[Localization] Load language specific files

This commit is contained in:
momo5502 2016-11-17 18:17:25 +01:00
parent f68c895286
commit 45200eba58
2 changed files with 12 additions and 5 deletions

View File

@ -133,8 +133,17 @@ namespace Components
DWORD Localization::SELoadLanguageStub() DWORD Localization::SELoadLanguageStub()
{ {
//'official' iw4x localized strings if (ZoneBuilder::IsEnabled())
Game::SE_Load("localizedstrings/iw4x.str", 0); {
if (FileSystem::File(fmt::sprintf("localizedstrings/iw4x_%s.str", Game::Win_GetLanguage())).Exists())
{
Game::SE_Load(Utils::String::VA("localizedstrings/iw4x_%s.str", Game::Win_GetLanguage()), 0);
}
else
{
Game::SE_Load("localizedstrings/iw4x_english.str", 0);
}
}
return Utils::Hook::Call<DWORD()>(0x629E20)(); return Utils::Hook::Call<DWORD()>(0x629E20)();
} }
@ -161,10 +170,8 @@ namespace Components
// Resolving hook // Resolving hook
Utils::Hook(0x629B90, Localization::Get, HOOK_JUMP).Install()->Quick(); Utils::Hook(0x629B90, Localization::Get, HOOK_JUMP).Install()->Quick();
#ifdef DEBUG
// Set loading entry point // Set loading entry point
Utils::Hook(0x41D859, Localization::SELoadLanguageStub, HOOK_CALL).Install()->Quick(); Utils::Hook(0x41D859, Localization::SELoadLanguageStub, HOOK_CALL).Install()->Quick();
#endif
// Overwrite SetString // Overwrite SetString
Utils::Hook(0x4CE5EE, Localization::SetStringStub, HOOK_CALL).Install()->Quick(); Utils::Hook(0x4CE5EE, Localization::SetStringStub, HOOK_CALL).Install()->Quick();

View File

@ -458,7 +458,7 @@ namespace Game
typedef int(__cdecl * Script_CleanString_t)(char* buffer); typedef int(__cdecl * Script_CleanString_t)(char* buffer);
extern Script_CleanString_t Script_CleanString; extern Script_CleanString_t Script_CleanString;
typedef char* (__cdecl * SE_Load_t)(char* file, int Unk); typedef char* (__cdecl * SE_Load_t)(const char* file, int Unk);
extern SE_Load_t SE_Load; extern SE_Load_t SE_Load;
typedef char* (__cdecl * SEH_StringEd_GetString_t)(const char* string); typedef char* (__cdecl * SEH_StringEd_GetString_t)(const char* string);