Compare commits

..

No commits in common. "3c1fc7f53d1613377b4e51820b9fe5ad46631174" and "f4e6a714a4e28ec8add6fb5ae3baa6b91ad8ef10" have entirely different histories.

9 changed files with 80 additions and 253 deletions

View File

@ -59,7 +59,7 @@ build_windows:
image: fedora:35 image: fedora:35
script: script:
- dnf -y install wine wget p7zip sed dos2unix python - dnf -y install wine wget p7zip sed dos2unix
- unix2dos *.txt - unix2dos *.txt
- unix2dos files_example/*.txt files_example/*/*.txt - unix2dos files_example/*.txt files_example/*/*.txt
- sed -i 's/..\\vcpkg\\installed\\/.\\protobuf_/g' build_set_protobuf_directories.bat - sed -i 's/..\\vcpkg\\installed\\/.\\protobuf_/g' build_set_protobuf_directories.bat
@ -69,9 +69,27 @@ build_windows:
- 7za x protobuf_x86-windows-static.7z -oprotobuf_x86-windows-static - 7za x protobuf_x86-windows-static.7z -oprotobuf_x86-windows-static
- 7za x protobuf_x64-windows-static.7z -oprotobuf_x64-windows-static - 7za x protobuf_x64-windows-static.7z -oprotobuf_x64-windows-static
- 7za x sdk_standalone.7z -osdk_standalone - 7za x sdk_standalone.7z -osdk_standalone
- python generate_build_win_bat.py - DLL_FILES="$(ls dll/*.cpp | tr "\n" " ")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls detours/*.cpp | tr "\n" " ")"; sed "s|detours/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls overlay_experimental/*.cpp | tr "\n" " ")"; sed "s|overlay_experimental/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls overlay_experimental/windows/*.cpp | tr "\n" " ")"; sed "s|overlay_experimental/windows/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls ImGui/*.cpp | tr "\n" " ")"; sed "s|ImGui/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls ImGui/backends/imgui_impl_dx*.cpp | tr "\n" " ")"; sed "s|ImGui/backends/imgui_impl_dx\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls overlay_experimental/System/*.cpp | tr "\n" " ")"; sed "s|overlay_experimental/System/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls dll/*.proto | tr "\n" " " | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls steamclient_loader/*.cpp | tr "\n" " ")"; sed "s|steamclient_loader/\*.cpp|$DLL_FILES|g" -i *.bat
- sed "s| /MP12 | /MP4 |g" -i *.bat
- export WINEDEBUG=-all - export WINEDEBUG=-all
- wine cmd /c build_win_release_test.bat - wine cmd /c build_win_debug_experimental.bat
- mkdir debug_experimental
- mv steam_api.dll steam_api64.dll debug_experimental/
- wine cmd /c build_win_release.bat
- mv debug_experimental release/
- rm -f steamclient.dll steamclient64.dll
- wine cmd /c build_win_debug_experimental_steamclient.bat
- mkdir release/debug_experimental_steamclient
- mv steamclient.dll steamclient64.dll release/debug_experimental_steamclient/
- cp Readme_debug.txt release/debug_experimental/Readme.txt
artifacts: artifacts:
paths: paths:
- release/ - release/

View File

