Mobile step 7b: iOS packaging (simulator verified to the game scene)
- ios/build.sh builds static SDL3 + FreeType, then the .app (code only, embedded Python); signs ad hoc and runs on a simulator, or signs with a development profile and installs with devicectl (device path untested). Simulator-only SDL patch: accept the simulator Metal device for SDL_GPU. - ios/Info.plist.in: landscape, full screen, launch screen, file sharing. - Data dir is Documents on iOS; ios/push_assets.py stages the client root lower-cased (iOS is case-sensitive, the client opens lower-cased paths) and copies it into the app container. - EffectData path normalisation folds A-Z like the effect cache key. - android/push_assets.py: test-rundir base layer + svside/, which the game phase needs (also fixes Android); --lowercase (ASCII only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f973b24abc
commit
908838c8f9
+45
-6
@@ -4,13 +4,17 @@
|
||||
The APK holds code only; on Android the client runs in its external files directory
|
||||
(/sdcard/Android/data/com.metin2.ava2/files) and reads the flattened client root from there:
|
||||
|
||||
0. build/dev/test-rundir the pack-manifest client root (tools/make_test_rundir.py)
|
||||
1. assets/loose the client-root asset tree
|
||||
2. upstream/python-root scripts; win over same-named asset files (case-insensitive)
|
||||
3. python27.zip the embedded interpreter's stdlib
|
||||
3. <pack_maker>/../svside loose client-root folder that is in no pack
|
||||
4. python27.zip the embedded interpreter's stdlib
|
||||
|
||||
Later layers replace earlier files with the same (case-insensitive) path.
|
||||
|
||||
The merged tree is staged as hard links (no copy) in build/android-data/root, then sent with
|
||||
`adb push --sync`, which skips files the device already has with the same timestamp, so later
|
||||
runs only transfer what changed. The first run moves about 2.8 GB.
|
||||
runs only transfer what changed. The first run moves about 4 GB.
|
||||
|
||||
assets/loose keeps a few symlinks into the decoded pack_maker tree of the machine it was
|
||||
committed on; they are remapped to --pack-maker (default ../AVA2/TEST/1. Client DEV/pack_maker).
|
||||
@@ -30,6 +34,8 @@ ROOT = Path(__file__).resolve().parent.parent
|
||||
PACKAGE = "com.metin2.ava2"
|
||||
DEVICE_DIR = f"/sdcard/Android/data/{PACKAGE}/files"
|
||||
PACK_MAKER_MARK = "/pack_maker/"
|
||||
LOOSE_DIRS = ["svside"]
|
||||
RUNDIR_MARKER = ".ava2_test_rundir"
|
||||
|
||||
|
||||
def find_stdlib():
|
||||
@@ -39,11 +45,21 @@ def find_stdlib():
|
||||
return max(candidates, key=os.path.getmtime) if candidates else None
|
||||
|
||||
|
||||
def ascii_lower(name):
|
||||
"""Lower-cases A-Z only, like the client's ResourceManager::NormalizePath; legacy CP949 names
|
||||
(stored as Latin-1 code points) must keep their bytes."""
|
||||
return name.translate(ASCII_LOWER)
|
||||
|
||||
|
||||
ASCII_LOWER = str.maketrans("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")
|
||||
|
||||
|
||||
class Stage:
|
||||
"""Hard-link tree; a later source replaces an earlier file with the same lower-case path."""
|
||||
|
||||
def __init__(self, out):
|
||||
def __init__(self, out, lowercase=False):
|
||||
self.out = out
|
||||
self.lowercase = lowercase # stage every name lower-case (case-sensitive targets, iOS)
|
||||
self.files = {} # lower-case relative path -> staged path
|
||||
self.dirs = {"": out}
|
||||
|
||||
@@ -53,7 +69,7 @@ class Stage:
|
||||
parent = self.dirs[key]
|
||||
key = f"{key}/{part.lower()}" if key else part.lower()
|
||||
if key not in self.dirs:
|
||||
self.dirs[key] = parent / part
|
||||
self.dirs[key] = parent / (ascii_lower(part) if self.lowercase else part)
|
||||
self.dirs[key].mkdir()
|
||||
return self.dirs[key]
|
||||
|
||||
@@ -62,7 +78,7 @@ class Stage:
|
||||
old = self.files.pop(key, None)
|
||||
if old is not None:
|
||||
old.unlink()
|
||||
target = self._dir(rel.parent) / rel.name
|
||||
target = self._dir(rel.parent) / (ascii_lower(rel.name) if self.lowercase else rel.name)
|
||||
try:
|
||||
os.link(source, target)
|
||||
except OSError: # another volume
|
||||
@@ -105,7 +121,11 @@ def main():
|
||||
parser.add_argument("--pack-maker", type=Path, default=ROOT.parent / "AVA2/TEST/1. Client DEV/pack_maker")
|
||||
parser.add_argument("--stdlib", help="python27.zip (default: newest Android/desktop build output)")
|
||||
parser.add_argument("--stage", type=Path, default=ROOT / "build/android-data/root")
|
||||
parser.add_argument("--rundir", type=Path, default=ROOT / "build/dev/test-rundir",
|
||||
help="pack-manifest client root (tools/make_test_rundir.py), staged underneath")
|
||||
parser.add_argument("--stage-only", action="store_true", help="build the staging tree, do not push")
|
||||
parser.add_argument("--lowercase", action="store_true",
|
||||
help="lower-case every staged name, for case-sensitive file systems (iOS)")
|
||||
args = parser.parse_args()
|
||||
|
||||
stdlib = args.stdlib or find_stdlib()
|
||||
@@ -115,10 +135,29 @@ def main():
|
||||
if args.stage.exists():
|
||||
shutil.rmtree(args.stage)
|
||||
args.stage.mkdir(parents=True)
|
||||
stage, missing = Stage(args.stage), []
|
||||
stage, missing = Stage(args.stage, args.lowercase), []
|
||||
# Base layer: the pack-manifest client root the desktop tests run against. assets/loose alone
|
||||
# lacks the pack files (Dopador_manual/*, the switcher art...) game.py needs, and a failed window
|
||||
# load there ends the game phase.
|
||||
if args.rundir.is_dir():
|
||||
for rel, path in walk(args.rundir, args.pack_maker, missing):
|
||||
if rel.name != RUNDIR_MARKER:
|
||||
stage.add(rel, path)
|
||||
else:
|
||||
print(f"warning: {args.rundir} not found (tools/make_test_rundir.py); the game phase will miss "
|
||||
"pack files", file=sys.stderr)
|
||||
for top in (ROOT / "assets/loose", ROOT / "upstream/python-root"):
|
||||
for rel, path in walk(top, args.pack_maker, missing):
|
||||
stage.add(rel, path)
|
||||
# Loose client-root folders that are in neither assets/loose nor any pack (same as
|
||||
# tools/make_test_rundir.py); svsideoi.py, built by game.py, needs svside/*.jpg.
|
||||
for name in LOOSE_DIRS:
|
||||
top = args.pack_maker.parent / name
|
||||
if not top.is_dir():
|
||||
missing.append(f"{name} -> {top}")
|
||||
continue
|
||||
for rel, path in walk(top, args.pack_maker, missing):
|
||||
stage.add(Path(name) / rel, path)
|
||||
stage.add(Path("python27.zip"), stdlib)
|
||||
for line in missing:
|
||||
print(f"warning: unresolved symlink {line}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user