Custom page: language is now two explicit choices, 中文 / English (#12)
The single "Language: English" checkbox becomes two side-by-side options, readable in both UIs, with a hint under the row in the chosen language: tap Apply, then close and reopen the app. Storage is unchanged (still one key). Suggested in #12.
This commit is contained in:
+2
-1
@@ -1017,7 +1017,8 @@ static int ui_classify(module_t *m, uint64_t root, int x, int y, char *hit, size
|
||||
// The settings page covers the pause menu, yet the pause menu's buttons still receive clicks (the game's dispatch does not look at who is on top): on a pause menu button and not on a clickable widget of the settings page = covered, do not click (same as "on a button covered by an upper panel").
|
||||
// Previously, while the settings page was open the whole pause menu layer was set invisible and written back on close - that is writing to the original game's widgets, violating the no-writes-to-original-widgets rule; changed to blocking here only on a hit
|
||||
{ uint64_t st = ui_panel(root, "SettingsPanel"), xy = (uint64_t)(uint32_t)x | ((uint64_t)(uint32_t)y << 32);
|
||||
if (st && *(uint8_t *)(st + 0x50) && !click_walk(st, xy, 1, (uint64_t)m->base)) { // 设置页自己可点的控件照常;点在它的底板 / 列表空处时,游戏会把这一下交给底下的暂停菜单按钮 | The settings page's own clickable widgets work as usual; when the tap is on its backing / empty list space, the game would hand this tap to the pause menu button underneath
|
||||
uint64_t cp = ui_panel(root, "VideoOptionsPanel"); // 自定义页(借的视频页)与设置页并列、不是它的子控件:这一页上的勾选框也算「设置页自己可点的控件」(语言行的「中文」那格正落在暂停菜单按钮的位置上) | The Custom page (the borrowed video page) sits beside the settings page and is not its child: checkboxes on this page also count as "controls of the settings page itself that can be tapped" (the 「中文」 box of the language row lands exactly where the pause menu button is)
|
||||
if (st && *(uint8_t *)(st + 0x50) && !click_walk(st, xy, 1, (uint64_t)m->base) && !(cp && *(uint8_t *)(cp + 0x50) && click_walk(cp, xy, 1, (uint64_t)m->base))) { // 设置页自己可点的控件照常;点在它的底板 / 列表空处时,游戏会把这一下交给底下的暂停菜单按钮 | The settings page's own clickable widgets work as usual; when the tap is on its backing / empty list space, the game would hand this tap to the pause menu button underneath
|
||||
static const char *const pl[] = { "PauseLayoutGarden", "PauseLayout" };
|
||||
for (int i = 0; i < 2; i++) { uint64_t pw = ui_panel(root, pl[i]); if (pw && *(uint8_t *)(pw + 0x50) && click_walk(pw, xy, 1, (uint64_t)m->base)) { snprintf(hit, hn, "设置页盖着的暂停菜单按钮(不点,可滚)"); return 11; } /* 11:这一下不点下去,但从这里起手上下拖照常滚设置页的列表(自定义页各行的文字不是可点控件,玩家多半就在文字上滑) | 11: this tap is not pressed down, but a vertical drag starting here still scrolls the settings page list as usual (the text of the rows on the Custom page is not a clickable widget, and players mostly swipe right on the text) */ } } }
|
||||
const char *mn = ""; uint64_t mp = modal_top(m, root, &mn);
|
||||
|
||||
+15
-6
@@ -132,7 +132,10 @@ void dm_custom_ui_pump(unsigned long long root) {
|
||||
if (pad) { uint64_t ev = dm_padmode_page_keys(DM_BTN_UP | DM_BTN_DOWN | DM_BTN_A);
|
||||
if (ev & DM_BTN_DOWN) sel = sel + 1 < NK ? sel + 1 : sel; else if (ev & DM_BTN_UP) sel = sel > 0 ? sel - 1 : 0;
|
||||
snprintf(nm, sizeof nm, "TouchCustom_%s", k_keys[sel]); cw = find_w(sp, nm, 0); snprintf(nm, sizeof nm, "TouchCustom_%s_Text", k_keys[sel]); tw = find_w(sp, nm, 0);
|
||||
if ((ev & DM_BTN_A) && cw && seen[sel] == cw) set_toggle(cw, !TOGGLED(cw)); }
|
||||
if ((ev & DM_BTN_A) && cw && seen[sel] == cw) {
|
||||
if (sel == 0) { int p0 = atomic_load(&g_pend[0]), sh = p0 >= 0 ? p0 : atomic_load(&g_val[0]); atomic_store(&g_pend[0], !sh); set_toggle(cw, !sh); { uint64_t z = find_w(sp, "TouchCustom_lang_zh", 0); if (z) set_toggle(z, sh); } // 语言行是单选的两项:两个框当场摆好(只改待定值的话,下面读框状态会把没跟上的框当成玩家点的) | The language row is a single choice between two items: both boxes are set on the spot (if only the pending value were changed, the code below that reads the box states would take the box that has not caught up as a player tap)
|
||||
LOG("自定义设置:语言 → %s(手柄 A 在两项间切换;点「应用」生效)", !sh ? "English" : "中文"); }
|
||||
else set_toggle(cw, !TOGGLED(cw)); } }
|
||||
if (dm) { int32_t *r = (int32_t *)(dm + 0x70), want[4] = { 99999, 0, r[2], r[3] }; /* 不用时只把 x 挪出屏:它在滚动区里,y 放远了会撑大可滚范围 | when unused only x is moved off screen: it is inside the scroll area, and a far-away y would enlarge the scrollable range */
|
||||
if (dm_padmode_current() && tw && cw) { int32_t *t = (int32_t *)(tw + 0x70), *c = (int32_t *)(cw + 0x70); int top = t[1] < c[1] ? t[1] : c[1], bot = t[1] + t[3] > c[1] + c[3] ? t[1] + t[3] : c[1] + c[3]; // 框住整行:文字与勾选框两者的上下沿取并,再各放 10 单位(原先只按文字框的高度算,文字框比字矮,框成了横穿文字中线的一条) | Frame the whole row: take the union of the top and bottom edges of the text and the checkbox, then pad 10 units on each side (previously computed from the text box height only; the text box is shorter than the glyphs, so the frame became a strip cutting across the middle of the text)
|
||||
want[0] = t[0] - 30; want[1] = top - 10; want[2] = c[0] + c[2] + 30 - want[0]; want[3] = bot - top + 20;
|
||||
@@ -149,13 +152,19 @@ void dm_custom_ui_pump(unsigned long long root) {
|
||||
for (int i = 0; i < NK; i++) { char nm[48]; snprintf(nm, sizeof nm, "TouchCustom_%s", k_keys[i]);
|
||||
uint64_t w = find_w(sp, nm, 0); if (!w || !*(uint8_t *)(w + 0x50)) continue;
|
||||
int pd0 = atomic_load(&g_pend[i]), want = pd0 >= 0 ? pd0 : atomic_load(&g_val[i]);
|
||||
if (seen[i] != w) { seen[i] = w; set_toggle(w, want); continue; } // 页刚出现(布局里一律是没勾):先摆成该显示的值,这一帧不当玩家点了 | The page has just appeared (in the layout everything is unchecked): first set it to the value it should show, and do not treat this frame as a player tap
|
||||
uint64_t z = i == 0 ? find_w(sp, "TouchCustom_lang_zh", 0) : 0; // 语言行:并排的「中文」「English」两个勾选框,单选——存的仍是 lang_en 一个键,「中文」那格是它的反面 | Language row: two checkboxes side by side, 「中文」 and "English", single choice -- what is stored is still the one key lang_en, and the 「中文」 box is its opposite
|
||||
if (seen[i] != w) { seen[i] = w; set_toggle(w, want); if (z) set_toggle(z, !want); continue; } // 页刚出现(布局里一律是没勾):先摆成该显示的值,这一帧不当玩家点了 | The page has just appeared (in the layout everything is unchecked): first set it to the value it should show, and do not treat this frame as a player tap
|
||||
int on = TOGGLED(w), pd = atomic_load(&g_pend[i]), shown = pd >= 0 ? pd : atomic_load(&g_val[i]);
|
||||
if (i == 0 && z) { // 点没选中的那一项 = 选它;点已选中的那一项不变(摆回勾上) | Tapping the item that is not selected = select it; tapping the one already selected changes nothing (it is put back to checked)
|
||||
int zon = TOGGLED(z), to = on != shown ? (on ? 1 : shown) : zon != !shown ? (zon ? 0 : shown) : shown;
|
||||
if (to != shown) { atomic_store(&g_pend[0], to); LOG("自定义设置:语言 → %s(点「应用」生效)", to ? "English" : "中文"); }
|
||||
if (TOGGLED(w) != to) set_toggle(w, to); if (TOGGLED(z) != !to) set_toggle(z, !to); continue; }
|
||||
if (on != shown) { atomic_store(&g_pend[i], on); LOG("自定义设置:%s 勾选框 → %s(点「应用」生效)", k_keys[i], on ? "勾上" : "取消"); } }
|
||||
// 语言那一格下面的「重启游戏后生效」提示(TouchCustomLangHint,布局里先放在屏外):勾选框此刻显示的值与正在跑的语言不一致时挪到标签正下方(横坐标取标签的)
|
||||
// The 「重启游戏后生效」(Takes effect after restarting the game) hint under the language cell (TouchCustomLangHint, initially placed off-screen in the layout): when the value the checkbox currently shows differs from the running language it is moved directly below the label (x taken from the label)
|
||||
{ uint64_t hw = find_w(sp, "TouchCustomLangHint", 0), lw = find_w(sp, "TouchCustom_lang_en_Text", 0);
|
||||
if (hw && lw) { int pd = atomic_load(&g_pend[0]), shown = pd >= 0 ? pd : atomic_load(&g_val[0]), x = shown != !dm_lang_zh() ? ((int32_t *)(lw + 0x70))[0] : 99999; int32_t *r = (int32_t *)(hw + 0x70);
|
||||
// 语言那一行下面的「点应用后把 App 关掉重开」提示(TouchCustomLangHint,布局里先放在屏外):勾选框此刻显示的值与正在跑的语言不一致时挪到标签正下方(横坐标取标签的)
|
||||
// The "tap Apply, then close and reopen the app" hint under the language row (TouchCustomLangHint, placed off screen in the layout): moved right under the label (taking the label's x) when the value the checkboxes currently show differs from the language now running
|
||||
{ uint64_t lw = find_w(sp, "TouchCustom_lang_en_Text", 0); int pd = atomic_load(&g_pend[0]), shown = pd >= 0 ? pd : atomic_load(&g_val[0]), diff = shown != !dm_lang_zh();
|
||||
for (int k = 0; k < 2 && lw; k++) { uint64_t hw = find_w(sp, k ? "TouchCustomLangHintEn" : "TouchCustomLangHintZh", 0); if (!hw) continue; // 提示用「选中的那种语言」写:选了中文显示中文那句,选了 English 显示英文那句 | The hint is written in "the language that was chosen": choosing 中文 shows the Chinese sentence, choosing English shows the English one
|
||||
int x = diff && shown == k ? ((int32_t *)(lw + 0x70))[0] : 99999; int32_t *r = (int32_t *)(hw + 0x70);
|
||||
if (r[0] != x) { r[0] = x; ((void (*)(uint64_t))*(uint64_t *)(*(uint64_t *)hw + 0x10))(hw); } } }
|
||||
// 「应用 / 放弃」亮不亮(自定义页改了勾选,「应用」仍是灰的):原版各选项子页的每帧更新 main+0xae5f28 把自己 +0x1a0「有未应用的改动」
|
||||
// 交给 main+0xaed9e4(设置页, 亮否),按钮 +0x57a 是灰的标志;原版的勾选框一改就由面板置 +0x1a0,我们的勾选框原版面板不认识,这一位一直是 0。
|
||||
|
||||
@@ -79,8 +79,11 @@ static const struct { const char *k, *zh, *en; } k_dm_i18n[] = {
|
||||
{ "dmCustomEcoFps", "省电模式(30 帧)", "Power saver (30 fps)" },
|
||||
{ "dmCustomLootFilter", "掉落过滤(噩梦起自动隐藏杂物)", "Loot Filter (auto, Nightmare+)" },
|
||||
{ "dmCustomAutoBuff", "自动补上增益技能(站着不动时)", "Auto-recast buffs when idle" },
|
||||
{ "dmCustomLangEn", "语言 / Language:English", "Language: English" },
|
||||
{ "dmCustomLangHint", "重启游戏后生效 / Restart to apply", "Restart to apply" },
|
||||
{ "dmCustomLang", "语言 / Language", "语言 / Language" },
|
||||
{ "dmCustomLangZh", "中文", "中文" },
|
||||
{ "dmCustomLangEnOpt", "English", "English" },
|
||||
{ "dmCustomLangHintZh", "点「应用」,然后把 App 关掉重开", "点「应用」,然后把 App 关掉重开" },
|
||||
{ "dmCustomLangHintEn", "Tap Apply, then close and reopen the app", "Tap Apply, then close and reopen the app" },
|
||||
{ "dmTabGameSettings", "游戏设定", "Settings" },
|
||||
{ "dmVaultPart0", "头盔", "Helms" },
|
||||
{ "dmVaultPart1", "盔甲", "Armor" },
|
||||
|
||||
Reference in New Issue
Block a user