@ -1,127 +0,0 @@
import os
def files_from_dir(dir, extension, filter=[]):
out = []
for f in os.listdir(dir):
if f.endswith(extension) and f not in filter:
out.append(os.path.join(dir, f))
return out
def convert_to_obj(files, obj_dir):
out = []
for f in files:
out.append(os.path.join(obj_dir, os.path.splitext(os.path.basename(f))[0] + ".obj"))
return out
def cl_line_obj(arguments, out_dir):
return "rmdir /S /Q {0}\nmkdir {0}\ncl /Fo:{0}/ /c {1}\n".format(out_dir, ' '.join(arguments))
def cl_line_link(arguments, linker_arguments):
return "cl /LD {} /link {}\n".format(' '.join(arguments), ' '.join(linker_arguments))
def cl_line_exe(arguments, linker_arguments):
return "cl {} /link {}\n".format(' '.join(arguments), ' '.join(linker_arguments))
jobs = 4
normal_build_args = ["/EHsc", "/Ox", "/MP{}".format(jobs)]
includes = ["ImGui", "overlay_experimental"]
includes_32 = list(map(lambda a: '/I{}'.format(a), ["%PROTOBUF_X86_DIRECTORY%\\include\\"] + includes))
includes_64 = list(map(lambda a: '/I{}'.format(a), ["%PROTOBUF_X64_DIRECTORY%\\include\\"] + includes))
debug_build_args = []
release_build_args = ["/DEMU_RELEASE_BUILD", "/DNDEBUG"]
steamclient_build_args = ["/DSTEAMCLIENT_DLL"]
experimental_build_args = ["/DEMU_EXPERIMENTAL_BUILD", "/DCONTROLLER_SUPPORT", "/DEMU_OVERLAY"]
steamclient_experimental_build_args = experimental_build_args + steamclient_build_args
normal_linker_libs = ["Iphlpapi.lib", "Ws2_32.lib", "rtlgenrandom.lib", "Shell32.lib"]
experimental_linker_libs = ["opengl32.lib", "Winmm.lib"] + normal_linker_libs
linker_32 = ['"%PROTOBUF_X86_LIBRARY%"']
linker_64 = ['"%PROTOBUF_X64_LIBRARY%"']
controller_deps = ["controller/gamepad.c"]
imgui_deps = files_from_dir("ImGui", ".cpp") + ["ImGui/backends/imgui_impl_dx9.cpp", "ImGui/backends/imgui_impl_dx10.cpp", "ImGui/backends/imgui_impl_dx11.cpp", "ImGui/backends/imgui_impl_dx12.cpp", "ImGui/backends/imgui_impl_win32.cpp", "ImGui/backends/imgui_impl_vulkan.cpp", "ImGui/backends/imgui_impl_opengl3.cpp", "ImGui/backends/imgui_win_shader_blobs.cpp"]
proto_deps = list(map(lambda a: a.replace(".proto", ".pb.cc"), files_from_dir("dll", ".proto")))
all_deps = proto_deps + files_from_dir("detours", ".cpp") + controller_deps + imgui_deps + files_from_dir("overlay_experimental/System", ".cpp")
sc_different_deps = ["flat.cpp", "dll.cpp"]
steam_deps = files_from_dir("dll", ".cpp", sc_different_deps)
overlay_deps = files_from_dir("overlay_experimental", ".cpp") + files_from_dir("overlay_experimental/windows", ".cpp")
experimental_steam_deps = steam_deps + overlay_deps
sc_different_deps = list(map(lambda a: "dll/" + a, sc_different_deps))
regular_files = []
head = """@echo off
cd /d "%~dp0"
rmdir /S /Q release
mkdir release
mkdir release\experimental
mkdir release\experimental_steamclient
mkdir release\debug_experimental
mkdir release\debug_experimental_steamclient
call build_set_protobuf_directories.bat
"""
head_32bit = """"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\\net.proto
call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
"""
head_64bit = """"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\\net.proto
call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
"""
footer = """
copy Readme_release.txt release\Readme.txt
xcopy /s files_example\* release\\
copy Readme_experimental.txt release\experimental\Readme.txt
copy Readme_debug.txt release\debug_experimental\Readme.txt
copy steamclient_loader\ColdClientLoader.ini release\experimental_steamclient\\
call build_win_lobby_connect.bat
call build_win_find_interfaces.bat
"""
out = head
out += head_32bit
deps_folder = "deps"
sc_deps_folder = "deps_sc"
def generate_common(include_arch, linker_arch, steam_api_name, steamclient_name):
out = ""
out += cl_line_obj(normal_build_args + release_build_args + include_arch + all_deps, deps_folder)
out += cl_line_link(normal_build_args + release_build_args + include_arch + steam_deps + sc_different_deps + ["deps/net.pb.obj"] + linker_arch + normal_linker_libs, ["/debug:none", "/OUT:release\\{}".format(steam_api_name)])
debug_full_args = normal_build_args + debug_build_args + experimental_build_args + include_arch
out += cl_line_obj(debug_full_args + experimental_steam_deps, sc_deps_folder)
debug_full_dll_args = debug_full_args + sc_different_deps + convert_to_obj(all_deps, deps_folder) + convert_to_obj(experimental_steam_deps, sc_deps_folder) + linker_arch + experimental_linker_libs
out += cl_line_link(debug_full_dll_args, ["/OUT:release\debug_experimental\\{}".format(steam_api_name)])
out += cl_line_link(steamclient_build_args + debug_full_dll_args, ["/OUT:release\debug_experimental_steamclient\\{}".format(steamclient_name)])
release_full_args = normal_build_args + release_build_args + experimental_build_args + include_arch
out += cl_line_obj(release_full_args + experimental_steam_deps, sc_deps_folder)
release_full_dll_args = release_full_args + sc_different_deps + convert_to_obj(all_deps, deps_folder) + convert_to_obj(experimental_steam_deps, sc_deps_folder) + linker_arch + experimental_linker_libs
out += cl_line_link(release_full_dll_args, ["/debug:none", "/OUT:release\experimental\\{}".format(steam_api_name)])
out += cl_line_link(steamclient_build_args + release_full_dll_args, ["/debug:none", "/OUT:release\experimental_steamclient\\{}".format(steamclient_name)])
out += cl_line_link(release_build_args + experimental_build_args + ["steamclient.cpp"] + normal_build_args, ["/debug:none", "/OUT:release\experimental\\{}".format(steamclient_name)])
return out
out += generate_common(includes_32, linker_32, "steam_api.dll", "steamclient.dll")
out += cl_line_exe(files_from_dir("steamclient_loader", ".cpp") + ["advapi32.lib", "user32.lib"] + normal_build_args, ["/debug:none", "/OUT:release\experimental_steamclient\steamclient_loader.exe"])
out += head_64bit
out += generate_common(includes_64, linker_64, "steam_api64.dll", "steamclient64.dll")
out += footer
with open("build_win_release_test.bat", "w") as f:
f.write(out)

