This commit is contained in:
momo5502 2016-01-03 15:44:51 +01:00
parent 9b0abfb043
commit 3c3eba8244
4 changed files with 29 additions and 4 deletions

View File

@ -29,10 +29,31 @@ namespace Components
return key;
}
void __stdcall Localization::SetStringStub(const char* key, const char* value, bool isEnglish)
{
Localization::Set(key, value);
}
DWORD Localization::SELoadLanguageStub()
{
//'official' iw4m localized strings
Game::SE_Load("localizedstrings/iw4m.str", 0);
return Utils::Hook::Call<DWORD()>(0x629E20)();
}
Localization::Localization()
{
// Resolving hook
Utils::Hook(0x629B90, Localization::Get, HOOK_JUMP).Install()->Quick();
// Set loading entry point
Utils::Hook(0x41D859, Localization::SELoadLanguageStub, HOOK_CALL).Install()->Quick();
// Overwrite SetString
Utils::Hook(0x4CE5EE, Localization::SetStringStub, HOOK_CALL).Install()->Quick();
// TODO: Get rid of those!
Localization::Set("MENU_SEARCHINGFORGAMES_100MS", "");
Localization::Set("MP_SEARCHING_FOR_PLAYER", "Waiting");
Localization::Set("MENU_WAITING_FOR_MORE_PLAYERS_TEAMS", "Waiting for more players to balance teams");
@ -59,10 +80,6 @@ namespace Components
Localization::Set("PLATFORM_REFRESH_LIST", "Refresh List ^0- ^3F5");
Localization::Set("PLATFORM_REFRESH_LIST_CAPS", "REFRESH LIST ^0- ^3F5");
// Don't perform non-english localization here, do it in fastfiles instead
//Localization::Set("MP_SEARCHING_FOR_PLAYER", "Warte");
//Localization::Set("MENU_WAITING_FOR_MORE_PLAYERS_TEAMS", "Auf weitere Spieler zum Teamausgleich warten");
Localization::UseLocalization = Dvar::Register<bool>("ui_localize", true, Game::dvar_flag::DVAR_FLAG_NONE, "Use localization strings");
}

View File

@ -13,5 +13,8 @@ namespace Components
private:
static std::map<std::string, std::string> LocalizeMap;
static Dvar::Var UseLocalization;
static void __stdcall SetStringStub(const char* key, const char* value, bool isEnglish);
static DWORD SELoadLanguageStub();
};
}

View File

@ -76,6 +76,8 @@ namespace Game
sendOOB_t OOBPrint = (sendOOB_t)0x4AEF00;
sendOOBRaw_t OOBPrintRawData = (sendOOBRaw_t)0x60FDC0;
SE_Load_t SE_Load = (SE_Load_t)0x502A30;
PC_ReadToken_t PC_ReadToken = (PC_ReadToken_t)0x4ACCD0;
PC_ReadTokenHandle_t PC_ReadTokenHandle = (PC_ReadTokenHandle_t)0x4D2060;
PC_SourceError_t PC_SourceError = (PC_SourceError_t)0x467A00;

View File

@ -172,6 +172,9 @@ namespace Game
typedef void(__cdecl* sendOOBRaw_t)(int, size_t, const char*, int, int, int, int, int);
extern sendOOBRaw_t OOBPrintRawData;
typedef char* (__cdecl * SE_Load_t)(char* file, int Unk);
extern SE_Load_t SE_Load;
typedef int(__cdecl * PC_ReadToken_t)(source_t*, token_t*);
extern PC_ReadToken_t PC_ReadToken;