From a65d085ae985fbc789998f63359df14959ff482a Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Thu, 14 Jul 2011 13:50:06 -0700 Subject: [PATCH 1/4] Enable App.SetLanguage console command. --- Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp index f52353dc..a190ef8e 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp @@ -2565,7 +2565,6 @@ PF_CONSOLE_CMD(App, #endif // LIMIT_CONSOLE_COMMANDS -#ifdef LIMIT_CONSOLE_COMMANDS // for now, disable languages in external clients PF_CONSOLE_CMD(App, SetLanguage, "string language", @@ -2591,7 +2590,6 @@ PF_CONSOLE_CMD(App, plLocalization::SetLanguage(plLocalization::kJapanese); } -#endif // LIMIT_CONSOLE_COMMANDS PF_CONSOLE_CMD(App, DemoMode, From 8f8fbb9dacfa99687c38dd55cd8ec49d4f6c7140 Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Thu, 14 Jul 2011 13:50:42 -0700 Subject: [PATCH 2/4] Add support for general.ini settings file. --- Sources/Plasma/Apps/plClient/winmain.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index 6a0799b8..78c25dc8 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -1603,6 +1603,18 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC #endif plLocalization::SetDefaultLanguage(); + // Load an optional general.ini + wchar gipath[MAX_PATH]; + PathGetInitDirectory(gipath, arrsize(gipath)); + PathAddFilename(gipath, gipath, L"general.ini", arrsize(gipath)); + FILE *generalini = _wfopen(gipath, L"rb"); + if (generalini) + { + fclose(generalini); + pfConsoleEngine tempConsole; + tempConsole.ExecuteFile(gipath); + } + // If another instance is running, exit. We'll automatically release our // lock on the mutex when our process exits HANDLE hOneInstance = CreateMutex(nil, FALSE, "UruExplorer"); @@ -1616,13 +1628,13 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC case plLocalization::kGerman: hsMessageBox("URU wird bereits in einer anderen Instanz ausgeführt", "Fehler", hsMessageBoxNormal); break; -/* case plLocalization::kSpanish: + case plLocalization::kSpanish: hsMessageBox("En estos momentos se está ejecutando otra copia de URU", "Error", hsMessageBoxNormal); break; case plLocalization::kItalian: hsMessageBox("Un'altra copia di URU è già aperta", "Errore", hsMessageBoxNormal); break; -*/ // default is English + // default is English default: hsMessageBox("Another copy of URU is already running", "Error", hsMessageBoxNormal); break; From 5d48936354900a70d2776536ce9f4fb45e447356 Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Thu, 14 Jul 2011 14:04:15 -0700 Subject: [PATCH 3/4] Remove unused Windows-registry-specific SetDefaultLanguage(). --- Sources/Plasma/Apps/plClient/winmain.cpp | 1 - .../PubUtilLib/plResMgr/plLocalization.cpp | 54 ------------------- .../PubUtilLib/plResMgr/plLocalization.h | 3 -- 3 files changed, 58 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index 78c25dc8..0dd1aa6c 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -1602,7 +1602,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC } #endif - plLocalization::SetDefaultLanguage(); // Load an optional general.ini wchar gipath[MAX_PATH]; PathGetInitDirectory(gipath, arrsize(gipath)); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp index 9ffa3b19..63f52635 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp @@ -188,57 +188,3 @@ std::vector plLocalization::StringToLocal(const std::wstring & loc retVal[0] = localizedText; // if no tags were in the text, we assume it to be English return retVal; } - -#include "hsWindows.h" - -void plLocalization::SetDefaultLanguage() -{ - fLanguage = kEnglish; -#if 0 // disable all languages -#ifdef HS_BUILD_FOR_WIN32 - HKEY hLocalKey = NULL; - HKEY hMSKey = NULL; - HKEY hWindowsKey = NULL; - HKEY hCurVerKey = NULL; - HKEY hUninstKey = NULL; - HKEY hUruKey = NULL; - - #define RegOpen(key, retKey, subKeyName) RegOpenKeyEx(key, subKeyName, 0, KEY_READ, &retKey) == ERROR_SUCCESS - - if (RegOpen(HKEY_LOCAL_MACHINE, hLocalKey, "software") && - RegOpen(hLocalKey, hMSKey, "microsoft") && - RegOpen(hMSKey, hWindowsKey, "windows") && - RegOpen(hWindowsKey, hCurVerKey, "currentversion") && - RegOpen(hCurVerKey, hUninstKey, "uninstall") && - RegOpen(hUninstKey, hUruKey, "Uru - Ages Beyond Myst")) - { - char value[20]; - DWORD bufsize = sizeof(value); - if (RegQueryValueEx(hUruKey, "Lang", NULL, NULL, (LPBYTE)value, &bufsize) == ERROR_SUCCESS) - { - if (hsStrEQ(value, "en")) - fLanguage = kEnglish; - else if (hsStrEQ(value, "fr")) - fLanguage = kFrench; - else if (hsStrEQ(value, "de")) - fLanguage = kGerman; - else if (hsStrEQ(value, "es")) - fLanguage = kSpanish; - else if (hsStrEQ(value, "it")) - fLanguage = kItalian; - else if (hsStrEQ(value, "jp")) - fLanguage = kJapanese; - else - fLanguage = kEnglish; - } - } - - RegCloseKey(hLocalKey); - RegCloseKey(hMSKey); - RegCloseKey(hWindowsKey); - RegCloseKey(hCurVerKey); - RegCloseKey(hUninstKey); - RegCloseKey(hUruKey); -#endif // HS_BUILD_FOR_WIN32 -#endif // 0 -} diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.h b/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.h index 888c8f5b..ab341662 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.h @@ -67,9 +67,6 @@ protected: static hsBool IGetLocalized(const char* name, Language lang, char* localizedName); public: - // Sets the default language, as determined by the installer - static void SetDefaultLanguage(); - static void SetLanguage(Language lang) { fLanguage = lang; } static Language GetLanguage() { return fLanguage; } From 0f1b397d167116a9d61f67d5f072bcb08e43fea4 Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Thu, 14 Jul 2011 19:17:59 -0700 Subject: [PATCH 4/4] Fix for crash caused by Objects without a name when running localized. --- Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp index 9f6d9ad5..0fff1520 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp @@ -515,7 +515,7 @@ inline plKeyImp* IFindKeyLocalized(const plUoid& uoid, plRegistryPageNode* page) const char* objectName = uoid.GetObjectName(); // If we're running localized, try to find a localized version first - if (plLocalization::IsLocalized()) + if ((objectName != nil) && plLocalization::IsLocalized()) { char localName[256]; if (plLocalization::GetLocalized(objectName, localName))