d2rm_android.py checks only these four, and test_s2arm_deps.py confirms the packing path imports nothing else.
unicorn is used only by the developer checks under dm/host/tests (DEPENDENCIES.md), and on Windows it can need a
source build with Visual Studio when no wheel matches the Python version. NO_XCODE.md and HARMONYOS.md list it too;
left for the maintainer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The interface-art scripts (romfs_art.py, gen_widestash_art.py) read the game's textures through a small deswizzle library
that they build with clang on the spot unless DM_DESWIZZLE_LIB is set. On Windows that needs LLVM plus Visual Studio's
C++ tools, which is most of the setup list in #243. The release's shell zip already carries the library
(Tools/deswizzle/{win-x64,macos-arm64}/), and d2rm_pack.py places it for the iOS route.
- check_env: with --shell, place_deswizzle(z) sets DM_DESWIZZLE_LIB from the shell; without a prebuilt library it now asks
for clang up front (the scripts call clang by name) instead of failing halfway through the art step.
- Header, docs/ANDROID.md (+ zh-CN) and dm/android/README (+ zh-CN): clang is listed, and --shell covers it too.
- test_android_shell.py: 11 cases (shell with both tools needs neither .NET nor clang and sets DM_DESWIZZLE_LIB; a shell
without the library, or no shell, needs clang; DM_DESWIZZLE_LIB needs no clang).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows the Android import pack needed the .NET SDK only to build dmsh_xlate, and that build is where players get stuck
(NuGet source fixes, a failing shader step, #243). The release's D2RMobile-shell-build-input.zip already carries NativeAOT
translators for win-x64 and macos-arm64 (the S2Arm / iOS packing path uses them).
- d2rm_android.py --shell <shell zip>: the translator comes from DM_XLATE_PREBUILT, else the shell's Tools/dmsh_xlate/<platform>/,
else a .NET build as before. Only the zip's Tools/ is used. The shell's product code must match the source (same rule as
d2rm_pack.py), so a translator from another release cannot make mismatched shaders.
- check_env asks for the .NET SDK only when there is no prebuilt translator; its message points at --shell when none was given.
- docs/ANDROID.md (+ zh-CN) and dm/android/README (+ zh-CN): the --shell route for Windows and Apple-silicon Macs.
- dm/tools/tests/test_android_shell.py (7 cases, also run by make -C dm/host/tests run): product mismatch stops, missing file
stops, a matching shell with a translator needs no .NET and places it, a shell without one still needs .NET, DM_XLATE_PREBUILT
needs no .NET.
Checked on Linux (xbl-tools:1) with dotnet hidden: a full pack from a test copy of the v2.3.5 shell zip with a NativeAOT
linux-x64 translator added builds all 6,931 shaders, byte-identical to the .NET-built pack except the 42 that #303 changes.
The real v2.3.5 zip (no Linux translator) stops with the .NET message. Not run on Windows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
d2rm_pack.py counted the rewritten program as done when the files existed. The out
directory is keyed by the product code, and the code does not always change with the
rewriter (v2.3.0 -> v2.3.1 changed patch_nso.py and kept r45). Anyone who reuses a
work directory -- S2Arm does on every export -- would keep packing a program the older
rewriter made, with no message.
patched_ready() now also requires the fingerprint patch_nso.py records next to its
products (build_src.sha256) to equal this source's patch_nso.py, the same rule
d2rm_android.py already uses. Same class of problem as #299 / #300.
dm/tools/tests/test_patched_ready.py (4 cases, in make -C dm/host/tests run): current
rewriter = done; older fingerprint, no fingerprint, missing gates file = redo.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Felt on a OnePlus 13: even the predefined heavy click is one short tap,
and the click / tick of the medium and light tiers are barely noticeable,
so every tier now plays EFFECT_HEAVY_CLICK. The tier still goes into the
log. iOS keeps its Heavy / Medium / Light by tier.
OnePlus 13 (Android 17): a Ber rune (tier 1) and a unique cap (tier 2)
from DM_TEST_GIVE both played Prebaked=HEAVY_CLICK, usage MEDIA, and felt
the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After moving from the v2.3.1 shell to v2.3.3, d2rm_pack.py kept the
framework-dependent dmsh_xlate that v2.3.1 had placed in
build/gfx/dmsh_xlate: the step counted as done whenever the file existed,
so place_xlate (which does replace the folder) never ran. That copy needs
.NET; without it --source-sha printed nothing, and dmsh_chain.py reported
"translator not built from in-repo source (embedded: empty)", which
pointed the wrong way.
- d2rm_pack.xlate_ready: with a prebuilt translator (the shell's copy for
this platform, or DM_XLATE_PREBUILT) the placed files must match it byte
for byte, otherwise place_xlate replaces the folder. Without a prebuilt
one (developer machines build it with .NET) presence is enough, as
before. Used by d2rm_pack.py and d2rm_android.py.
- dmsh_chain.py: when the translator does not run (no output, or it
cannot start) the report says so, with its exit code and first stderr
line, instead of "not built from in-repo source".
dm/tools/tests/test_xlate_ready.py covers both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#284 now recognises the Adreno model by device ID when the name has none
(the Retroid Pocket G2 reports "Adreno (TM) 22" with the 735's ID).
Resolved the policy header and the engine call site, and gave
xbg_adreno_inline_is_new the same optional device ID so the one-time
retry of old skip entries also reaches such phones. Tests cover the 6xx
and the 735 by ID.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Retroid Pocket G2 reports its GPU as "Adreno (TM) 22", but its device
ID is 0x43030b00, the same as the Adreno 735. It crashes the same way as
the 735 in #169: SIGSEGV addr=0x48 in libllvm-qgl.so on 098a126f92bf533a
with inlining off. The policy only parsed a three-digit model from the
name, so this phone would not get the 735's inlining.
xbg_adreno_model_of() takes the model from the name when it parses, and
otherwise from a table of device IDs seen in the issue reports (650, 660,
730, 720, 735, 750, 830). rewrites_fault, compiler_needs_inline and
dispatch_overruns take the device ID as an optional third argument, and
xbg_game.cpp passes properties.deviceID. A name that parses always wins,
so every phone that reports a normal name behaves as before.
adreno_policy_test.cpp: "Adreno (TM) 22" with the 735's ID gets inlining
but not the rewrite switch-off, with an unknown ID or none it gets
neither, a parseable name wins, and ID-only detection also covers the
720 (rewrites off) and the 830 (dispatch guard).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Neither test phone (Redmi K50 Ultra, OnePlus 13) nor any Apple chip
lacks LSE atomics, RCpc or dot product, so a change that brings them back
would only show up as a SIGILL on Snapdragon 680-class phones (#293).
tools/check_armv80.py runs the NDK's llvm-objdump on libdm.so after the
link (CMake POST_BUILD) and fails the build on any LSE atomic (cas, casp,
swp, ld<op>, st<op>), RCpc load/store (ldapr, ldapur, stlur) or dot
product (sdot, udot), listing the function and instruction. Allowed:
compiler-rt's __aarch64_* outline atomics and libdeflate's
adler32_arm_neon_dotprod, which are picked at run time from HWCAP.
It takes about 2 s.
Checked: the v2.3.1 release libdm.so fails (524: nvn_prof_entry and the
523 thunks); this branch passes; disabling the asm_elf.py rewrite makes
the link step fail, and restoring it passes again. The APK is
byte-identical to the one tested on the Redmi (e7ee7936).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every NVN call goes through a counting thunk in nvn_thunks.S that bumps
its counter with stadd, an ARMv8.1 LSE atomic. Android phones with
ARMv8.0 cores (Cortex-A53 / A73 class: Snapdragon 680 / 665 / 662 / 460
and others) have no LSE, so the first graphics call raised SIGILL. The
#293 log (Redmi Note 11, Snapdragon 680): CRASH sig=4 at libdm.so+0x34a7f4,
which in the v2.3.1 release APK is the stadd in nvnth_6.
- asm_elf.py (Android build only): stadd Xs, [Xn] becomes an
ldxr / add / stxr / cbnz retry loop with x14 / w15 as scratch, which
are caller-saved (the C implementations the thunks jump to clobber
them anyway). Any other stadd form stops the build. This covers the
generated nvn_thunks.S and the DM_NVN_PROF wrapper in nvn_entry.S.
- hle_count.c: on Android, the DM_HLECOUNT debug stubs (which emit
stadd at run time) turn themselves off on a CPU without LSE.
iOS and HarmonyOS assemble the original files and are unchanged.
Checked: the built libdm.so has LSE instructions only in compiler-rt's
__aarch64_* helpers, which check the CPU at run time. Under unicorn's
Cortex-A53 model the old nvnth_6 raises an exception and the new one
counts and jumps. Redmi K50 Ultra camp run: clean, 60 fps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Custom page's "Vibrate on valuable drops" row did nothing on Android:
dm_drophaptic.c picks a tier when a valuable item lands, but only the iOS
front end took it.
- touch_android.c: the per-frame input hook takes the pending tier before
the touch lock and hands it to front_android_drop_haptic.
- text_input_jni.c: a new job kind on the existing Java worker thread calls
DmActivity.dropHaptic (optional lookup, like shareDiagnostics). It only
queues, so the game thread never waits on Java.
- DmActivity.dropHaptic: tier 1/2/3 -> predefined HEAVY_CLICK / CLICK /
TICK, as media vibration, so the system's touch-feedback switch does not
turn it off.
- Manifest: VIBRATE (a normal permission, no prompt).
- dm_drophaptic.c: header comment names the Android consumer (comment only).
Redmi K50 Ultra, DM_TEST_GIVE drops of Ber / Ist / Pul: each logged its
tier and dumpsys vibrator_manager shows HEAVY_CLICK / CLICK / TICK played
for com.xiaoboluo.d2r with usage MEDIA.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
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>
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>
S2Arm's bundled spirv-cross is built from modified sources and translates
2984 of 6927 shaders differently from upstream 1.4.363.0, so the shader
digest never matched on Windows. The shell now ships spirv-cross built from
the upstream vulkan-sdk tag as is (Windows: static CRT, KERNEL32 only);
d2rm_pack uses it before PATH and no longer falls back to S2Arm's copy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- dmsh_xlate: JsonArray.Add takes a JsonNode (the generic Add<T> needs dynamic code under NativeAOT); the one trimming
warning left in Ryujinx.Common's log formatter is suppressed with its reason (log lines only). PublishAot warnings 13 -> 0.
- shell_build.sh: Tools/dmsh_xlate/<platform>/ gets NativeAOT builds: macos-arm64 built here, win-x64 from
DM_XLATE_WIN_AOT (NativeAOT cannot cross operating systems); both must report the same --source-sha.
- d2rm_pack.py: takes the translator for its platform from the shell and checks nothing about .NET; only without
one does it fall back to building with the .NET SDK (developer machines).
- dm/gfx/tools/aot_run.py: the build chain runs through it; when the translator directory has no dlls (NativeAOT),
dmsh_chain.py's fingerprint reads of the three dlls read the executable instead. No build-chain file changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- dm/tools/deswizzle_build.sh: prebuild the texture deswizzle library from the same sources
(macos-arm64 dylib; win-x64 DLL cross-built on the Mac, no C runtime); shipped in the shell zip under Tools/deswizzle/<platform>/.
- shell_build.sh: also put a win-x64 launcher (dmsh_xlate.exe) next to the prebuilt translator, and the deswizzle libraries.
- d2rm_pack.py: take the prebuilt deswizzle library (DM_DESWIZZLE_LIB); only require a C compiler without one;
with the prebuilt translator only the .NET runtime is needed (DOTNET_ROOT); find spirv-cross also in S2A_PREBUILT_TOOLS/spvc/cli/bin;
report every missing item with its real reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
When the S2Arm launcher pushes the resource pack it launches the app once with S2A_PACK_APPLY_ONLY=1 to unpack it. On a first install with a free Apple ID the developer is not trusted yet, that launch fails, and the tars stay in Documents/资源包/.incoming; opening the app afterwards only said "Game resources not found". Now boot sends a pending push to the resource screen, which unpacks it in place (progress by batch, reason from unpack.log on failure) and then starts the game, so no second launch from the computer is needed. An update push is also unpacked before the game starts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Once a rune's stack in the advanced stash reaches 99, every further one
the auto-pickup collected could not go into the stash and piled up in the
pouch. Auto-pickup now leaves such a rune on the ground. It reads the
client's copy of the player's advanced stash unit (type-0 unit buckets at
main+0x2d603a0, item list as in bag_item, stack count at item data
+0x9c, as adv_stack_full does on the server). Gems are still picked up,
as the request asks. Each skipped rune is logged once.
Tested on a OnePlus 13: after 99 Eth went into the stash, 3 more Eth stayed
on the ground (one log line each) and 3 Tir were picked up as usual.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A long press on an empty item cell sorts that page through the game's own
"hold to sort" end point, 0x3c2320(owner unit id, page). The host always
passed the player's unit id and a fixed page (0 backpack, 3 Cube, 4
stash), but the shared stash pages are owned by another unit, so a long
press there sorted the personal page or nothing.
Like the original controller code (main+0x3b2e58-0x3b2ea0), the long press
now takes the owner unit id [grid+0x5c4], owner type [grid+0x5c8] and page
[grid+0x630] from the item grid it hit (vtable main+0x2089ab8), looks the
unit up (0x45f5f0), runs the availability check (0x3c213c) and sorts. When
the hit widget is not an item grid it falls back to the old path.
Tested on a OnePlus 13: long press on an empty cell sorts the personal
stash page (owner 1), a shared stash page (owner 2, which did not sort
before) and the backpack.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#224 added the sixth option to the Custom page's language row
(touch_layout.py: label @dmCustomLangPtOpt, hint @dmCustomLangHintPt) but
not the two rows to dm/i18n/ui_text.tsv, so the game showed its "missing
string" text for the option, and for the "tap Apply, then reopen" hint
after picking Portuguese. Both rows are added (the option is written
"Português" in every language like the other five; the hint is the
Portuguese sentence) and dm_i18n_tab.h is regenerated.
test_touch_layout_language.py now also checks that every "@key" on the
Custom page is in the string table; without the two rows it fails with
exactly these two keys.
Tested on a OnePlus 13 with a new import pack and APK from the same
source: the option reads "Português".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>