Use different loader method

This commit is contained in:
Federico Cecchetto 2022-03-18 22:02:44 +01:00
parent a70fd7bd80
commit 22b14523b7
28 changed files with 215 additions and 237 deletions

View File

@ -118,13 +118,13 @@ namespace binding
void post_unpack() override void post_unpack() override
{ {
// write all bindings to config file // 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 // 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 // execute custom binds
cl_execute_key_hook.create(0x3CF1E0_b, &cl_execute_key_stub); cl_execute_key_hook.create(0x1403CF1E0, &cl_execute_key_stub);
} }
}; };
} }

View File

@ -45,7 +45,7 @@ namespace branding
localized_strings::override("MENU_SYSINFO_DONATION_LINK", "Donation Link:"); localized_strings::override("MENU_SYSINFO_DONATION_LINK", "Donation Link:");
localized_strings::override("MENU_SYSINFO_DONATION_URL", "https://paypal.me/fedecek"); 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);
} }
}; };
} }

View File

@ -148,7 +148,7 @@ namespace command
public: public:
void post_unpack() override 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); add("quit", game::Quit);
@ -156,7 +156,7 @@ namespace command
{ {
const auto map = params.get(1); const auto map = params.get(1);
const auto exists = utils::hook::invoke<bool>(0x412B50_b, map, 0); const auto exists = utils::hook::invoke<bool>(0x140412B50, map, 0);
if (!exists) if (!exists)
{ {
@ -165,7 +165,7 @@ namespace command
} }
// SV_SpawnServer // SV_SpawnServer
utils::hook::invoke<void>(0x6B3AA0_b, map, 0, 0, 0, 0); utils::hook::invoke<void>(0x1406B3AA0, map, 0, 0, 0, 0);
}); });
add("say", [](const params& params) add("say", [](const params& params)
@ -207,11 +207,6 @@ namespace command
} }
}); });
add("baseAddress", []()
{
printf("%p\n", (void*)game::base_address);
});
add("commandDump", []() add("commandDump", []()
{ {
printf("======== Start command dump =========\n"); printf("======== Start command dump =========\n");

View File

@ -158,7 +158,6 @@ namespace exception
line("Timestamp: "s + get_timestamp()); line("Timestamp: "s + get_timestamp());
line(utils::string::va("Exception: 0x%08X", exceptioninfo->ExceptionRecord->ExceptionCode)); line(utils::string::va("Exception: 0x%08X", exceptioninfo->ExceptionRecord->ExceptionCode));
line(utils::string::va("Address: 0x%llX", exceptioninfo->ExceptionRecord->ExceptionAddress)); 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(push)
#pragma warning(disable: 4996) #pragma warning(disable: 4996)

View File

@ -51,7 +51,7 @@ namespace fastfiles
public: public:
void post_unpack() override 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) command::add("loadzone", [](const command::params& params)
{ {

View File

@ -303,7 +303,7 @@ namespace fps
{ {
scheduler::loop(draw, scheduler::pipeline::renderer); 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_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); cg_drawFps = dvars::register_int("cg_drawFPS", 0, 0, 4, game::DVAR_FLAG_SAVED);

View File

@ -46,10 +46,10 @@ namespace gameplay
a.jnz(allsolid); a.jnz(allsolid);
a.bind(stand); a.bind(stand);
a.jmp(0x6878CD_b); a.jmp(0x1406878CD);
a.bind(allsolid); a.bind(allsolid);
a.jmp(0x6878D4_b); a.jmp(0x1406878D4);
} }
void pm_crashland_stub(void* ps, void* pm) 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); 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' // 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 // 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("jump_height", 39, 0, 1000, game::DVAR_FLAG_REPLICATED);
dvars::register_float("g_gravity", 800, 1, 1000, game::DVAR_FLAG_REPLICATED); dvars::register_float("g_gravity", 800, 1, 1000, game::DVAR_FLAG_REPLICATED);

View File

@ -208,7 +208,7 @@ namespace gui
a.call_aligned(rbx); a.call_aligned(rbx);
a.mov(ecx, eax); a.mov(ecx, eax);
a.jmp(0x7A14D1_b); a.jmp(0x1407A14D1);
} }
utils::hook::detour wnd_proc_hook; utils::hook::detour wnd_proc_hook;
@ -301,8 +301,8 @@ namespace gui
void post_unpack() override void post_unpack() override
{ {
utils::hook::jump(0x7A14C4_b, utils::hook::assemble(dxgi_swap_chain_present_stub), true); utils::hook::jump(0x1407A14C4, utils::hook::assemble(dxgi_swap_chain_present_stub), true);
wnd_proc_hook.create(0x650F10_b, wnd_proc_stub); wnd_proc_hook.create(0x140650F10, wnd_proc_stub);
on_frame([]() on_frame([]()
{ {

View File

@ -111,8 +111,8 @@ namespace images
public: public:
void post_unpack() override void post_unpack() override
{ {
setup_texture_hook.create(0x74A390_b, setup_texture_stub); setup_texture_hook.create(0x14074A390, setup_texture_stub);
load_texture_hook.create(0x2A7940_b, load_texture_stub); load_texture_hook.create(0x1402A7940, load_texture_stub);
} }
}; };
} }

View File

@ -74,9 +74,9 @@ namespace input
public: public:
void post_unpack() override void post_unpack() override
{ {
cl_char_event_hook.create(0x3D27B0_b, cl_char_event_stub); cl_char_event_hook.create(0x1403D27B0, cl_char_event_stub);
cl_key_event_hook.create(0x3D2AE0_b, cl_key_event_stub); cl_key_event_hook.create(0x1403D2AE0, cl_key_event_stub);
cl_mouse_move_hook.create(0x3296F0_b, cl_mouse_move_stub); cl_mouse_move_hook.create(0x1403296F0, cl_mouse_move_stub);
} }
}; };
} }

View File

@ -46,7 +46,7 @@ namespace localized_strings
void post_unpack() override void post_unpack() override
{ {
// Change some localized strings // 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);
} }
}; };
} }

View File

