[Localization] Fix localization crash

Preserve esi, as it is required by the hooked function
This commit is contained in:
momo5502 2016-11-20 14:09:07 +01:00
parent 8085e4bd88
commit 1d13548829
2 changed files with 16 additions and 4 deletions

View File

@ -131,7 +131,7 @@ namespace Components
Localization::Set(key, value); Localization::Set(key, value);
} }
DWORD Localization::SELoadLanguageStub() void Localization::LoadLanguageStrings()
{ {
//if (ZoneBuilder::IsEnabled()) //if (ZoneBuilder::IsEnabled())
{ {
@ -144,8 +144,19 @@ namespace Components
Game::SE_Load("localizedstrings/iw4x_english.str", 0); Game::SE_Load("localizedstrings/iw4x_english.str", 0);
} }
} }
}
return Utils::Hook::Call<DWORD()>(0x629E20)(); __declspec(naked) void Localization::SELoadLanguageStub()
{
__asm
{
pushad
call Localization::LoadLanguageStrings
popad
push 629E20h
retn
}
} }
Localization::Localization() Localization::Localization()

View File

@ -24,6 +24,7 @@ namespace Components
static Dvar::Var UseLocalization; static Dvar::Var UseLocalization;
static void __stdcall SetStringStub(const char* key, const char* value, bool isEnglish); static void __stdcall SetStringStub(const char* key, const char* value, bool isEnglish);
static DWORD SELoadLanguageStub(); static void LoadLanguageStrings();
static void SELoadLanguageStub();
}; };
} }