View File

@ -68,15 +68,6 @@ public:
return instance; return instance;
} }
static void deleteInst()
{
if (instance != nullptr)
{
delete instance;
instance = nullptr;
}
}
~Renderer_Detector() ~Renderer_Detector()
{ {
delete dx9_hook; delete dx9_hook;
@ -104,8 +95,7 @@ private:
dx12_hook(nullptr), dx12_hook(nullptr),
opengl_hook(nullptr), opengl_hook(nullptr),
vulkan_hook(nullptr), vulkan_hook(nullptr),
detection_done(false), detection_done(false)
force_done(false)
{ {
std::wstring tmp(4096, L'\0'); std::wstring tmp(4096, L'\0');
tmp.resize(GetSystemDirectoryW(&tmp[0], tmp.size())); tmp.resize(GetSystemDirectoryW(&tmp[0], tmp.size()));
@ -152,7 +142,7 @@ private:
OpenGL_Hook* opengl_hook; OpenGL_Hook* opengl_hook;
Vulkan_Hook* vulkan_hook; Vulkan_Hook* vulkan_hook;
bool detection_done, force_done; bool detection_done;
std::condition_variable stop_detection_cv; std::condition_variable stop_detection_cv;
std::mutex stop_detection_mutex; std::mutex stop_detection_mutex;
@ -1053,7 +1043,7 @@ public:
std::lock_guard<std::mutex> lk(renderer_mutex); std::lock_guard<std::mutex> lk(renderer_mutex);
if (detection_done) if (detection_done)
{ {
if (renderer_hook != nullptr || force_done) if (renderer_hook != nullptr)
return renderer_hook; return renderer_hook;
detection_done = false; detection_done = false;
@ -1132,7 +1122,6 @@ public:
{ {
System::scoped_lock lk(renderer_mutex, stop_detection_mutex); System::scoped_lock lk(renderer_mutex, stop_detection_mutex);
detection_done = true; detection_done = true;
force_done = true;
} }
stop_detection_cv.notify_all(); stop_detection_cv.notify_all();
} }
@ -1264,7 +1253,7 @@ public:
std::lock_guard<std::mutex> lk(renderer_mutex); std::lock_guard<std::mutex> lk(renderer_mutex);
if (detection_done) if (detection_done)
{ {
if (renderer_hook != nullptr || force_done) if (renderer_hook != nullptr)
return renderer_hook; return renderer_hook;
detection_done = false; detection_done = false;
@ -1316,7 +1305,6 @@ public:
{ {
System::scoped_lock lk(renderer_mutex, stop_detection_mutex); System::scoped_lock lk(renderer_mutex, stop_detection_mutex);
detection_done = true; detection_done = true;
force_done = true;
} }
stop_detection_cv.notify_all(); stop_detection_cv.notify_all();
} }
@ -1444,7 +1432,7 @@ public:
std::lock_guard<std::mutex> lk(renderer_mutex); std::lock_guard<std::mutex> lk(renderer_mutex);
if (detection_done) if (detection_done)
{ {
if (renderer_hook != nullptr || force_done) if (renderer_hook != nullptr)
return renderer_hook; return renderer_hook;
detection_done = false; detection_done = false;
@ -1496,7 +1484,6 @@ public:
{ {
System::scoped_lock lk(renderer_mutex, stop_detection_mutex); System::scoped_lock lk(renderer_mutex, stop_detection_mutex);
detection_done = true; detection_done = true;
force_done = true;
} }
stop_detection_cv.notify_all(); stop_detection_cv.notify_all();
} }
@ -1518,9 +1505,4 @@ void StopRendererDetection()
Renderer_Detector::Inst()->stop_detection(); Renderer_Detector::Inst()->stop_detection();
} }
void FreeRendererDetection()
{
Renderer_Detector::deleteInst();
}
} }

