diff --git a/dm/host/dm_i18n_tab.h b/dm/host/dm_i18n_tab.h index 4b4571e..84c3bbb 100644 --- a/dm/host/dm_i18n_tab.h +++ b/dm/host/dm_i18n_tab.h @@ -137,6 +137,11 @@ static const struct { const char *k, *zh, *en; } k_dm_i18n[] = { { "dmDlProgress", "正在下载游戏资源\n%.2f / %.2f GB(%.0f%%) %.1f MB/s", "Downloading game resources\n%.2f / %.2f GB (%.0f%%) %.1f MB/s" }, { "dmDlPaused", "下载已暂停(检查网络),恢复后自动继续", "Download paused (check your network). It resumes automatically." }, { "dmDlPackWait", "系统还在准备资源包,完成后自动继续", "The system is still preparing the resource pack. It continues automatically." }, + { "dmDlInstalling", "下载完成,系统正在安装资源包\n可能要几分钟,请保持本 App 在前台\n资源包 %.2f GB,本机可用 %.2f GB", "Download complete. The system is installing the resource pack.\nThis can take a few minutes. Keep this app open.\nPack %.2f GB, %.2f GB free on this device" }, + { "dmDlInstallSpace", "下载完成,但本机空间不够系统安装资源包\n资源包 %.2f GB,%@ 现在可用 %.2f GB,至少还差 %.2f GB\n请在「设置 → 通用 → %@ 储存空间」清理,清理后自动继续", "Download complete, but there is not enough space to install the resource pack.\nPack %.2f GB; this %@ has %.2f GB free, at least %.2f GB more needed.\nFree up space in Settings → General → %@ Storage. It continues automatically." }, + { "dmDlPackSlow", "系统安装资源包已超过 %d 分钟还没完成\n可以继续等,也可以点「改用直接下载」从下载站下载资源(断点续传)", "The system has been installing the resource pack for over %d minutes.\nYou can keep waiting, or tap \"Download Directly\" to get the resources from our download site (resumable)." }, + { "dmDlPackSlowNoDl", "系统安装资源包已超过 %d 分钟还没完成\n可以继续等;也可以点「分享诊断日志」把日志发给我们", "The system has been installing the resource pack for over %d minutes.\nYou can keep waiting, or tap \"Share Diagnostics\" to send us the log." }, + { "dmDlUseDirect", "改用直接下载", "Download Directly" }, { "dmDlNotReady", "游戏资源还不能用\n%@\n处理后点重试", "Game resources are not ready\n%@\nFix this, then tap Retry" }, { "dmDlWill", "将下载游戏资源:还要下 %@(共 %.1f GB)", "Downloading game resources: %@ remaining (%.1f GB total)" }, { "dmDlNotStarted", "%@游戏资源下载没开始:%@\n%@\n也可以从内测页手动下载资源包,放进「我的 iPhone → D2R Mobile」", "%@The resource download could not start: %@\n%@\nYou can also download the resource pack from the beta page and put it in \"On My iPhone → D2R Mobile\"" }, @@ -210,6 +215,7 @@ static const struct { const char *k, *zh, *en; } k_dm_i18n[] = { { "dmRiftSayInvader", "强敌逼近!", "A powerful foe approaches!" }, { "dmRiftSayInvaderGone", "闯入者退去了", "The intruder withdraws" }, { "dmRiftSayGuardians", "进度已满:两位守护者现身!", "Two Rift Guardians appear!" }, + { "dmRiftSayWave", "守护者第 %d 波现身(共 %d 波)", "Guardian wave %d of %d" }, { "dmRiftSayGuardian", "进度已满:守护者现身!", "The Rift Guardian appears!" }, { "dmElyToaGround", "背包已满,赦免之证掉在脚边", "Inventory full: Token of Absolution dropped" }, { "dmMercSlotLocked", "通关地狱后打通秘境10层解锁", "Clear Greater Rift Level 10 to unlock" }, @@ -264,6 +270,7 @@ static const struct { const char *k, *zh, *en; } k_dm_i18n[] = { { "dmRiftHudNext", "下次第 %d 层", "Next: Level %d" }, { "dmRiftHudTop", "已通关最高层", "Highest level cleared" }, { "dmRiftHudOver", "已超时:打完仍有掉落,不计通关", "Overtime: drops, no clear" }, + { "dmRiftHudKillWave", "守护者 第 %d/%d 波(%d/%d)", "Guardians %d/%d (%d/%d)" }, { "dmRiftHudKillN", "击败守护者(%d/%d)", "Slay the Guardians (%d/%d)" }, { "dmRiftHudOverKill", "已超时:击败守护者仍有掉落", "Overtime: slay it for drops" }, { "dmRiftHudOverKillN", "已超时:击败守护者(%d/%d)仍有掉落", "Overtime: slay %d/%d for drops" }, diff --git a/dm/host/dm_rift.c b/dm/host/dm_rift.c index 00ffc06..10f912a 100644 --- a/dm/host/dm_rift.c +++ b/dm/host/dm_rift.c @@ -99,8 +99,10 @@ static void say(const char *key, ...) { char line[160], full[180]; va_list ap; v enum { ST_IDLE, ST_RUN, ST_DONE }; static struct { _Atomic int st; int tier, maps[3], nmaps, cur; // 本次层数、串起来的图、正在第几张 | This rift's level, the chained maps, which map we are on - _Atomic int gdead, gtotal; // 守护者:已倒下几位 / 本场已刷出几位(顶部条用) | Guardians: how many have fallen / how many have been spawned this run (for the top bar) + _Atomic int gdead, gtotal; // 守护者:当前这一波已倒下几位 / 这一波刷出几位(顶部条用) | Guardians: how many of the current wave are down / how many this wave spawned (for the top bar) + int nwave, wave, wcls[3][2], wn[3], whp[3], wdm[3]; uint32_t wave_t; // 守护者分几波(95 层起 2 波、100 层 3 波)、当前第几波(0 起)、各波的类号 / 人数 / 生命与伤害系数(×1000)、上一波全倒那一拍(0 = 不在两波之间) | how many Guardian waves (2 from level 95, 3 at level 100), the current wave (from 0), each wave's class ids / count / life and damage factors (x1000), the tick the previous wave was all down (0 = not between two waves) _Atomic int score, need; uint64_t t0_ns; _Atomic int timeout, guard_dead; // 分数(客户端加)、开局时刻(客体时钟)、超时、守护者已死 | Score (added by the client), start time (guest clock), timed out, guardian dead + int su_order[43], su_next, su_cnt; uint32_t su_live[3], su_seen[3], su_near[3], su_last; // 特殊精英(75 层起):本场的出场次序(池洗过的牌)、下一位、已放几组;在场各组本体的单位 id、最后一次找到它的拍、最后一次离玩家 60 格以内的拍、上次放组的拍 | special elites (from level 75): this run's order of appearance (the shuffled pool), the next one, how many groups placed; for each group present, the body's unit id, the tick it was last found, the tick it was last within 60 tiles of the player; the tick of the last placement int inv_n, inv_cls[2], inv_pct[2], inv_st[2]; uint32_t inv_id[2], inv_t[2]; // 闯入首领(80 层起):本场几位、各自类号、在进度百分之几闯入、状态(0 未到 / 1 已预警 / 2 在场 / 3 已死 / 4 作罢)、单位 id、预警那一拍 | Invading bosses (from level 80): how many this run, their class ids, at what percentage of progress they invade, state (0 not yet / 1 warned / 2 present / 3 dead / 4 called off), unit id, the tick of the warning uint32_t guard, guards[3]; int guard_cls, gcls[3], nplan, inc; // 守护者:guards[] 各位的单位 id(guard = 第一位,非 0 即「已刷出」)、gcls[] 开局抽好的类号、nplan 本场几位;inc 成功涨了几层 | Guardians: guards[] unit id of each (guard = the first, non-zero meaning "spawned"), gcls[] class ids drawn at the start, nplan how many in this run; inc how many levels were gained on success int players_old; // 开局前的 /players 档 | The /players setting from before the start of the run @@ -302,7 +304,7 @@ int dm_rift_hud(dm_rift_hud_t *o) { o->secs_left = st == ST_DONE ? g_left_done : RIFT_SECS - el; o->done = st == ST_DONE; o->guardian = K.guard != 0 && !atomic_load(&K.guard_dead); o->inc = K.inc; o->next = next_tier(); o->overtime = rift_overtime(); // 第二行写哪一句在这里定(一个来源):超时优先说明「已超时」,守护者在场就把「击败守护者」合进同一句;两位以上带(已倒 / 总数) // Which sentence the second line shows is decided here (one source): overtime takes priority with "Overtime", and when Guardians are present "Slay the Rift Guardian" is merged into the same sentence; with two or more it carries (fallen / total) - o->gdead = atomic_load(&K.gdead); o->gtotal = atomic_load(&K.gtotal); + o->gdead = atomic_load(&K.gdead); o->gtotal = atomic_load(&K.gtotal); o->wave = K.wave + 1; o->nwave = K.nwave; o->goal = o->overtime ? (o->guardian ? (o->gtotal >= 2 ? 5 : 4) : 3) : o->guardian ? (o->gtotal >= 2 ? 2 : 1) : 0; return 1; } @@ -327,7 +329,49 @@ static int hi_duo_x1000(int which) { int t = K.tier < 75 ? 75 : K.tier > 100 ? 1 // not killed by damage; the same with or without the quest-event gate; the control pair (Duriel + Diablo) shows nothing of the kind. It appears to come with her original death sequence; that code has not been read. A single Guardian (level 74 and below) is still drawn from all five static const int k_duo[] = { 211, 242, 243, 544 }; static int g_entry_lv, g_entry_x, g_entry_y; // 玩家进当前这张秘境图时的落点(退场找不到远处空地时的兜底去处:一定可达) | where the player entered the current rift map (the fallback destination when no distant open ground is found for leaving: always reachable) -static uint32_t g_inv_gone[2]; static int g_inv_gone_xy[2][2]; // 已退场的闯入首领:单位 id(等它所在的房间被游戏卸载后,把它那条存档记录改成不还原;见 inv_gone_pump)与退场落点 | an invading boss that has left: its unit id (once the game unloads the room it is in, its saved record is changed to do-not-restore; see inv_gone_pump) and where it was sent +// ---- 特殊精英(75 层起;设计稿第二十四节):层数越高原生怪越少、特殊精英越多,90 层起随机生成的原生怪为 0。 +// 池:超级金怪表(66 行)里去掉带任务掉落 / 固定场地 / 脚本的 23 行(设计稿第二十三节;按原版常识圈的),剩 43 行,女伯爵(行 6)在内。掉落一律照原版。 +// 放法:不在开局定点,跟着玩家推进一组一组放——在场组数低于上限、玩家 40 格内敌对单位少于 SU_NEAR 只时,在玩家前方约 70 格的空地用原版函数 +// main+0x69b310(游戏, 房间, x, y, 行号, 0) 连随从一起刷一组(第六个参数含义没查到,取 0 的依据是探路与验收轮的局)。守护者现身后不再放新的。 +// 它们走现有的「客户端见到 → 认作敌对 → 按层改属性 → 计分(本体 15、随从 2)」流程;本体(怪物数据带超级独特标志的,含地图自带的)生命另乘 SU_HP_X,到软顶为止; +// 我们刷的组里的随从生命另乘 SU_MINION_X1000 ÷ 1000。两个系数按「一场的生命和 ≈ 74 层一场 × 层倍率之比」校(设计稿第二十五节):池里高幕的行多、随从按原生等级起算偏肉。 +// 追击:在场的本体离玩家 80 格以外满 5 秒,挪到玩家前方约 70 格——不会被甩在卸载的房间里占着名额,玩家不动它们也会找上来。 +// 两个距离都按「屏幕外」取(推算:一格横向约 16 像素、纵向约 8 像素,1952×900 的画面半宽约 61 格、半高约 56 格;没用截图核),玩家看不到它消失、也看不到它出现 +// 本场有巴尔(守护者或闯入)时不抽随从 9 只的三行(24、36、38):巴尔自己召的触手已占同屏余量。 +// 总开关 DM_RIFT_HI=0;测试开关 DM_RIFT_TEST_HI=su(低层强开)、DM_RIFT_TEST_SUROWS=<行号>,…(指定出场次序)、DM_RIFT_TEST_NAT=<百分数>(指定原生怪比例) +// ---- Special elites (from level 75; design draft section 24): the higher the level, the fewer native monsters and the more special elites; from level 90 randomly generated native monsters are 0. +// Pool: the super unique table (66 rows) minus the 23 rows with quest drops / fixed locations / scripts (design draft section 23; picked by common knowledge of the original), leaving 43 rows, the Countess (row 6) included. Drops always follow the original. +// Placement: not at fixed points at the start, but one group at a time as the player advances - when the number of groups present is below the limit and there are fewer than SU_NEAR hostile units within 40 tiles of the player, a group is spawned with its minions on open ground about 70 tiles ahead of the player with the original function +// main+0x69b310(game, room, x, y, row, 0) (the meaning of the sixth argument was not found; 0 is used on the basis of the exploratory and acceptance runs). No new ones are placed after the Guardians appear. +// They go through the existing "client sees it -> treated as hostile -> attributes scaled by level -> scored (body 15, minion 2)" flow; the body (monster data with the super unique flag, including ones placed by the map) has its life additionally multiplied by SU_HP_X, up to the soft cap; +// minions in the groups we spawned have their life additionally multiplied by SU_MINION_X1000 / 1000. Both factors are calibrated so that "total life in one run ~= one level-74 run x ratio of level multipliers" (design draft section 25): the pool has many high-act rows, and minions starting from their native level are on the tanky side. +// Pursuit: a body present more than 80 tiles from the player for 5 seconds is moved to about 70 tiles ahead of the player - it is not left behind in an unloaded room holding a slot, and comes to the player even if the player stays put. +// Both distances are chosen to be "off screen" (estimate: one tile is about 16 pixels horizontally and about 8 vertically; a 1952x900 view is about 61 tiles half-wide and about 56 tiles half-high; not checked with screenshots), so the player sees it neither disappear nor appear +// When this run has Baal (as Guardian or invader), the three rows with 9 minions (24, 36, 38) are not drawn: the tentacles Baal summons himself already use up the on-screen headroom. +// Master switch DM_RIFT_HI=0; test switches DM_RIFT_TEST_HI=su (force on at low levels), DM_RIFT_TEST_SUROWS=,... (set the order of appearance), DM_RIFT_TEST_NAT= (set the native monster share) +#define SU_NEAR 12 +#define SU_HP_X 3 +#define SU_MINION_X1000 800 // 特殊精英的随从生命另乘 0.8 | special elite minions' life additionally x0.8 +static uint32_t g_su_min[64]; static unsigned g_su_min_w; // 我们刷的特殊精英组里的随从(单位 id):刷出当拍在本体 15 格内找新单位记下 | minions in the special elite groups we spawned (unit ids): on the tick of spawning, new units within 15 tiles of the body are recorded +static int su_minion(uint32_t id) { for (int i = 0; i < 64; i++) if (id && g_su_min[i] == id) return 1; return 0; } +#define SU_HP_SOFT 225000 // 本体生命乘 SU_HP_X 的软顶:× 本层总倍率,90 层约 100 万点(读数:不设顶时攻城兽那一行 383 万) | soft cap for multiplying body life by SU_HP_X: x this level's total multiplier, about 1 million points at level 90 (reading: without a cap the siege beast row reached 3.83 million) +static int su_nat_pct(int tier) { return tier >= 90 ? 0 : tier >= 85 ? 30 : tier >= 80 ? 55 : tier >= 75 ? 80 : 100; } // 原生怪(密度与精英组数)留几成 | what share of native monsters (density and elite pack count) is kept +static int su_quota(int tier) { return tier >= 90 ? 1 << 30 : tier >= 85 ? 7 : tier >= 80 ? 5 : tier >= 75 ? 2 : 0; } // 一场最多放几组(90 层起放到守护者现身为止) | at most this many groups placed in one run (from level 90, placed until the Guardians appear) +static int su_cap(int tier) { return tier >= 90 ? 3 : 2; } // 同时在场最多几组 | at most this many groups present at the same time +// 刷一位超级金怪(连随从)。原版 main+0x69b310 对「表里 +0x21 字节为 0 的行」查本局已出现位图(游戏 +0x5668,第 行号 位):出现过就返回 0、不刷—— +// 同一局里一位超级金怪只出一次(地图上自带的那位,例如图 111 的 Eldritch = 行 49,也算)。秘境同一局连开多场、池放完一轮从头,都会撞上它。 +// 做法:刷之前把这一位清掉、刷完写回原值——原版地图自带的那位该不该出现照旧,我们刷的不受这条限制 +// Spawn one super unique (with minions). The original main+0x69b310, for "rows whose byte +0x21 in the table is 0", checks this game's has-appeared bitmap (game +0x5668, bit ): if it has appeared, it returns 0 and spawns nothing - +// in one game a super unique appears only once (the one placed by the map itself also counts, e.g. Eldritch on map 111 = row 49). Several rifts in a row in one game, and the pool starting again after a full round, both run into this. +// Approach: clear this one's bit before spawning and write the original value back afterwards - whether the one the original map places should appear stays as before, and the ones we spawn are not limited by this +static uint64_t su_spawn(uint64_t G, uint64_t room, int x, int y, int row) { + uint8_t *bm = (uint8_t *)(uintptr_t)(G + 0x5668 + (row >> 3)), bit = (uint8_t)(1u << (row & 7)), old = *bm & bit; *bm &= (uint8_t)~bit; + uint64_t u = ((uint64_t (*)(uint64_t, uint64_t, int, int, int, int))(B + 0x69b310))(G, room, x, y, row, 0); + uint8_t mid = *bm & bit; *bm = (uint8_t)((*bm & ~bit) | old); static int n; if (n++ < 3) LOG("秘境:刷超级金怪 行 %d:本局已出现位 刷前 %d、刷完原版置成 %d、写回 %d", row, old != 0, mid != 0, (*bm & bit) != 0); return u; } +static int g_near_now; // 玩家 40 格内的敌对单位数(hs_tick 每秒数一次) | number of hostile units within 40 tiles of the player (counted once a second by hs_tick) +static const uint8_t k_su_pool[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 19, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 38, 40, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 }; +static uint32_t g_inv_gone[2]; static int g_inv_gone_xy[2][2]; +static uint32_t g_suseq_id; // 测试开关 DM_RIFT_TEST_SUSEQ 当前在场的那位(任务事件的门见到它死要记一行) // 已退场的闯入首领:单位 id(等它所在的房间被游戏卸载后,把它那条存档记录改成不还原;见 inv_gone_pump)与退场落点 | the one currently present for test switch DM_RIFT_TEST_SUSEQ (the quest-event gate records a line when it sees it die) // an invading boss that has left: its unit id (once the game unloads the room it is in, its saved record is changed to do-not-restore; see inv_gone_pump) and where it was sent // 首领自己召出来的单位(现在只有巴尔的:触手 562–566、分身 570)。75 层以上它们不按层改属性、保持原版数值——它们是首领技能的一部分,不是秘境的怪; // 按层放大会让触手变成打不完的墙,并且随战斗时长在场上越积越多(实测巴尔在场 36 秒同屏多 26 只、141 秒多 44 只)。74 层及以下照旧(那条「逐位不变」的线不为此破例)。 // 按类号认:单位上「召唤者是谁」的字段没读到;以后别的首领有召唤物要加进来 @@ -363,7 +407,7 @@ static void hs_tick(uint64_t G, uint64_t player, uint32_t t, int lv) { int px, py, n = 0; if (!unit_xy(player, &px, &py)) return; for (int b = 0; b < 128; b++) for (uint64_t u = rd(G + 0x2230 + 1 * 0x400 + 8 * b); u; u = rd(u + 0x158)) { uint32_t m = *(uint32_t *)(uintptr_t)(u + 0xc); int x, y; if (m == 0 || m == 12 || unit_level(u) != lv || !unit_xy(u, &x, &y) || abs(x - px) > 40 || abs(y - py) > 40 || unit_align(u)) continue; n++; } - HS.near_sum += n; HS.near_n++; if (n > HS.near_peak) HS.near_peak = n; + HS.near_sum += n; HS.near_n++; if (n > HS.near_peak) HS.near_peak = n; g_near_now = n; } static void hs_report(int secs) { LOG("秘境:读数 第 %d 层 用时 %d 秒:击杀 %d 只、生命和 %lld 点(另守护者 %lld 点);改过属性的敌对怪 %d 只、生命和 %lld 点;承伤和 %lld 点、每秒峰值 %lld 点、死亡 %d 次;40 格内敌对单位 峰值 %d / 均值 %.1f(采样 %d 次)", @@ -467,13 +511,15 @@ static uint32_t monlvl(uint64_t G, int lvl, int grp) { uint64_t T = tables(G), a // for a unit with a percentage life bonus, writing the base up to the limit makes the total overflow to a negative number, which is read as 1 point (this is how minions fell back to 1). So headroom is left according to the current total / base. // base / full = the base entry and the total at this moment (raw fixed-point values); with no bonus (total not greater than base) or when the base entry cannot be read, it is the stat limit itself static long long hp_base_limit(int base, int full) { return base > 0 && full > base ? 0x7fffff00LL * base / full : 0x7fffff00LL; } +static int g_hp_soft; // 额外系数的软顶(点数,按「本层总倍率 = 1」计;0 = 没有):特殊精英本体用,免得天生就肉的怪种(攻城兽)再乘 4 变成半个守护者 | soft cap of the extra factor (points, counted with "this level's total multiplier = 1"; 0 = none): used for special elite bodies, so that naturally tanky monster types (siege beasts) do not become half a Guardian after another x4 static int g_hp_mul = 1000; // scale_monster 的生命额外系数(×1000):双守护者的 s 在截顶之前乘进去——先截顶再乘的话,规则值过上限的那位(巴尔)会被多砍一刀 | extra life factor of scale_monster (x1000): the dual-Guardian s is multiplied in before the clamp - clamping first and multiplying afterwards would cut the one whose rule value exceeds the limit (Baal) a second time static void scale_monster(uint64_t G, uint64_t u, int lt, int l9) { // lt = 本层的等级(守护者 + 3)、l9 = 起算层的等级 | lt = this level's level (Guardian + 3), l9 = the baseline level's level int l0 = gs(u, 12); if (l0 <= 0) return; if (lt > lvl_cap()) lt = lvl_cap(); if (l9 > lt) l9 = lt; int tx = tier_total_x1000(K.tier, 0), lb = l0 > l9 ? l0 : l9, le = l0 > lt ? l0 : lt; // lb:「起算层那只怪」的等级;le:写进单位的等级(不降级) | lb: the level of "that monster at the baseline level"; le: the level written into the unit (never lowered) if (le == l0 && lb == l0 && tx == 1000) return; // 9 层、原生等级已不低于目标:什么都不用改 | level 9 and the native level is already no lower than the target: nothing to change uint32_t h0 = monlvl(G, l0, 2), hb = monlvl(G, lb, 2), d0 = monlvl(G, l0, 3), db = monlvl(G, lb, 3), a0 = monlvl(G, l0, 0), a1 = monlvl(G, le, 0); if (!h0 || !d0 || !a0) return; - long long want = (long long)gs(u, 7) * hb / h0 * tx / 1000 * g_hp_mul / 1000, hp = want, lim = hp_base_limit(gsb(u, 7), gs(u, 7)); if (hp > lim) hp = lim; // 定点 ×256;原版上限 2²³ 点,带百分比生命加成的怪按比例留余量(hp_base_limit) | fixed point x256; the original's limit is 2^23 points, and monsters with a percentage life bonus get proportional headroom (hp_base_limit) + long long want = (long long)gs(u, 7) * hb / h0 * tx / 1000 * g_hp_mul / 1000; if (g_hp_soft > 0 && g_hp_mul > 1000) { long long w1 = want * 1000 / g_hp_mul, sf = (long long)g_hp_soft * 256 * tx / 1000; if (want > sf) want = w1 > sf ? w1 : sf; } /* 软顶:额外系数最多把它乘到软顶,本来就过软顶的不再乘 | soft cap: the extra factor raises it at most to the soft cap; one already above the soft cap is not multiplied further */ + long long hp = want, lim = hp_base_limit(gsb(u, 7), gs(u, 7)); if (hp > lim) hp = lim; // 定点 ×256;原版上限 2²³ 点,带百分比生命加成的怪按比例留余量(hp_base_limit) | fixed point x256; the original's limit is 2^23 points, and monsters with a percentage life bonus get proportional headroom (hp_base_limit) // 顶到上限不静默:这只怪(多半是守护者)的生命没按线涨足,只剩伤害在涨。每开一层记前 3 只 // Hitting the cap is not silent: this monster (most likely the Guardian) did not get its full life according to the line, and only its damage keeps // growing. The first 3 are logged for each level opened @@ -846,7 +892,7 @@ static void merc_test(uint64_t G, uint64_t pl, uint32_t t) { static void rift_quest_obs(const uint64_t *regs) { static uint8_t stand_in[0x200]; uint64_t G = regs[0], mon = regs[1]; int st = atomic_load(&K.st); if ((st != ST_RUN && st != ST_DONE) || !G || G != L.G || !mon || !in_rift_map(any_level(mon))) return; - static int n; if (n++ < 6) LOG("秘境:怪物类号 %u(单位 id %u)死在秘境图里,不走原版任务事件", *(uint32_t *)(uintptr_t)(mon + 4), *(uint32_t *)(uintptr_t)(mon + 8)); + static int n; if (n++ < 6 || (g_suseq_id && *(uint32_t *)(uintptr_t)(mon + 8) == g_suseq_id)) LOG("秘境:怪物类号 %u(单位 id %u)死在秘境图里,不走原版任务事件", *(uint32_t *)(uintptr_t)(mon + 4), *(uint32_t *)(uintptr_t)(mon + 8)); ((uint64_t *)(uintptr_t)regs)[1] = (uint64_t)(uintptr_t)stand_in; } static void rift_gates(void) { static int once; if (once) return; once = 1; @@ -940,7 +986,8 @@ static void rift_setup(uint64_t G) { uint64_t T = tables(G), a = T ? rd(T + 0x18f8) : 0, n = T ? rd(T + 0x1900) : 0; for (int i = 0; i < K.nmaps; i++) { int lv = K.maps[i]; uint64_t r = rd(G + 0x1d0 + 8ull * lv); if (!r) { LOG("【红】秘境:关卡 %d 没有怪物区域", lv); continue; } uint8_t *umin, *umax; int32_t *den = region_of(G, lv, &umin, &umax); int d0 = g_reg[lv].den, a0 = g_reg[lv].umin, b0 = g_reg[lv].umax; // 从原值算(上一次秘境结算后置过 0) | Computed from the original values (they were set to 0 after the previous rift completion) - int e2 = tier_elite_x2(K.tier); *den = d0 * 3 > 10000 ? 10000 : d0 * 3; *umin = a0 * e2 / 2 > 255 ? 255 : a0 * e2 / 2; *umax = b0 * e2 / 2 > 255 ? 255 : b0 * e2 / 2; // 精英组倍数按层(tier_elite_x2) | elite pack multiplier by level (tier_elite_x2) + int e2 = tier_elite_x2(K.tier); *den = d0 * 3 > 10000 ? 10000 : d0 * 3; *umin = a0 * e2 / 2 > 255 ? 255 : a0 * e2 / 2; *umax = b0 * e2 / 2 > 255 ? 255 : b0 * e2 / 2; + { const char *e = getenv("DM_RIFT_TEST_NAT"); int pct = e ? atoi(e) : hi_on("su", 75) ? su_nat_pct(K.tier) : 100; *den = (int)((long long)*den * pct / 100); *umin = (uint8_t)(*umin * pct / 100); *umax = (uint8_t)(*umax * pct / 100); } // 75 层起原生怪按层减少,位置让给特殊精英 | from level 75, native monsters are reduced level by level, making room for special elites LOG("秘境:关卡 %d 本局怪物区域 密度 %d → %d、精英组 %d–%d → %d–%d(第 %d 层 ×%d.%d)", lv, d0, *den, a0, b0, *umin, *umax, K.tier, e2 / 2, e2 % 2 * 5); for (uint64_t k = 0; a && k < n; k++) if (*(int32_t *)(uintptr_t)(a + k * 0x1c) == lv) { int32_t *rm = (int32_t *)(uintptr_t)(a + k * 0x1c + 0xc); int had = 0; for (int q = 0; q < g_nmz; q++) had |= g_mz[q].lv == lv; if (g_built[lv]) LOG("秘境:关卡 %d 服务端已建,LvlMaze 地狱房间数不动(%d)", lv, *rm); @@ -1152,7 +1199,25 @@ static int start_rift(uint64_t G, uint64_t player, uint32_t t, int tier) { if (K.inv_n) { int nd = atomic_load(&K.need); atomic_store(&K.need, nd * (100 + 12 * K.inv_n) / 100); // 打掉一位 +12% 进度:进度需求同步上调,免得内容更多反而更快出守护者 | +12% progress for each one killed: the progress requirement is raised to match, so that more content does not make the Guardians appear sooner if (K.inv_n >= 2) say("dmRiftSayFoes", K.inv_n); // 90 层起开局说一声本场有几位强敌(不说是谁、不说何时) | from level 90, say at the start how many strong enemies this run has (not who, not when) LOG("秘境:本场闯入首领 %d 位:类号 %d(进度 %d%% 时)%s;进度需求 %d → %d", K.inv_n, K.inv_cls[0], K.inv_pct[0], K.inv_n > 1 ? "与另一位(见闯入时的日志)" : "", nd, atomic_load(&K.need)); } } - K.guard_cls = K.gcls[0]; if (K.nplan == 2) LOG("秘境:本场守护者两位,类号 %d 与 %d(生命 ×%d.%03d、伤害 ×%d.%03d)", K.gcls[0], K.gcls[1], hi_duo_x1000(0) / 1000, hi_duo_x1000(0) % 1000, hi_duo_x1000(1) / 1000, hi_duo_x1000(1) % 1000); } + // 特殊精英:开局把池洗成本场的出场次序(放完一轮再从头) + // Special elites: at the start, shuffle the pool into this run's order of appearance (after a full round, start again from the top) + { K.su_next = K.su_cnt = 0; K.su_last = 0; memset(K.su_live, 0, sizeof K.su_live); int np = (int)sizeof k_su_pool; for (int q = 0; q < np; q++) K.su_order[q] = k_su_pool[q]; + for (int q = np - 1; q > 0; q--) { int j = rnd(q + 1), x = K.su_order[q]; K.su_order[q] = K.su_order[j]; K.su_order[j] = x; } + const char *e = getenv("DM_RIFT_TEST_SUROWS"); if (e) { char bf[200]; strlcpy(bf, e, sizeof bf); int q = 0; for (char *sv, *k = strtok_r(bf, ",", &sv); k && q < np; k = strtok_r(NULL, ",", &sv)) K.su_order[q++] = atoi(k); } + if (hi_on("su", 75)) LOG("秘境:本场特殊精英:原生怪留 %d%%,同时在场最多 %d 组,头几位的行号 %d、%d、%d", su_nat_pct(K.tier), su_cap(K.tier), K.su_order[0], K.su_order[1], K.su_order[2]); } + // 守护者分波(设计稿第二十四节第 3 问):安达利尔死时会连带杀死同场的其它首领,所以她单独一波、先出;她倒下 WAVE_GAP 拍后下一波才刷 + // (实测她死后 0 / 25 / 75 拍刷出的迪亚波罗都活着,各 1 局;取 75 拍留余量,也给玩家喘口气)。 + // 95–99 层:安达利尔(生命 ×0.5 → ×0.9)→ 本场那一对(照双守护者的 s / d);100 层:安达利尔(×1.0)→ 一对 → 另一对(四位各 ×0.5、伤害 ×1.0)。94 层及以下一波不变 + // Guardian waves (design draft section 24, question 3): when Andariel dies she also kills the other bosses on the field, so she is a wave of her own and comes first; the next wave is spawned WAVE_GAP ticks after she falls + // (measured: Diablo spawned 0 / 25 / 75 ticks after her death stayed alive, 1 run each; 75 ticks is taken to leave margin, and it also gives the player a breather). + // Levels 95–99: Andariel (life x0.5 -> x0.9) -> this run's pair (with the s / d of the two-Guardian fight); level 100: Andariel (x1.0) -> a pair -> the other pair (each of the four x0.5, damage x1.0). Level 94 and below: one wave, unchanged + K.wave = 0; K.wave_t = 0; K.nwave = 1; K.wn[0] = K.nplan; K.wcls[0][0] = K.gcls[0]; K.wcls[0][1] = K.gcls[1]; K.whp[0] = K.nplan == 2 ? hi_duo_x1000(0) : 1000; K.wdm[0] = K.nplan == 2 ? hi_duo_x1000(1) : 1000; + if (K.nplan == 2 && hi_on("wave", 95)) { const char *tw = getenv("DM_RIFT_TEST_HI"); int three = K.tier >= 100 || (tw && strstr(tw, "wave3")); + K.wn[0] = 1; K.wcls[0][0] = 156; K.wcls[0][1] = 0; K.wdm[0] = 1000; K.whp[0] = three ? 1000 : 500 + 100 * ((K.tier < 95 ? 95 : K.tier > 99 ? 99 : K.tier) - 95); + K.wn[1] = 2; K.wcls[1][0] = K.gcls[0]; K.wcls[1][1] = K.gcls[1]; K.whp[1] = three ? 500 : hi_duo_x1000(0); K.wdm[1] = three ? 1000 : hi_duo_x1000(1); K.nwave = 2; + if (three) { int q = 0; for (int k = 0; k < 4; k++) if (k_duo[k] != K.gcls[0] && k_duo[k] != K.gcls[1] && q < 2) K.wcls[2][q++] = k_duo[k]; K.wn[2] = q; K.whp[2] = 500; K.wdm[2] = 1000; K.nwave = 3; } + LOG("秘境:本场守护者分 %d 波:安达利尔(生命 ×%d.%03d)→ 类号 %d 与 %d(×%d.%03d)%s", K.nwave, K.whp[0] / 1000, K.whp[0] % 1000, K.wcls[1][0], K.wcls[1][1], K.whp[1] / 1000, K.whp[1] % 1000, K.nwave == 3 ? " → 另外两位(×0.500)" : ""); } + K.guard_cls = K.gcls[0]; if (K.nplan == 2 && K.nwave == 1) LOG("秘境:本场守护者两位,类号 %d 与 %d(生命 ×%d.%03d、伤害 ×%d.%03d)", K.gcls[0], K.gcls[1], hi_duo_x1000(0) / 1000, hi_duo_x1000(0) % 1000, hi_duo_x1000(1) / 1000, hi_duo_x1000(1) % 1000); } K.t0_ns = guest_ns(); if (getenv("DM_RIFT_TEST_LATE")) { K.t0_ns -= (uint64_t)RIFT_SECS * 1000000000ull; LOG("秘境:测试 DM_RIFT_TEST_LATE 开局即超时"); } // 造「超时打倒守护者」现场 | set up the "Guardian defeated after time ran out" test case K.players_old = dm_hud_requested_players(); if (!K.players_old) K.players_old = 1; @@ -1170,6 +1235,23 @@ static int start_rift(uint64_t G, uint64_t player, uint32_t t, int tier) { if (!R.gift) L.gift_due = 1; // 第一次进秘境送一颗彩虹刻面,只送一次:落到秘境图里再掉在脚下 | The first rift entry gives one Rainbow Facet, only once: dropped at the player's feet after landing on a rift map return 1; } +// 刷当前这一波守护者(K.wave)。一位:人右下 6 格;两位:一左一右各 6 格。每位先照常按层改(守护者 = 本层怪物等级 + 3,起算层也 + 3,同吃本层总倍率), +// 再乘这一波的生命系数(截顶之前乘)与伤害系数 +// Spawn the Guardians of the current wave (K.wave). One: 6 tiles to the player's lower right; two: 6 tiles to the left and 6 to the right. Each is first scaled by level as usual (Guardian = this level's monster level + 3, the starting level also + 3, taking this level's total multiplier as well), +// then multiplied by this wave's life factor (before capping) and damage factor +#define WAVE_GAP 75 +static void guard_wave(uint64_t G, uint64_t player, uint32_t t, int lowhp) { + static const int ox[2][2] = { { 6, 0 }, { 6, -6 } }, oy[2][2] = { { 6, 0 }, { 6, 6 } }; int w = K.wave, nw = K.wn[w] < 1 ? 1 : K.wn[w] > 2 ? 2 : K.wn[w], x, y, n = 0; unit_xy(player, &x, &y); hs_sync(); + for (int i = 0; i < nw; i++) { int32_t pos[2] = { x + ox[nw - 1][i], y + oy[nw - 1][i] }; uint64_t rr = free_spot(G, unit_room(player), pos); + uint64_t u = rr ? ((uint64_t (*)(uint64_t, uint64_t, int, int, int, int, int, int, uint64_t))(B + 0x7ce630))(G, rr, 1, K.wcls[w][i], pos[0], pos[1], 1, 0, 0x10) : 0; + if (!u) { LOG("【红】秘境:守护者第 %d 波第 %d 位(类号 %d)没刷出来", w + 1, i + 1, K.wcls[w][i]); continue; } + K.guards[i] = *(uint32_t *)(uintptr_t)(u + 8); K.gcls[i] = K.wcls[w][i]; if (!K.guard) K.guard = K.guards[i]; n++; + if (lowhp) ss(u, 6, 256); else if (K.tier >= 9) { g_hp_mul = K.whp[w]; scale_monster(G, u, target_level(player) + 3, dm_rift_tier_level(9, gs(player, 12)) + 3); g_hp_mul = 1000; } + if (K.wdm[w] != 1000 && !lowhp) ss(u, 25, (int)((100LL + gs(u, 25)) * K.wdm[w] / 1000 - 100)); // 伤害:属性 25 是「伤害 +N%」,整体乘 d 即 (100 + N) × d − 100 | damage: stat 25 is "damage +N%", so multiplying the whole by d gives (100 + N) x d - 100 + HS.guard_hp += gs(u, 7) >> 8; + LOG("秘境:拍 %u 刷守护者%s%s 类号 %d id %u 等级 %d 生命 %d 伤害百分比 %d", t, K.nwave > 1 ? (w == 0 ? "(第 1 波)" : w == 1 ? "(第 2 波)" : "(第 3 波)") : "", nw == 2 ? (i ? "(第二位)" : "(第一位)") : "", K.wcls[w][i], K.guards[i], gs(u, 12), gs(u, 7) >> 8, gs(u, 25)); } + atomic_store(&K.gdead, 0); atomic_store(&K.gtotal, n); + if (n) { if (w == 0) say(nw == 2 && n == 2 ? "dmRiftSayGuardians" : "dmRiftSayGuardian"); else say("dmRiftSayWave", w + 1, K.nwave); } } void dm_rift_tick(uint64_t G, uint64_t player, uint8_t *main_base) { B = main_base; if (!G || !player || !B) return; atomic_store(&g_merc_req, 0); if (getenv("DM_TEST_MERC_EQUIP") || getenv("DM_TEST_MERC_DUMP")) merc_test(G, player, *(uint32_t *)(uintptr_t)(G + 0x170)); @@ -1316,8 +1398,13 @@ void dm_rift_tick(uint64_t G, uint64_t player, uint8_t *main_base) { if (K.tier >= 9 || lowhp) { static uint32_t r_; uint32_t w = atomic_load(&g_newq_w); if (w - r_ > NQ) r_ = w - NQ; int lt = target_level(player); for (; r_ != w; r_++) { uint32_t id = atomic_load(&g_newq[r_ % NQ]); uint64_t u = find_unit(G, 1, id); if (u && !is_guard(id) && hi_on("summon", 75) && boss_summon(*(uint32_t *)(uintptr_t)(u + 4))) { static int n, sq = -1; int cur = atomic_load(&g_run_seq); if (cur != sq) { sq = cur; n = 0; } if (n++ < 4) LOG("秘境:首领召唤物 id %u(类号 %u)不按层改,保持原版:等级 %d 生命 %d", id, *(uint32_t *)(uintptr_t)(u + 4), gs(u, 12), gs(u, 7) >> 8); hs_spawn(id, gs(u, 7) >> 8); continue; } - if (u && !is_guard(id)) { if (K.tier >= 9) scale_monster(G, u, lt, dm_rift_tier_level(9, gs(player, 12))); if (lowhp) ss(u, 6, 256); dmg_probe_add(id, t); hs_spawn(id, gs(u, 7) >> 8); } } } + if (u && !is_guard(id)) { uint64_t md = rd(u + 0x10); int su = md && (*(uint8_t *)(uintptr_t)(md + 0x1a) & 0x02) && hi_on("su", 75), sm = !su && su_minion(id); /* 特殊精英本体:生命另乘 SU_HP_X;组里的随从另乘 SU_MINION_X1000 | special elite body: life additionally multiplied by SU_HP_X; minions in the group additionally by SU_MINION_X1000 */ + if (K.tier >= 9) { if (su) { g_hp_mul = SU_HP_X * 1000; g_hp_soft = SU_HP_SOFT; } else if (sm) g_hp_mul = SU_MINION_X1000; scale_monster(G, u, lt, dm_rift_tier_level(9, gs(player, 12))); g_hp_mul = 1000; g_hp_soft = 0; } if (su) { static int n; if (n++ < 12) LOG("秘境:特殊精英本体 id %u(类号 %u,超级独特号 %d)生命另乘 %d:等级 %d 生命 %d", id, *(uint32_t *)(uintptr_t)(u + 4), *(int16_t *)(uintptr_t)(md + 0x2a), SU_HP_X, gs(u, 12), gs(u, 7) >> 8); } if (lowhp) ss(u, 6, 256); dmg_probe_add(id, t); hs_spawn(id, gs(u, 7) >> 8); } } } dmg_probe_pump(G, t); hs_tick(G, player, t, lv); + // 测试开关 DM_RIFT_TEST_PETGOD=1:每 10 拍把秘境图里友方怪物单位(玩家的随从)的当前生命回满——自动局靠随从代打,随从被围死后就没人补最后一下了 + // Test switch DM_RIFT_TEST_PETGOD=1: every 10 ticks, refill the current life of friendly monster units (the player's minions) in the rift map - unattended runs rely on minions to do the fighting, and once the minions are surrounded and killed nobody lands the last hit + { static int on = -1; if (on < 0) on = getenv("DM_RIFT_TEST_PETGOD") != NULL; if (on && t % 10 == 0 && in_rift_map(lv)) for (int b = 0; b < 128; b++) for (uint64_t u = rd(G + 0x2230 + 1 * 0x400 + 8 * b); u; u = rd(u + 0x158)) { + uint32_t m = *(uint32_t *)(uintptr_t)(u + 0xc); if (m != 0 && m != 12 && unit_align(u)) ss(u, 6, gs(u, 7)); } } // 测试读数 DM_RIFT_TEST_ILVL=1:每 10 秒数一次地上的物品(服务端物品表 G+0x2e30,模式 3),报物品等级(数据块 +0x38)范围——验 B 方案下掉落物品等级跟不跟改过的怪物等级 // Test readout DM_RIFT_TEST_ILVL=1: every 10 seconds count the items on the ground (server item table G+0x2e30, mode 3) and report the item level (data block +0x38) range -- verifies whether drop item levels follow the modified monster level under plan B { static int il = -1; if (il < 0) il = getenv("DM_RIFT_TEST_ILVL") != NULL; @@ -1329,11 +1416,14 @@ void dm_rift_tick(uint64_t G, uint64_t player, uint8_t *main_base) { { static int pull = -1; if (pull < 0) pull = getenv("DM_RIFT_TEST_PULL") != NULL; if (pull && t % 38 == 0 && in_rift_map(lv) && ((K.guard && !atomic_load(&K.guard_dead)) || K.inv_st[0] == 2 || K.inv_st[1] == 2)) { uint64_t g = 0; for (int i = 0; i < 2 && !g; i++) { uint64_t gu = K.inv_st[i] == 2 ? find_unit(G, 1, K.inv_id[i]) : 0; uint32_t gm = gu ? *(uint32_t *)(uintptr_t)(gu + 0xc) : 0; if (gu && gm != 0 && gm != 12) g = gu; } /* 在场的闯入首领优先 | an invading boss that is present takes priority */ for (int i = 0; i < 3 && !g; i++) { uint64_t gu = K.guards[i] ? find_unit(G, 1, K.guards[i]) : 0; uint32_t gm = gu ? *(uint32_t *)(uintptr_t)(gu + 0xc) : 0; if (gu && gm != 0 && gm != 12) g = gu; } int x, y; if (g && unit_xy(g, &x, &y)) dm_teleport(B, G, player, unit_room(g), x + 2, y + 2); } - else if (pull && t % 38 == 0 && in_rift_map(lv)) { uint32_t w = atomic_load(&g_newq_w); int px, py, bd = 1 << 30, bx = 0, by = 0; unit_xy(player, &px, &py); // 最近的那只 | The nearest one - for (uint32_t k = 0; k < NQ && k < w; k++) { uint64_t u = find_unit(G, 1, atomic_load(&g_newq[(w - 1 - k) % NQ])); if (!u || unit_level(u) != lv) continue; uint32_t m = *(uint32_t *)(uintptr_t)(u + 0xc); if (m == 0 || m == 12) continue; - int x, y; if (!unit_xy(u, &x, &y)) continue; int d = abs(x - px) + abs(y - py); if (d < bd) { bd = d; bx = x; by = y; } } + else if (pull && t % 38 == 0 && in_rift_map(lv)) { uint32_t w = atomic_load(&g_newq_w); int px, py, bd = 1 << 30, bx = 0, by = 0; unit_xy(player, &px, &py); // 最近的那只;同一只连着 4 次(约 6 秒)都是最近的还没死,就当它打不死(投石车一类的预设单位、卡在墙里的),以后不再找它 | the nearest one; if the same one is the nearest 4 times in a row (about 6 seconds) and still not dead, treat it as unkillable (preset units such as catapults, ones stuck in walls) and never look for it again + static uint32_t bl[64], last; static int nbl, rep; uint32_t bid = 0; + for (uint32_t k = 0; k < NQ && k < w; k++) { uint32_t id = atomic_load(&g_newq[(w - 1 - k) % NQ]); uint64_t u = find_unit(G, 1, id); if (!u || unit_level(u) != lv) continue; uint32_t m = *(uint32_t *)(uintptr_t)(u + 0xc); if (m == 0 || m == 12) continue; + int x, y, skip = 0; for (int q = 0; q < nbl && q < 64; q++) skip |= bl[q] == id; if (skip || !unit_xy(u, &x, &y)) continue; int d = abs(x - px) + abs(y - py); if (d < bd) { bd = d; bx = x; by = y; bid = id; } } + if (bid && bid == last) { if (++rep >= 4) { bl[nbl++ % 64] = bid; rep = 0; LOG("秘境:测试拉人 单位 id %u 连着 4 次是最近的还没死,不再找它", bid); } } else { last = bid; rep = 0; } if (bd < (1 << 30) && bd > 3) { uint64_t lvp = level_of(player); int32_t pos[2] = { bx + 1, by + 1 }; uint64_t rs = room_at(lvp, pos[0], pos[1]), rr = rs ? free_spot(G, rs, pos) : 0; - int ok = dm_teleport(B, G, player, rr, pos[0], pos[1]); static int ln; if (ln++ < 5) LOG("秘境:测试拉人 → %d,%d(最近的怪 %d 格)%s", pos[0], pos[1], bd, ok ? "成" : "不成"); } } } + int ok = dm_teleport(B, G, player, rr, pos[0], pos[1]); static int ln; if (ln++ < 5 || ln % 20 == 0) LOG("秘境:测试拉人 → %d,%d(最近的怪 id %u,%d 格)%s", pos[0], pos[1], bid, bd, ok ? "成" : "不成"); } + else { static int ln2; if (ln2++ % 20 == 0) LOG("秘境:测试拉人 这一次没拉(最近的怪 id %u,%d 格;新怪队列写到 %u)", bid, bd == 1 << 30 ? -1 : bd, w); } } } // 计时 // Timer { uint64_t now = guest_ns(); @@ -1342,6 +1432,37 @@ void dm_rift_tick(uint64_t G, uint64_t player, uint8_t *main_base) { // Guardian inv_gone_pump(G, t); if (in_rift_map(lv) && g_entry_lv != lv) { int ex, ey; if (unit_xy(player, &ex, &ey)) { g_entry_lv = lv; g_entry_x = ex; g_entry_y = ey; } } else if (!in_rift_map(lv)) g_entry_lv = 0; + // 特殊精英:每秒看一次要不要放下一组(规则见池那段注释)。「前方」= 玩家最近 2 秒走的方向;八个方向从它起、左右交替着找空地,离人不足 45 格或离本图入口不足 40 格的不要 + // Special elites: once a second, check whether to place the next group (rules in the comment on the pool). "Ahead" = the direction the player walked in the last 2 seconds; the eight directions are searched for open ground starting from it, alternating left and right; spots less than 45 tiles from the player or less than 40 tiles from this map's entrance are rejected + if (t % 25 == 0 && hi_on("su", 75) && atomic_load(&K.st) == ST_RUN && g_entry_lv == lv) { static int hx[2], hy[2], hk; int px, py, live = 0; unit_xy(player, &px, &py); + int dx = hx[hk] ? px - hx[hk] : 0, dy = hx[hk] ? py - hy[hk] : 0; hx[hk] = px; hy[hk] = py; hk ^= 1; + for (int i = 0; i < 3; i++) { if (!K.su_live[i]) continue; uint64_t u = find_unit(G, 1, K.su_live[i]); uint32_t m = u ? *(uint32_t *)(uintptr_t)(u + 0xc) : 1; + if (u && (m == 0 || m == 12)) K.su_live[i] = 0; else if (!u) { if (t - K.su_seen[i] > 750) K.su_live[i] = 0; } /* 本体死了这一组就算打完;30 秒找不到单位(玩家换了图 / 回了城,房间卸载)也不再占名额 | once the body is dead this group counts as finished; if its unit cannot be found for 30 seconds (the player changed map / went to town, the room was unloaded) it no longer takes up a slot either */ + else { K.su_seen[i] = t; int x, y; unit_xy(u, &x, &y); /* 追击(见池那段注释):本体离玩家 80 格以外满 5 秒,挪到玩家前方约 70 格的空地(随从照原版自己跟着首领) | pursuit (see the comment on the pool): once the body has been more than 80 tiles from the player for 5 seconds, move it to open ground about 70 tiles ahead of the player (the minions follow their boss on their own, as in the original) */ + if (abs(x - px) + abs(y - py) <= 80) K.su_near[i] = t; + else if (t - K.su_near[i] >= 125) { static const int cx[8] = { 70, 50, 0, -50, -70, -50, 0, 50 }, cy[8] = { 0, 50, 70, 50, 0, -50, -70, -50 }; int d0 = rnd(8), best = 0, ok = 0; int32_t pos[2]; + if (dx || dy) for (int d = 0; d < 8; d++) { int v = dx * cx[d] + dy * cy[d]; if (v > best) { best = v; d0 = d; } } + for (int k = 0; k < 8 && !ok; k++) { int d = (d0 + (k & 1 ? (k + 1) / 2 : 8 - k / 2)) % 8; pos[0] = px + cx[d]; pos[1] = py + cy[d]; uint64_t rs = room_load(G, level_of(player), pos[0], pos[1]), rr = rs ? free_spot(G, rs, pos) : 0; + if (rr && abs(pos[0] - px) + abs(pos[1] - py) >= 60) ok = dm_teleport(B, G, u, rr, pos[0], pos[1]); } + K.su_near[i] = t; static int n; if (n++ < 8) LOG("秘境:拍 %u 特殊精英(id %u)离玩家 %d 格满 5 秒,%s", t, K.su_live[i], abs(x - px) + abs(y - py), ok ? "挪到玩家前方" : "周围没有空地,下次再挪"); } } + live += K.su_live[i] != 0; } + if (!K.guard && live < su_cap(K.tier) && K.su_cnt < su_quota(K.tier) && g_near_now < SU_NEAR && t - K.su_last >= 75) { + static const int sx[8] = { 70, 50, 0, -50, -70, -50, 0, 50 }, sy[8] = { 0, 50, 70, 50, 0, -50, -70, -50 }; int d0 = rnd(8), best = 0, np = (int)sizeof k_su_pool, baal = 0, row; + if (dx || dy) for (int d = 0; d < 8; d++) { int v = dx * sx[d] + dy * sy[d]; if (v > best) { best = v; d0 = d; } } + for (int w = 0; w < K.nwave; w++) for (int q = 0; q < K.wn[w]; q++) baal |= K.wcls[w][q] == 544; for (int q = 0; q < K.inv_n; q++) baal |= K.inv_cls[q] == 544; + do row = K.su_order[K.su_next++ % np]; while (baal && (row == 24 || row == 36 || row == 38)); + uint64_t u = 0; int32_t pos[2] = { 0, 0 }; int f_room = 0, f_near = 0, f_fn = 0; + for (int k = 0; k < 8 && !u; k++) { int d = (d0 + (k & 1 ? (k + 1) / 2 : 8 - k / 2)) % 8; pos[0] = px + sx[d]; pos[1] = py + sy[d]; uint64_t rs = room_load(G, level_of(player), pos[0], pos[1]), rr = rs ? free_spot(G, rs, pos) : 0; + if (!rr) { f_room++; continue; } if (abs(pos[0] - px) + abs(pos[1] - py) < 45 || abs(pos[0] - g_entry_x) + abs(pos[1] - g_entry_y) < 40) { f_near++; continue; } f_fn++; + u = su_spawn(G, rr, pos[0], pos[1], row); } + static int fails; if (u) fails = 0; else if (++fails < 10) K.su_next--; else fails = 0; /* 放不成:这一位留着 1 秒后再试;同一位连着 10 次放不成就跳过它,免得一行卡住整场 | could not place it: keep this one and try again in 1 second; after 10 failures in a row for the same one, skip it so that one row does not hold up the whole run */ + if (!u) { K.su_last = t - 50; static int n; if (n++ % 20 == 0) LOG("秘境:拍 %u 特殊精英(行 %d)这一秒没放成(第 %d 次):八个方向里没有房间 / 空地的 %d 个、离人或离入口太近的 %d 个、原版函数没刷出来的 %d 个", t, row, n, f_room, f_near, f_fn); } /* 周围没有合适的空地(或原版函数没刷出来):这一位留着,1 秒后再试 | no suitable open ground around (or the original function spawned nothing): keep this one and try again in 1 second */ + else { uint32_t uid = *(uint32_t *)(uintptr_t)(u + 8); int ux = pos[0], uy = pos[1], nm = 0; + for (int b = 0; b < 128; b++) for (uint64_t v = rd(G + 0x2230 + 1 * 0x400 + 8 * b); v; v = rd(v + 0x158)) { uint32_t vid = *(uint32_t *)(uintptr_t)(v + 8); uint64_t md = rd(v + 0x10); int x, y; + if (vid > uid && md && (*(uint8_t *)(uintptr_t)(md + 0x1a) & 0x10) && unit_xy(v, &x, &y) && abs(x - ux) + abs(y - uy) <= 15) { g_su_min[g_su_min_w++ % 64] = vid; nm++; } } + for (int i = 0; i < 3; i++) if (!K.su_live[i]) { K.su_live[i] = uid; K.su_seen[i] = K.su_near[i] = t; break; } K.su_cnt++; K.su_last = t; + LOG("秘境:拍 %u 特殊精英第 %d 组刷出:行 %d 类号 %u id %u 在 %d,%d(离人 %d 格、离入口 %d 格;此前在场 %d 组、40 格内敌对 %d 只;随从 %d 只)", t, K.su_cnt, row, *(uint32_t *)(uintptr_t)(u + 4), *(uint32_t *)(uintptr_t)(u + 8), pos[0], pos[1], + abs(pos[0] - px) + abs(pos[1] - py), abs(pos[0] - g_entry_x) + abs(pos[1] - g_entry_y), live, g_near_now, nm); } } } // 测试读数 DM_RIFT_TEST_GONE=<拍>:退场的闯入首领每 25 拍报一次位置 / 模式 / 生命 / 离人多远;到 <拍> 时把人传到它跟前,并让固定输出替身开始打它(验:退场后它动不动、走过去会不会打起来、打死给不给进度 / 掉不掉东西) // Test readout DM_RIFT_TEST_GONE=: an invading boss that has left reports its position / mode / life / distance from the player every 25 ticks; at the player is teleported next to it and the fixed-output stand-in starts hitting it (to verify: whether it moves after leaving, whether walking up to it starts a fight, whether killing it gives progress / drops) { static int at = -1, hit, gx, gy, cls; static uint32_t hit_t; if (at < 0) { const char *e = getenv("DM_RIFT_TEST_GONE"); at = e ? atoi(e) : 0; } @@ -1357,6 +1478,28 @@ void dm_rift_tick(uint64_t G, uint64_t player, uint8_t *main_base) { if (gx && t >= (uint32_t)at && !hit) { int32_t pos[2] = { gx, gy }; uint64_t rs = room_load(G, level_of(player), gx, gy), rr = rs ? free_spot(G, rs, pos) : 0; hit = 1; hit_t = t; LOG("[退场读数] 拍 %u 把人传到退场落点 %d,%d(%s)", t, gx, gy, rr && dm_teleport(B, G, player, rr, pos[0], pos[1]) ? "成" : "没成"); } if (hit == 1 && t - hit_t >= 150) { hit = 2; int n = 0, px, py; unit_xy(player, &px, &py); for (int b = 0; b < 128; b++) for (uint64_t u = rd(G + 0x2230 + 1 * 0x400 + 8 * b); u; u = rd(u + 0x158)) { int x, y; if ((int)*(uint32_t *)(uintptr_t)(u + 4) == cls && unit_xy(u, &x, &y) && abs(x - px) + abs(y - py) < 80) n++; } LOG("[退场读数] 拍 %u 人已在退场落点 150 拍:80 格内类号 %d 的单位 %d 只(人在 %d,%d)", t, cls, n, px, py); } } } + // 测试开关 DM_RIFT_TEST_SUSEQ=<起始拍>:<行号>,<行号>…(特殊精英的验收轮):秘境进行中从这一拍起,在人旁边用原版函数 main+0x69b310(游戏, 房间, x, y, 行号, 0) 依次刷超级金怪, + // 每秒把人放到它旁边(配 DM_RIFT_TEST_LOWHP=1,新刷的怪只剩 1 点血,随从补一下就死);它死后 40 拍报一行:随从几只、这段时间新掉在地上的物品(类号:品质),再刷下一位。600 拍没死记「没打死」照样往下。 + // 第六个参数含义没查到,取 0 的依据是探路那一局(行 3,本体 + 8 只随从照表刷出)与这一轮 + // Test switch DM_RIFT_TEST_SUSEQ=:,... (acceptance round for special elites): from this tick during a rift, super uniques are spawned one after another next to the player with the original function main+0x69b310(game, room, x, y, row, 0), + // and every second the player is put next to it (with DM_RIFT_TEST_LOWHP=1 a freshly spawned monster has only 1 life left and dies from one hit by a minion); 40 ticks after it dies one line is reported: how many minions, the items newly dropped on the ground in that time (class id:quality), then the next one is spawned. If it is not dead after 600 ticks, "not killed" is recorded and it moves on anyway. + // The meaning of the sixth argument was not found; 0 is used on the basis of the exploratory run (row 3, body + 8 minions spawned as in the table) and this round + { static int at = -1, rows[66], nr, idx, ph, row, minions; static uint32_t t0, hi, cls; + if (at < 0) { const char *e = getenv("DM_RIFT_TEST_SUSEQ"); at = e ? atoi(e) : 0; const char *c = e ? strchr(e, ':') : NULL; char bf[400]; strlcpy(bf, c ? c + 1 : "", sizeof bf); for (char *sv, *k = strtok_r(bf, ",", &sv); k && nr < 66; k = strtok_r(NULL, ",", &sv)) rows[nr++] = atoi(k); } + if (at > 0 && idx < nr && in_rift_map(lv) && atomic_load(&K.st) == ST_RUN) { + if (ph == 0 && t >= (uint32_t)at && t >= t0 + 10) { row = rows[idx]; int x, y; unit_xy(player, &x, &y); int32_t pos[2] = { 0, 0 }; uint64_t rr = 0, u = 0; hi = 0; minions = 0; + for (int b = 0; b < 128; b++) for (uint64_t it = rd(G + 0x2e30 + 8 * b); it; it = rd(it + 0x158)) if (*(uint32_t *)(uintptr_t)(it + 8) > hi) hi = *(uint32_t *)(uintptr_t)(it + 8); + for (int d = 0; d < 8 && !u; d++) { static const int ox[8] = { 12, 9, 0, -9, -12, -9, 0, 9 }, oy[8] = { 0, 9, 12, 9, 0, -9, -12, -9 }; pos[0] = x + ox[d]; pos[1] = y + oy[d]; rr = free_spot(G, unit_room(player), pos); /* 原版函数在同一点试 5 次,那点被残留的随从占着就返回 0:换个方向再试 | the original function tries 5 times at the same point and returns 0 if that point is occupied by leftover minions: try again in another direction */ + u = rr ? su_spawn(G, rr, pos[0], pos[1], row) : 0; } + if (!u) { LOG("[验收轮] 拍 %u 行 %d 刷不出(房间 %s,函数返回 0)", t, row, rr ? "有" : "无"); idx++; t0 = t; } + else { g_suseq_id = *(uint32_t *)(uintptr_t)(u + 8); cls = *(uint32_t *)(uintptr_t)(u + 4); t0 = t; ph = 1; } } + else if (ph == 1) { uint64_t u = find_unit(G, 1, g_suseq_id); uint32_t m = u ? *(uint32_t *)(uintptr_t)(u + 0xc) : 0; int dead = !u || m == 0 || m == 12, x, y; + if (t - t0 == 20) { int px, py; unit_xy(player, &px, &py); for (int b = 0; b < 128; b++) for (uint64_t v = rd(G + 0x2230 + 1 * 0x400 + 8 * b); v; v = rd(v + 0x158)) { uint64_t md = rd(v + 0x10); if (md && (*(uint8_t *)(uintptr_t)(md + 0x1a) & 0x10) && unit_xy(v, &x, &y) && abs(x - px) + abs(y - py) <= 40) minions++; } } + if (!dead && t % 25 == 0 && unit_xy(u, &x, &y)) dm_teleport(B, G, player, unit_room(u), x + 2, y + 2); + if (dead || t - t0 > 600) { LOG("[验收轮] 拍 %u 行 %d 类号 %u id %u %s(刷出后 %u 拍),40 格内带随从标志的 %d 只", t, row, cls, g_suseq_id, dead ? "已死" : "【没打死】", t - t0, minions); ph = 2; t0 = t; } } + else if (ph == 2 && t - t0 >= 40) { char ln[700]; int o = 0, n = 0; ln[0] = 0; + for (int b = 0; b < 128; b++) for (uint64_t it = rd(G + 0x2e30 + 8 * b); it; it = rd(it + 0x158)) { uint64_t d = rd(it + 0x10); if (!d || *(uint32_t *)(uintptr_t)(it + 0xc) != 3 || *(uint32_t *)(uintptr_t)(it + 8) <= hi) continue; n++; if (o < (int)sizeof ln - 16) o += snprintf(ln + o, sizeof ln - o, " %u:%d", *(uint32_t *)(uintptr_t)(it + 4), *(int32_t *)(uintptr_t)d); } + LOG("[验收轮] 拍 %u 行 %d 之后新掉在地上的物品 %d 件(类号:品质):%s", t, row, n, ln); g_suseq_id = 0; ph = 0; t0 = t; if (++idx == nr) LOG("[验收轮] 拍 %u 全部 %d 行走完", t, nr); } } } // 测试开关 DM_RIFT_TEST_SCOREAT=<拍>:<分数>:到这一拍把进度分数直接设成这个数(造「闯入首领还活着时进度满了」这类现场) // Test switch DM_RIFT_TEST_SCOREAT=:: at this tick set the progress score directly to this number (to stage scenes such as "progress fills while an invading boss is still alive") { static int at = -1, sc; if (at < 0) { const char *e = getenv("DM_RIFT_TEST_SCOREAT"); at = e ? atoi(e) : 0; const char *c = e ? strchr(e, ':') : NULL; sc = c ? atoi(c + 1) : 0; } @@ -1393,18 +1536,10 @@ void dm_rift_tick(uint64_t G, uint64_t player, uint8_t *main_base) { if (rr && dm_teleport(B, G, iu, rr, fp[0], fp[1])) { moved = 1; LOG("秘境:拍 %u 守护者现身,闯入首领(第 %d 位,类号 %d)远处没有空地,退场到本图入口 %d,%d(离人 %d 格)", t, i + 1, K.inv_cls[i], fp[0], fp[1], abs(fp[0] - px) + abs(fp[1] - py)); } } if (!moved) LOG("【红】秘境:拍 %u 守护者现身,闯入首领(第 %d 位)退场落点与本图入口都没传成,留在场上(作罢,不给进度)", t, i + 1); g_inv_gone[i] = K.inv_id[i]; if (iu) unit_xy(iu, &g_inv_gone_xy[i][0], &g_inv_gone_xy[i][1]); K.inv_st[i] = 4; K.inv_id[i] = 0; say("dmRiftSayInvaderGone"); } - // 一位:人右下 6 格;两位:一左一右各 6 格。每位先照常按层改(守护者 = 本层怪物等级 + 3,起算层也 + 3,同吃本层总倍率),两位时再各乘 s(生命)与 d(伤害) - // One Guardian: 6 tiles to the lower right of the player; two: 6 tiles to the left and to the right. Each is first scaled by level as usual (Guardian = this level's monster level + 3, the starting level + 3 as well, with this level's total multiplier), and with two each is additionally multiplied by s (life) and d (damage) - static const int ox[2][2] = { { 6, 0 }, { 6, -6 } }, oy[2][2] = { { 6, 0 }, { 6, 6 } }; int x, y, n = 0; unit_xy(player, &x, &y); hs_sync(); - for (int i = 0; i < K.nplan && i < 2; i++) { int32_t pos[2] = { x + ox[K.nplan - 1][i], y + oy[K.nplan - 1][i] }; uint64_t rr = free_spot(G, unit_room(player), pos); - uint64_t u = rr ? ((uint64_t (*)(uint64_t, uint64_t, int, int, int, int, int, int, uint64_t))(B + 0x7ce630))(G, rr, 1, K.gcls[i], pos[0], pos[1], 1, 0, 0x10) : 0; - if (!u) { LOG("【红】秘境:守护者第 %d 位(类号 %d)没刷出来", i + 1, K.gcls[i]); continue; } - K.guards[i] = *(uint32_t *)(uintptr_t)(u + 8); if (!K.guard) K.guard = K.guards[i]; n++; - if (lowhp) ss(u, 6, 256); else if (K.tier >= 9) { g_hp_mul = K.nplan == 2 ? hi_duo_x1000(0) : 1000; scale_monster(G, u, target_level(player) + 3, dm_rift_tier_level(9, gs(player, 12)) + 3); g_hp_mul = 1000; } - if (K.nplan == 2 && !lowhp) ss(u, 25, (int)((100LL + gs(u, 25)) * hi_duo_x1000(1) / 1000 - 100)); // 伤害:属性 25 是「伤害 +N%」,整体乘 d 即 (100 + N) × d − 100 | damage: stat 25 is "damage +N%", so multiplying the whole by d gives (100 + N) x d - 100 - HS.guard_hp += gs(u, 7) >> 8; - LOG("秘境:拍 %u 刷守护者%s 类号 %d id %u 等级 %d 生命 %d 伤害百分比 %d", t, K.nplan == 2 ? (i ? "(第二位)" : "(第一位)") : "", K.gcls[i], K.guards[i], gs(u, 12), gs(u, 7) >> 8, gs(u, 25)); } - atomic_store(&K.gtotal, n); if (n) say(K.nplan == 2 && n == 2 ? "dmRiftSayGuardians" : "dmRiftSayGuardian"); } + guard_wave(G, player, t, lowhp); } + // 两波之间:上一波全倒 WAVE_GAP 拍后刷下一波 + // Between two waves: WAVE_GAP ticks after the previous wave is all down, the next wave is spawned + if (K.wave_t && t >= K.wave_t + WAVE_GAP && atomic_load(&K.st) == ST_RUN) { K.wave_t = 0; guard_wave(G, player, t, lowhp); } // 测试替身 DM_RIFT_TEST_DUMMY=<每秒点数>:对在场的每位守护者按固定输出扣当前生命(留 1 点,由随从补最后一下)——人物不用真打,用来出「承伤每秒峰值」的相对值 // Test stand-in DM_RIFT_TEST_DUMMY=: deduct current life from every Guardian present at a fixed output (leaving 1 point, with a minion delivering the last hit) - the character does not have to fight for real; used to obtain relative values of the "per-second peak of damage taken" { static int dps = -1; if (dps < 0) { const char *e = getenv("DM_RIFT_TEST_DUMMY"); dps = e ? atoi(e) : 0; } @@ -1418,5 +1553,6 @@ void dm_rift_tick(uint64_t G, uint64_t player, uint8_t *main_base) { for (int i = 0; i < 3; i++) { if (!K.guards[i]) continue; uint64_t u = find_unit(G, 1, K.guards[i]); if (!u) { alive++; continue; } /* 不在单位表里(房间卸载):不当它死了 | not in the unit table (room unloaded): do not treat it as dead */ uint32_t m = *(uint32_t *)(uintptr_t)(u + 0xc); if (m == 0 || m == 12) { last = u; deadn++; static uint32_t said[3]; if (said[i] != K.guards[i]) { said[i] = K.guards[i]; LOG("秘境:拍 %u 守护者死亡(类号 %d id %u)", t, K.gcls[i], K.guards[i]); } } else alive++; } atomic_store(&K.gdead, deadn); - if (!alive && last) { atomic_store(&K.guard_dead, 1); LOG("秘境:拍 %u 守护者全部死亡 → 结算", t); finish(G, player, last); } } + if (!alive && last && K.wave + 1 < K.nwave) { memset(K.guards, 0, sizeof K.guards); K.wave++; K.wave_t = t; atomic_store(&K.gdead, 0); atomic_store(&K.gtotal, 0); LOG("秘境:拍 %u 守护者第 %d 波全部倒下,%d 拍后刷第 %d 波", t, K.wave, WAVE_GAP, K.wave + 1); } + else if (!alive && last) { atomic_store(&K.guard_dead, 1); LOG("秘境:拍 %u 守护者全部死亡 → 结算", t); finish(G, player, last); } } } diff --git a/dm/host/dm_rift.h b/dm/host/dm_rift.h index e5e40a0..9914763 100644 --- a/dm/host/dm_rift.h +++ b/dm/host/dm_rift.h @@ -2,7 +2,7 @@ // Rift tower climb (dm_rift.c) #pragma once #include -typedef struct { int tier; float progress; int secs_left, done, guardian, inc, next, overtime, goal, gdead, gtotal; } dm_rift_hud_t; /* goal = 没结算时第二行该写哪一句(宿主定,显示方只照着选串):0 进度目标、1 击败守护者、2 击败守护者(已倒 / 总数)、3 已超时、4 已超时 + 击败守护者、5 已超时 + 击败守护者(已倒 / 总数);gdead / gtotal = 已倒下与本场已刷出的守护者数 | goal = which sentence the second line should show before completion (decided by the host; the display only picks the string accordingly): 0 progress goal, 1 slay the Guardian, 2 slay the Guardians (fallen / total), 3 overtime, 4 overtime + slay the Guardian, 5 overtime + slay the Guardians (fallen / total); gdead / gtotal = Guardians fallen and Guardians spawned this run */ // overtime = 进行中且限时已到(还能打完拿掉落,不计通关);与菜单里的同名量同源;next = 本层完成后下一次打第几层(封顶 100;等于 tier = 不涨:超时,或已在最高层)。显示方只读它,不自己用 tier + inc 算 | overtime = in progress and the time limit has passed (can still be finished for loot, does not count as a clear); the same source as the quantity of the same name in the menu; next = which level will be played after this one is completed (capped at 100; equal to tier = no increase: overtime, or already at the highest level). Display code only reads it and does not compute tier + inc itself +typedef struct { int tier; float progress; int secs_left, done, guardian, inc, next, overtime, goal, gdead, gtotal, wave, nwave; } dm_rift_hud_t; /* goal = 没结算时第二行该写哪一句(宿主定,显示方只照着选串):0 进度目标、1 击败守护者、2 击败守护者(已倒 / 总数)、3 已超时、4 已超时 + 击败守护者、5 已超时 + 击败守护者(已倒 / 总数);gdead / gtotal = 已倒下与本场已刷出的守护者数 | goal = which sentence the second line should show before completion (decided by the host; the display only picks the string accordingly): 0 progress goal, 1 slay the Guardian, 2 slay the Guardians (fallen / total), 3 overtime, 4 overtime + slay the Guardian, 5 overtime + slay the Guardians (fallen / total); gdead / gtotal = Guardians fallen and Guardians spawned this run */ // overtime = 进行中且限时已到(还能打完拿掉落,不计通关);与菜单里的同名量同源;next = 本层完成后下一次打第几层(封顶 100;等于 tier = 不涨:超时,或已在最高层)。显示方只读它,不自己用 tier + inc 算 | overtime = in progress and the time limit has passed (can still be finished for loot, does not count as a clear); the same source as the quantity of the same name in the menu; next = which level will be played after this one is completed (capped at 100; equal to tier = no increase: overtime, or already at the highest level). Display code only reads it and does not compute tier + inc itself void dm_rift_tick(uint64_t G, uint64_t player, uint8_t *main_base); // 服务端拍(diag.c) | Server tick (diag.c) void dm_rift_c2s(uint64_t G, const uint8_t *pkt, uint32_t len); // 客户端命令(点门) | Client command (door tap) void dm_rift_client_pump(uint8_t *main_base); // 取手柄处(dm_world.c):认击杀、新刷出的怪 | At the controller sampling point (dm_world.c): recognize kills and newly spawned monsters diff --git a/dm/host/tests/t_rift_next.c b/dm/host/tests/t_rift_next.c index 98e5ab7..afab59d 100644 --- a/dm/host/tests/t_rift_next.c +++ b/dm/host/tests/t_rift_next.c @@ -63,6 +63,16 @@ int main(void) { { static const struct { uint32_t cls; int want; } bc[] = { { 561, 0 }, { 562, 1 }, { 564, 1 }, { 566, 1 }, { 567, 0 }, { 570, 1 }, { 571, 0 }, { 544, 0 }, { 45, 0 } }; for (unsigned i = 0; i < sizeof bc / sizeof *bc; i++) if (boss_summon(bc[i].cls) != bc[i].want) { fails++; printf(" ✗ boss_summon(%u) 应为 %d\n", bc[i].cls, bc[i].want); } } printf("invader_guard %s:在场与已退场的闯入首领都算特殊单位\n", fails ? "失败" : "OK"); + // 特殊精英的梯度(设计稿第二十四节):原生怪留几成 / 一场最多几组 / 同时在场几组。74 层及以下 = 100% / 0 / —(逐位不变) + // Special elite gradient (design draft section 24): share of native monsters kept / max groups per run / groups present at once. Level 74 and below = 100% / 0 / - (unchanged bit for bit) + { static const struct { int tier, nat, quota, cap; } sc[] = { { 1, 100, 0, 2 }, { 74, 100, 0, 2 }, { 75, 80, 2, 2 }, { 79, 80, 2, 2 }, { 80, 55, 5, 2 }, { 84, 55, 5, 2 }, { 85, 30, 7, 2 }, { 89, 30, 7, 2 }, { 90, 0, 1 << 30, 3 }, { 100, 0, 1 << 30, 3 } }; + for (unsigned i = 0; i < sizeof sc / sizeof *sc; i++) if (su_nat_pct(sc[i].tier) != sc[i].nat || su_quota(sc[i].tier) != sc[i].quota || su_cap(sc[i].tier) != sc[i].cap) { fails++; printf(" ✗ 第 %d 层特殊精英梯度应为 %d%% / %d 组 / 同时 %d 组\n", sc[i].tier, sc[i].nat, sc[i].quota, sc[i].cap); } + // 池:43 行、不重样、不含剔掉的 23 行、含女伯爵(6)与随从 9 只的三行(24、36、38,有巴尔的场在抽的时候跳过) + // Pool: 43 rows, no duplicates, none of the 23 removed rows, includes the Countess (6) and the three rows with 9 minions (24, 36, 38; skipped when drawing for a run with Baal) + static const uint8_t out[] = { 5, 10, 15, 18, 20, 26, 27, 28, 29, 30, 31, 39, 41, 42, 43, 44, 45, 60, 61, 62, 63, 64, 65 }; int seen[66] = { 0 }, bad = sizeof k_su_pool != 43; + for (unsigned i = 0; i < sizeof k_su_pool; i++) { if (k_su_pool[i] > 65 || seen[k_su_pool[i]]++) bad = 1; } for (unsigned i = 0; i < sizeof out; i++) bad |= seen[out[i]]; bad |= !seen[6] || !seen[24] || !seen[36] || !seen[38]; + if (bad) { fails++; printf(" ✗ 特殊精英的池不对(应 43 行、不重样、不含剔掉的 23 行)\n"); } + printf("su_tiers %s:10 格梯度 + 池 43 行\n", fails ? "失败" : "OK"); } printf("t_rift_next %s:%d 格(层 × 晋级量)下一层 = 手写期望且 ≤ 100,宿主与顶部条同值\n", fails ? "失败" : "OK", n); return fails != 0; } diff --git a/dm/i18n/literal_whitelist.tsv b/dm/i18n/literal_whitelist.tsv index 3033677..5ca538c 100644 --- a/dm/i18n/literal_whitelist.tsv +++ b/dm/i18n/literal_whitelist.tsv @@ -113,3 +113,6 @@ host/dm_custom.c @DM_WIDGET_OK 同上 host/dm_rift_ui.c @DM_WIDGET_OK 同上 host/dm_autobuff.c * 技能名、排除理由、测试读数都只进日志;这个功能屏上没有自己的文字(玩家看到的是原版的施法动作) ios/Sources/dm_shader_prep.m * 公开版壳专用的「首次准备着色器」页(整个文件在 #ifdef DM_SHELL 里,内测包不编):这时宿主与中英表还没起,中英两套文字就写在文件里、跟系统语言走 +host/dm_rift.c (第 1 波) 只进日志:刷守护者那行标第几波(分波时) +host/dm_rift.c (第 2 波) 同上 +host/dm_rift.c (第 3 波) 同上 diff --git a/dm/i18n/ui_text.tsv b/dm/i18n/ui_text.tsv index 634a0ca..cfc416d 100644 --- a/dm/i18n/ui_text.tsv +++ b/dm/i18n/ui_text.tsv @@ -135,6 +135,11 @@ dmDlCellGo 用流量下载 Use Cellular Data 蜂窝网络提示框按钮 dmDlProgress 正在下载游戏资源\n%.2f / %.2f GB(%.0f%%) %.1f MB/s Downloading game resources\n%.2f / %.2f GB (%.0f%%) %.1f MB/s 资源下载页进度(托管下载) dmDlPaused 下载已暂停(检查网络),恢复后自动继续 Download paused (check your network). It resumes automatically. 资源下载页 dmDlPackWait 系统还在准备资源包,完成后自动继续 The system is still preparing the resource pack. It continues automatically. 资源下载页(main.m) +dmDlInstalling 下载完成,系统正在安装资源包\n可能要几分钟,请保持本 App 在前台\n资源包 %.2f GB,本机可用 %.2f GB Download complete. The system is installing the resource pack.\nThis can take a few minutes. Keep this app open.\nPack %.2f GB, %.2f GB free on this device 资源下载页:托管下载到 100% 之后(main.m) +dmDlInstallSpace 下载完成,但本机空间不够系统安装资源包\n资源包 %.2f GB,%@ 现在可用 %.2f GB,至少还差 %.2f GB\n请在「设置 → 通用 → %@ 储存空间」清理,清理后自动继续 Download complete, but there is not enough space to install the resource pack.\nPack %.2f GB; this %@ has %.2f GB free, at least %.2f GB more needed.\nFree up space in Settings → General → %@ Storage. It continues automatically. 资源下载页:托管下载 100% 后空间不够(main.m) +dmDlPackSlow 系统安装资源包已超过 %d 分钟还没完成\n可以继续等,也可以点「改用直接下载」从下载站下载资源(断点续传) The system has been installing the resource pack for over %d minutes.\nYou can keep waiting, or tap "Download Directly" to get the resources from our download site (resumable). 资源下载页:托管安装超时(main.m) +dmDlPackSlowNoDl 系统安装资源包已超过 %d 分钟还没完成\n可以继续等;也可以点「分享诊断日志」把日志发给我们 The system has been installing the resource pack for over %d minutes.\nYou can keep waiting, or tap "Share Diagnostics" to send us the log. 资源下载页:托管安装超时、包里没配下载地址(main.m) +dmDlUseDirect 改用直接下载 Download Directly 资源下载页按钮(main.m) dmDlNotReady 游戏资源还不能用\n%@\n处理后点重试 Game resources are not ready\n%@\nFix this, then tap Retry 资源下载页(main.m) dmDlWill 将下载游戏资源:还要下 %@(共 %.1f GB) Downloading game resources: %@ remaining (%.1f GB total) 资源下载页:自动开始的大下载,开始前写明大小(%@ = 「4 MB」「4.1 GB」) dmDlNotStarted %@游戏资源下载没开始:%@\n%@\n也可以从内测页手动下载资源包,放进「我的 iPhone → D2R Mobile」 %@The resource download could not start: %@\n%@\nYou can also download the resource pack from the beta page and put it in "On My iPhone → D2R Mobile" 资源下载页:取不到下载地址 / 清单时停在这一页(前缀、原因、下一步) @@ -208,6 +213,7 @@ dmRiftSayFoes 本场有 %d 位强敌 %d powerful foes this run 秘境系统提 dmRiftSayInvader 强敌逼近! A powerful foe approaches! 秘境系统提示(dm_rift.c):80 层起途中闯入一位首领,刷出前约 3 秒提示;英文:拟 dmRiftSayInvaderGone 闯入者退去了 The intruder withdraws 秘境系统提示(dm_rift.c):守护者现身时,还在场的闯入首领退场;英文:拟 dmRiftSayGuardians 进度已满:两位守护者现身! Two Rift Guardians appear! 秘境系统提示(dm_rift.c):75 层起守护者是两位;英文:同 dmRiftSayGuardian 的用词 +dmRiftSayWave 守护者第 %d 波现身(共 %d 波) Guardian wave %d of %d 秘境系统提示(dm_rift.c):95 层起守护者分波,第 2 波起每波现身时说一声;英文:拟 dmRiftSayGuardian 进度已满:守护者现身! The Rift Guardian appears! 秘境系统提示(dm_rift.c);英文:Rift Guardian 取自暗黑 3 官方 2.1.0 补丁说明(news.blizzard.com/en-us/article/14569138);出现时的界面原句没查到,拟 dmElyToaGround 背包已满,赦免之证掉在脚边 Inventory full: Token of Absolution dropped 极乐世界新角色补齐(dm_elysium.c):背包放不下时的系统提示;英文物品名 = 暗黑 2 原版 Token of Absolution dmMercSlotLocked 通关地狱后打通秘境10层解锁 Clear Greater Rift Level 10 to unlock 佣兵新装备位没解锁时的系统提示(dm_rift.c;中文是 原句);英文:Greater Rift 取暗黑 3 原文 @@ -262,6 +268,7 @@ dmRiftHudGuard 守护者现身 Rift Guardian 秘境顶部进度条(dm_rift_hud dmRiftHudNext 下次第 %d 层 Next: Level %d 秘境顶部进度条(dm_rift_hud.m,UIKit);英文:拟 dmRiftHudTop 已通关最高层 Highest level cleared 秘境顶部进度条(dm_rift_hud.m,UIKit):第 100 层限时内通关,没有下一层了(公开仓库);英文:拟 dmRiftHudOver 已超时:打完仍有掉落,不计通关 Overtime: drops, no clear 秘境顶部进度条(dm_rift_hud.m,UIKit)第二行:限时已到、守护者还没倒(公开仓库);英文:拟 +dmRiftHudKillWave 守护者 第 %d/%d 波(%d/%d) Guardians %d/%d (%d/%d) 秘境顶部进度条第二行:守护者分波时(95 层起)写第几波 / 共几波与这一波已倒 / 总数;英文:拟,栏宽所限不写 wave dmRiftHudKillN 击败守护者(%d/%d) Slay the Guardians (%d/%d) 秘境顶部进度条第二行:守护者两位以上时带已倒 / 总数;英文:同 dmRiftHudKill 的用词 dmRiftHudOverKill 已超时:击败守护者仍有掉落 Overtime: slay it for drops 秘境顶部进度条第二行:已超时且守护者在场(一位);英文:拟 dmRiftHudOverKillN 已超时:击败守护者(%d/%d)仍有掉落 Overtime: slay %d/%d for drops 同上,守护者两位以上;英文:拟 diff --git a/dm/ios/Sources/dm_rift_hud.m b/dm/ios/Sources/dm_rift_hud.m index a2e5c38..888db03 100644 --- a/dm/ios/Sources/dm_rift_hud.m +++ b/dm/ios/Sources/dm_rift_hud.m @@ -76,7 +76,7 @@ void dm_rift_hud_draw(UIView *host, CGRect wr, BOOL hide) { set_text(sub, st, d2font(14 * u), white, CGRectMake(48 * u, 9 * u, 130 * u, 19 * u), kCAAlignmentLeft); set_text(timer, [NSString stringWithFormat:@"%d:%02d", s / 60, s % 60], d2font(17 * u), (s <= 60 && !h.done) ? red : gold, CGRectMake(W - 90 * u, 6 * u, 80 * u, 22 * u), kCAAlignmentRight); NSString *gl = h.done ? (!h.inc ? @(dm_ui("dmRiftHudSame")) : h.next > h.tier ? [NSString stringWithFormat:@(dm_ui("dmRiftHudNext")), h.next] : @(dm_ui("dmRiftHudTop"))) : h.goal == 5 ? [NSString stringWithFormat:@(dm_ui("dmRiftHudOverKillN")), h.gdead, h.gtotal] : h.goal == 4 ? @(dm_ui("dmRiftHudOverKill")) : h.goal == 3 ? @(dm_ui("dmRiftHudOver")) - : h.goal == 2 ? [NSString stringWithFormat:@(dm_ui("dmRiftHudKillN")), h.gdead, h.gtotal] : h.goal == 1 ? @(dm_ui("dmRiftHudKill")) : [NSString stringWithFormat:@(dm_ui("dmRiftHudGoal")), (int)(h.progress * 100)]; // 已超时:第二行换成这一句,优先于「击败守护者」/ 进度目标(第一行照旧写第几层 / 守护者现身) | overtime: the second line becomes this sentence, taking priority over "Slay the Rift Guardian" / the progress goal (the first line still says which level / that the Guardian has appeared) + : (h.goal == 1 || h.goal == 2) && h.nwave > 1 ? [NSString stringWithFormat:@(dm_ui("dmRiftHudKillWave")), h.wave, h.nwave, h.gdead, h.gtotal] : h.goal == 2 ? [NSString stringWithFormat:@(dm_ui("dmRiftHudKillN")), h.gdead, h.gtotal] : h.goal == 1 ? @(dm_ui("dmRiftHudKill")) : [NSString stringWithFormat:@(dm_ui("dmRiftHudGoal")), (int)(h.progress * 100)]; // 已超时:第二行换成这一句,优先于「击败守护者」/ 进度目标(第一行照旧写第几层 / 守护者现身) | overtime: the second line becomes this sentence, taking priority over "Slay the Rift Guardian" / the progress goal (the first line still says which level / that the Guardian has appeared) set_text(goal, gl, d2font(12 * u), grey, CGRectMake(10 * u, 32 * u, W - 20 * u, 17 * u), kCAAlignmentLeft); CGRect tr = CGRectMake(11 * u, 55 * u, W - 22 * u, 10 * u); // 含 1 单位外框(条 8 + 外框各 1) // 进度条:外框暗边 + 深底,填充金褐(守护者转暗红),每 10% 一道刻痕,两端菱形钉 | Includes the 1-unit outer frame (bar 8 + frame 1 on each side) // Progress bar: dark-edged outer frame + deep background, golden-brown fill (turns dark red for the guardian), a notch every 10%, diamond studs at both ends track.frame = tr; track.backgroundColor = rgb(25, 20, 14, 1).CGColor; track.borderColor = rgb(95, 78, 48, 1).CGColor; track.borderWidth = MAX(1, u); diff --git a/dm/ios/Sources/dm_sharelog.m b/dm/ios/Sources/dm_sharelog.m index c48fe0c..215cba8 100644 --- a/dm/ios/Sources/dm_sharelog.m +++ b/dm/ios/Sources/dm_sharelog.m @@ -116,3 +116,4 @@ static void on_click(void) { // 宿主在游戏主线程调:玩家点了「 }); } void dm_sharelog_boot(void) { g_t0 = NSDate.date; dm_sharelog_init(on_click); } // main.m 起宿主前调一次 | main.m calls this once before starting the host +void dm_sharelog_share(void) { on_click(); } // 游戏外的界面直接调(资源下载页的「分享诊断日志」按钮,main.m AssetVC) | called directly from screens outside the game (the "Share diagnostic log" button on the asset download page, main.m AssetVC) diff --git a/dm/ios/Sources/main.m b/dm/ios/Sources/main.m index 75aaafa..c575249 100644 --- a/dm/ios/Sources/main.m +++ b/dm/ios/Sources/main.m @@ -739,6 +739,14 @@ static void run_boot(void); @property (strong) UILabel *label; @property (strong) UIProgressView *bar; @property (strong) UIButton *retry; @property (assign) int64_t last; @property (assign) CFAbsoluteTime lastT; @property (assign) double rate; @property (strong) nw_path_monitor_t netmon; @property (assign) int netDown, stopped; // 守着网络:停在「下载没开始」那一页时,网络从不通变成通就自己重试 | network watch: while sitting on the "download did not start" page, retry automatically when the network goes from down to up +// 托管下载(TestFlight):进度到 100% 之后系统还要把资源包装进本地(头文件:完成通知 = 下完且本地可用),这段不给进度;完成回调 / 通知不来就会一直停在进度字上(线上玩家卡 10 分钟)。 +// 所以守着系统的「本地可用」状态自己轮询(5 秒一次、30 秒记一行日志),到了就进游戏,不只等回调;100% 后屏上说明在安装、空间不够写清差多少; +// 安装超时 / 暂停 / 报错时给「改用直接下载」(走下载站那条路,包里配了下载地址才给)。packFull = 进度到 100% 的时刻,gone = 已改走直接下载(之后托管的回调只记日志) +// Hosted download (TestFlight): after progress reaches 100% the system still has to install the asset pack locally (header: completion notification = downloaded and available locally), and gives no progress for that part; if the completion callback / notification does not come, the screen stays on the progress text forever (players in the field were stuck for 10 minutes). +// So we watch the system's "available locally" state and poll it ourselves (every 5 seconds, a log line every 30 seconds) and enter the game when it is reached, instead of only waiting for the callback; after 100% the screen explains that it is installing, and if space is short it says by how much; +// on install timeout / pause / error it offers "Use direct download" (the download-site path, only offered if the package has a download address configured). packFull = the moment progress reached 100%, gone = already switched to direct download (after that, callbacks from the hosted download are only logged) +@property (strong) UIButton *useDirect, *share; @property (strong) dispatch_source_t poll; @property (assign) CFAbsoluteTime packT, packFull, logT, testAvailAt; +@property (assign) int64_t packBytes, packDone; @property (assign) int gone, slowShown, finished, textKind, packStop; // packStop:系统报了暂停 / 失败,屏上留那条说明,不再换回「正在安装」 | packStop: the system reported paused / failed; the screen keeps that explanation and does not switch back to "Installing" @end @implementation AssetVC - (void)netUp { if (self.netDown && self.stopped) { plog("assets: 网络通了,自动重试"); self.netDown = 0; [self start]; } else self.netDown = 0; } @@ -765,24 +773,108 @@ static void run_boot(void); self.retry = [UIButton buttonWithType:UIButtonTypeSystem]; self.retry.frame = CGRectMake(b.size.width / 2 - 60, b.size.height / 2 + 50, 120, 44); [self.retry setTitle:T("dmDlRetry") forState:UIControlStateNormal]; self.retry.hidden = YES; self.retry.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; [self.retry addTarget:self action:@selector(start) forControlEvents:UIControlEventTouchUpInside]; - [self.view addSubview:self.label]; [self.view addSubview:self.bar]; [self.view addSubview:self.retry]; + self.useDirect = [UIButton buttonWithType:UIButtonTypeSystem]; [self.useDirect setTitle:T("dmDlUseDirect") forState:UIControlStateNormal]; self.useDirect.hidden = YES; + [self.useDirect addTarget:self action:@selector(useDirectTap) forControlEvents:UIControlEventTouchUpInside]; + self.share = [UIButton buttonWithType:UIButtonTypeSystem]; [self.share setTitle:T("dmPauseShareLog") forState:UIControlStateNormal]; self.share.hidden = YES; + [self.share addTarget:self action:@selector(shareTap) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:self.label]; [self.view addSubview:self.bar]; [self.view addSubview:self.retry]; [self.view addSubview:self.useDirect]; [self.view addSubview:self.share]; UIApplication.sharedApplication.idleTimerDisabled = YES; [self watchNet]; [self start]; } +- (void)viewDidLayoutSubviews { // 按钮一行居中排:重试 / 改用直接下载 / 分享诊断日志,只排露出来的 | buttons centred in one row: Retry / Use direct download / Share diagnostic log, only the ones showing + [super viewDidLayoutSubviews]; CGRect b = self.view.bounds; NSMutableArray *row = [NSMutableArray array]; CGFloat w = 0; + for (UIButton *x in @[self.retry, self.useDirect, self.share]) if (!x.hidden) { [x sizeToFit]; [row addObject:x]; w += MAX(120, x.bounds.size.width + 24) + (row.count > 1 ? 16 : 0); } + CGFloat x0 = (b.size.width - w) / 2; + for (UIButton *x in row) { CGFloat bw = MAX(120, x.bounds.size.width + 24); x.frame = CGRectMake(x0, b.size.height / 2 + 50, bw, 44); x0 += bw + 16; } +} +- (void)showBtn:(UIButton *)x { dispatch_async(dispatch_get_main_queue(), ^{ x.hidden = NO; [self.view setNeedsLayout]; }); } +- (void)shareTap { plog("assets: 玩家点了分享诊断日志"); void dm_sharelog_share(void); dm_sharelog_share(); } +- (void)useDirectTap { + plog("assets: 玩家点了改用直接下载(托管已等 %.0f 秒,进度 %.2f / %.2f GB%s)", CFAbsoluteTimeGetCurrent() - self.packT, self.packDone / 1e9, self.packBytes / 1e9, self.packFull ? ",已到 100%" : ""); + self.gone = 1; if (self.poll) { dispatch_source_cancel(self.poll); self.poll = nil; } + self.useDirect.hidden = YES; [self.view setNeedsLayout]; [self direct:nil]; +} +- (void)offerDirect:(int)why { // 托管那条路走不下去时给玩家另一条(why:1 安装超时、2 暂停、3 报错):包里没配下载地址(照公开仓库出的包)就不给,只记日志 | when the hosted path cannot go on, give the player another path (why: 1 install timeout, 2 paused, 3 error): if the package has no download address configured (packages built from the public repository), it is not offered, only logged + if (self.gone) return; + if (!res_dl_configured()) { static int lg; if (!lg++) plog("assets: 托管走不下去(%d:1 安装超时 2 暂停 3 报错),但本包没配资源下载地址,不给「改用直接下载」", why); return; } + plog("assets: 托管走不下去(%d:1 安装超时 2 暂停 3 报错)→ 露出「改用直接下载」", why); [self showBtn:self.useDirect]; [self showBtn:self.share]; +} +static double slow_s(void) { const char *t = getenv("DM_TEST_BA_SLOW"); return t ? atof(t) : 300; } // 100% 后等系统装进本地多久算慢(头文件只说完成通知 = 本地可用,中间要多久没写;给 5 分钟);测试开关缩短 | how long to wait after 100% for the system to install it locally before it counts as slow (the header only says the completion notification = available locally, not how long it takes in between; 5 minutes is given); a test switch shortens it +static int64_t free_bytes(void) { // 给 App 用的可用空间(系统「重要用途」口径,同设置里显示的);测试开关 DM_TEST_BA_FREE= 造空间不够 | free space available to the App (the system's "important usage" measure, the same as shown in Settings); test switch DM_TEST_BA_FREE= stages not enough space + const char *t = getenv("DM_TEST_BA_FREE"); if (t) return (int64_t)(atof(t) * 1e9); + NSURL *u = [NSURL fileURLWithPath:NSHomeDirectory()]; NSNumber *v = nil; [u getResourceValue:&v forKey:NSURLVolumeAvailableCapacityForImportantUsageKey error:nil]; return v.longLongValue; +} +- (BOOL)packAvail { + if (getenv("DM_TEST_BA")) return self.testAvailAt > 0 && CFAbsoluteTimeGetCurrent() >= self.testAvailAt; + if (@available(iOS 26.4, *)) return [BAAssetPackManager.sharedManager assetPackIsAvailableLocallyWithIdentifier:@"romfs"]; + return NO; +} +- (void)logPack:(BOOL)avail free:(int64_t)fr { + CFAbsoluteTime now = CFAbsoluteTimeGetCurrent(); double w = now - self.packT, f = self.packFull ? now - self.packFull : -1, d = self.packDone / 1e9, t = self.packBytes / 1e9, g = fr / 1e9; int a = avail; + if (getenv("DM_TEST_BA")) { plog("assets: 托管状态(测试现场):已等 %.0f 秒,进度 %.2f / %.2f GB(100%% 后 %.0f 秒,-1 = 没到),系统说本地可用 %d,可用空间 %.2f GB", w, d, t, f, a, g); return; } + if (@available(iOS 26.4, *)) { + [BAAssetPackManager.sharedManager getLocalStatusOfAssetPackWithIdentifier:@"romfs" completionHandler:^(BAAssetPackStatus st) { + plog("assets: 托管状态:已等 %.0f 秒,进度 %.2f / %.2f GB(100%% 后 %.0f 秒,-1 = 没到),系统说本地可用 %d,可用空间 %.2f GB;系统状态位 0x%lx(1 可下载 2 有更新 4 最新 8 过期 0x10 已撤 0x20 下载中 0x40 已下完)", + w, d, t, f, a, g, (unsigned long)st); }]; + } else plog("assets: 托管状态:已等 %.0f 秒,进度 %.2f / %.2f GB(100%% 后 %.0f 秒,-1 = 没到),系统说本地可用 %d,可用空间 %.2f GB", w, d, t, f, a, g); +} +- (void)packText:(int64_t)fr { // 100% 之后屏上那段:空间不够 > 超时 > 正在安装 | the passage on screen after 100%: not enough space > timeout > installing + NSString *dev = UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad ? @"iPad" : @"iPhone"; + int k = self.packBytes > 0 && fr < self.packBytes ? 3 : self.slowShown ? 2 : 1; + NSString *t = k == 3 ? [NSString stringWithFormat:T("dmDlInstallSpace"), self.packBytes / 1e9, dev, fr / 1e9, (self.packBytes - fr) / 1e9, dev] + : k == 2 ? [NSString stringWithFormat:T(res_dl_configured() ? "dmDlPackSlow" : "dmDlPackSlowNoDl"), (int)MAX(1, lround(slow_s() / 60))] // 没配下载地址就没有「改用直接下载」按钮,文字不提它 | with no download address configured there is no "Use direct download" button, and the text does not mention it + : [NSString stringWithFormat:T("dmDlInstalling"), self.packBytes / 1e9, fr / 1e9]; + if (k != self.textKind) { self.textKind = k; [self say:t]; } // 换了一种说法才进日志;只是空间数字变了就只改屏上的字 | only goes into the log when the wording changes; if only the space numbers changed, just update the text on screen + else if (![self.label.text isEqualToString:t]) dispatch_async(dispatch_get_main_queue(), ^{ self.label.text = t; }); +} +- (void)pollPack { + if (self.gone) return; + CFAbsoluteTime now = CFAbsoluteTimeGetCurrent(); BOOL avail = [self packAvail]; int64_t fr = free_bytes(); + if (now - self.logT >= 30) { self.logT = now; [self logPack:avail free:fr]; } + if (avail) { plog("assets: 轮询:系统说资源包本地可用(完成回调%s)→ 进游戏", self.finished ? "也到了" : "没到"); [self ready]; return; } + if (!self.packFull || self.packStop) return; + if (!self.slowShown && now - self.packFull >= slow_s()) { self.slowShown = 1; plog("assets: 进度 100%% 后 %.0f 秒系统仍没装好", now - self.packFull); [self offerDirect:1]; } + [self packText:fr]; +} +- (void)watchPack { // 托管下载开始后:守着系统状态(主线程定时器) | after the hosted download starts: watch the system state (main-thread timer) + if (self.poll) return; self.packT = CFAbsoluteTimeGetCurrent(); self.logT = 0; + dispatch_source_t s = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); self.poll = s; __weak AssetVC *w = self; + dispatch_source_set_timer(s, dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), 5 * NSEC_PER_SEC, NSEC_PER_SEC / 2); + dispatch_source_set_event_handler(s, ^{ [w pollPack]; }); dispatch_resume(s); +} +// 测试开关 DM_TEST_BA=finish|late|silent|fail(Mac 上的 iOS 包造托管下载现场,资源其实在本地):3 秒内假进度走到 100%,之后—— +// finish 再 3 秒送完成通知;late 什么都不来(配 DM_TEST_BA_SLOW=<秒> 看超时);silent 不送通知、8 秒后「系统说本地可用」(看轮询自愈);fail 送下载失败。 +// DM_TEST_BA_TAP=<秒>:到点替玩家点「改用直接下载」(按钮没露出来就报红) +// Test switch DM_TEST_BA=finish|late|silent|fail (stages a hosted download scene for the iOS package on the Mac, the resources are actually local): fake progress goes to 100% within 3 seconds, then - +// finish sends the completion notification 3 seconds later; late sends nothing (with DM_TEST_BA_SLOW= to see the timeout); silent sends no notification and "the system says it is available locally" after 8 seconds (to see polling recover); fail sends a download failure. +// DM_TEST_BA_TAP=: at that time, taps "Use direct download" for the player (reports red if the button is not showing) +- (void)fakeBA:(NSString *)sc API_AVAILABLE(ios(26.0)) { + plog("assets: 测试现场 DM_TEST_BA=%s", sc.UTF8String); self.packBytes = 4130000000LL; [self watchPack]; [self say:T("dmDlDownloading")]; + NSProgress *g = [NSProgress progressWithTotalUnitCount:self.packBytes]; BAAssetPack *np = nil; + for (int i = 1; i <= 10; i++) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(i * 0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ g.completedUnitCount = self.packBytes * i / 10; [self downloadOfAssetPack:np hasProgress:g]; }); + if ([sc isEqualToString:@"silent"]) self.testAvailAt = CFAbsoluteTimeGetCurrent() + 11; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 6 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + if ([sc isEqualToString:@"finish"]) [self downloadOfAssetPackFinished:np]; + if ([sc isEqualToString:@"fail"]) [self downloadOfAssetPack:np failedWithError:[NSError errorWithDomain:@"DmTestBA" code:1 userInfo:@{NSLocalizedDescriptionKey: @"test failure"}]]; }); + const char *tp = getenv("DM_TEST_BA_TAP"); if (tp) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(atof(tp) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (self.useDirect.hidden) plog("【红】DM_TEST_BA_TAP:「改用直接下载」没露出来"); else [self useDirectTap]; }); +} - (void)say:(NSString *)t { plog("assets: %s", t.UTF8String); dispatch_async(dispatch_get_main_queue(), ^{ self.label.text = t; }); } - (void)fail:(NSString *)what error:(NSError *)e { // 直装包没有托管资源,这条路必然失败:报错只进日志,界面给玩家能照做的指引 // A direct-install build has no hosted assets, so this path always fails: the error goes only to the log, and the screen gives the player instructions they can follow plog("assets: %s失败:%s(%s %ld)", what.UTF8String, e.localizedDescription.UTF8String, e.domain.UTF8String, (long)e.code); [self say:no_assets_text()]; - dispatch_async(dispatch_get_main_queue(), ^{ self.retry.hidden = NO; }); + [self showBtn:self.retry]; } - (void)start { - self.retry.hidden = YES; self.stopped = 0; self.last = 0; self.lastT = CFAbsoluteTimeGetCurrent(); + self.retry.hidden = YES; self.stopped = 0; self.last = 0; self.lastT = CFAbsoluteTimeGetCurrent(); self.packStop = 0; self.textKind = 0; char why[2048]; + if (getenv("DM_TEST_BA") && !self.gone) { if (@available(iOS 26.0, *)) [self fakeBA:@(getenv("DM_TEST_BA"))]; return; } // 测试:造托管下载现场(fakeBA) | test: stage a hosted download scene (fakeBA) if (!getenv("DM_ASSETS_TEST") && romfs_locate(why, sizeof why)) { [self ready]; return; } // 重试时资源已到(如刚在「文件」里拷完) | Assets have already arrived on retry (e.g. just finished copying in the Files app) if (!getenv("DM_ASSETS_TEST") && g_doc_bad) { [self direct:@(why)]; return; } // 有文件夹但不完整(拷到一半 / 下到一半):不试托管下载,直接从下载站补齐;下载站走不通才报原因 | A folder exists but is incomplete (half copied / half downloaded): do not try the hosted download, fill in the rest straight from the download site; report the reason only if the download site is unreachable + if (self.gone) { [self direct:nil]; return; } // 玩家已选「改用直接下载」:重试仍走这条(托管的回调此后不接,回到托管会停在「正在下载」) | the player chose "Use direct download": retries keep going this way (callbacks from the hosted download are not taken from now on; going back to hosted would stay stuck at "Downloading") NSString *stray = !getenv("DM_ASSETS_TEST") && g_doc_stray ? @(why) : nil; // 「D2R Mobile」里有文件夹但都不是资源:托管下载、下载站都走不通时给玩家看这条 | 「D2R Mobile」 has folders but none of them is assets: show the player this message when neither the hosted download nor the download site works if (getenv("DM_ROMFS_TEST_PACK")) { [self ready]; return; } // 只测试用:托管资源包「下完了」但不合格的现场 | Test only: the scenario where the managed asset pack has "finished downloading" but does not pass validation if (getenv("DM_ASSETS_TEST") && !strcmp(getenv("DM_ASSETS_TEST"), "direct")) { [self direct:nil]; return; } // 测试:资源在本地也走真正的直接下载准备(联网取清单、盘点、查空间),配 DM_ASSET_FREE_TEST 造空间不够 | Test: with assets local, still go through the real direct-download preparation (fetch the manifest over the network, take inventory, check space); pair with DM_ASSET_FREE_TEST to fake insufficient space @@ -798,8 +890,11 @@ static void run_boot(void); [m getAssetPackWithIdentifier:@"romfs" completionHandler:^(BAAssetPack *pack, NSError *e) { if (!pack) { plog("assets: 没有托管资源包(%s),改从下载站直接下", e.localizedDescription.UTF8String); dispatch_async(dispatch_get_main_queue(), ^{ [self direct:stray]; }); return; } // 直装包走到这里必然失败 | A direct-install build always fails when it gets here [self say:T("dmDlDownloading")]; + plog("assets: 托管资源包 版本 %ld、%.2f GB,请系统确保本地可用(可用空间 %.2f GB)", (long)pack.version, pack.downloadSize / 1e9, free_bytes() / 1e9); + dispatch_async(dispatch_get_main_queue(), ^{ self.packBytes = pack.downloadSize; [self watchPack]; }); [m ensureLocalAvailabilityOfAssetPack:pack completionHandler:^(NSError *e2) { - if (e2) { [self fail:@"下载游戏资源" error:e2]; return; } + if (e2) { self.packStop = 1; [self fail:@"下载游戏资源" error:e2]; [self offerDirect:3]; return; } + plog("assets: 系统「确保本地可用」完成回调到了"); dispatch_async(dispatch_get_main_queue(), ^{ [self ready]; }); }]; }]; @@ -809,7 +904,7 @@ static void run_boot(void); // Direct-install build: download the assets straight from our own download site into Documents/D2R Mobile Resources (asset_dl.m). When the download site is unreachable the screen falls back to the original instructions (or the reason given by fallback) - (void)direct:(NSString *)fallback { if (!res_dl_configured()) { // 这个包没配下载地址(照公开仓库自己出的包):不去连、不说「下载没开始」,只讲把资源拷进来 | This build has no download address configured (a build made by yourself from the public repository): do not connect, do not say "the download has not started", only explain how to copy the resources in - plog("assets: 本包没配资源下载地址,不走下载"); [self say:fallback ? [NSString stringWithFormat:@"%@\n%@", fallback, T("dmDlCopyInShort")] : no_assets_text()]; self.bar.hidden = YES; self.retry.hidden = NO; self.stopped = 1; return; } // 这条路没有进度可报:不留一条空的进度条 | nothing to report progress on along this path: do not leave an empty progress bar + plog("assets: 本包没配资源下载地址,不走下载"); [self say:fallback ? [NSString stringWithFormat:@"%@\n%@", fallback, T("dmDlCopyInShort")] : no_assets_text()]; self.bar.hidden = YES; [self showBtn:self.retry]; self.stopped = 1; return; } // 这条路没有进度可报:不留一条空的进度条 | nothing to report progress on along this path: do not leave an empty progress bar [self say:T("dmDlConnecting")]; [DmAssetDL.shared prepare:^(NSString *err, int64_t remain, int64_t total, BOOL cellular) { if (err && DmAssetDL.shared.shortBytes > 0) { // 设备空间不够(原先只进日志、界面显示的是「先从内测页下载资源包」,跟真实原因无关):系统提示写清还差多少 | Not enough space on the device (previously this only went to the log and the screen showed 「先从内测页下载资源包」(First download the asset pack from the beta page), unrelated to the real cause): the system prompt states exactly how much is missing @@ -817,7 +912,7 @@ static void run_boot(void); NSString *dev = UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad ? @"iPad" : @"iPhone"; // 按设备写 | Wording depends on the device NSString *m = [NSString stringWithFormat:T("dmDlSpaceMsg"), DmAssetDL.shared.shortBytes / 1e9, remain / 1e9, dev, DmAssetDL.shared.freeBytes / 1e9, dev]; NSString *title = [NSString stringWithFormat:T("dmDlSpaceTitle"), dev]; - [self say:[[title stringByAppendingString:@"\n"] stringByAppendingString:m]]; self.retry.hidden = NO; + [self say:[[title stringByAppendingString:@"\n"] stringByAppendingString:m]]; [self showBtn:self.retry]; UIAlertController *a = [UIAlertController alertControllerWithTitle:title message:m preferredStyle:UIAlertControllerStyleAlert]; [a addAction:[UIAlertAction actionWithTitle:T("dmOk") style:UIAlertActionStyleDefault handler:nil]]; [self presentViewController:a animated:YES completion:^{ plog("assets: 已弹系统提示「%s」|正文:%s", title.UTF8String, [m stringByReplacingOccurrencesOfString:@"\n" withString:@" ⏎ "].UTF8String); }]; return; } @@ -829,7 +924,7 @@ static void run_boot(void); if (err) { // 下载没开始:屏上写真实原因和下一步,不落回「还没有游戏资源」(没网时玩家看到的是「没有资源」,不知道是网络、也不知道能重试) | download did not start: show the real reason and the next step on screen instead of falling back to "no game assets yet" (with no network the player saw "no assets", not knowing it was the network or that a retry was possible) plog("assets: 直接下载走不了:%s", err.UTF8String); [self say:[NSString stringWithFormat:T("dmDlNotStarted"), fallback ? [fallback stringByAppendingString:@"\n"] : @"", self.netDown ? T("dmDlNetDown") : err, self.netDown ? T("dmDlNextAuto") : T("dmDlNextRetry")]]; - self.retry.hidden = NO; self.stopped = 1; return; } + [self showBtn:self.retry]; self.stopped = 1; return; } void (^go)(void) = ^{ [self say:[NSString stringWithFormat:T("dmDlWill"), remain < 100000000 ? [NSString stringWithFormat:@"%.0f MB", remain / 1e6] : [NSString stringWithFormat:@"%.1f GB", remain / 1e9], total / 1e9]]; // 自动开始的大下载,开始前先把要下多少写在屏上 | A large download that starts automatically: show on screen how much will be downloaded before it starts self.last = total - remain; self.lastT = CFAbsoluteTimeGetCurrent(); self.rate = 0; @@ -839,33 +934,45 @@ static void run_boot(void); self.label.text = [NSString stringWithFormat:@"正在下载游戏资源(共 %.1f GB)\n%.2f / %.2f GB(%.0f%%) %.1f MB/s%@", tot / 1e9, done / 1e9, tot / 1e9, tot ? 100.0 * done / tot : 0, self.rate / 1e6, note ? [@"\n" stringByAppendingString:note] : @""]; self.bar.progress = tot ? (float)done / tot : 0; } done:^(NSString *e2) { - if (e2) { [self say:[NSString stringWithFormat:T("dmDlStopped"), e2, self.last / 1e9, total / 1e9]]; self.retry.hidden = NO; self.stopped = 1; return; } + if (e2) { [self say:[NSString stringWithFormat:T("dmDlStopped"), e2, self.last / 1e9, total / 1e9]]; [self showBtn:self.retry]; self.stopped = 1; return; } [self ready]; }]; }; if (!cellular || remain <= 0) { go(); return; } UIAlertController *a = [UIAlertController alertControllerWithTitle:T("dmDlCellTitle") message:[NSString stringWithFormat:T("dmDlCellMsg"), remain / 1e9] preferredStyle:UIAlertControllerStyleAlert]; - [a addAction:[UIAlertAction actionWithTitle:T("dmDlCellLater") style:UIAlertActionStyleCancel handler:^(UIAlertAction *x) { [self say:T("dmDlCellWait")]; self.retry.hidden = NO; }]]; + [a addAction:[UIAlertAction actionWithTitle:T("dmDlCellLater") style:UIAlertActionStyleCancel handler:^(UIAlertAction *x) { [self say:T("dmDlCellWait")]; [self showBtn:self.retry]; }]]; [a addAction:[UIAlertAction actionWithTitle:T("dmDlCellGo") style:UIAlertActionStyleDefault handler:^(UIAlertAction *x) { plog("assets: 玩家同意用流量下载"); go(); }]]; [self presentViewController:a animated:YES completion:nil]; }]; } - (void)downloadOfAssetPack:(BAAssetPack *)p hasProgress:(NSProgress *)g API_AVAILABLE(ios(26.0)) { CFAbsoluteTime now = CFAbsoluteTimeGetCurrent(); int64_t done = g.completedUnitCount, total = g.totalUnitCount; + if (self.gone) return; // 已改走直接下载:屏上是那条路的进度 | already switched to direct download: the screen shows that path's progress + self.packDone = done; if (total > 0) self.packBytes = total; + if (total > 0 && done >= total) { // 到 100%:之后是系统装包,屏上改说明(进度字不再刷) | reached 100%: from here the system installs the pack, the screen switches to an explanation (the progress text is no longer updated) + if (!self.packFull) { self.packFull = now; plog("assets: 托管下载进度到 100%%(%.2f GB),等系统装进本地;可用空间 %.2f GB", total / 1e9, free_bytes() / 1e9); + dispatch_async(dispatch_get_main_queue(), ^{ self.bar.progress = 1; [self packText:free_bytes()]; [self showBtn:self.share]; }); } + return; } 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 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)downloadOfAssetPackBegan:(BAAssetPack *)p API_AVAILABLE(ios(26.0)) { plog("assets: 系统通知托管下载开始 / 继续"); self.packStop = 0; self.textKind = 0; } +- (void)downloadOfAssetPackFinished:(BAAssetPack *)p API_AVAILABLE(ios(26.0)) { + plog("assets: 系统通知资源包下载完成%s", self.gone ? "(已改走直接下载,不接)" : ""); if (self.gone) return; self.finished = 1; dispatch_async(dispatch_get_main_queue(), ^{ [self ready]; }); } +- (void)downloadOfAssetPackPaused:(BAAssetPack *)p API_AVAILABLE(ios(26.0)) { + plog("assets: 系统通知托管下载暂停%s", self.gone ? "(已改走直接下载)" : ""); if (self.gone) return; self.packStop = 1; [self say:T("dmDlPaused")]; [self offerDirect:2]; } +- (void)downloadOfAssetPack:(BAAssetPack *)p failedWithError:(NSError *)e API_AVAILABLE(ios(26.0)) { + if (self.gone) { plog("assets: 托管下载失败(已改走直接下载):%s", e.localizedDescription.UTF8String); return; } + self.packStop = 1; [self fail:@"下载游戏资源" error:e]; [self offerDirect:3]; } - (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 if (!romfs_locate(why, sizeof why)) { - if (g_pack_wait) { [self say:T("dmDlPackWait")]; return; } // 等系统的完成通知(downloadOfAssetPackFinished)再来,不按时间等 | Come back when the system's completion notification (downloadOfAssetPackFinished) arrives; do not wait by time - [self say:[NSString stringWithFormat:T("dmDlNotReady"), @(why)]]; self.retry.hidden = NO; return; } - started = 1; + if (g_pack_wait) { if (!self.packFull) [self say:T("dmDlPackWait")]; return; } // 等系统说本地可用(完成通知或 pollPack 轮询到);100% 后屏上是 packText 那段 | waiting for the system to say it is available locally (the completion notification, or found by pollPack's polling); after 100% the screen shows the packText passage + if (self.poll) { plog("assets: 系统说可用但校验没过:%s", why); } + [self say:[NSString stringWithFormat:T("dmDlNotReady"), @(why)]]; [self showBtn:self.retry]; return; } + started = 1; if (self.poll) { dispatch_source_cancel(self.poll); self.poll = nil; } plog("assets: 资源就绪,就地起宿主"); g_need_assets = 0; self.view = front_ios_view(self.view.window.windowScene.coordinateSpace.bounds); @@ -1071,7 +1178,7 @@ int main(int argc, char *argv[]) { else plog("boot: 老机型补充包未就绪:%s", g_astc_why); } if (g_no_bc) {} - else if (getenv("DM_ASSETS_TEST")) { g_need_assets = 1; plog("boot: DM_ASSETS_TEST——强制走资源下载界面再就地起宿主(测这条路径)"); } + else if (getenv("DM_ASSETS_TEST") || getenv("DM_TEST_BA")) { g_need_assets = 1; plog("boot: DM_ASSETS_TEST——强制走资源下载界面再就地起宿主(测这条路径)"); } else if (romfs_locate(why, sizeof why)) plog("boot: 游戏资源就绪,宿主等场景到前台再装载"); else { g_need_assets = 1; plog("boot: 游戏资源还没到(%s),先显示资源下载界面", why); } } else metal_cache_report_and_clean(); diff --git a/dm/ios/run.sh b/dm/ios/run.sh index 3e20cfa..867218d 100755 --- a/dm/ios/run.sh +++ b/dm/ios/run.sh @@ -52,7 +52,7 @@ if [ "$1" = build ]; then mkdir -p Gen/msl && cp -cR "$MSL/b-$V" Gen/msl/ # 资源直接下载(直装包,Sources/asset_dl.m):地址文件列表(仓库里的 asset_pointers.txt)+ 出包时的缺省下载根地址(DM_ASSET_BASE,tools/adhoc.sh 传隧道地址;没传就不带) # Direct asset download (direct-install package, Sources/asset_dl.m): URL file list (asset_pointers.txt in the repository) + the default download root URL at packaging time (DM_ASSET_BASE; tools/adhoc.sh passes the tunnel URL; omitted if not passed) - cp asset_pointers.txt Gen/dm/; [ -n "${DM_ASSET_BASE:-}" ] && echo "$DM_ASSET_BASE" > Gen/dm/asset_base.txt + cp asset_pointers.txt Gen/dm/; if [ -n "${DM_ASSET_BASE:-}" ]; then echo "$DM_ASSET_BASE" > Gen/dm/asset_base.txt; else rm -f Gen/dm/asset_base.txt; fi # 没给就删掉上次的:生成物只跟本次输入走(原先只写不删,同一棵树先出带地址的包、再出不带的会沿用旧地址) | if not given, delete the previous one: the generated file follows only this run's input (it used to be written but never deleted, so building a package with an address and then one without in the same tree kept the old address) # 老机型补充包的自动下载根地址(DM_ASTC_PACK_BASE,<根>/manifest.json + <根>/data/…;没传 = 只能玩家用「文件」拷,见 Sources/asset_dl.m) # Root URL for automatic download of the Legacy Device Pack (DM_ASTC_PACK_BASE, /manifest.json + /data/...; not passed = players can only copy it with the Files app, see Sources/asset_dl.m) rm -f Gen/dm/astc_pack_base.txt; [ -n "${DM_ASTC_PACK_BASE:-}" ] && echo "$DM_ASTC_PACK_BASE" > Gen/dm/astc_pack_base.txt