gsc hook safe set

This commit is contained in:
ineed bots
2023-09-01 20:05:59 -06:00
parent ca306d785b
commit db053c05d2
3 changed files with 26 additions and 3 deletions

View File

@ -170,6 +170,7 @@ namespace signatures
return true;
}
#define SAFE_SET_PLUTO_SYMBOL_DOUBLE(name, addr, off) \
addr2 = reinterpret_cast<size_t>(utils::hook::get_displacement_addr(addr)); \
if (!addr_is_in_image_space(addr2)) \
@ -186,6 +187,16 @@ namespace signatures
game::plutonium::name.set(addr1)
#define SAFE_SET_PLUTO_SYMBOL(name, addr) \
addr1 = reinterpret_cast<size_t>(utils::hook::get_displacement_addr(addr)); \
if (!addr_is_in_image_space(addr1)) \
{ \
err_reason = #name; \
return false; \
} \
game::plutonium::name.set(addr1)
bool handle_funcs()
{
size_t addr1;
@ -199,6 +210,9 @@ namespace signatures
SAFE_SET_PLUTO_SYMBOL_DOUBLE(scr_execentthread_update_codepos_func, 0x699640, 0x7);
SAFE_SET_PLUTO_SYMBOL_DOUBLE(scr_addexecthread_update_codepos_func, 0x699730, 0x7);
SAFE_SET_PLUTO_SYMBOL(scr_get_function_stub, 0x682D99);
SAFE_SET_PLUTO_SYMBOL(scr_get_method_stub, 0x683043);
return true;
}