View File

@ -31,5 +31,5 @@ namespace ingame_overlay {
std::future<Renderer_Hook*> DetectRenderer(std::chrono::milliseconds timeout = std::chrono::milliseconds{ -1 }); std::future<Renderer_Hook*> DetectRenderer(std::chrono::milliseconds timeout = std::chrono::milliseconds{ -1 });
void StopRendererDetection(); void StopRendererDetection();
void FreeRendererDetection();
} }

View File

@ -101,25 +101,14 @@ bool X11_Hook::StartHook(std::function<bool(bool)>& _key_combination_callback, s
return false; return false;
} }
struct { XEventsQueued = libX11.GetSymbol<decltype(::XEventsQueued)>("XEventsQueued");
void** func_ptr; XPending = libX11.GetSymbol<decltype(::XPending)>("XPending");
void* hook_ptr;
const char* func_name;
} hook_array[] = {
{ (void**)&XEventsQueued, &X11_Hook::MyXEventsQueued, "XEventsQueued" },
{ (void**)&XPending , &X11_Hook::MyXPending , "XPending" },
};
for (auto& entry : hook_array) if (XPending == nullptr || XEventsQueued == nullptr)
{ {
*entry.func_ptr = libX11.GetSymbol<void*>(entry.func_name); SPDLOG_WARN("Failed to hook X11: Cannot load functions.({}, {})", DLL_NAME, (void*)XEventsQueued, (void*)XPending);
if (entry.func_ptr == nullptr) return false;
{
SPDLOG_ERROR("Failed to hook X11: Event function {} missing.", entry.func_name);
return false;
}
} }
SPDLOG_INFO("Hooked X11"); SPDLOG_INFO("Hooked X11");
_KeyCombinationCallback = std::move(_key_combination_callback); _KeyCombinationCallback = std::move(_key_combination_callback);
@ -135,13 +124,12 @@ bool X11_Hook::StartHook(std::function<bool(bool)>& _key_combination_callback, s
_Hooked = true; _Hooked = true;
UnhookAll();
BeginHook(); BeginHook();
HookFuncs(
for (auto& entry : hook_array) std::make_pair<void**, void*>(&(void*&)XEventsQueued, (void*)&X11_Hook::MyXEventsQueued),
{ std::make_pair<void**, void*>(&(void*&)XPending, (void*)&X11_Hook::MyXPending)
HookFunc(std::make_pair(entry.func_ptr, entry.hook_ptr)); );
}
EndHook(); EndHook();
} }
return true; return true;

