What changed
Validate the page index and the table, page, entry, and vector pointers in the indexed resource lookup for game build 3.3.94012. An unavailable entry uses the game's existing zero-vector fallback. The loop still updates the cached ID and writes each result with the original stride.
The Unicorn regression exercises the rewritten ARM64 routine with the recorded missing page, missing entries, an out-of-range page, repeated IDs, and valid vectors.
Why
A Necromancer run on iPad crashed after returning from Underground Passage Level 1 to Dark Wood. Resource ID 0xb20 selects page 5 and slot 0x120. When the page pointer was null, the load at main+0x1450294 tried to read address 0x900.
Checks run
-
python3 dm/i18n/scan_literals.pyreports the same two existing findings onmainand on this branch, ingen_romfs_overlay.pyanddrop_light.py. -
python3 dm/ios/tools/dm_i18n.py --checkpassed withdm_i18n OK 486 条. -
make -C dm/host/tests run -
make -C dm/gfx/tests run -
make -C dm/ios/tests test -
dm/verify/regress.sh --freshand the iOS output's structural checks passed withREGRESS OK freshandREGRESS OK rewritten. -
cd dm/ios && ./run.sh build -
dm/ios/tools/smoke_mac.sh 1 -
dm/ios/tools/check_hud_gen.sh
The focused regression reproduced the fault at 0x1450294 with the old image and passed all six cases with the patched image. A signed iOS Release build completed 20 scripted area transitions using a Necromancer save copy on an iPad Pro (M4), including 10 transitions from Underground Passage Level 1 to Dark Wood. Every area finished loading and the app kept running.
Visible changes
- Nothing on screen changes during normal resource loading.
No game content
- This change contains no game files, generated assets, keys, or built package.
- The local
setup.shrewrites are excluded.
Comments
- New comments are in both Chinese and English.
Reviewed against the 3.3.94012 image (Android pack built from current main and from this branch, in docker):
0x145027cchecks the page index against+0x1b0, then the table, page, slot and vector array for null, and on any miss falls through to the zero vector. It touches only the scratch registers the original used (x14, x16, x17, v0) and leaves x12 / x13 alone. It loads x, y and z; the original also loaded w, but the store at0x1450250only writes x, y and z.+0x1b0is the page count:0x13282b0–0x13282c8reads it, stores the new page attable[count](+0x1a0) and increments it, as the comment says.test_area_resource_lookup.pyfaults at0x1450294with(0x204, 0xb20, 0xb20, 0x407)on the current main image and passes all 6 cases on the image from this branch.One question: the same unchecked page lookup appears twice more in this function. One is the single-ID path (
0x14501b4–0x14501dc,ldr x8, [x8, x9]thenldr x9, [x8]). The other is the interpolating loop (0x1450128–0x1450140, rewritten through the trampolines at0x32f2fd4/0x32f3000). A null page there would fault the same way. Were those left out on purpose (never seen to fault), or would it make sense to guard them in the same PR?Looks good to me otherwise. The patch is "host only", so it applies on Android and HarmonyOS too.