From 02ba3b366305ad427f376a551355bbfe13d64ca0 Mon Sep 17 00:00:00 2001 From: diamante0018 Date: Wed, 9 Sep 2026 21:14:45 +0200 Subject: [PATCH] feat: admen abooze --- src/client/component/arxan.cpp | 6 +- src/client/component/assets/weapons.cpp | 2 - src/client/component/auth.cpp | 23 +- src/client/component/binding.cpp | 6 +- src/client/component/bots.cpp | 5 - src/client/component/branding.cpp | 5 +- src/client/component/bullet.cpp | 5 - src/client/component/colors.cpp | 31 +- src/client/component/command.cpp | 98 +----- src/client/component/console.cpp | 6 +- src/client/component/cursor.cpp | 2 +- src/client/component/demonware.cpp | 2 +- src/client/component/discord.cpp | 4 +- src/client/component/dvar_cheats.cpp | 2 - src/client/component/fastfiles.cpp | 22 +- src/client/component/filesystem.cpp | 25 +- src/client/component/fps.cpp | 6 +- src/client/component/game_log.cpp | 5 - src/client/component/gameplay.cpp | 36 +- src/client/component/gsc/script_error.cpp | 23 +- src/client/component/gsc/script_extension.cpp | 27 +- src/client/component/gsc/script_loading.cpp | 58 ++-- src/client/component/input.cpp | 4 +- src/client/component/localized_strings.cpp | 2 +- src/client/component/logger.cpp | 2 +- src/client/component/mods.cpp | 11 +- src/client/component/network.cpp | 5 - src/client/component/notifies.cpp | 15 +- src/client/component/party.cpp | 15 - src/client/component/patches.cpp | 67 +--- src/client/component/ranked.cpp | 5 - src/client/component/raw_mouse.cpp | 13 +- src/client/component/rcon.cpp | 2 - src/client/component/renderer.cpp | 4 +- src/client/component/scheduler.cpp | 8 +- src/client/component/scripting.cpp | 24 +- src/client/component/security.cpp | 4 +- src/client/component/slowmotion.cpp | 5 - src/client/component/splash.cpp | 6 +- src/client/component/steam_proxy.cpp | 34 +- src/client/component/ui_scripting.cpp | 42 ++- src/client/component/ultrawide.cpp | 110 +----- src/client/game/game.cpp | 8 - src/client/game/game.hpp | 17 +- src/client/game/scripting/functions.cpp | 2 +- .../launcher/html/doc_host_ui_handler.cpp | 115 ------- .../launcher/html/doc_host_ui_handler.hpp | 47 --- src/client/launcher/html/html_argument.cpp | 48 --- src/client/launcher/html/html_argument.hpp | 20 -- src/client/launcher/html/html_dispatch.cpp | 61 ---- src/client/launcher/html/html_dispatch.hpp | 24 -- src/client/launcher/html/html_frame.cpp | 320 ------------------ src/client/launcher/html/html_frame.hpp | 67 ---- src/client/launcher/html/html_window.cpp | 29 -- src/client/launcher/html/html_window.hpp | 15 - src/client/launcher/html/ole_client_site.cpp | 77 ----- src/client/launcher/html/ole_client_site.hpp | 24 -- .../launcher/html/ole_in_place_frame.cpp | 82 ----- .../launcher/html/ole_in_place_frame.hpp | 30 -- .../launcher/html/ole_in_place_site.cpp | 105 ------ .../launcher/html/ole_in_place_site.hpp | 32 -- src/client/launcher/launcher.cpp | 69 ---- src/client/launcher/launcher.hpp | 29 -- src/client/launcher/window.cpp | 208 ------------ src/client/launcher/window.hpp | 44 --- src/client/loader/loader.hpp | 2 - src/client/main.cpp | 13 +- src/client/resource.rc | 2 +- 68 files changed, 228 insertions(+), 2039 deletions(-) delete mode 100644 src/client/launcher/html/doc_host_ui_handler.cpp delete mode 100644 src/client/launcher/html/doc_host_ui_handler.hpp delete mode 100644 src/client/launcher/html/html_argument.cpp delete mode 100644 src/client/launcher/html/html_argument.hpp delete mode 100644 src/client/launcher/html/html_dispatch.cpp delete mode 100644 src/client/launcher/html/html_dispatch.hpp delete mode 100644 src/client/launcher/html/html_frame.cpp delete mode 100644 src/client/launcher/html/html_frame.hpp delete mode 100644 src/client/launcher/html/html_window.cpp delete mode 100644 src/client/launcher/html/html_window.hpp delete mode 100644 src/client/launcher/html/ole_client_site.cpp delete mode 100644 src/client/launcher/html/ole_client_site.hpp delete mode 100644 src/client/launcher/html/ole_in_place_frame.cpp delete mode 100644 src/client/launcher/html/ole_in_place_frame.hpp delete mode 100644 src/client/launcher/html/ole_in_place_site.cpp delete mode 100644 src/client/launcher/html/ole_in_place_site.hpp delete mode 100644 src/client/launcher/launcher.cpp delete mode 100644 src/client/launcher/launcher.hpp delete mode 100644 src/client/launcher/window.cpp delete mode 100644 src/client/launcher/window.hpp diff --git a/src/client/component/arxan.cpp b/src/client/component/arxan.cpp index 88085eb..fe6a2cc 100644 --- a/src/client/component/arxan.cpp +++ b/src/client/component/arxan.cpp @@ -103,9 +103,7 @@ namespace arxan BOOL WINAPI set_thread_context_stub(const HANDLE thread, CONTEXT* context) { - if (!game::environment::is_sp() - && game::dwGetLogOnStatus(0) == game::DW_LIVE_CONNECTED - && context->ContextFlags == CONTEXT_DEBUG_REGISTERS) + if (game::dwGetLogOnStatus(0) == game::DW_LIVE_CONNECTED && context->ContextFlags == CONTEXT_DEBUG_REGISTERS) { return TRUE; } @@ -142,8 +140,6 @@ namespace arxan void post_unpack() override { - if (game::environment::is_sp()) return; - utils::hook::jump(0x1404FE1E0, 0x1404FE2D0); // idk utils::hook::jump(0x140558C20, 0x140558CB0); // dwNetPump utils::hook::jump(0x140591850, 0x1405918E0); // dwLobbyPump diff --git a/src/client/component/assets/weapons.cpp b/src/client/component/assets/weapons.cpp index 5e414c1..f5115b1 100644 --- a/src/client/component/assets/weapons.cpp +++ b/src/client/component/assets/weapons.cpp @@ -45,8 +45,6 @@ namespace weapons public: void post_unpack() override { - if (game::environment::is_sp()) return; - // Kill Scr_PrecacheItem (We are going to do this from code) utils::hook::nop(0x1403BDB10, 4); utils::hook::set(0x1403BDB10, 0xC3); diff --git a/src/client/component/auth.cpp b/src/client/component/auth.cpp index ef9ad26..f6842f0 100644 --- a/src/client/component/auth.cpp +++ b/src/client/component/auth.cpp @@ -272,23 +272,14 @@ namespace auth void post_unpack() override { // Patch steam id bit check - if (game::environment::is_sp()) - { - utils::hook::jump(0x1404BF3F0, 0x1404BF446); - utils::hook::jump(0x1404C02AF, 0x1404C02F0); - utils::hook::jump(0x1404C07F4, 0x1404C0842); - } - else - { - utils::hook::jump(0x140585410, 0x140585466); - utils::hook::jump(0x140142252, 0x140142293); - utils::hook::jump(0x140142334, 0x140142389); - utils::hook::jump(0x1405864EF, 0x140586530); - utils::hook::jump(0x140586A80, 0x140586AC6); + utils::hook::jump(0x140585410, 0x140585466); + utils::hook::jump(0x140142252, 0x140142293); + utils::hook::jump(0x140142334, 0x140142389); + utils::hook::jump(0x1405864EF, 0x140586530); + utils::hook::jump(0x140586A80, 0x140586AC6); - utils::hook::jump(0x140479636, get_direct_connect_stub(), true); - utils::hook::call(0x1402C4F8E, send_connect_data_stub); - } + utils::hook::jump(0x140479636, get_direct_connect_stub(), true); + utils::hook::call(0x1402C4F8E, send_connect_data_stub); command::add("guid", []() -> void { diff --git a/src/client/component/binding.cpp b/src/client/component/binding.cpp index 5d5638a..fca9c62 100644 --- a/src/client/component/binding.cpp +++ b/src/client/component/binding.cpp @@ -115,13 +115,13 @@ namespace binding } // write all bindings to config file - utils::hook::call(SELECT_VALUE(0x14023DF2B, 0x1402C465B), key_write_bindings_to_buffer_stub); + utils::hook::call(0x1402C465B, key_write_bindings_to_buffer_stub); // links a custom command to an index - utils::hook::jump(SELECT_VALUE(0x14023D6E0, 0x1402C3E50), key_get_binding_for_cmd_stub); + utils::hook::jump(0x1402C3E50, key_get_binding_for_cmd_stub); // execute custom binds - cl_execute_key_hook.create(SELECT_VALUE(0x140239970, 0x1402BF0E0), &cl_execute_key_stub); + cl_execute_key_hook.create(0x1402BF0E0, &cl_execute_key_stub); } }; } diff --git a/src/client/component/bots.cpp b/src/client/component/bots.cpp index 4409cbd..a50f1d2 100644 --- a/src/client/component/bots.cpp +++ b/src/client/component/bots.cpp @@ -160,11 +160,6 @@ namespace bots public: void post_unpack() override { - if (game::environment::is_sp()) - { - return; - } - get_bot_name_hook.create(game::SV_BotGetRandomName, get_random_bot_name); command::add("spawnBot", [](const command::params& params) diff --git a/src/client/component/branding.cpp b/src/client/component/branding.cpp index 3602fb4..78132e4 100644 --- a/src/client/component/branding.cpp +++ b/src/client/component/branding.cpp @@ -40,9 +40,8 @@ namespace branding localized_strings::override("LUA_MENU_LEGAL_COPYRIGHT", "iw6-mod: " VERSION " by AlterWare.\n"); - utils::hook::call(SELECT_VALUE(0x1403BDABA, 0x140414424), dvar_set_string_stub); - ui_get_formatted_build_number_hook.create( - SELECT_VALUE(0x140415FD0, 0x1404D7C00), ui_get_formatted_build_number_stub); + utils::hook::call(0x140414424, dvar_set_string_stub); + ui_get_formatted_build_number_hook.create(0x1404D7C00, ui_get_formatted_build_number_stub); scheduler::loop([]() { diff --git a/src/client/component/bullet.cpp b/src/client/component/bullet.cpp index caeadd7..61130c3 100644 --- a/src/client/component/bullet.cpp +++ b/src/client/component/bullet.cpp @@ -28,11 +28,6 @@ namespace bullet public: void post_unpack() override { - if (game::environment::is_sp()) - { - return; - } - dvars::bg_surfacePenetration = game::Dvar_RegisterFloat("bg_surfacePenetration", 0.0f, 0.0f, std::numeric_limits::max(), game::DVAR_FLAG_SAVED, "Set to a value greater than 0 to override the surface penetration depth"); diff --git a/src/client/component/colors.cpp b/src/client/component/colors.cpp index 6ea61b2..bb53f7a 100644 --- a/src/client/component/colors.cpp +++ b/src/client/component/colors.cpp @@ -126,11 +126,11 @@ namespace colors if (index == '8') { - *color = *reinterpret_cast(SELECT_VALUE(0x145FFD958, 0x1480E85BC)); + *color = *reinterpret_cast(0x1480E85BC); } else if (index == '9') { - *color = *reinterpret_cast(SELECT_VALUE(0x145FFD95C, 0x1480E85C0)); + *color = *reinterpret_cast(0x1480E85C0); } else if (index == ':') { @@ -138,7 +138,7 @@ namespace colors } else if (index == ';') { - *color = *reinterpret_cast(SELECT_VALUE(0x145FFD964, 0x1480E85C8)); + *color = *reinterpret_cast(0x1480E85C8); } else { @@ -157,25 +157,22 @@ namespace colors return; } - if (!game::environment::is_sp()) - { - // allows colored name in-game - utils::hook::call(0x1403881CF, com_clean_name_stub); - utils::hook::call(0x140388224, com_clean_name_stub); + // allows colored name in-game + utils::hook::call(0x1403881CF, com_clean_name_stub); + utils::hook::call(0x140388224, com_clean_name_stub); - // don't apply colors to overhead names - utils::hook::call(0x14025CE79, cl_get_client_name_and_clan_tag_stub); + // don't apply colors to overhead names + utils::hook::call(0x14025CE79, cl_get_client_name_and_clan_tag_stub); - // don't apply colors to overhead names of agents (like dogs or juggernauts) - // hook Com_sprintf in CL_GetAgentName - utils::hook::call(0x1402CF760, com_sprintf_stub); + // don't apply colors to overhead names of agents (like dogs or juggernauts) + // hook Com_sprintf in CL_GetAgentName + utils::hook::call(0x1402CF760, com_sprintf_stub); - // patch I_CleanStr - utils::hook::jump(0x1404F63C0, i_clean_str_stub); - } + // patch I_CleanStr + utils::hook::jump(0x1404F63C0, i_clean_str_stub); // force new colors - utils::hook::jump(SELECT_VALUE(0x14055DCC0, 0x14062AE80), rb_lookup_color_stub); + utils::hook::jump(0x14062AE80, rb_lookup_color_stub); // add colors add(0, 0, 0); // 0 - Black diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index bfc3218..76604c1 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -253,16 +253,9 @@ namespace command public: void post_unpack() override { - if (game::environment::is_sp()) - { - add_sp_commands(); - } - else - { - utils::hook::call(0x14041213C, &parse_commandline_stub); + utils::hook::call(0x14041213C, &parse_commandline_stub); - add_mp_commands(); - } + add_mp_commands(); add_commands_generic(); } @@ -449,93 +442,6 @@ namespace command execute(dvar->current.string); }); } - - void add_sp_commands() - { - add("god", [] - { - if (!game::SV_Loaded()) - { - return; - } - - game::sp::g_entities[0].flags ^= game::FL_GODMODE; - game::CG_GameMessage(0, utils::string::va("godmode %s", game::sp::g_entities[0].flags & game::FL_GODMODE ? "^2on" : "^1off")); - }); - - add("notarget", [] - { - if (!game::SV_Loaded()) - { - return; - } - - game::sp::g_entities[0].flags ^= game::FL_NOTARGET; - game::CG_GameMessage(0, utils::string::va("notarget %s", game::sp::g_entities[0].flags & game::FL_NOTARGET ? "^2on" : "^1off")); - }); - - add("noclip", [] - { - if (!game::SV_Loaded()) - { - return; - } - - game::sp::g_entities[0].client->flags ^= 1; - game::CG_GameMessage(0, utils::string::va("noclip %s", game::sp::g_entities[0].client->flags & 1 ? "^2on" : "^1off")); - }); - - add("ufo", [] - { - if (!game::SV_Loaded()) - { - return; - } - - game::sp::g_entities[0].client->flags ^= 2; - game::CG_GameMessage(0, utils::string::va("ufo %s", game::sp::g_entities[0].client->flags & 2 ? "^2on" : "^1off")); - }); - - add("give", [](const params& params) - { - if (!game::SV_Loaded()) - { - return; - } - - if (params.size() < 2) - { - game::CG_GameMessage(0, "You did not specify a weapon name"); - return; - } - - auto ps = game::SV_GetPlayerstateForClientNum(0); - auto wp = game::G_GetWeaponForName(params.get(1)); - if (game::G_GivePlayerWeapon(ps, wp, 0, 0, 0)) - { - game::G_InitializeAmmo(ps, wp, 0); - game::G_SelectWeapon(0, wp); - } - }); - - add("take", [](const params& params) - { - if (!game::SV_Loaded()) - { - return; - } - - if (params.size() < 2) - { - game::CG_GameMessage(0, "You did not specify a weapon name"); - return; - } - - auto ps = game::SV_GetPlayerstateForClientNum(0); - auto wp = game::G_GetWeaponForName(params.get(1)); - game::G_TakePlayerWeapon(ps, wp); - }); - } static void add_mp_commands() { diff --git a/src/client/component/console.cpp b/src/client/component/console.cpp index 2cc9c22..8b24662 100644 --- a/src/client/component/console.cpp +++ b/src/client/component/console.cpp @@ -125,7 +125,7 @@ namespace console void post_unpack() override { // Redirect input (]command) - utils::hook::jump(SELECT_VALUE(0x14043DFA0, 0x140502A80), append_text); + utils::hook::jump(0x140502A80, append_text); utils::hook::jump(printf, print_stub); @@ -219,7 +219,7 @@ namespace console HWND get_window() { - return *reinterpret_cast((SELECT_VALUE(0x145A7B490, 0x147AD1DB0))); + return *reinterpret_cast(0x147AD1DB0); } void set_title(std::string title) @@ -241,7 +241,7 @@ namespace console SetWindowPos(get_window(), nullptr, rect.left, rect.top, width, height, 0); - auto* const logo_window = *reinterpret_cast(SELECT_VALUE(0x145A7B4A0, 0x147AD1DC0)); + auto* const logo_window = *reinterpret_cast(0x147AD1DC0); SetWindowPos(logo_window, nullptr, 5, 5, width - 25, 60, 0); } diff --git a/src/client/component/cursor.cpp b/src/client/component/cursor.cpp index a18f4eb..19ffde9 100644 --- a/src/client/component/cursor.cpp +++ b/src/client/component/cursor.cpp @@ -49,7 +49,7 @@ namespace cursor { // This is the legacy cursor // TODO: Find the new cursor drawing... - utils::hook::call(SELECT_VALUE(0x14040117E, 0x1404BB119), draw_cursor_stub); + utils::hook::call(0x1404BB119, draw_cursor_stub); scheduler::loop([]() { diff --git a/src/client/component/demonware.cpp b/src/client/component/demonware.cpp index 81bf2c3..62003d1 100644 --- a/src/client/component/demonware.cpp +++ b/src/client/component/demonware.cpp @@ -442,7 +442,7 @@ namespace demonware void post_unpack() override { - utils::hook::jump(SELECT_VALUE(0x140602230, 0x1406F54D0), bd_logger_stub); + utils::hook::jump(0x1406F54D0, bd_logger_stub); } void pre_destroy() override diff --git a/src/client/component/discord.cpp b/src/client/component/discord.cpp index 97960c1..3cc43db 100644 --- a/src/client/component/discord.cpp +++ b/src/client/component/discord.cpp @@ -37,7 +37,7 @@ namespace discord if (!game::CL_IsCgameInitialized()) { - discord_presence.details = game::environment::is_sp() ? "Singleplayer" : "Multiplayer"; + discord_presence.details = "Multiplayer"; discord_presence.state = "Main Menu"; discord_presence.partySize = 0; @@ -47,8 +47,6 @@ namespace discord } else { - if (game::environment::is_sp()) return; - const auto* gametype = game::UI_LocalizeGametype(game::Dvar_FindVar("ui_gametype")->current.string); const auto* map = game::UI_LocalizeMapname(game::Dvar_FindVar("ui_mapname")->current.string); diff --git a/src/client/component/dvar_cheats.cpp b/src/client/component/dvar_cheats.cpp index d17ec07..dd46d13 100644 --- a/src/client/component/dvar_cheats.cpp +++ b/src/client/component/dvar_cheats.cpp @@ -171,8 +171,6 @@ namespace dvar_cheats public: void post_unpack() override { - if (game::environment::is_sp()) return; - utils::hook::nop(0x1404F0D13, 4); // let our stub handle zero-source sets utils::hook::jump(0x1404F0D1A, dvar_flag_checks_stub, true); // check extra dvar flags when setting values diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index 680a3cc..2d4e2d4 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -143,15 +143,16 @@ namespace fastfiles public: void post_unpack() override { - db_try_load_x_file_internal_hook.create(SELECT_VALUE(0x140275850, 0x1403237F0), &db_try_load_x_file_internal); + db_try_load_x_file_internal_hook.create(0x1403237F0, &db_try_load_x_file_internal); db_find_x_asset_header_hook.create(game::DB_FindXAssetHeader, db_find_x_asset_header_stub); dvars::g_dump_scripts = game::Dvar_RegisterBool("g_dumpScripts", false, game::DVAR_FLAG_NONE, "Dump GSC scripts to binary format"); dvars::g_dump_string_tables = game::Dvar_RegisterBool("g_dumpStringTables", false, game::DVAR_FLAG_NONE, "Dump CSV files"); - utils::hook::call(SELECT_VALUE(0x1402752DF, 0x140156350), p_mem_free_stub); - utils::hook::call(SELECT_VALUE(0x140276004, 0x140324259), p_mem_free_stub); + utils::hook::call(0x140156350, p_mem_free_stub); + utils::hook::call(0x140324259, p_mem_free_stub); + // who asked for this this ? command::add("materiallist", [](const command::params& params) { game::DB_EnumXAssets_FastFile(game::ASSET_TYPE_MATERIAL, [](const game::XAssetHeader header, void*) @@ -163,17 +164,14 @@ namespace fastfiles }, nullptr, false); }); - if (!game::environment::is_sp()) - { - reallocate_asset_pool(game::ASSET_TYPE_WEAPON, 320); + reallocate_asset_pool(game::ASSET_TYPE_WEAPON, 320); - // Fixes ("Exceeded limit of 16 'font' assets.") new steam files use a 32 font pool (2026) - reallocate_asset_pool(game::ASSET_TYPE_FONT, 32); + // Fixes ("Exceeded limit of 16 'font' assets.") new steam files use a 32 font pool (2026) + reallocate_asset_pool(game::ASSET_TYPE_FONT, 32); - // Allow loading of unsigned fastfiles - utils::hook::set(0x1402FBF23, 0xEB); // DB_LoadXFile - utils::hook::nop(0x1402FC445, 2); // DB_SetFileLoadCompressor - } + // Allow loading of unsigned fastfiles + utils::hook::set(0x1402FBF23, 0xEB); // DB_LoadXFile + utils::hook::nop(0x1402FC445, 2); // DB_SetFileLoadCompressor } }; } diff --git a/src/client/component/filesystem.cpp b/src/client/component/filesystem.cpp index 6abf5e5..47e850a 100644 --- a/src/client/component/filesystem.cpp +++ b/src/client/component/filesystem.cpp @@ -275,29 +275,18 @@ namespace filesystem void post_unpack() override { // Set fs_basegame - utils::hook::inject(SELECT_VALUE(0x14041C053, 0x1404DDA13), "iw6"); + utils::hook::inject(0x1404DDA13, "iw6"); #ifndef INJECT_HOST_AS_LIB - utils::hook::jump(SELECT_VALUE(0x1404351B0, 0x1404F96C0), sys_default_install_path_stub); + utils::hook::jump(0x1404F96C0, sys_default_install_path_stub); #endif - if (game::environment::is_sp()) - { - utils::hook::call(0x14041B744, fs_startup_stub); + utils::hook::call(0x1404DD704, fs_startup_stub); + utils::hook::call(0x1404DDB43, fs_startup_stub); - utils::hook::call(0x14041CD00, register_custom_path_stub); - utils::hook::call(0x14041CD20, register_custom_path_stub); - utils::hook::call(0x14041CD5F, register_custom_path_stub); - } - else - { - utils::hook::call(0x1404DD704, fs_startup_stub); - utils::hook::call(0x1404DDB43, fs_startup_stub); - - utils::hook::call(0x1404DE550, register_custom_path_stub); - utils::hook::call(0x1404DE570, register_custom_path_stub); - utils::hook::call(0x1404DE5AF, register_custom_path_stub); - } + utils::hook::call(0x1404DE550, register_custom_path_stub); + utils::hook::call(0x1404DE570, register_custom_path_stub); + utils::hook::call(0x1404DE5AF, register_custom_path_stub); } }; } diff --git a/src/client/component/fps.cpp b/src/client/component/fps.cpp index 3614829..34e4b36 100644 --- a/src/client/component/fps.cpp +++ b/src/client/component/fps.cpp @@ -85,7 +85,7 @@ namespace fps perf_calc_fps(&cg_perf, cg_perf.frame_ms); - utils::hook::invoke(SELECT_VALUE(0x1405806E0, 0x140658E30)); + utils::hook::invoke(0x140658E30); } void cg_draw_fps() @@ -167,10 +167,10 @@ namespace fps // fps setup cg_perf.perf_start = std::chrono::high_resolution_clock::now(); - utils::hook::call(SELECT_VALUE(0x140242C11, 0x1402CF457), &perf_update); + utils::hook::call(0x1402CF457, &perf_update); // change cg_drawfps flags to saved - utils::hook::call(SELECT_VALUE(0x1401F400A, 0x140272B98), &cg_draw_fps_register_stub); + utils::hook::call(0x140272B98, &cg_draw_fps_register_stub); cg_drawPing = game::Dvar_RegisterInt("cg_drawPing", 0, 0, 1, game::DVAR_FLAG_SAVED, "Draw ping"); diff --git a/src/client/component/game_log.cpp b/src/client/component/game_log.cpp index 0697c1c..ca580a9 100644 --- a/src/client/component/game_log.cpp +++ b/src/client/component/game_log.cpp @@ -63,11 +63,6 @@ namespace game_log public: void post_load() override { - if (game::environment::is_sp()) - { - return; - } - utils::hook::set(0x1409E8A20, gscr_log_print); scheduler::once([] diff --git a/src/client/component/gameplay.cpp b/src/client/component/gameplay.cpp index db4c8da..5b9f50b 100644 --- a/src/client/component/gameplay.cpp +++ b/src/client/component/gameplay.cpp @@ -65,30 +65,6 @@ namespace gameplay a.jmp(0x140383796); }); - const auto pm_bouncing_stub_sp = utils::hook::assemble([](utils::hook::assembler& a) - { - const auto no_bounce = a.newLabel(); - const auto loc_14046ED26 = a.newLabel(); - - a.push(rax); - - a.mov(rax, qword_ptr(reinterpret_cast(&dvars::pm_bouncing))); - a.mov(al, byte_ptr(rax, 0x10)); - a.cmp(ptr(rbp, -0x40), al); - - a.pop(rax); - a.jz(no_bounce); - a.jmp(0x14046EC7E); - - a.bind(no_bounce); - a.cmp(ptr(rbp, -0x80), r13d); - a.jnz(loc_14046ED26); - a.jmp(0x14046EC6C); - - a.bind(loc_14046ED26); - a.jmp(0x14046ED26); - }); - const auto pm_bouncing_stub_mp = utils::hook::assemble([](utils::hook::assembler& a) { const auto no_bounce = a.newLabel(); @@ -327,21 +303,13 @@ namespace gameplay void post_unpack() override { // Implement bouncing dvar - if (game::environment::is_sp()) - { - utils::hook::nop(0x14046EC5C, 16); - } - - utils::hook::jump( - SELECT_VALUE(0x14046EC5C, 0x140228FFF), SELECT_VALUE(pm_bouncing_stub_sp, pm_bouncing_stub_mp), true); + utils::hook::jump(0x140228FFF, pm_bouncing_stub_mp, true); dvars::pm_bouncing = game::Dvar_RegisterBool("pm_bouncing", false, game::DVAR_FLAG_REPLICATED, "Enable bouncing"); dvars::player_sustainAmmo = game::Dvar_RegisterBool("player_sustainAmmo", false, game::DVAR_FLAG_REPLICATED, "Firing weapon will not decrease clip ammo."); - pm_weapon_use_ammo_hook.create(SELECT_VALUE(0x140479640, 0x140238A90), &pm_weapon_use_ammo_stub); - - if (game::environment::is_sp()) return; + pm_weapon_use_ammo_hook.create(0x140238A90, &pm_weapon_use_ammo_stub); // Implement player ejection dvar dvars::g_playerEjection = game::Dvar_RegisterBool("g_playerEjection", true, game::DVAR_FLAG_REPLICATED, "Flag whether player ejection is on or off"); diff --git a/src/client/component/gsc/script_error.cpp b/src/client/component/gsc/script_error.cpp index 5cb1072..184ee95 100644 --- a/src/client/component/gsc/script_error.cpp +++ b/src/client/component/gsc/script_error.cpp @@ -303,11 +303,11 @@ namespace gsc public: void post_unpack() override { - scr_emit_function_hook.create(SELECT_VALUE(0x1403D3350, 0x14042E150), &scr_emit_function_stub); + scr_emit_function_hook.create(0x14042E150, &scr_emit_function_stub); - utils::hook::call(SELECT_VALUE(0x1403D32E4, 0x14042E0E4), compile_error_stub); // LinkFile - utils::hook::call(SELECT_VALUE(0x1403D3338, 0x14042E138), compile_error_stub); // LinkFile - utils::hook::call(SELECT_VALUE(0x1403D342A, 0x14042E22B), find_variable_stub); // Scr_EmitFunction + utils::hook::call(0x14042E0E4, compile_error_stub); // LinkFile + utils::hook::call(0x14042E138, compile_error_stub); // LinkFile + utils::hook::call(0x14042E22B, find_variable_stub); // Scr_EmitFunction // Restore basic error messages to scr functions utils::hook::jump(game::Scr_GetObject, scr_get_object); @@ -317,16 +317,13 @@ namespace gsc utils::hook::jump(game::Scr_GetInt, scr_get_int); utils::hook::jump(game::Scr_GetFloat, scr_get_float); - utils::hook::jump(SELECT_VALUE(0x1403DE150, 0x1404390B0), scr_get_pointer_type); - utils::hook::jump(SELECT_VALUE(0x1403DE320, 0x140439280), scr_get_type); - utils::hook::jump(SELECT_VALUE(0x1403DE390, 0x1404392F0), scr_get_type_name); + utils::hook::jump(0x1404390B0, scr_get_pointer_type); + utils::hook::jump(0x140439280, scr_get_type); + utils::hook::jump(0x1404392F0, scr_get_type_name); - if (game::environment::is_mp()) - { - utils::hook::call(0x14038A4F7, player_cmd_set_client_dvar_is_valid_name); - utils::hook::call(0x14038A52F, player_cmd_set_client_dvar_server_dvar); - utils::hook::call(0x14038A53A, player_cmd_set_client_dvar_non_writable_dvar); - } + utils::hook::call(0x14038A4F7, player_cmd_set_client_dvar_is_valid_name); + utils::hook::call(0x14038A52F, player_cmd_set_client_dvar_server_dvar); + utils::hook::call(0x14038A53A, player_cmd_set_client_dvar_non_writable_dvar); } void pre_destroy() override diff --git a/src/client/component/gsc/script_extension.cpp b/src/client/component/gsc/script_extension.cpp index 6825a3e..44764b2 100644 --- a/src/client/component/gsc/script_extension.cpp +++ b/src/client/component/gsc/script_extension.cpp @@ -200,7 +200,7 @@ namespace gsc } console::warn("******* script runtime error ********\n"); - const auto opcode_id = *reinterpret_cast(SELECT_VALUE(0x1455BE740, 0x144D57840)); + const auto opcode_id = *reinterpret_cast(0x144D57840); const std::string error = gsc_error_msg.has_value() ? std::format(": {}", gsc_error_msg.value()) : std::string(); @@ -360,21 +360,21 @@ namespace gsc public: void post_unpack() override { - utils::hook::set(SELECT_VALUE(0x14086F468, 0x1409E6CE8), scr_print); - utils::hook::set(SELECT_VALUE(0x14086F480, 0x1409E6D00), scr_print_ln); + utils::hook::set(0x1409E6CE8, scr_print); + utils::hook::set(0x1409E6D00, scr_print_ln); - utils::hook::set(SELECT_VALUE(0x1403D353B + 1, 0x14042E33B + 1), 0x1000); // Scr_RegisterFunction + utils::hook::set(0x14042E33B + 1, 0x1000); // Scr_RegisterFunction - utils::hook::set(SELECT_VALUE(0x1403D3542 + 4, 0x14042E342 + 4), RVA(&func_table)); // Scr_RegisterFunction - // utils::hook::set(SELECT_VALUE(0x1403E0BDD + 3, 0x14043BBBE + 3), RVA(&func_table)); // VM_Execute_0 - utils::hook::inject(SELECT_VALUE(0x1403D38E4 + 3, 0x14042E734 + 3), &func_table); // Scr_BeginLoadScripts + utils::hook::set(0x14042E342 + 4, RVA(&func_table)); // Scr_RegisterFunction + // utils::hook::set(0x14043BBBE + 3, RVA(&func_table)); // VM_Execute_0 + utils::hook::inject(0x14042E734 + 3, &func_table); // Scr_BeginLoadScripts - utils::hook::nop(SELECT_VALUE(0x1403E0BDD + 5, 0x14043BBBE + 5), 2); - utils::hook::call(SELECT_VALUE(0x1403E0BDD, 0x14043BBBE), vm_call_builtin_function); + utils::hook::nop(0x14043BBBE + 5, 2); + utils::hook::call(0x14043BBBE, vm_call_builtin_function); - utils::hook::call(SELECT_VALUE(0x1403D391F, 0x14042E76F), scr_get_function_stub); + utils::hook::call(0x14042E76F, scr_get_function_stub); - utils::hook::call(SELECT_VALUE(0x1403E1ED0, 0x14043CEB1), vm_error_stub); + utils::hook::call(0x14043CEB1, vm_error_stub); add_function("replacefunc", [] { @@ -392,11 +392,6 @@ namespace gsc command::execute(cmd); }); - if (game::environment::is_sp()) - { - return; - } - utils::hook::set(0x1409E6E38, assert_ex_cmd); utils::hook::set(0x1409E6E50, assert_msg_cmd); utils::hook::set(0x1409E6E20, assert_cmd); diff --git a/src/client/component/gsc/script_loading.cpp b/src/client/component/gsc/script_loading.cpp index 0e04a6e..cf75635 100644 --- a/src/client/component/gsc/script_loading.cpp +++ b/src/client/component/gsc/script_loading.cpp @@ -224,26 +224,15 @@ namespace gsc load(base_dir); const auto* map_name = game::Dvar_FindVar("mapname"); + + const std::filesystem::path game_folder = "mp"; - if (game::environment::is_sp()) - { - const std::filesystem::path game_folder = "sp"; + load(base_dir / game_folder); - load(base_dir / game_folder); + load(base_dir / game_folder / map_name->current.string); - load(base_dir / game_folder / map_name->current.string); - } - else - { - const std::filesystem::path game_folder = "mp"; - - load(base_dir / game_folder); - - load(base_dir / game_folder / map_name->current.string); - - const auto* game_type = game::Dvar_FindVar("g_gametype"); - load(base_dir / game_folder / game_type->current.string); - } + const auto* game_type = game::Dvar_FindVar("g_gametype"); + load(base_dir / game_folder / game_type->current.string); } int db_is_x_asset_default(game::XAssetType type, const char* name) @@ -369,14 +358,14 @@ namespace gsc return {{}, script_data}; }); - utils::hook::invoke(SELECT_VALUE(0x1403D3860, 0x14042E6B0)); + utils::hook::invoke(0x14042E6B0); } void scr_end_load_scripts_stub() { gsc_ctx->cleanup(); - utils::hook::invoke(SELECT_VALUE(0x140603C00, 0x14042E7E0)); + utils::hook::invoke(0x14042E7E0); } } @@ -408,17 +397,17 @@ namespace gsc void post_unpack() override { - dvars::com_developer = reinterpret_cast(SELECT_VALUE(0x141603850, 0x1419A9700)); + dvars::com_developer = reinterpret_cast(0x1419A9700); // Load our scripts with an uncompressed stack - utils::hook::call(SELECT_VALUE(0x1403DC8F0, 0x140437940), db_get_raw_buffer_stub); + utils::hook::call(0x140437940, db_get_raw_buffer_stub); - utils::hook::call(SELECT_VALUE(0x14032D1E0, 0x1403CCED9), scr_begin_load_scripts_stub); // GScr_LoadScripts - utils::hook::call(SELECT_VALUE(0x14032D345, 0x1403CD08D), scr_end_load_scripts_stub); // GScr_LoadScripts + utils::hook::call(0x1403CCED9, scr_begin_load_scripts_stub); // GScr_LoadScripts + utils::hook::call(0x1403CD08D, scr_end_load_scripts_stub); // GScr_LoadScripts // ProcessScript - utils::hook::call(SELECT_VALUE(0x1403DC887, 0x1404378D7), find_script); - utils::hook::call(SELECT_VALUE(0x1403DC897, 0x1404378E7), db_is_x_asset_default); + utils::hook::call(0x1404378D7, find_script); + utils::hook::call(0x1404378E7, db_is_x_asset_default); dvars::com_developer_script = game::Dvar_RegisterBool("developer_script", false, game::DVAR_FLAG_NONE, "Enable developer script comments"); @@ -430,21 +419,12 @@ namespace gsc } }); - if (game::environment::is_sp()) - { - utils::hook::call(0x14034996F, g_scr_load_script_and_label_stub); + // GScr_LoadScripts + utils::hook::call(0x1403CD009, gscr_load_game_type_script_stub); - utils::hook::call(0x140316591, scr_load_level_singleplayer_stub); - } - else - { - // GScr_LoadScripts - utils::hook::call(0x1403CD009, gscr_load_game_type_script_stub); - - // Exec script handles - utils::hook::call(0x14039F64E, g_load_structs_stub); - utils::hook::call(0x14039F653, scr_load_level_multiplayer_stub); - } + // Exec script handles + utils::hook::call(0x14039F64E, g_load_structs_stub); + utils::hook::call(0x14039F653, scr_load_level_multiplayer_stub); } }; } diff --git a/src/client/component/input.cpp b/src/client/component/input.cpp index 6c3ecb9..5859421 100644 --- a/src/client/component/input.cpp +++ b/src/client/component/input.cpp @@ -50,8 +50,8 @@ namespace input return; } - cl_char_event_hook.create(SELECT_VALUE(0x14023CE50, 0x1402C2AE0), cl_char_event_stub); - cl_key_event_hook.create(SELECT_VALUE(0x14023D070, 0x1402C2CE0), cl_key_event_stub); + cl_char_event_hook.create(0x1402C2AE0, cl_char_event_stub); + cl_key_event_hook.create(0x1402C2CE0, cl_key_event_stub); } }; } diff --git a/src/client/component/localized_strings.cpp b/src/client/component/localized_strings.cpp index 00e8910..5deb023 100644 --- a/src/client/component/localized_strings.cpp +++ b/src/client/component/localized_strings.cpp @@ -58,7 +58,7 @@ namespace localized_strings void post_unpack() override { // Change some localized strings - seh_string_ed_get_string_hook.create(SELECT_VALUE(0x1403F42D0, 0x1404A5F60), &seh_string_ed_get_string); + seh_string_ed_get_string_hook.create(0x1404A5F60, &seh_string_ed_get_string); } }; } diff --git a/src/client/component/logger.cpp b/src/client/component/logger.cpp index 0cdf0f7..9675013 100644 --- a/src/client/component/logger.cpp +++ b/src/client/component/logger.cpp @@ -114,7 +114,7 @@ namespace logger } // Make havok script's print function actually print - utils::hook::jump(SELECT_VALUE(0x1406283A4, 0x140732184), print); + utils::hook::jump(0x140732184, print); logger_dev = game::Dvar_RegisterBool("logger_dev", false, game::DVAR_FLAG_NONE, "Print dev stuff"); } diff --git a/src/client/component/mods.cpp b/src/client/component/mods.cpp index aea4be0..dfa7724 100644 --- a/src/client/component/mods.cpp +++ b/src/client/component/mods.cpp @@ -168,17 +168,12 @@ namespace mods void post_unpack() override { - dvars::fs_gameDirVar = reinterpret_cast(SELECT_VALUE(0x145856D38, 0x147876000)); + dvars::fs_gameDirVar = reinterpret_cast(0x147876000); // Remove DVAR_INIT from fs_game - utils::hook::set(SELECT_VALUE(0x14041C085 + 2, 0x1404DDA45 + 2), SELECT_VALUE(game::DVAR_FLAG_NONE, game::DVAR_FLAG_SERVERINFO)); + utils::hook::set(0x1404DDA45 + 2, game::DVAR_FLAG_SERVERINFO); - utils::hook::inject(SELECT_VALUE(0x14041C097 + 3, 0x1404DDA57 + 3), &fs_game_dir_domain_func); - - if (game::environment::is_sp()) - { - return; - } + utils::hook::inject(0x1404DDA57 + 3, &fs_game_dir_domain_func); // Don't load eng_ + patch_ with loadzone utils::hook::nop(0x1403217B1, 15); diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index 0222a44..1e5365f 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -210,11 +210,6 @@ namespace network void post_unpack() override { { - if (game::environment::is_sp()) - { - return; - } - // redirect dw_sendto to raw socket utils::hook::jump(0x140501A00, dw_send_to_stub); diff --git a/src/client/component/notifies.cpp b/src/client/component/notifies.cpp index 7fc89e4..ba4986a 100644 --- a/src/client/component/notifies.cpp +++ b/src/client/component/notifies.cpp @@ -63,12 +63,10 @@ namespace notifies const auto* guid = game::SV_GetGuid(client_num); const auto* name = game::mp::svs_clients[client_num].name; - game_log::g_log_printf("%s;%s;%i;%s;%s\n", - params.get(0), - guid, + game_log::g_log_printf("%s;%s;%i;%s;%s\n", params.get(0), guid, client_num, name, - message.data() + message.c_str() ); }, scheduler::pipeline::server); @@ -126,7 +124,7 @@ namespace notifies a.lea(eax, dword_ptr(r15, -0x17)); a.mov(dword_ptr(rbp, 0x60), r15d); - a.jmp(SELECT_VALUE(0x1403DF5B3, 0x14043A593)); + a.jmp(0x14043A593); a.bind(replace); @@ -174,7 +172,7 @@ namespace notifies public: void post_unpack() override { - utils::hook::jump(SELECT_VALUE(0x1403DF5A4, 0x14043A584), utils::hook::assemble(vm_execute_stub), true); + utils::hook::jump(0x14043A584, utils::hook::assemble(vm_execute_stub), true); scripting::on_shutdown([](const int clear_scripts, const int post_shutdown) -> void { @@ -184,11 +182,6 @@ namespace notifies } }); - if (game::environment::is_sp()) - { - return; - } - utils::hook::call(0x1404724DD, client_command_stub); } }; diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 723f5d5..e0c766d 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -40,11 +40,6 @@ namespace party void connect_to_party(const game::netadr_s& target, const std::string& mapname, const std::string& gametype) { - if (game::environment::is_sp()) - { - return; - } - if (game::Live_SyncOnlineDataFlags(0)) { scheduler::once([=]() @@ -201,11 +196,6 @@ namespace party void connect(const game::netadr_s& target) { - if (game::environment::is_sp()) - { - return; - } - command::execute("lui_open popup_acceptinginvite", false); connect_state.host = target; @@ -230,11 +220,6 @@ namespace party public: void post_unpack() override { - if (game::environment::is_sp()) - { - return; - } - // hook disconnect command function utils::hook::jump(0x1402C6370, disconnect_stub); diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 878d3f6..9fdfaac 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -33,12 +33,13 @@ namespace patches { return; } + return sv_kick_client_num_hook.invoke(clientNum, reason); } std::string get_login_username() { - char username[UNLEN + 1]; + char username[UNLEN + 1]{}; DWORD username_len = UNLEN + 1; if (!GetUserNameA(username, &username_len)) { @@ -55,7 +56,7 @@ namespace patches if (game::environment::is_mp()) { // Make name save - game::Dvar_RegisterString("name", get_login_username().data(), game::DVAR_FLAG_SAVED, "Player name."); + game::Dvar_RegisterString("name", get_login_username().c_str(), game::DVAR_FLAG_SAVED, "Player name."); } return com_register_dvars_hook.invoke(); @@ -106,23 +107,6 @@ namespace patches a.jmp(0x1403F7574); }); - auto cmd_exec_stub_sp = utils::hook::assemble([](utils::hook::assembler& a) - { - const auto success = a.newLabel(); - - a.pushad64(); - a.call_aligned(cmd_exec_patch); - a.test(al, al); - a.popad64(); - - a.jz(success); - a.mov(edx, 0x18000); - a.jmp(0x1403B39C0); - - a.bind(success); - a.jmp(0x1403B3A04); - }); - int dvar_command_patch() // game makes this return an int and compares with eax instead of al -_- { const command::params args{}; @@ -235,14 +219,10 @@ namespace patches LoadLibraryA("PhysXUpdateLoader64.dll"); // Unlock fps in main menu - utils::hook::set(SELECT_VALUE(0x140242DDB, 0x1402CF58B), 0xEB); + utils::hook::set(0x1402CF58B, 0xEB); // Unlock cg_fov - utils::hook::call(SELECT_VALUE(0x1401F3E96, 0x14027273C), register_cg_fov_stub); - if (game::environment::is_sp()) - { - utils::hook::call(0x1401F3EC7, register_cg_fov_stub); - } + utils::hook::call(0x14027273C, register_cg_fov_stub); // changed max value from 85 -> 1000 if (!game::environment::is_dedi()) @@ -250,11 +230,8 @@ namespace patches dvars::override::register_int("com_maxfps", 85, 0, 1000, game::DVAR_FLAG_SAVED); } - if (!game::environment::is_sp()) - { - //increased max limit for sv_network_fps, the lower limit is the default one. Original range is from 20 to 200 times a second. - utils::hook::call(0x140476F4F, register_network_fps_stub); - } + // increased max limit for sv_network_fps, the lower limit is the default one. Original range is from 20 to 200 times a second. + utils::hook::call(0x140476F4F, register_network_fps_stub); // register cg_gun_ dvars with new values and flags // maybe _x can stay usable within a reasonable range? it can make scoped weapons DRASTICALLY better on high FOVs @@ -266,29 +243,18 @@ namespace patches dvars::override::register_float("cg_fovScale", 1.0f, 0.1f, 5.0f, game::DVAR_FLAG_SAVED); // Patch Dvar_Command to print out values how CoD4 does it - utils::hook::jump(SELECT_VALUE(0x1403BFCB0, 0x140416A60), dvar_command_patch); + utils::hook::jump(0x140416A60, dvar_command_patch); // Allow executing custom cfg files with the "exec" command - utils::hook::jump(SELECT_VALUE(0x1403B39BB, 0x1403F752B), SELECT_VALUE(0x1403B3A12, 0x1403F7582)); + utils::hook::jump(0x1403F752B, 0x1403F7582); //Use a relative jump to empty memory first - utils::hook::jump(SELECT_VALUE(0x1403B3A12, 0x1403F7582), SELECT_VALUE(cmd_exec_stub_sp, cmd_exec_stub_mp), true); + utils::hook::jump(0x1403F7582, cmd_exec_stub_mp, true); // Use empty memory to go to our stub first (can't do close jump, so need space for 12 bytes) - // Fix mouse lag - utils::hook::nop(SELECT_VALUE(0x14043E6CB, 0x140504A2B), 6); - scheduler::loop([]() - { - SetThreadExecutionState(ES_DISPLAY_REQUIRED); - }, scheduler::pipeline::main); + // nop call to SetThreadExecutionState for good luck (???) + utils::hook::nop(0x140504A2B, 6); - if (game::environment::is_sp()) - { - patch_sp(); - } - else - { - patch_mp(); - } + patch_mp(); } static void patch_mp() @@ -377,13 +343,6 @@ namespace patches // Disable Com_Error in NET_SendPacket utils::hook::nop(0x140501AE3, 5); } - - static void patch_sp() - { - // SP doesn't initialize WSA - WSADATA wsa_data; - WSAStartup(MAKEWORD(2, 2), &wsa_data); - } }; } diff --git a/src/client/component/ranked.cpp b/src/client/component/ranked.cpp index 55bc4b4..a60714e 100644 --- a/src/client/component/ranked.cpp +++ b/src/client/component/ranked.cpp @@ -74,11 +74,6 @@ namespace ranked public: void post_unpack() override { - if (game::environment::is_sp()) - { - return; - } - if (game::environment::is_mp()) { // This must be registered as 'true' to avoid crash when starting a private match diff --git a/src/client/component/raw_mouse.cpp b/src/client/component/raw_mouse.cpp index 1108074..c62435b 100644 --- a/src/client/component/raw_mouse.cpp +++ b/src/client/component/raw_mouse.cpp @@ -181,16 +181,15 @@ namespace raw_mouse return; } - utils::hook::call(SELECT_VALUE(0x14043845F, 0x1404FC3FB), &in_mouse_move); + utils::hook::call(0x1404FC3FB, &in_mouse_move); - utils::hook::call(SELECT_VALUE(0x140519F71, 0x1405E69A1), &create_window_ex_a_stub); - utils::hook::set(SELECT_VALUE(0x140519F76, 0x1405E69A6), 0x90); + utils::hook::call(0x1405E69A1, &create_window_ex_a_stub); + utils::hook::set(0x1405E69A6, 0x90); - utils::hook::call(SELECT_VALUE(0x14043BF04, 0x140500824), ®ister_class_ex_a_stub); - utils::hook::set(SELECT_VALUE(0x14043BF09, 0x140500829), 0x90); + utils::hook::call(0x140500824, ®ister_class_ex_a_stub); + utils::hook::set(0x140500829, 0x90); - cl_rawInput = game::Dvar_RegisterBool("cl_rawInput", true, - game::DVAR_FLAG_SAVED, "Use Raw Input for mouse input. This fixes mouse acceleration issue"); + cl_rawInput = game::Dvar_RegisterBool("cl_rawInput", true, game::DVAR_FLAG_SAVED, "Use Raw Input for mouse. This fixes mouse acceleration issue"); } }; } diff --git a/src/client/component/rcon.cpp b/src/client/component/rcon.cpp index 6f740ce..f289525 100644 --- a/src/client/component/rcon.cpp +++ b/src/client/component/rcon.cpp @@ -123,8 +123,6 @@ namespace rcon public: void post_unpack() override { - if (game::environment::is_sp()) return; - scheduler::once([]() { game::Dvar_RegisterString("rcon_password", "", game::DvarFlags::DVAR_FLAG_NONE, diff --git a/src/client/component/renderer.cpp b/src/client/component/renderer.cpp index 163b47c..63c9df0 100644 --- a/src/client/component/renderer.cpp +++ b/src/client/component/renderer.cpp @@ -49,8 +49,8 @@ namespace renderer dvars::r_fullbright = game::Dvar_RegisterBool("r_fullbright", false, game::DVAR_FLAG_CHEAT, "Toggles rendering without lighting"); - r_init_draw_method_hook.create(SELECT_VALUE(0x1404FF600, 0x1405CB470), &r_init_draw_method_stub); - r_update_front_end_dvar_options_hook.create(SELECT_VALUE(0x140535FF0, 0x140603240), &r_update_front_end_dvar_options_stub); + r_init_draw_method_hook.create(0x1405CB470, &r_init_draw_method_stub); + r_update_front_end_dvar_options_hook.create(0x140603240, &r_update_front_end_dvar_options_stub); } }; } diff --git a/src/client/component/scheduler.cpp b/src/client/component/scheduler.cpp index bada509..017cb2a 100644 --- a/src/client/component/scheduler.cpp +++ b/src/client/component/scheduler.cpp @@ -149,7 +149,7 @@ namespace scheduler { schedule([=]() { - const auto dw_init = game::environment::is_sp() || game::Live_SyncOnlineDataFlags(0) == 0; + const auto dw_init = game::Live_SyncOnlineDataFlags(0) == 0; if (dw_init && game::Sys_IsDatabaseReady2()) { once(callback, type, delay); @@ -177,10 +177,10 @@ namespace scheduler void post_unpack() override { - r_end_frame_hook.create(SELECT_VALUE(0x140534860, 0x140601AA0), scheduler::r_end_frame_stub); + r_end_frame_hook.create(0x140601AA0, scheduler::r_end_frame_stub); - utils::hook::call(SELECT_VALUE(0x1403BC922, 0x140413142), scheduler::main_frame_stub); - utils::hook::call(SELECT_VALUE(0x1403185FD, 0x1403A0AF9), scheduler::server_frame_stub); + utils::hook::call(0x140413142, scheduler::main_frame_stub); + utils::hook::call(0x1403A0AF9, scheduler::server_frame_stub); } void pre_destroy() override diff --git a/src/client/component/scripting.cpp b/src/client/component/scripting.cpp index 8b1b48c..65d142c 100644 --- a/src/client/component/scripting.cpp +++ b/src/client/component/scripting.cpp @@ -195,24 +195,20 @@ namespace scripting public: void post_unpack() override { - // SP address is wrong, but should be ok - scr_load_level_hook.create(SELECT_VALUE(0x14013D5D0, 0x1403C4E60), &scr_load_level_stub); - g_shutdown_game_hook.create(SELECT_VALUE(0x140318C10, 0x1403A0DF0), &g_shutdown_game_stub); + scr_load_level_hook.create(0x1403C4E60, &scr_load_level_stub); + g_shutdown_game_hook.create(0x1403A0DF0, &g_shutdown_game_stub); - scr_set_thread_position_hook.create(SELECT_VALUE(0x1403D3560, 0x14042E360), &scr_set_thread_position_stub); - process_script_hook.create(SELECT_VALUE(0x1403DC870, 0x1404378C0), &process_script_stub); + scr_set_thread_position_hook.create(0x14042E360, &scr_set_thread_position_stub); + process_script_hook.create(0x1404378C0, &process_script_stub); sl_get_canonical_string_hook.create(game::SL_GetCanonicalString, &sl_get_canonical_string_stub); - if (!game::environment::is_sp()) - { - // Make some room for pre_main hook - utils::hook::jump(0x1402084A0, has_config_string_index); + // Make some room for pre_main hook + utils::hook::jump(0x1402084A0, has_config_string_index); - // Allow precaching anytime - utils::hook::jump(0x1402084A5, is_pre_main_stub); - utils::hook::set(0x1402084D0, 0xD3EB); // jump to 0x1402084A5 - g_find_config_string_index.create(0x140161F90, &g_find_config_string_index_stub); - } + // Allow precaching anytime + utils::hook::jump(0x1402084A5, is_pre_main_stub); + utils::hook::set(0x1402084D0, 0xD3EB); // jump to 0x1402084A5 + g_find_config_string_index.create(0x140161F90, &g_find_config_string_index_stub); } }; } diff --git a/src/client/component/security.cpp b/src/client/component/security.cpp index 581107e..d0069a2 100644 --- a/src/client/component/security.cpp +++ b/src/client/component/security.cpp @@ -105,9 +105,7 @@ namespace security void post_unpack() override { // sprinf - utils::hook::call(SELECT_VALUE(0x140310D0F, 0x140399B0F), hud_elem_set_enum_string_stub); - - if (game::environment::is_sp()) return; + utils::hook::call(0x140399B0F, hud_elem_set_enum_string_stub); // Patch vulnerability in PlayerCards_SetCachedPlayerData utils::hook::call(0x140287C5C, set_cached_playerdata_stub); diff --git a/src/client/component/slowmotion.cpp b/src/client/component/slowmotion.cpp index 3a0e1b5..d90ccc1 100644 --- a/src/client/component/slowmotion.cpp +++ b/src/client/component/slowmotion.cpp @@ -83,11 +83,6 @@ namespace slowmotion public: void post_unpack() override { - if (game::environment::is_sp()) - { - return; - } - command::add("timescale", com_timescale_f); if (!game::environment::is_dedi()) diff --git a/src/client/component/splash.cpp b/src/client/component/splash.cpp index de919df..52ceeb9 100644 --- a/src/client/component/splash.cpp +++ b/src/client/component/splash.cpp @@ -30,9 +30,9 @@ namespace splash void post_unpack() override { // Disable native splash screen - utils::hook::nop(SELECT_VALUE(0x14043C15B, 0x140500ADB), 5); - utils::hook::jump(SELECT_VALUE(0x14043D5A0, 0x140502000), destroy_stub); - utils::hook::jump(SELECT_VALUE(0x14043D5E0, 0x140502040), destroy_stub); + utils::hook::nop(0x140500ADB, 5); + utils::hook::jump(0x140502000, destroy_stub); + utils::hook::jump(0x140502040, destroy_stub); } void pre_destroy() override diff --git a/src/client/component/steam_proxy.cpp b/src/client/component/steam_proxy.cpp index a8ad1ba..028340d 100644 --- a/src/client/component/steam_proxy.cpp +++ b/src/client/component/steam_proxy.cpp @@ -46,16 +46,27 @@ namespace steam_proxy #ifndef DEV_BUILD try { - const std::string game_type = game::environment::is_sp() ? "singleplayer" : "multiplayer"; - state_ = this->start_mod("\xF0\x9F\x92\x8E" " iw6-mod: " + (game_type), game::environment::is_sp() ? 209160 : 209170); + const std::string game_type = "multiplayer"; + state_ = this->start_mod("\xF0\x9F\x92\x8E" " iw6-mod: " + (game_type), 209170); } catch (const std::exception& ex) { state_ = ownership_state::error; printf("Steam: %s\n", ex.what()); } + +#ifdef STEAM_OWNERSHIP_CHECK + if (utils::nt::is_wine()) + { + state_ = ownership_state::success; + return; + } +#endif + +#ifdef STEAM_OWNERSHIP_CHECK + evaluate_ownership_state(state_); +#endif #endif - (void)state_; } void pre_destroy() override @@ -212,6 +223,23 @@ namespace steam_proxy return scheduler::cond_end; }); } + +#ifdef STEAM_OWNERSHIP_CHECK + void evaluate_ownership_state(const ownership_state state) + { + switch (state) + { + case ownership_state::nosteam: + throw std::runtime_error("Steam must be running to play this game!"); + case ownership_state::unowned: + throw std::runtime_error("You must own the game on Steam to play this mod!"); + case ownership_state::error: + throw std::runtime_error("Failed to verify ownership of the game!"); + case ownership_state::success: + break; + } + } +#endif }; } diff --git a/src/client/component/ui_scripting.cpp b/src/client/component/ui_scripting.cpp index ac1e879..9310100 100644 --- a/src/client/component/ui_scripting.cpp +++ b/src/client/component/ui_scripting.cpp @@ -32,15 +32,13 @@ namespace ui_scripting std::string root; }; - struct globals + struct { std::string in_require_script; std::vector