port 2D step 2: 40250 item_proto/mob_proto through CLZO and pack://locale/<lang>/

proto.cpp reads the 40250 MIPX/MMPT tables with the ported CLZO/TEA (156-byte
TItemTable, 255-byte SMobTable), replacing the m2dev XChaCha20 236/335 reader.
Names follow CItemData::GetName / GetMonsterName (szLocaleName, cp1252).
GDScript callers load AssetRoot.locale_file() = pack://locale/en/<name>, which
makes the EterPack chain runtime-reachable; port-map entries for the functions
a coverage run hit move to PORTED/ADAPTED.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-23 01:34:08 +09:00
co-authored by Claude Opus 5
parent 5a26e93f07
commit 232d0461be
28 changed files with 1367 additions and 332 deletions
+25
View File
@@ -45,3 +45,28 @@ static func sub(rel: String) -> String:
# 资源目录是否真的存在(缺资源的测试据此跳过)。
static func available() -> bool:
return DirAccess.dir_exists_absolute(path())
# --- 40250 client (pack/Index + .eix/.epk), docs/PORT-PLAN.md 2R item 6 / 2D ---
# 解析顺序:环境变量 MT_40250_CLIENT;开发树 res://../../40250/Server Client TMP4/Client。
static func client_path() -> String:
var env := OS.get_environment("MT_40250_CLIENT")
if env != "":
return env
return ProjectSettings.globalize_path("res://../../40250/Server Client TMP4/Client").simplify_path()
# 按 40250 PackInitialize("pack") 注册 <client>/pack;只注册一次,之后返回首次结果。
static func pack_ready() -> bool:
if not ClassDB.class_exists("Metin2Pack"):
return false
return bool(ClassDB.class_call_static("Metin2Pack", "initialize", client_path()))
# 40250 的 locale 文件(CPythonApplication::Create: "%s/item_proto" % LocalePath,LocalePath = "locale/<lang>"),
# 走 pack://;该语言没有时回退 en。pack 没就绪返回 ""。
static func locale_file(name: String, lang: String = "en") -> String:
if not pack_ready():
return ""
for l in [lang, "en"]:
var p := "pack://locale/%s/%s" % [l, name]
if bool(ClassDB.class_call_static("Metin2Pack", "exists", "locale/%s/%s" % [l, name])):
return p
return ""