port: UserInterface.cpp entry unit — ApplicationSetErrorString/StringTable_Initialize verbatim, Main ADAPTED to PythonBoot, Win32 entry N_A
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fd4d9a39df
commit
b497fce393
@@ -46,6 +46,7 @@
|
||||
#include "UserInterface/PythonApplication.h"
|
||||
#include "EterBase/Timer.h"
|
||||
#include "PythonBoot.h"
|
||||
#include "../UserInterface/UserInterface.h"
|
||||
#include "PythonHost.h"
|
||||
#include "../EterLib/UIRenderCommands.h"
|
||||
#include "../EterBase/LogBox.h"
|
||||
@@ -714,6 +715,8 @@ bool Start(const char* stdlib_path, std::string* error)
|
||||
});
|
||||
#endif
|
||||
|
||||
// 40250 WinMain (UserInterface.cpp:524): ApplicationStringTable_Initialize(hInstance) before locale.cfg.
|
||||
ApplicationStringTable_Initialize(NULL);
|
||||
// 40250 Main (UserInterface.cpp:410): if (LocaleService_LoadGlobal(hInstance)) SetDefaultCodePage(...).
|
||||
std::string locale_config = "locale.cfg";
|
||||
if (const char* client = std::getenv("MT_40250_CLIENT"))
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "MilesLib/SoundData.h"
|
||||
#include "UserInterface.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
@@ -26,6 +27,15 @@
|
||||
// 40250 UserInterface.cpp:49.
|
||||
bool __IS_TEST_SERVER_MODE__=false;
|
||||
|
||||
// 40250 UserInterface.cpp:73. WinMain shows the text in a message box after Main returns; here it stays readable
|
||||
// for the host.
|
||||
char gs_szErrorString[512] = "";
|
||||
|
||||
void ApplicationSetErrorString(const char* szErrorString)
|
||||
{
|
||||
strcpy(gs_szErrorString, szErrorString);
|
||||
}
|
||||
|
||||
// 40250 UserInterface.cpp:98. PORT: LoadString reads the executable's STRINGTABLE; the one the supplied English
|
||||
// client resolves is UserInterface.rc's LANG_ENGLISH, SUBLANG_ENGLISH_US section (ids from resource.h).
|
||||
namespace
|
||||
@@ -45,12 +55,22 @@ const char* LoadAppString(DWORD dwID)
|
||||
return "";
|
||||
}
|
||||
|
||||
std::map<DWORD, std::string> gs_kMap_dwID_stLocale;
|
||||
} // namespace
|
||||
|
||||
struct ApplicationStringTable
|
||||
{
|
||||
HINSTANCE m_hInstance;
|
||||
std::map<DWORD, std::string> m_kMap_dwID_stLocale;
|
||||
} gs_kAppStrTable;
|
||||
|
||||
void ApplicationStringTable_Initialize(HINSTANCE hInstance)
|
||||
{
|
||||
gs_kAppStrTable.m_hInstance=hInstance;
|
||||
}
|
||||
|
||||
const std::string& ApplicationStringTable_GetString(DWORD dwID)
|
||||
{
|
||||
std::string& rstLocale=gs_kMap_dwID_stLocale[dwID];
|
||||
std::string& rstLocale=gs_kAppStrTable.m_kMap_dwID_stLocale[dwID];
|
||||
rstLocale=LoadAppString(dwID);
|
||||
|
||||
return rstLocale;
|
||||
|
||||
@@ -10,3 +10,10 @@ bool PackInitialize(const char * c_pszFolder);
|
||||
// The two function-static singletons 40250 Main() creates before PackInitialize("pack")
|
||||
// (`static CLZO lzo; static CEterPackManager EterPackManager;`), created on first use and alive until exit.
|
||||
void PackSingletons();
|
||||
|
||||
// 40250: ApplicationStringTable_Initialize (WinMain, before LocaleService_LoadConfig). LoadString has no module
|
||||
// here, so the handle is only stored.
|
||||
void ApplicationStringTable_Initialize(HINSTANCE hInstance);
|
||||
|
||||
// gs_szErrorString (40250 UserInterface.cpp:73), set by ApplicationSetErrorString (UserInterface/StdAfx.h); WinMain shows it after Main.
|
||||
extern char gs_szErrorString[512];
|
||||
|
||||
Reference in New Issue
Block a user