From 8fcf87e2d028dc987ea6edcccb232669b186b054 Mon Sep 17 00:00:00 2001 From: Sku-111 Date: Wed, 25 Oct 2023 19:26:27 +0200 Subject: [PATCH] added some little stuff removes "no work" string for Aniyah Incursion map adds an unlock all cmd and moved some code --- hook_lib/Main.cpp | 3 +++ hook_lib/dvar.cpp | 20 +++----------------- hook_lib/fastfile.cpp | 5 +++++ hook_lib/fastfile.h | 5 ++++- hook_lib/functions.cpp | 1 + hook_lib/functions.hpp | 1 + hook_lib/g_cmds.cpp | 26 ++++++++++++++++++++++++++ hook_lib/g_cmds.h | 6 +++++- hook_lib/party.cpp | 2 ++ hook_lib/patch.cpp | 15 ++++++++++++++- hook_lib/stringed.cpp | 9 +++++++-- 11 files changed, 71 insertions(+), 22 deletions(-) diff --git a/hook_lib/Main.cpp b/hook_lib/Main.cpp index 98c46b5..e692cf8 100644 --- a/hook_lib/Main.cpp +++ b/hook_lib/Main.cpp @@ -52,8 +52,11 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD Reason, LPVOID lpVoid) printf("Base Address: %p\n", base); addCustomDvars(); + addCustomCmds(); patchGame(); + printf("Discord: discord.gg/donetsk\n"); + cmd_args = (CmdArgs*)(0x14D20CBD0_g); clientUIActives = (clientUIActive_t*)(0x14EEF1280_g); diff --git a/hook_lib/dvar.cpp b/hook_lib/dvar.cpp index dbdbc65..3702ca0 100644 --- a/hook_lib/dvar.cpp +++ b/hook_lib/dvar.cpp @@ -3,22 +3,7 @@ void addCustomDvars() { - Cmd_AddCommandInternal("set_byte", set_byte_f, &set_byte_f_VAR); - Cmd_AddCommandInternal("set_short", set_short_f, &set_short_f_VAR); - Cmd_AddCommandInternal("set_int", set_int_f, &set_int_f_VAR); - Cmd_AddCommandInternal("set_float", set_float_f, &set_float_f_VAR); - Cmd_AddCommandInternal("set_pointer", set_pointer_f, &set_pointer_f_VAR); - Cmd_AddCommandInternal("quit", Cmd_Quit_f, &quit_f_VAR); - Cmd_AddCommandInternal("openmenu", Cmd_OpenMenu_f, &openmenu_f_VAR); - Cmd_AddCommandInternal("addbot", Cmd_AddBot_f, &addbot_f_VAR); - Cmd_AddCommandInternal("ddldump", Cmd_DDLDump_f, &ddldump_f_VAR); - Cmd_AddCommandInternal("weapondefdump", Cmd_WeaponDefDump_f, &weapondefdump_f_VAR); - //Cmd_AddCommandInternal("view_vehicle_ents", Cmd_ViewVehicleEnts_f, &view_vehicle_ents_f_VAR); - // Cmd_AddCommandInternal("save_inventory", Cmd_LoadoutSave_f, &loadout_save_f_VAR); - Cmd_AddCommandInternal("map_restart", SV_CmdsMP_MapRestart_f, &MapRestart_f_VAR); - Cmd_AddCommandInternal("fast_restart", SV_CmdsMP_FastRestart_f, &FastRestart_f_VAR); - Cmd_AddCommandInternal("setOmnvar", Cmd_Omnvar_Set_f, &omnvar_set_f_VAR); - // Cmd_AddCommandInternal("dumpomnvars", Cmd_Omnvars_Dump_f, &omnvar_dump_f_VAR); + } dvar_t* Dvar_RegisterBool_Detour(const char* dvarName, bool value, unsigned int flags, const char* description) @@ -44,4 +29,5 @@ dvar_t* Dvar_FindVarByName_Detour(const char* dvarName) { dvar_t* ret = dvar_findvarbyname.stub(dvarName); return ret; -} \ No newline at end of file +} + diff --git a/hook_lib/fastfile.cpp b/hook_lib/fastfile.cpp index 27dddab..e0beae1 100644 --- a/hook_lib/fastfile.cpp +++ b/hook_lib/fastfile.cpp @@ -16,4 +16,9 @@ int DB_PollFastfileState_Detour(const char* zoneName) //printf("%s\n", zoneName); return db_pollfastfilestate.stub(zoneName); +} + +bool DB_CheckXFileVersion_Detour() +{ + return true; } \ No newline at end of file diff --git a/hook_lib/fastfile.h b/hook_lib/fastfile.h index 280cdd4..36754f2 100644 --- a/hook_lib/fastfile.h +++ b/hook_lib/fastfile.h @@ -5,4 +5,7 @@ inline utils::hook::detour db_loadxfile; int DB_LoadXFile_Detour(const char* zoneName, uintptr_t zoneMem, uintptr_t assetList, int zoneFlags, bool wasPaused, int failureMode, uintptr_t outSignature); inline utils::hook::detour db_pollfastfilestate; -int DB_PollFastfileState_Detour(const char* zoneName); \ No newline at end of file +int DB_PollFastfileState_Detour(const char* zoneName); + +inline utils::hook::detour db_checkxfileversion; +bool DB_CheckXFileVersion_Detour(); \ No newline at end of file diff --git a/hook_lib/functions.cpp b/hook_lib/functions.cpp index ade2649..89896f2 100644 --- a/hook_lib/functions.cpp +++ b/hook_lib/functions.cpp @@ -511,6 +511,7 @@ cmd_function_s FastRestart_f_VAR; cmd_function_s MapRestart_f_VAR; cmd_function_s omnvar_set_f_VAR; cmd_function_s omnvar_dump_f_VAR; +cmd_function_s unlockall_f_VAR; CmdArgs* cmd_args; diff --git a/hook_lib/functions.hpp b/hook_lib/functions.hpp index b904df7..452e8a7 100644 --- a/hook_lib/functions.hpp +++ b/hook_lib/functions.hpp @@ -130,6 +130,7 @@ extern cmd_function_s FastRestart_f_VAR; extern cmd_function_s MapRestart_f_VAR; extern cmd_function_s omnvar_set_f_VAR; extern cmd_function_s omnvar_dump_f_VAR; +extern cmd_function_s unlockall_f_VAR; extern CmdArgs* cmd_args; void* RtlAddVectoredExceptionHandler(LONG First, PVECTORED_EXCEPTION_HANDLER Handler); diff --git a/hook_lib/g_cmds.cpp b/hook_lib/g_cmds.cpp index 4fb97c9..285cd9d 100644 --- a/hook_lib/g_cmds.cpp +++ b/hook_lib/g_cmds.cpp @@ -1,6 +1,27 @@ #include "g_cmds.h" #include "game_inc.h" +void addCustomCmds() +{ + Cmd_AddCommandInternal("set_byte", set_byte_f, &set_byte_f_VAR); + Cmd_AddCommandInternal("set_short", set_short_f, &set_short_f_VAR); + Cmd_AddCommandInternal("set_int", set_int_f, &set_int_f_VAR); + Cmd_AddCommandInternal("set_float", set_float_f, &set_float_f_VAR); + Cmd_AddCommandInternal("set_pointer", set_pointer_f, &set_pointer_f_VAR); + Cmd_AddCommandInternal("quit", Cmd_Quit_f, &quit_f_VAR); + Cmd_AddCommandInternal("openmenu", Cmd_OpenMenu_f, &openmenu_f_VAR); + Cmd_AddCommandInternal("addbot", Cmd_AddBot_f, &addbot_f_VAR); + Cmd_AddCommandInternal("ddldump", Cmd_DDLDump_f, &ddldump_f_VAR); + Cmd_AddCommandInternal("weapondefdump", Cmd_WeaponDefDump_f, &weapondefdump_f_VAR); + //Cmd_AddCommandInternal("view_vehicle_ents", Cmd_ViewVehicleEnts_f, &view_vehicle_ents_f_VAR); + // Cmd_AddCommandInternal("save_inventory", Cmd_LoadoutSave_f, &loadout_save_f_VAR); + Cmd_AddCommandInternal("map_restart", SV_CmdsMP_MapRestart_f, &MapRestart_f_VAR); + Cmd_AddCommandInternal("fast_restart", SV_CmdsMP_FastRestart_f, &FastRestart_f_VAR); + Cmd_AddCommandInternal("setOmnvar", Cmd_Omnvar_Set_f, &omnvar_set_f_VAR); + // Cmd_AddCommandInternal("dumpomnvars", Cmd_Omnvars_Dump_f, &omnvar_dump_f_VAR); + Cmd_AddCommandInternal("unlockAll", Cmd_UnlockAll_f, &unlockall_f_VAR); +} + void G_CmdsMP_ClientCommand_Detour(int clientNum) { g_entities = *reinterpret_cast(0x14BC20F00_g); @@ -375,4 +396,9 @@ void Cmd_ViewVehicleEnts_f() void Cmd_LoadoutSave_f() { SaveInventory(); +} + +void Cmd_UnlockAll_f() +{ + Cbuf_AddText("seta unlockAllItems 1"); } \ No newline at end of file diff --git a/hook_lib/g_cmds.h b/hook_lib/g_cmds.h index 820dbc9..c5566ed 100644 --- a/hook_lib/g_cmds.h +++ b/hook_lib/g_cmds.h @@ -1,6 +1,8 @@ #pragma once #include "Main.hpp" +void addCustomCmds(); + inline utils::hook::detour g_cmdsmp_clientcommand; void G_CmdsMP_ClientCommand_Detour(int clientNum); @@ -30,4 +32,6 @@ void Cmd_WeaponDefDump_f(); void Cmd_ViewVehicleEnts_f(); -void Cmd_LoadoutSave_f(); \ No newline at end of file +void Cmd_LoadoutSave_f(); + +void Cmd_UnlockAll_f(); \ No newline at end of file diff --git a/hook_lib/party.cpp b/hook_lib/party.cpp index 9ec6621..555edca 100644 --- a/hook_lib/party.cpp +++ b/hook_lib/party.cpp @@ -8,4 +8,6 @@ void PartyHost_StartPrivateParty_Detour(int localClientNum, int localControllerI partyhost_startprivateparty.stub(localClientNum, localControllerIndex, currentlyActive, hostType); LoadInventory(); + + Cbuf_AddText("set cl_textChatEnabled 1"); } \ No newline at end of file diff --git a/hook_lib/patch.cpp b/hook_lib/patch.cpp index 5344d6c..d2e3483 100644 --- a/hook_lib/patch.cpp +++ b/hook_lib/patch.cpp @@ -5,11 +5,15 @@ int iTick = 0; bool bFinished; bool btoggle; +dvar_t* cl_textChatEnabled = reinterpret_cast(0x14EEB0738_g); +dvar_t* com_timescale = reinterpret_cast(0x14D3865E8_g); + uintptr_t xuid_generated; int collision_ticker; void R_EndFrame_Detour() { - if (strcmp(Dvar_GetStringSafe("NSQLTTMRMP"), "mp_donetsk") == 0) { + if (strcmp(Dvar_GetStringSafe("NSQLTTMRMP"), "mp_donetsk") == 0) + { *reinterpret_cast(0x14E385A68_g) = 80; *reinterpret_cast(0x14E385A78_g) = 80; if (collision_ticker == 60) { @@ -140,6 +144,9 @@ void hooks() com_gamemode_supportsfeature.create(0x1410C8980_g, Com_GameMode_SupportsFeature_Detour); lui_cod_luacall_getblueprintdata_impl.create(0x140F58A00_g, LUI_CoD_LuaCall_GetBlueprintData_impl_Detour); + + // remove FF Header version check + // db_checkxfileversion.create(0x1411A7840_g, DB_CheckXFileVersion_Detour); } void patchGame() @@ -181,4 +188,10 @@ void patchGame() utils::hook::nop(0x14165E660_g, 5); utils::hook::nop(0x141665289_g, 5); utils::hook::nop(0x14166567D_g, 5); + + // set com_timescale dvar to read only + utils::hook::set(0x1412B26CF_g, 8192); + + // remove FF Header version check + // utils::hook::set(0x1411A776B_g, 0xEB); } \ No newline at end of file diff --git a/hook_lib/stringed.cpp b/hook_lib/stringed.cpp index c1816a3..a1c89a7 100644 --- a/hook_lib/stringed.cpp +++ b/hook_lib/stringed.cpp @@ -15,8 +15,13 @@ const char* SEH_StringEd_GetString_Detour(const char* pszReference) GamerProfile_SetDataByName(0, "acceptedEULA", 1); GamerProfile_SetDataByName(0, "hasEverPlayed_MainMenu", 1); - if (strstr(pszReference, "LUA_MENU/MAPNAME_ANIYAH") || - strstr(pszReference, "LUA_MENU/MAPNAME_DEADZONE") || + // LUA_MENU/MAPNAME_ANIYAH // Aniyah Palace + if (std::string(pszReference) == "LUA_MENU/MAPNAME_ANIYAH") + { + return "^1no work"; + } + + if (strstr(pszReference, "LUA_MENU/MAPNAME_DEADZONE") || strstr(pszReference, "LUA_MENU/MAPNAME_M_CAGE") || strstr(pszReference, "LUA_MENU/MAPNAME_CAVE_AM") || strstr(pszReference, "LUA_MENU/MAPNAME_CAVE") ||