Skip to content

Add launcher and d3hacks gameplay features (seasons) - #1

Open
leahd3 wants to merge 13 commits into
enginefuture:mainfrom
leahd3:main
Open

leahd3 wants to merge 13 commits into
enginefuture:mainfrom
leahd3:main

Conversation

@leahd3

@leahd3 leahd3 commented Oct 27, 2026 •

Copy link
Copy Markdown

Summary

PR is covering three areas:

  1. D3 offline season content — the 2.7.7 offline lobby never issues the publisher fetch, so the callbacks d3hack hooks are never entered. The host now calls the game's own callbacks with the documents it would have downloaded, which makes the season calendar, season XVars and the weekly challenge-rift payload land without any online state.
  2. Launcher / display / input — a third display mode, a raised wide profile, en/zh-Hans localization with a game-language control, a DualSense pad default, swapped shoulders and full-screen.
  3. Build reproducibility — a nix devshell, uv-built venv, and LLVM resolved from LLVM_BIN/PATH instead of a hardcoded Homebrew path.

Diff: 32 files, +1,501 / −197. Every changed file is source, test, config or documentation — there is no vendored tree to skip.

Why

Diablo III's offline path has no service account, so anything the lobby would have fetched from the publisher service is simply absent: no season, no seasonal heroes, no challenge rift.

Verification

Run locally on Apple silicon macOS, current HEAD:

  • python3 -m unittest discover -s tests → 58 tests, OK (6 skipped); the skips are the opt-in Bonjour/LAN probes, which advertise a temporary local service.
  • Recorded per commit (native/GPU runs, not re-run for this PR text):
    • per-mode C guard accept/reject for each display mode; rewrite/verify clean; make app builds both images and passes the i18n key-set check.
    • headless runs present 1568×720 → 2560×1176 and 1920×720 → 2560×960 with no red lines; 1920×720 run at 59.8 fps (GPU 4.10 ms mean, 5.05 ms p95).
    • 90 s injection run: season vector size 1, season 37, seasons/blacklist flags 1.
    • challenge rift: headless run with the injection on publishes valid=0x1, number 346 while Continue loads the hero and commits the save.
    • rewrite/verify clean with the 9th registered main cut.

Not verified / limitations

  • Challenge rift entry is not verified in game. Game Settings → Mode Select now shows the Challenge Rifts row, but it stays locked until a Greater Rift is cleared.
  • Config.txt is not injected, so any config-file-dependent behaviour remains absent.
  • The MSAA measurement is a negative result only for 2.7.7; it does not generalise to other builds.
  • d3hack's spawn gate (site 10) is deliberately excluded — arming it unconditionally made every hero hang on world entry.
  • Real GFX/hardware numbers are from headless offscreen runs, not a foreground gameplay session; nothing here changes the compatibility claims in the README.

Policy notes

  • No game files, keys, tickets, saves or game-containing packages are added.
  • python3 tools/audit_public.py --all-history → passed: 181 source blobs, 4.41 MiB, verified on a single-branch clone of this branch (CI-equivalent refs).
  • The two diagnostic switches from 1b10628 (DM_DR3_NSA, DM_DR3_PCTL) are env-gated, D3-only and inert without the variable set.

Review focus

  • patches/nxnative.patch (+1,026) — the seasonal/challenge-rift transcription and the new cut sites; every original word is asserted by the rewriter.
  • tools/mobile_graphics_profile.py and loader.c per-mode word tables (the 1568 words are now a documented reject vector).
  • tools/mac_app.py / tools/mac_launcher.m — mode pair build+verify and the LaunchWide → LaunchDisplayMode migration.
  • third_party/README.md, THIRD_PARTY_NOTICES.md — the d3hack pin and the fetch command, now that the tree is not vendored.
Screenshot 2026-10-27 at 16 25 05 Screenshot 2026-10-27 at 16 24 50

