diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index 9520d2f6..da034395 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -152,7 +152,7 @@ namespace command public: void post_unpack() override { - utils::hook::jump(game::base_address + 0x5A74F0, dvar_command_stub, true); + utils::hook::jump(0x5A74F0_b, dvar_command_stub, true); add("quit", game::Com_Quit_f); @@ -160,7 +160,7 @@ namespace command { const auto map = params.get(1); - const auto exists = utils::hook::invoke(game::base_address + 0x412B50, map, 0); + const auto exists = utils::hook::invoke(0x412B50_b, map, 0); if (!exists) { @@ -169,7 +169,7 @@ namespace command } // SV_SpawnServer - utils::hook::invoke(game::base_address + 0x6B3AA0, map, 0, 0, 0, 0); + utils::hook::invoke(0x6B3AA0_b, map, 0, 0, 0, 0); }); add("say", [](const params& params) diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index 01b9ce94..cded2397 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -42,7 +42,7 @@ namespace fastfiles public: void post_unpack() override { - db_try_load_x_file_internal_hook.create(game::base_address + 0x4173B0, &db_try_load_x_file_internal); + db_try_load_x_file_internal_hook.create(0x4173B0_b, &db_try_load_x_file_internal); command::add("loadzone", [](const command::params& params) { diff --git a/src/client/component/images.cpp b/src/client/component/images.cpp index e82c532c..693f208d 100644 --- a/src/client/component/images.cpp +++ b/src/client/component/images.cpp @@ -111,8 +111,8 @@ namespace images public: void post_unpack() override { - setup_texture_hook.create(game::base_address + 0x74A390, setup_texture_stub); - load_texture_hook.create(game::base_address + 0x2A7940, load_texture_stub); + setup_texture_hook.create(0x74A390_b, setup_texture_stub); + load_texture_hook.create(0x2A7940_b, load_texture_stub); } }; } diff --git a/src/client/component/input.cpp b/src/client/component/input.cpp index fa8f941c..dc777972 100644 --- a/src/client/component/input.cpp +++ b/src/client/component/input.cpp @@ -58,9 +58,9 @@ namespace input public: void post_unpack() override { - cl_char_event_hook.create(game::base_address + 0x3D27B0, cl_char_event_stub); - cl_key_event_hook.create(game::base_address + 0x3D2AE0, cl_key_event_stub); - cl_mouse_move_hook.create(game::base_address + 0x3296F0, cl_mouse_move_stub); + cl_char_event_hook.create(0x3D27B0_b, cl_char_event_stub); + cl_key_event_hook.create(0x3D2AE0_b, cl_key_event_stub); + cl_mouse_move_hook.create(0x3296F0_b, cl_mouse_move_stub); } }; } diff --git a/src/client/component/localized_strings.cpp b/src/client/component/localized_strings.cpp index 60d988b1..f09fe247 100644 --- a/src/client/component/localized_strings.cpp +++ b/src/client/component/localized_strings.cpp @@ -46,7 +46,7 @@ namespace localized_strings void post_unpack() override { // Change some localized strings - seh_string_ed_get_string_hook.create(game::base_address + 0x5E5FD0, &seh_string_ed_get_string); + seh_string_ed_get_string_hook.create(0x5E5FD0_b, &seh_string_ed_get_string); } }; } diff --git a/src/client/component/lui.cpp b/src/client/component/lui.cpp index 50267901..87ee13b4 100644 --- a/src/client/component/lui.cpp +++ b/src/client/component/lui.cpp @@ -39,8 +39,8 @@ namespace lui command::add("lui_restart", []() { - utils::hook::invoke(game::base_address + 0x3203B0); - utils::hook::invoke(game::base_address + 0x32D370); + utils::hook::invoke(0x3203B0_b); + utils::hook::invoke(0x32D370_b); }); } }; diff --git a/src/client/component/notifies.cpp b/src/client/component/notifies.cpp index e0e04d4b..1419fa67 100644 --- a/src/client/component/notifies.cpp +++ b/src/client/component/notifies.cpp @@ -94,7 +94,7 @@ namespace notifies a.inc(r14); a.mov(dword_ptr(rbp, 0xA4), r15d); - a.jmp(game::base_address + 0x5C90B3); + a.jmp(0x5C90B3_b); a.bind(replace); @@ -137,7 +137,7 @@ namespace notifies std::string convert_mod(const int meansOfDeath) { - const auto value = reinterpret_cast(game::base_address + 0xBF49B0)[meansOfDeath]; + const auto value = reinterpret_cast(0xBF49B0_b)[meansOfDeath]; const auto string = game::SL_ConvertToString(*value); return string; @@ -147,7 +147,7 @@ namespace notifies int damage, int dflags, const unsigned int hitLoc, const unsigned int weapon, bool isAlternate, unsigned int a11, const int meansOfDeath, unsigned int a13, unsigned int a14) { { - const std::string _hitLoc = reinterpret_cast(game::base_address + 0xBF4AA0)[hitLoc]; + const std::string _hitLoc = reinterpret_cast(0xBF4AA0_b)[hitLoc]; const auto _mod = convert_mod(meansOfDeath); const auto _weapon = get_weapon_name(weapon, isAlternate); @@ -199,9 +199,9 @@ namespace notifies public: void post_unpack() override { - utils::hook::jump(game::base_address + 0x5C90A5, utils::hook::assemble(vm_execute_stub), true); + utils::hook::jump(0x5C90A5_b, utils::hook::assemble(vm_execute_stub), true); - scr_entity_damage_hook.create(game::base_address + 0x4BD2E0, scr_entity_damage_stub); + scr_entity_damage_hook.create(0x4BD2E0_b, scr_entity_damage_stub); } }; } diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index ac948f43..74bb41ef 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -23,7 +23,7 @@ namespace patches uint64_t off_11C52460; void* sub_46148() { - off_11C52460 = game::base_address + 0xAD0C58; + off_11C52460 = 0xAD0C58_b; return &off_11C52460; } } @@ -34,17 +34,17 @@ namespace patches void post_unpack() override { // Not sure but it works - utils::hook::set(game::base_address + 0x633080, 0xC301B0); - utils::hook::set(game::base_address + 0x272F70, 0xC301B0); - utils::hook::jump(game::base_address + 0x46148, sub_46148, true); + utils::hook::set(0x633080_b, 0xC301B0); + utils::hook::set(0x272F70_b, 0xC301B0); + utils::hook::jump(0x46148_b, sub_46148, true); // Unlock fps in main menu - utils::hook::set(game::base_address + 0x3D8E1B, 0xEB); + utils::hook::set(0x3D8E1B_b, 0xEB); // Disable battle net popup - utils::hook::nop(game::base_address + 0x5F4496, 5); + utils::hook::nop(0x5F4496_b, 5); - pm_crashland_hook.create(game::base_address + 0x688A20, pm_crashland_stub); + pm_crashland_hook.create(0x688A20_b, pm_crashland_stub); dvars::jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", 1, game::DVAR_FLAG_REPLICATED); dvars::register_float("jump_height", 39, 0, 1000, game::DVAR_FLAG_REPLICATED); diff --git a/src/client/component/renderer.cpp b/src/client/component/renderer.cpp index eb8c5a6e..be9f7360 100644 --- a/src/client/component/renderer.cpp +++ b/src/client/component/renderer.cpp @@ -63,8 +63,8 @@ namespace renderer { dvars::r_fullbright = dvars::register_int("r_fullbright", 0, 0, 3, game::DVAR_FLAG_SAVED); - r_init_draw_method_hook.create(game::base_address + 0x72F950, &r_init_draw_method_stub); - r_update_front_end_dvar_options_hook.create(game::base_address + 0x76EE70, &r_update_front_end_dvar_options_stub); + r_init_draw_method_hook.create(0x72F950_b, &r_init_draw_method_stub); + r_update_front_end_dvar_options_hook.create(0x76EE70_b, &r_update_front_end_dvar_options_stub); } }; } diff --git a/src/client/component/scheduler.cpp b/src/client/component/scheduler.cpp index 653818ff..5c33bfa1 100644 --- a/src/client/component/scheduler.cpp +++ b/src/client/component/scheduler.cpp @@ -178,9 +178,9 @@ namespace scheduler void post_unpack() override { - r_end_frame_hook.create(game::base_address + 0x76D7B0, scheduler::r_end_frame_stub); - g_run_frame_hook.create(game::base_address + 0x4CB030, scheduler::server_frame_stub); - main_frame_hook.create(game::base_address + 0x417FA0, scheduler::main_frame_stub); + r_end_frame_hook.create(0x76D7B0_b, scheduler::r_end_frame_stub); + g_run_frame_hook.create(0x4CB030_b, scheduler::server_frame_stub); + main_frame_hook.create(0x417FA0_b, scheduler::main_frame_stub); } void pre_destroy() override diff --git a/src/client/component/scripting.cpp b/src/client/component/scripting.cpp index ec1f4457..c6ad6c0e 100644 --- a/src/client/component/scripting.cpp +++ b/src/client/component/scripting.cpp @@ -104,14 +104,14 @@ namespace scripting public: void post_unpack() override { - vm_notify_hook.create(game::base_address + 0x5CC450, vm_notify_stub); + vm_notify_hook.create(0x5CC450_b, vm_notify_stub); - g_shutdown_game_hook.create(game::base_address + 0x4CBAD0, g_shutdown_game_stub); - player_spawn_hook.create(game::base_address + 0x4B0710, player_spawn_stub); + g_shutdown_game_hook.create(0x4CBAD0_b, g_shutdown_game_stub); + player_spawn_hook.create(0x4B0710_b, player_spawn_stub); - scr_add_class_field_hook.create(game::base_address + 0x5C2C30, scr_add_class_field_stub); - scr_set_thread_position_hook.create(game::base_address + 0x5BC7E0, scr_set_thread_position_stub); - process_script_hook.create(game::base_address + 0x5C6160, process_script_stub); + scr_add_class_field_hook.create(0x5C2C30_b, scr_add_class_field_stub); + scr_set_thread_position_hook.create(0x5BC7E0_b, scr_set_thread_position_stub); + process_script_hook.create(0x5C6160_b, process_script_stub); scheduler::loop([]() { diff --git a/src/client/component/ui_scripting.cpp b/src/client/component/ui_scripting.cpp index 527d4315..ab63ad29 100644 --- a/src/client/component/ui_scripting.cpp +++ b/src/client/component/ui_scripting.cpp @@ -229,12 +229,12 @@ namespace ui_scripting }, scheduler::pipeline::renderer); }); - hks_start_hook.create(game::base_address + 0x328BE0, hks_start_stub); - hks_shutdown_hook.create(game::base_address + 0x3203B0, hks_shutdown_stub); - hksi_open_lib_hook.create(game::base_address + 0x2E4530, hksi_open_lib_stub); - hksi_lual_error_hook.create(game::base_address + 0x2E3E40, hksi_lual_error_stub); - hksi_lual_error_hook2.create(game::base_address + 0x2DCB40, hksi_lual_error_stub); - hksi_add_function_hook.create(game::base_address + 0x2DB570, hksi_add_function_stub); + hks_start_hook.create(0x328BE0_b, hks_start_stub); + hks_shutdown_hook.create(0x3203B0_b, hks_shutdown_stub); + hksi_open_lib_hook.create(0x2E4530_b, hksi_open_lib_stub); + hksi_lual_error_hook.create(0x2E3E40_b, hksi_lual_error_stub); + hksi_lual_error_hook2.create(0x2DCB40_b, hksi_lual_error_stub); + hksi_add_function_hook.create(0x2DB570_b, hksi_add_function_stub); } }; } diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index 63b2cf7b..fd4ae831 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -78,4 +78,9 @@ namespace game } } } +} + +uintptr_t operator"" _b(const uintptr_t ptr) +{ + return game::base_address + ptr; } \ No newline at end of file diff --git a/src/client/game/game.hpp b/src/client/game/game.hpp index 1a208510..6085c887 100644 --- a/src/client/game/game.hpp +++ b/src/client/game/game.hpp @@ -52,4 +52,6 @@ namespace game }; } +uintptr_t operator"" _b(const uintptr_t ptr); + #include "symbols.hpp" \ No newline at end of file diff --git a/src/client/game/ui_scripting/lua/context.cpp b/src/client/game/ui_scripting/lua/context.cpp index 3c3c5503..c191c58f 100644 --- a/src/client/game/ui_scripting/lua/context.cpp +++ b/src/client/game/ui_scripting/lua/context.cpp @@ -960,7 +960,7 @@ namespace ui_scripting::lua game_type["playmenuvideo"] = [](const game&, const std::string& video) { reinterpret_cast - (::game::base_address + 0x71B970)(video.data(), 64, 0); + (0x71B970_b)(video.data(), 64, 0); }; game_type[sol::meta_function::index] = [](const game&, const std::string& name) diff --git a/src/client/main.cpp b/src/client/main.cpp index 83172fa9..45a1a6bd 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -91,7 +91,7 @@ void remove_crash_file() void verify_version() { - const auto value = *reinterpret_cast(game::base_address + 0x123456); + const auto value = *reinterpret_cast(0x123456_b); if (value != 0xE465E151) { throw std::runtime_error("Unsupported Call of Duty: Modern Warfare 2 Campaign Remastered version");