Android device verification: forced landscape, fullscreen, data layering

- Ava2Activity passes the "args" intent extra as the command line
  (build.sh forwards AVA2_ARGS); it also always requests sensor landscape.
- app_loop sets SDL_HINT_ORIENTATIONS to landscape and creates the window
  fullscreen on Android/iOS (SDL requested FULL_USER for the resizable
  window, overriding the manifest; the status bar drew over the HUD).
- push_assets.py: pack-manifest test-rundir now wins over assets/loose
  (~1000 differing files; half-size tree atlases broke SpeedTree UVs),
  pushes in batches of <=20k files, and chmods shell-owned files so the
  app can read them on Android 17.
- PORT-PLAN: device verification results and outstanding gaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-13 10:53:56 +09:00
co-authored by Claude Opus 5.5
parent 6244b1d860
commit 8f96e7a143
9 changed files with 153 additions and 17 deletions
+46 -10
View File
@@ -4,8 +4,11 @@
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
0. assets/loose the client-root asset tree
1. build/dev/test-rundir the pack-manifest client root (tools/make_test_rundir.py): what
the original client serves from its packs, so it wins over the
~1000 older models/textures assets/loose holds (zone/b tree
atlases at half size broke the SpeedTree UVs on the phone)
2. upstream/python-root scripts; win over same-named asset files (case-insensitive)
3. <pack_maker>/../svside loose client-root folder that is in no pack
4. python27.zip the embedded interpreter's stdlib
@@ -110,6 +113,23 @@ def walk(top, pack_maker, missing):
yield child, path
PUSH_BATCH = 20000
def count_files(path):
return sum(len(files) for _, _, files in os.walk(path))
def push_batches(stage, rel):
"""Yields stage-relative paths (directories or files) of at most PUSH_BATCH files each."""
path = stage / rel
if not path.is_dir() or count_files(path) <= PUSH_BATCH:
yield rel
return
for entry in sorted(path.iterdir()):
yield from push_batches(stage, rel / entry.name)
def adb(serial, *args, **kwargs):
command = ["adb"] + (["-s", serial] if serial else []) + list(args)
return subprocess.run(command, check=True, **kwargs)
@@ -136,9 +156,11 @@ def main():
shutil.rmtree(args.stage)
args.stage.mkdir(parents=True)
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.
for rel, path in walk(ROOT / "assets/loose", args.pack_maker, missing):
stage.add(rel, path)
# The pack-manifest client root the desktop tests run against, over assets/loose: assets/loose
# alone lacks the pack files (Dopador_manual/*, the switcher art...) game.py needs, and where
# both have a file the pack version is the one the original client loads.
if args.rundir.is_dir():
for rel, path in walk(args.rundir, args.pack_maker, missing):
if rel.name != RUNDIR_MARKER:
@@ -146,9 +168,8 @@ def main():
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)
for rel, path in walk(ROOT / "upstream/python-root", 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:
@@ -167,8 +188,23 @@ def main():
return
adb(args.serial, "shell", "mkdir", "-p", DEVICE_DIR)
# Trailing "/." pushes the directory's contents rather than the directory itself.
adb(args.serial, "push", "--sync", f"{args.stage}/.", DEVICE_DIR)
# One `adb push --sync` over all ~98k files aborts in file_sync_client ("protocol fault: failed
# to read stat response"), so push in batches of at most PUSH_BATCH files.
for rel in push_batches(args.stage, Path()):
source, target = args.stage / rel, f"{DEVICE_DIR}/{rel.as_posix()}" if rel.parts else DEVICE_DIR
if source.is_dir():
adb(args.serial, "shell", "mkdir", "-p", f"'{target}'")
# Trailing "/." pushes the directory's contents rather than the directory itself.
adb(args.serial, "push", "--sync", f"{source}/.", target)
else:
adb(args.serial, "push", "--sync", str(source), target)
# Recent Android versions (seen on Android 17) leave what adb creates under Android/data owned
# by `shell` with 2770 directories, which the app's uid cannot enter ("Permission denied" on
# the first model load). Open up what adb created; files the app wrote itself (channel.inf,
# the cfg files) and the files directory belong to the app and cannot be chmodded by shell.
adb(args.serial, "shell",
f"find '{DEVICE_DIR}' -mindepth 1 -user shell -type d ! -perm -005 -exec chmod 2777 {{}} + ; "
f"find '{DEVICE_DIR}' -user shell -type f ! -perm -004 -exec chmod 666 {{}} +")
print(f"pushed to {DEVICE_DIR}")