移植 UserInterface/RunMainScript 到 platform/ScriptLib/PythonBoot:40250 把
CPythonLauncher 放在 Main() 的栈上,这里进程归 Godot,launcher 必须活过创建它的
那次调用,所以拆成 Start / RunMainScript / RunLine / Stop。37 个模块初始化函数里
只调已移植的 initpack(),system.py 因此仍停在第一个 import。
脚本报错能传回 GDScript,靠的是 platform/EterBase/Debug.cpp 实现 LogBox/LogBoxf:
ScriptLib 的 Traceback() 在 PyErr_Fetch 之后只剩这一条路,LastLogBoxMessage()
(platform/EterBase/LogBox.h)是 traceback 唯一幸存的地方。
GDScript 侧新增 Metin2PythonHost(python_host_node.{h,cpp})——唯一同时认识
godot-cpp 和 port 树的单元,PythonBoot 保持 godot-free。检查脚本
python_host_check.gd 分两段:解释器 + 标准库那段不需要 40250 的 pack,哪个平台都
能跑;system.py 那段需要 pack,没有就跳过。桌面入口 python_host_test.gd,真机入口
MT_TEST_MODE=python(导出模板不接受 --script)。
验证(macOS):标准库可 import、codec 注册表可用、sys.path 非空,system.py 停在和
ctest port.python_launcher 完全相同的 ImportError: No module named app;
ctest 27/27。Android/iOS 进程内未做,正式启动路径仍不起解释器(2V0)。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
79 lines
2.8 KiB
JSON
79 lines
2.8 KiB
JSON
{
|
|
"reference": "UserInterface/UserInterface.cpp",
|
|
"reference_sha256": "beed987e4b1de627acafe7ea6f5fde989b8f4b33c8643fe2abb0f7152ea4a9eb",
|
|
"priority": "P4",
|
|
"contracts": [],
|
|
"functions": {
|
|
"ApplicationSetErrorString": {
|
|
"status": "TODO"
|
|
},
|
|
"CheckPythonLibraryFilenames": {
|
|
"status": "TODO"
|
|
},
|
|
"ApplicationStringTable_Initialize": {
|
|
"status": "TODO"
|
|
},
|
|
"ApplicationStringTable_GetString": {
|
|
"status": "TODO"
|
|
},
|
|
"ApplicationStringTable_GetStringz": {
|
|
"status": "TODO"
|
|
},
|
|
"PackInitialize": {
|
|
"impl": [
|
|
"extension/src/platform/UserInterface/UserInterface.cpp:PackInitialize"
|
|
],
|
|
"status": "ADAPTED",
|
|
"note": "platform PackInitialize: Index pack names resolved to the on-disk .eix spelling case-insensitively; no LogBoxf; CTextFileLoader::SetCacheMode / CSoundData::SetPackMode not called (units not ported, neither affects pack registration)",
|
|
"test": "extension/tests/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects); extension/tests/proto_test.cpp (40250 locale/en item_proto/mob_proto through pack://)"
|
|
},
|
|
"RunMainScript": {
|
|
"impl": [
|
|
"extension/src/platform/ScriptLib/PythonBoot.cpp:PythonBoot::RunMainScript"
|
|
],
|
|
"status": "ADAPTED",
|
|
"note": "40250 runs it on Main()'s stack and takes the CPythonLauncher by reference; Godot owns this process, so PythonBoot::Start holds the launcher and RunMainScript takes only the command line plus a std::string* for the text 40250 shows in LogBox's message box. Of the 37 module initializers only initpack() is called — the rest are 2V slices, which is why system.py still stops at its first import. RegisterCommandLine passes the line through unchanged: the -cs/-ncs auto-login decoding needs EterBase/Utils.cpp SplitLine and EterLib/Util.cpp base64_decode, both still TODO (批次 2V1). '--pause-before-create-window' (system(\"pause\")) and the XTrap init check are dropped: no console and no XTrap on this platform.",
|
|
"test": "project/python_host_test.gd (godot --headless --path project --script python_host_test.gd) and the same check through MT_TEST_MODE=python in project/client_main.gd -> system.py stops at ImportError: No module named app, the same point as ctest port.python_launcher"
|
|
},
|
|
"Main": {
|
|
"status": "TODO"
|
|
},
|
|
"CreateMetin2GameMutex": {
|
|
"status": "TODO"
|
|
},
|
|
"DestroyMetin2GameMutex": {
|
|
"status": "TODO"
|
|
},
|
|
"__ErrorPythonLibraryIsNotExist": {
|
|
"status": "TODO"
|
|
},
|
|
"__IsTimeStampOption": {
|
|
"status": "TODO"
|
|
},
|
|
"__PrintTimeStamp": {
|
|
"status": "TODO"
|
|
},
|
|
"__IsLocaleOption": {
|
|
"status": "TODO"
|
|
},
|
|
"__IsLocaleVersion": {
|
|
"status": "TODO"
|
|
},
|
|
"__IsOpenIDAuthKeyOption": {
|
|
"status": "TODO"
|
|
},
|
|
"__IsOpenIDTestOption": {
|
|
"status": "TODO"
|
|
},
|
|
"WinMain": {
|
|
"status": "TODO"
|
|
},
|
|
"GrannyError": {
|
|
"status": "TODO"
|
|
},
|
|
"Setup": {
|
|
"status": "TODO"
|
|
}
|
|
}
|
|
}
|