View File

@ -207,7 +207,6 @@ void Steam_Overlay::UnSetupOverlay()
if (!Ready() && future_renderer.valid()) { if (!Ready() && future_renderer.valid()) {
if (future_renderer.wait_for(std::chrono::milliseconds{500}) == std::future_status::ready) { if (future_renderer.wait_for(std::chrono::milliseconds{500}) == std::future_status::ready) {
future_renderer.get(); future_renderer.get();
ingame_overlay::FreeRendererDetection();
} }
} }
} }

View File

@ -93,30 +93,24 @@ bool Windows_Hook::StartHook(std::function<bool(bool)>& _key_combination_callbac
return false; return false;
} }
struct { GetRawInputBuffer = libUser32.GetSymbol<decltype(::GetRawInputBuffer)>("GetRawInputBuffer");
void** func_ptr; GetRawInputData = libUser32.GetSymbol<decltype(::GetRawInputData)>("GetRawInputData");
void* hook_ptr; GetKeyState = libUser32.GetSymbol<decltype(::GetKeyState)>("GetKeyState");
const char* func_name; GetAsyncKeyState = libUser32.GetSymbol<decltype(::GetAsyncKeyState)>("GetAsyncKeyState");
} hook_array[] = { GetKeyboardState = libUser32.GetSymbol<decltype(::GetKeyboardState)>("GetKeyboardState");
{ (void**)&GetRawInputBuffer, &Windows_Hook::MyGetRawInputBuffer, "GetRawInputBuffer" }, GetCursorPos = libUser32.GetSymbol<decltype(::GetCursorPos)>("GetCursorPos");
{ (void**)&GetRawInputData , &Windows_Hook::MyGetRawInputData , "GetRawInputData" }, SetCursorPos = libUser32.GetSymbol<decltype(::SetCursorPos)>("SetCursorPos");
{ (void**)&GetKeyState , &Windows_Hook::MyGetKeyState , "GetKeyState" },
{ (void**)&GetAsyncKeyState , &Windows_Hook::MyGetAsyncKeyState , "GetAsyncKeyState" },
{ (void**)&GetKeyboardState , &Windows_Hook::MyGetKeyboardState , "GetKeyboardState" },
{ (void**)&GetCursorPos , &Windows_Hook::MyGetCursorPos , "GetCursorPos" },
{ (void**)&SetCursorPos , &Windows_Hook::MySetCursorPos , "SetCursorPos" },
{ (void**)&GetClipCursor , &Windows_Hook::MyGetClipCursor , "GetClipCursor" },
{ (void**)&ClipCursor , &Windows_Hook::MyClipCursor , "ClipCursor" },
};
for (auto& entry : hook_array) if(GetRawInputBuffer == nullptr ||
GetRawInputData == nullptr ||
GetKeyState == nullptr ||
GetAsyncKeyState == nullptr ||
GetKeyboardState == nullptr ||
GetCursorPos == nullptr ||
SetCursorPos == nullptr)
{ {
*entry.func_ptr = libUser32.GetSymbol<void*>(entry.func_name); SPDLOG_ERROR("Failed to hook Windows: Events functions missing.");
if (entry.func_ptr == nullptr) return false;
{
SPDLOG_ERROR("Failed to hook Windows: Events function {} missing.", entry.func_name);
return false;
}
} }
SPDLOG_INFO("Hooked Windows"); SPDLOG_INFO("Hooked Windows");
@ -132,12 +126,15 @@ bool Windows_Hook::StartHook(std::function<bool(bool)>& _key_combination_callbac
} }
BeginHook(); BeginHook();
HookFuncs(
for (auto& entry : hook_array) std::make_pair<void**, void*>(&(PVOID&)GetRawInputBuffer, &Windows_Hook::MyGetRawInputBuffer),
{ std::make_pair<void**, void*>(&(PVOID&)GetRawInputData , &Windows_Hook::MyGetRawInputData),
HookFunc(std::make_pair(entry.func_ptr, entry.hook_ptr)); std::make_pair<void**, void*>(&(PVOID&)GetKeyState , &Windows_Hook::MyGetKeyState),
} std::make_pair<void**, void*>(&(PVOID&)GetAsyncKeyState , &Windows_Hook::MyGetAsyncKeyState),
std::make_pair<void**, void*>(&(PVOID&)GetKeyboardState , &Windows_Hook::MyGetKeyboardState),
std::make_pair<void**, void*>(&(PVOID&)GetCursorPos , &Windows_Hook::MyGetCursorPos),
std::make_pair<void**, void*>(&(PVOID&)SetCursorPos , &Windows_Hook::MySetCursorPos)
);
EndHook(); EndHook();
_Hooked = true; _Hooked = true;
@ -292,11 +289,6 @@ LRESULT CALLBACK Windows_Hook::HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam,
// Save the last known cursor pos when opening the overlay // Save the last known cursor pos when opening the overlay
// so we can spoof the GetCursorPos return value. // so we can spoof the GetCursorPos return value.
inst->GetCursorPos(&inst->_SavedCursorPos); inst->GetCursorPos(&inst->_SavedCursorPos);
inst->GetClipCursor(&inst->_SavedClipCursor);
}
else
{
inst->ClipCursor(&inst->_SavedClipCursor);
} }
inst->_KeyCombinationPushed = true; inst->_KeyCombinationPushed = true;
} }
@ -415,33 +407,16 @@ BOOL WINAPI Windows_Hook::MySetCursorPos(int X, int Y)
{ {
Windows_Hook* inst = Windows_Hook::Inst(); Windows_Hook* inst = Windows_Hook::Inst();
if (!inst->_Initialized || !inst->_KeyCombinationCallback(false)) if (inst->_Initialized && inst->_KeyCombinationCallback(false))
return inst->SetCursorPos(X, Y); {// That way, it will fail only if the real API fails.
// Hides error messages on some Unity debug builds.
POINT pos;
inst->GetCursorPos(&pos);
X = pos.x;
Y = pos.y;
}
return TRUE; return inst->SetCursorPos(X, Y);
}
BOOL WINAPI Windows_Hook::MyGetClipCursor(RECT* lpRect)
{
Windows_Hook* inst = Windows_Hook::Inst();
if (lpRect == nullptr || !inst->_Initialized || !inst->_KeyCombinationCallback(false))
return inst->GetClipCursor(lpRect);
*lpRect = inst->_SavedClipCursor;
return TRUE;
}
BOOL WINAPI Windows_Hook::MyClipCursor(CONST RECT* lpRect)
{
Windows_Hook* inst = Windows_Hook::Inst();
CONST RECT* v = lpRect == nullptr ? &inst->_DefaultClipCursor : lpRect;
inst->_SavedClipCursor = *v;
if (!inst->_Initialized || !inst->_KeyCombinationCallback(false))
return inst->ClipCursor(v);
return inst->ClipCursor(&inst->_DefaultClipCursor);
} }
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
@ -452,8 +427,12 @@ Windows_Hook::Windows_Hook() :
_RecurseCallCount(0), _RecurseCallCount(0),
_GameHwnd(nullptr), _GameHwnd(nullptr),
_GameWndProc(nullptr), _GameWndProc(nullptr),
_DefaultClipCursor{ LONG(0xFFFF8000), LONG(0xFFFF8000), LONG(0x00007FFF), LONG(0x00007FFF) }, _KeyCombinationPushed(false),
_KeyCombinationPushed(false) GetRawInputBuffer(nullptr),
GetRawInputData(nullptr),
GetKeyState(nullptr),
GetAsyncKeyState(nullptr),
GetKeyboardState(nullptr)
{ {
} }

