[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);
}
DWORD Localization::SELoadLanguageStub()
void Localization::LoadLanguageStrings()
{
//if (ZoneBuilder::IsEnabled())
{
@ -144,8 +144,19 @@ namespace Components
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()

View File

@ -7,7 +7,7 @@ namespace Components
~Localization();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Localization"; };
const char* getName() { return "Localization"; };
#endif
static void Set(std::string key, std::string value);
@ -24,6 +24,7 @@ namespace Components
static Dvar::Var UseLocalization;
static void __stdcall SetStringStub(const char* key, const char* value, bool isEnglish);
static DWORD SELoadLanguageStub();
static void LoadLanguageStrings();
static void SELoadLanguageStub();
};
}