#133

feat(web): add local browser IPA packager

Openn3crosiswants to merge intofrom

What changed

Users can now generate an IPA on the website, with shaders precompiled in the browser.

Here’s a working build: https://n3crosis.github.io/d2r-mobile/

  • Compile real game shaders locally into Metal .metallib libraries with floor_llvm compiled to WebAssembly, rather than only packaging shader source.

  • End users do not need to install any additional software or development tools before generating the IPA. Everything runs locally in a supported desktop browser. Required runtimes load automatically, including .NET WASM used internally by the shader translator.

  • Supply your own game-input folder. Installing the resulting IPA is a separate step; optional local signing requires your signing identity and provisioning profile.

  • Support the v2.0.0 shells for iOS 26 and iOS 18.

  • Accept NSP/XCI or a complete merged ExeFS/RomFS layout. Package mode validates content identity, updates and optional DLC; extracted input does not provide the same authentication. Invalid package keys do not silently fall back to extracted mode.

  • Use pinned, digest-verified public runtimes for program rewriting, asset generation, shader translation and AIR WASM compilation. The browser downloads about 40 MB of gzip-compressed runtime files.

  • Export bulk resources directly to data, without a UUID wrapper. Reuse existing data only after a complete bounded comparison; mismatches stop without modifying it. Optional older-GPU output uses Legacy Device Pack (with a numbered suffix on collision). Generated-output cache is visible as D2R-cache.

  • Produce an unsigned IPA by default or sign locally with the user's P12/PFX and matching provisioning profile. Download is not offered until requested signing completes. App identity and signing options remain visible; EN/简体中文 switching is at the top.

  • Include progress, cancellation, retryable download, installation guidance, bounded worker pooling and source/runtime-bound caching. This is a new web application and toolchain integration, not a rewrite of native game logic.

  • Add an early folder-access capability warning and remove the optional full-content hashing pass; required integrity/authentication checks remain. Preserve notices for the actual bundled dependency set.

  • Add a CI job that builds the website and public runtimes, then deploys the verified output to GitHub Pages on successful deployment-branch runs. No local build is needed to deploy. Pull requests do not deploy.

Why

Allow users with their own legally obtained game files to prepare an IPA without installing a development toolchain, while keeping explicit input validation and output boundaries. Public runtimes preload before private input processing.

Checks run

Tested with the game on a real device and confirmed working.

Submission branch

No game files needed:

  • python3 dm/i18n/scan_literals.py
    • I18N OK:中文字面量 465 条全在白名单(111 行),其余走中英表
  • python3 dm/ios/tools/dm_i18n.py --check
    • dm_i18n OK 453 条

Game files and a workspace prepared by ./setup.sh needed:

  • make -C dm/host/tests run
  • make -C dm/gfx/tests run
  • make -C dm/ios/tests test
  • dm/verify/regress.sh (with --fresh if dm/tools/patch_nso.py changed)
  • cd dm/ios && ./run.sh build
  • dm/ios/tools/smoke_mac.sh 1
  • dm/ios/tools/check_hud_gen.sh

Anything else run:

  • Linux / Node.js 24.19.0 / Bun 1.4.3: exact quick recipe passes, including frozen install/audit, frontend build, lint, TypeScript, documentation/workflow formatting, and explicit repository Ruff/clang-format/Bash checks.
  • Combined application tree: 1,559 tests, 1,536 passed, 23 skipped, 0 failed.
  • Current CI build and GitHub Pages deployment: passed for 38bf0a6.

Use desktop Chrome or Edge. Game resources are exported separately.

Visible changes

  • Nothing on screen changes
  • Something on screen changes — screenshots taken after the change are attached below
  • Web UI text is in web/i18n/ui_text.tsv; native translation sources and generated outputs are unchanged

No game content

  • This change contains no game files, nothing generated from game files, no keys, and no built package
  • It does not carry the local rewrites ./setup.sh makes to dm/gfx/tools/dmsh_chain.lock, dm/gfx/nvn/dmsh_chain.h and dm/gfx/nvn/c1_full.tsv

Comments

  • New and changed comments are in both Chinese and English

Authored new/changed comments and file-purpose headers are bilingual. Unmodified third-party licenses, vendored code and the pinned public compiler reference retain their original bytes.

Activity

2
jhaizhou-ops1mo ago

@n3crosis 由衷地向你致以崇高的敬意和感谢。

在浏览器里把整条出包链跑通,每一环都有实打实的东西:游戏包解密、程序改写、6,927 个着色器的翻译,还有最难的一环——用开源的 floor_llvm 代替苹果的闭源 Metal 编译器,在本地编出能直接装的 metallib。这意味着玩家不用 Mac、不用装任何开发工具,打开一个网页就能用自己的游戏文件做出着色器已经编好的 iOS 包。这是了不起的工作。

项目负责人 @jhaizhou-ops 想先好好想一想这件事的重大意义,也会亲自认真试一遍,再定下怎么和主仓库结合。请给我们一点时间。

再次感谢你的投入。


@n3crosis — our deepest respect and thanks.

You got the whole packaging chain running in a browser, and every link in it is real work: decrypting the game packages, rewriting the program, translating all 6,927 shaders, and, hardest of all, replacing Apple's closed Metal compiler with an open floor_llvm build that produces installable metallibs locally. Players no longer need a Mac or any developer tools: one web page turns their own game files into an iOS package with the shaders already compiled. That is a remarkable achievement.

The project lead, @jhaizhou-ops, wants to think through what this means for the project and to try it out properly before deciding how it fits with the main repository. Please give us a little time.

Thank you again for all the work you have put into this.