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
+16
View File
@@ -3,7 +3,9 @@
#include "dm.h"
#include "front.h"
#include <stdatomic.h>
#if defined(__APPLE__)
#include <sys/sysctl.h>
#endif
#include <sys/time.h>
#include <unistd.h>
void probe_install(void); void ticks_install(void); void hid_keys_init(void); void tact_prefetch_start(const char *outdir); void tact_chk_init(void); void stubs_report(void); void crash_install(void); void guest_thread_init(void); uint32_t svc_thread_main_init(void);
@@ -90,11 +92,25 @@ static void flags_init(void) {
// 启动时间线零点 = 进程创建时刻(sysctl KERN_PROC_PID 的 p_starttime,墙钟)换算到 now_ns 单调时基;Mac / iOS 同口径
// Zero point of the boot timeline = process creation time (p_starttime from sysctl KERN_PROC_PID, wall clock) converted to the now_ns monotonic time base; same definition on Mac / iOS
static uint64_t proc_start_mono_ns(void) {
#if !defined(__APPLE__)
// Linux:/proc/self/stat 第 22 字段 starttime(开机起的时钟滴答,含挂起)对 CLOCK_BOOTTIME 求进程年龄
// Linux: field 22 of /proc/self/stat, starttime (clock ticks since boot, including suspend), against CLOCK_BOOTTIME gives the process age
uint64_t mono = now_ns(); char b[1024] = {0};
FILE *f = fopen("/proc/self/stat", "r"); if (!f) return mono;
size_t n = fread(b, 1, sizeof b - 1, f); fclose(f); b[n] = 0;
char *p = strrchr(b, ')'); unsigned long long st = 0;
for (int i = 2; p && i < 22; i++) p = strchr(p + 1, ' '); // ')' 之后是第 3 字段 | field 3 follows ')'
if (!p || sscanf(p + 1, "%llu", &st) != 1) return mono;
struct timespec ts; clock_gettime(CLOCK_BOOTTIME, &ts);
int64_t age = (int64_t)ts.tv_sec * 1000000000ll + ts.tv_nsec - (int64_t)(st * 1000000000ull / (unsigned long long)sysconf(_SC_CLK_TCK));
return age > 0 ? mono - (uint64_t)age : mono;
#else
struct kinfo_proc kp; size_t n = sizeof kp; int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()};
uint64_t mono = now_ns(); struct timeval tv; gettimeofday(&tv, NULL);
if (sysctl(mib, 4, &kp, &n, NULL, 0) || !n) return mono;
int64_t age = (int64_t)(tv.tv_sec - kp.kp_proc.p_starttime.tv_sec) * 1000000000ll + (tv.tv_usec - kp.kp_proc.p_starttime.tv_usec) * 1000ll;
return age > 0 ? mono - (uint64_t)age : mono;
#endif
}
// 宿主装载(与 UIKit / Metal 无关):读 NSO、重定位、强制接管、探针 / 拍门 / 按键、预取起跑。缺省在 main 里同步跑;