View File

@ -37,8 +37,6 @@ private:
HWND _GameHwnd; HWND _GameHwnd;
WNDPROC _GameWndProc; WNDPROC _GameWndProc;
POINT _SavedCursorPos; POINT _SavedCursorPos;
RECT _SavedClipCursor;
CONST RECT _DefaultClipCursor;
// In (bool): Is toggle wanted // In (bool): Is toggle wanted
// Out(bool): Is the overlay visible, if true, inputs will be disabled // Out(bool): Is the overlay visible, if true, inputs will be disabled
@ -57,8 +55,6 @@ private:
decltype(::GetKeyboardState) *GetKeyboardState; decltype(::GetKeyboardState) *GetKeyboardState;
decltype(::GetCursorPos) *GetCursorPos; decltype(::GetCursorPos) *GetCursorPos;
decltype(::SetCursorPos) *SetCursorPos; decltype(::SetCursorPos) *SetCursorPos;
decltype(::GetClipCursor) *GetClipCursor;
decltype(::ClipCursor) *ClipCursor;
static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader); static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
@ -68,8 +64,6 @@ private:
static BOOL WINAPI MyGetKeyboardState(PBYTE lpKeyState); static BOOL WINAPI MyGetKeyboardState(PBYTE lpKeyState);
static BOOL WINAPI MyGetCursorPos(LPPOINT lpPoint); static BOOL WINAPI MyGetCursorPos(LPPOINT lpPoint);
static BOOL WINAPI MySetCursorPos(int X, int Y); static BOOL WINAPI MySetCursorPos(int X, int Y);
static BOOL WINAPI MyGetClipCursor(RECT* lpRect);
static BOOL WINAPI MyClipCursor(CONST RECT* lpRect);
public: public:
std::string LibraryName; std::string LibraryName;

