Skip to content

Integrate Windows builder, RomFS split fix and CoreMotion gyro - #2

Draft
KillingStalking wants to merge 112 commits into
mainfrom
integrate-windows-gyro
Draft

KillingStalking wants to merge 112 commits into
mainfrom
integrate-windows-gyro

Conversation

@KillingStalking

@KillingStalking KillingStalking commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Integration

  • Start from the latest seedds/nxnative history and merge the zenvyzenshiro/NXNativeWindows port, preserving both histories.
  • Keep upstream's newer game/profile and memory changes where they overlap the older Windows branch.
  • Preserve the Windows builder documentation as README.windows.md and link it from the current upstream README.
  • Add the Windows build's additional OCTOPATH TRAVELER 0 v0 profile row without restoring the obsolete per-game patches.py that upstream replaced with generalized Unreal patches.

Custom fixes

  • Restore the RomFS-image-aware split-data path: virtual RomFS traversal, rfs.open fallback copying, and allow split builds from RomFS.img (BOTW build fix).
  • Port the CoreMotion phone gyro/shake path, recentering, orientation mapping (including iOS 27 deviceMotionBody), host HID publishing, and the iOS Motion controls setting.
  • Keep software BC1–BC7 support for GPUs without native BC compression (A16 and older): BC1–BC3 integer ASTC transcoder with Metal compute acceleration and CPU fallback; BC7 ASTC / BC4–BC5 R8/RG8 / BC6H floating-point fallbacks.
  • Keep BC 3D textures on uncompressed pixel formats rather than assuming ASTC 3D support; use the matching target-aware row pitch and decoder for upload and buffer-to-texture copies.
  • Document the older-GPU fallback and the DM_BC_SOFT=1 / DM_BC_ASTC=0 test and compatibility switches.

Validation status

The source changes and fallback paths are committed, but this branch has not had a full iOS build, Windows build, or physical-device run. The BC1–BC3 GPU parity test is present but has not been executed. Keep this PR in draft until those checks pass.

zenvyzenshiro and others added 30 commits October 26, 2026 04:59
Run the upstream NSP-to-IPA pipeline on Windows: map xcrun to the Metal
Developer Tools for Windows and LLVM, replace build_ipa.sh with an LLVM
clang + ld64.lld build, port the SwiftUI launcher to UIKit, extract the
iPhoneOS SDK from Xcode.xip, and pack Unix modes from Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shader chain fingerprints hash source bytes (dmsh_xlate --source-sha,
chain inputs); a CRLF checkout on Windows changes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Find the single-toolchain layout of Metal Developer Tools 5.x/6.x.
Extract Xcode 27 xips, whose deduplicated cpio stores hard links as
NULLcanary placeholders, and resolve chained symlinks. Add
win/compile_check.py, which builds every app source against the SDK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebuild a LÖVE game's run-time GLSL offline from the Lua that love-nx
embeds in main (its defaults match gl_capture.tsv byte for byte). Give a
derived profile a RomFS marker its version has. Take the button-icon
letters from a Windows font. Add a step-by-step Windows tutorial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LÖVE hands each .fs file's bytes to GL as they are; read_text turned
Balatro's CRLF into LF, so no game shader matched what the game compiles
on the device (every draw skipped, then a crash after the menu). The 31
keys an iPad run asked for are now all in the library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The upstream NSP script, build_ipa.sh and the Mac app packer now use the
same default as the Windows driver; docs follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
win/gui.pyw (Tkinter, black and pink, English) runs win/build_ipa_windows.py
with --progress json and shows stages, progress and the log. Files that
share a folder with another game are hard-linked into a folder of their
own. Build-IPA-GUI.bat starts it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rounded cards, a click-to-choose drop zone, file chips (base / update /
DLC), a pink-to-violet Build button that becomes the progress bar, a
result card, and details shown by default with the defaults a build uses.
App name, bundle ID, language and the FPS switch are gone: builds use the
pipeline's defaults.

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

win/ios/Launcher.m now draws as the original SwiftUI launcher (2f69480):
one rounded section per setting, choices as a menu, ranges as an inline
slider, the game card on the left half. settings.tsv lists Frame rate
(with Game default), Render scale (disabled where the build has no stub),
Console mode (docked, handheld for touch games) and Game language for
every game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sdk 86a2afd863c9 (Megabyte Punch, Unity 2019.2) takes the node area and
1 GB alignment cuts of the SDK 8.2.1 build, found at the same distances
from its AddressRegionManager constructor and checked by disassembly; its
StandardAllocator::Initialize broke in nninitStartup on an iPad. On
Windows the heap check becomes an estimate: a provisional profile with
virtual address memory gets a 2 GB application pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
win/sdk_auto_cuts.py finds the node-area loads in the AddressRegionManager
constructor (by its dynamic symbol) and the 1 GB alignment load after it,
for games with virtual address memory whose sdk build sdk_patches.py does
not register; the shim adds them to CUTS when patch_nso.py loads the file.
Megabyte Punch's manual SDK 8.3.1 entry leaves sdk_patches.py (it has no
repository profile, so test_patches.py refused it); the found cuts give
the same patched sdk byte for byte.

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

A full player guide: status and the tested PC, setup, the window and the
terminal builds, Sideloadly, the launcher settings, how each Mac step is
replaced, which games need a Mac, troubleshooting, differences from
upstream, layout and updating. GUI screenshots in docs/images/windows.

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

dm/gfx/tex/bc_soft.c decodes BC1-BC7 (BC6H, BC7 with their partition and
anchor tables) into RGBA8 / R8 / RG8 / RGBA16F. While the Metal device
reports no BC support, nvn_fmt_to_mtl answers each BC format with that
format, and package uploads and buffer-to-texture copies decode the
blocks on the CPU. An iPad with an A16 aborted on Megabyte Punch's BC3
textures. win/tests checks the decoder against Pillow block by block.