@ -142,10 +142,10 @@ namespace logger
public: public:
void post_unpack() override void post_unpack() override
{ {
utils::hook::jump(0x32C620_b, print_warning, true); utils::hook::jump(0x14032C620, print_warning, true);
utils::hook::jump(0x32C630_b, print_warning, true); utils::hook::jump(0x14032C630, print_warning, true);
utils::hook::jump(0x32AEF0_b, lui_print, true); utils::hook::jump(0x14032AEF0, lui_print, true);
com_error_hook.create(0x5A2D80_b, com_error_stub); com_error_hook.create(0x1405A2D80, com_error_stub);
} }
}; };
} }

View File

@ -39,8 +39,8 @@ namespace lui
command::add("lui_restart", []() command::add("lui_restart", []()
{ {
utils::hook::invoke<void>(0x3203B0_b); utils::hook::invoke<void>(0x1403203B0);
utils::hook::invoke<void>(0x32D370_b); utils::hook::invoke<void>(0x14032D370);
}); });
} }
}; };

View File

@ -94,7 +94,7 @@ namespace notifies
a.inc(r14); a.inc(r14);
a.mov(dword_ptr(rbp, 0xA4), r15d); a.mov(dword_ptr(rbp, 0xA4), r15d);
a.jmp(0x5C90B3_b); a.jmp(0x1405C90B3);
a.bind(replace); a.bind(replace);
@ -137,7 +137,7 @@ namespace notifies
std::string convert_mod(const int meansOfDeath) std::string convert_mod(const int meansOfDeath)
{ {
const auto value = reinterpret_cast<game::scr_string_t**>(0xBF49B0_b)[meansOfDeath]; const auto value = reinterpret_cast<game::scr_string_t**>(0x140BF49B0)[meansOfDeath];
const auto string = game::SL_ConvertToString(*value); const auto string = game::SL_ConvertToString(*value);
return string; 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) 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**>(0xBF4AA0_b)[hitLoc]; const std::string _hitLoc = reinterpret_cast<const char**>(0x140BF4AA0)[hitLoc];
const auto _mod = convert_mod(meansOfDeath); const auto _mod = convert_mod(meansOfDeath);
const auto _weapon = get_weapon_name(weapon, isAlternate); const auto _weapon = get_weapon_name(weapon, isAlternate);
@ -199,9 +199,9 @@ namespace notifies
public: public:
void post_unpack() override 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);
} }
}; };
} }

View File

@ -16,7 +16,7 @@ namespace patches
void* sub_46148() void* sub_46148()
{ {
static uint64_t off_11C52460 = 0xAD0C58_b; static uint64_t off_11C52460 = 0x140AD0C58;
return &off_11C52460; return &off_11C52460;
} }
@ -28,7 +28,7 @@ namespace patches
void gscr_set_save_dvar_stub() void gscr_set_save_dvar_stub()
{ {
const auto string = utils::string::to_lower(utils::hook::invoke<const char*>(0x5C7C20_b, 0)); const auto string = utils::string::to_lower(utils::hook::invoke<const char*>(0x1405C7C20, 0));
if (string == "cg_fov" || string == "cg_fovscale") if (string == "cg_fov" || string == "cg_fovscale")
{ {
return; return;
@ -65,24 +65,24 @@ namespace patches
void post_unpack() override void post_unpack() override
{ {
// Fix startup crashes // Fix startup crashes
utils::hook::set(0x633080_b, 0xC301B0); utils::hook::set(0x140633080, 0xC301B0);
utils::hook::set(0x272F70_b, 0xC301B0); utils::hook::set(0x140272F70, 0xC301B0);
utils::hook::jump(0x46148_b, sub_46148, true); 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 // Unlock fps in main menu
utils::hook::set<BYTE>(0x3D8E1B_b, 0xEB); utils::hook::set<BYTE>(0x1403D8E1B, 0xEB);
// Disable battle net popup // Disable battle net popup
utils::hook::nop(0x5F4496_b, 5); utils::hook::nop(0x1405F4496, 5);
// Allow kbam input when gamepad is enabled // Allow kbam input when gamepad is enabled
utils::hook::nop(0x3D2F8E_b, 2); utils::hook::nop(0x1403D2F8E, 2);
utils::hook::nop(0x3D0C9C_b, 6); utils::hook::nop(0x1403D0C9C, 6);
// Prevent game from overriding cg_fov and cg_fovscale values // 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 // Make cg_fov and cg_fovscale saved dvars

View File

@ -63,8 +63,8 @@ namespace renderer
{ {
dvars::r_fullbright = dvars::register_int("r_fullbright", 0, 0, 3, game::DVAR_FLAG_SAVED); 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_init_draw_method_hook.create(0x14072F950, &r_init_draw_method_stub);
r_update_front_end_dvar_options_hook.create(0x76EE70_b, &r_update_front_end_dvar_options_stub); r_update_front_end_dvar_options_hook.create(0x14076EE70, &r_update_front_end_dvar_options_stub);
} }
}; };
} }

View File

@ -183,9 +183,9 @@ namespace scheduler
void post_unpack() override void post_unpack() override
{ {
r_end_frame_hook.create(0x76D7B0_b, scheduler::r_end_frame_stub); r_end_frame_hook.create(0x14076D7B0, scheduler::r_end_frame_stub);
g_run_frame_hook.create(0x4CB030_b, scheduler::server_frame_stub); g_run_frame_hook.create(0x1404CB030, scheduler::server_frame_stub);
main_frame_hook.create(0x417FA0_b, scheduler::main_frame_stub); main_frame_hook.create(0x140417FA0, scheduler::main_frame_stub);
} }
void pre_destroy() override void pre_destroy() override

View File

@ -116,19 +116,19 @@ namespace scripting
public: public:
void post_unpack() override 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); g_shutdown_game_hook.create(0x1404CBAD0, g_shutdown_game_stub);
player_spawn_hook.create(0x4B0710_b, player_spawn_stub); player_spawn_hook.create(0x1404B0710, player_spawn_stub);
scr_add_class_field_hook.create(0x5C2C30_b, scr_add_class_field_stub); scr_add_class_field_hook.create(0x1405C2C30, scr_add_class_field_stub);
scr_set_thread_position_hook.create(0x5BC7E0_b, scr_set_thread_position_stub); scr_set_thread_position_hook.create(0x1405BC7E0, scr_set_thread_position_stub);
process_script_hook.create(0x5C6160_b, process_script_stub); process_script_hook.create(0x1405C6160, process_script_stub);
// Loading last checkpoint doesn't call spawn player again (player_spawn_hook) // Loading last checkpoint doesn't call spawn player again (player_spawn_hook)
// Not sure what this function does but `a1` is != nullptr when loading // Not sure what this function does but `a1` is != nullptr when loading
// the last checkpoint so we need to start lua in this context // 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([]() scheduler::loop([]()
{ {

View File

@ -178,13 +178,13 @@ namespace ui_scripting
void post_unpack() override void post_unpack() override
{ {
scheduler::loop(ui_scripting::lua::engine::run_frame, scheduler::pipeline::lui); scheduler::loop(ui_scripting::lua::engine::run_frame, scheduler::pipeline::lui);
hks_start_hook.create(0x328BE0_b, hks_start_stub); hks_start_hook.create(0x140328BE0, hks_start_stub);
hks_shutdown_hook.create(0x3203B0_b, hks_shutdown_stub); hks_shutdown_hook.create(0x1403203B0, hks_shutdown_stub);
hksi_lual_error_hook.create(0x2E3E40_b, hksi_lual_error_stub); hksi_lual_error_hook.create(0x1402E3E40, hksi_lual_error_stub);
hksi_lual_error_hook2.create(0x2DCB40_b, hksi_lual_error_stub); hksi_lual_error_hook2.create(0x1402DCB40, hksi_lual_error_stub);
hks_allocator_hook.create(0x2D92A0_b, hks_allocator_stub); hks_allocator_hook.create(0x1402D92A0, hks_allocator_stub);
lui_error_hook.create(0x2B9D90_b, lui_error_stub); lui_error_hook.create(0x1402B9D90, lui_error_stub);
hksi_hks_error_hook.create(0x2DBC00_b, hksi_hks_error_stub); hksi_hks_error_hook.create(0x1402DBC00, hksi_hks_error_stub);
} }
}; };
} }

