diff --git a/cheat-base/cheat-base.vcxproj b/cheat-base/cheat-base.vcxproj
index 10266a0..5f13907 100644
--- a/cheat-base/cheat-base.vcxproj
+++ b/cheat-base/cheat-base.vcxproj
@@ -125,7 +125,7 @@
pch.h
stdcpp20
$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\
- stdc17
+ Default
@@ -158,7 +158,7 @@
MaxSpeed
true
false
- stdc17
+ Default
@@ -193,7 +193,7 @@
MaxSpeed
true
false
- stdc17
+ Default
@@ -222,7 +222,7 @@
_DEBUG;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)
Use
pch.h
- stdc17
+ Default
ProgramDatabase
false
false
@@ -242,7 +242,7 @@
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)
Use
pch.h
- stdc17
+ Default
detours-$(PlatformShortName).lib
@@ -259,7 +259,7 @@
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)
Use
pch.h
- stdc17
+ Default
detours-$(PlatformShortName).lib
@@ -298,6 +298,8 @@
+
+
@@ -335,6 +337,7 @@
+
@@ -365,6 +368,7 @@
+
@@ -410,6 +414,14 @@
pch.h
pch.h
+
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+
NotUsing
NotUsing
diff --git a/cheat-base/cheat-base.vcxproj.filters b/cheat-base/cheat-base.vcxproj.filters
index c8e131f..4fe5690 100644
--- a/cheat-base/cheat-base.vcxproj.filters
+++ b/cheat-base/cheat-base.vcxproj.filters
@@ -243,6 +243,15 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
@@ -335,5 +344,11 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
\ No newline at end of file
diff --git a/cheat-base/src/cheat-base/HookManager.h b/cheat-base/src/cheat-base/HookManager.h
index 41b3f85..9cc2d31 100644
--- a/cheat-base/src/cheat-base/HookManager.h
+++ b/cheat-base/src/cheat-base/HookManager.h
@@ -17,7 +17,7 @@ public:
}
template
- [[nodiscard]] static Fn getOrigin(Fn handler, const char* callerName = nullptr) noexcept
+ static Fn getOrigin(Fn handler, const char* callerName = nullptr) noexcept
{
if (holderMap.count(reinterpret_cast(handler)) == 0) {
LOG_WARNING("Origin not found for handler: %s. Maybe racing bug.", callerName == nullptr ? "" : callerName);
@@ -27,14 +27,17 @@ public:
}
template
- [[nodiscard]] static void detach(Fn handler) noexcept
+ static void detach(Fn handler) noexcept
{
disable(handler);
holderMap.erase(reinterpret_cast(handler));
}
+ // I don't know why
+#ifdef _WIN64
+
template
- [[nodiscard]] static RType call(RType(*handler)(Params...), const char* callerName = nullptr, Params... params)
+ static RType call(RType(*handler)(Params...), const char* callerName = nullptr, Params... params)
{
auto origin = getOrigin(handler, callerName);
if (origin != nullptr)
@@ -43,6 +46,30 @@ public:
return RType();
}
+#else
+
+ template
+ static RType call(RType(__cdecl *handler)(Params...), const char* callerName = nullptr, Params... params)
+ {
+ auto origin = getOrigin(handler, callerName);
+ if (origin != nullptr)
+ return origin(params...);
+
+ return RType();
+ }
+
+ template
+ static RType call(RType(__stdcall *handler)(Params...), const char* callerName = nullptr, Params... params)
+ {
+ auto origin = getOrigin(handler, callerName);
+ if (origin != nullptr)
+ return origin(params...);
+
+ return RType();
+ }
+
+#endif
+
static void detachAll() noexcept
{
for (const auto &[key, value] : holderMap)
diff --git a/cheat-base/src/cheat-base/ISerializable.h b/cheat-base/src/cheat-base/ISerializable.h
new file mode 100644
index 0000000..19dab63
--- /dev/null
+++ b/cheat-base/src/cheat-base/ISerializable.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include
+
+class ISerializable
+{
+public:
+ virtual void to_json(nlohmann::json& j) const = 0;
+ virtual void from_json(const nlohmann::json& j) = 0;
+};
+
+inline void to_json(nlohmann::json& j, const ISerializable& ser)
+{
+ ser.to_json(j);
+}
+
+inline void from_json(const nlohmann::json& j, ISerializable& ser)
+{
+ ser.from_json(j);
+}
\ No newline at end of file
diff --git a/cheat-base/src/cheat-base/PipeTransfer.cpp b/cheat-base/src/cheat-base/PipeTransfer.cpp
index b4f616f..28664a4 100644
--- a/cheat-base/src/cheat-base/PipeTransfer.cpp
+++ b/cheat-base/src/cheat-base/PipeTransfer.cpp
@@ -16,18 +16,22 @@ PipeTransfer::PipeTransfer(const std::string& name)
PipeTransfer::~PipeTransfer()
{
- if (m_Pipe)
- CloseHandle(m_Pipe);
+ Close();
}
bool PipeTransfer::Create()
{
- if (m_Pipe)
- CloseHandle(m_Pipe);
+ Close();
m_Pipe = CreateNamedPipe(m_Name.c_str(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 256 * 1024, 16, INFINITE, NULL);
return IsPipeOpened();
}
+void PipeTransfer::Close()
+{
+ if (m_Pipe)
+ CloseHandle(m_Pipe);
+}
+
bool PipeTransfer::IsPipeOpened()
{
return m_Pipe && m_Pipe != INVALID_HANDLE_VALUE;
diff --git a/cheat-base/src/cheat-base/PipeTransfer.h b/cheat-base/src/cheat-base/PipeTransfer.h
index 8b91386..a5195a3 100644
--- a/cheat-base/src/cheat-base/PipeTransfer.h
+++ b/cheat-base/src/cheat-base/PipeTransfer.h
@@ -20,6 +20,7 @@ public:
~PipeTransfer();
bool Create();
+ void Close();
bool Connect();
bool WaitForConnection();
bool IsPipeOpened();
diff --git a/cheat-base/src/cheat-base/cheat/CheatManagerBase.cpp b/cheat-base/src/cheat-base/cheat/CheatManagerBase.cpp
index 352fabc..3930a32 100644
--- a/cheat-base/src/cheat-base/cheat/CheatManagerBase.cpp
+++ b/cheat-base/src/cheat-base/cheat/CheatManagerBase.cpp
@@ -10,9 +10,9 @@
namespace cheat
{
- void CheatManagerBase::Init(LPBYTE pFontData, DWORD dFontDataSize)
+ void CheatManagerBase::Init(LPBYTE pFontData, DWORD dFontDataSize, renderer::DXVersion dxVersion)
{
- renderer::Init(pFontData, dFontDataSize);
+ renderer::Init(pFontData, dFontDataSize, dxVersion);
events::RenderEvent += MY_METHOD_HANDLER(CheatManagerBase::OnRender);
events::KeyUpEvent += MY_METHOD_HANDLER(CheatManagerBase::OnKeyUp);
diff --git a/cheat-base/src/cheat-base/cheat/CheatManagerBase.h b/cheat-base/src/cheat-base/cheat/CheatManagerBase.h
index fd8f2dc..3bb5e53 100644
--- a/cheat-base/src/cheat-base/cheat/CheatManagerBase.h
+++ b/cheat-base/src/cheat-base/cheat/CheatManagerBase.h
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include
#include