Register observable 2V0 gameplay stubs through RunApp

This commit is contained in:
shen
2026-09-22 20:05:22 -07:00
parent b221a9eaf5
commit 9c30f06083
8 changed files with 2014 additions and 14 deletions
File diff suppressed because one or more lines are too long
@@ -24,6 +24,8 @@ bool fail(std::string* error, const std::string& text)
}
}
void init_2v0_gameplay_stubs();
namespace PythonBoot
{
@@ -77,6 +79,7 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
initgrpText();
initwndMgr();
initapp();
init_2v0_gameplay_stubs();
ClearLogBoxMessage();
@@ -26,8 +26,8 @@ bool Start(const char* stdlib_path, std::string* error);
bool IsRunning();
// 40250: RunMainScript(CPythonLauncher&, const char*) — the module initializers, __DEBUG__,
// __COMMAND_LINE__ and RunFile("system.py"). Only the initializers that are ported are called; the rest
// arrive with the 2V slices, which is why system.py still stops at its first import.
// __COMMAND_LINE__ and RunFile("system.py"). 2V0-e registers temporary observable gameplay modules;
// they are replaced by the real modules in later 2V slices.
// False leaves *error set to what the launcher reported through LogBox (platform/EterBase/LogBox.h).
bool RunMainScript(const char* lpCmdLine, std::string* error);
@@ -18,7 +18,13 @@ void CPythonApplication::Exit() { MT_PLATFORM_STUB(); }
void CPythonApplication::Abort() { MT_PLATFORM_STUB(); }
void CPythonApplication::SetMinFog(float) { MT_PLATFORM_STUB(); }
void CPythonApplication::SetFrameSkip(bool) { MT_PLATFORM_STUB(); }
bool CPythonApplication::Create(PyObject*, const char*, int, int, int) { MT_PLATFORM_STUB(); return false; }
bool CPythonApplication::Create(PyObject*, const char*, int, int, int) {
MT_PLATFORM_STUB();
// appCreate returns NULL on failure. Give Python the exception that
// prototype.RunApp expects rather than a SystemError with no exception set.
PyErr_SetString(PyExc_RuntimeError, "CREATE_DEVICE");
return false;
}
void CPythonApplication::UpdateGame() { MT_PLATFORM_STUB(); }
void CPythonApplication::RenderGame() { MT_PLATFORM_STUB(); }
bool CPythonApplication::Process() { MT_PLATFORM_STUB(); return false; }
@@ -79,10 +85,19 @@ bool LoadLocaleData(const char*) { MT_PLATFORM_STUB(); return false; }
void SetGuildSymbolPath(const char*) { MT_PLATFORM_STUB(); }
void DefaultFont_SetName(const char*) { MT_PLATFORM_STUB(); }
void TextTail_SetLivingTime(long) { MT_PLATFORM_STUB(); }
const char* LocaleService_GetName() { MT_PLATFORM_STUB(); return ""; }
namespace {
// The supplied 40250 Client/locale.cfg selects "en" (code page 1252).
// Keep these mutable for app.ForceSetLocale, as Locale.cpp does.
std::string locale_name = "en";
std::string locale_path = "locale/en";
}
const char* LocaleService_GetName() { return "EUROPE"; }
bool LocaleService_IsCHEONMA() { MT_PLATFORM_STUB(); return false; }
void LocaleService_SetCHEONMA(bool) { MT_PLATFORM_STUB(); }
unsigned LocaleService_GetCodePage() { MT_PLATFORM_STUB(); return 0; }
const char* LocaleService_GetLocaleName() { MT_PLATFORM_STUB(); return ""; }
const char* LocaleService_GetLocalePath() { MT_PLATFORM_STUB(); return ""; }
void LocaleService_ForceSetLocale(const char*, const char*) { MT_PLATFORM_STUB(); }
unsigned LocaleService_GetCodePage() { return 1252; }
const char* LocaleService_GetLocaleName() { return locale_name.c_str(); }
const char* LocaleService_GetLocalePath() { return locale_path.c_str(); }
void LocaleService_ForceSetLocale(const char* name, const char* path) {
locale_name = name ? name : "";
locale_path = path ? path : "";
}
+2 -2
View File
@@ -6,8 +6,8 @@
// var err := Metin2PythonHost.run_main_script("")
//
// Both calls answer with "" on success and with the reason otherwise, so GDScript never has to guess
// from a bool. Until 批次 2V0 registers the C++ modules, run_main_script() is expected to come back with
// system.py's first import error; that is what step 4 verifies on each target platform.
// from a bool. 2V0-e reaches prototype.RunApp(); until 2V0-f implements the application adapter,
// app.Create reports CREATE_DEVICE and the original script displays its error popup.
//
// This is the only unit that knows both godot-cpp and the port tree: the sequence itself lives in
// platform/ScriptLib/PythonBoot.h, which stays godot-free.