leahd3 added 13 commits October 20, 2026 14:21
Resolve LLVM from LLVM_BIN, then PATH, then Homebrew; provide LLVM,
.NET 10, SPIRV-Cross and Python 3.12 through flake.nix; build the venv
with uv. Default the launch profiles to enUS because zh-Hans needs the
separate zhCN DLC pack.
Add en/zh-Hans Localizable.strings, select the launcher language from the
system locale, and let the launcher pick the game language (System,
English, 简体中文) instead of hardcoding one tag.
Retarget d3hack v3.1's always-on dynamic-seasonal set from 2.7.6.90885 to
2.7.7.92380 with dm/tools/nso_fnmap.py plus per-site disassembly: five
equal-length patches, originals asserted by the rewriter. d3hack's spawn
gate (site 10) is deliberately excluded — arming it unconditionally made
every hero hang on world entry — and its XVar writes cannot be done
statically (0x72eea0's x1 is a pointer, not the value).

Also adds two env-gated diagnostic switches used while chasing that hang:
DM_DR3_NSA (fake network service account) and DM_DR3_PCTL (grant
free-communication permission). Both are D3-only and inert without the
environment variable.
Cross=A, Circle=B, Square=X, Triangle=Y and a 0.15 stick deadzone, matching
the player_0 block in Eden's qt-config.ini for the DualSense. The Switch
physical layout is still available with DM_PAD_FACE=position, and the
gamepad test now asserts both.
L1 now sends Switch R and R1 sends Switch L (D4 muscle memory, potion on LB).
The game window gets FullScreenPrimary collection behaviour and a View menu
with Enter Full Screen (Ctrl-Cmd-F), so it no longer needs to be dragged to
another space.
Installs branch gates at the three lobby retrieval result tests
(OnConfigFileRetrieved 0x64268, OnSeasonsFileRetrieved 0x6527c,
OnBlacklistFileRetrieved 0x6581c) with host calls 0x8f-0x91. The host
handler only logs the blz::string it is handed and always forces x8=0,
so guest behaviour is unchanged.

The branch-copy verifier now accepts a cbz/cbnz copy re-encoded to the
original target (directly or through a checked local b trampoline), since
a verbatim copy in the patch area would branch by the wrong pc.
The offline lobby never issues the publisher fetch, so the callbacks d3hack
hooks are never entered. Call them ourselves instead: seeds two blz::string
payloads as embedded-capacity buffers and invokes OnBlacklistFileRetrieved
and OnSeasonsFileRetrieved with result 0 from a weak per-frame hook in the
OE message poll, 600 frames after boot, re-arming if the game resets the
season vector.

Verified in a 90 s run: vector size 1, season 37, seasons/blacklist flags 1.
Config.txt is not injected because that callback dereferences self.
XVarUint32_Set is 0xA273C0 in 2.7.7; the season objects are pointed to by
0x114ac60/0x114ac68 and the injector now writes season 37 / state 1 with
dirty flags 3, matching d3hack's pair. The window title carries the host
build stamp, the rewrite build id and the injector's status line, so a
stale bundle is visible at a glance.
OnGetChallengeRiftData (main+0x185f70) is not reachable offline: the service only registers it in the connected branch. The host calls it directly with the two parsed publisher documents and clears the gate byte on the resolved service instance, so the guest publishes the weekly data itself (measured valid=1, challenge_number 346). Payloads are the captured protobufs from vendor/d3hack read at runtime from work/rift_data; a missing directory disables the path instead of failing. Game Settings -> Mode Select now shows the Challenge Rifts row; it stays locked until a Greater Rift is cleared, so rift entry is not yet verified in game.
One summary line per run from the texture-initialization counters, plus the swapchain sample count in WindowInitialize. Measured on 2.7.7: the guest never calls nvnTextureBuilderSetSamples, so every texture and the swapchain is single-sample. d3hack's MSAA clamp rule and its dead extra.msaal_level override therefore have no target here.
Render area 1,382,400 px stays below the original docked 1,440,000, so the pool-budget envelope is unchanged; horizontal FOV grows 50% and MetalFX now reconstructs 1920x720 into 2560x960 at 1.333x instead of 1568x720 into 2560x1176 at 1.633x. Guard words regenerated from the emitted image rather than hand-encoded; the previous 1568 words are now a reject vector. Verified: rewrite/verify clean, 6 profile tests pass, headless wide run presents 1920x720 -> 2560x960 with no red lines at 59.8 fps (gpu 4.10 ms mean, 5.05 p95).
Writing bit 0x4 into the resolved service object made the front end believe an online session existed, so the main-menu Continue action stalled (measured: works with DM_D3_CHALLENGE=0, dead with the write). Replace it with an equal-length cut: main+0x185fd0 tbz w8,#2,#0x186044 -> nop (original word 0x361003a8 read from the image). Verified: rewrite/verify clean with the 9th registered main cut, and a headless run with the injection on still publishes (valid=0x1, number 346) while Continue loads the hero and commits the save.
normal 1600x900, wide 1568x720, wider 1920x720. mac_app builds and independently verifies one patched image per wide size (rewrite-wide, rewrite-wider); loader.c validates the image against the word table of the mode it was asked for, so the pair cannot be swapped. Preference is LaunchDisplayMode with LaunchWide migrated (true -> wide). Verified: 58 unit tests, per-mode C guard accept/reject, rewrite/verify clean, make app builds both images and passes the i18n key-set check; headless runs present 1568x720 -> 2560x1176 and 1920x720 -> 2560x960 with no red lines.
Kamisorara added a commit to Kamisorara/dr3-mobile that referenced this pull request Nov 3, 2026
客体侧(patches/nxnative.patch 重生成):
- patch_nso.py 的 PARAMS 加 D3 (2607a74f) 三对位点(与
  mobile_graphics_profile.SITES 逐字一致):0xe7858/0xe7860 KRES1
  主机渲染分辨率、0xe785c/0xe7864 KRES0 掌机、0xe7868/0xe786c
  KASPECT 显示宽高比浮点——三对相邻 mov+movk 改参数蹦床(键页
  LDR),宿主按屏幕给值,16:9 原值行为不变。
- 三处仅宿主剪口:16:9 约束谓词 0x29b480/0x29b484 → mov w0,#0/ret、
  贴图 full/half/quarter 查询比例 0xebb48 → fmov s1,enginefuture#1.0(与
  SITES 一致;16:9 值下结果与原版相同)。
- thread.c KASPECT 的 D3 分支:槽是镜头的直接输入
  (Perspective cot(vfov/2)/aspect),取掌机比例本身——没有 D2R
  的 19/9 下限、无 UI 柱边距;dm.h 加 DM_D3_BUILD。
- structck 全绿(本机 + LLVM):参数门 3、槽访问
  KRES1/KRES0/KASPECT 各 1、跳板出口与 3 剪口全过。
- verify 脚本跨平台修复:structck/equiv/patch_nso 的文本 open 钉
  UTF-8(Windows GBK 崩)、表输出钉 UTF-8+LF、grep 走 PATH。

iOS 侧:
- 启动器第三段从「宽屏」(需要第二张签名映像,从未出过)改为
  「适配」:pack 带 D3 参数槽(main.params.tsv 有数据行 →
  mobile-graphics.json 的 runtime_aspect)且屏幕非 16:9 时可用。
- front_game_res 适配分支:高 720、宽 = 720×屏幕比例(KRES 槽;
  同 D2R 先例,帧比例=屏幕比例 → drawable 同比例无变形);布局
  fit 直接铺满。DM_IOS_GRAPHICS_MODE 恒 normal(不换映像)。

| D3 parameter slots: true full-screen fit (no crop, no bars)

Guest side (patches/nxnative.patch regenerated):
- patch_nso.py PARAMS gains the D3 (2607a74f) three site pairs
  (verbatim from mobile_graphics_profile.SITES): KRES1/KRES0 render
  resolution and the KASPECT display-aspect float — three adjacent
  mov+movk pairs become parameter trampolines (key-page LDR); the
  host supplies values per screen, 16:9 originals unchanged.
- Three host-only cuts: the 16:9 constraint predicate to mov w0,#0/ret
  and the texture full/half/quarter query ratio to fmov s1,enginefuture#1.0.
- thread.c D3 branch for KASPECT: the slot feeds the camera directly;
  take the handheld ratio itself — no D2R 19/9 floor, no UI margin.
- structck fully green locally (with LLVM): 3 parameter gates, slot
  accesses check out, trampoline exits and cuts verified.
- Cross-platform verify fixes: UTF-8 pinned for text opens and table
  writes (GBK crash on Windows), grep via PATH.

iOS side:
- The third launcher segment becomes Aspect (was Wide, which needed a
  second signed image that never shipped): available when the pack
  carries the D3 slots (runtime_aspect in mobile-graphics.json) and
  the screen is not 16:9.
- front_game_res aspect branch: height 720, width = 720 × screen ratio;
  layout fit fills the screen; DM_IOS_GRAPHICS_MODE stays normal.
Kamisorara added a commit to Kamisorara/dr3-mobile that referenced this pull request Nov 3, 2026
客体侧(patches/nxnative.patch 重生成):
- patch_nso.py 的 PARAMS 加 D3 (2607a74f) 三对位点(与
  mobile_graphics_profile.SITES 逐字一致):0xe7858/0xe7860 KRES1
  主机渲染分辨率、0xe785c/0xe7864 KRES0 掌机、0xe7868/0xe786c
  KASPECT 显示宽高比浮点——三对相邻 mov+movk 改参数蹦床(键页
  LDR),宿主按屏幕给值,16:9 原值行为不变。
