Files
mtgodot-poc/android/push-client.sh
T
shenleiandClaude Opus 5.5 a46093104c layout: restructure into src/ tests/ android/ scripts/ tools/
- extension/src/{port,platform,codepage} -> src/; native_render -> src/host
  (+ dxt, shaders/); libgr2 -> src/gr2; extension/third_party -> third_party
- extension/tests -> tests/port, libgr2/tests -> tests/gr2
- android-native -> android (build.sh, push-client.sh moved in)
- script -> scripts; tools/40250 -> tools/server; oracle -> tools/granny-oracle;
  perf tools -> tools/perf
- all build trees under build/ (native, release, android, port-gate)
- xrender:: CMake aliases -> mt::; port-map ledger impl paths rewritten

No code changes. ctest 15/15, port_gate macos+android PASS, port_map check 0 errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 19:08:19 +09:00

40 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copy the 40250 Client/ directory into the Android app's private files/ (SDL_GetPrefPath), where
# src/host looks for files/Client/pack/Index. Needs the debug APK installed (run-as).
# ./android/push-client.sh [--locale XX] [CLIENT_DIR]
# --locale XX writes the pushed locale.cfg from CLIENT_DIR/locale_XX.cfg. --locale zh defaults
# CLIENT_DIR to build/zh-locale/Client (scripts/build_zh_locale.py), whose pack/ registers locale_zh.
# Symbolic links in CLIENT_DIR (the zh client links the original packs) are copied as their targets.
set -euo pipefail
cd "$(dirname "$0")/.."
PKG=org.metin2port.client
LOCALE=""
if [ "${1:-}" = "--locale" ]; then
LOCALE="${2:?--locale needs a locale code}"
shift 2
fi
if [ "$LOCALE" = zh ]; then
CLIENT="${1:-build/zh-locale/Client}"
else
CLIENT="${1:-Client}"
fi
[ -f "$CLIENT/pack/Index" ] || { echo "$CLIENT/pack/Index not found" >&2; exit 1; }
# The archive's top directory is basename(CLIENT DIR); the app reads files/Client.
[ "$(basename "$CLIENT")" = Client ] || { echo "CLIENT_DIR must be named Client" >&2; exit 1; }
if [ -n "$LOCALE" ]; then
[ -f "$CLIENT/locale_$LOCALE.cfg" ] || { echo "$CLIENT/locale_$LOCALE.cfg not found" >&2; exit 1; }
pack="$(cut -d' ' -f3 < "$CLIENT/locale_$LOCALE.cfg" | tr -d '\r\n')"
tr -d '\r' < "$CLIENT/pack/Index" | grep -qxF "locale_$pack" ||
{ echo "locale_$pack is not registered in $CLIENT/pack/Index" >&2; exit 1; }
fi
TMP=/data/local/tmp/mt-client.tar
echo "packing $CLIENT ..."
tar -h -C "$(dirname "$CLIENT")" -cf - "$(basename "$CLIENT")" | adb shell "cat > $TMP"
echo "unpacking into $PKG files/ ..."
adb shell "run-as $PKG sh -c 'mkdir -p files && rm -rf files/Client && cd files && tar -xf $TMP' && rm -f $TMP"
if [ -n "$LOCALE" ]; then
adb shell "run-as $PKG sh -c 'cp files/Client/locale_$LOCALE.cfg files/Client/locale.cfg'"
echo "locale.cfg: $(adb shell "run-as $PKG cat files/Client/locale.cfg")"
fi
adb shell "run-as $PKG ls files/Client/pack/Index" >/dev/null && echo "done: files/Client"