From 2c08889a39ae07d23d276d30385da5e893b78b38 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Wed, 17 Nov 2021 14:35:12 +0600 Subject: [PATCH] Fixes for GTA III --- README.md | 3 +-- src/dllmain.cpp | 20 +++++++++----------- src/hook.cpp | 9 ++------- src/menuinfo.h | 2 +- src/weapon.h | 27 ++++++++++----------------- 5 files changed, 23 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 73a8e54..7084760 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,7 @@ Only these versions of the game is supported. I highly recommand installing the 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) +3. Install [SilentPatch](https://gtaforums.com/topic/669045-silentpatch/) (For GTA III don't install the ddraw.dll component) ### 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. diff --git a/src/dllmain.cpp b/src/dllmain.cpp index af58ee9..e51582f 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -22,17 +22,21 @@ 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 << "Error: CheatMenu folder not found. You need to put both \"CheatMenu.asi\" & \"CheatMenu\" folder in the same directory" << std::endl; 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; } + /* + Need SilentPatch since all gta games have issues with mouse input + Implementing mouse fix is a headache anyway + */ if (!GetModuleHandle(BY_GAME("SilentPatchSA.asi" ,"SilentPatchVC.asi" ,"SilentPatchIII.asi"))) { + gLog << "Error: SilentPatch not found. Please install it from here https://gtaforums.com/topic/669045-silentpatch/" << std::endl; 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) @@ -49,18 +53,11 @@ void MenuThread(void* param) */ if (GetModuleHandle("SAMP.dll") || GetModuleHandle("SAMP.asi")) { + gLog << "Error: CheatMenu doesn't support SAMP" << std::endl; MessageBox(RsGlobal.ps->window, "SAMP detected. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR); 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: " @@ -102,8 +99,9 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) } else { + gLog << "Error: Unknown game version. GTA " << BY_GAME("SA v1.0 US Hoodlum", "GTA VC v1.0 EN", "GTA III v1.0 EN") << " is required." << std::endl; #ifdef GTASA - MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR); + MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US Hoodlum is required.", "CheatMenu", MB_ICONERROR); #elif GTAVC MessageBox(HWND_DESKTOP, "Unknown game version. GTA VC v1.0 EN is required.", "CheatMenu", MB_ICONERROR); #else // GTA3 diff --git a/src/hook.cpp b/src/hook.cpp index aa075c3..1b6e353 100644 --- a/src/hook.cpp +++ b/src/hook.cpp @@ -157,17 +157,12 @@ void Hook::ShowMouse(bool state) { // Disable player controls for controllers bool bMouseDisabled = false; - bool isController; + bool isController = patch::Get(BY_GAME(0x5F03D8, 0x86968B, 0xBA6818)); #ifdef GTA3 - isController = !patch::Get(0x5F03D8); -#elif GTAVC - isController = patch::Get(0x86968B); -#else // GTASA - isController = patch::Get(0xBA6818); + isController = !isController; #endif - if (isController && (state || bMouseDisabled)) { diff --git a/src/menuinfo.h b/src/menuinfo.h index 283d741..b8b0a7b 100644 --- a/src/menuinfo.h +++ b/src/menuinfo.h @@ -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 "20211116" +#define BUILD_NUMBER "20211117" #define MENU_TITLE MENU_NAME " v" MENU_VERSION diff --git a/src/weapon.h b/src/weapon.h index d33c69e..32c7e23 100644 --- a/src/weapon.h +++ b/src/weapon.h @@ -13,18 +13,6 @@ public: static inline bool m_bMoveAim; static inline bool m_bMoveFire; static inline int m_nSelectedGang; -#else // GTA3 & GTAVC - static inline ResourceStore m_WeaponData{ "weapon", eResourceType::TYPE_TEXT }; - static inline bool m_bInfiniteAmmo; -#endif - static inline bool m_bFastReload; - static inline bool m_bHugeDamage; - static inline bool m_bLongRange; - static inline int m_nAmmoCount = 99999; - static inline uchar m_nCurrentWeaponSlot = -1; - static inline int m_nSelectedWeapon; - -#ifdef GTASA static inline int m_nGangWeaponList[10][3] = { {WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Ballas @@ -38,19 +26,24 @@ public: {WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 9 {WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 10 }; +#else // GTA3 & GTAVC + static inline ResourceStore m_WeaponData{ "weapon", eResourceType::TYPE_TEXT }; + static inline bool m_bInfiniteAmmo; #endif + static inline bool m_bFastReload; + static inline bool m_bHugeDamage; + static inline bool m_bLongRange; + static inline int m_nAmmoCount = 99999; + static inline uchar m_nCurrentWeaponSlot = -1; + static inline int m_nSelectedWeapon; Weapon(); - static void Draw(); #ifdef GTASA static void GiveWeaponToPlayer(std::string& weapon_type); + static void SetGangWeapon(std::string& weapon_type); #else // GTA3 & GTAVC static void GiveWeaponToPlayer(std::string& rootkey, std::string& model, std::string& name); #endif - -#ifdef GTASA - static void SetGangWeapon(std::string& weapon_type); -#endif };