View File

@ -3,14 +3,6 @@
namespace game namespace game
{ {
uint64_t base_address;
void load_base_address()
{
const auto module = GetModuleHandle(NULL);
base_address = uint64_t(module);
}
std::string mod_folder{}; std::string mod_folder{};
namespace environment namespace environment
@ -81,8 +73,3 @@ namespace game
} }
} }
} }
uintptr_t operator"" _b(const uintptr_t ptr)
{
return game::base_address + ptr;
}

View File

@ -5,9 +5,6 @@
namespace game namespace game
{ {
extern uint64_t base_address;
void load_base_address();
extern std::string mod_folder; extern std::string mod_folder;
namespace environment namespace environment
@ -35,7 +32,7 @@ namespace game
T* get() const T* get() const
{ {
return reinterpret_cast<T*>((uint64_t)address_ + base_address); return reinterpret_cast<T*>(address_);
} }
operator T* () const operator T* () const
@ -53,6 +50,4 @@ namespace game
}; };
} }
uintptr_t operator"" _b(const uintptr_t ptr);
#include "symbols.hpp" #include "symbols.hpp"

View File

@ -59,15 +59,15 @@ namespace scripting
script_function get_function_by_index(const unsigned index) script_function get_function_by_index(const unsigned index)
{ {
static const auto function_table = 0xB153F90; static const auto function_table = 0x14B153F90;
static const auto method_table = 0xB155890; static const auto method_table = 0x14B155890;
if (index < 0x320) if (index < 0x320)
{ {
return reinterpret_cast<script_function*>(game::base_address + function_table)[index - 1]; return reinterpret_cast<script_function*>(function_table)[index - 1];
} }
return reinterpret_cast<script_function*>(game::base_address + method_table)[index - 0x8000]; return reinterpret_cast<script_function*>(method_table)[index - 0x8000];
} }
} }

View File

