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:
co-authored by
Claude Opus 5.5
parent
5bc5a01087
commit
4d91f80bae
+13
-4
@@ -110,7 +110,16 @@ static Result mount(const char *name, const char *dir, int ro) { return mount_ex
|
||||
// APFS is case-insensitive by default, Horizon paths are case-sensitive: every component is looked up exactly by guest name.
|
||||
// Ordinary host names are unchanged; only when a name collides on the host is a separate physical name chosen, with the guest name stored in an xattr.
|
||||
// clonefile preserves xattr, so save Commit/remount needs no separate mapping table; enumeration must not leak physical aliases.
|
||||
#if defined(__APPLE__)
|
||||
#define FS_GUEST_NAME "org.d2rmobile.guest-name"
|
||||
#else
|
||||
// Linux:非特权进程只能写 user.* 命名空间;不跟随符号链接用 l* 版本,Darwin 的 position / options 参数丢弃
|
||||
// Linux: unprivileged processes may only write the user.* namespace; not following symlinks uses the l* variants, Darwin's position / options arguments are dropped
|
||||
#define FS_GUEST_NAME "user.d2rmobile.guest-name"
|
||||
#define getxattr(p, k, v, n, pos, opt) lgetxattr(p, k, v, n)
|
||||
#define setxattr(p, k, v, n, pos, opt) lsetxattr(p, k, v, n, 0)
|
||||
#define removexattr(p, k, opt) lremovexattr(p, k)
|
||||
#endif
|
||||
static int guest_name(const char *parent, const char *physical, char *out, size_t n) {
|
||||
char p[1280]; snprintf(p, sizeof p, "%s/%s", parent, physical);
|
||||
ssize_t k = getxattr(p, FS_GUEST_NAME, out, n - 1, 0, XATTR_NOFOLLOW);
|
||||
@@ -297,7 +306,7 @@ static void stash_seed_one(const char *save_dir, const char *name) {
|
||||
// 标准级与专家级各一份,各判各的(游戏按角色类型选文件名,main+0x2ce1e8:DLC 类型标准 = ModernSharedStashSoftCoreV2、专家 = ModernSharedStashHardCoreV2;文件格式相同)
|
||||
// One copy each for standard and hardcore, each judged on its own (the game picks the file name by character type, main+0x2ce1e8: DLC type standard = ModernSharedStashSoftCoreV2, hardcore = ModernSharedStashHardCoreV2; same file format)
|
||||
static void stash_seed(const char *save_dir) {
|
||||
const char *e = getenv("DM_STASH_SEED"); int on = e ? strcmp(e, "0") != 0 : TARGET_OS_IPHONE; if (!on) return; // iOS 上缺省开;Mac 宿主缺省关(对拍 / 存档事务这些闸门逐字节比存档目录,多出一个文件就红),要验时设 DM_STASH_SEED=1 | on by default on iOS; off by default on the Mac host (gate checks such as lockstep comparison / save transaction compare the save directory byte by byte, one extra file turns them red), set DM_STASH_SEED=1 to verify
|
||||
const char *e = getenv("DM_STASH_SEED"); int on = e ? strcmp(e, "0") != 0 : DM_TOUCH_PRODUCT; if (!on) return; // iOS 上缺省开;Mac 宿主缺省关(对拍 / 存档事务这些闸门逐字节比存档目录,多出一个文件就红),要验时设 DM_STASH_SEED=1 | on by default on iOS; off by default on the Mac host (gate checks such as lockstep comparison / save transaction compare the save directory byte by byte, one extra file turns them red), set DM_STASH_SEED=1 to verify
|
||||
stash_seed_one(save_dir, "ModernSharedStashSoftCoreV2"); stash_seed_one(save_dir, "ModernSharedStashHardCoreV2");
|
||||
}
|
||||
#else
|
||||
@@ -308,7 +317,7 @@ static void stash_seed(const char *save_dir) { (void)save_dir; }
|
||||
// Fallback for 「大字体」(Large Font) (settings key "Low Vision Mode"): if it is 1 in the settings file, change it back to 0. It switches the UI to the original game's low-vision layout profile, which our touch UI was never built for; it hangs after being turned on in the settings page.
|
||||
// This item in the settings page is separately hidden by the UI overlay; this here guarantees that devices where it was already turned on recover on restart. Same switch as settings_seed (on by default on iOS, on the Mac host only with DM_TOUCH_DEFAULTS=1)
|
||||
static void low_vision_off(const char *save_dir) {
|
||||
const char *e = getenv("DM_TOUCH_DEFAULTS"); int on = e ? strcmp(e, "0") != 0 : TARGET_OS_IPHONE; if (!on) return;
|
||||
const char *e = getenv("DM_TOUCH_DEFAULTS"); int on = e ? strcmp(e, "0") != 0 : DM_TOUCH_PRODUCT; if (!on) return;
|
||||
char path[1200]; snprintf(path, sizeof path, "%s/Settings/Settings.json", save_dir); static char buf[65536]; FILE *f = fopen(path, "rb"); if (!f) return;
|
||||
size_t n = fread(buf, 1, sizeof buf - 1, f); fclose(f); if (n == sizeof buf - 1) return; buf[n] = 0;
|
||||
char *k = strstr(buf, "\"Low Vision Mode\""); if (!k) return; char *v = strchr(k + 17, ':'); if (!v) return; v++; while (*v == ' ' || *v == '\t') v++;
|
||||
@@ -317,7 +326,7 @@ static void low_vision_off(const char *save_dir) {
|
||||
if (ok && !rename(tmp, path)) LOG("设置兜底:「大字体」(Low Vision Mode)是开着的,已改回关"); else remove(tmp);
|
||||
}
|
||||
static void settings_seed(const char *save_dir) {
|
||||
const char *e = getenv("DM_TOUCH_DEFAULTS"); int on = e ? strcmp(e, "0") != 0 : TARGET_OS_IPHONE; if (!on) return;
|
||||
const char *e = getenv("DM_TOUCH_DEFAULTS"); int on = e ? strcmp(e, "0") != 0 : DM_TOUCH_PRODUCT; if (!on) return;
|
||||
static const char *kv[][2] = {{"\"Item Name Display\"", "1"}, {"\"Item Tooltip Hotkey Appender\"", "0"},
|
||||
{"\"AutoMapMode\"", "2"}, {"\"AutoMap Open On Load\"", "1"}};
|
||||
char dir[1100], path[1200]; snprintf(dir, sizeof dir, "%s/Settings", save_dir); snprintf(path, sizeof path, "%s/Settings.json", dir);
|
||||
@@ -388,7 +397,7 @@ HLE_FORCE("_ZN2nn2fs13MountSaveDataEPKcRKNS_7account3UidE", "fsp-srv;存档
|
||||
// iOS 上缺省写;Mac 宿主的对拍闸门(存档要和真机真值逐文件相同)不写
|
||||
// Rule files for the loot filter (the game loads them at startup; dm_lootfilter.c registers this hook from a constructor; it is null in unit tests that link only hle_fs.c). Same switch as settings_seed:
|
||||
// written by default on iOS; not written under the Mac host's parity gate (saves must match the device ground truth file by file)
|
||||
{ const char *e = getenv("DM_TOUCH_DEFAULTS"); if (g_dm_mount_seed_hook && (e ? strcmp(e, "0") != 0 : TARGET_OS_IPHONE)) g_dm_mount_seed_hook(dd); }
|
||||
{ const char *e = getenv("DM_TOUCH_DEFAULTS"); if (g_dm_mount_seed_hook && (e ? strcmp(e, "0") != 0 : DM_TOUCH_PRODUCT)) g_dm_mount_seed_hook(dd); }
|
||||
return mount_ex(name, dd, 0, 1);
|
||||
}
|
||||
void (*g_dm_pre_commit_hook[4])(const char *workdir); // 提交前调(工作目录):宿主旁路文件按工作目录里的存档内容核对后再写([0] 个人仓库多页 dm_pages.c、[2] 百宝囊 dm_pouch.c、[1] 编年史仓库 dm_vault.c、[3] 秘境进度 dm_rift.c) | called before commit (working directory): host side files are checked against the save contents in the working directory before being written ([0] personal stash pages dm_pages.c, [2] pouch dm_pouch.c, [1] chronicle vault dm_vault.c, [3] rift progress dm_rift.c)
|
||||
|
||||
Reference in New Issue
Block a user