View File

@ -11,7 +11,6 @@ STAT_TYPE_BITS = '4'
def generate_stats_achievements(schema, config_directory): def generate_stats_achievements(schema, config_directory):
schema = vdf.binary_loads(schema) schema = vdf.binary_loads(schema)
# print(schema)
achievements_out = [] achievements_out = []
stats_out = [] stats_out = []
@ -55,19 +54,14 @@ def generate_stats_achievements(schema, config_directory):
out['default'] = stat['default'] out['default'] = stat['default']
stats_out += [out] stats_out += [out]
#print(stat_info[s]) # print(stat_info[s])
output_ach = json.dumps(achievements_out, indent=4) output_ach = json.dumps(achievements_out, indent=4)
output_stats = "" output_stats = ""
for s in stats_out: for s in stats_out:
default_num = 0 output_stats += "{}={}={}\n".format(s['name'], s['type'], s['default'])
if (s['type'] == 'int'):
default_num = int(s['default'])
else:
default_num = float(s['default'])
output_stats += "{}={}={}\n".format(s['name'], s['type'], default_num)
# print(output_ach) # print(output_ach)
# print(output_stats) # print(output_stats)
@ -78,7 +72,7 @@ def generate_stats_achievements(schema, config_directory):
with open(os.path.join(config_directory, "achievements.json"), 'w') as f: with open(os.path.join(config_directory, "achievements.json"), 'w') as f:
f.write(output_ach) f.write(output_ach)
with open(os.path.join(config_directory, "stats.txt"), 'w', encoding='utf-8') as f: with open(os.path.join(config_directory, "stats.txt"), 'w') as f:
f.write(output_stats) f.write(output_stats)
return (achievements_out, stats_out) return (achievements_out, stats_out)