@ -6,198 +6,198 @@ namespace game
{ {
// Functions // Functions
WEAK symbol<void(int type, VariableUnion u)> AddRefToValue{0x5C0EB0}; WEAK symbol<void(int type, VariableUnion u)> AddRefToValue{0x1405C0EB0};
WEAK symbol<void(unsigned int id)> AddRefToObject{0x5C0EA0}; WEAK symbol<void(unsigned int id)> AddRefToObject{0x1405C0EA0};
WEAK symbol<unsigned int(unsigned int id)> AllocThread{0x5C1200}; WEAK symbol<unsigned int(unsigned int id)> AllocThread{0x1405C1200};
WEAK symbol<ObjectVariableValue*(unsigned int* id)> AllocVariable{0x5C1260}; WEAK symbol<ObjectVariableValue*(unsigned int* id)> AllocVariable{0x1405C1260};
WEAK symbol<void(int type, VariableUnion u)> RemoveRefToValue{0x5C29B0}; WEAK symbol<void(int type, VariableUnion u)> RemoveRefToValue{0x1405C29B0};
WEAK symbol<void(unsigned int id)> RemoveRefToObject{0x5C28A0}; WEAK symbol<void(unsigned int id)> RemoveRefToObject{0x1405C28A0};
WEAK symbol<void(unsigned int weapon, bool isAlternate, WEAK symbol<void(unsigned int weapon, bool isAlternate,
char* output, unsigned int maxStringLen)> BG_GetWeaponNameComplete{0x6A0800}; char* output, unsigned int maxStringLen)> BG_GetWeaponNameComplete{0x1406A0800};
WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x59A050}; WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x14059A050};
WEAK symbol<void(int localClientNum, const char* message)> CG_GameMessage{0x37F450}; WEAK symbol<void(int localClientNum, const char* message)> CG_GameMessage{0x14037F450};
WEAK symbol<void(int localClientNum, const char* message)> CG_GameMessageBold{0x37F1B0}; WEAK symbol<void(int localClientNum, const char* message)> CG_GameMessageBold{0x14037F1B0};
WEAK symbol<char*(const unsigned int weapon, WEAK symbol<char*(const unsigned int weapon,
bool isAlternate, char* outputBuffer, int bufferLen)> CG_GetWeaponDisplayName{0x3B9210}; bool isAlternate, char* outputBuffer, int bufferLen)> CG_GetWeaponDisplayName{0x1403B9210};
WEAK symbol<void(const char* cmdName, void(), cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x59A5F0}; WEAK symbol<void(const char* cmdName, void(), cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x14059A5F0};
WEAK symbol<void(int localClientNum, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x59ABA0}; WEAK symbol<void(int localClientNum, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x14059ABA0};
WEAK symbol<void(errorParm code, const char* message, ...)> Com_Error{0x5A2D80}; WEAK symbol<void(errorParm code, const char* message, ...)> Com_Error{0x1405A2D80};
WEAK symbol<void()> Com_Quit_f{0x5A50D0}; WEAK symbol<void()> Com_Quit_f{0x1405A50D0};
WEAK symbol<void()> Quit{0x5A52A0}; WEAK symbol<void()> Quit{0x1405A52A0};
WEAK symbol<void(XAssetType type, void(__cdecl* func)(game::XAssetHeader, void*), const void* inData, bool includeOverride)> WEAK symbol<void(XAssetType type, void(__cdecl* func)(game::XAssetHeader, void*), const void* inData, bool includeOverride)>
DB_EnumXAssets_Internal{0x4129F0}; DB_EnumXAssets_Internal{0x1404129F0};
WEAK symbol<const char*(const XAsset* asset)> DB_GetXAssetName{0x3E4090}; WEAK symbol<const char*(const XAsset* asset)> DB_GetXAssetName{0x1403E4090};
WEAK symbol<void(XZoneInfo* zoneInfo, unsigned int zoneCount, DBSyncMode syncMode)> DB_LoadXAssets{0x414FF0}; WEAK symbol<void(XZoneInfo* zoneInfo, unsigned int zoneCount, DBSyncMode syncMode)> DB_LoadXAssets{0x140414FF0};
WEAK symbol<XAssetHeader(XAssetType type, const char* name, int allowCreateDefault)> DB_FindXAssetHeader{0x412F60}; WEAK symbol<XAssetHeader(XAssetType type, const char* name, int allowCreateDefault)> DB_FindXAssetHeader{0x140412F60};
WEAK symbol<int(const RawFile* rawfile)> DB_GetRawFileLen{0x413D80}; WEAK symbol<int(const RawFile* rawfile)> DB_GetRawFileLen{0x140413D80};
WEAK symbol<int(const RawFile* rawfile, char* buf, int size)> DB_GetRawBuffer{0x413C40}; WEAK symbol<int(const RawFile* rawfile, char* buf, int size)> DB_GetRawBuffer{0x140413C40};
WEAK symbol<dvar_t*(const char* name)> Dvar_FindVar{0x618F90}; WEAK symbol<dvar_t*(const char* name)> Dvar_FindVar{0x140618F90};
WEAK symbol<void(char* buffer, int index)> Dvar_GetCombinedString{0x5A75D0}; WEAK symbol<void(char* buffer, int index)> Dvar_GetCombinedString{0x1405A75D0};
WEAK symbol<dvar_t*(int hash, const char* name, bool value, unsigned int flags)> Dvar_RegisterBool{0x617BB0}; WEAK symbol<dvar_t*(int hash, const char* name, bool value, unsigned int flags)> Dvar_RegisterBool{0x140617BB0};
WEAK symbol<dvar_t*(int hash, const char* name, int value, int min, int max, unsigned int flags)> Dvar_RegisterInt{0x618090}; WEAK symbol<dvar_t*(int hash, const char* name, int value, int min, int max, unsigned int flags)> Dvar_RegisterInt{0x140618090};
WEAK symbol<dvar_t*(int hash, const char* dvarName, float value, float min, float max, unsigned int flags)> WEAK symbol<dvar_t*(int hash, const char* dvarName, float value, float min, float max, unsigned int flags)>
Dvar_RegisterFloat{0x617F80}; Dvar_RegisterFloat{0x140617F80};
WEAK symbol<dvar_t*(int hash, const char* dvarName, const char* value, unsigned int flags)> WEAK symbol<dvar_t*(int hash, const char* dvarName, const char* value, unsigned int flags)>
Dvar_RegisterString{0x618170}; Dvar_RegisterString{0x140618170};
WEAK symbol<dvar_t*(int dvarName, const char* a2, float x, float y, float z, float w, float min, float max, WEAK symbol<dvar_t*(int dvarName, const char* a2, float x, float y, float z, float w, float min, float max,
unsigned int flags)> Dvar_RegisterVec4{0x6185F0}; unsigned int flags)> Dvar_RegisterVec4{0x1406185F0};
WEAK symbol<const char*(const dvar_t* dvar)> Dvar_DisplayableValue{0x618EA0}; WEAK symbol<const char*(const dvar_t* dvar)> Dvar_DisplayableValue{0x140618EA0};
WEAK symbol<const char*(dvar_t* dvar, void* a2, void* value)> Dvar_ValueToString{0x61B8F0}; WEAK symbol<const char*(dvar_t* dvar, void* a2, void* value)> Dvar_ValueToString{0x14061B8F0};
WEAK symbol<void(int hash, const char* name, const char* buffer)> Dvar_SetCommand{0x61A5C0}; WEAK symbol<void(int hash, const char* name, const char* buffer)> Dvar_SetCommand{0x14061A5C0};
WEAK symbol<void(const char* dvarName, const char* string, DvarSetSource source)> Dvar_SetFromStringFromSource{0x61A910}; WEAK symbol<void(const char* dvarName, const char* string, DvarSetSource source)> Dvar_SetFromStringFromSource{0x14061A910};
WEAK symbol<int(const char* fname)> generateHashValue{0x343D20}; WEAK symbol<int(const char* fname)> generateHashValue{0x140343D20};
WEAK symbol<bool()> CL_IsCgameInitialized{0x3CA0C0}; WEAK symbol<bool()> CL_IsCgameInitialized{0x1403CA0C0};
WEAK symbol<void(const char* text, int maxChars, Font_s* font, float x, float y, float xScale, float yScale, WEAK symbol<void(const char* text, int maxChars, Font_s* font, float x, float y, float xScale, float yScale,
const float* color, int style, const float* glowColor, Material* fxMaterial, Material* fxMaterialGlow, const float* color, int style, const float* glowColor, Material* fxMaterial, Material* fxMaterialGlow,
int fxBirthTime, int fxLetterTime, int fxDecayStartTime, int fxDecayDuration, int a17)> CL_DrawTextPhysicalWithEffects{0x3D4990}; int fxBirthTime, int fxLetterTime, int fxDecayStartTime, int fxDecayDuration, int a17)> CL_DrawTextPhysicalWithEffects{0x1403D4990};
WEAK symbol<unsigned int(unsigned int parentId, unsigned int name)> FindVariable{0x5C1D50}; WEAK symbol<unsigned int(unsigned int parentId, unsigned int name)> FindVariable{0x1405C1D50};
WEAK symbol<unsigned int(int entnum, unsigned int classnum)> FindEntityId{0x5C1C50}; WEAK symbol<unsigned int(int entnum, unsigned int classnum)> FindEntityId{0x1405C1C50};
WEAK symbol<void(VariableValue* result, unsigned int classnum, int entnum, int offset)> GetEntityFieldValue{0x5C6100}; WEAK symbol<void(VariableValue* result, unsigned int classnum, int entnum, int offset)> GetEntityFieldValue{0x1405C6100};
WEAK symbol<unsigned int(unsigned int parentId, unsigned int unsignedValue)> GetVariable{0x5C2690}; WEAK symbol<unsigned int(unsigned int parentId, unsigned int unsignedValue)> GetVariable{0x1405C2690};
WEAK symbol<unsigned int(unsigned int parentId, unsigned int unsignedValue)> GetNewVariable{0x5C22B0}; WEAK symbol<unsigned int(unsigned int parentId, unsigned int unsignedValue)> GetNewVariable{0x1405C22B0};
WEAK symbol<unsigned int(unsigned int parentId, unsigned int unsignedValue)> GetNewArrayVariable{0x5C2130}; WEAK symbol<unsigned int(unsigned int parentId, unsigned int unsignedValue)> GetNewArrayVariable{0x1405C2130};
WEAK symbol<void(unsigned int parentId, unsigned int id, VariableValue* value)> SetNewVariableValue{0x5C5EA0}; WEAK symbol<void(unsigned int parentId, unsigned int id, VariableValue* value)> SetNewVariableValue{0x1405C5EA0};
WEAK symbol<void(unsigned int parentId, unsigned int index)> RemoveVariableValue{0x5C2A50}; WEAK symbol<void(unsigned int parentId, unsigned int index)> RemoveVariableValue{0x1405C2A50};
WEAK symbol<unsigned int(const char* name)> G_GetWeaponForName{0x51B260}; WEAK symbol<unsigned int(const char* name)> G_GetWeaponForName{0x14051B260};
WEAK symbol<int(void* ps, unsigned int weapon, int a3, int a4, __int64 a5, int a6)> WEAK symbol<int(void* ps, unsigned int weapon, int a3, int a4, __int64 a5, int a6)>
G_GivePlayerWeapon{0x51B660}; G_GivePlayerWeapon{0x14051B660};
WEAK symbol<void(void* ps, const unsigned int weapon, int hadWeapon)> G_InitializeAmmo{0x4C4110}; WEAK symbol<void(void* ps, const unsigned int weapon, int hadWeapon)> G_InitializeAmmo{0x1404C4110};
WEAK symbol<void(int clientNum, const unsigned int weapon)> G_SelectWeapon{0x51C0D0}; WEAK symbol<void(int clientNum, const unsigned int weapon)> G_SelectWeapon{0x14051C0D0};
WEAK symbol<bool(int localClientNum, ScreenPlacement* screenPlacement, const float* worldDir, float* outScreenPos)> WorldPosToScreenPos{0x36F310}; WEAK symbol<bool(int localClientNum, ScreenPlacement* screenPlacement, const float* worldDir, float* outScreenPos)> WorldPosToScreenPos{0x14036F310};
WEAK symbol<char*(char* string)> I_CleanStr{0x620660}; WEAK symbol<char*(char* string)> I_CleanStr{0x140620660};
WEAK symbol<char*(GfxImage* image, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipCount, WEAK symbol<char*(GfxImage* image, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipCount,
uint32_t imageFlags, DXGI_FORMAT imageFormat, int a8, const char* name, const void* initData)> Image_Setup{0x74B2A0}; uint32_t imageFlags, DXGI_FORMAT imageFormat, int a8, const char* name, const void* initData)> Image_Setup{0x14074B2A0};
WEAK symbol<const char*(int, int, int)> Key_KeynumToString{0x3D32D0}; WEAK symbol<const char*(int, int, int)> Key_KeynumToString{0x1403D32D0};
WEAK symbol<void(int clientNum, const char* menu, int a3, int a4, unsigned int a5)> LUI_OpenMenu{0x5F0EE0}; WEAK symbol<void(int clientNum, const char* menu, int a3, int a4, unsigned int a5)> LUI_OpenMenu{0x1405F0EE0};
WEAK symbol<bool(int clientNum, const char* menu)> Menu_IsMenuOpenAndVisible{0x5EE1A0}; WEAK symbol<bool(int clientNum, const char* menu)> Menu_IsMenuOpenAndVisible{0x1405EE1A0};
WEAK symbol<Material*(const char* material)> Material_RegisterHandle{0x759BA0}; WEAK symbol<Material*(const char* material)> Material_RegisterHandle{0x140759BA0};
WEAK symbol<void(pathnode_t*, float* out)> PathNode_WorldifyPosFromParent{0x525830}; WEAK symbol<void(pathnode_t*, float* out)> PathNode_WorldifyPosFromParent{0x140525830};
WEAK symbol<const float*(const float* v)> Scr_AllocVector{0x5C3220}; WEAK symbol<const float*(const float* v)> Scr_AllocVector{0x1405C3220};
WEAK symbol<void()> Scr_ClearOutParams{0x5C6E50}; WEAK symbol<void()> Scr_ClearOutParams{0x1405C6E50};
WEAK symbol<scr_entref_t(unsigned int entId)> Scr_GetEntityIdRef{0x5C56C0}; WEAK symbol<scr_entref_t(unsigned int entId)> Scr_GetEntityIdRef{0x1405C56C0};
WEAK symbol<unsigned int(int entnum, unsigned int classnum)> Scr_GetEntityId{0x5C5610}; WEAK symbol<unsigned int(int entnum, unsigned int classnum)> Scr_GetEntityId{0x1405C5610};
WEAK symbol<int(unsigned int classnum, int entnum, int offset)> Scr_SetObjectField{0x512190}; WEAK symbol<int(unsigned int classnum, int entnum, int offset)> Scr_SetObjectField{0x140512190};
WEAK symbol<void(unsigned int id, scr_string_t stringValue, unsigned int paramcount)> Scr_NotifyId{0x5C8240}; WEAK symbol<void(unsigned int id, scr_string_t stringValue, unsigned int paramcount)> Scr_NotifyId{0x1405C8240};
WEAK symbol<unsigned int(unsigned int threadId)> Scr_GetSelf{0x5C57C0}; WEAK symbol<unsigned int(unsigned int threadId)> Scr_GetSelf{0x1405C57C0};
WEAK symbol<void()> Scr_ErrorInternal{0x5C6EC0}; WEAK symbol<void()> Scr_ErrorInternal{0x1405C6EC0};
WEAK symbol<unsigned int(unsigned int localId, const char* pos, unsigned int paramcount)> VM_Execute{0x5C8DB0}; WEAK symbol<unsigned int(unsigned int localId, const char* pos, unsigned int paramcount)> VM_Execute{0x1405C8DB0};
WEAK symbol<void(float x, float y, float width, float height, float s0, float t0, float s1, float t1, WEAK symbol<void(float x, float y, float width, float height, float s0, float t0, float s1, float t1,
float* color, Material* material)> R_AddCmdDrawStretchPic{0x3C9710}; float* color, Material* material)> R_AddCmdDrawStretchPic{0x1403C9710};
WEAK symbol<void(float x, float y, float width, float height, float s0, float t0, float s1, float t1, WEAK symbol<void(float x, float y, float width, float height, float s0, float t0, float s1, float t1,
float angle, float* color, Material* material)> R_AddCmdDrawStretchPicRotateXY{0x3C99B0}; float angle, float* color, Material* material)> R_AddCmdDrawStretchPicRotateXY{0x1403C99B0};
WEAK symbol<void*(const char* text, int maxChars, Font_s* font, float x, float y, float xScale, float yScale, WEAK symbol<void*(const char* text, int maxChars, Font_s* font, float x, float y, float xScale, float yScale,
float rotation, float* color, int style)> R_AddCmdDrawText{0x76C660}; float rotation, float* color, int style)> R_AddCmdDrawText{0x14076C660};
WEAK symbol<void(const char* text, int maxChars, Font_s* font, float x, float y, float xScale, float yScale, WEAK symbol<void(const char* text, int maxChars, Font_s* font, float x, float y, float xScale, float yScale,
float rotation, float* color1, float* color2, int style)> R_AddCmdDrawText2{0x76C860}; float rotation, float* color1, float* color2, int style)> R_AddCmdDrawText2{0x14076C860};
WEAK symbol<void(rectangle* rect, float a2, float a3, float a4, float a5, float* color, Material* material)> R_DrawRectangle{0x76A280}; WEAK symbol<void(rectangle* rect, float a2, float a3, float a4, float a5, float* color, Material* material)> R_DrawRectangle{0x14076A280};
WEAK symbol<void(const char* text, int maxChars, Font_s* font, int fontSize, float x, float y, float xScale, float yScale, float rotation, WEAK symbol<void(const char* text, int maxChars, Font_s* font, int fontSize, float x, float y, float xScale, float yScale, float rotation,
const float* color, int style, int cursorPos, char cursor)> R_AddCmdDrawTextWithCursor{0x76CAF0}; const float* color, int style, int cursorPos, char cursor)> R_AddCmdDrawTextWithCursor{0x14076CAF0};
WEAK symbol<void*(const char* text, int maxChars, Font_s* font, float x, float y, float xScale, float yScale, WEAK symbol<void*(const char* text, int maxChars, Font_s* font, float x, float y, float xScale, float yScale,
int a8, float* color1, unsigned int style, rgba color2)> R_AddCmdDrawTextGradient{0x76C570}; int a8, float* color1, unsigned int style, rgba color2)> R_AddCmdDrawTextGradient{0x14076C570};
WEAK symbol<Font_s*(const char* font, int size)> R_RegisterFont{0x746FE0}; WEAK symbol<Font_s*(const char* font, int size)> R_RegisterFont{0x140746FE0};
WEAK symbol<int(const char* text, int maxChars, Font_s* font)> R_TextWidth{0x7472A0}; WEAK symbol<int(const char* text, int maxChars, Font_s* font)> R_TextWidth{0x1407472A0};
WEAK symbol<void()> R_SyncRenderThread{0x76E7D0}; WEAK symbol<void()> R_SyncRenderThread{0x14076E7D0};
WEAK symbol<void(const void* obj, void* pose, unsigned int entnum, unsigned int renderFxFlags, float* lightingOrigin, WEAK symbol<void(const void* obj, void* pose, unsigned int entnum, unsigned int renderFxFlags, float* lightingOrigin,
float materialTime, __int64 a7, __int64 a8)> R_AddDObjToScene{0x775C40}; float materialTime, __int64 a7, __int64 a8)> R_AddDObjToScene{0x140775C40};
WEAK symbol<ScreenPlacement*()> ScrPlace_GetViewPlacement{0x3E16A0}; WEAK symbol<ScreenPlacement*()> ScrPlace_GetViewPlacement{0x1403E16A0};
WEAK symbol<ScreenPlacement*()> ScrPlace_GetView{0x3E1660}; WEAK symbol<ScreenPlacement*()> ScrPlace_GetView{0x1403E1660};
WEAK symbol<const char*(scr_string_t stringValue)> SL_ConvertToString{0x5BFBB0}; WEAK symbol<const char*(scr_string_t stringValue)> SL_ConvertToString{0x1405BFBB0};
WEAK symbol<scr_string_t(const char* str, unsigned int user)> SL_GetString{0x5C0170}; WEAK symbol<scr_string_t(const char* str, unsigned int user)> SL_GetString{0x1405C0170};
WEAK symbol<bool()> SV_Loaded{0x6B3860}; WEAK symbol<bool()> SV_Loaded{0x1406B3860};
WEAK symbol<void()> Sys_ShowConsole{0x633080}; WEAK symbol<void()> Sys_ShowConsole{0x140633080};
WEAK symbol<bool()> Sys_IsDatabaseReady2{0x5A9FE0}; WEAK symbol<bool()> Sys_IsDatabaseReady2{0x1405A9FE0};
WEAK symbol<int()> Sys_Milliseconds{0x650720}; WEAK symbol<int()> Sys_Milliseconds{0x140650720};
WEAK symbol<bool()> Sys_IsMainThread{0x5AA020}; WEAK symbol<bool()> Sys_IsMainThread{0x1405AA020};
WEAK symbol<const char*(const char* string)> UI_SafeTranslateString{0x5A2930}; WEAK symbol<const char*(const char* string)> UI_SafeTranslateString{0x1405A2930};
WEAK symbol<int(int localClientNum, const char* sound)> UI_PlayLocalSoundAlias{0x606080}; WEAK symbol<int(int localClientNum, const char* sound)> UI_PlayLocalSoundAlias{0x140606080};
WEAK symbol<void(pmove_t* move, trace_t*, const float*, const float*, WEAK symbol<void(pmove_t* move, trace_t*, const float*, const float*,
const Bounds*, int, int)> PM_playerTrace{0x68F0A0}; const Bounds*, int, int)> PM_playerTrace{0x14068F0A0};
WEAK symbol<void(pmove_t*, trace_t*, const float*, const float*, WEAK symbol<void(pmove_t*, trace_t*, const float*, const float*,
const Bounds*, int, int)> PM_trace{0x68F1D0}; const Bounds*, int, int)> PM_trace{0x14068F1D0};
WEAK symbol<void*(jmp_buf* Buf, int Value)> longjmp{0x89EED0}; WEAK symbol<void*(jmp_buf* Buf, int Value)> longjmp{0x14089EED0};
WEAK symbol<int(jmp_buf* Buf)> _setjmp{0x8EC2E0}; WEAK symbol<int(jmp_buf* Buf)> _setjmp{0x1408EC2E0};
// Variables // Variables
WEAK symbol<cmd_function_s*> cmd_functions{0xAD17BB8}; WEAK symbol<cmd_function_s*> cmd_functions{0x14AD17BB8};
WEAK symbol<CmdArgs> cmd_args{0xAD17A60}; WEAK symbol<CmdArgs> cmd_args{0x14AD17A60};
WEAK symbol<const char*> command_whitelist{0xBF84E0}; WEAK symbol<const char*> command_whitelist{0x140BF84E0};
WEAK symbol<HWND> hWnd{0xCCF81C0}; WEAK symbol<HWND> hWnd{0x14CCF81C0};
WEAK symbol<const char*> g_assetNames{0xBEF280}; WEAK symbol<const char*> g_assetNames{0x140BEF280};
WEAK symbol<int> g_poolSize{0xBF2E40}; WEAK symbol<int> g_poolSize{0x140BF2E40};
WEAK symbol<gentity_s> g_entities{0x52DDDA0}; WEAK symbol<gentity_s> g_entities{0x1452DDDA0};
WEAK symbol<int> num_entities{0x55CC738}; WEAK symbol<int> num_entities{0x1455CC738};
WEAK symbol<PathData> pathData{0x52CCDA0}; WEAK symbol<PathData> pathData{0x1452CCDA0};
WEAK symbol<int> vehicle_pathnode_count{0xD009A30}; WEAK symbol<int> vehicle_pathnode_count{0x14D009A30};
WEAK symbol<DWORD> threadIds{0xB11DC80}; WEAK symbol<DWORD> threadIds{0x14B11DC80};
WEAK symbol<GfxDrawMethod_s> gfxDrawMethod{0xEDF9E00}; WEAK symbol<GfxDrawMethod_s> gfxDrawMethod{0x14EDF9E00};
WEAK symbol<refdef_t> refdef{0x1BC2500}; WEAK symbol<refdef_t> refdef{0x141BC2500};
WEAK symbol<int> keyCatchers{0x203F3C0}; WEAK symbol<int> keyCatchers{0x14203F3C0};
WEAK symbol<PlayerKeyState> playerKeys{0x1E8767C}; WEAK symbol<PlayerKeyState> playerKeys{0x141E8767C};
WEAK symbol<int> dvarCount{0xBFBB310}; WEAK symbol<int> dvarCount{0x14BFBB310};
WEAK symbol<dvar_t> dvarPool{0xBFBB320}; WEAK symbol<dvar_t> dvarPool{0x14BFBB320};
WEAK symbol<unsigned int> levelEntityId{0xB5E0B30}; WEAK symbol<unsigned int> levelEntityId{0x14B5E0B30};
WEAK symbol<int> g_script_error_level{0xBA9CC24}; WEAK symbol<int> g_script_error_level{0x14BA9CC24};
WEAK symbol<jmp_buf> g_script_error{0xBA9CD40}; WEAK symbol<jmp_buf> g_script_error{0x14BA9CD40};
WEAK symbol<scr_classStruct_t> g_classMap{0xBF95C0}; WEAK symbol<scr_classStruct_t> g_classMap{0x140BF95C0};
WEAK symbol<scrVarGlob_t> scr_VarGlob{0xB617C00}; WEAK symbol<scrVarGlob_t> scr_VarGlob{0x14B617C00};
WEAK symbol<scrVmPub_t> scr_VmPub{0xBA9EE40}; WEAK symbol<scrVmPub_t> scr_VmPub{0x14BA9EE40};
WEAK symbol<function_stack_t> scr_function_stack{0xBAA93C0}; WEAK symbol<function_stack_t> scr_function_stack{0x14BAA93C0};
namespace hks namespace hks
{ {
WEAK symbol<lua_State*> lua_state{0x19D83E8}; WEAK symbol<lua_State*> lua_state{0x1419D83E8};
WEAK symbol<void(lua_State* s, const char* str, unsigned int l)> hksi_lua_pushlstring{0x287410}; WEAK symbol<void(lua_State* s, const char* str, unsigned int l)> hksi_lua_pushlstring{0x140287410};
WEAK symbol<const char*(lua_State* s, const HksObject* obj, unsigned int* len)> hks_obj_tolstring{0x287410}; WEAK symbol<const char*(lua_State* s, const HksObject* obj, unsigned int* len)> hks_obj_tolstring{0x140287410};
WEAK symbol<int(lua_State* s, const HksObject* obj, HksObject* ret)> hks_obj_getmetatable{0x2DA210}; WEAK symbol<int(lua_State* s, const HksObject* obj, HksObject* ret)> hks_obj_getmetatable{0x1402DA210};
WEAK symbol<HksObject*(HksObject* result, lua_State* s, const HksObject* table, const HksObject* key)> hks_obj_getfield{0x2D9E20}; WEAK symbol<HksObject*(HksObject* result, lua_State* s, const HksObject* table, const HksObject* key)> hks_obj_getfield{0x1402D9E20};
WEAK symbol<void(lua_State* s, const HksObject* tbl, const HksObject* key, const HksObject* val)> hks_obj_settable{0x2DB040}; WEAK symbol<void(lua_State* s, const HksObject* tbl, const HksObject* key, const HksObject* val)> hks_obj_settable{0x1402DB040};
WEAK symbol<HksObject* (HksObject* result, lua_State* s, const HksObject* table, const HksObject* key)> hks_obj_gettable{0x2DA300}; WEAK symbol<HksObject* (HksObject* result, lua_State* s, const HksObject* table, const HksObject* key)> hks_obj_gettable{0x1402DA300};
WEAK symbol<void(lua_State* s, int nargs, int nresults, const unsigned int* pc)> vm_call_internal{0x30AB60}; WEAK symbol<void(lua_State* s, int nargs, int nresults, const unsigned int* pc)> vm_call_internal{0x14030AB60};
WEAK symbol<void(lua_State* s, int index)> hksi_lua_pushvalue{0x2DE040}; WEAK symbol<void(lua_State* s, int index)> hksi_lua_pushvalue{0x1402DE040};
WEAK symbol<HashTable*(lua_State* s, unsigned int arraySize, unsigned int hashSize)> Hashtable_Create{0x2C8290}; WEAK symbol<HashTable*(lua_State* s, unsigned int arraySize, unsigned int hashSize)> Hashtable_Create{0x1402C8290};
WEAK symbol<HksObject*(HashTable* t, HksObject* result, HksObject* key)> Hashtable_getNextHash{0x2D5150}; WEAK symbol<HksObject*(HashTable* t, HksObject* result, HksObject* key)> Hashtable_getNextHash{0x1402D5150};
WEAK symbol<void(lua_State* s, const HksObject* tbl, HksObject* key, HksObject* retval)> hks_obj_next{0x2DA850}; WEAK symbol<void(lua_State* s, const HksObject* tbl, HksObject* key, HksObject* retval)> hks_obj_next{0x1402DA850};
WEAK symbol<cclosure*(lua_State* s, lua_function function, int num_upvalues, WEAK symbol<cclosure*(lua_State* s, lua_function function, int num_upvalues,
int internal_, int profilerTreatClosureAsFunc)> cclosure_Create{0x2C84B0}; int internal_, int profilerTreatClosureAsFunc)> cclosure_Create{0x1402C84B0};
WEAK symbol<int(lua_State* s, int t)> hksi_luaL_ref{0x2E4520}; WEAK symbol<int(lua_State* s, int t)> hksi_luaL_ref{0x1402E4520};
WEAK symbol<void(lua_State* s, int t, int ref)> hksi_luaL_unref{0x2DCE50}; WEAK symbol<void(lua_State* s, int t, int ref)> hksi_luaL_unref{0x1402DCE50};
} }
} }

