Fix but with radio scroll #45 & config save

This commit is contained in:
Grinch_ 2021-02-09 23:25:21 +06:00
parent adf52ae50c
commit 86286d63d6
3 changed files with 13 additions and 6 deletions

View File

@ -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 += []

View File

@ -12,7 +12,7 @@ bool Hook::show_mouse = false;
std::function<void()> 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);
}
}

View File

@ -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: