[Weapon] Correctly clear configstrings

This commit is contained in:
momo5502 2017-02-05 22:25:38 +01:00
parent 99351df9d0
commit ee87a4948c
3 changed files with 9 additions and 0 deletions

View File

@ -83,6 +83,12 @@ namespace Components
}
}
int Weapon::ClearConfigStrings(void* dest, int value, int size)
{
memset(Utils::Hook::Get<void*>(0x405B72), value, MAX_CONFIGSTRINGS * 2);
return Utils::Hook::Call<int(void*, int, int)>(0x4C98D0)(dest, value, size); // Com_Memset
}
void Weapon::PatchConfigStrings()
{
Utils::Hook::Set<DWORD>(0x4347A7, MAX_CONFIGSTRINGS);
@ -150,6 +156,7 @@ namespace Components
//Utils::Hook::Set(0x6083D6, &configStrings[ARRAYSIZE(configStrings)]);
//Utils::Hook::Set(0x60848E, &configStrings[ARRAYSIZE(configStrings)]);
Utils::Hook(0x405BBE, Weapon::ClearConfigStrings, HOOK_CALL).install()->quick();
Utils::Hook(0x593CA4, Weapon::ParseConfigStrings, HOOK_CALL).install()->quick();
Utils::Hook(0x4BD52D, Weapon::GetWeaponConfigString, HOOK_CALL).install()->quick();
Utils::Hook(0x45D170, Weapon::SaveRegisteredWeapons, HOOK_JUMP).install()->quick();

View File

@ -26,5 +26,6 @@ namespace Components
static void ParseConfigStrings();
static int ParseWeaponConfigStrings();
static int ClearConfigStrings(void* dest, int value, int size);
};
}

View File

@ -129,6 +129,7 @@ namespace Game
dvar_value_t _default; //48:64
dvar_maxmin_t min; //65:67
dvar_maxmin_t max; //68:72 woooo
bool(*callback)(dvar_t* dvar, dvar_value_t value);
} dvar_t;
typedef struct cmd_function_s