54 Commits
Author SHA1 Message Date
jhaizhou-opsandClaude Opus 5.5 f150c91446 Merge main (#284 #287) into fragment-subgroup-inline-order
Conflict at the gfx-inline default: #287 counts 6xx / 735 by name or device ID and retries old skips; this branch adds Qualcomm
drivers without fragment-stage subgroups. Both are kept: xbg_adreno_inline_default takes the device ID, and
xbg_adreno_inline_is_new also treats Qualcomm drivers without fragment subgroups (outside 750-799) as newly inlined, so their old
skip entries get the one retry. The test "650 with fragment subgroups is not inlined" now expects inlining, since #287 inlines
all 6xx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 06:15:35 -08:00
Yuechuan YangandClaude Opus 5.5 9803dd3179 Adreno 6xx: inline subgroup helpers by default; retry skips recorded without inlining (#266)
On a Galaxy Z Fold 3 (Adreno 660) the fluid shader 098a126f92bf533a is
in gfx-pipe-skip with inlining off (it crashed the compiler on earlier
boots), and fire and smoke show white / coloured squares (#266, #265).
On an Adreno 650 it compiles once inlined (#243).

- xbg_adreno_compiler_needs_inline covers the 6xx.
- gfx-pipe-skip entries recorded with inlining on end in " i". Where
  inlining is newly on (6xx and 735 defaults, or the gfx-inline
  marker), an entry without " i" is dropped once and rebuilt inlined;
  if it still crashes it is recorded with " i" and stays skipped. The
  750-799, inlined since v2.0.2, do not retry.

Redmi (Adreno 730) with gfx-inline 1: an untagged 098a entry was
retried and the shader loaded inlined; a tagged one stayed skipped.
Policy test extended. Not tested on a 6xx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 01:22:11 +13:00
Yuechuan YangandClaude Opus 5.5 e4a05f3057 Adreno: switch the rewrites off for the 720 only, not the whole 0x43 generation
The 735 of the same generation ran fine with the quad-derivative and
warp32 rewrites on once its helpers were inlined (#169), and turning
them off would lose their fixes there (warp32 keeps the grass, clutter
and fluid appends correct; the quad rewrite prevents black squares).
The 720 crash (#263) is the only evidence, so xbg_adreno_rewrites_fault
covers the 740-799 models plus the 720, and the device-ID rule is
dropped. The 735 keeps its inlining.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 21:05:13 +13:00
Yuechuan YangandClaude Opus 5.5 21c425f05b Adreno: recognise the 740/750 chip family by device ID (720, 735) (#263, #169)
The rewrite and inlining defaults keyed on the model number (740-799,
750-799). Device IDs show the 720 (0x43020000) and 735 (0x43030b00) are
the same chip family as the 750 (0x43051401), while the 730 (0x07...)
and 830 (0x44...) are not. The 720 ran both rewrites and lost the
device on the main menu's first frame (#263, the 740's symptom in
#141); the 735 needed the 750's inlining (#169).

- xbg_adreno_rewrites_fault takes the device ID: Qualcomm chips with
  0x43 in the top byte default the quad-derivative and warp32 rewrites
  off.
- xbg_adreno_compiler_needs_inline includes the 735.
- The start-up line names the device ID.

Policy test: 9 new cases. Redmi (Adreno 730): unchanged. Not tested on
a 720 or 735.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:01:36 +13:00
Yuechuan YangandClaude Opus 5.5 c8ac3c2437 Vulkan: rewrite fragment shuffles before inlining on drivers without fragment subgroups (#243)
Found by @kieusonlam on a real Adreno 650 (Retroid Pocket 5): with
gfx-inline=1 the helpers were inlined before the quad rewrite, so the
shuffles sat in the entry function under divergent control flow, none
were rewritten and the capability check aborted; with gfx-inline=0
the fluid compute shader 098a126f92bf533a crashed libllvm-qgl.so
(addr 0x48), the Adreno 750 family's compiler crash.

- front_rewrites: without fragment subgroups the quad rewrite and
  clean-up run before the inlining (both loaders); with them the order
  is unchanged.
- xbg_adreno_inline_default: inlining is on by default for the 750-799
  family and for Qualcomm drivers without fragment subgroups; the
  gfx-inline marker still wins.

Offline the Adreno 650 chain passes the check for all 6,931 shaders and
spirv-val for all 187 modules with subgroup use. Redmi (Adreno 730)
with the fake switch: inlining on, fragment shaders rewritten first,
compute shaders inlined, camp clean, same picture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 08:34:13 +13:00
姜海舟andClaude Opus 5.5 4a938fe444 docs(S2ARM): packing needs no .NET, C compiler or spirv-cross; S2Arm on Windows is connected
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 06:02:20 -08:00
jhaizhou-ops 82ca0e15ac Merge pull request #280 from jhaizhou-ops/subgroup-check-after-rewrite
Vulkan: rewrite fragment shuffles when the driver has no fragment-stage subgroups (Adreno 650 / Maleoon 910 crash, #243 #155)
2026-11-16 01:16:30 -08:00
jhaizhou-ops 92f6569556 Merge pull request #279 from jhaizhou-ops/vulkan-d24-fallback
Vulkan: store 24-bit depth as 32-bit float when the driver has no D24 formats (Xclipse crash, #250)
2026-11-16 01:16:23 -08:00
jhaizhou-ops 48a077f692 Merge pull request #269 from jhaizhou-ops/android-share-diagnostics
Android: Share Diagnostics in the pause menu (#216)
2026-11-16 01:15:58 -08:00
jhaizhou-ops c838b8a9fe Merge pull request #268 from jhaizhou-ops/adreno830-dispatch-guard
Adreno 8xx: compute shaders return at once outside the dispatched range (#256)
2026-11-16 01:15:53 -08:00
jhaizhou-ops 1824fc2648 Merge pull request #255 from jhaizhou-ops/android-import-vault
Save import: bring back the Chronicle stash's items (#241)
2026-11-16 01:15:47 -08:00
jhaizhou-ops cd55fd30e4 Merge pull request #230 from jhaizhou-ops/android-import-followups
Save import: a Settings-only save-import is accepted, and an import that fails halfway takes back what it added (#213 follow-ups)
2026-11-16 01:15:28 -08:00
Yuechuan YangandClaude Opus 5.5 c0e1f065c9 Vulkan: rewrite fragment shuffles when the driver has no fragment-stage subgroups (#243, #155)
Old Adreno 650 drivers and the Maleoon 910 support subgroup operations
in compute shaders only (supportedStages 0x20). 182 of D2R's fragment
shaders hold one shuffle (the translator's SHFL.BFLY helper), so the
capability check aborted at the main menu. The analysis is
@kieusonlam's (#155).

- The runtime loader checks capabilities after the rewrites, not
  before, and accepts DerivativeControl.
- On such drivers the quad rewrite always runs, in a relaxed mode that
  also rewrites calls whose result has bit uses or whose value comes
  from float arithmetic/loads (as floats) or from float-to-integer
  conversions (exact integer path); divergent control flow and other
  sources stay skipped.
- xbg_spirv_strip_subgroup then removes the helper nobody calls, the
  unused subgroup built-ins and the GroupNonUniform capabilities
  (self-contained, so the HarmonyOS build has it too).
- Marker gfx-no-fragment-subgroups / DM_GFX_NO_FRAGMENT_SUBGROUPS fakes
  such a driver for testing.

Offline over the import pack: all 182 shaders end without subgroup
use and pass spirv-val; the default mode's output is byte-identical to
main's; the moved check passes all 6,931 shaders for every phone
family's rewrite chain. Redmi (Adreno 730) with the fake driver: camp
and Den of Evil run, same picture. Not tested on an Adreno 650 or
Maleoon 910.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 10:39:44 +13:00
Yuechuan YangandClaude Opus 5.5 d2a7e4c4e7 Notes: Xclipse shadows will be point-sampled; keep #250 open until shadows are checked
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 09:11:36 +13:00
Yuechuan YangandClaude Opus 5.5 1c3d2c3d83 Vulkan: store 24-bit depth as 32-bit float when the driver has no D24 formats (#250)
Samsung Xclipse drivers (AMD RDNA) offer neither D24_UNORM_S8_UINT nor
X8_D24_UNORM_PACK32, so creating the game's first Z24S8 depth target
failed with VK_ERROR_FORMAT_NOT_SUPPORTED and the engine aborted.

- choose_depth_storage (before the warm-up threads start): when either
  D24 format lacks depth-stencil attachment, sampled or transfer
  features and D32F / D32FS8 have them, NVN Z24X8 / Z24S8 are stored as
  D32_SFLOAT / D32_SFLOAT_S8_UINT. Marker gfx-depth24-float (1/0) or
  DM_GFX_DEPTH24_FLOAT forces it.
- Uploads and readbacks convert 24-bit unorm <-> float per pixel
  (xbg_depth.c; exact round trip for all 2^24 values, unit test
  tests/depth24_float_test.c).
- Warm-up records get the same render pass format remap, so seed
  records made on other phones still match (log: depth24-remapped=N).
- The first biased draws on a stand-in are logged, since a float depth
  buffer's constant bias unit depends on the depth's exponent.

Tested on the Redmi K50 Ultra (Adreno 730) with the fallback forced on:
camp runs, 392 warm records built, 267 remapped, 178 warm hits and 0
draw-time pipeline creates in both runs, same picture apart from
animated content. Not tested on an Xclipse phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:50:34 +13:00
Yuechuan YangandClaude Opus 5.5 74cf8e7cbc Android: Share Diagnostics in the pause menu (#216)
The pause menu's Share Diagnostics button sends
PanelManager:ClosePanel:TouchShareLog, and the host calls the callback the
shell registered (dm/host/diag.c); only iOS registered one, so on Android
the button did nothing.

Now jni_android.c registers it. The request goes through the existing
native worker thread (text_input_jni.c; JNI only runs there) to
DmActivity.shareDiagnostics, which builds one text file on a background
thread (ShareLog) and opens Android's share sheet:
- header: version, device and SoC, Android version, thermal status,
  battery, memory, storage, time running (no device name, account or
  location);
- the key readings of this run and the previous one (GPU and driver,
  [perf], presents, fps);
- this run's and the previous run's part of boot.log, cut at the line every
  run starts with ("boot: 内部目录"), since Android's boot.log is appended
  to; a run over 6 MB keeps its first 1 MB and last 5 MB.
The file reaches the chosen app through a read-only, non-exported content
provider and the share intent's one-off grant (no AndroidX; the same
pattern as the S2Arm Android app). A missing Java method only turns the
button off and never stops start-up.

Tested on a OnePlus 13: the share sheet opened from the pause menu, the
saved file has the header, both runs' readings and logs. ShareLogTest: 20
checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 10:36:02 +13:00
Yuechuan YangandClaude Opus 5.5 26a7cf1c44 Save import: imported Elysium characters stay Elysium
The list of Elysium characters, sw_elysium.txt at the saves root (one name
per line, dm_elysium.c), was left behind by the import, so an imported
Elysium character came back as a normal one. It is now set from the backup
for the characters the import adds, and only for them: a name in the
backup's list is added to the phone's list, a name that is not there is
removed (a deleted character of the same name may have left it). The
phone's other names stay, a character skipped because its name is taken is
not touched, and the list is restored if the import fails.

Tested on a OnePlus 13: with the Elysium character yyc moved off the phone,
importing it from a backup brought it back with its list entry, and in game
it entered as an Elysium character. SaveTransferTest: 71 checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 09:57:40 +13:00
Yuechuan YangandClaude Opus 5.5 fe4a65fd8d Adreno 8xx: compute shaders return at once outside the dispatched range (#256)
On the Adreno 830 a compute dispatch with local size exactly 8x4x1 and an odd
y group count runs one extra row of work groups. The game's per-tile
light-list shader is 8x4x1, dispatched (4,5,1) over 32x20 tiles; the extra
invocations write as tile rows 20-23, which are the second-layer lists of
rows 0-3, so the top-right tiles get other tiles' lights and flicker.

When a compute module loads, the engine now puts a dispatch-range check
first in its entry function. It compares work group id x local size + local
id with number of work groups x local size: the 830's compiler removes a
comparison of the local id with the literal size, and in this shader the
extra invocations have an in-range work group id and an out-of-range local
id. On by default on Adreno 8xx, marker gfx-dispatch-guard (1 / 0).

Tested on a OnePlus 13 (Adreno 830): the light-list shader alone on
captured inputs is right in 40 of 40 runs (0 of 5 without the check), and
in game the River of Flame rectangles are gone. The risk that a later
driver removes the position comparison too is written in the code and in
docs/android-notes/2026-11-13-adreno-830-dispatch-guard.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 09:30:56 +13:00
姜海舟andClaude Opus 5.5 18bd146f00 Docs: the S2Arm route is iOS 26 and later for now (the bundle carries only the iOS 26 shell)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 06:54:29 -08:00
姜海舟andClaude Opus 5.5 cf51a47bfd Docs: one-click packing with S2Arm, and the contract between the two projects
- README (en / zh-CN / es): a "one click with S2Arm (recommended)" section first under Getting started, plus a row in the device table; the existing routes stay as they are. Status says only what works today: iPhone / iPad through S2Arm on a Mac.
- docs/S2ARM.md + .zh-CN.md: the bundle (bundle.json + shell.zip with the prebuilt translator + src/), how S2Arm calls d2rm_pack.py, the dependency budget (only what the S2Arm launcher ships), the resource pack and S2A_PACK_APPLY_ONLY contract including the log lines, versions (1.0.34.0 only; S2Arm pins tag / commit / SHA-256), the extra release step, and what is not connected yet.
- dm/tools/tests/test_s2arm_deps.py: walks every script and repository module reachable from d2rm_pack.py and d2rm_android.py (48 files) and fails on any import that is not the standard library, a repository module, or a package S2Arm bundles (capstone, lz4, numpy, Pillow). Passes; dropping numpy from the allowed set turns it red.
- Issue template: asks how the package was made (S2Arm / Xcode / shell + tool / Android / HarmonyOS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 06:45:00 -08:00
Yuechuan YangandClaude Opus 5.5 efcc709214 Save import: bring back the Chronicle stash's items (#241)
The items stored in the Chronicle stash live in a side file at the
saves root, <shared stash name>.swvault (dm_vault.c), not inside the
stash folder. The export copies the whole save folder, so backups had
it, but the import only took folders (characters, shared stash,
Settings). After an export, reinstall and import, the Chronicle still
listed the entries but every stored item was gone ("recorded, not
stored").

The import now takes that file too:
- the phone has none: it is copied in. When the game loads the vault
  it already drops any item whose bytes are in a save, so nothing is
  doubled;
- the phone has a different one: it goes into the merge inbox with the
  shared stash, at the pack path dm_cloudmerge.c already reads
  (<stash>.swvault), and the backup's items the phone doesn't have come
  back to the inventory in game. Not for a backup from this same phone,
  as for the stash;
- the same contents: nothing to do.
A save-import holding only that file is accepted, so a player who lost
the items can restore them from the old export. Without a side file
the merge digest is the same as before, so earlier inbox entries still
count as merged.

SaveTransferTest: 60 checks (was 40). Against the unfixed
SaveTransfer.java the new part fails at the first check ("vault: fresh
import result lists the vault"). docs/ANDROID.md and the Chinese
version describe the file and the restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:33:12 +13:00
Yuechuan YangandClaude Opus 5.5 fb6ab13be0 Save import: a Settings-only save-import is accepted, and an import that fails halfway takes back what it added (#213 follow-ups)
Two points from the review of #213:

- A save-import holding only Settings/ was not recognised as saves and was renamed
  save-import.rejected-*. looksLikeSaves now counts a Settings/ folder too, so it goes
  through the usual add-only rule: imported while the phone has no settings, otherwise
  reported as already on the phone.
- If a multi-character import failed halfway (a copy error, a full disk), the characters
  already added stayed while the message said the saves were unchanged. importFrom now
  remembers what it placed and deletes it again on failure; everything it places was
  absent before (add-only), so the saves are exactly as before and the message is true.
  save-import keeps its name, so the next start tries again. Only if that cleanup fails
  too (rare) does the result become IMPORT_PARTIAL, with a new message
  (dmAndroidSaveImportPartial, 6 languages) naming what was already added.
- Items are imported in name order, so a retry behaves the same way.

SaveTransferTest: 40 checks (was 34). The new Settings-only and halfway checks fail
against main's SaveTransfer.java and pass with this change. docs/ANDROID.md and the
Chinese version describe both cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 07:54:38 +13:00
CharlesandClaude Opus 5.5 28bded7eab i18n: add Portuguese (ptBR) support (#224)
Adds Brazilian Portuguese as the sixth UI language: a Português (Brasil) column for every project string, a six-option
language row in Options -> Custom, Portuguese touch wording, map name plates, the ptBR voice-over when present, and the
Android HUD in values-pt.

Maintainer merge: rebased onto #212 / #213 / #214, and the 19 strings those added got their Portuguese text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 01:17:20 -08:00
556c7a57f6 Android: back up and import saves with an export marker or a save-import folder; an imported stash is merged (#140, #174, #193) (#213)
Saves live in the App's internal files/save, which cannot be reached without root,
and uninstalling deletes them. Without adding any menu, as #140 proposes, the game
folder Download/S2X/D2R Mobile/ now takes two markers, handled at start before the
native library loads (the game has not mounted the saves yet):

- an `export` file (or folder): files/save is copied to save-export/<date-time>/
  (through a .part copy), then the marker is deleted;
- a `save-import` folder: the saves in it (one folder per character with
  <name>.d2s, as in an export; an export's own <date-time>/ level is accepted) are
  added to files/save. Nothing on the phone is replaced: a character whose name is
  taken is skipped, and Settings are only imported while the phone has none.
  A shared stash the phone lacks is copied in; one it has is merged: the backup's
  copy is packed into the in-game merge inbox (_cloudinbox/<ms>-import/mine.pack,
  the dm_cloudsync.c pack format, no base), and dm_cloudmerge.c -- the path iOS
  uses for forked iCloud stashes -- puts the items the current stash lacks into the
  inventory when the stash is opened and adds the gold. A digest per entry
  (import.sha256) stops the same stash from being merged twice, and a backup this
  phone exported itself is not merged back at all: exports carry this install's id
  (export-source.txt, kept in files/save-transfer-id from the first export on), and
  merging your own older stash would add its gold again and duplicate items taken
  out since. The softcore and hardcore stashes merge separately, each when a
  character of that kind opens the stash. Entries ending in
  -import get their own in-game notices (dmImportMergeBack / dmImportMergeFull)
  instead of the iCloud wording. save-import is then renamed
  save-import.done-<date-time>; a folder with no recognisable saves is left alone
  and renamed save-import.rejected-<date-time>.

Toasts say what was exported, imported, skipped or queued for merging (strings in
ui_text.tsv, 5 languages, header regenerated). SaveTransfer.java is plain Java with
a host test (dm/android/tests/SaveTransferTest.java, 34 checks); a Java-made pack
was read back by dm_cloudsync.c's dm_cloud_pack_each byte for byte. docs/ANDROID.md
and the Chinese version explain both steps.

Co-authored-by: Yuechuan Yang <22333122+yyan160@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 17:16:40 +08:00
f7aafc61bc Android: "Item notes and old names" takes effect after a restart, as on iOS (#191) (#210)
The switch goes through the overlay: gen_romfs_overlay.py writes a complete overlay
per switch combination next to the base one (overlay_variants/item_notes: the item,
rune, area, monster and shrine strings with notes and old names, plus the text-box
table), and the iOS App picks the matching one at start (main.m). Android had no such
step: d2rm_android.py packed only out/, shaders/ and overlay/, and jni_android.c always
used overlay/. So on Android the switch changed only the monster resistances added at
run time, and "on, restart" looked like nothing happened.

- d2rm_android.py puts overlay_variants/ into the Android import pack (HarmonyOS packs
  unchanged).
- DmActivity imports it as an optional item: older packs without it still import, and a
  stale copy is removed when a new pack has none.
- jni_android.c picks, as iOS does, the variant whose key set equals the switches that are
  on (read from sw_custom.txt next to the save directory, before the host starts), checks
  its own overlay.manifest, and sets DM_ROMFS_OVERLAY to "variant:overlay": the game data
  comes from the variant, the touch art is only in overlay/ and is found through the
  second layer. Everything off, no variants, no matching combination or a bad manifest:
  overlay/ as before.
- docs/ANDROID.md and dm/android/README.md (both languages) list the new folder.

Co-authored-by: Yuechuan Yang <22333122+yyan160@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 19:20:14 +08:00
bf158f3c45 Android import pack: --warm-seed puts the pipeline warm-up seed into the pack / 导入包可以带上管线预热种子 (#161)
* Android import pack: --warm-seed puts the pipeline warm-up seed into shaders/

The engine has read shaders/vk-pipeline-list.seed on a first launch since #113, but nothing put one
into the import pack, so every v2.0 player gets the first-play stutter the seed removes.

d2rm_android.py --warm-seed <file> copies a seed next to the bundles (dm/android/warm/
vk-pipeline-list.seed is used without the option when the repository has one). Every record is
parsed first and its shader keys are checked against the bundles just made: a malformed or empty
seed, or one none of whose keys is in the pack, stops the tool; some missing keys only produce a
note. pack_info.txt gets WARM_SEED=<sha256 prefix>, which also makes the App re-import. The App's
importer copies the whole shaders/ tree, so no App change is needed.

dm/tools/tests/test_warm_seed.py checks the parsing, the rejections, the key check and the copy
with a synthetic seed. Docs: docs/ANDROID.md step 1 and dm/android/README.md, with Chinese versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Import pack warm seed: no default inside the repository, the seed is checked when the arguments are read, the test runs with the host tests

From the review of #161:
- The default seed path dm/android/warm/vk-pipeline-list.seed is gone: a seed is
  only taken from --warm-seed, and the docs say to keep it outside the repository
  (whether a seed counts as derived game content is still open).
- warm_seed_load reads and parses the seed right after the arguments, so a missing,
  malformed or empty seed exits at once instead of after the shader translation;
  the shader-key check against the bundles still runs once they exist.
- make -C dm/host/tests run runs dm/tools/tests/test_warm_seed.py (the docs say so).
- The docs say the seed helps a first launch only: a phone that already has
  files/dm/vk-pipeline-list.bin keeps its own list after a re-import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Yuechuan Yang <22333122+yyan160@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:01:20 +08:00
jhaizhou-opsandClaude Opus 5.5 39dcc6b123 Docs: the Mac App now shows the rift quest bar (#187), so it is no longer listed as missing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 19:10:28 +08:00
jhaizhou-opsandClaude Opus 5.5 c7ff2f8570 Docs: the Chinese OLDER_SYSTEMS states the iOS 18.0 / macOS 15.0 minimum and no longer says the iOS 18 changes are unmerged (matches the English)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 12:15:35 +08:00
jhaizhou-opsandClaude Opus 5.5 1e0e7934c9 Docs: the entertainment mode in the README feature table; the camera doc says how to switch it in game (Options > Custom > Camera view) and where it runs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 09:54:06 +08:00
dc5778d352 Entertainment mode: over-the-shoulder and first-person camera (#165)
Over-the-shoulder and first-person camera (entertainment mode; Custom page > Camera view, off by default)

- Perspective camera rebuilt from the original orthographic one, on Metal (iOS / Mac) and Vulkan (Android / HarmonyOS), shared math in xbg_cam.h
- Over the shoulder: follows the move direction, pulls in and rises at walls, keeps the view within what the game draws
- First person: the left stick walks and strafes relative to the view; the camera follows the ground height
- Touch: drag the right half to look around (horizontal turns, vertical tilts); turn buttons and optional motion sensors on Android
- Arrows on the screen edge for monsters off the picture, coloured by name tier (normal / champion / unique / act boss); the player's own summons left out
- A facing pointer on the minimap and the full-screen map
- Names, health bars and taps follow the perspective picture

Co-Authored-By: Yuechuan Yang <22333122+yyan160@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 09:50:18 +08:00
jhaizhou-opsandClaude Opus 5.5 2428e5b3af Adreno 750: inline shader helpers at load; the pipeline guard covers graphics pipelines (#123, #153, #166)
The Adreno 750 shader compiler (libllvm-qgl.so) segfaults (addr=0x48) building any pipeline whose shader has subgroup
instructions inside a called helper function: 098a and 6a7a (compute) and 358197ac, 5c1ca4e7, e1c00b41 and others (pixel)
on four Samsung / Xiaomi phones. v2.0.1 skipped only 098a.

- Engine: on Qualcomm Adreno 750-799, a shader of that shape (187 in the pack) has its helpers inlined at load with the
  SPIRV-Tools passes merge-return, inline-entry-points-exhaustive and eliminate-dead-functions (marker gfx-inline 1 / 0).
  The import pack is unchanged; only the APK is updated. The warm-up's inlined SPIR-V is reused on the graphics thread.
- dm/third_party/spirv-tools: SPIRV-Tools v2026.3 library sources, pre-generated tables and the SPIR-V headers it includes,
  built into the Android package only, without debug info. DM_VK_INLINE_CS is removed.
- pipeguard: every pipeline-building thread (graphics, warm-up, async) marks its build in gfx-pipe-inflight.<slot>; an
  entry in flight on two boots in a row goes into gfx-pipe-skip (c:<key> for compute, g:<stage keys> for graphics); a
  graphics pipeline error is skipped instead of fatal. v2.0.1's unprefixed entries and its hard 098a skip are dropped.
- Android: graphics log lines go to the dm tag and the log file; crash lines print library+offset for symbol-less libraries.

Verified on Adreno 830 (vivo) with a v2.0.1 import pack: default unchanged, forced inlining in game with the same picture,
guard record / skip / restore / old entries. See docs/android-notes/2026-10-27-adreno-750-inline.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 18:40:19 +08:00
vickFunWorld 24616499a8 Android: Adreno 740/750 default the quad and warp32 rewrites off (#148)
The two Adreno shader rewrites were written for the Adreno 730 and run there
and on the Adreno 830. On Adreno 740 (Snapdragon 8 Gen 2) the newer driver
accepts the rewritten SPIR-V and then faults: dmesg has "gpu timeout" and
kgsl status 00EF1087, the driver drops the device, and the next submit fails
with VK_ERROR_DEVICE_LOST (#141). On Adreno 750 (8 Gen 3) the submission never
finishes; the async command pool reset waits 10 s, gets VK_TIMEOUT, and the
slot reuse aborts with "s.reset_result failed: 2" (Redmi K70 Pro report,
#123 and the other 8 Gen 3 issues).

xbg_adreno_policy.h decides by device family: Qualcomm, model 740-799. A
marker file still wins, so either rewrite can be forced back on for a test;
the JNI's DM_GFX_* values no longer override the device default. Adreno 730,
Adreno 830 and other vendors are unchanged, and existing import packs work
without a rebuild.

The pool-reset wait now logs the GPU hang and the fatal message names it,
instead of leaving a bare "2" in the crash report.

With both rewrites off, #141 ran 27,900+ frames at a 16.63 ms p50 on an
iQOO 11 with the same import pack. This build has not run on an 8 Gen 2 or
8 Gen 3 phone yet; the PR is a draft until it does.

Refs #141, #123, #137, #138, #139, #142, #143
2026-10-26 21:09:08 +08:00
jhaizhouandcodingOuch e3756f8942 Adopt community PR #120: optional VP8 cutscene playback on iOS
dm/ios/tools/build_ffmpeg_ios.sh builds a static FFmpeg (7.1.1, LGPL 2.1+) for iOS, and building the App with
DM_MOVIE_FFMPEG=1 / MOVIE_FFMPEG=1 links it so cutscenes are decoded to the screen, as the Mac host already can
(#97). Builds that turn it on also get a Cinematics entry on the main menu and a Chinese / English voice choice in
Custom. Default builds are unchanged: no FFmpeg, no extra Custom rows, the same saved settings.

Taken in with two changes: the voice rows are compiled in only together with FFmpeg (the PR added them to every
build), and t_fs_case.c gets the stub the host tests need to link. The language code mapping keeps v2.0's Korean.
docs/DEPENDENCIES lists FFmpeg and its license.

Checked: host unit tests, the full acceptance gate, the Mac smoke test and the on-device smoke test (3/3 each);
a default build shows no voice rows and has no FFmpeg symbols; an FFmpeg build run as the iOS App on a Mac played
Act02start.webm (1280x720) at a steady 60 fps, with different frames captured at 16 s and 40 s. Not yet run on an
iPhone; cutscene audio still goes through the game's own path.

Co-authored-by: codingOuch <25929878+codingOuch@users.noreply.github.com>
2026-10-23 15:12:16 +08:00
jhaizhouandxielh96 16b87031c3 Adopt community PR #121: iCloud save sync for the Mac App with a paid developer account
`DM_MAC_ICLOUD=1 dm/tools/mac_app.sh` signs the Mac App with the Mac provisioning profile you put into
`~/dm-work/mac-sign` (or `DM_MAC_SIGN_DIR`): team, bundle identifier, entitlements and certificate are read
from the profile, and the keychain identity is matched by the embedded certificate's SHA-1 fingerprint, so the
App carries the iCloud entitlement and syncs saves like the iPhone / iPad App. Without the switch the App is
signed locally as before. docs/MAC and the homepage describe how to turn it on.

Ported into the internal tree and checked: the code change matches the PR line for line once comments are
stripped; a default build still signs ad-hoc; with the switch, an empty signing folder and an invalid profile
stop with their specific messages. Signing with a real profile and the iCloud sync itself were tested by the
author on an M1 Pro with a paid account.

Co-authored-by: xielh96 <16849027+xielh96@users.noreply.github.com>
2026-10-23 14:28:51 +08:00
b811b90172 v2.0: Android and HarmonyOS ports, Korean, iPhone Duo, Xbox controller layout, separate game packages, Mac icon and pointer
- Android (#113, @yyan160; graphics engine and shader-bundle packer from @biglawine's HarmonyOS port): an
  Android app (dm/android) with a JNI host, a touch overlay on the shared touch state machine, Vulkan
  presentation and AAudio sound; an NVN-to-Vulkan replay engine (dm/gfx/vulkan) behind the same backend
  interface as Metal; the shared host now builds for Apple and Android, and the module rewriter has an
  Android target (DM_TARGET=android; Apple output unchanged). Measured by the authors at a median 60 fps on
  a Redmi K50 Ultra.
- Android install with your own game files: the release APK (dm/android/tools/shell_apk.sh) contains no game
  content; dm/tools/d2rm_android.py makes an import pack (rewritten program, Vulkan shader bundles, touch overlay,
  data tables) that the App imports from Download/S2X/D2R Mobile/android with a progress screen. The shader export
  step (dm/gfx/tools/dmsh_vk.py) makes the 6,927 game shader bundles byte-for-byte identical to the tested set.
- Android rewriter fix (#113, @yyan160): rewrite blocks no longer stash registers below sp (Android has no red
  zone); equiv.py checks Android outputs, structck.py recognizes the Android block shapes. Apple output unchanged.
- Android touch controls drawn as on iOS (sockets, silver skill silhouettes, joystick), no map key in game state,
  no virtual pad buttons over panels; dm/android/tools/art_compare.sh compares the two drawings pixel by pixel.
- HarmonyOS (#114, @biglawine): a HarmonyOS NEXT app (dm/harmony, ArkTS shell + N-API library) on the same shared host
  and Vulkan engine as Android; shared changes are behind __OHOS__ or opt-in switches (adaptive present tier, fence waits
  woken on completion, OHAudio, HiTrace markers, a byte-identical BC fast path).
- HarmonyOS install with your own game files (@biglawine, 0.19.4 / code122): the release HAP is unsigned and contains
  no game content; players re-sign it with their own debug certificate and import a pack made with
  dm/tools/d2rm_android.py --target ohos. The registering stand-ins read the tables only when dm_derived_reload() is
  called (on __OHOS__); first import creates the target folders; outside a game a map toggle request is dropped
  before the AutoMap exists. Run by the author on a Mate 90 Pro Max: re-sign, install, import, in game, save and exit.
- Vulkan: NaN-ignoring min / max / clamp as on Maxwell (#113, @yyan160), fixing one-frame black tiles on the OnePlus 13.
- Xbox controllers (from #110, @rrroy5640): recognized automatically and given the PC / Xbox layout (bottom
  confirms, right goes back) with the game's Xbox button icons; other controllers are unchanged. The Mac-only
  keyboard prompt switch became a three-way prompt style (Switch / keyboard / Xbox) on every platform.
- Separate base and update packages (#106, @PowerBeef): setup.sh and extract_game.sh take both packages and
  read the title keys from their tickets.
- Mac App (#108, #109, @PowerBeef): the project's icon by default; the pointer hides after resting 3 s.
- run.sh install no longer goes through the test-device battery gate (#107, @PowerBeef).
- Chinese wording (#101, @zzz6519003): 「旧接口版」 and 「默认构建」 throughout.
- Dynamic 3D resolution (from #113): a run of dropped frames counts only its first 3 frames unless it lasts
  1 s, so one-off stalls no longer lower the resolution.
- In-game Korean (#118, @soulsakura): a 한국어 column for all our UI text, a fifth option in the language row (each
  checkbox now sits before its name), Korean touch wording and map name plates, Korean voice when the game files
  carry it; a Korean system language picks Korean on first install.
- iPhone Duo: in full screen the output size follows the window when the phone is unfolded or folded, up to the
  size the game started with; needs Xcode 27.1 for the inner screen to be filled. Test switches DM_TEST_FOLD and
  DM_TEST_SCREEN simulate the two screens with the iOS package on a Mac.
- README: Android and HarmonyOS sections, device table and credits in all three languages; dependency list for Android.

Every change was ported into the internal tree with its authors credited. For the shared files, the code
changes match the pull requests' after stripping comments. Host / graphics / iOS unit tests, the full
acceptance gate and the Mac smoke test passed; the rewriter's rule sets were rebuilt and passed the
equivalence regression; an iOS build of this code was played on an iPhone; the Android APK with an import pack
made from our own game files was played on a vivo X200 Ultra.

Exported from main 8055e5212.

Co-authored-by: Yuechuan Yang <22333122+yyan160@users.noreply.github.com>
Co-authored-by: biglawine <26263820+biglawine@users.noreply.github.com>
Co-authored-by: rrroy <hly5640@gmail.com>
Co-authored-by: Patrice Déry <109446870+PowerBeef@users.noreply.github.com>
Co-authored-by: Sam Snowman(赵正中) <zhengzhongzhao@gmail.com>
Co-authored-by: soulsakura <74704744+soulsakura@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 09:21:08 +08:00
53e7c5bb9c Adopt community PRs: in-game Russian (#100), Mac packaging (#96), optional Mac VP8 movies (#97)
- Russian (ruRU), from #100 by @XpycT: a Русский column for all our UI text, a four-way language row
  (中文 / English / Español / Русский) in Options → Custom, Russian touch wording, map goal name plates,
  and first launch following a Russian device language. Voice: the Russian voice-over is used when your
  game files include it (chunk 16, present in a package built from complete game data), otherwise English.
  Item notes remain Chinese and Spanish only.
- Mac packaging, from #96 by @SwonDev: SW_MAC_ROMFS_COPY=1 bundles your own resources (private use only),
  SW_MAC_ICON_SOURCE builds an App icon from your own image, linked non-system dylibs are copied into the
  bundle and relinked, and the bundle is verified with a strict codesign check. Rebuilding into the same
  output directory still replaces the whole App.
- Mac movies, from #97 by @SwonDev: MOVIE_FFMPEG=1 swaps the duration-only movie backend for FFmpeg VP8
  decoding to NV12; the default build and iOS are unchanged. See dm/host/MOVIE.md.

Every change was ported into the internal tree and passed the host unit tests, a Russian UI regression
run on the iOS app on Mac, the Mac smoke test, a real-iPhone smoke test (3/3) and the full acceptance gate.

Exported from main 69614143f.

Co-authored-by: XpycT <XpycT.TOP@gmail.com>
Co-authored-by: SwonDev <35969131+SwonDev@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:13:20 +08:00
44a6770601 Apple TV (tvOS) community port as a separate DmTV target; Rift and Mac fixes
- Apple TV 4K (3rd gen, A15): community port by @yinqingyan, contributed under
  the MIT License with the author's consent
  (https://github.com/jhaizhou-ops/d2r-mobile/issues/53#issuecomment-6184331793).
  Developer preview: reached character selection on the author's Apple TV;
  entering the game, full controller mapping and saves are not verified, and
  the maintainers have not tested it on real hardware. Separate DmTV target in
  dm/ios/project.yml (the iOS target is unchanged), bundled tvOS shaders,
  zh/en strings, icon generated from the iOS icon. Real hardware only: the tvOS
  Simulator GPU cannot run the renderer. See dm/tvos/README.md.
- Rift: the next guardian wave no longer spawns in town after you go back; it
  spawns when you return to the Rift level (#44, from @hubeiqiao's PR #45). A
  Rift monster that dies just across the border in the neighbouring original
  level no longer triggers that level's original quest events.
- Mac: choosing the folder that directly holds the .data files is accepted, and
  Chinese folder names show correctly in the error message; frame pacing follows
  the refresh rate of the screen the window is on (72 fps on 144 Hz screens).
- iCloud: forked shared stashes are merged in game (items, gold and Chronicle
  vault) instead of one copy replacing the other.
- Touch: with the primary skill empty, tapping "+" on the main attack button
  opens the skill picker.
- Renderer: fixed-function state is not re-sent when unchanged; copy-encoder
  reuse adds an in-encoder barrier on Metal 4; per-pass GPU timing works on
  Metal 4 again.

Co-authored-by: yinqingyan <271124084+yinqingyan@users.noreply.github.com>
Co-authored-by: hubeiqiao <12777592+hubeiqiao@users.noreply.github.com>
2026-10-15 13:23:23 +08:00
jhaizhou b94670c795 v1.0.15: shell is now build input (.zip), launch self-check for incomplete packages and devices without Metal 3, graphics translation on its own thread, save with the pause menu open, wide-iPhone item tooltip and Chronicle rewards fixes 2026-10-15 04:32:15 +08:00
jhaizhouandseedds e2a0c9a9b5 NPC speech restored (explicit 5.1 to stereo downmix); graphics memory pools made resident only on first GPU use (about 0.5 GB less held); render targets written through a format-changing view attached with that format, sRGB swapchain presented through a non-sRGB view (#36); bloom / FXAA texture-slot rewrites mark bindings dirty; Mac App plays sound and fills 16:10 screens
The render-target view issue (#36) was found and diagnosed by seedds on another port built from this repository, who also proposed the fix direction.

Co-authored-by: seedds <3463322+seedds@users.noreply.github.com>
2026-10-14 21:46:55 +08:00
jhaizhou 5bc5a01087 Docs: which devices are supported (iPhone / iPad by chip and system, Mac), what the in-app dialogs mean, and what self-built packages do not include 2026-10-14 12:08:38 +08:00
jhaizhouandJoe Hu 2e7177c080 Greater Rift: two Guardians from level 75, overtime status spelled out (#33); item descriptions stay open on touch (#32); Mac: click monsters to attack, items take the mouse, Share Log
The overtime status (#33) was reported with a clear direction by Joe Hu, who also sent a patch along the same lines (#34).

Co-authored-by: Joe Hu <12777592+hubeiqiao@users.noreply.github.com>
2026-10-14 10:34:48 +08:00
jhaizhouandJoe Hu dc3cc22b9b Greater Rift: confirm before the next-level door (#25), robust return to a finished run, top bar capped at level 100 (#29), monster life clamp; Mac: close X on the rift page
The top-bar fix (#29) was reported and diagnosed by Joe Hu, who also sent a fix along the same lines (#30).

Co-authored-by: Joe Hu <12777592+hubeiqiao@users.noreply.github.com>
2026-10-14 07:02:05 +08:00
jhaizhouandJoe Hu 135773b44f Docs: regression checklist for Greater Rift minion life (verification matrix proposed by the reporter of #23)
Co-authored-by: Joe Hu <12777592+hubeiqiao@users.noreply.github.com>
2026-10-14 05:34:59 +08:00
jhaizhou feb2bb9fdc Greater Rift minion life fix (#23); Mac click-to-walk and keyboard key names; older-API declaration de-duplication 2026-10-14 05:22:34 +08:00
jhaizhou d9e95c3381 Older systems: iOS 18+ / macOS 15+ via the older-API build; floating left stick; runeword required level; Mac keyboard, mouse and docs; clearer older-device dialog 2026-10-14 01:49:25 +08:00
jhaizhou eab0fada7c No-Xcode route: older devices (A16 and earlier) are supported - give the packaging tool a Legacy Device Pack with D2RM_ASTC_PACK 2026-10-13 19:52:03 +08:00
jhaizhou b50b976523 Older devices (A16 and earlier): a start-to-finish guide for the Legacy Device Pack
docs/LEGACY_DEVICES.md explains why older chips need an extra texture pack, how to build the astcenc encoder, the three commands that make the pack from your own game files, how to build the App with it and where the folder goes on the phone. The README links to it from the performance section and the status table. astc_pack.py now names the output folder "Legacy Device Pack", the name the App asks for.
2026-10-13 19:23:29 +08:00
jhaizhou 2b270ff76e Docs: the Mac version requires macOS 26 or later (the graphics layer is built on Metal 4); setup.sh notes it on older systems 2026-10-13 18:15:23 +08:00
jhaizhou 6a2474d917 Native macOS App (first version): dm/tools/mac_app.sh, docs/MAC.md
The Mac host can now be packaged as a double-click macOS App with keyboard, mouse and gamepad input, saves under Application Support, a first-launch resource-folder picker and save-before-quit. dm/tools/mac_app.sh builds it after ./setup.sh; by default the package carries no derived content and points at this machine's build outputs, so it runs only on the Mac that built it and needs only a local ad-hoc signature.

Nobody has played this version by hand yet; what was verified was run unattended. See docs/MAC.md.
2026-10-13 16:49:19 +08:00
jhaizhou ffab0bf5d2 Docs: name the game version as the console shows it (1.0.34.0, PC 3.3.94012); note community ports to other versions; package format is not checked 2026-10-13 15:28:59 +08:00