diff --git a/src/client/component/binding.cpp b/src/client/component/binding.cpp index 0eb88f30..e29c2871 100644 --- a/src/client/component/binding.cpp +++ b/src/client/component/binding.cpp @@ -118,13 +118,13 @@ namespace binding void post_unpack() override { // write all bindings to config file - key_write_bindings_to_buffer_hook.create(0x3D3840_b, key_write_bindings_to_buffer_stub); + key_write_bindings_to_buffer_hook.create(0x1403D3840, key_write_bindings_to_buffer_stub); // links a custom command to an index - utils::hook::jump(0x59AE30_b, key_get_binding_for_cmd_stub, true); + utils::hook::jump(0x14059AE30, key_get_binding_for_cmd_stub, true); // execute custom binds - cl_execute_key_hook.create(0x3CF1E0_b, &cl_execute_key_stub); + cl_execute_key_hook.create(0x1403CF1E0, &cl_execute_key_stub); } }; } diff --git a/src/client/component/branding.cpp b/src/client/component/branding.cpp index 46f0ad7f..42204839 100644 --- a/src/client/component/branding.cpp +++ b/src/client/component/branding.cpp @@ -45,7 +45,7 @@ namespace branding localized_strings::override("MENU_SYSINFO_DONATION_LINK", "Donation Link:"); localized_strings::override("MENU_SYSINFO_DONATION_URL", "https://paypal.me/fedecek"); - utils::hook::jump(0x33D550_b, get_build_number_stub, true); + utils::hook::jump(0x14033D550, get_build_number_stub, true); } }; } diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index 0240cc7e..d5737946 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -148,7 +148,7 @@ namespace command public: void post_unpack() override { - utils::hook::jump(0x5A74F0_b, dvar_command_stub, true); + utils::hook::jump(0x1405A74F0, dvar_command_stub, true); add("quit", game::Quit); @@ -156,7 +156,7 @@ namespace command { const auto map = params.get(1); - const auto exists = utils::hook::invoke(0x412B50_b, map, 0); + const auto exists = utils::hook::invoke(0x140412B50, map, 0); if (!exists) { @@ -165,7 +165,7 @@ namespace command } // SV_SpawnServer - utils::hook::invoke(0x6B3AA0_b, map, 0, 0, 0, 0); + utils::hook::invoke(0x1406B3AA0, map, 0, 0, 0, 0); }); add("say", [](const params& params) @@ -207,11 +207,6 @@ namespace command } }); - add("baseAddress", []() - { - printf("%p\n", (void*)game::base_address); - }); - add("commandDump", []() { printf("======== Start command dump =========\n"); diff --git a/src/client/component/exception.cpp b/src/client/component/exception.cpp index c4f0f1dd..91805379 100644 --- a/src/client/component/exception.cpp +++ b/src/client/component/exception.cpp @@ -158,7 +158,6 @@ namespace exception line("Timestamp: "s + get_timestamp()); line(utils::string::va("Exception: 0x%08X", exceptioninfo->ExceptionRecord->ExceptionCode)); line(utils::string::va("Address: 0x%llX", exceptioninfo->ExceptionRecord->ExceptionAddress)); - line(utils::string::va("Base: 0x%llX", game::base_address)); #pragma warning(push) #pragma warning(disable: 4996) diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index 3b71d881..f0426f56 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -51,7 +51,7 @@ namespace fastfiles public: void post_unpack() override { - db_try_load_x_file_internal_hook.create(0x4173B0_b, &db_try_load_x_file_internal); + db_try_load_x_file_internal_hook.create(0x1404173B0, &db_try_load_x_file_internal); command::add("loadzone", [](const command::params& params) { diff --git a/src/client/component/fps.cpp b/src/client/component/fps.cpp index ff522f5d..e2761b29 100644 --- a/src/client/component/fps.cpp +++ b/src/client/component/fps.cpp @@ -303,7 +303,7 @@ namespace fps { scheduler::loop(draw, scheduler::pipeline::renderer); - sub_7C55D0_hook.create(0x7C55D0_b, perf_update); + sub_7C55D0_hook.create(0x1407C55D0, perf_update); cg_drawSpeed = dvars::register_bool("cg_drawSpeed", 0, game::DVAR_FLAG_SAVED); cg_drawFps = dvars::register_int("cg_drawFPS", 0, 0, 4, game::DVAR_FLAG_SAVED); diff --git a/src/client/component/gameplay.cpp b/src/client/component/gameplay.cpp index ce946769..d727335b 100644 --- a/src/client/component/gameplay.cpp +++ b/src/client/component/gameplay.cpp @@ -46,10 +46,10 @@ namespace gameplay a.jnz(allsolid); a.bind(stand); - a.jmp(0x6878CD_b); + a.jmp(0x1406878CD); a.bind(allsolid); - a.jmp(0x6878D4_b); + a.jmp(0x1406878D4); } void pm_crashland_stub(void* ps, void* pm) @@ -70,12 +70,12 @@ namespace gameplay dvars::jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", true, game::DVAR_FLAG_REPLICATED); // Influence PM_JitterPoint code flow so the trace->startsolid checks are 'ignored' - pm_player_trace_hook.create(0x068F0A0_b, &pm_player_trace_stub); + pm_player_trace_hook.create(0x14068F0A0, &pm_player_trace_stub); // If g_enableElevators is 1 the 'ducked' flag will always be removed from the player state - utils::hook::jump(0x6878C1_b, utils::hook::assemble(pm_trace_stub), true); + utils::hook::jump(0x1406878C1, utils::hook::assemble(pm_trace_stub), true); - pm_crashland_hook.create(0x688A20_b, pm_crashland_stub); + pm_crashland_hook.create(0x140688A20, pm_crashland_stub); dvars::register_float("jump_height", 39, 0, 1000, game::DVAR_FLAG_REPLICATED); dvars::register_float("g_gravity", 800, 1, 1000, game::DVAR_FLAG_REPLICATED); diff --git a/src/client/component/gui.cpp b/src/client/component/gui.cpp index 34e0af53..d4852c7c 100644 --- a/src/client/component/gui.cpp +++ b/src/client/component/gui.cpp @@ -208,7 +208,7 @@ namespace gui a.call_aligned(rbx); a.mov(ecx, eax); - a.jmp(0x7A14D1_b); + a.jmp(0x1407A14D1); } utils::hook::detour wnd_proc_hook; @@ -301,8 +301,8 @@ namespace gui void post_unpack() override { - utils::hook::jump(0x7A14C4_b, utils::hook::assemble(dxgi_swap_chain_present_stub), true); - wnd_proc_hook.create(0x650F10_b, wnd_proc_stub); + utils::hook::jump(0x1407A14C4, utils::hook::assemble(dxgi_swap_chain_present_stub), true); + wnd_proc_hook.create(0x140650F10, wnd_proc_stub); on_frame([]() { diff --git a/src/client/component/images.cpp b/src/client/component/images.cpp index 693f208d..e3bfbd61 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(0x74A390_b, setup_texture_stub); - load_texture_hook.create(0x2A7940_b, load_texture_stub); + setup_texture_hook.create(0x14074A390, setup_texture_stub); + load_texture_hook.create(0x1402A7940, load_texture_stub); } }; } diff --git a/src/client/component/input.cpp b/src/client/component/input.cpp index 198ea92a..a890cf43 100644 --- a/src/client/component/input.cpp +++ b/src/client/component/input.cpp @@ -74,9 +74,9 @@ namespace input public: void post_unpack() override { - 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); + cl_char_event_hook.create(0x1403D27B0, cl_char_event_stub); + cl_key_event_hook.create(0x1403D2AE0, cl_key_event_stub); + cl_mouse_move_hook.create(0x1403296F0, cl_mouse_move_stub); } }; } diff --git a/src/client/component/localized_strings.cpp b/src/client/component/localized_strings.cpp index f09fe247..b968d498 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(0x5E5FD0_b, &seh_string_ed_get_string); + seh_string_ed_get_string_hook.create(0x1405E5FD0, &seh_string_ed_get_string); } }; } diff --git a/src/client/component/logger.cpp b/src/client/component/logger.cpp index 9d7b4b50..554ce013 100644 --- a/src/client/component/logger.cpp +++ b/src/client/component/logger.cpp @@ -142,10 +142,10 @@ namespace logger public: void post_unpack() override { - utils::hook::jump(0x32C620_b, print_warning, true); - utils::hook::jump(0x32C630_b, print_warning, true); - utils::hook::jump(0x32AEF0_b, lui_print, true); - com_error_hook.create(0x5A2D80_b, com_error_stub); + utils::hook::jump(0x14032C620, print_warning, true); + utils::hook::jump(0x14032C630, print_warning, true); + utils::hook::jump(0x14032AEF0, lui_print, true); + com_error_hook.create(0x1405A2D80, com_error_stub); } }; } diff --git a/src/client/component/lui.cpp b/src/client/component/lui.cpp index 87ee13b4..a1d9988d 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(0x3203B0_b); - utils::hook::invoke(0x32D370_b); + utils::hook::invoke(0x1403203B0); + utils::hook::invoke(0x14032D370); }); } }; diff --git a/src/client/component/notifies.cpp b/src/client/component/notifies.cpp index 1419fa67..4d8b6fa9 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(0x5C90B3_b); + a.jmp(0x1405C90B3); a.bind(replace); @@ -137,7 +137,7 @@ namespace notifies std::string convert_mod(const int meansOfDeath) { - const auto value = reinterpret_cast(0xBF49B0_b)[meansOfDeath]; + const auto value = reinterpret_cast(0x140BF49B0)[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(0xBF4AA0_b)[hitLoc]; + const std::string _hitLoc = reinterpret_cast(0x140BF4AA0)[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(0x5C90A5_b, utils::hook::assemble(vm_execute_stub), true); + utils::hook::jump(0x1405C90A5, utils::hook::assemble(vm_execute_stub), true); - scr_entity_damage_hook.create(0x4BD2E0_b, scr_entity_damage_stub); + scr_entity_damage_hook.create(0x1404BD2E0, scr_entity_damage_stub); } }; } diff --git a/src/client/component/patches.cpp b/src/client/component/patches.cpp index 8465f83d..c569b84a 100644 --- a/src/client/component/patches.cpp +++ b/src/client/component/patches.cpp @@ -16,7 +16,7 @@ namespace patches void* sub_46148() { - static uint64_t off_11C52460 = 0xAD0C58_b; + static uint64_t off_11C52460 = 0x140AD0C58; return &off_11C52460; } @@ -28,7 +28,7 @@ namespace patches void gscr_set_save_dvar_stub() { - const auto string = utils::string::to_lower(utils::hook::invoke(0x5C7C20_b, 0)); + const auto string = utils::string::to_lower(utils::hook::invoke(0x1405C7C20, 0)); if (string == "cg_fov" || string == "cg_fovscale") { return; @@ -65,24 +65,24 @@ namespace patches void post_unpack() override { // Fix startup crashes - utils::hook::set(0x633080_b, 0xC301B0); - utils::hook::set(0x272F70_b, 0xC301B0); - utils::hook::jump(0x46148_b, sub_46148, true); + utils::hook::set(0x140633080, 0xC301B0); + utils::hook::set(0x140272F70, 0xC301B0); + utils::hook::jump(0x140046148, sub_46148, true); - utils::hook::jump(0x64EF10_b, quit_stub, true); + utils::hook::jump(0x14064EF10, quit_stub, true); // Unlock fps in main menu - utils::hook::set(0x3D8E1B_b, 0xEB); + utils::hook::set(0x1403D8E1B, 0xEB); // Disable battle net popup - utils::hook::nop(0x5F4496_b, 5); + utils::hook::nop(0x1405F4496, 5); // Allow kbam input when gamepad is enabled - utils::hook::nop(0x3D2F8E_b, 2); - utils::hook::nop(0x3D0C9C_b, 6); + utils::hook::nop(0x1403D2F8E, 2); + utils::hook::nop(0x1403D0C9C, 6); // Prevent game from overriding cg_fov and cg_fovscale values - gscr_set_save_dvar_hook.create(0x504C60_b, &gscr_set_save_dvar_stub); + gscr_set_save_dvar_hook.create(0x140504C60, &gscr_set_save_dvar_stub); // Make cg_fov and cg_fovscale saved dvars diff --git a/src/client/component/renderer.cpp b/src/client/component/renderer.cpp index be9f7360..236f8a45 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(0x72F950_b, &r_init_draw_method_stub); - r_update_front_end_dvar_options_hook.create(0x76EE70_b, &r_update_front_end_dvar_options_stub); + r_init_draw_method_hook.create(0x14072F950, &r_init_draw_method_stub); + r_update_front_end_dvar_options_hook.create(0x14076EE70, &r_update_front_end_dvar_options_stub); } }; } diff --git a/src/client/component/scheduler.cpp b/src/client/component/scheduler.cpp index a266a693..ed0301b8 100644 --- a/src/client/component/scheduler.cpp +++ b/src/client/component/scheduler.cpp @@ -183,9 +183,9 @@ namespace scheduler void post_unpack() override { - 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); + r_end_frame_hook.create(0x14076D7B0, scheduler::r_end_frame_stub); + g_run_frame_hook.create(0x1404CB030, scheduler::server_frame_stub); + main_frame_hook.create(0x140417FA0, scheduler::main_frame_stub); } void pre_destroy() override diff --git a/src/client/component/scripting.cpp b/src/client/component/scripting.cpp index cf4167cd..b876c479 100644 --- a/src/client/component/scripting.cpp +++ b/src/client/component/scripting.cpp @@ -116,19 +116,19 @@ namespace scripting public: void post_unpack() override { - vm_notify_hook.create(0x5CC450_b, vm_notify_stub); + vm_notify_hook.create(0x1405CC450, vm_notify_stub); - g_shutdown_game_hook.create(0x4CBAD0_b, g_shutdown_game_stub); - player_spawn_hook.create(0x4B0710_b, player_spawn_stub); + g_shutdown_game_hook.create(0x1404CBAD0, g_shutdown_game_stub); + player_spawn_hook.create(0x1404B0710, player_spawn_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); + scr_add_class_field_hook.create(0x1405C2C30, scr_add_class_field_stub); + scr_set_thread_position_hook.create(0x1405BC7E0, scr_set_thread_position_stub); + process_script_hook.create(0x1405C6160, process_script_stub); // Loading last checkpoint doesn't call spawn player again (player_spawn_hook) // Not sure what this function does but `a1` is != nullptr when loading // the last checkpoint so we need to start lua in this context - sub_6B2940_hook.create(0x6B2940_b, sub_6B2940_stub); + sub_6B2940_hook.create(0x1406B2940, sub_6B2940_stub); scheduler::loop([]() { diff --git a/src/client/component/ui_scripting.cpp b/src/client/component/ui_scripting.cpp index 9c2214ac..f6cdba10 100644 --- a/src/client/component/ui_scripting.cpp +++ b/src/client/component/ui_scripting.cpp @@ -178,13 +178,13 @@ namespace ui_scripting void post_unpack() override { scheduler::loop(ui_scripting::lua::engine::run_frame, scheduler::pipeline::lui); - hks_start_hook.create(0x328BE0_b, hks_start_stub); - hks_shutdown_hook.create(0x3203B0_b, hks_shutdown_stub); - hksi_lual_error_hook.create(0x2E3E40_b, hksi_lual_error_stub); - hksi_lual_error_hook2.create(0x2DCB40_b, hksi_lual_error_stub); - hks_allocator_hook.create(0x2D92A0_b, hks_allocator_stub); - lui_error_hook.create(0x2B9D90_b, lui_error_stub); - hksi_hks_error_hook.create(0x2DBC00_b, hksi_hks_error_stub); + hks_start_hook.create(0x140328BE0, hks_start_stub); + hks_shutdown_hook.create(0x1403203B0, hks_shutdown_stub); + hksi_lual_error_hook.create(0x1402E3E40, hksi_lual_error_stub); + hksi_lual_error_hook2.create(0x1402DCB40, hksi_lual_error_stub); + hks_allocator_hook.create(0x1402D92A0, hks_allocator_stub); + lui_error_hook.create(0x1402B9D90, lui_error_stub); + hksi_hks_error_hook.create(0x1402DBC00, hksi_hks_error_stub); } }; } diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index 28261c72..e4c8dccd 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -3,14 +3,6 @@ namespace game { - uint64_t base_address; - - void load_base_address() - { - const auto module = GetModuleHandle(NULL); - base_address = uint64_t(module); - } - std::string mod_folder{}; namespace environment @@ -81,8 +73,3 @@ 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 601179ad..4da1c52d 100644 --- a/src/client/game/game.hpp +++ b/src/client/game/game.hpp @@ -5,9 +5,6 @@ namespace game { - extern uint64_t base_address; - void load_base_address(); - extern std::string mod_folder; namespace environment @@ -35,7 +32,7 @@ namespace game T* get() const { - return reinterpret_cast((uint64_t)address_ + base_address); + return reinterpret_cast(address_); } operator T* () const @@ -53,6 +50,4 @@ namespace game }; } -uintptr_t operator"" _b(const uintptr_t ptr); - -#include "symbols.hpp" \ No newline at end of file +#include "symbols.hpp" diff --git a/src/client/game/scripting/functions.cpp b/src/client/game/scripting/functions.cpp index c6977ad1..0a3da8b3 100644 --- a/src/client/game/scripting/functions.cpp +++ b/src/client/game/scripting/functions.cpp @@ -59,15 +59,15 @@ namespace scripting script_function get_function_by_index(const unsigned index) { - static const auto function_table = 0xB153F90; - static const auto method_table = 0xB155890; + static const auto function_table = 0x14B153F90; + static const auto method_table = 0x14B155890; if (index < 0x320) { - return reinterpret_cast(game::base_address + function_table)[index - 1]; + return reinterpret_cast(function_table)[index - 1]; } - return reinterpret_cast(game::base_address + method_table)[index - 0x8000]; + return reinterpret_cast(method_table)[index - 0x8000]; } } diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index f9108c0a..6abaeafa 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -6,198 +6,198 @@ namespace game { // Functions - WEAK symbol AddRefToValue{0x5C0EB0}; - WEAK symbol AddRefToObject{0x5C0EA0}; - WEAK symbol AllocThread{0x5C1200}; - WEAK symbol AllocVariable{0x5C1260}; - WEAK symbol RemoveRefToValue{0x5C29B0}; - WEAK symbol RemoveRefToObject{0x5C28A0}; + WEAK symbol AddRefToValue{0x1405C0EB0}; + WEAK symbol AddRefToObject{0x1405C0EA0}; + WEAK symbol AllocThread{0x1405C1200}; + WEAK symbol AllocVariable{0x1405C1260}; + WEAK symbol RemoveRefToValue{0x1405C29B0}; + WEAK symbol RemoveRefToObject{0x1405C28A0}; WEAK symbol BG_GetWeaponNameComplete{0x6A0800}; + char* output, unsigned int maxStringLen)> BG_GetWeaponNameComplete{0x1406A0800}; - WEAK symbol Cbuf_AddText{0x59A050}; + WEAK symbol Cbuf_AddText{0x14059A050}; - WEAK symbol CG_GameMessage{0x37F450}; - WEAK symbol CG_GameMessageBold{0x37F1B0}; + WEAK symbol CG_GameMessage{0x14037F450}; + WEAK symbol CG_GameMessageBold{0x14037F1B0}; WEAK symbol CG_GetWeaponDisplayName{0x3B9210}; + bool isAlternate, char* outputBuffer, int bufferLen)> CG_GetWeaponDisplayName{0x1403B9210}; - WEAK symbol Cmd_AddCommandInternal{0x59A5F0}; - WEAK symbol Cmd_ExecuteSingleCommand{0x59ABA0}; + WEAK symbol Cmd_AddCommandInternal{0x14059A5F0}; + WEAK symbol Cmd_ExecuteSingleCommand{0x14059ABA0}; - WEAK symbol Com_Error{0x5A2D80}; - WEAK symbol Com_Quit_f{0x5A50D0}; - WEAK symbol Quit{0x5A52A0}; + WEAK symbol Com_Error{0x1405A2D80}; + WEAK symbol Com_Quit_f{0x1405A50D0}; + WEAK symbol Quit{0x1405A52A0}; WEAK symbol - DB_EnumXAssets_Internal{0x4129F0}; - WEAK symbol DB_GetXAssetName{0x3E4090}; - WEAK symbol DB_LoadXAssets{0x414FF0}; - WEAK symbol DB_FindXAssetHeader{0x412F60}; - WEAK symbol DB_GetRawFileLen{0x413D80}; - WEAK symbol DB_GetRawBuffer{0x413C40}; + DB_EnumXAssets_Internal{0x1404129F0}; + WEAK symbol DB_GetXAssetName{0x1403E4090}; + WEAK symbol DB_LoadXAssets{0x140414FF0}; + WEAK symbol DB_FindXAssetHeader{0x140412F60}; + WEAK symbol DB_GetRawFileLen{0x140413D80}; + WEAK symbol DB_GetRawBuffer{0x140413C40}; - WEAK symbol Dvar_FindVar{0x618F90}; - WEAK symbol Dvar_GetCombinedString{0x5A75D0}; - WEAK symbol Dvar_RegisterBool{0x617BB0}; - WEAK symbol Dvar_RegisterInt{0x618090}; + WEAK symbol Dvar_FindVar{0x140618F90}; + WEAK symbol Dvar_GetCombinedString{0x1405A75D0}; + WEAK symbol Dvar_RegisterBool{0x140617BB0}; + WEAK symbol Dvar_RegisterInt{0x140618090}; WEAK symbol - Dvar_RegisterFloat{0x617F80}; + Dvar_RegisterFloat{0x140617F80}; WEAK symbol - Dvar_RegisterString{0x618170}; + Dvar_RegisterString{0x140618170}; WEAK symbol Dvar_RegisterVec4{0x6185F0}; - WEAK symbol Dvar_DisplayableValue{0x618EA0}; - WEAK symbol Dvar_ValueToString{0x61B8F0}; - WEAK symbol Dvar_SetCommand{0x61A5C0}; - WEAK symbol Dvar_SetFromStringFromSource{0x61A910}; + unsigned int flags)> Dvar_RegisterVec4{0x1406185F0}; + WEAK symbol Dvar_DisplayableValue{0x140618EA0}; + WEAK symbol Dvar_ValueToString{0x14061B8F0}; + WEAK symbol Dvar_SetCommand{0x14061A5C0}; + WEAK symbol Dvar_SetFromStringFromSource{0x14061A910}; - WEAK symbol generateHashValue{0x343D20}; + WEAK symbol generateHashValue{0x140343D20}; - WEAK symbol CL_IsCgameInitialized{0x3CA0C0}; + WEAK symbol CL_IsCgameInitialized{0x1403CA0C0}; WEAK symbol CL_DrawTextPhysicalWithEffects{0x3D4990}; + int fxBirthTime, int fxLetterTime, int fxDecayStartTime, int fxDecayDuration, int a17)> CL_DrawTextPhysicalWithEffects{0x1403D4990}; - WEAK symbol FindVariable{0x5C1D50}; - WEAK symbol FindEntityId{0x5C1C50}; - WEAK symbol GetEntityFieldValue{0x5C6100}; - WEAK symbol GetVariable{0x5C2690}; - WEAK symbol GetNewVariable{0x5C22B0}; - WEAK symbol GetNewArrayVariable{0x5C2130}; - WEAK symbol SetNewVariableValue{0x5C5EA0}; - WEAK symbol RemoveVariableValue{0x5C2A50}; + WEAK symbol FindVariable{0x1405C1D50}; + WEAK symbol FindEntityId{0x1405C1C50}; + WEAK symbol GetEntityFieldValue{0x1405C6100}; + WEAK symbol GetVariable{0x1405C2690}; + WEAK symbol GetNewVariable{0x1405C22B0}; + WEAK symbol GetNewArrayVariable{0x1405C2130}; + WEAK symbol SetNewVariableValue{0x1405C5EA0}; + WEAK symbol RemoveVariableValue{0x1405C2A50}; - WEAK symbol G_GetWeaponForName{0x51B260}; + WEAK symbol G_GetWeaponForName{0x14051B260}; WEAK symbol - G_GivePlayerWeapon{0x51B660}; - WEAK symbol G_InitializeAmmo{0x4C4110}; - WEAK symbol G_SelectWeapon{0x51C0D0}; - WEAK symbol WorldPosToScreenPos{0x36F310}; + G_GivePlayerWeapon{0x14051B660}; + WEAK symbol G_InitializeAmmo{0x1404C4110}; + WEAK symbol G_SelectWeapon{0x14051C0D0}; + WEAK symbol WorldPosToScreenPos{0x14036F310}; - WEAK symbol I_CleanStr{0x620660}; + WEAK symbol I_CleanStr{0x140620660}; WEAK symbol Image_Setup{0x74B2A0}; + uint32_t imageFlags, DXGI_FORMAT imageFormat, int a8, const char* name, const void* initData)> Image_Setup{0x14074B2A0}; - WEAK symbol Key_KeynumToString{0x3D32D0}; + WEAK symbol Key_KeynumToString{0x1403D32D0}; - WEAK symbol LUI_OpenMenu{0x5F0EE0}; - WEAK symbol Menu_IsMenuOpenAndVisible{0x5EE1A0}; + WEAK symbol LUI_OpenMenu{0x1405F0EE0}; + WEAK symbol Menu_IsMenuOpenAndVisible{0x1405EE1A0}; - WEAK symbol Material_RegisterHandle{0x759BA0}; + WEAK symbol Material_RegisterHandle{0x140759BA0}; - WEAK symbol PathNode_WorldifyPosFromParent{0x525830}; + WEAK symbol PathNode_WorldifyPosFromParent{0x140525830}; - WEAK symbol Scr_AllocVector{0x5C3220}; - WEAK symbol Scr_ClearOutParams{0x5C6E50}; - WEAK symbol Scr_GetEntityIdRef{0x5C56C0}; - WEAK symbol Scr_GetEntityId{0x5C5610}; - WEAK symbol Scr_SetObjectField{0x512190}; - WEAK symbol Scr_NotifyId{0x5C8240}; - WEAK symbol Scr_GetSelf{0x5C57C0}; - WEAK symbol Scr_ErrorInternal{0x5C6EC0}; + WEAK symbol Scr_AllocVector{0x1405C3220}; + WEAK symbol Scr_ClearOutParams{0x1405C6E50}; + WEAK symbol Scr_GetEntityIdRef{0x1405C56C0}; + WEAK symbol Scr_GetEntityId{0x1405C5610}; + WEAK symbol Scr_SetObjectField{0x140512190}; + WEAK symbol Scr_NotifyId{0x1405C8240}; + WEAK symbol Scr_GetSelf{0x1405C57C0}; + WEAK symbol Scr_ErrorInternal{0x1405C6EC0}; - WEAK symbol VM_Execute{0x5C8DB0}; + WEAK symbol VM_Execute{0x1405C8DB0}; WEAK symbol R_AddCmdDrawStretchPic{0x3C9710}; + float* color, Material* material)> R_AddCmdDrawStretchPic{0x1403C9710}; WEAK symbol R_AddCmdDrawStretchPicRotateXY{0x3C99B0}; + float angle, float* color, Material* material)> R_AddCmdDrawStretchPicRotateXY{0x1403C99B0}; WEAK symbol R_AddCmdDrawText{0x76C660}; + float rotation, float* color, int style)> R_AddCmdDrawText{0x14076C660}; WEAK symbol R_AddCmdDrawText2{0x76C860}; - WEAK symbol R_DrawRectangle{0x76A280}; + float rotation, float* color1, float* color2, int style)> R_AddCmdDrawText2{0x14076C860}; + WEAK symbol R_DrawRectangle{0x14076A280}; WEAK symbol R_AddCmdDrawTextWithCursor{0x76CAF0}; + const float* color, int style, int cursorPos, char cursor)> R_AddCmdDrawTextWithCursor{0x14076CAF0}; WEAK symbol R_AddCmdDrawTextGradient{0x76C570}; - WEAK symbol R_RegisterFont{0x746FE0}; - WEAK symbol R_TextWidth{0x7472A0}; - WEAK symbol R_SyncRenderThread{0x76E7D0}; + int a8, float* color1, unsigned int style, rgba color2)> R_AddCmdDrawTextGradient{0x14076C570}; + WEAK symbol R_RegisterFont{0x140746FE0}; + WEAK symbol R_TextWidth{0x1407472A0}; + WEAK symbol R_SyncRenderThread{0x14076E7D0}; WEAK symbol R_AddDObjToScene{0x775C40}; + float materialTime, __int64 a7, __int64 a8)> R_AddDObjToScene{0x140775C40}; - WEAK symbol ScrPlace_GetViewPlacement{0x3E16A0}; - WEAK symbol ScrPlace_GetView{0x3E1660}; + WEAK symbol ScrPlace_GetViewPlacement{0x1403E16A0}; + WEAK symbol ScrPlace_GetView{0x1403E1660}; - WEAK symbol SL_ConvertToString{0x5BFBB0}; - WEAK symbol SL_GetString{0x5C0170}; + WEAK symbol SL_ConvertToString{0x1405BFBB0}; + WEAK symbol SL_GetString{0x1405C0170}; - WEAK symbol SV_Loaded{0x6B3860}; + WEAK symbol SV_Loaded{0x1406B3860}; - WEAK symbol Sys_ShowConsole{0x633080}; - WEAK symbol Sys_IsDatabaseReady2{0x5A9FE0}; - WEAK symbol Sys_Milliseconds{0x650720}; - WEAK symbol Sys_IsMainThread{0x5AA020}; + WEAK symbol Sys_ShowConsole{0x140633080}; + WEAK symbol Sys_IsDatabaseReady2{0x1405A9FE0}; + WEAK symbol Sys_Milliseconds{0x140650720}; + WEAK symbol Sys_IsMainThread{0x1405AA020}; - WEAK symbol UI_SafeTranslateString{0x5A2930}; - WEAK symbol UI_PlayLocalSoundAlias{0x606080}; + WEAK symbol UI_SafeTranslateString{0x1405A2930}; + WEAK symbol UI_PlayLocalSoundAlias{0x140606080}; WEAK symbol PM_playerTrace{0x68F0A0}; + const Bounds*, int, int)> PM_playerTrace{0x14068F0A0}; WEAK symbol PM_trace{0x68F1D0}; + const Bounds*, int, int)> PM_trace{0x14068F1D0}; - WEAK symbol longjmp{0x89EED0}; - WEAK symbol _setjmp{0x8EC2E0}; + WEAK symbol longjmp{0x14089EED0}; + WEAK symbol _setjmp{0x1408EC2E0}; // Variables - WEAK symbol cmd_functions{0xAD17BB8}; - WEAK symbol cmd_args{0xAD17A60}; - WEAK symbol command_whitelist{0xBF84E0}; + WEAK symbol cmd_functions{0x14AD17BB8}; + WEAK symbol cmd_args{0x14AD17A60}; + WEAK symbol command_whitelist{0x140BF84E0}; - WEAK symbol hWnd{0xCCF81C0}; + WEAK symbol hWnd{0x14CCF81C0}; - WEAK symbol g_assetNames{0xBEF280}; - WEAK symbol g_poolSize{0xBF2E40}; + WEAK symbol g_assetNames{0x140BEF280}; + WEAK symbol g_poolSize{0x140BF2E40}; - WEAK symbol g_entities{0x52DDDA0}; - WEAK symbol num_entities{0x55CC738}; - WEAK symbol pathData{0x52CCDA0}; - WEAK symbol vehicle_pathnode_count{0xD009A30}; + WEAK symbol g_entities{0x1452DDDA0}; + WEAK symbol num_entities{0x1455CC738}; + WEAK symbol pathData{0x1452CCDA0}; + WEAK symbol vehicle_pathnode_count{0x14D009A30}; - WEAK symbol threadIds{0xB11DC80}; + WEAK symbol threadIds{0x14B11DC80}; - WEAK symbol gfxDrawMethod{0xEDF9E00}; - WEAK symbol refdef{0x1BC2500}; + WEAK symbol gfxDrawMethod{0x14EDF9E00}; + WEAK symbol refdef{0x141BC2500}; - WEAK symbol keyCatchers{0x203F3C0}; + WEAK symbol keyCatchers{0x14203F3C0}; - WEAK symbol playerKeys{0x1E8767C}; + WEAK symbol playerKeys{0x141E8767C}; - WEAK symbol dvarCount{0xBFBB310}; - WEAK symbol dvarPool{0xBFBB320}; + WEAK symbol dvarCount{0x14BFBB310}; + WEAK symbol dvarPool{0x14BFBB320}; - WEAK symbol levelEntityId{0xB5E0B30}; - WEAK symbol g_script_error_level{0xBA9CC24}; - WEAK symbol g_script_error{0xBA9CD40}; - WEAK symbol g_classMap{0xBF95C0}; + WEAK symbol levelEntityId{0x14B5E0B30}; + WEAK symbol g_script_error_level{0x14BA9CC24}; + WEAK symbol g_script_error{0x14BA9CD40}; + WEAK symbol g_classMap{0x140BF95C0}; - WEAK symbol scr_VarGlob{0xB617C00}; - WEAK symbol scr_VmPub{0xBA9EE40}; - WEAK symbol scr_function_stack{0xBAA93C0}; + WEAK symbol scr_VarGlob{0x14B617C00}; + WEAK symbol scr_VmPub{0x14BA9EE40}; + WEAK symbol scr_function_stack{0x14BAA93C0}; namespace hks { - WEAK symbol lua_state{0x19D83E8}; - WEAK symbol hksi_lua_pushlstring{0x287410}; - WEAK symbol hks_obj_tolstring{0x287410}; - WEAK symbol hks_obj_getmetatable{0x2DA210}; - WEAK symbol hks_obj_getfield{0x2D9E20}; - WEAK symbol hks_obj_settable{0x2DB040}; - WEAK symbol hks_obj_gettable{0x2DA300}; - WEAK symbol vm_call_internal{0x30AB60}; - WEAK symbol hksi_lua_pushvalue{0x2DE040}; - WEAK symbol Hashtable_Create{0x2C8290}; - WEAK symbol Hashtable_getNextHash{0x2D5150}; - WEAK symbol hks_obj_next{0x2DA850}; + WEAK symbol lua_state{0x1419D83E8}; + WEAK symbol hksi_lua_pushlstring{0x140287410}; + WEAK symbol hks_obj_tolstring{0x140287410}; + WEAK symbol hks_obj_getmetatable{0x1402DA210}; + WEAK symbol hks_obj_getfield{0x1402D9E20}; + WEAK symbol hks_obj_settable{0x1402DB040}; + WEAK symbol hks_obj_gettable{0x1402DA300}; + WEAK symbol vm_call_internal{0x14030AB60}; + WEAK symbol hksi_lua_pushvalue{0x1402DE040}; + WEAK symbol Hashtable_Create{0x1402C8290}; + WEAK symbol Hashtable_getNextHash{0x1402D5150}; + WEAK symbol hks_obj_next{0x1402DA850}; WEAK symbol cclosure_Create{0x2C84B0}; - WEAK symbol hksi_luaL_ref{0x2E4520}; - WEAK symbol hksi_luaL_unref{0x2DCE50}; + int internal_, int profilerTreatClosureAsFunc)> cclosure_Create{0x1402C84B0}; + WEAK symbol hksi_luaL_ref{0x1402E4520}; + WEAK symbol hksi_luaL_unref{0x1402DCE50}; } } \ 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 8c422965..1d7bdd9b 100644 --- a/src/client/game/ui_scripting/lua/context.cpp +++ b/src/client/game/ui_scripting/lua/context.cpp @@ -360,7 +360,7 @@ namespace ui_scripting::lua game_type["playmenuvideo"] = [](const game&, const std::string& video) { reinterpret_cast - (0x71B970_b)(video.data(), 64, 0); + (0x14071B970)(video.data(), 64, 0); }; game_type["sharedset"] = [](const game&, const std::string& key, const std::string& value) diff --git a/src/client/loader/loader.cpp b/src/client/loader/loader.cpp index 4ec12c7c..cc3437c5 100644 --- a/src/client/loader/loader.cpp +++ b/src/client/loader/loader.cpp @@ -31,7 +31,7 @@ FARPROC loader::load(const utils::nt::library& library, const std::string& buffe return FARPROC(library.get_ptr() + source.get_relative_entry_point()); } -FARPROC loader::load_library(const std::string& filename, uint64_t* base_address) const +FARPROC loader::load_library(const std::string& filename) const { const auto target = utils::nt::library::load(filename); if (!target) @@ -39,9 +39,6 @@ FARPROC loader::load_library(const std::string& filename, uint64_t* base_address throw std::runtime_error{"Failed to map binary!"}; } - const auto base = size_t(target.get_ptr()); - *base_address = base; - this->load_imports(target, target); this->load_tls(target, target); diff --git a/src/client/loader/loader.hpp b/src/client/loader/loader.hpp index 0c0b5a12..2c5d86f9 100644 --- a/src/client/loader/loader.hpp +++ b/src/client/loader/loader.hpp @@ -5,7 +5,7 @@ class loader final { public: FARPROC load(const utils::nt::library& library, const std::string& buffer) const; - FARPROC load_library(const std::string& filename, uint64_t* base_address) const; + FARPROC load_library(const std::string& filename) const; void set_import_resolver(const std::function& resolver); diff --git a/src/client/main.cpp b/src/client/main.cpp index b24acb2a..41365a72 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -39,7 +39,7 @@ launcher::mode detect_mode_from_arguments() return launcher::mode::none; } -FARPROC load_binary(const launcher::mode mode, uint64_t* base_address) +FARPROC load_binary(const launcher::mode mode) { loader loader; utils::nt::library self; @@ -87,7 +87,7 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address) binary.data())); } - return loader.load_library(binary, base_address); + return loader.load(self, data); } void remove_crash_file() @@ -97,7 +97,7 @@ void remove_crash_file() void verify_version() { - const auto value = *reinterpret_cast(0x123456_b); + const auto value = *reinterpret_cast(0x140123456); if (value != 0xE465E151) { throw std::runtime_error("Unsupported Call of Duty: Modern Warfare 2 Campaign Remastered version"); @@ -184,14 +184,12 @@ int main() game::environment::set_mode(mode); - uint64_t base_address{}; - entry_point = load_binary(mode, &base_address); + entry_point = load_binary(mode); if (!entry_point) { throw std::runtime_error("Unable to load binary into memory"); } - game::base_address = base_address; verify_version(); if (!component_loader::post_load()) diff --git a/src/client/std_include.cpp b/src/client/std_include.cpp index a5497531..e0a46eed 100644 --- a/src/client/std_include.cpp +++ b/src/client/std_include.cpp @@ -1,6 +1,13 @@ #include -#pragma comment(linker, "/base:0x7FFF00000000") +#pragma comment(linker, "/merge:.data=.cld") +#pragma comment(linker, "/merge:.rdata=.clr") +#pragma comment(linker, "/merge:.cl=.main") +#pragma comment(linker, "/merge:.text=.main") +#pragma comment(linker, "/stack:0x1000000") +#pragma comment(linker, "/base:0x140000000") +#pragma bss_seg(".payload") +char payload_data[BINARY_PAYLOAD_SIZE]; extern "C" {