The shim writes every pipeline text file with LF line ends: CRLF made the
host refuse the shader libraries' stamp and c1_full.tsv. README lists the
games again and describes the A16 support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shim runs xcrun metal / metallib straight to the Windows Metal tools
(no Python per shader: 1.05 s → 0.36 s a compile), the shader build runs
twice the cores' workers, and os.replace retries as POSIX rename would
(threads finishing the same cache entry). Megabyte Punch's 3,498 shaders
take 3:35 in place of 6:13. bc_soft.c reads bits a word at a time and
decodes big levels on every core (GCD): a 2048x2048 BC7 level in 65 ms
on one PC core.

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

win/arm64_emu.py (Unicorn) loads NSO modules, relocates them and calls
their functions, with the C library's memory functions and an allocator
as traps; checked with the SDK's nn::util::DecompressZlib against zlib.
win/oodle_emu.py ports hle_oodle.c's decoder search and its SERVE / JOB
modes, so the Oodle, Unreal and LZ5 steps no longer need a Mac. Not yet
run on an Oodle game's files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…apture on the device

arm64_emu.py applies DT_RELR packed relocations (SDK 19 games): Octopath
Traveler 0's Oodle decoder now runs in the emulator and decodes its 10,596
shaders. uepak.py's CCCrypt maps to Windows CNG (bcrypt.dll), checked with
the FIPS-197 vector. GLSLC and Vulkan captures no longer need a Mac: the
build packs a capture IPA (no shader libraries, DM_*_CAPTURE in its
env.txt; Launcher.m makes the folder), and the folder copied back from the
device finishes the build. The version warning is red only when the
registered builds carry fixes the version loses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The iOS build never packs them, and c1_guard.py / cb_extent.py read only
the MSL and JSON beside them. subprocess.run of xcrun -sdk macosx metal /
metallib writes an empty file in-process (no process: starting one costs
about 0.35 s here). NXW_MAC_METAL=1 compiles them for real.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ryujinx's SPIR-V backend refused bounded image atomics whose result is
used. They now return the atomic's value through OpPhi (zero when the
coordinate is out of bounds). Octopath Traveler 0 goes from 2093 failed
shaders to 16. Rebuilt dmsh_xlate, bumped DMSH_CHAIN to 356a42e62fee,
and updated test_image_atomic_bounds.py.

LICENSE: add the NXNative for Windows copyright line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split build (--split-data, or Package > App + data folder in the window):
the IPA holds only the app (Balatro: 9.8 MB) and the game files, shader
libraries and DLC go to a "<IPA name>-data" folder, hard-linked, that
the player copies into the app's Documents once. Re-signing then takes
seconds. The iOS app looks for romfs/ in Documents, in each folder
directly inside Documents, then in the bundle, and takes msl/ and aoc/
beside the romfs it found.

Octopath Traveler 0 1.0.0 (v0, the cartridge): nninitStartup crashed in
the FMallocBinned3 constructor (37 GB of address space) because the
allocator cut was registered only for 1.0.5. v0 has the same call at
main+0x12e40; the object is at main+0x68082c8 and the vtable at
main+0x5b0cf68 (checked by disassembly). Registered the v0 build row,
cut and host allocator entry.

GUI: a Package card with the two choices; flat pink accent instead of
the pink-to-violet gradients; numbered steps as plain numerals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream: MetalFX spatial upscaling and the single-screen launcher,
offline Metal pipeline archives, the prepare step and hybrid pipelines,
Pokemon Shield / Brilliant Diamond, Echoes of Wisdom 1.1.0, thermal
frame-rate caps, function-matched cuts, and fixes.

Windows side:
- Translator rebuilt from upstream's Ryujinx sources plus our returning
  bounded image atomics (chain 22e827f8eaed; test_image_atomic_bounds
  passes against the rebuilt DLLs).
- build_app.py follows build_ipa.sh: shader_pairs.tsv / pso_pairs.tsv
  in the app, the offline pipeline archive through metal-tt (shipped by
  Metal Developer Tools for Windows; xcrun.py maps metal-*), the
  pulling-library skip, MetalFX linked, DM_METAL_CAPTURE.
- Launcher.m ports the single-screen launcher: Game / Controls /
  Performance sections, notes under labels, toggles with on/off values,
  Reset to tested defaults, only changed choices stored.
- settings.tsv keeps Frame rate, Render scale and Game language always
  listed (greyed out where a game has nothing they act on; a greyed
  Frame rate shows Game default).
- The profile status line is not red when the only differing fixes are
  sdk address-region cuts that win/sdk_auto_cuts.py found.
- README: split builds, the new launcher, the sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 60 fps lock

Found from the cvar names' registrations (main+0x2ca6550, main+0x1026e50) as for 1.0.5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the app finds no game files it now shows, in the launcher's style,
where the data folder goes: its name and size (NXWDataFolder /
NXWDataSize in Info.plist, written by a split build), the Apple Devices
and Files app routes, and a Check again button that looks for it
without restarting. Replaces the one-line hint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows os.walk and relpath give backslashes, so shader_split.py sorted
its files differently and named packages from paths like /Effect\...:
Tears of the Kingdom 1.4.3's split matched the profile's keys but not
its shader_map.tsv (order and package names), and the build stopped.
gl_shaders.py and vk_shaders.py record sources the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e no such key)

Portal's capture IPA stopped with KeyError: game.tsv has no key pso_mtl4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

4 participants