View File

@ -360,7 +360,7 @@ namespace ui_scripting::lua
game_type["playmenuvideo"] = [](const game&, const std::string& video) game_type["playmenuvideo"] = [](const game&, const std::string& video)
{ {
reinterpret_cast<void (*)(const char* a1, int a2, int a3)> reinterpret_cast<void (*)(const char* a1, int a2, int a3)>
(0x71B970_b)(video.data(), 64, 0); (0x14071B970)(video.data(), 64, 0);
}; };
game_type["sharedset"] = [](const game&, const std::string& key, const std::string& value) game_type["sharedset"] = [](const game&, const std::string& key, const std::string& value)

View File

@ -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()); 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); const auto target = utils::nt::library::load(filename);
if (!target) 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!"}; 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_imports(target, target);
this->load_tls(target, target); this->load_tls(target, target);

View File

@ -5,7 +5,7 @@ class loader final
{ {
public: public:
FARPROC load(const utils::nt::library& library, const std::string& buffer) const; 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<void*(const std::string&, const std::string&)>& resolver); void set_import_resolver(const std::function<void*(const std::string&, const std::string&)>& resolver);

View File

@ -39,7 +39,7 @@ launcher::mode detect_mode_from_arguments()
return launcher::mode::none; return launcher::mode::none;
} }
FARPROC load_binary(const launcher::mode mode, uint64_t* base_address) FARPROC load_binary(const launcher::mode mode)
{ {
loader loader; loader loader;
utils::nt::library self; utils::nt::library self;
@ -87,7 +87,7 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address)
binary.data())); binary.data()));
} }
return loader.load_library(binary, base_address); return loader.load(self, data);
} }
void remove_crash_file() void remove_crash_file()
@ -97,7 +97,7 @@ void remove_crash_file()
void verify_version() void verify_version()
{ {
const auto value = *reinterpret_cast<DWORD*>(0x123456_b); const auto value = *reinterpret_cast<DWORD*>(0x140123456);
if (value != 0xE465E151) if (value != 0xE465E151)
{ {
throw std::runtime_error("Unsupported Call of Duty: Modern Warfare 2 Campaign Remastered version"); 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); game::environment::set_mode(mode);
uint64_t base_address{}; entry_point = load_binary(mode);
entry_point = load_binary(mode, &base_address);
if (!entry_point) if (!entry_point)
{ {
throw std::runtime_error("Unable to load binary into memory"); throw std::runtime_error("Unable to load binary into memory");
} }
game::base_address = base_address;
verify_version(); verify_version();
if (!component_loader::post_load()) if (!component_loader::post_load())

View File

@ -1,6 +1,13 @@
#include <std_include.hpp> #include <std_include.hpp>
#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" extern "C"
{ {