Revert to using SilentPatch mouse fix, fixes
This commit is contained in:
parent
592b52f731
commit
8ca1ad805a
@ -24,14 +24,13 @@ If you have those mentioned versions installed follow the steps below,
|
||||
1. Install [DirectX9](https://www.microsoft.com/en-us/download/details.aspx?id=35), [Visual C++ Redistributable 2022 x86](https://aka.ms/vs/17/release/vc_redist.x86.exe) & [Asi loader](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases).
|
||||
2. Download [**CheatMenuSA/VC/III.7z**](https://github.com/user-grinch/Cheat-Menu/releases) and extract everything in game root directory. The **CheatMenu** folder & **.asi** file must be placed in the same place.
|
||||
|
||||
3. Install [SilentPatch](https://gtaforums.com/topic/669045-silentpatch/) (required)
|
||||
|
||||
### For III & VC
|
||||
3. Install [D3D8to9 wrapper](https://github.com/crosire/d3d8to9/releases). Sometimes the asi loader blocks **d3d8.dll** file. Just delete the **Globals.ini** file and you should be good to go.
|
||||
|
||||
Be sure to check [here](https://github.com/user-grinch/Cheat-Menu/issues/48) to know about incompatibilities with other mods.
|
||||
|
||||
### Optional
|
||||
- Install [SilentPatch](https://gtaforums.com/topic/669045-silentpatch/) (If you're having mouse movement or click issues)
|
||||
|
||||
## Things to do on crash
|
||||
1. Delete the `CheatMenu/json/config.json` file and try again.
|
||||
2. If it's happening after installing a recent mod try removing it. A list of incompatibile mods are [here](https://github.com/user-grinch/Cheat-Menu/issues/48).
|
||||
|
@ -6,22 +6,6 @@
|
||||
|
||||
void MenuThread(void* param)
|
||||
{
|
||||
/*
|
||||
Had to put this in place since some people put the folder in root
|
||||
directory and the asi in modloader. Why??
|
||||
|
||||
TODO: Unlikely they'd even read the log so have to do something else
|
||||
*/
|
||||
if (!std::filesystem::is_directory(PLUGIN_PATH((char*)"CheatMenu")))
|
||||
{
|
||||
gLog << "CheatMenu folder not found. You need to put both \"CheatMenu.asi\" & \"CheatMenu\" folder in the same directory" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
Hook::ApplyMouseFix();
|
||||
#endif
|
||||
|
||||
static bool bGameInit = false;
|
||||
|
||||
// Wait till game init
|
||||
@ -35,6 +19,29 @@ void MenuThread(void* param)
|
||||
Sleep(1000);
|
||||
}
|
||||
|
||||
/*
|
||||
Had to put this in place since some people put the folder in root
|
||||
directory and the asi in modloader. Why??
|
||||
|
||||
TODO: Unlikely they'd even read the log so have to do something else
|
||||
*/
|
||||
if (!std::filesystem::is_directory(PLUGIN_PATH((char*)"CheatMenu")))
|
||||
{
|
||||
MessageBox(RsGlobal.ps->window, "CheatMenu folder not found. You need to put both \"CheatMenu.asi\" & \"CheatMenu\" folder in the same directory", "CheatMenu", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetModuleHandle(BY_GAME("SilentPatchSA.asi" ,"SilentPatchVC.asi" ,"SilentPatchIII.asi")))
|
||||
{
|
||||
int msgID = MessageBox(RsGlobal.ps->window, "SilentPatch not found. Do you want to install Silent Patch? (Game restart required)", "CheatMenu", MB_OKCANCEL | MB_DEFBUTTON1);
|
||||
|
||||
if (msgID == IDOK)
|
||||
{
|
||||
ShellExecute(nullptr, "open", "https://gtaforums.com/topic/669045-silentpatch/", nullptr, nullptr, SW_SHOWNORMAL);
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
/*
|
||||
TODO: Find a better way
|
||||
@ -46,6 +53,14 @@ void MenuThread(void* param)
|
||||
return;
|
||||
}
|
||||
CFastman92limitAdjuster::Init();
|
||||
#elif GTA3
|
||||
|
||||
// There's a issue with ddraw.dll, dunno how to fix atm
|
||||
if (GetModuleHandle("ddraw.dll"))
|
||||
{
|
||||
MessageBox(RsGlobal.ps->window, "Please remove the ddraw.dll (SilentPatch) from game directory and restart.", "CheatMenu", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
gLog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE "\nMore Info: "
|
||||
|
104
src/hook.cpp
104
src/hook.cpp
@ -137,7 +137,6 @@ void Hook::RenderFrame(void* ptr)
|
||||
io.IniFilename = nullptr;
|
||||
io.LogFilename = nullptr;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
|
||||
|
||||
oWndProc = (WNDPROC)SetWindowLongPtr(RsGlobal.ps->window, GWL_WNDPROC, (LRESULT)WndProc);
|
||||
}
|
||||
}
|
||||
@ -169,7 +168,7 @@ void Hook::ShowMouse(bool state)
|
||||
#endif
|
||||
|
||||
|
||||
if (isController && (m_bShowMouse || bMouseDisabled))
|
||||
if (isController && (state || bMouseDisabled))
|
||||
{
|
||||
|
||||
#ifdef GTASA
|
||||
@ -181,7 +180,7 @@ void Hook::ShowMouse(bool state)
|
||||
|
||||
if (pad)
|
||||
{
|
||||
if (m_bShowMouse)
|
||||
if (state)
|
||||
{
|
||||
bMouseDisabled = true;
|
||||
#ifdef GTA3
|
||||
@ -202,30 +201,28 @@ void Hook::ShowMouse(bool state)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bMouseVisibility != m_bShowMouse)
|
||||
if (m_bMouseVisibility != state)
|
||||
{
|
||||
ImGui::GetIO().MouseDrawCursor = state;
|
||||
|
||||
#ifdef GTASA
|
||||
Hook::ApplyMouseFix(); // Reapply the patches
|
||||
#else
|
||||
if (m_bShowMouse)
|
||||
if (state)
|
||||
{
|
||||
|
||||
patch::SetUChar(BY_GAME(0, 0x6020A0, 0x580D20), 0xC3); // psSetMousePos
|
||||
patch::Nop(BY_GAME(0, 0x4AB6CA, 0x49272F), 5); // don't call CPad::UpdateMouse()
|
||||
patch::SetUChar(BY_GAME(0x6194A0, 0x6020A0, 0x580D20), 0xC3); // psSetMousePos
|
||||
patch::Nop(BY_GAME(0x541DD7, 0x4AB6CA, 0x49272F), 5); // don't call CPad::UpdateMouse()
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
patch::SetUChar(BY_GAME(0, 0x6020A0, 0x580D20), 0x53);
|
||||
#ifdef GTAVC
|
||||
patch::SetUChar(BY_GAME(0x6194A0, 0x6020A0, 0x580D20), BY_GAME(0xE9, 0x53, 0x53));
|
||||
#ifdef GTASA
|
||||
patch::SetRaw(0x541DD7, (char*)"\xE8\xE4\xD5\xFF\xFF", 5);
|
||||
#elif GTAVC
|
||||
patch::SetRaw(0x4AB6CA, (char*)"\xE8\x51\x21\x00\x00", 5);
|
||||
#else // GTA3
|
||||
patch::SetRaw(0x49272F, (char*)"\xE8\x6C\xF5\xFF\xFF", 5);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
CPad::NewMouseControllerState.X = 0;
|
||||
CPad::NewMouseControllerState.Y = 0;
|
||||
@ -235,7 +232,7 @@ void Hook::ShowMouse(bool state)
|
||||
CPad::ClearMouseHistory();
|
||||
#endif
|
||||
CPad::UpdatePads();
|
||||
m_bMouseVisibility = m_bShowMouse;
|
||||
m_bMouseVisibility = state;
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,82 +265,3 @@ Hook::~Hook()
|
||||
ImGui::DestroyContext();
|
||||
kiero::shutdown();
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
struct Mouse
|
||||
{
|
||||
unsigned int x, y;
|
||||
unsigned int wheelDelta;
|
||||
unsigned char buttons[8];
|
||||
};
|
||||
|
||||
struct MouseInfo
|
||||
{
|
||||
int x, y, wheelDelta;
|
||||
} mouseInfo;
|
||||
|
||||
static BOOL __stdcall _SetCursorPos(int X, int Y)
|
||||
{
|
||||
if (Hook::m_bShowMouse || GetActiveWindow() != RsGlobal.ps->window)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
mouseInfo.x = X;
|
||||
mouseInfo.y = Y;
|
||||
|
||||
return SetCursorPos(X, Y);
|
||||
}
|
||||
|
||||
static LRESULT __stdcall _DispatchMessage(MSG* lpMsg)
|
||||
{
|
||||
if (lpMsg->message == WM_MOUSEWHEEL && !Hook::m_bShowMouse)
|
||||
{
|
||||
mouseInfo.wheelDelta += GET_WHEEL_DELTA_WPARAM(lpMsg->wParam);
|
||||
}
|
||||
|
||||
return DispatchMessageA(lpMsg);
|
||||
}
|
||||
|
||||
static int _cdecl _GetMouseState(Mouse* pMouse)
|
||||
{
|
||||
if (Hook::m_bShowMouse || !RsGlobal.ps->diMouse)
|
||||
{
|
||||
DIMOUSE->Unacquire();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (DIMOUSE->GetDeviceState(sizeof(Mouse), pMouse) < 0)
|
||||
{
|
||||
if (DIMOUSE->Acquire() == DIERR_NOTINITIALIZED)
|
||||
{
|
||||
while (DIMOUSE->Acquire() == DIERR_NOTINITIALIZED);
|
||||
}
|
||||
}
|
||||
|
||||
pMouse->wheelDelta = mouseInfo.wheelDelta;
|
||||
mouseInfo.wheelDelta = 0;
|
||||
pMouse->buttons[0] = (GetAsyncKeyState(1) >> 8);
|
||||
pMouse->buttons[1] = (GetAsyncKeyState(2) >> 8);
|
||||
pMouse->buttons[2] = (GetAsyncKeyState(4) >> 8);
|
||||
pMouse->buttons[3] = (GetAsyncKeyState(5) >> 8);
|
||||
pMouse->buttons[4] = (GetAsyncKeyState(6) >> 8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Hook::ApplyMouseFix()
|
||||
{
|
||||
patch::ReplaceFunctionCall(0x53F417, _GetMouseState);
|
||||
patch::Nop(0x57C59B, 1);
|
||||
patch::ReplaceFunctionCall(0x57C59C, _SetCursorPos);
|
||||
patch::Nop(0x81E5D4, 1);
|
||||
patch::ReplaceFunctionCall(0x81E5D5, _SetCursorPos);
|
||||
patch::Nop(0x74542D, 1);
|
||||
patch::ReplaceFunctionCall(0x74542E, _SetCursorPos);
|
||||
patch::Nop(0x748A7C, 1);
|
||||
patch::ReplaceFunctionCall(0x748A7D, _DispatchMessage);
|
||||
patch::SetChar(0x746A08, 32); // diMouseOffset
|
||||
patch::SetChar(0x746A58, 32); // diDeviceoffset
|
||||
}
|
||||
#endif
|
@ -27,10 +27,6 @@ public:
|
||||
static inline bool m_bShowMouse = false;
|
||||
static inline std::function<void()> pCallbackFunc = nullptr;
|
||||
|
||||
#ifdef GTASA
|
||||
static void ApplyMouseFix();
|
||||
#endif
|
||||
|
||||
Hook();
|
||||
~Hook();
|
||||
};
|
||||
|
@ -526,13 +526,16 @@ void Menu::Draw()
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(3))))
|
||||
{
|
||||
ShellExecute(nullptr, "open", DISCORD_INVITE, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("GitHub repo", ImVec2(Ui::GetSize(3))))
|
||||
{
|
||||
ShellExecute(nullptr, "open", GITHUB_LINK, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
|
||||
}
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::BeginChild("AboutChild"))
|
||||
|
@ -2,5 +2,5 @@
|
||||
#define MENU_NAME "Cheat Menu"
|
||||
#define MENU_VERSION_NUMBER "3.0"
|
||||
#define MENU_VERSION MENU_VERSION_NUMBER"-beta"
|
||||
#define BUILD_NUMBER "20211106"
|
||||
#define BUILD_NUMBER "20211116"
|
||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION
|
||||
|
Loading…
Reference in New Issue
Block a user