Skip to content

launcher: merge a mod's copy of a frame rate variant's file into the variant's - #685

Open
catmona wants to merge 1 commit into
igawa6:mainfrom
catmona:variant-romfs-merge
Open

catmona wants to merge 1 commit into
igawa6:mainfrom
catmona:variant-romfs-merge

Conversation

@catmona

@catmona catmona commented Nov 25, 2026

Copy link
Copy Markdown

What and why

A files mod that ships one of a frame rate variant's game data files does nothing at that frame rate, and the log says nothing. On Animal Crossing: New Horizons at 60 fps, ACNH Combined's River Hopping (hopping a river without a pole) stops at the bank. At Game owned, on the same save and route, it crosses.

Cause.

  • The variant's game data (<pack>/<variant>/romfs) goes first in DM_ROMFS_OVERLAY, ahead of the mods. The first root that has a file wins (rom_overlay_path, hle_fs.c).
  • The 60 fps variant ships Pack/StaticParam.pack. So does River Hopping, whose one change is a float in Param/Actor/PlayerActor.byml (the widest gap the player hops, 35 to 100). The variant's copy hid the mod's whole file.

Change.

  • The pack step keeps the files the variant was made from beside it, in <pack>/<variant>/romfs-orig (romfs_rows.make's orig_out, Pack.variantOriginals). Both "not offered" paths remove it.
  • At a start, dev.peanuts.mods.VariantMerge merges each enabled mod's copy of one of the variant's files into a copy of the variant's file, three ways against that original. A value the mod changed is written unless the variant changed the same value. Then the variant's value stays, since its frame rate needs it.
  • Values are matched by what they are, not by offset. SARC entries are matched by name and BYML (v2 and later) values by their path of keys and indexes, so a mod made from another game version, laid out differently, still merges. ACNH Combined's pack is 6,762,272 bytes and 3.0.3's is 6,800,572. Other data of the same size merges by changed runs of bytes. Nothing is resized or moved, so a value the mod adds is not merged and is counted in the log line.
  • A mod higher in the list wins a value two mods change, as it wins a whole file.
  • The merged files go to <files>/mods_stage/<title ID>/variant-romfs, first in the overlay. Each file a mod shares with the variant gets a line, e.g. [nxlaunch] mods: Pack/StaticParam.pack (the 60 variant's game data): ACNH-Combined: 5 values merged. A pack made before this change merges nothing and says the mod's copy is hidden and to prepare the game again.

Reference entry: docs/reference/packing.md, "A frame rate variant's game data hides a mod's copy of the same file (Android)". Game note: dm/games/01006F8002326000/README.md, 60 fps and Found on this game.

Checked

  • Python tests: python3 -m unittest discover -s dm/tools/tests with DM_GAME=01006F8002326000: 1682 tests, with 38 failures, 133 errors and 149 skipped. Upstream main has the same failures and errors, test for test, on this Windows PC (for example python3 is not on PATH, and os.system pickles as nt.system). The branch runs one test more, VariantMergeJvm. test_pack_android_variants has a new JVM test, VariantMergeJvm (javac -Xlint:all -Werror). It covers made-up SARC and BYML files: a value only the mod changes, one both change, a mod laid out differently (a rounded float, an added key), two mods, strings, same-size data, no originals, a mod file equal to the original, a file that does not parse, and another size. With the clash rule taken out, it fails. Overlays checks the originals are written and removed.
  • Real files on a PC (3.0.3's StaticParam.pack, the variant's made from it by the repo rows, which matches the phone's byte for byte, and ACNH Combined's; none of them in the change): 5 values merged in 66 ms, none kept, none left out. They are the hop gap and 4 PlayerActor floats that the mod's tool rounded (0.243165 to 0.24317). The game gets those at Game owned too.
  • On an AYN Thor, a merged pack of the same values made by hand and put in the pack's 60/romfs hops the river at 60 fps.
  • Not checked: this launcher build on a phone (the start-time merge and its log line), and the Turnip driver. The change has no host or GPU code.

Docs

  • The finding is in its game note or its docs/reference/<subsystem>.md entry, and python3 dm/tools/docs_symptoms.py was run (the symptom index)
  • No game files, keys or data extracted from a game in the change or the attachments
  • Source only: no binaries, nothing under dm/third_party/, no change to dmsh_chain.lock; the branch starts from the current main

…variant's

A files mod that ships one of a variant's game data files does nothing at
that frame rate. On ACNH at 60 fps, ACNH Combined's River Hopping stops at the
bank; at Game owned it crosses.

Cause: the variant's romfs goes first in DM_ROMFS_OVERLAY and the first root
that has a file wins. The 60 fps variant ships Pack/StaticParam.pack, and so
does River Hopping (one float in Param/Actor/PlayerActor.byml, 35 to 100), so
the variant's copy hid the mod's whole file.

Fix: the pack step keeps the originals the variant was made from in
<pack>/<variant>/romfs-orig (romfs_rows.make orig_out, Pack.variantOriginals).
At a start, dev.peanuts.mods.VariantMerge merges each enabled mod's copy into
a copy of the variant's file, three ways against the original: a value the
mod changed is written unless the variant changed it too. SARC entries are
matched by name and BYML values by path, so a mod made from another game
version still merges; other same-size data merges by changed runs. The
merged files go first in the overlay, and each shared file gets a log line.

Checks: test_pack_android_variants (VariantMergeJvm, Overlays), test_docs.
On the real files (3.0.3 StaticParam.pack, the variant's, ACNH Combined's):
5 values merged in 66 ms on a PC JVM, none kept, none left out.
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.

1 participant