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
+21 -7
View File
@@ -6,6 +6,7 @@
# 表的条数会写进替身(数组大小):条数随游戏版本固定,不是游戏内容。
# 用法:shell_stubs.py data <dm 目录> <输出 derived.tsv> 读真实的三份生成文件,写数据(d2rm_pack.py 与 shell_build.sh 都用)
# shell_stubs.py stubs <dm 目录> 把三份生成文件原地换成替身(只在 shell_build.sh 的临时副本里做)
# shell_stubs.py host-stubs <dm 目录> <derived.tsv> 只写宿主的两份替身(经验 / 仓库),条数取自 derived.tsv(Android 无界面宿主,不需要 RomFS)
# For the shell: split the three files "generated from the game files and compiled into the code" into two halves --
# data → one derived.tsv (generated from the user's own game files, placed in dm/ of the install package)
# stubs → three source files of the same names, with no data inside, only fixed-size empty tables and the few lines that fill the tables from derived.tsv at startup (host/dm_derived_rt.h)
@@ -13,6 +14,7 @@
# The entry counts of the tables are written into the stubs (array sizes): the counts are fixed by the game version and are not game content.
# Usage: shell_stubs.py data <dm directory> <output derived.tsv> read the three real generated files and write the data (used by both d2rm_pack.py and shell_build.sh)
# shell_stubs.py stubs <dm directory> replace the three generated files in place with stubs (done only in shell_build.sh's temporary copy)
# shell_stubs.py host-stubs <dm directory> <derived.tsv> write only the host's two stubs (experience / vault), counts taken from derived.tsv (Android headless host, no RomFS)
import os, re, sys
CSTR = r'"((?:[^"\\]|\\.)*)"'
@@ -22,7 +24,7 @@ def unq(s): return bytes(s, 'utf-8').decode('unicode_escape').encode('latin-1').
def paths(dm):
return (os.path.join(dm, 'host', 'dm_hud_exp.h'), os.path.join(dm, 'host', 'dm_vault_tab.h'), os.path.join(dm, 'ios', 'Sources', 'dm_touch_native_art.c'))
return (os.path.join(dm, 'host', 'dm_hud_exp.h'), os.path.join(dm, 'host', 'dm_vault_tab.h'), os.path.join(dm, 'touch', 'dm_touch_native_art.c'))
def parse(dm):
@@ -52,9 +54,8 @@ def data(dm, dst):
return len(exp), len(parts), len(rows), len(sets), len(trows)
def stubs(dm):
exp, parts, rows, sets, trows, (hud, vault, art, m) = parse(dm)
p_hud, p_vault, p_art = paths(dm)
def host_stubs(dm, nparts, nrows, nsets):
p_hud, p_vault, _ = paths(dm)
open(p_hud, 'w', encoding='utf-8').write('''// 壳的替身(ios/tools/shell_stubs.py 生成):经验表不编进代码,启动时从安装包的 dm/derived.tsv 读(标签 EXP,每行 10 个)
#pragma once
#include <stdint.h>
@@ -82,14 +83,20 @@ __attribute__((constructor)) static void vt_load(void) { int a = 0, b = 0, c = 0
for (int i = a; i < VT_NPART; i++) vt_part_name[i] = ""; for (int i = c; i < VT_NSET; i++) vt_set_key[i] = "";
for (int i = b; i < VT_NROW; i++) vt_rows[i] = (vt_row){ .set = -1, .key = "", .icon = "" };
if (a != VT_NPART || b != VT_NROW || c != VT_NSET) fprintf(stderr, "[dm] 【红】编年史仓库表没读全:部位 %%d / %%d、条目 %%d / %%d、套装 %%d / %%d\\n", a, VT_NPART, b, VT_NROW, c, VT_NSET); }
''' % (len(parts), len(rows), len(sets)))
''' % (nparts, nrows, nsets))
def stubs(dm):
exp, parts, rows, sets, trows, (hud, vault, art, m) = parse(dm)
p_hud, p_vault, p_art = paths(dm)
host_stubs(dm, len(parts), len(rows), len(sets))
stub = art[:m.start()] + '''static struct { uint32_t id; int atlas,frame; } rows[%d]; /* 壳的替身:技能索引不编进代码,启动时从安装包的 dm/derived.tsv 读(标签 TAROW) */
static void ta_row_cb(char **f, int n, void *ctx) { int *i = ctx; if (n < 3 || *i >= (int)(sizeof rows / sizeof rows[0])) return;
rows[*i].id = (uint32_t)strtoul(f[0], NULL, 10); rows[*i].atlas = atoi(f[1]); rows[*i].frame = atoi(f[2]); (*i)++; }
__attribute__((constructor)) static void ta_load(void) { int i = 0; dm_derived_each("TAROW", ta_row_cb, &i);
for (int k = i; k < (int)(sizeof rows / sizeof rows[0]); k++) { rows[k].id = UINT32_MAX - 1; rows[k].atlas = rows[k].frame = -1; }
if (i != (int)(sizeof rows / sizeof rows[0])) fprintf(stderr, "[dm] 【红】技能图标索引没读全:%%d / %%d\\n", i, (int)(sizeof rows / sizeof rows[0])); }''' % len(trows) + art[m.end():]
stub = stub.replace('#include <stddef.h>', '#include <stddef.h>\n#include "../../host/dm_derived_rt.h"', 1); assert 'dm_derived_rt.h' in stub
stub = stub.replace('#include <stddef.h>', '#include <stddef.h>\n#include "../host/dm_derived_rt.h"', 1); assert 'dm_derived_rt.h' in stub
open(p_art, 'w', encoding='utf-8').write(stub)
return len(parts), len(rows), len(sets), len(trows)
@@ -97,4 +104,11 @@ __attribute__((constructor)) static void ta_load(void) { int i = 0; dm_derived_e
if __name__ == '__main__':
if len(sys.argv) == 4 and sys.argv[1] == 'data': print('derived.tsv:经验 %d、部位 %d、仓库条目 %d、套装 %d、技能索引 %d' % data(sys.argv[2], sys.argv[3]))
elif len(sys.argv) == 3 and sys.argv[1] == 'stubs': print('替身已写:部位 %d、仓库条目 %d、套装 %d、技能索引 %d' % stubs(sys.argv[2]))
else: sys.exit('用法:shell_stubs.py data <dm 目录> <输出 derived.tsv> | shell_stubs.py stubs <dm 目录>')
elif len(sys.argv) == 4 and sys.argv[1] == 'host-stubs':
# 只写宿主用的两份替身(经验表、编年史仓库表),条数取自现成的 derived.tsv(如安装包里的 dm/derived.tsv):没有原版 RomFS 也能编宿主(Android 无界面宿主)
# Write only the two stubs the host uses (experience table, chronicle vault table), with counts taken from an existing derived.tsv (e.g. dm/derived.tsv in an install package): the host builds without the original RomFS (Android headless host)
tags = [l.split('\t', 1)[0] for l in open(sys.argv[3], encoding='utf-8')]
assert tags.count('EXP') == 10, '经验表应是 10 行'
n = tags.count('VTPART'), tags.count('VTROW'), tags.count('VTSET'); assert all(n), n
host_stubs(sys.argv[2], *n); print('宿主替身已写:部位 %d、仓库条目 %d、套装 %d' % n)
else: sys.exit('用法:shell_stubs.py data <dm 目录> <输出 derived.tsv> | shell_stubs.py stubs <dm 目录> | shell_stubs.py host-stubs <dm 目录> <derived.tsv>')