- 三处仅宿主剪口:16:9 约束谓词 0x29b480/0x29b484 → mov w0,#0/ret、
  贴图 full/half/quarter 查询比例 0xebb48 → fmov s1,enginefuture#1.0(与
  SITES 一致;16:9 值下结果与原版相同)。
- thread.c KASPECT 的 D3 分支:槽是镜头的直接输入
  (Perspective cot(vfov/2)/aspect),取掌机比例本身——没有 D2R
  的 19/9 下限、无 UI 柱边距;dm.h 加 DM_D3_BUILD。
- structck 全绿(本机 + LLVM):参数门 3、槽访问
  KRES1/KRES0/KASPECT 各 1、跳板出口与 3 剪口全过。
- verify 脚本跨平台修复:structck/equiv/patch_nso 的文本 open 钉
  UTF-8(Windows GBK 崩)、表输出钉 UTF-8+LF、grep 走 PATH。

iOS 侧:
- 启动器第三段从「宽屏」(需要第二张签名映像,从未出过)改为
  「适配」:pack 带 D3 参数槽(main.params.tsv 有数据行 →
  mobile-graphics.json 的 runtime_aspect)且屏幕非 16:9 时可用。
- front_game_res 适配分支:高 720、宽 = 720×屏幕比例(KRES 槽;
  同 D2R 先例,帧比例=屏幕比例 → drawable 同比例无变形);布局
  fit 直接铺满。DM_IOS_GRAPHICS_MODE 恒 normal(不换映像)。

| D3 parameter slots: true full-screen fit (no crop, no bars)

Guest side (patches/nxnative.patch regenerated):
- patch_nso.py PARAMS gains the D3 (2607a74f) three site pairs
  (verbatim from mobile_graphics_profile.SITES): KRES1/KRES0 render
  resolution and the KASPECT display-aspect float — three adjacent
  mov+movk pairs become parameter trampolines (key-page LDR); the
  host supplies values per screen, 16:9 originals unchanged.
- Three host-only cuts: the 16:9 constraint predicate to mov w0,#0/ret
  and the texture full/half/quarter query ratio to fmov s1,enginefuture#1.0.
- thread.c D3 branch for KASPECT: the slot feeds the camera directly;
  take the handheld ratio itself — no D2R 19/9 floor, no UI margin.
- structck fully green locally (with LLVM): 3 parameter gates, slot
  accesses check out, trampoline exits and cuts verified.
- Cross-platform verify fixes: UTF-8 pinned for text opens and table
  writes (GBK crash on Windows), grep via PATH.

iOS side:
- The third launcher segment becomes Aspect (was Wide, which needed a
  second signed image that never shipped): available when the pack
  carries the D3 slots (runtime_aspect in mobile-graphics.json) and
  the screen is not 16:9.
- front_game_res aspect branch: height 720, width = 720 × screen ratio;
  layout fit fills the screen; DM_IOS_GRAPHICS_MODE stays normal.
Kamisorara added a commit to Kamisorara/dr3-mobile that referenced this pull request Nov 12, 2026
…补 obj+0/+8 字段真值

深挖结论(本轮静态验证):
- 0x56aa0 = 旗标+0x228!=0 ‖ 服务对象+0!=0 ‖ +8!=0(三路或;0x56ad0 分支)
- 对象构造函数(0x55cd8/0x5606c)把 +0/+8 与旗标全部清零(stp xzr,xzr)——离线填充者静态未定位
  ([0x114aa30] 45 处访问全 LDR 零 STR,对象经计算地址构造)→ enabled 强制应答 1 保险;关=代调原函数
- 创建放行路径 0x359d44 → bl 0x347300(本地状态清检)→ 尾 b 0x16a340(0x16,0,svc,0):
  事件分发器对 0x16/0x17 对特判(orr enginefuture#1==0x17),终局=向 [0x114d080]+0x9b8 本地队列投递
  (0x1add40)——与普通英雄同一离线已验证机制,路上无弹窗
- 0x4c7df0 = 在线/离线双链供应商 +0x1c 计数判零(离线走 [0x114a010] 链)——菜单/分发器的公共门
- 0x4a5f40 无 bl/b/adrp+add 直接引用(疑跳表分发;门C保留当保险,无害)

structck main OK:门=4、KGATE=6、剪口=10、失败项=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant