Small stats fix

This commit is contained in:
Federico Cecchetto 2022-05-20 22:02:42 +02:00
parent 9d0f319c02
commit 7210536a44

View File

@ -18,27 +18,15 @@ namespace stats
game::dvar_t* cg_unlock_all_items; game::dvar_t* cg_unlock_all_items;
utils::hook::detour is_item_unlocked_hook; utils::hook::detour is_item_unlocked_hook;
utils::hook::detour is_item_unlocked_hook2;
utils::hook::detour is_item_unlocked_hook3;
int is_item_unlocked_stub(int a1, void* a2, int a3) int is_item_unlocked_stub(int a1, void* a2, void* a3, void* a4, int a5, void* a6)
{ {
if (cg_unlock_all_items->current.enabled) if (cg_unlock_all_items->current.enabled)
{ {
return 0; return 0;
} }
return is_item_unlocked_hook.invoke<int>(a1, a2, a3); return is_item_unlocked_hook.invoke<int>(a1, a2, a3, a4, a5, a6);
}
int is_item_unlocked_stub2(int a1, void* a2, void* a3, void* a4, int a5, void* a6)
{
if (cg_unlock_all_items->current.enabled)
{
return 0;
}
return is_item_unlocked_hook2.invoke<int>(a1, a2, a3, a4, a5, a6);
} }
int is_item_unlocked() int is_item_unlocked()
@ -57,16 +45,16 @@ namespace stats
return; return;
} }
utils::hook::jump(0x19E6E0_b, is_item_unlocked, true);
if (game::environment::is_dedi()) if (game::environment::is_dedi())
{ {
utils::hook::jump(0x19E6E0_b, is_item_unlocked, true);
utils::hook::jump(0x19E070_b, is_item_unlocked, true); utils::hook::jump(0x19E070_b, is_item_unlocked, true);
utils::hook::jump(0x19D390_b, is_item_unlocked, true); utils::hook::jump(0x19D390_b, is_item_unlocked, true);
} }
else else
{ {
is_item_unlocked_hook.create(0x19E6E0_b, is_item_unlocked_stub); is_item_unlocked_hook.create(0x19E070_b, is_item_unlocked_stub);
is_item_unlocked_hook2.create(0x19E070_b, is_item_unlocked_stub2);
cg_unlock_all_items = dvars::register_bool("cg_unlockall_items", false, game::DVAR_FLAG_SAVED, cg_unlock_all_items = dvars::register_bool("cg_unlockall_items", false, game::DVAR_FLAG_SAVED,
"Whether items should be locked based on the player's stats or always unlocked."); "Whether items should be locked based on the player's stats or always unlocked.");