Files
d2r-mobile/dm/host/android/front_headless.c
T
shenleiandClaude Opus 5.5 4d91f80bae 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>
2026-10-14 14:55:05 +09:00

26 lines
1.8 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Android 无头前端(adb shell 直接跑 dmhost,先跑通引导链):无窗口、无输入框,客体在当前线程跑;GameActivity 前端接上后由它替换
// Android headless front end (run dmhost straight from adb shell to get the boot chain working first): no window, no input box, the guest runs on the current thread; replaced by the GameActivity front end once that is wired up
#include "../dm.h"
#include "../front.h"
// 客体在 64 MB 栈的线程里跑(与 iOS 壳的 boot_thread 一致;adb shell 主线程栈只有 8 MB)
// The guest runs on a thread with a 64 MB stack (same as the iOS shell's boot_thread; the adb shell main thread has only 8 MB)
static void *guest_thread(void *p) { ((void (*)(void))p)(); return NULL; }
void front_run(void (*guest)(void)) {
pthread_attr_t a; pthread_t t;
pthread_attr_init(&a); pthread_attr_setstacksize(&a, 64 << 20);
if (pthread_create(&t, &a, guest_thread, (void *)guest)) die("建客体线程失败");
pthread_join(t, NULL);
}
void *front_metal_layer(void) { return NULL; }
// 与 front_mac.m 同一规则:DM_GAME_RES=宽x高 指定主机模式分辨率,掌机模式取 4/5
// Same rule as front_mac.m: DM_GAME_RES=WxH sets the docked resolution, handheld takes 4/5 of it
uint64_t front_game_res(int docked) {
unsigned w, h; const char *e = getenv("DM_GAME_RES");
if (e && sscanf(e, "%ux%u", &w, &h) == 2) return docked ? (uint64_t)h << 32 | w : (uint64_t)(h * 4 / 5) << 32 | (w * 4 / 5 + 3) / 4 * 4;
return docked ? 900ull << 32 | 1600 : 720ull << 32 | 1280;
}
int front_text_input(const char *title, const char *sub, const char *guide, const char *initial, int max_chars, char *out, int out_cap) {
(void)title; (void)sub; (void)guide; (void)initial; (void)max_chars; (void)out; (void)out_cap;
return -1;
}