diff --git a/cod4qol/commands.cpp b/cod4qol/commands.cpp index 2c32ff2..875d90d 100644 --- a/cod4qol/commands.cpp +++ b/cod4qol/commands.cpp @@ -220,15 +220,18 @@ void commands::ToggleLoadingInfoUpdate() void commands::ToggleSteamAuthUpdate() { + //game::cod4x_entry + 0x1A70A + //game::cod4x_entry + 0x1A717 + if (commands::qol_disable_steam_auth->current.enabled) { - hooks::write_addr(game::cod4x_entry + 0x1A70A, "\x90\x90\x90\x90\x90\x90", 6); - hooks::write_addr(game::cod4x_entry + 0x1A717, "\x90\x90\x90\x90\x90\x90", 6); + hooks::write_addr(game::cod4x_entry + 0x10982, "\x90\x90", 2); + hooks::write_addr(game::cod4x_entry + 0x1098B, "\x90\x90\x90\x90\x90\x90", 6); } else { - hooks::write_addr(game::cod4x_entry + 0x1A70A, "\x0F\x85\xDB\x00\x00\x00", 6); - hooks::write_addr(game::cod4x_entry + 0x1A717, "\x0F\x85\xCE\x00\x00\x00", 6); + hooks::write_addr(game::cod4x_entry + 0x10982, "\x75\x0D", 2); + hooks::write_addr(game::cod4x_entry + 0x1098B, "\x0F\x84\xBF\x01\x00\x00", 6); } } diff --git a/cod4qol/defines.hpp b/cod4qol/defines.hpp index f12b120..9fa291d 100644 --- a/cod4qol/defines.hpp +++ b/cod4qol/defines.hpp @@ -12,4 +12,4 @@ #define COD4QOL_GITHUB_URL "https://api.github.com/repos/Rex109/CoD4QOL/releases/latest" #define COD4QOL_FILE_NAME "download/cod4qol.zip" -#define COD4QOL_SUPPORTEDVERSIONS "21.1" \ No newline at end of file +#define COD4QOL_SUPPORTEDVERSIONS "21.2" \ No newline at end of file diff --git a/cod4qol/dllmain.cpp b/cod4qol/dllmain.cpp index c8402eb..bba3727 100644 --- a/cod4qol/dllmain.cpp +++ b/cod4qol/dllmain.cpp @@ -42,9 +42,9 @@ void Initialize() if (!iw3mp) return; - if (!game::cod4x_entry) + if (!game::cod4x_entry || strcmp(reinterpret_cast(game::cod4x_entry + 0x22551A), "CoD4 MP 21.2") != 0) { - MessageBox(NULL, "CoD4X version mismatch, CoD4QOL unloaded.\nYou need to have CoD4X version " COD4QOL_SUPPORTEDVERSIONS " installed.", "CoD4QOL", MB_ICONERROR); + MessageBox(NULL, "CoD4X version mismatch, CoD4QOL has been unloaded.\nYou need to have CoD4X version " COD4QOL_SUPPORTEDVERSIONS " installed.\n\nYou may need to update your game or manually download a newer version of CoD4QOL, otherwise you will have to wait for a new version of CoD4QOL and manually update it later." , "CoD4QOL", MB_ICONWARNING); return; } diff --git a/cod4qol/game.cpp b/cod4qol/game.cpp index 45bf17f..71e653c 100644 --- a/cod4qol/game.cpp +++ b/cod4qol/game.cpp @@ -25,9 +25,9 @@ HMODULE game::GetCurrentModule() bool game::LoadLocalizedIWD(const char* pakfile, const char* basename, const char* gamename) { - hooks::write_addr((game::cod4x_entry + 0x386E2), "\x01", 1); + hooks::write_addr(game::cod4x_entry + 0x2E366, "\x01", 1); bool result = FS_AddSingleIwdFileForGameDirectory(pakfile, basename, gamename); - hooks::write_addr((game::cod4x_entry + 0x386E2), "\x00", 1); + hooks::write_addr(game::cod4x_entry + 0x2E366, "\x00", 1); return result; } @@ -175,9 +175,9 @@ int game::hookedScreenshotRequest(int a1, int a2) commands::iPrintLnBold("[^3CoD4QOL^7]: ^1You are currently being screenshotted"); if (commands::qol_getss->current.integer == 2) - hooks::write_addr(game::cod4x_entry + 0xEA62B, "\xEB", 1); + hooks::write_addr(game::cod4x_entry + 0xB21FB, "\xEB", 1); else - hooks::write_addr(game::cod4x_entry + 0xEA62B, "\x74", 1); + hooks::write_addr(game::cod4x_entry + 0xB21FB, "\x74", 1); return pScreenshotRequest(a1, a2); } diff --git a/cod4qol/game.hpp b/cod4qol/game.hpp index 6891473..f441c23 100644 --- a/cod4qol/game.hpp +++ b/cod4qol/game.hpp @@ -5,6 +5,7 @@ #include "defines.hpp" #include #include +#include "hooks.hpp" namespace game { @@ -431,7 +432,7 @@ namespace game inline bool startup = true; const static DWORD cod4x_entry = (DWORD)GetModuleHandleA("cod4x_021.dll"); - const static HWND* hwnd = reinterpret_cast(game::cod4x_entry + 0x43FE9A0); + const static HWND* hwnd = reinterpret_cast(game::cod4x_entry + 0x443BA00); const static char* prefix = COD4QOL_CONSOLE_PREFIX; const static char* localization = *reinterpret_cast(0xCC147D4); @@ -538,20 +539,20 @@ namespace game typedef bool(*FS_AddSingleIwdFileForGameDirectory_t)(const char* pakfile, const char* basename, const char* gamename); extern FS_AddSingleIwdFileForGameDirectory_t FS_AddSingleIwdFileForGameDirectory; - inline void* Cmd_AddCommand_fnc = (void*)(cod4x_entry + 0x2116C); + inline void* Cmd_AddCommand_fnc = (void*)(cod4x_entry + 0x639B0); //cod4x_entry + 0x2116C inline game::CmdArgs* cmd_args = reinterpret_cast(0x1410B40); inline game::gclient_s* g_clients = reinterpret_cast(0x13255A8); inline game::Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand = Cmd_ExecuteSingleCommand_t(0x4F9AB0); inline game::Com_PrintMessage_t Com_PrintMessage = game::Com_PrintMessage_t(0x4FCA50); inline game::DB_LoadXAssets_t DB_LoadXAssets = DB_LoadXAssets_t(0x48A2B0); - inline game::Sys_CreateConsole_t Sys_CreateConsole = Sys_CreateConsole_t(cod4x_entry + 0x7F503); + inline game::Sys_CreateConsole_t Sys_CreateConsole = Sys_CreateConsole_t(cod4x_entry + 0x7F160); //cod4x_entry + 0x7F503 - inline game::Cvar_RegisterBool_t Cvar_RegisterBool = Cvar_RegisterBool_t(cod4x_entry + 0x2D8F2); - inline game::Cvar_RegisterEnum_t Cvar_RegisterEnum = Cvar_RegisterEnum_t(cod4x_entry + 0x2DCAF); - inline game::Cvar_RegisterString_t Cvar_RegisterString = Cvar_RegisterString_t(cod4x_entry + 0x2D87D); + inline game::Cvar_RegisterBool_t Cvar_RegisterBool = Cvar_RegisterBool_t(cod4x_entry + 0x60BE0); //cod4x_entry + 0x2D8F2 + inline game::Cvar_RegisterEnum_t Cvar_RegisterEnum = Cvar_RegisterEnum_t(cod4x_entry + 0x60640); //cod4x_entry + 0x2DCAF + inline game::Cvar_RegisterString_t Cvar_RegisterString = Cvar_RegisterString_t(cod4x_entry + 0x60960); //cod4x_entry + 0x2D87D - inline game::FS_AddSingleIwdFileForGameDirectory_t FS_AddSingleIwdFileForGameDirectory = FS_AddSingleIwdFileForGameDirectory_t(cod4x_entry + 0x3867C); + inline game::FS_AddSingleIwdFileForGameDirectory_t FS_AddSingleIwdFileForGameDirectory = FS_AddSingleIwdFileForGameDirectory_t(cod4x_entry + 0x2E310); //cod4x_entry + 0x3867C inline game::dvar_s* fs_game = game::Find("fs_game"); inline game::dvar_s* fs_homepath = game::Find("fs_homepath"); @@ -561,4 +562,4 @@ namespace game inline int* modIndex = reinterpret_cast(0xCAF7558); inline const char** modName = reinterpret_cast(0xCAF7354); inline const char** modDesc = reinterpret_cast(0xCAF7358); -} +} \ No newline at end of file diff --git a/cod4qol/hooks.cpp b/cod4qol/hooks.cpp index 55bf435..462b94c 100644 --- a/cod4qol/hooks.cpp +++ b/cod4qol/hooks.cpp @@ -1,22 +1,27 @@ #include "hooks.hpp" #include "game.hpp" +#include +#include void hooks::InitializeHooks() { std::cout << "Initializing hooks..." << std::endl; //Removing cod4x safechecks - hooks::write_addr((game::cod4x_entry + 0x43580), "\xC3", 1); + //(game::cod4x_entry + 0x43580) + hooks::write_addr((game::cod4x_entry + 0x82E40), "\xC3", 1); //Fast startup - hooks::write_addr((game::cod4x_entry + 0x3AA7C), "\xC3", 1); + //(game::cod4x_entry + 0x3AA7C) + hooks::write_addr((game::cod4x_entry + 0x30F00), "\xC3", 1); //Console name game::pCon_LinePrefix = (game::Con_LinePrefix)(0x460613); hooks::install(&(PVOID&)game::pCon_LinePrefix, (PBYTE)game::hookedCon_LinePrefix); //Game start - game::pDB_LoadXZoneFromGfxConfig = (game::DB_LoadXZoneFromGfxConfig)(game::cod4x_entry + 0x8327E); + //(game::cod4x_entry + 0x8327E) + game::pDB_LoadXZoneFromGfxConfig = (game::DB_LoadXZoneFromGfxConfig)(game::cod4x_entry + 0x3C180); hooks::install(&(PVOID&)game::pDB_LoadXZoneFromGfxConfig, (PBYTE)game::hookedDB_LoadXZoneFromGfxConfig); //Return to main menu @@ -32,7 +37,8 @@ void hooks::InitializeHooks() hooks::install(&(PVOID&)game::pCL_RegisterDvars, (PBYTE)game::hookedCL_RegisterDvars); //Respawn - game::pCG_Respawn = (game::CG_Respawn)(game::cod4x_entry + 0x3B45); + //(game::cod4x_entry + 0x3B45) + game::pCG_Respawn = (game::CG_Respawn)(game::cod4x_entry + 0x3DF00); hooks::install(&(PVOID&)game::pCG_Respawn, (PBYTE)game::hookedCG_Respawn); //VSTR @@ -40,7 +46,8 @@ void hooks::InitializeHooks() hooks::install(&(PVOID&)game::pCmd_Vstr_f, (PBYTE)game::hookedCmd_Vstr_f); //ScreenshotRequest - game::pScreenshotRequest = (game::ScreenshotRequest)(game::cod4x_entry + 0xEA610); + //(game::cod4x_entry + 0xEA610) + game::pScreenshotRequest = (game::ScreenshotRequest)(game::cod4x_entry + 0xB21E0); hooks::install(&(PVOID&)game::pScreenshotRequest, (PBYTE)game::hookedScreenshotRequest); //R_SetViewParmsForScene