[TextRenderer]: Fixed crash in DrawPlayerWeaponLowAmmoWarning

This commit is contained in:
JerryALT 2024-06-10 22:53:28 +03:00
parent 8775a7455d
commit aaf8e6aba9

View File

@ -187,7 +187,7 @@ namespace Components
{
char binding[256];
if (!Game::UI_GetKeyBindingLocalizedString(0, "+usereload", binding, 0))
std::strncpy(binding, "", sizeof(binding));
strncpy_s(binding, sizeof(binding), "", _TRUNCATE);
const char* displayString = Game::UI_SafeTranslateString(pszInputBuffer);
const char* localizedString = Game::UI_ReplaceConversionString(displayString, binding);
@ -196,16 +196,10 @@ namespace Components
__declspec(naked) void TextRenderer::CG_DrawPlayerWeaponLowAmmoWarningStub()
{
const static uint32_t jump_offset = 0x040A1F0;
static const char* messageType = "low ammo warning";
const static uint32_t jump_offset = 0x40A1F0;
__asm
{
push 0;
push messageType;
push esi;
call CG_DrawPlayerWeaponLowAmmoKey;
add esp, 0xC;
jmp jump_offset;
}
}