From 86286d63d6a206d1449f44d828d43fe4787b7878 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Tue, 9 Feb 2021 23:25:21 +0600 Subject: [PATCH] Fix but with radio scroll #45 & config save --- src/CheatMenu.cpp | 6 +++++- src/Hook.cpp | 11 +++++++---- src/Hook.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/CheatMenu.cpp b/src/CheatMenu.cpp index 72ef016..773ba17 100644 --- a/src/CheatMenu.cpp +++ b/src/CheatMenu.cpp @@ -86,7 +86,11 @@ CheatMenu::CheatMenu() Events::drawMenuBackgroundEvent += [this] { - Hook::show_mouse = false; + if (Hook::show_mouse) + { + config.WriteToDisk(); + Hook::show_mouse = false; + } }; Events::shutdownRwEvent += [] diff --git a/src/Hook.cpp b/src/Hook.cpp index 35935b4..5e2caa8 100644 --- a/src/Hook.cpp +++ b/src/Hook.cpp @@ -12,7 +12,7 @@ bool Hook::show_mouse = false; std::function Hook::window_func = NULL; -LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam); @@ -20,6 +20,9 @@ LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam { patch::Nop(0x4EB9F4, 5); // disable radio scroll Call<0x541BD0>(); // CPad::ClearMouseHistory + + if (uMsg == WM_MOUSEWHEEL) + return 1; } else patch::SetRaw(0x4EB9F4, (void*)"\xE8\x67\xFC\xFF\xFF", 5); // enable radio scroll @@ -29,8 +32,8 @@ LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam Call<0x53F1E0>(); // CPad::ClearKeyboardHistory return 1; } - else - return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam); + + return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam); } HRESULT Hook::Reset(IDirect3DDevice9 * pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters) @@ -117,7 +120,7 @@ void Hook::Present(void *ptr) io.LogFilename = NULL; style.WindowTitleAlign = ImVec2(0.5, 0.5); - oWndProc = (WNDPROC)SetWindowLongPtr(RsGlobal.ps->window, GWL_WNDPROC, (LRESULT)InputProc); + oWndProc = (WNDPROC)SetWindowLongPtr(RsGlobal.ps->window, GWL_WNDPROC, (LRESULT)WndProc); } } diff --git a/src/Hook.h b/src/Hook.h index 4805414..c3d0d4c 100644 --- a/src/Hook.h +++ b/src/Hook.h @@ -20,7 +20,7 @@ private: static HRESULT CALLBACK PresentDx9Handler(IDirect3DDevice9 *pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion); static HRESULT CALLBACK PresentDx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags); static HRESULT CALLBACK Reset(IDirect3DDevice9 * pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters); - static LRESULT CALLBACK InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static void ShowMouse(bool state); protected: