[TextRenderer]: Added 'ButtonAnimation' for game hints. (#5)

This commit is contained in:
JerryALT 2024-03-18 02:46:24 +03:00
parent 22d7821e17
commit 3a50517730
2 changed files with 28 additions and 0 deletions

View File

@ -202,6 +202,30 @@ namespace Components
} }
} }
__declspec(naked) void TextRenderer::UI_GetKeyBindingLocalizedStringStub()
{
const static uint32_t continue_function = 0x41AA92;
const static uint32_t jump_end = 0x41AAF5;
__asm
{
//stock op's
add esp, 8;
test eax, eax;
//mod
jz isNotKeyBinding;
pushad;
push edi;
call ButtonAnimation;
add esp, 4;
popad;
jmp jump_end;
isNotKeyBinding:
jmp continue_function;
}
}
TextRenderer::TextRenderer() TextRenderer::TextRenderer()
{ {
Utils::Hook(0x56E613, R_TextWidth_Stub01, HOOK_JUMP).install()->quick(); Utils::Hook(0x56E613, R_TextWidth_Stub01, HOOK_JUMP).install()->quick();
@ -211,5 +235,8 @@ namespace Components
Utils::Hook(0x5FE402, DrawHudIconStub, HOOK_JUMP).install()->quick(); Utils::Hook(0x5FE402, DrawHudIconStub, HOOK_JUMP).install()->quick();
Utils::Hook(0x568224, UI_ReplaceConversionStringStub, HOOK_JUMP).install()->quick(); Utils::Hook(0x568224, UI_ReplaceConversionStringStub, HOOK_JUMP).install()->quick();
// GetHudelemDirective
Utils::Hook::Nop(0x41AA8B, 7);
Utils::Hook(0x41AA8B, UI_GetKeyBindingLocalizedStringStub, HOOK_JUMP).install()->quick();
} }
} }

View File

@ -22,6 +22,7 @@ namespace Components
static void DrawHudIconStub(); static void DrawHudIconStub();
static void UI_ReplaceConversionStringStub(); static void UI_ReplaceConversionStringStub();
static void ButtonAnimation(char* text); static void ButtonAnimation(char* text);
static void UI_GetKeyBindingLocalizedStringStub();
static int R_TextWidth_Hk(const char* text, int maxChars, Game::Font_s* font); static int R_TextWidth_Hk(const char* text, int maxChars, Game::Font_s* font);
static float DrawHudIcon(const char* text, const Game::Font_s* font, const float x, const float y, const float sinAngle, const float cosAngle, const float xScale, const float yScale, Game::GfxColor color); static float DrawHudIcon(const char* text, const Game::Font_s* font, const float x, const float y, const float sinAngle, const float cosAngle, const float xScale, const float yScale, Game::GfxColor color);