Android port (Adreno): Vulkan backend, GameActivity app, touch HUD, lifecycle, minimap quest goals

- host/android: Vulkan replay backend (nvn_vk.c) with pipeline/descriptor caching, ADPF,
  AChoreographer present link; Linux compat layer; Makefile.android (headless dmhost + APK lib)
- android/app: GameActivity shell without Gradle (build_apk.sh), AAudio output, touch HUD port
  (touch_app.c + TouchOverlay.java, three layers: body / joystick / minimap goals),
  lifecycle save-on-background like iOS, art_from_ipa.py for touch / HUD / mapgoal art
- touch: shared touch controls moved from ios/Sources to dm/touch
- patch_nso.py Android ruleset, dmsh_vk.py shader pack, DM_TOUCH_PRODUCT defaults
- hle_audio: AAudio resume waits through STARTING and reopens once on failure
- .gitignore: local resources/ (original game data) never committed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-14 14:55:05 +09:00
co-authored by Claude Opus 5.5
parent 5bc5a01087
commit 4d91f80bae
106 changed files with 7009 additions and 181 deletions
+9 -2
View File
@@ -34,6 +34,7 @@ IB = 0x100000000
ARENA, ARENA_SZ = 0x10000000, 0x1000000 # 随机堆:一半的 8 字节字是指回堆内的指针 | Random heap: half of the 8-byte words are pointers back into the heap
STK, STK_SZ = 0x20000000, 0x100000; SP0 = STK + STK_SZ - 0x10000 # sp 以上留 64 KB 给栈传参 | 64 KB kept above sp for stack-passed arguments
TSD = 0x30000000
TPA = TSD + 0x8000 # linux-bionic:模拟 Bionic 线程指针区,[TPA + TP_SLOT_OFF] = TSD | linux-bionic: emulated Bionic thread pointer area, [TPA + TP_SLOT_OFF] = TSD
TRAP = 0x300000000; RET = 0x400000000; GATE = 0x500000000
hdr = nsoimg.header(A.dir, A.mod)
PO, TE = hdr['PATCH_OFF'], hdr['TEXT_END']
@@ -73,8 +74,11 @@ def btarget(b, o):
return o + 4 * imm
def plain_subst(a):
s = btarget(pat, a)
ins = list(md.disasm(bytes(pat[s:s + 24]), s))
if len(ins) < 5 or ins[0].mnemonic != 'stp' or ins[1].mnemonic != 'mrs' or 'tpidrro_el0' not in ins[1].op_str: return None
ins = list(md.disasm(bytes(pat[s:s + 28]), s))
sb = nsoimg.slot_base(ins, 1, hdr)
if not ins or ins[0].mnemonic != 'stp' or not sb: return None
ins = ins[:1] + ins[sb[1]:] # 基址前缀折成一条 | Fold the base prefix into one
if len(ins) < 5: return None
if ins[2].mnemonic != 'adrp' or ins[2].operands[1].imm != KEY_PAGE_OFF: return None
if ins[3].mnemonic != 'ldr' or ins[3].operands[1].mem.base != ins[2].operands[0].reg: return None
if ins[4].mnemonic != 'add' or ins[4].operands[0].reg != ins[1].operands[0].reg or ins[4].operands[1].reg != ins[1].operands[0].reg: return None
@@ -142,6 +146,9 @@ class Emu:
u.mem_write(IB + KEY_PAGE_OFF + 8 * idx, struct.pack('<Q', KEY_SLOT[key] * 8))
for k, v in ((K18, init['g'][18]), (KTLS, init['tls']), (KTLR, init['tlr']), (KGATE, GATE)): u.mem_write(TSD + 8 * k, struct.pack('<Q', v))
u.reg_write(UC_ARM64_REG_X18, 0xDEADBEEFDEADBEEF); u.reg_write(UC_ARM64_REG_TPIDR_EL0, 0)
if hdr['ABI'] != 'apple':
u.reg_write(UC_ARM64_REG_TPIDRRO_EL0, 0)
u.reg_write(UC_ARM64_REG_TPIDR_EL0, TPA); u.mem_write(TPA + hdr['TP_SLOT_OFF'], struct.pack('<Q', TSD))
else:
u.reg_write(UC_ARM64_REG_TPIDRRO_EL0, init['tlr']); u.reg_write(UC_ARM64_REG_TPIDR_EL0, init['tls'])
try: u.emu_start(IB + fn, 0, count=budget)