Older systems: iOS 18+ / macOS 15+ via the older-API build; floating left stick; runeword required level; Mac keyboard, mouse and docs; clearer older-device dialog

This commit is contained in:
jhaizhou
2026-10-14 01:49:25 +08:00
parent 2eb5758771
commit d9e95c3381
52 changed files with 1325 additions and 274 deletions
+42 -10
View File
@@ -4,16 +4,23 @@
// 只同步玩家真实存档 Documents/save;测试存档(save.test 等)缺省不同步。测试开关 DM_TEST_ICLOUD_SUB=<子目录名>:测试存档也同步,云端用容器里的这个子目录(与真实存档的 saves 隔开,不会把测试角色传到玩家设备上)。
// 测试开关 DM_TEST_ICLOUD_DIR=<本地目录>:用本地目录当云端(不碰 iCloud),测试存档也同步。不以 / 开头的路径拼到 App 的 Documents 下(下同)。
// 测试开关 DM_TEST_ICLOUD_ROOT=<本地目录>:用本地目录当 iCloud 容器的 Documents(下有 saves / saves_v2),验目录换代与一次性迁移;测试存档也同步。
// Mac 原生 App(宿主 app_mac.m 包成的那个)也编这个文件,同一个容器、同一套规则:真实存档 = 应用支持目录下的 save(启动代码设 DM_CLOUD_REAL=1;
// 带 DM_APP_SUPPORT 起的测试局不设,一律当测试存档、不同步);没有「切后台」,改成退出 App 前传一次并等它传完(dm_cloud_flush_wait)。
// 开关:「自定义」页 icloud(缺省开)。没登录 iCloud / 本 App 的 iCloud 被关:取不到容器,整套跳过,日志记一行。
// iOS side of iCloud save sync: get the iCloud container directory, let the cloud packages download first, then call the shared core dm_cloud_sync (dm/host/dm_cloudsync.c).
// Startup: dm_cloud_boot is called in boot_thread before dm_main mounts the save; waits at most 5 seconds, pulls each cloud package and swaps it into the local save under "later write overwrites earlier write"; after that the game reads the save list as usual.
// While running: each time a save commit succeeds (Commit in hle_fs.c), the commit hook first clonefiles the committed directory into a snapshot (copy-on-write, nearly free); in a run it is only marked pending, and on leaving the run / going to background the snapshot is compared with the cloud on a serial queue, upload only (allow_down = 0); commits outside a run are uploaded on the spot.
// Only the player's real save Documents/save is synced; test saves (save.test etc.) are not synced by default. Test switch DM_TEST_ICLOUD_SUB=<subdirectory name>: test saves are synced too, and the cloud uses this subdirectory of the container (kept apart from the real save's saves, so test characters are not uploaded to the player's devices).
// Test switch DM_TEST_ICLOUD_DIR=<local directory>: use a local directory as the cloud (iCloud untouched); test saves are synced too. Paths not starting with / are joined under the App's Documents (same below).
// Test switch DM_TEST_ICLOUD_ROOT=<local directory>: use a local directory as the iCloud container's Documents (containing saves / saves_v2), to verify the directory generation change and the one-time migration; test saves are synced too.
// Switch: icloud on the 「自定义」(Custom) page (on by default). Not signed in to iCloud / iCloud turned off for this App: the container cannot be obtained, the whole thing is skipped and one log line is written.
// The iOS side of iCloud save sync: obtain the iCloud container directory, let the cloud packages download first, then call the shared core dm_cloud_sync (dm/host/dm_cloudsync.c).
// Startup: dm_cloud_boot is called in boot_thread, before dm_main mounts the save; it waits at most 5 seconds, pulls each cloud package and swaps it into the local save by "last write wins", after which the game reads the save list as usual.
// While running: every time a save commit succeeds (Commit in hle_fs.c), the commit hook first clonefiles the committed directory into a snapshot (copy-on-write, nearly free); in game it is only marked as pending, and on leaving the game / going to the background the snapshot is compared with the cloud on a serial queue and only uploaded (allow_down = 0); commits outside a game are uploaded on the spot.
// Only the player's real save Documents/save is synced; test saves (save.test and so on) are not synced by default. Test switch DM_TEST_ICLOUD_SUB=<subdirectory name>: test saves are synced as well, using this subdirectory of the container in the cloud (separate from the saves of the real save, so test characters are not sent to the player's devices).
// Test switch DM_TEST_ICLOUD_DIR=<local directory>: use a local directory as the cloud (iCloud is not touched); test saves are synced as well. A path not starting with / is joined under the App's Documents (same below).
// Test switch DM_TEST_ICLOUD_ROOT=<local directory>: use a local directory as the Documents of the iCloud container (with saves / saves_v2 under it), to verify the directory generation change and the one-time migration; test saves are synced as well.
// The native Mac App (the one the host's app_mac.m is wrapped into) compiles this file too, with the same container and the same rules: the real save = save under the application support directory (the startup code sets DM_CLOUD_REAL=1;
// test runs launched with DM_APP_SUPPORT do not set it and are always treated as test saves, not synced); there is no "going to the background", so it uploads once before quitting the App and waits for it to finish (dm_cloud_flush_wait).
// Switch: icloud on the Custom page (on by default). Not signed in to iCloud / iCloud turned off for this App: the container cannot be obtained, the whole thing is skipped, and one line is logged.
#import <Foundation/Foundation.h>
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#endif
#include <signal.h>
#include <sys/clonefile.h>
#include <stdatomic.h>
@@ -87,15 +94,28 @@ static void on_commit(const char *commit_dir) {
void dm_cloud_flush(int background) {
if (!g_q) return; // 没开同步(测试存档 / 没登录 iCloud / 自定义页关了) | Sync not enabled (test save / not signed in to iCloud / turned off on the Custom page)
if (background) atomic_store(&g_bg, 1);
#if TARGET_OS_IPHONE
__block UIBackgroundTaskIdentifier tk = UIBackgroundTaskInvalid;
if (background) tk = [UIApplication.sharedApplication beginBackgroundTaskWithName:@"dm.cloud" expirationHandler:^{ LOG("【红】iCloud 同步:后台收尾时间到,系统叫停(没传完的下次启动补传)"); [UIApplication.sharedApplication endBackgroundTask:tk]; tk = UIBackgroundTaskInvalid; }];
#endif
dispatch_async(g_q, ^{
NSString *p = g_pend; g_pend = nil;
if (p) upload_snap(p, background ? "切到后台," : "退出这一局回到前端,");
else LOG("iCloud 同步:%s,局内没有待传的存档", background ? "切到后台" : "退出这一局回到前端");
#if TARGET_OS_IPHONE
if (tk != UIBackgroundTaskInvalid) dispatch_async(dispatch_get_main_queue(), ^{ if (tk != UIBackgroundTaskInvalid) { [UIApplication.sharedApplication endBackgroundTask:tk]; tk = UIBackgroundTaskInvalid; } });
#endif
});
}
// 退出 App 前(Mac):把局内攒下的最新一份传掉,并等队列里的活做完,最多 sec 秒。返回 1 = 做完了(或本来就没开同步),0 = 到点还没完
// Before quitting the App (Mac): upload the latest copy accumulated during the game and wait for the queued work to finish, at most sec seconds. Returns 1 = done (or sync was not on in the first place), 0 = not finished in time
int dm_cloud_flush_wait(double sec) {
if (!g_q) return 1;
dispatch_semaphore_t done = dispatch_semaphore_create(0);
dispatch_async(g_q, ^{ NSString *p = g_pend; g_pend = nil; if (p) upload_snap(p, "退出 App 前,"); else LOG("iCloud 同步:退出 App 前,没有待传的存档"); dispatch_semaphore_signal(done); });
if (dispatch_semaphore_wait(done, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(sec * NSEC_PER_SEC)))) { LOG("【红】iCloud 同步:退出 App 前 %.0f 秒没传完(没传完的下次启动补传)", sec); return 0; }
return 1;
}
void dm_cloud_foreground(void) { atomic_store(&g_bg, 0); }
static void cloud_ingame(int on) { if (on) atomic_store(&g_session, 1); }
static void cloud_charsel(void) { if (atomic_exchange(&g_session, 0)) dm_cloud_flush(0); } // 退出这一局回到前端(主菜单 / 选角页):这一局结束 | Left this run back to the front end (main menu / character select page): this run has ended
@@ -126,7 +146,11 @@ static NSURL *container(double limit) { // 取 iCloud 容器:要在主线程
// (later, deleting a character removes packages, so we cannot keep blocking on the manifest forever). Returns 0 = skip sync this time
static NSString *test_path(const char *e) { // 测试开关里的路径:不以 / 开头的拼到 App 的 Documents 下(真机容器路径每次装包都变) | Paths in test switches: those not starting with / are joined under the App's Documents (the real-device container path changes on every install)
if (!e) return nil; if (e[0] == '/') return @(e);
#if TARGET_OS_OSX
return [@(getenv("DM_SAVE") ?: ".").stringByDeletingLastPathComponent stringByAppendingPathComponent:@(e)]; // Mac:拼到存档目录的上一级(应用支持目录) | Mac: joined to the parent of the save directory (the application support directory)
#else
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:@(e)];
#endif
}
static int v2_ready(NSString *nw, NSString *okf) { // 迁移过来的整套是否都到了本机 | Whether the whole migrated set has arrived on this device
NSFileManager *fm = NSFileManager.defaultManager; if ([fm fileExistsAtPath:okf]) return 1;
@@ -167,8 +191,15 @@ void dm_cloud_boot(void) {
const char *sv = getenv("DM_SAVE"), *sub = getenv("DM_TEST_ICLOUD_SUB"), *ldir = getenv("DM_TEST_ICLOUD_DIR"), *lroot = getenv("DM_TEST_ICLOUD_ROOT"); if (!sv) return;
NSString *doc = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
NSString *save = @(sv); int real = [save.stringByStandardizingPath isEqualToString:[doc stringByAppendingPathComponent:@"save"].stringByStandardizingPath];
#if TARGET_OS_OSX
real = getenv("DM_CLOUD_REAL") != NULL; (void)doc; // Mac:真实存档由启动代码认(app_mac.m:没带 DM_APP_SUPPORT 的那种起法) | Mac: the real save is recognised by the startup code (app_mac.m: the way of launching without DM_APP_SUPPORT)
#endif
int off = getenv("DM_TEST_ICLOUD_OFF") != NULL; // 测试总闸:脚本起的局一律带它(tools/cloud_guard.sh),整局不同步 | Test master gate: runs launched by scripts always carry it (tools/cloud_guard.sh), and the whole run does not sync
if (!real && !sub && !ldir && !lroot) { if (off) LOG("iCloud 同步:测试开关 DM_TEST_ICLOUD_OFF,本局不同步"); return; } // 测试存档:不同步 | Test save: not synced
if (!real && !sub && !ldir && !lroot) { if (off) LOG("iCloud 同步:测试开关 DM_TEST_ICLOUD_OFF,本局不同步"); // 测试存档:不同步 | Test save: not synced
#if TARGET_OS_OSX
else LOG("iCloud 同步:测试用的存档目录(DM_APP_SUPPORT),本局不同步");
#endif
return; }
// Mac 上跑的 iOS 包:缺省整个不连真实 iCloud。这个包只发 iPhone / iPad,Mac 上跑的全是开发与测试;开发机登着真实账号时,
// 它就是那个账号的又一台设备,任何脚本、手点图标都会和真实云端双向同步(出过把测试存档传进真实云端)。本地测试云端(DIR / ROOT)不受影响;
// 真要在 Mac 上连真实云端:同时给 DM_REAL_ICLOUD=1 与 DM_REAL_ICLOUD_CONFIRM=写入真实云端。真机不走这一支。
@@ -193,9 +224,10 @@ void dm_cloud_boot(void) {
g_q = dispatch_queue_create("dm.cloud", DISPATCH_QUEUE_SERIAL);
for (NSString *f in [NSFileManager.defaultManager contentsOfDirectoryAtPath:save.stringByDeletingLastPathComponent error:nil] ?: @[]) // 上次被杀时没删掉的提交快照 | Commit snapshots not deleted when we were last killed
if ([f hasPrefix:[save.lastPathComponent stringByAppendingString:@".cloudsnap"]]) [NSFileManager.defaultManager removeItemAtPath:[save.stringByDeletingLastPathComponent stringByAppendingPathComponent:f] error:nil];
int pend = pending_downloads(1);
double t1 = CFAbsoluteTimeGetCurrent(); int pend = pending_downloads(1);
while (pend && CFAbsoluteTimeGetCurrent() - t0 < limit) { usleep(100000); pend = pending_downloads(0); }
int n = run_sync(save, 1);
double t2 = CFAbsoluteTimeGetCurrent(); int n = run_sync(save, 1);
LOG("iCloud 同步:启动分段 取容器与查齐 %.0f ms、等下载 %.0f ms、文件协调与同步 %.0f ms", (t1 - t0) * 1000, (t2 - t1) * 1000, (CFAbsoluteTimeGetCurrent() - t2) * 1000);
LOG("iCloud 同步:启动 %.0f ms,动作 %d 个%s(云端目录 %s)", (CFAbsoluteTimeGetCurrent() - t0) * 1000, n, pend ? [NSString stringWithFormat:@",%d 个包没等到下载完、本次跳过", pend].UTF8String : "", ldir ? "本地测试目录" : sub ? sub : "saves_v2");
g_dm_save_commit_hook = on_commit;
{ extern void (*g_dm_ingame_hook)(int); extern void (*g_dm_charsel_hook)(void); g_dm_ingame_hook = cloud_ingame; g_dm_charsel_hook = cloud_charsel; } // 进局记一局开始;回到前端 = 这一局结束,传一次 | Entering a run marks the start of a run; returning to the front end = this run has ended, upload once
+29 -18
View File
@@ -76,9 +76,19 @@ void dm_tc_layout_make(dm_tc_layout *l, float width, float height) {
{ float sx = main_x-112*k, bar_r = l->width/2+(2015-1434)*u+8*k+22*k; /* 右雕像翼尖:七格时 2075,六格石条右端收进 60 | Right statue wing tip: 2075 with seven cells; with six cells the right end of the stone bar is pulled in by 60 */ if (sx < bar_r) sx = bar_r;
l->swap = (dm_tc_target){sx, main_y+52*k, 22*k, 0}; }
/* 底栏外侧是血 / 蓝球;球不是输入目标。 | Outside the bottom bar are the life / mana orbs; the orbs are not input targets. */
l->joy_x = fmaxf(90*k, g_safe_l + 60*k); /* 摇杆底盘(半径 60)左沿不越过安全区左界 | The left edge of the stick base (radius 60) does not cross the left boundary of the safe area */
l->joy_y = l->height - 100*k;
/* 左摇杆是浮动底盘:左下「起摇杆区」里手指落在哪,底盘圆心就落在哪,松手回静止位。
静止位:圆心离安全区左界 90(底盘半径 60 + 30)、不小于 120,离屏幕底 115——只是没按时画在哪。
起摇杆区:屏宽的左 40% × 屏高的下 55%(左与下到屏幕边:拇指压在刘海那一条上也算);区里我们的圆钮 / 腰带格、原版界面上可点的东西各自优先。
夹回:落点贴边时圆心挪回来,整个底盘留在安全区左界以右、底盘下沿离屏幕底不少于 25(不撞系统横条)
The left stick is a floating base: wherever the finger lands inside the bottom-left "stick-start zone", the base centre goes there, and it returns to the rest position on release.
Rest position: centre 90 from the left edge of the safe area (base radius 60 + 30), not less than 120, and 115 from the bottom of the screen - only where it is drawn while not pressed.
Stick-start zone: the left 40% of the screen width x the lower 55% of the screen height (reaching the screen edges on the left and bottom: a thumb on the notch strip counts too); inside the zone our round buttons / belt cells and the clickable things of the original UI each take priority.
Clamping: when the touch point is near an edge the centre is moved back so that the whole base stays to the right of the safe area's left edge and its lower rim is at least 25 from the bottom of the screen (clear of the system bar) */
l->joy_radius = 60*k;
l->joy_x = fmaxf(90*k, g_safe_l + 60*k) + 30*k;
l->joy_y = l->height - 115*k;
l->joy_zone_r = l->width*0.40f; l->joy_zone_t = l->height*0.45f;
l->joy_min_x = g_safe_l + l->joy_radius; l->joy_max_y = l->height - 25*k - l->joy_radius;
}
int dm_tc_hit(const dm_tc_layout *l, float x, float y) {
@@ -378,7 +388,7 @@ void dm_tc_cancel_finger(dm_tc_state *s, int slot) {
if (slot < 0 || slot >= DM_TC_MAX_TOUCH) return;
++s->gesture_epoch;
if (s->finger[slot].active && s->finger[slot].target == DM_TC_PORTAL) { dm_tc_cancel_portal(s); }
if (slot == s->joy_slot && s->finger[slot].active) { s->joy_lost_s = s->last_time_s; s->joy_lost_x = s->finger[slot].x; s->joy_lost_y = s->finger[slot].y; } /* 系统取消了摇杆那根手指:记下,紧接着在附近重新落下的接着当摇杆 | the system cancelled the joystick finger: record it, and a finger landing again nearby right afterwards continues as the joystick */
if (slot == s->joy_slot && s->finger[slot].active) { s->joy_lost_s = s->last_time_s; s->joy_lost_x = s->finger[slot].x; s->joy_lost_y = s->finger[slot].y; s->joy_lost_ox = s->joy_origin_x; s->joy_lost_oy = s->joy_origin_y; } /* 系统取消了摇杆那根手指:记下,紧接着在附近重新落下的接着当摇杆 | the system cancelled the joystick finger: record it, and a finger landing again nearby right afterwards continues as the joystick */
s->finger[slot] = (dm_tc_finger){.target=DM_TC_NONE};
if (slot == s->joy_slot) { s->joy_slot = DM_TC_NONE; s->joy_origin_x = s->joy_origin_y = 0; }
if (slot == s->aim_slot) s->aim_slot = DM_TC_NONE;
@@ -492,23 +502,24 @@ void dm_tc_begin_at(dm_tc_state *s, int slot, float x, float y, double now_s) {
if (!s->mouse_click_mode) { s->pointer_valid = 1; s->pointer_x = x; s->pointer_y = y; }
} else if (!s->navigation_mode && hit == DM_TC_NONE && g_edge_b > 0 && x >= 0 && x < s->layout.width*0.43f && y > s->layout.height - g_edge_b) {
f->target = DM_TC_EDGE;
} else if (!s->navigation_mode && !s->joy_block && hit == DM_TC_NONE && s->joy_slot == DM_TC_NONE &&
x >= 0 && y <= s->layout.height && x < s->layout.width*0.43f && y > s->layout.height*0.25f &&
(hypotf(x - s->layout.joy_x, y - s->layout.joy_y) <= DM_TC_JOY_GRAB_K * s->layout.joy_radius ||
(s->joy_lost_s > 0 && now_s - s->joy_lost_s <= DM_TC_JOY_RESUME_S && hypotf(x - s->joy_lost_x, y - s->joy_lost_y) <= DM_TC_JOY_GRAB_K * s->layout.joy_radius))) {
/* 摇杆底座固定在左下角原位:手指落在底座附近(DM_TC_JOY_GRAB_K 倍半径内)才起摇杆,方向与幅度按「手指相对底座中心」算,
按住后拖到多远都照样识别;落在左侧别处不起摇杆(照旧是点地)。原先是浮动摇杆:落在左侧区域哪里,底座就出在哪里、松手回原位。
例外:摇杆那根手指刚被系统取消(通知横幅、系统手势;dm_tc_cancel_finger 记下时刻与位置),DM_TC_JOY_RESUME_S 内在原处附近重新落下的手指接着当摇杆——
拖远了的摇杆被系统打断一下不该就此断掉;浮动摇杆时这种情形表现为底座追着手指重起
The joystick base is fixed at its home position in the lower left: the joystick starts only when a finger lands near the base (within DM_TC_JOY_GRAB_K × radius), and direction and magnitude are computed as "finger relative to the base center";
once held it is still recognized however far it is dragged; landing elsewhere on the left does not start the joystick (it is a ground tap as before). Previously it was a floating joystick: wherever in the left area the finger landed, the base appeared there, returning to its home position on release.
Exception: when the joystick finger has just been cancelled by the system (notification banner, system gesture; dm_tc_cancel_finger records the time and position), a finger landing again near the same spot within DM_TC_JOY_RESUME_S continues as the joystick --
a joystick dragged far away should not be cut off for good by a brief system interruption; with the floating joystick this case showed up as the base restarting under the finger */
} else if (!s->navigation_mode && !s->joy_block && hit == DM_TC_NONE && s->joy_slot == DM_TC_NONE && x >= 0 && y <= s->layout.height &&
((x < s->layout.joy_zone_r && y > s->layout.joy_zone_t) ||
(x < s->layout.width*0.43f && y > s->layout.height*0.25f && s->joy_lost_s > 0 && now_s - s->joy_lost_s <= DM_TC_JOY_RESUME_S && hypotf(x - s->joy_lost_x, y - s->joy_lost_y) <= DM_TC_JOY_GRAB_K * s->layout.joy_radius))) {
/* 浮动底盘:落在起摇杆区里就起摇杆,底盘圆心 = 落点(贴边时夹回,见布局处),方向与幅度按「手指相对底盘圆心」算,按住后拖到多远都照样识别,
底盘不跟手走;落在区外照旧是点地。这一下若很快原地松开,仍兼作一次点击(dm_tc_end_at):区里的怪、掉落物、NPC 要点得到。
摇杆那根手指刚被系统取消(通知横幅、系统手势;dm_tc_cancel_finger 记下时刻与位置),DM_TC_JOY_RESUME_S 内在原处附近重新落下的手指接着当摇杆,
哪怕落点已拖出起摇杆区。只开着讲话文字框 / 对话菜单时不起摇杆(joy_block):夹回会让落点 ≠ 圆心、一落下就有方向,那一下只该关框
Floating base: a touch inside the stick-start zone starts the stick with the base centre = the touch point (clamped back near the edges, see the layout), direction and magnitude are computed from "finger relative to base centre", and once held, dragging any distance is still recognised;
the base does not follow the finger; a touch outside the zone is a ground tap as before. If this touch is released quickly in place it still doubles as a tap (dm_tc_end_at): monsters, dropped items and NPCs inside the zone must remain tappable.
When the stick finger has just been cancelled by the system (notification banner, system gesture; dm_tc_cancel_finger records the time and position), a finger touching down again near the same place within DM_TC_JOY_RESUME_S continues as the stick,
even if the touch point has been dragged out of the stick-start zone. The stick does not start while only a speech text box / dialogue menu is open (joy_block): clamping would make touch point != centre and give a direction the moment it lands, when that touch should only close the box */
int resume = s->joy_lost_s > 0 && now_s - s->joy_lost_s <= DM_TC_JOY_RESUME_S && hypotf(x - s->joy_lost_x, y - s->joy_lost_y) <= DM_TC_JOY_GRAB_K * s->layout.joy_radius;
s->joy_lost_s = 0;
f->target = DM_TC_JOYSTICK;
s->joy_slot = slot;
s->joy_origin_x = s->layout.joy_x;
s->joy_origin_y = s->layout.joy_y;
/* 接续的沿用取消前的圆心,不按新落点重定:触摸被系统反复打断又重来的机器上,每重来一次底盘就跳到手指当前位置,看着像底盘追着手指跑 | a continuation keeps the centre from before the cancel instead of re-centring on the new touch point: on devices where touches are repeatedly interrupted by the system and restarted, the base would jump to the finger's current position on every restart and look as if it were chasing the finger */
s->joy_origin_x = resume ? s->joy_lost_ox : fmaxf(x, s->layout.joy_min_x);
s->joy_origin_y = resume ? s->joy_lost_oy : fminf(y, s->layout.joy_max_y);
}
update(s);
}
@@ -625,7 +636,7 @@ void dm_tc_end_at(dm_tc_state *s, int slot, double now_s) {
else if (s->belt_rows > 1 && up < -th) s->belt_request = 2;
else if (fabsf(dx) <= th && fabsf(up) <= th) belt_fire(s, 0x10 | (done.target - DM_TC_BELT1));
}
if (done.active && !s->navigation_mode && done.target == DM_TC_NONE && now_s - done.start_time_s < DM_TC_POINTER_TAP_S && /* 落在摇杆底座上的那一下是摇杆(一按就有方向),不再兼作点地 | the tap that lands on the joystick base is the joystick (direction as soon as pressed) and no longer doubles as a ground tap */
if (done.active && !s->navigation_mode && (done.target == DM_TC_NONE || done.target == DM_TC_JOYSTICK) && now_s - done.start_time_s < DM_TC_POINTER_TAP_S && /* 起摇杆区里很快原地松开的那一下兼作点击 | a quick release in place inside the stick-start zone doubles as a tap */
hypotf(done.x - done.aim_origin_x, done.y - done.aim_origin_y) <= DM_TC_POINTER_MOVE_PT * scale_for(&s->layout)) {
s->world_tap_x = done.aim_origin_x; s->world_tap_y = done.aim_origin_y; ++s->world_tap_seq; /* 点游戏世界 | Tap the game world */
}
+4 -3
View File
@@ -18,7 +18,8 @@ typedef struct { float x, y, r; uint64_t button; } dm_tc_target;
typedef struct {
float width, height;
dm_tc_target target[DM_TC_COUNT];
float joy_x, joy_y, joy_radius;
float joy_x, joy_y, joy_radius; /* 没按时底盘的显示位置(静止位)与底盘半径 | where the base is shown while not pressed (rest position), and the base radius */
float joy_zone_r, joy_zone_t, joy_min_x, joy_max_y; /* 起摇杆区的右界与上界(左与下到屏幕边);按下后底盘圆心的夹回界:x 不小于、y 不大于 | right and upper bounds of the stick-start zone (left and bottom reach the screen edges); clamp bounds for the base centre once pressed: x not less than, y not greater than */
dm_tc_target swap; /* 技能组切换键:本地开关,不直接发按键 | Skill set switch key: a local toggle; does not send a key directly */
dm_tc_target diff; /* 底部 UI v4 第 0 格难度:点开 / 收起 1–8 选择条,不发按键 | Bottom UI v4 cell 0 difficulty: tap to open / collapse the 1–8 selector bar; sends no key */
dm_tc_target pick[8]; /* 选择条 8 格(第 i 格 = 人数档 i+1),在七格上方 | The selector bar's 8 cells (cell i = player-count level i+1), above the seven cells */
@@ -122,7 +123,7 @@ typedef struct {
int belt_rows, belt_open, belt_request;
/* 腰带点一下 = 自己喝,松手那一刻就喝,点几下喝几瓶;不判双击、腰带上不做喂雇佣兵的手势 | one tap on the belt = the player drinks, at the moment of release, several taps drink several; no double-tap detection, no mercenary feeding gesture on the belt */
int belt_gap_cell; double belt_gap_at; /* 按着第二组技能时要喝药:先把 ZL 和技能键松开、空出 DM_TC_ZL_LEAD_S,到 belt_gap_at 才按腰带键(belt_gap_cell = 等着的那一格,0 = 没有) | to drink a potion while a skill of the second skill set is held: first release ZL and the skill key and leave a gap of DM_TC_ZL_LEAD_S, and only at belt_gap_at press the belt key (belt_gap_cell = the cell that is waiting, 0 = none) */
double joy_lost_s; float joy_lost_x, joy_lost_y; /* 摇杆手指被系统取消的时刻与当时的位置(0 = 没有):紧接着在附近重新落下的手指接着当摇杆 | time and position at which the joystick finger was cancelled by the system (0 = none): a finger landing again nearby right afterwards continues as the joystick */
double joy_lost_s; float joy_lost_x, joy_lost_y, joy_lost_ox, joy_lost_oy; /* 摇杆手指被系统取消的时刻与当时的位置(0 = 没有):紧接着在附近重新落下的手指接着当摇杆 | time and position at which the joystick finger was cancelled by the system (0 = none): a finger landing again nearby right afterwards continues as the joystick */
int joy_block; /* 讲话文字框单独开着(前端不进面板态):这时落在底座上的手指不起摇杆,照旧只当一次点击(关讲话框)。前端按面板栈写 | speech text box open on its own (the front end does not enter panel state): a finger on the base starts no stick and is still just one click (closes the speech box). Written by the front end from the panel stack */
double belt_pulse_s; /* 最近一次「给玩家喝」的腰带脉冲还在发的时刻:其间按着的第二组技能连同 ZL 一起让开,收回后 ZL 重新领先 DM_TC_ZL_LEAD_S 技能键才回来 | Time until which the most recent "player drinks" belt pulse is still being sent: during it the held second-set skill gives way together with ZL, and after the release ZL again leads by DM_TC_ZL_LEAD_S before the skill key comes back */
int belt_q; /* 此刻有别的脉冲在发 / 别的补发在等:排着,空了再落地(不互相盖掉)。值 = 格 | another pulse is being sent / another resend is pending: queue and fire when free (they never overwrite each other). Value = cell */
@@ -193,7 +194,7 @@ int dm_tc_belt_outside(const dm_tc_state *state, float x, float y);
#define DM_TC_BELT_SWIPE_PT 24 /* 腰带格上松手时纵向位移过这么多点 = 展开 / 收起;不到 = 点按(喝) | On release over a belt cell, vertical displacement beyond this many points = expand / collapse; less = tap (drink) */
#define DM_TC_KEY_MIN_S 0.035 /* 技能键至少按住这么久(约 2 帧);不够的松手时补成脉冲,保证游戏读到 | A skill button is held at least this long (about 2 frames); a shorter one is made up as a pulse on release to guarantee the game reads it */
#define DM_TC_JOY_RESUME_S 0.35 /* 摇杆那根手指被系统取消后,这么久之内在原处附近重新落下的手指接着当摇杆(不要求落在底座附近) | after the joystick finger is cancelled by the system, a finger landing again near the same spot within this long continues as the joystick (landing near the base is not required) */
#define DM_TC_JOY_GRAB_K 1.5f /* 手指落在离摇杆底座中心这么多倍半径之内才起摇杆(底座固定,不跟落指点) | the joystick starts only when a finger lands within this many radii of the joystick base center (the base is fixed and does not follow the touch-down point) */
#define DM_TC_JOY_GRAB_K 1.5f /* 摇杆那根手指被系统取消后重新落下:离原处这么多倍底盘半径之内才接着当摇杆 | after the stick finger is cancelled by the system and touches down again: it continues as the stick only within this many base radii of the original place */
#define DM_TC_ZL_LEAD_S 0.17 /* 修饰键领先主键的时间(约 10 帧;同一帧按下游戏只认主键) | Time the modifier key leads the main key (about 10 frames; pressed in the same frame, the game only recognizes the main key) */
#define DM_TC_DOUBLE_TAP_S 0.40 /* 两次单击间隔上限 | Upper limit of the interval between two single taps */
#define DM_TC_HOLD_USE_S 0.60 /* 「按住」动作的按住时长:Mac 宿主实测 0.25 s 只捡起、0.45 s 打开魔盒 | Hold duration of the "hold" action: measured on the Mac host, 0.25 s only picks up, 0.45 s opens the cube */
+19 -7
View File
@@ -850,15 +850,15 @@ static void run_boot(void);
[self presentViewController:a animated:YES completion:nil];
}];
}
- (void)downloadOfAssetPack:(BAAssetPack *)p hasProgress:(NSProgress *)g {
- (void)downloadOfAssetPack:(BAAssetPack *)p hasProgress:(NSProgress *)g API_AVAILABLE(ios(26.0)) {
CFAbsoluteTime now = CFAbsoluteTimeGetCurrent(); int64_t done = g.completedUnitCount, total = g.totalUnitCount;
if (now - self.lastT >= 1.0) { self.rate = (done - self.last) / (now - self.lastT); self.last = done; self.lastT = now; }
NSString *t = [NSString stringWithFormat:T("dmDlProgress"), done / 1e9, total / 1e9, total ? 100.0 * done / total : 0, self.rate / 1e6];
dispatch_async(dispatch_get_main_queue(), ^{ self.label.text = t; self.bar.progress = total ? (float)done / total : 0; });
}
- (void)downloadOfAssetPackFinished:(BAAssetPack *)p { plog("assets: 系统通知资源包下载完成"); dispatch_async(dispatch_get_main_queue(), ^{ [self ready]; }); }
- (void)downloadOfAssetPackPaused:(BAAssetPack *)p { [self say:T("dmDlPaused")]; }
- (void)downloadOfAssetPack:(BAAssetPack *)p failedWithError:(NSError *)e { [self fail:@"下载游戏资源" error:e]; }
- (void)downloadOfAssetPackFinished:(BAAssetPack *)p API_AVAILABLE(ios(26.0)) { plog("assets: 系统通知资源包下载完成"); dispatch_async(dispatch_get_main_queue(), ^{ [self ready]; }); }
- (void)downloadOfAssetPackPaused:(BAAssetPack *)p API_AVAILABLE(ios(26.0)) { [self say:T("dmDlPaused")]; }
- (void)downloadOfAssetPack:(BAAssetPack *)p failedWithError:(NSError *)e API_AVAILABLE(ios(26.0)) { [self fail:@"下载游戏资源" error:e]; }
- (void)ready {
char why[2048];
static int started; if (started) return; // 完成回调与系统的完成通知都会走到这里:只起一次 | Both the completion callback and the system's completion notification end up here: start only once
@@ -978,9 +978,21 @@ static void bg_relaunch_test(void) {
}
const char *us = getenv("DM_TEST_UISHOT"); // 只测试用:DM_TEST_UISHOT=<秒>:<名字>,到点把当前窗口存成 Documents/<名字>.png——资源界面、着色器准备页这类系统界面层,游戏内截图截不到 | Test only: DM_TEST_UISHOT=<seconds>:<name> saves the current window to Documents/<name>.png at that time -- UIKit-level screens such as the resource screen and the shader preparation page cannot be captured by the in-game screenshot
if (us && atof(us) > 0 && strchr(us, ':')) { NSString *fn = @(strchr(us, ':') + 1); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(atof(us) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIWindow *w = nil; for (UIScene *sc in UIApplication.sharedApplication.connectedScenes) if ([sc isKindOfClass:UIWindowScene.class]) for (UIWindow *x in ((UIWindowScene *)sc).windows) if (x.isKeyWindow || !w) w = x;
if (!w) { plog("【红】DM_TEST_UISHOT:没有窗口"); return; }
UIImage *im = [[[UIGraphicsImageRenderer alloc] initWithBounds:w.bounds] imageWithActions:^(UIGraphicsImageRendererContext *c) { [w drawViewHierarchyInRect:w.bounds afterScreenUpdates:NO]; }];
// 所有场景的所有窗口按层级从低到高画进同一张图(系统弹框不一定在主窗口里,只取主窗口会得到一张黑图);
// 另把最上层呈现的界面里每个文字标签的「实际高度 / 排完整段要的高度」记进日志——截图万一仍截不到,截没截断也有数可读
// All windows of all scenes are drawn into one image from the lowest level to the highest (a system alert is not necessarily in the main window, and taking only the main window gives a black image);
// in addition, for every text label in the topmost presented interface, "actual height / height needed to lay out the whole text" is written to the log - should the screenshot still fail to capture it, whether it is truncated can be read from numbers
NSMutableArray<UIWindow *> *ws = [NSMutableArray array]; for (UIScene *sc in UIApplication.sharedApplication.connectedScenes) if ([sc isKindOfClass:UIWindowScene.class]) [ws addObjectsFromArray:((UIWindowScene *)sc).windows];
[ws sortUsingComparator:^NSComparisonResult(UIWindow *x, UIWindow *y) { return x.windowLevel < y.windowLevel ? NSOrderedAscending : x.windowLevel > y.windowLevel ? NSOrderedDescending : NSOrderedSame; }];
if (!ws.count) { plog("【红】DM_TEST_UISHOT:没有窗口"); return; }
CGRect all = CGRectZero; for (UIWindow *x in ws) all = CGRectUnion(all, x.frame);
UIImage *im = [[[UIGraphicsImageRenderer alloc] initWithBounds:all] imageWithActions:^(UIGraphicsImageRendererContext *c) { for (UIWindow *x in ws) if (!x.hidden) [x drawViewHierarchyInRect:x.frame afterScreenUpdates:YES]; }];
for (UIWindow *x in ws) { UIViewController *top = x.rootViewController; while (top.presentedViewController) top = top.presentedViewController;
plog("DM_TEST_UISHOT:窗口 %s 层级 %.0f %.0fx%.0f%s|最上层 %s", NSStringFromClass(x.class).UTF8String, x.windowLevel, x.frame.size.width, x.frame.size.height, x.hidden ? "(隐藏)" : "", top ? NSStringFromClass(top.class).UTF8String : "无");
if (top && top != x.rootViewController) { NSMutableArray<UIView *> *q = [NSMutableArray arrayWithObject:top.view];
while (q.count) { UIView *v = q.firstObject; [q removeObjectAtIndex:0]; [q addObjectsFromArray:v.subviews];
if ([v isKindOfClass:UILabel.class] && ((UILabel *)v).text.length) { UILabel *l = (UILabel *)v; CGFloat need = [l sizeThatFits:CGSizeMake(l.bounds.size.width, CGFLOAT_MAX)].height; BOOL sc = NO; for (UIView *u = l.superview; u; u = u.superview) if ([u isKindOfClass:UIScrollView.class]) sc = YES;
plog("DM_TEST_UISHOT:标签 %.0fx%.0f 排完要高 %.0f 行数上限 %ld%s %s|%.24s", l.bounds.size.width, l.bounds.size.height, need, (long)l.numberOfLines, sc ? " 在滚动区里" : "", need <= l.bounds.size.height + 0.5 ? "不截断" : "【红】高度不够", l.text.UTF8String); } } } }
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0] stringByAppendingPathComponent:[fn.lastPathComponent stringByAppendingString:@".png"]];
plog("DM_TEST_UISHOT:%s %s", path.fileSystemRepresentation, [UIImagePNGRepresentation(im) writeToFile:path atomically:YES] ? "已存" : "【红】没存下");
}); }
+16 -6
View File
@@ -72,15 +72,25 @@ if [ "$1" = build ]; then
[ -f Gen/romfs_overlay/data/.build.config ] || { t "🔴 没生成覆盖层 Gen/romfs_overlay"; exit 1; }
# 免费的开发者账号(个人团队)签不了这几项权限:DM_FREE_ACCOUNT=1 时从工程描述里去掉再生成。去掉后少的是 iCloud 存档同步、
# 持续执行模式与更高的内存上限;游戏照常运行(地址预留已按不带扩展虚拟寻址也放得下来定,见 host/hle_svc.c)
# A free developer account (personal team) cannot sign these entitlements: with DM_FREE_ACCOUNT=1 they are removed from the project
# description before generating. What is lost is iCloud save sync,
# sustained execution mode and the higher memory limit; the game runs as usual (the address reservation is already sized to fit without
# extended virtual addressing, see host/hle_svc.c)
# 两个开关各自独立、可以叠:先按免费档去掉签不了的,再按老接口版改部署目标(公开用户多是免费账号,「免费账号 + iOS 18」要两样都生效)。都没设 = 原样生成
# A free developer account (personal team) cannot sign these entitlements: with DM_FREE_ACCOUNT=1 they are removed from the project description before generating. What is lost is iCloud save sync,
# sustained execution mode and the higher memory limit; the game runs as usual (the address reservation is sized to fit without extended virtual addressing as well, see host/hle_svc.c)
# The two switches are independent and can be combined: first remove what the free tier cannot sign, then change the deployment target for the older-API build (most public users have free accounts, and "free account + iOS 18" needs both to take effect). Neither set = generate as is
SPEC=project.yml; FREE=
if [ "${DM_FREE_ACCOUNT:-0}" = 1 ]; then
python3 tools/project_free.py project.yml project_free.yml || { t "🔴 DM_FREE_ACCOUNT:免费档的工程描述没生成(见上)"; exit 1; } # 去掉签不了的六行权限与用不上的资源下载扩展 | remove the six entitlement lines it cannot sign and the asset download extension it has no use for
xcodegen generate -q --spec project_free.yml >/dev/null || { t "🔴 xcodegen 失败"; exit 1; }; rm -f project_free.yml; t "按免费账号生成:不带 iCloud / 持续执行 / 增加内存上限 / 扩展虚拟寻址,也不带资源下载扩展(只占一个应用标识)"
else
SPEC=project_free.yml; FREE=free
fi
if [ "${DM_IOS_M3:-0}" = 1 ]; then # 老接口版:图形后端不用 Metal 4,部署目标 iOS 18.0(tools/project_m3.py);缺省不走这里 | older-API build: the graphics backend does not use Metal 4, deployment target iOS 18.0 (tools/project_m3.py); not taken by default
python3 tools/project_m3.py $SPEC project_m3.yml $FREE || { rm -f project_free.yml; t "🔴 DM_IOS_M3:老接口版的工程描述没生成(见上)"; exit 1; }
SPEC=project_m3.yml
fi
if [ $SPEC = project.yml ]; then
xcodegen generate -q >/dev/null || { t "🔴 xcodegen 失败"; exit 1; }
else
xcodegen generate -q --spec $SPEC >/dev/null; XG=$?; rm -f project_free.yml project_m3.yml; [ $XG = 0 ] || { t "🔴 xcodegen 失败"; exit 1; }
[ -z "$FREE" ] || t "按免费账号生成:不带 iCloud / 持续执行 / 增加内存上限 / 扩展虚拟寻址,也不带资源下载扩展(只占一个应用标识)"
[ "${DM_IOS_M3:-0}" != 1 ] || t "按老接口版生成:部署目标 iOS 18.0、图形后端不用 Metal 4"
fi
[ "${DM_GEN_ONLY:-}" = 1 ] && { t "生成完成(DM_GEN_ONLY)"; exit 0; } # tools/testflight.sh 只要生成,自己 archive | tools/testflight.sh only needs the generation step and does the archive itself
asc_auth # App Store Connect API 密钥(有就带上,供签名自动注册 App Group 等能力;见 tools/asc_env.sh) | App Store Connect API key (included if present, so signing can auto-register capabilities such as the App Group; see tools/asc_env.sh)
+2 -2
View File
@@ -5,7 +5,7 @@
#include <stdlib.h>
static int checks;
#define CHECK(x) do { ++checks; if (!(x)) { fprintf(stderr,"FAIL line=%d %s\n",__LINE__,#x); exit(1); } } while (0)
static int push(dm_tc_state *s, float w, float h, float d) { /* 在底座圆心起手(底座固定),向右推 d 点,返回横轴输出 | start on the base center (the base is fixed), push d points to the right, return the horizontal axis output */
static int push(dm_tc_state *s, float w, float h, float d) { /* 在静止位起手(在起摇杆区里,圆心 = 落点),向右推 d 点,返回横轴输出 | start at the rest position (inside the stick-start zone, centre = touch point), push d points to the right, return the horizontal output */
dm_tc_init(s, w, h); float cx = s->layout.joy_x, cy = s->layout.joy_y; dm_tc_begin(s, 0, cx, cy); CHECK(s->joy_slot == 0);
dm_tc_move(s, 0, cx + d, cy); return s->lx;
}
@@ -24,7 +24,7 @@ int main(void) {
dm_tc_init(&s, 1366, 768); CHECK(s.layout.joy_radius > 104 && s.layout.joy_radius < 105); /* 画出来的底盘仍按视觉倍数:60 × 1.745 | The drawn base still follows the visual multiplier: 60 × 1.745 */
/* 底边那一条:手机(没设)照旧能在最底起摇杆 | Bottom-edge strip: a phone (not set) can still start the stick at the very bottom as before */
dm_tc_init(&s, 956, 440); dm_tc_begin(&s, 0, 90, 425); CHECK(s.joy_slot == 0); dm_tc_cancel_all(&s); /* 圆心 90,340、可起手半径 90:(90,425) 在内 | center 90,340, grab radius 90: (90,425) is inside */
dm_tc_init(&s, 956, 440); dm_tc_begin(&s, 0, 90, 425); CHECK(s.joy_slot == 0); dm_tc_cancel_all(&s); /* 起摇杆区一直到屏幕底:(90,425) 在内 | the stick-start zone reaches the bottom of the screen: (90,425) is inside */
/* iPad:底部 20 点里起手不当摇杆、松手不当点地 | iPad: a touch starting in the bottom 20 points is not treated as the stick, and its release is not treated as a ground tap */
dm_tc_set_edge_bottom(20); dm_tc_init(&s, 1366, 768);
dm_tc_begin(&s, 0, 100, 760); CHECK(s.joy_slot == DM_TC_NONE && s.finger[0].target == DM_TC_EDGE);
+36 -23
View File
@@ -117,28 +117,41 @@ static void two_fingers_same_key(void) {
dm_tc_end(&s,1); CHECK(s.buttons==0);
}
static void joystick_deadzone(void) {
/* 底座固定在静止位(667×375:圆心 90,275、半径 60):落在圆心上起手,原点 = 圆心 | the base is fixed at its rest position (667×375: center 90,275, radius 60): starting on the center, origin = center */
dm_tc_state s; dm_tc_init(&s,667,375); dm_tc_begin(&s,0,90,275);
/* 浮动底盘。667×375(k = 1、安全区 0)手算:静止位 (max(90, 0+60)+30, 375−115) = (120, 260);起摇杆区 x < 667×0.40 = 266.8 且 y > 375×0.45 = 168.75;
夹回 x ≥ 0+60 = 60、y ≤ 375−25−60 = 290。落在区里起手:圆心 = 落点,位移为零
Floating base. Worked by hand for 667x375 (k = 1, safe area 0): rest position (max(90, 0+60)+30, 375-115) = (120, 260); stick-start zone x < 667x0.40 = 266.8 and y > 375x0.45 = 168.75;
clamp x >= 0+60 = 60, y <= 375-25-60 = 290. Starting inside the zone: centre = touch point, zero displacement */
dm_tc_state s; dm_tc_init(&s,667,375); NEAR(s.layout.joy_x,120,0.001); NEAR(s.layout.joy_y,260,0.001);
NEAR(s.layout.joy_zone_r,266.8,0.001); NEAR(s.layout.joy_zone_t,168.75,0.001); NEAR(s.layout.joy_min_x,60,0.001); NEAR(s.layout.joy_max_y,290,0.001);
dm_tc_begin(&s,0,90,275);
CHECK(s.joy_slot==0); NEAR(s.joy_origin_x,90,0); NEAR(s.joy_origin_y,275,0);
CHECK(s.lx==0 && s.ly==0);
dm_tc_move(&s,0,96,275); CHECK(s.lx==0 && s.ly==0);
dm_tc_move(&s,0,96.1f,275); CHECK(s.lx>0 && s.lx<100 && s.ly==0);
dm_tc_move(&s,0,123,275); CHECK(abs(s.lx-16384)<=1 && s.ly==0);
dm_tc_end(&s,0);
/* 落在底座附近(离圆心不超过 1.5 倍半径 = 90 点):起摇杆,原点仍是圆心,一按下就按「手指相对圆心」出方向((150,275) 在圆心右 60 = 满偏) | landing near the base (no more than 1.5 × radius = 90 points from the center): the joystick starts, the origin is still the center, and from the moment of pressing the direction is "finger relative to the center" ((150,275) is 60 to the right of the center = full deflection) */
dm_tc_begin(&s,0,150,275); CHECK(s.joy_slot==0); NEAR(s.joy_origin_x,90,0); NEAR(s.joy_origin_y,275,0); CHECK(s.lx==DM_STICK_MAX && s.ly==0);
dm_tc_move(&s,0,600,275); CHECK(s.lx==DM_STICK_MAX && s.ly==0); NEAR(s.joy_origin_x,90,0); /* 拖到很远:照样识别,底座不动 | dragged very far: still recognized, the base does not move */
dm_tc_move(&s,0,90,100); CHECK(s.lx==0 && s.ly==DM_STICK_MAX); NEAR(s.joy_origin_y,275,0);
dm_tc_end(&s,0); CHECK(s.joy_slot==-1 && s.lx==0 && s.ly==0);
dm_tc_begin(&s,0,90,365); CHECK(s.joy_slot==0); dm_tc_end(&s,0); /* 正下方 90 点:刚好在内 | 90 points straight down: just inside */
dm_tc_begin(&s,0,181,275); CHECK(s.joy_slot==-1 && s.lx==0); dm_tc_end(&s,0); /* 右边 91 点:不起摇杆 | 91 points to the right: no joystick started */
dm_tc_begin(&s,0,250,150); CHECK(s.joy_slot==-1 && s.lx==0 && s.ly==0); dm_tc_move(&s,0,300,150); CHECK(s.joy_slot==-1 && s.lx==0); dm_tc_end(&s,0); /* 左侧别处:不起摇杆,拖也不变成摇杆 | elsewhere on the left: no joystick started, and dragging does not turn into a joystick either */
/* 拖远了的摇杆手指被系统取消,0.35 秒内在原处附近重新落下:接着当摇杆(原点仍是圆心);超时或离得远:不接 | a joystick finger dragged far away is cancelled by the system and lands again near the same spot within 0.35 seconds: it continues as the joystick (the origin is still the center); timed out or too far away: not picked up */
/* 区里别处:圆心跟落点;按住后拖到多远都照样识别,底盘不跟手走;松手后静止位不变 | elsewhere in the zone: the centre follows the touch point; once held, dragging any distance is still recognised and the base does not follow the finger; after release the rest position is unchanged */
dm_tc_begin(&s,0,200,200); CHECK(s.joy_slot==0); NEAR(s.joy_origin_x,200,0); NEAR(s.joy_origin_y,200,0); CHECK(s.lx==0 && s.ly==0);
dm_tc_move(&s,0,600,200); CHECK(s.lx==DM_STICK_MAX && s.ly==0); NEAR(s.joy_origin_x,200,0);
dm_tc_move(&s,0,200,25); CHECK(s.lx==0 && s.ly==DM_STICK_MAX); NEAR(s.joy_origin_y,200,0);
dm_tc_end(&s,0); CHECK(s.joy_slot==-1 && s.lx==0 && s.ly==0); NEAR(s.layout.joy_x,120,0.001);
/* 贴左下角落指 (10,370):圆心夹回 (60,290),手指在圆心左下 (−50,−80),一落下就是左下满偏 | touching down against the bottom-left corner (10,370): the centre is clamped back to (60,290), the finger is at (-50,-80) to the lower left of the centre, so it is at full lower-left deflection the moment it lands */
dm_tc_begin(&s,0,10,370); CHECK(s.joy_slot==0); NEAR(s.joy_origin_x,60,0); NEAR(s.joy_origin_y,290,0); CHECK(s.lx<0 && s.ly<0); dm_tc_end(&s,0);
dm_tc_begin(&s,0,266,169); CHECK(s.joy_slot==0); NEAR(s.joy_origin_x,266,0); NEAR(s.joy_origin_y,169,0); dm_tc_end(&s,0); /* 区的右上角以内 | just inside the zone's top-right corner */
/* 区外:不起摇杆,拖也不变成摇杆 | outside the zone: no stick starts, and dragging does not turn into a stick either */
dm_tc_begin(&s,0,267,275); CHECK(s.joy_slot==-1 && s.lx==0); dm_tc_end(&s,0);
dm_tc_begin(&s,0,100,168); CHECK(s.joy_slot==-1 && s.lx==0); dm_tc_end(&s,0);
dm_tc_begin(&s,0,300,150); CHECK(s.joy_slot==-1 && s.lx==0 && s.ly==0); dm_tc_move(&s,0,200,250); CHECK(s.joy_slot==-1 && s.lx==0); dm_tc_end(&s,0);
/* 区里很快原地松开的那一下兼作点击(落点记成点世界),按久了 / 拖开了的不算 | a quick release in place inside the zone doubles as a tap (the touch point is recorded as a world tap); held long / dragged away does not count */
{ unsigned q = s.world_tap_seq; dm_tc_begin_at(&s,0,150,250,40.0); dm_tc_end_at(&s,0,40.1); CHECK(s.world_tap_seq==q+1); NEAR(s.world_tap_x,150,0); NEAR(s.world_tap_y,250,0);
dm_tc_begin_at(&s,0,150,250,41.0); dm_tc_move_at(&s,0,200,250,41.05); dm_tc_end_at(&s,0,41.1); CHECK(s.world_tap_seq==q+1); }
/* 拖远了的摇杆手指被系统取消,0.2 秒后在离取消处 40 点的 (236,128) 重新落下((260,160) 偏 (−24,−32);已在起摇杆区上界 168.75 之外):接着当摇杆,圆心沿用取消前的 (90,275)、方向按旧圆心算;超时:不接 | the stick finger, dragged far away, is cancelled by the system and 0.2 s later touches down again at (236,128), 40 points from where it was cancelled ((260,160) offset by (-24,-32); already above the zone's upper bound 168.75): it continues as the stick, the centre stays at (90,275) from before the cancel and the direction is computed from the old centre; after the timeout: not continued */
dm_tc_begin_at(&s,0,90,275,50.0); dm_tc_move_at(&s,0,260,160,50.2); CHECK(s.lx>0 && s.ly>0); dm_tc_cancel_finger(&s,0); CHECK(s.joy_slot==-1 && s.lx==0);
dm_tc_begin_at(&s,1,265,165,50.4); CHECK(s.joy_slot==1 && s.lx>0 && s.ly>0); NEAR(s.joy_origin_x,90,0); dm_tc_cancel_finger(&s,1);
dm_tc_begin_at(&s,2,265,165,50.4+0.36); CHECK(s.joy_slot==-1); dm_tc_end_at(&s,2,51.5); /* 超过 0.35 秒 | more than 0.35 seconds */
dm_tc_begin_at(&s,1,236,128,50.4); CHECK(s.joy_slot==1 && s.lx>0 && s.ly>0); NEAR(s.joy_origin_x,90,0); NEAR(s.joy_origin_y,275,0); dm_tc_cancel_finger(&s,1);
dm_tc_begin_at(&s,2,236,128,50.4+0.36); CHECK(s.joy_slot==-1); dm_tc_end_at(&s,2,51.5); /* 超过 0.35 秒、落点在区外 | beyond 0.35 s, touch point outside the zone */
/* 取消后在区里别处重落(离取消处 140 点,不算接续):按新落点起一个新的,圆心 (265, min(300,290)) | after a cancel, touching down elsewhere in the zone (140 points from where it was cancelled, not a continuation): a new stick starts at the new touch point, centre (265, min(300,290)) */
dm_tc_begin_at(&s,0,90,275,52.0); dm_tc_move_at(&s,0,260,160,52.2); dm_tc_cancel_finger(&s,0);
dm_tc_begin_at(&s,1,265,300,52.3); CHECK(s.joy_slot==-1); dm_tc_end_at(&s,1,53.5); /* 离取消时的位置 140 点:不接 | 140 points from the position at cancellation: not picked up */
dm_tc_begin_at(&s,1,265,300,52.3); CHECK(s.joy_slot==1); NEAR(s.joy_origin_x,265,0); NEAR(s.joy_origin_y,290,0); dm_tc_end_at(&s,1,53.5);
}
static void joystick_axes(void) {
dm_tc_state s; dm_tc_init(&s,667,375); dm_tc_begin(&s,0,90,275); /* 圆心 90,275;下面各点 = 原用例整体平移 (−10, +75) | center 90,275; the points below = the original cases shifted as a whole by (−10, +75) */
@@ -308,15 +321,15 @@ static void pointer_over_disabled_target(void) {
static void world_tap(void) {
dm_tc_state s; dm_tc_init(&s,667,375); dm_tc_enable_targets(&s,(1u<<DM_TC_COUNT)-1);
dm_tc_begin_at(&s,0,400,120,10.0); dm_tc_end_at(&s,0,10.1); CHECK(s.world_tap_seq==1); NEAR(s.world_tap_x,400,0.001); NEAR(s.world_tap_y,120,0.001);
dm_tc_begin_at(&s,0,250,150,11.0); CHECK(s.joy_slot==-1); dm_tc_end_at(&s,0,11.1); CHECK(s.world_tap_seq==2); NEAR(s.world_tap_x,250,0.001); /* 左侧区域、底座以外点一下:点世界(不起摇杆) | a tap in the left area outside the base: world tap (no joystick started) */
dm_tc_begin_at(&s,0,120,250,11.5); CHECK(s.joy_slot==0); dm_tc_end_at(&s,0,11.6); CHECK(s.world_tap_seq==2); /* 落在底座上点一下:是摇杆(一按就有方向),不兼作点世界 | a tap landing on the base: it is the joystick (direction as soon as pressed), and does not double as a world tap */
dm_tc_begin_at(&s,0,120,250,12.0); dm_tc_move_at(&s,0,170,250,12.1); dm_tc_end_at(&s,0,12.2); CHECK(s.world_tap_seq==2); /* 拖了 = 摇杆 | Dragged = stick */
dm_tc_begin_at(&s,0,400,120,13.0); dm_tc_end_at(&s,0,13.6); CHECK(s.world_tap_seq==2); /* 按了 0.6 秒:不算点按 | Held for 0.6 seconds: does not count as a tap */
dm_tc_begin_at(&s,0,250,150,11.0); CHECK(s.joy_slot==-1); dm_tc_end_at(&s,0,11.1); CHECK(s.world_tap_seq==2); NEAR(s.world_tap_x,250,0.001); /* 左侧、起摇杆区以外点一下:点世界(不起摇杆) | a tap on the left side outside the stick-start zone: a world tap (no stick) */
dm_tc_begin_at(&s,0,120,250,11.5); CHECK(s.joy_slot==0); dm_tc_end_at(&s,0,11.6); CHECK(s.world_tap_seq==3); NEAR(s.world_tap_x,120,0.001); NEAR(s.world_tap_y,250,0.001); /* 起摇杆区里很快原地松开:起过摇杆(位移为零),也兼作点世界 | a quick release in place inside the stick-start zone: the stick did start (zero displacement), and it also counts as a world tap */
dm_tc_begin_at(&s,0,120,250,12.0); dm_tc_move_at(&s,0,170,250,12.1); dm_tc_end_at(&s,0,12.2); CHECK(s.world_tap_seq==3); /* 拖了 = 摇杆 | Dragged = stick */
dm_tc_begin_at(&s,0,400,120,13.0); dm_tc_end_at(&s,0,13.6); CHECK(s.world_tap_seq==3); /* 按了 0.6 秒:不算点按 | Held for 0.6 seconds: does not count as a tap */
const dm_tc_target *m=&s.layout.target[DM_TC_MAIN];
dm_tc_begin_at(&s,0,m->x,m->y,14.0); CHECK(s.buttons==m->button); dm_tc_end_at(&s,0,14.1); CHECK(s.world_tap_seq==2); /* 点主按钮:发键,不算点世界 | Tapping the main button: sends the key, does not count as a world tap */
dm_tc_set_joy_block(&s,1); dm_tc_begin_at(&s,0,120,250,20.5); CHECK(s.joy_slot==-1 && s.lx==0 && s.ly==0); dm_tc_end_at(&s,0,20.6); CHECK(s.world_tap_seq==3); NEAR(s.world_tap_x,120,0.001); /* 讲话文字框单独开着:同一处点一下不起摇杆、没有方向,只当一次点击 | speech text box open on its own: a tap in the same place starts no stick and gives no direction, it is just one click */
dm_tc_set_joy_block(&s,0); dm_tc_begin_at(&s,0,120,250,21.5); CHECK(s.joy_slot==0); dm_tc_end_at(&s,0,21.6); CHECK(s.world_tap_seq==3); /* 文字框关了:照旧是摇杆 | text box closed: stick as usual */
dm_tc_set_navigation_mode(&s,1); dm_tc_begin_at(&s,0,400,120,16.0); dm_tc_end_at(&s,0,16.1); CHECK(s.world_tap_seq==3); /* 面板态不记 | Not recorded in panel state */
dm_tc_begin_at(&s,0,m->x,m->y,14.0); CHECK(s.buttons==m->button); dm_tc_end_at(&s,0,14.1); CHECK(s.world_tap_seq==3); /* 点主按钮:发键,不算点世界 | Tapping the main button: sends the key, does not count as a world tap */
dm_tc_set_joy_block(&s,1); dm_tc_begin_at(&s,0,120,250,20.5); CHECK(s.joy_slot==-1 && s.lx==0 && s.ly==0); dm_tc_end_at(&s,0,20.6); CHECK(s.world_tap_seq==4); NEAR(s.world_tap_x,120,0.001); /* 讲话文字框单独开着:同一处点一下不起摇杆、没有方向,只当一次点击 | speech text box open on its own: a tap in the same place starts no stick and gives no direction, it is just one click */
dm_tc_set_joy_block(&s,0); dm_tc_begin_at(&s,0,120,250,21.5); CHECK(s.joy_slot==0); dm_tc_end_at(&s,0,21.6); CHECK(s.world_tap_seq==5); /* 文字框关了:起摇杆,短按照样兼作点世界 | text box closed: the stick starts, and a short press still doubles as a world tap */
dm_tc_set_navigation_mode(&s,1); dm_tc_begin_at(&s,0,400,120,16.0); dm_tc_end_at(&s,0,16.1); CHECK(s.world_tap_seq==5); /* 面板态不记 | Not recorded in panel state */
}
/* 面板外点按 = 按 B 到面板关掉为止:第一下在 tick 里发;面板还开着,0.3 秒后再发;面板关了就不再发;至多 3 下 | Tap outside the panel = press B until the panel closes: the first press is sent in tick; if the panel is still open, send again 0.3 seconds later; once the panel is closed no more are sent; at most 3 presses */
static void pointer_outside_close(void) {
@@ -424,7 +437,7 @@ static void safe_insets(void) {
dm_tc_set_safe_insets(62, 62); dm_tc_layout_make(&b, 956, 440); dm_tc_set_safe_insets(0, 0);
NEAR(a.target[DM_TC_MAIN].x, 900, 0.001); NEAR(b.target[DM_TC_MAIN].x, 854, 0.001); NEAR(b.target[DM_TC_MAIN].y, a.target[DM_TC_MAIN].y, 0.001);
for (int i = DM_TC_SKILL1; i <= DM_TC_SKILL4; ++i) { NEAR(a.target[i].x - b.target[i].x, 46, 0.001); NEAR(a.target[i].y, b.target[i].y, 0.001); CHECK(b.target[i].x + b.target[i].r <= 894.001f); }
NEAR(a.swap.x - b.swap.x, 46, 0.001); NEAR(a.joy_x, 90, 0.001); NEAR(b.joy_x, 122, 0.001); CHECK(b.joy_x - b.joy_radius >= 61.999f);
NEAR(a.swap.x - b.swap.x, 46, 0.001); NEAR(a.joy_x, 120, 0.001); NEAR(b.joy_x, 152, 0.001); NEAR(b.joy_min_x, 122, 0.001); NEAR(a.joy_y, 325, 0.001); NEAR(a.joy_max_y, 355, 0.001); /* 静止位 max(90, 安全区 + 60) + 30、440 − 115;夹回界 安全区 + 60、440 − 25 − 60 | rest position max(90, safe area + 60) + 30, 440 - 115; clamp bounds safe area + 60, 440 - 25 - 60 */
dm_tc_layout c; dm_tc_layout_make(&c, 956, 440); NEAR(c.target[DM_TC_MAIN].x, 900, 0.001);
}
/* 换组键:956×440 下主键中心 (900,358),换组键在技能一正下方 (900−112, 358+52) = (788,410),半径 22;不与技能一(中心 (788,358) 半径 26)重叠、不出屏 | Set-switch button: at 956×440 the main button center is (900,358), the set-switch button is directly below skill one at (900−112, 358+52) = (788,410), radius 22; it does not overlap skill one (center (788,358), radius 26) and does not go off screen */
+8 -1
View File
@@ -71,6 +71,13 @@ with tempfile.TemporaryDirectory() as t:
# dm_rift_ui.c
lp,lt=touch_layout.read_layout(romfs,'controller/messagelogpanelhd.json'); o=os.path.join(tpad,'pad_rift.json'); open(o,'w',encoding='utf-8').write(touch_layout._rift_panel(lt)[0]); PR[lp.lower()]=o
PR.update(merc_slots.build_pad(romfs,tpad)) # 手柄版佣兵面板:同样加六个装备位 | Controller layout mercenary panel: likewise add six equipment slots
# 手柄版职业选择页:八个职业的点击矩形同样改成按实际站位分的竖条(touch_layout.CLASS_STRIPS,原因见那里)。手柄用左右键选、原版没暴露;
# Mac App 是手柄版布局 + 鼠标,点德鲁伊出术士、右半边四个职业都错一格
# Gamepad-layout class selection page: the click rectangles of the eight classes are likewise changed to vertical strips split by where the characters actually stand (touch_layout.CLASS_STRIPS, see there for the reason). A gamepad selects with left / right and the original never exposed this;
# the Mac App is the gamepad layout plus a mouse, where clicking the Druid selected the Warlock and all four classes on the right half were off by one
lp,lt=touch_layout.read_layout(romfs,'controller/console/charactercreatepanelhd.json')
for nm,x0,x1 in touch_layout.CLASS_STRIPS: lt=touch_layout.set_rect(lt,nm,x0,450,x1-x0,1300)
o=os.path.join(tpad,'pad_charcreate.json'); open(o,'w',encoding='utf-8').write(lt); PR[lp.lower()]=o
PR.update(touch_layout.build_ingame(romfs,tpad,touch_layout.PAD_VENDOR,present=False)[0]) # 手柄版商人页:刷新货架钮 | Controller layout vendor page: the refresh shop stock button
lp,lt=touch_layout.read_layout(romfs,'controller/console/mainmenupanelhd.json'); o=os.path.join(tpad,'pad_mainmenu.json'); open(o,'w',encoding='utf-8').write(touch_layout.pad_mainmenu(lt)); PR[lp.lower()]=o # 手柄版主菜单:构建号与新版本提示 | Controller layout main menu: build number and new version notice
lp,lt=touch_layout.read_layout(romfs,'controller/console/mainmenubuttonribbonhd.json'); o=os.path.join(tpad,'pad_ribbon.json'); open(o,'w',encoding='utf-8').write(touch_layout.pad_ribbon(lt)); PR[lp.lower()]=o # 手柄版主菜单按钮栏:拿掉「电影动画」 | Controller layout main menu button ribbon: remove 「电影动画」(Cinematics)
@@ -151,7 +158,7 @@ with tempfile.TemporaryDirectory() as t:
PADLAY={k:v for k,v in PR.items() if touch_path(k)} # 手柄版只取布局(数据表、图与触屏版同一份) | The controller version takes only layouts (data tables and images are the same copy as the touch version)
# 手柄专用清单:手柄模式下不是原版字节的布局就这几份,一份不许多、一份不许少(改上面某一行时把相邻一行整行替掉过,商人页的刷新钮就从包里掉了)
# Controller-only list: these are the only layouts that are not original bytes in controller mode, not one more and not one fewer (once, when a line above was edited, the adjacent line was replaced whole, and the vendor page's refresh button dropped out of the package)
PAD_PAGES=('controller/bankexpansionlayouthd.json','controller/console/characteroptionspanelhd.json','controller/console/mainmenubuttonribbonhd.json','controller/console/mainmenupanelhd.json','controller/console/settingspanelhd.json','controller/console/switch/playerinventoryexpansionlayouthd.json','controller/console/videooptionspanelhd.json',
PAD_PAGES=('controller/bankexpansionlayouthd.json','controller/console/charactercreatepanelhd.json','controller/console/characteroptionspanelhd.json','controller/console/mainmenubuttonribbonhd.json','controller/console/mainmenupanelhd.json','controller/console/settingspanelhd.json','controller/console/switch/playerinventoryexpansionlayouthd.json','controller/console/videooptionspanelhd.json',
'controller/controlleroverlayhd.json','controller/hirelinginventorypanelhd.json','controller/hudmonsterhealthhd.json','controller/messagelogpanelhd.json','controller/pauselayoutgardenhd.json','controller/pauselayouthd.json','controller/vendorpanellayouthd.json')
if sorted(k[len(LAY):] for k in PADLAY)!=sorted(PAD_PAGES): raise SystemExit('gen_romfs_overlay:手柄专用布局与清单 PAD_PAGES 不一致:多 %s,少 %s' % (sorted(set(k[len(LAY):] for k in PADLAY)-set(PAD_PAGES)), sorted(set(PAD_PAGES)-set(k[len(LAY):] for k in PADLAY))))
def emit(repl, dst, tag, prebuilt=None): # repl → 覆盖层(新 .build.config + 一个新数据档)写到 dst/data | repl → overlay (a new .build.config + one new data archive) written to dst/data
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
# 老接口版的工程描述:project_m3.py <project.yml> <输出.yml> [free] (run.sh 在 DM_IOS_M3=1 时调)
# 第三个参数 free = 输入已经过了免费档(tools/project_free.py,DM_FREE_ACCOUNT=1 同时设着):资源下载扩展那五处免费档已去掉,这里要求一处都不剩
# 只改主程序三处:部署目标 26.0 → 18.0;编译参数加 -DDM_NVN_M3=1(图形后端不用 Metal 4,见 gfx/nvn/nvn_mtl.m);
# 处理器基线 a18 → a14(iOS 18 能装的机器里,内存够跑这个游戏的最老是 A14;宿主汇编要的 LSE 原子指令 A11 起就有)。
# 资源下载扩展(RomfsDownloader,只服务苹果托管资源包,部署目标 iOS 26.4)不带:扩展的最低系统高于主程序的包在老系统上装不装得上没人验过,
# 老接口版的资源本来也不走托管资源包(内测直装走自己的下载地址 / 手动拷,公开版用户自备)。去掉的三样与免费账号档相同(tools/project_free.py):
# 扩展目标、主程序对它的依赖、Info.plist 里托管资源包的三个键;主程序里见不到这三个键就不碰托管资源包。
# 每处都要求恰好命中一次,工程描述改了格式就在这里失败,不悄悄出一个没改到的工程。
# Project description for the older-API build: project_m3.py <project.yml> <output.yml> [free] (called by run.sh when DM_IOS_M3=1)
# The third argument free = the input has already been through the free tier (tools/project_free.py, with DM_FREE_ACCOUNT=1 set at the same time): the five places of the resource-download extension are already removed by the free tier, and here none may remain
# Only three things of the main program change: deployment target 26.0 -> 18.0; compile flags gain -DDM_NVN_M3=1 (the graphics backend does not use Metal 4, see gfx/nvn/nvn_mtl.m);
# processor baseline a18 -> a14 (among the devices that can install iOS 18, the oldest with enough memory for this game is the A14; the LSE atomic instructions the host assembly needs exist from the A11).
# The resource-download extension (RomfsDownloader, serving only Apple-hosted asset packs, deployment target iOS 26.4) is left out: whether a package whose extension has a higher minimum system than the main program installs on an older system has not been verified by anyone,
# and the older-API build does not use hosted asset packs for resources anyway (public users bring their own). The three things removed are the same as for the free-account tier (tools/project_free.py):
# the extension target, the main program's dependency on it, and the three hosted-asset-pack keys in Info.plist; without these three keys the main program does not touch hosted asset packs.
# Each place must match exactly once, so that a change in the format of the project description fails here instead of quietly producing a project that was not changed.
import sys
src, dst = sys.argv[1:3]; free = sys.argv[3:4] == ['free']; s = open(src).read()
def one(old, new):
global s
if s.count(old) != 1: sys.exit(f"🔴 project_m3:工程描述里「{old[:40]}」应恰好出现 1 次,实际 {s.count(old)} 次")
s = s.replace(old, new)
one(' iOS: "26.0"', ' iOS: "18.0"')
one('OTHER_CFLAGS: $(inherited) -mcpu=apple-a18', 'OTHER_CFLAGS: $(inherited) -mcpu=apple-a14 -DDM_NVN_M3=1')
import re
L = s.split('\n'); out, n_ba, n_dep, n_tgt, i = [], 0, 0, 0, 0
while i < len(L):
l = L[i]
if re.match(r'^ *(BAAppGroupID|BAHasManagedAssetPacks|BAUsesAppleHosting):', l): n_ba += 1; i += 1; continue
if re.match(r'^ *- target: RomfsDownloader\b', l): n_dep += 1; i += 1; continue
if re.match(r'^ RomfsDownloader:\s*$', l): # 整个目标块:到下一个同级键为止 | the whole target block: up to the next key at the same level
n_tgt += 1; i += 1
while i < len(L) and not re.match(r'^ \S', L[i]) and not re.match(r'^\S', L[i]): i += 1
continue
out.append(l); i += 1
want = (0, 0, 0) if free else (3, 1, 1)
if (n_ba, n_dep, n_tgt) != want: sys.exit(f"🔴 project_m3:资源下载扩展没去干净(托管资源包键 {n_ba} / {want[0]}、依赖 {n_dep} / {want[1]}、扩展目标 {n_tgt} / {want[2]}{';输入应已过免费档' if free else ''})")
if any('RomfsDownloader' in l and not l.lstrip().startswith('#') for l in out): sys.exit("🔴 project_m3:去掉之后工程描述里还有 RomfsDownloader")
open(dst, 'w').write('\n'.join(out))
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
# 符文之语清单「需要等级」全量核对:rw_lvcheck.py <DM_TEST_RW_LVDUMP 导出的文件> <原版表目录(含 weapons.txt armor.txt misc.txt runes.txt)>
# 一、整张物品表逐行:宿主读到的需求等级(导出文件,物品码<TAB>值)对原版三张表的 levelreq;
# 二、每个可做成的符文之语:按宿主读数取各符文需求等级的最大值,对按原版表算的同一个量。任何一处不等退出码 1。
# Full check of "required level" in the runeword list: rw_lvcheck.py <file exported by DM_TEST_RW_LVDUMP> <directory of original tables (with weapons.txt armor.txt misc.txt runes.txt)>
# One, the whole item table row by row: the required level the host read (the exported file, item code<TAB>value) against levelreq in the three original tables;
# Two, every runeword that can be made: the maximum of the runes' required levels by the host's readings against the same quantity computed from the original tables. Any mismatch exits with code 1.
import sys,csv,os
dump,d=sys.argv[1],sys.argv[2]
got={}
for l in open(dump,encoding='latin-1'):
c,v=l.rstrip('\n').split('\t')
if c: got.setdefault(c,int(v))
def rows(n): return list(csv.DictReader(open(os.path.join(d,n),encoding='latin-1'),delimiter='\t'))
want={}; diff_cols=0
for n in ('weapons.txt','armor.txt','misc.txt'):
for r in rows(n):
c=r.get('code','').strip()
if not c or c in want: continue
want[c]=int(r['levelreq'] or 0); diff_cols+=(r.get('level') or '0')!=(r['levelreq'] or '0')
bad=[(c,got.get(c),w) for c,w in want.items() if c in got and got[c]!=w]; miss=[c for c in want if c not in got]
print(f'物品表:原版三张表 {len(want)} 个物品码,导出 {len(got)} 个;逐行对上 {sum(1 for c in want if got.get(c)==want[c])},不等 {len(bad)},导出里没有的 {len(miss)};其中物品等级 ≠ 需求等级的物品 {diff_cols} 个(这些行分得出两列)')
for c,g,w in bad[:20]: print(f' 不等:{c} 读到 {g} 原版 {w}')
rb=0; n=0
for r in rows('runes.txt'):
if r.get('complete')!='1': continue
rs=[r[f'Rune{i}'] for i in range(1,7) if r.get(f'Rune{i}')]
if not rs: continue
n+=1; a=max(got.get(c,-1) for c in rs); b=max(want.get(c,-1) for c in rs)
if a!=b: rb+=1; print(f' 符文之语 {r["Name"]}({r.get("*Rune Name","")})符文 {rs}:读到 {a} 原版 {b}')
print(f'符文之语:可做成的 {n} 个,符文部分的需要等级不等 {rb} 个')
sys.exit(1 if bad or rb else 0)
+2 -1
View File
@@ -14,7 +14,8 @@ dm/ios/tools/dm_i18n.py *
dm/host/dm_i18n* *
dm/ios/tools/annot_strings.py k j rw1 rw2 kbb vt1
dm/host/dm_textbox* k j rw1 rw2 kbb vt1
dm/host/dm_runeword* k j rw1 rw2 rwp rwd d
dm/host/dm_rwlv* k j rw1 rw2 rwp rwd d rwlv
dm/host/dm_runeword* k j rw1 rw2 rwp rwd d rwlv
dm/host/dm_vault* vf1 vf2 vt1 pg1 pg2 c s sb t u d cb
dm/host/dm_pages* pg1 pg2 vt1 c s sb
dm/ios/tools/wide_stash.py vf1 vf2 vt1 pg1 pg2 c s sb t u d cb
1 # 改动文件 → 受影响的 uireg 局(uireg_pick.py 读;合入门槛 = 受影响局 + 核心局 + Mac 冒烟,整表只在出大包前 / 夜里浸泡)
14 dm/host/dm_i18n*
15 dm/ios/tools/annot_strings.py
16 dm/host/dm_textbox*
17 dm/host/dm_runeword* dm/host/dm_rwlv*
18 dm/host/dm_runeword*
19 dm/host/dm_vault*
20 dm/host/dm_pages*
21 dm/ios/tools/wide_stash.py
+9 -1
View File
@@ -1084,7 +1084,15 @@ def groups():
LISTOK=r"符文之语:长按[^\n]*→ 清单 [1-9]\d* 行"
def anyl(p): return lambda s,b: ("通:" if re.search(p,b+s) else "不通:")+"整局日志"
# rw1:背包里符文齐——长按 1 孔软帽不开清单;长按 2 孔软帽开清单;点清单外关;再长按、点「一键合成」成型,两枚符文离开背包
# rw1: all runes are in the inventory - long-pressing the 1-socket cap does not open the list; long-pressing the 2-socket cap opens the list; tapping outside the list closes it; long-press again and tap 「一键合成」(Craft) to form it, and the two runes leave the inventory
# rwlv 局:清单里的「需要等级」取底材的需求等级,不是物品等级(线上缺陷:塔盔需求 59、物品等级 79,清单整页显示 79)。
# 现场:背包里 7 顶塔盔(uhm,白装孔数随机但逐局相同),长按其中带孔的一顶;2 孔塔盔的首行是「知识」(欧特 21 + 索尔 27)→ max(59, 27) = 59
# rw1: all runes in the inventory - a long press on a 1-socket Cap does not open the list; a long press on a 2-socket Cap opens it; a tap outside the list closes it; long press again and tap "Craft" to make it, and the two runes leave the inventory
# rwlv run: "required level" in the list takes the base item's required level, not its item level (reported defect: the Spired Helm requires 59 with item level 79, and the whole page of the list showed 79).
# Scene: 7 Spired Helms in the inventory (uhm; socket counts of white items are random but the same every run), long press one with sockets; the first row for a 2-socket Spired Helm is Lore (Ort 21 + Sol 27) -> max(59, 27) = 59
g=G("rwlv","DM_TEST_GIVE=uhm:2:7@60 DM_TEST_GIVE_INV=1"); g.sect("rwlv",0); g.enter(); g.wait(2.0); g.tap("@menu",1.4)
g.item("长按背包里带孔的塔盔","弹清单,需要等级 59(看截图:每行都是 59)",r"长按 uhm[^\n]*需要等级 59",r"长按 uhm[^\n]*需要等级 79|【红】符文之语"); g.hold(395,267); g.wait(1.0); g.shot()
g.item("点清单外","清单关掉",r"清单外 → 关清单|清单关闭"); g.tap(P(120,200),1.5); g.shot()
gs.append(g)
g=G("rw1",RWE+" DM_TEST_RW_LIST=75"); g.sect("rw1",0); g.enter(); g.wait(2.0); g.tap("@menu",1.4)
g.item("背包布局","软帽、符文在 k 局同样的位置(看截图)",None); g.shot()
g.item("长按 1 孔软帽","不开清单(1 孔帽子没有能做的符文之语)",None,LISTOK); g.hold(376,228); g.wait(1.0); g.shot()