Use literal to calculate address + base
This commit is contained in:
parent
0c1279658d
commit
8807169f4e
@ -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<bool>(game::base_address + 0x412B50, map, 0);
|
||||
const auto exists = utils::hook::invoke<bool>(0x412B50_b, map, 0);
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -169,7 +169,7 @@ namespace command
|
||||
}
|
||||
|
||||
// SV_SpawnServer
|
||||
utils::hook::invoke<void>(game::base_address + 0x6B3AA0, map, 0, 0, 0, 0);
|
||||
utils::hook::invoke<void>(0x6B3AA0_b, map, 0, 0, 0, 0);
|
||||
});
|
||||
|
||||
add("say", [](const params& params)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ namespace lui
|
||||
|
||||
command::add("lui_restart", []()
|
||||
{
|
||||
utils::hook::invoke<void>(game::base_address + 0x3203B0);
|
||||
utils::hook::invoke<void>(game::base_address + 0x32D370);
|
||||
utils::hook::invoke<void>(0x3203B0_b);
|
||||
utils::hook::invoke<void>(0x32D370_b);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -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::scr_string_t**>(game::base_address + 0xBF49B0)[meansOfDeath];
|
||||
const auto value = reinterpret_cast<game::scr_string_t**>(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<const char**>(game::base_address + 0xBF4AA0)[hitLoc];
|
||||
const std::string _hitLoc = reinterpret_cast<const char**>(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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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<BYTE>(game::base_address + 0x3D8E1B, 0xEB);
|
||||
utils::hook::set<BYTE>(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);
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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([]()
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -78,4 +78,9 @@ namespace game
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uintptr_t operator"" _b(const uintptr_t ptr)
|
||||
{
|
||||
return game::base_address + ptr;
|
||||
}
|
@ -52,4 +52,6 @@ namespace game
|
||||
};
|
||||
}
|
||||
|
||||
uintptr_t operator"" _b(const uintptr_t ptr);
|
||||
|
||||
#include "symbols.hpp"
|
@ -960,7 +960,7 @@ namespace ui_scripting::lua
|
||||
game_type["playmenuvideo"] = [](const game&, const std::string& video)
|
||||
{
|
||||
reinterpret_cast<void (*)(const char* a1, int a2, int a3)>
|
||||
(::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)
|
||||
|
@ -91,7 +91,7 @@ void remove_crash_file()
|
||||
|
||||
void verify_version()
|
||||
{
|
||||
const auto value = *reinterpret_cast<DWORD*>(game::base_address + 0x123456);
|
||||
const auto value = *reinterpret_cast<DWORD*>(0x123456_b);
|
||||
if (value != 0xE465E151)
|
||||
{
|
||||
throw std::runtime_error("Unsupported Call of Duty: Modern Warfare 2 Campaign Remastered version");
|
||||
|
Loading…
Reference in New Issue
Block a user