Skip to content

iOS: find a game's DLC (aoc/) in Documents before the app bundle - #486

Closed
v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:ios-dlc-documents
Closed

v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:ios-dlc-documents

Conversation

@v0lumehi

Copy link
Copy Markdown
Contributor

What and why

The iOS app looked for a game's DLC only in <App>/aoc (dm/ios/Sources/main.m), while the game files already come from Documents/romfs.img (or Documents/romfs) before the bundle. So aoc/ had to stay in the IPA even when the game data is pushed to the device separately (DM_COPY_ROMFS=NO, #478).

aoc_locate() now sits beside the RomFS lookup and follows its order: a DM_AOC_DIR that is already set (env.txt, launch environment) wins, else Documents/aoc, else <App>/aoc. It logs boot: DLC from <path>. Documents/aoc is kept out of backups like the game files. scripts/push_romfs.sh also copies the build's add-on content (DM_RESOURCE_AOC) to Documents/aoc when there is any. Part of #388 (fewer patches for forks).

Follow-up once this lands: #478 can leave aoc/ out of the IPA with a one-line change in build_ipa.sh; build_ipa.sh gains nothing here.

Checked

  • Tests: dm/ios/tests/test_aoc_startup.py (new; compiles main.m's aoc_locate against a fixture Documents and App folder: found in each place, order, a file named aoc is ignored, preset variable wins, none present; fails without the change), test_romfs_startup.py, test_launcher_storage.py, test_pack_ipa.py, test_profile_pack.py, test_xcode_workflow.py, dm/tools/tests/test_docs.py pass. GAME=010015100B514000 python3 dm/ios/tools/compile_check.py: 178 files, 0 failed. lint_python.py: 0 new.
  • Games run: none, no device (not built, signed or installed).
  • Devices and OS: none; the lookup was run on macOS Foundation.

Docs

  • docs/development.md (Quick reinstalls): one sentence for the DLC copy and lookup. No finding for a reference entry, so no symptom index change.
  • No game files, keys or data extracted from a game in the change

main.m looked for DLC only in <App>/aoc, so aoc/ had to stay in the IPA even when
the game data goes to the device separately (Documents/romfs.img). aoc_locate()
now takes DM_AOC_DIR if set, else Documents/aoc, else <App>/aoc, like the RomFS
lookup, and logs 'boot: DLC from <path>'. push_romfs.sh copies aoc/ too; Documents/aoc
is kept out of backups.
subyoung pushed a commit to subyoung/NX2Apple that referenced this pull request Oct 29, 2026
…s it

Symptom: with the slim IPA, selected DLC was in neither the IPA nor games/<id>/,
so saves that need it could not load (LNPANDY#202).

Cause: the launcher copied <work>/aoc to games/<id>/aoc only in the success
callback of the folder-packing process. The stamp reuse, image reuse and image
copy branches returned before it. And main.m set DM_AOC_DIR only from
<App>/aoc, which a slim IPA does not have.

Fix: one placeAddOnContent step, called from all four ways the archive step
ends. main.m (patch 0003) points DM_AOC_DIR at Documents/games/<id>/aoc when the
per-game folder is in use and has one, before <App>/aoc and never over an
explicit value. The layout is the one hle_fs.c aoc_dir reads (<index>.img).
Compatible with seedds/nxnative#486 (Documents/aoc).

Checks: swift build and swift test (361 tests), compile_check.py for
010015100B514000, patches.py check, scripts/tests, dm/ios/tests. Not tested
on a device.

Fixes LNPANDY#202
seedds added a commit that referenced this pull request Oct 31, 2026
The iOS launcher searched only the app bundle for DLC, even when the base
RomFS was deployed separately. Preserve DM_AOC_DIR overrides, then search
Documents/aoc before the bundle, and exclude external DLC from backups.

Push the complete DLC set from resources.env with replacement semantics.
Directory merges retained removed indices, which the host still counted
and mounted. Send an empty directory for builds without DLC, reject a
missing declared source before transfer, and preserve DLC for image-only
pushes that carry no DLC metadata.

Add synthetic transfer regression tests and retain the author's Foundation
startup tests. Document the mechanism and regenerate the symptom index.
Validation: 59 tests passed, one disk-image test skipped; 185 iOS sources
compiled; Python lint has no new findings. Regression risk is low: only
iOS discovery and transfer change, so no game regression run was needed.
Device transfers remain untested.

Co-authored-by: v0lumehi <[email protected]>
@seedds

seedds commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Landed on main as c5fe6b5d. Thanks @v0lumehi — the DLC locator and Foundation startup tests are retained, and you are credited as co-author.

The design fits the project: explicit DM_AOC_DIR wins, then Documents/aoc, then the app bundle, with no game-specific behavior. I fixed two review findings while taking it in:

  • resources.env pushes now replace the complete DLC set with --remove-existing-content true. Smaller sets remove stale indices; builds without DLC send an empty directory to clear previous content. A declared but missing DLC source fails before transfer. Direct RomFS-image pushes leave DLC unchanged because they carry no DLC metadata.
  • Added the general mechanism to the packing reference and regenerated the symptom index.

Validation: 59 tests passed and one case-sensitive disk-image test was skipped because disk-image creation was unavailable; the iOS compile check passed all 185 sources; Python lint has zero new findings; shell syntax, documentation and diff checks passed. New synthetic transfer tests reproduced the original stale-content failures before the fix and pass afterward.

Confidence is high in both findings and fixes. These are generalized root-cause fixes, with no workaround. Regression risk is low because the change is limited to iOS discovery and transfer, so no game regression run was needed. Actual device transfers remain untested; transfers are not atomic, so a failed push must be rerun before launching.

Closing as incorporated into main.

@seedds seedds closed this Oct 31, 2026
Marceloalexandregoncalves pushed a commit to Marceloalexandregoncalves/nxnative that referenced this pull request Nov 3, 2026
On a volume without native extended attributes (exFAT, the build folder or
the output on an external drive) each file's attributes live in a "._name"
file beside it, which breaks the pack four ways: the input globs take those
names for modules, shaders and fonts and the fixups check fails on one,
copystat cannot set the flags of a copy (chflags: Operation not permitted),
a recursive copy carries the sidecars into the app, and codesign reads the
one beside the launcher as a code object that is not signed and refuses the
whole bundle: "code object is not signed at all", In subcomponent.

Skip them in the globs, copy without extended attributes (-X, cp rejects
it together with -c) and with shutil.copy instead of copy2 for the host,
and strip what a copy or the compiler leaves from the staged bundle before
codesign reads it, retrying with the attributes cleared if it refuses one.
Strip again afterwards: codesign sets an attribute on what it signs.

Upstream-Status: forwarded seedds#991
Reason: a build folder or an app on exFAT keeps every file's attributes in a ._name file beside it: the inputs, the copies and codesign all break on them (issue seedds#486)
Issue: LNPANDY/NX2Apple#486
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
The iOS launcher searched only the app bundle for DLC, even when the base
RomFS was deployed separately. Preserve DM_AOC_DIR overrides, then search
Documents/aoc before the bundle, and exclude external DLC from backups.

Push the complete DLC set from resources.env with replacement semantics.
Directory merges retained removed indices, which the host still counted
and mounted. Send an empty directory for builds without DLC, reject a
missing declared source before transfer, and preserve DLC for image-only
pushes that carry no DLC metadata.

Add synthetic transfer regression tests and retain the author's Foundation
startup tests. Document the mechanism and regenerate the symptom index.
Validation: 59 tests passed, one disk-image test skipped; 185 iOS sources
compiled; Python lint has no new findings. Regression risk is low: only
iOS discovery and transfer change, so no game regression run was needed.
Device transfers remain untested.

Co-authored-by: v0lumehi <[email protected]>
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.

2 participants