Skip to content

host/fs: mod folders for add-on content, and mod files packed into ARH1 archives - #3153

Open
Eriksrevenge1 wants to merge 4 commits into
seedds:mainfrom
Eriksrevenge1:pr/mods-archives
Open

Eriksrevenge1 wants to merge 4 commits into
seedds:mainfrom
Eriksrevenge1:pr/mods-archives

Conversation

@Eriksrevenge1

Copy link
Copy Markdown
Contributor

What and why

Two kinds of file mod did nothing:

  • Mods for add-on content: DM_ROMFS_OVERLAY covers only the game's RomFS. A DLC's mod replaces files of that DLC. DM_AOC_OVERLAY_<index>=<dir>[:<dir>…] now gives add-on content index <n> folders searched before its own files, as DM_ROMFS_OVERLAY is for the game (aoc_overlay at MountAddOnContent). - Mods for Monolith's games: Xenoblade Chronicles 3 and 2 read nearly every file from one archive (bf3.ard / bf2.ard, 9.7 and 15.1 GB) through its ARH1 index, and each add-on keeps its own pair; loose files in an overlay folder are reached only by a path the game opens, and these never are. On a Switch the mods need a skyline plugin (xc3-file-loader) that serves loose files in place of members. hle_fs.c (vf_open, vf_build; the format in arh1.h) builds both files at the first open of an index or its archive on a mount with mod folders: each mod file the index names but the RomFS does not have loose is appended past the archive's end, 16-byte aligned, and its member pointed there, stored as is. The archive is read as segments (the game's bytes in place, then the mod files: no copy of the archive); the index is a copy in memory. The first folder wins, as for loose files; a mount without such files keeps its archive as it was.

Found on Xenoblade Chronicles 3 with four GameBanana mods: 15 members of bf3.arh (30.1 MB) and 8 or 9 of each add-on archive replaced; the game reached its auto-save notice with the Xbox Button Prompts mod's B in the corner.

Checked

  • Tests: t_fs_archive (synthetic ARH1 index and archive with overlay folders: members replaced and added, first folder wins, a mount without mods unchanged), t_fs (199 checks), t_fs_case (58), the host build, test_docs, test_settings.
  • Games run: Xenoblade Chronicles 3 (010074F013262000, 2.2.1 with its four DLC), a Mac app built from this branch, fullscreen on a DELL S2725QC, about 3 minutes from launch with three GameBanana mods as DM_ROMFS_OVERLAY folders (Ultimate XC3 Rebalance, Mio – Queen Outfit, Eunie – Panther Outfit): fs archive rom:/bf3.arh: 12 members replaced by files of the mod folders (29.6 MB, read past the archive's 9.71 GB), and 8 members each in the three add-on archives; no [RED] line, no crash, 60 fps (p50 16.62 ms).
  • Devices and OS: Apple M6 Mac mini, macOS 27.0.1, Xcode 27.2
  • Not run: lint_c (no LLVM release installed here; CI runs it).

Front ends

Front-ends: a front end that installs mods sets DM_AOC_OVERLAY_<index> for a mod's add-on content folders, beside DM_ROMFS_OVERLAY (docs/reference/services.md).

Docs

  • The finding is in its docs/reference/services.md entry, and python3 dm/tools/docs_symptoms.py was run
  • No game files, keys or data extracted from a game in the change or the attachments

@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) docs Documentation game: 010074F013262000 Xenoblade Chronicles 3 labels Nov 21, 2026
@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Fixed the clang-tidy ratchet failures: the archive member table grows through a temporary, and the test checks fopen/open results and cleans up without system().

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Fixed the remaining clang-tidy ratchet findings: the index buffers are zero-allocated, the lowercase path buffer is initialised, and t_fs_archive frees each index it opens and checks each member it reads.

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main; test_docs and test_patches pass (the host builds where the change touches it). The Tool tests failure came from a stale merge base.

@Eriksrevenge1
Eriksrevenge1 force-pushed the pr/mods-archives branch 2 times, most recently from a4c295f to 677f340 Compare November 22, 2026 12:28
@github-actions github-actions Bot added the tools Tools and scripts (dm/tools, scripts) label Nov 22, 2026
@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Fixed the Tool tests failure: the env-switch table dropped the DM_AOC_OVERLAY_<n> row because the code builds the name with a format; env_switches.py now keeps a DM_X_<n> row when the code quotes its prefix. Rebased on current main; test_env_switches and test_docs pass. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main (it was 50+ commits behind); the clang-tidy ratchet failure was only the baseline file out of step with the tree it ran on (0 findings above it, entries below it). The host builds, test_docs and test_env_switches pass, and the host tests pass here. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main: hle_fs.c conflicted with the releasable-mount change (#3217), so the add-on mod folders (aoc_overlay) now sit on mount_releasable and the PR's own mount_aoc/aoc_release are gone. The host builds; t_fs_archive, t_fs_directory, test_docs and test_env_switches pass. t_exl and t_heap_size fail to link (_dm_sdk_ounce) here on main too, so not this change.

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main (39 commits behind); the CI failures came from the old merge base. The host builds; host tests, test_docs, test_env_switches and test_patches pass (test_exefs_patch and test_nso_match too on #3158). Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1
Eriksrevenge1 force-pushed the pr/mods-archives branch 2 times, most recently from bd1d853 to e4bc7ff Compare November 24, 2026 12:28
@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main (23 commits behind); the clang-tidy ratchet failure was main's baseline out of step at that time (clang-analyzer-unix.Errno below its baseline). The host builds; test_docs, test_env_switches and test_patches pass. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main: the clang-tidy ratchet finding was in dm/gfx/tests/t_cpu_tex.m, which this change does not touch (old merge base). The host builds; test_docs and test_env_switches pass. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main (7 commits behind) and shrank the clang-tidy baseline: hle_fs.c no longer has its clang-analyzer-unix.Errno finding, which was the ratchet's failure. clang-tidy cannot run here, so CI is the check; test_docs and test_env_switches pass. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main: docs/agents/symptoms.md and docs/reference/services.md conflicted beside the new RomFS-image-directory entry (both kept; symptom index regenerated). The clang-tidy ratchet finding was in dm/gfx/tests/t_gpu_lost.m, which this change does not touch (old merge base). test_docs passes. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main: the Tool tests failure (test_env_switches listing switches main itself had) came from the old merge base; test_env_switches and test_docs pass on the rebased tree. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main: hle_fs.c (the archive-file handle check beside main's txn_write_enter) and dm/host/tests/Makefile (beside main's t_cheats rules) conflicted; both sides kept. The host builds; t_fs_archive, t_fs_directory, test_docs, test_env_switches and test_patches pass. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Dropped my earlier baseline shrink: the clang-analyzer-unix.Errno finding in hle_fs.c is still there (main's baseline has it too), so the ratchet failed on the entry's removal. The baseline entry is back; test_docs passes. clang-tidy cannot run here, so CI is the check.

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main: hle_fs.c conflicted in the read log (main's fslog_path; kept it, it already gives '?' for an archive handle). The host builds; t_fs_archive, t_fs_directory, test_docs, test_env_switches and test_patches pass. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main: the clang-tidy ratchet failure was t_nfc.c (two findings from #2151), which this change does not touch and main has since fixed (05e7431). The host builds; t_fs_archive, t_fs_directory, test_docs and test_env_switches pass. Not run: GPU and game checks (no Metal 4 here).

@Eriksrevenge1

Copy link
Copy Markdown
Contributor Author

Rebased on current main (8fc54dc): every red check came from main's own breakage (t_sync_wait's missing dm_sdk_modules link, and pyright's str | None findings), which 2727c6f fixed. No conflicts. The host tests build; t_fs_archive, t_fs_directory, t_sync_wait, test_docs and test_env_switches pass. Not run: GPU and game checks (no Metal 4 here).

Eriksrevenge1 and others added 4 commits November 30, 2026 21:09
…H1 archives

Two kinds of file mod did nothing:

- Mods for add-on content: DM_ROMFS_OVERLAY covers only the game's RomFS. A
  DLC's mod replaces files of that DLC. DM_AOC_OVERLAY_<index>=<dir>[:<dir>…]
  now gives add-on content index <n> folders searched before its own files,
  as DM_ROMFS_OVERLAY is for the game (aoc_overlay at MountAddOnContent).
- Mods for Monolith's games: Xenoblade Chronicles 3 and 2 read nearly every
  file from one archive (bf3.ard / bf2.ard, 9.7 and 15.1 GB) through its ARH1
  index, and each add-on keeps its own pair; loose files in an overlay folder
  are reached only by a path the game opens, and these never are. On a Switch
  the mods need a skyline plugin (xc3-file-loader) that serves loose files in
  place of members. hle_fs.c (vf_open, vf_build; the format in arh1.h) builds
  both files at the first open of an index or its archive on a mount with mod
  folders: each mod file the index names but the RomFS does not have loose is
  appended past the archive's end, 16-byte aligned, and its member pointed
  there, stored as is. The archive is read as segments (the game's bytes in
  place, then the mod files: no copy of the archive); the index is a copy in
  memory. The first folder wins, as for loose files; a mount without such
  files keeps its archive as it was.

Found on Xenoblade Chronicles 3 with four GameBanana mods: 15 members of
bf3.arh (30.1 MB) and 8 or 9 of each add-on archive replaced; the game reached
its auto-save notice with the Xbox Button Prompts mod's B in the corner.

Checked: t_fs_archive (synthetic ARH1 index and archive with overlay folders:
members replaced and added, first folder wins, a mount without mods
unchanged), t_fs (199 checks), t_fs_case (58), the host build, test_docs,
test_settings.

Front-ends: a front end that installs mods sets DM_AOC_OVERLAY_<index> for a
mod's add-on content folders, beside DM_ROMFS_OVERLAY (docs/reference/services.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ang-tidy)

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

Copy link
Copy Markdown
Contributor Author

Rebased on current main (729bf94): the two checks still red after the last rebase (Build check and clang-tidy) both failed in dm/gfx/tests/t_shmap_warm.m (g_lib_borrow), which this change does not touch and main has since fixed. No conflicts. t_fs_archive, t_fs_directory, t_sync_wait, test_docs and test_env_switches pass. Not run: GPU and game checks (no Metal 4 here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 010074F013262000 Xenoblade Chronicles 3 host The Horizon host: SVCs, services, threads, memory (dm/host) tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants