Serve a mod's file named for another game version under its own name instead of leaving it out

A mod file whose name carries Product.<n> and which the RomFS lacks was counted as made for another game version and
never served. The game does ask for such names: on 1.4.3 with mods on, the file trace (trace = fs) shows it opening
Sound/Resource/Pack_MasterSword.Product.110.bars.zs, while its RomFS holds only the Product.140 and the unversioned
file. A sound mod that ships its pack under all those names was silent here and works on a console, where LayeredFS
shows the game every file of a mod. Such files are now added overlays like any other new file. Another version's
resource size table is still not served and still lends its entries; the files are still counted, and the Mods tab
and docs/mods.md now say they are read only when asked for by name.

tests/mods_romfs_check.py gets a case for it. Not run here: the test and --probe-fs need a build and the game's files.
runtime/romfs.c compiles with llvm-mingw.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TgQM2zwuVagwScByEJhT8V
This commit is contained in:
Claude committed 2026-11-10 14:32:15 -05:00
1 parent 7a37fc3c34
commit 2cc0a4eaa6
6 files changed
+32 -15

No files matched your search

+3 -2
View File
@@ -30,8 +30,9 @@ typedef struct {
int kind, enabled;
ModProblem problem;
uint32_t replaced, added, overridden; // romfs.c: files served (replacing / added), files a higher mod serves
uint32_t other_version; // files for another game version (RomFS *.Product.<n>.*, ExeFS patches
// for another build), not used
uint32_t other_version; // files named for another game version: RomFS *.Product.<n>.* the RomFS
// lacks (served under their own names; another version's size table is
// not) and ExeFS patches for another build (not used)
char overridden_by[256]; // the first higher mod that took one of its files
char note[256]; // MOD_EXEFS_UNSUPPORTED: why
uint32_t pending, pending_key; // ExeFS patch files the build lacks; FNV-1a of their names and contents
+13 -3
View File
@@ -340,7 +340,8 @@ static void overlay_push(Overlay o) {
}
// 1 when path names a file of one game version only (Product.<n> in a name: the resource size table, the actor
// database and other version-bound files); the RomFS lacking it means it is another version's.
// database and other version-bound files); the RomFS lacking it means it is another version's, or a name this version
// still asks for (mod_walk_cb).
static int other_version(const char *path) {
for (const char *p = strstr(path, ".Product."); p; p = strstr(p + 1, ".Product.")) {
const char *d = p + strlen(".Product.");
@@ -420,9 +421,18 @@ static int mod_walk_cb(const char *leaf, int kind, uint64_t size, void *ctx) {
}
uint64_t i = index_any_case(path);
if (i == UINT64_MAX && other_version(path)) {
if (is_restbl(path)) shipped_add(file, w->k + 1, 1); // its entries for this mod's files still apply
m->other_version++;
return 1;
// Another version's resource size table is no file this game opens; its entries for this mod's files still
// apply.
if (is_restbl(path)) {
shipped_add(file, w->k + 1, 1);
return 1;
}
// Any other file is served under its own name below, as an added file, the way LayeredFS shows a console every
// file of a mod: the game does ask for names its RomFS lacks. Measured on 1.4.3 with mods on (trace = fs): it
// opened Sound/Resource/Pack_MasterSword.Product.110.bars.zs, where its RomFS holds Product.140 and the
// unversioned file only. A sound mod that ships its pack under all those names stayed silent while this file
// was left out.
}
PlatFile *f = open_read(file);
if (!f) {
+11 -7
View File
@@ -218,8 +218,9 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_MODS_CHEATS] = "Cheats: %d. Switch them on the Cheats tab.",
[UI_MENU_MODS_CHEATS_FILE] = "Cheats for this game version are read at start from cheats\\%s in this mod.",
[UI_MENU_MODS_BAD_NAME] = "The folder name contains |, which the mod list uses between names. Rename the folder.",
[UI_MENU_MODS_OTHER_VERSION] = "%u of its files are made for another game version and are left out. Look for a "
"version of this mod made for your game version.",
[UI_MENU_MODS_OTHER_VERSION] = "%u of its files carry another game version in their names. The game reads them only "
"where something asks for those names. If the mod does nothing, look for a version "
"of it made for your game version.",
[UI_MENU_MODS_UNUSED] = "not used",
[UI_MENU_MODS_FPS60] = "60 FPS patch",
[UI_MENU_MODS_FPS60_DESC] = "The port's own patch for 60 frames per second. Set it with Frame rate limit on the "
@@ -699,8 +700,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_MODS_CHEATS] = "Читов: %d. Они включаются на вкладке «Читы».",
[UI_MENU_MODS_CHEATS_FILE] = "Читы для этой версии игры читаются при запуске из cheats\\%s в этом моде.",
[UI_MENU_MODS_BAD_NAME] = "В имени папки есть символ |, которым список модов разделяет имена. Переименуйте папку.",
[UI_MENU_MODS_OTHER_VERSION] = "Файлов для другой версии игры: %u, они пропущены. Поищите версию этого мода для "
"вашей версии игры.",
[UI_MENU_MODS_OTHER_VERSION] = "Файлов с другой версией игры в имени: %u. Игра читает их, только когда что-то "
"запрашивает эти имена. Если мод не работает, поищите его версию для вашей версии "
"игры.",
[UI_MENU_MODS_UNUSED] = "не используется",
[UI_MENU_MODS_FPS60] = "Патч 60 FPS",
[UI_MENU_MODS_FPS60_DESC] = "Собственный патч порта для 60 кадров в секунду. Настраивается «Ограничением частоты "
@@ -1029,8 +1031,9 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_MENU_MODS_CHEATS] = "Cheats: %d. Ligue-os na aba Cheats.",
[UI_MENU_MODS_CHEATS_FILE] = "Os cheats desta versão do jogo são lidos ao iniciar de cheats\\%s neste mod.",
[UI_MENU_MODS_BAD_NAME] = "O nome da pasta contém |, que a lista de mods usa entre os nomes. Renomeie a pasta.",
[UI_MENU_MODS_OTHER_VERSION] = "%u dos seus arquivos são de outra versão do jogo e ficam de fora. Procure uma versão "
"deste mod feita para a sua versão do jogo.",
[UI_MENU_MODS_OTHER_VERSION] = "%u dos seus arquivos trazem outra versão do jogo no nome. O jogo só os lê quando algo "
"pede esses nomes. Se o mod não fizer nada, procure uma versão dele feita para a sua "
"versão do jogo.",
[UI_MENU_MODS_UNUSED] = "não usado",
[UI_MENU_MODS_FPS60] = "Patch de 60 FPS",
[UI_MENU_MODS_FPS60_DESC] = "O patch do próprio port para 60 quadros por segundo. Ajuste em Limite de quadros na aba "
@@ -1552,7 +1555,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_MODS_CHEATS] = "金手指:%d 个。在“金手指”标签页中开关。",
[UI_MENU_MODS_CHEATS_FILE] = "此游戏版本的金手指在启动时从此模组的 cheats\\%s 读取。",
[UI_MENU_MODS_BAD_NAME] = "文件夹名称含有 |,模组列表用它分隔名称。请重命名该文件夹。",
[UI_MENU_MODS_OTHER_VERSION] = "它有 %u 个文件是为其他游戏版本制作的,已被跳过。请寻找适用于你的游戏版本的此模组。",
[UI_MENU_MODS_OTHER_VERSION] = "它有 %u 个文件的文件名带有其他游戏版本号。只有在有内容请求这些文件名时,游戏才会读取它们。"
"如果模组不起作用,请寻找适用于你的游戏版本的此模组。",
[UI_MENU_MODS_UNUSED] = "未使用",
[UI_MENU_MODS_FPS60] = "60 FPS 补丁",
[UI_MENU_MODS_FPS60_DESC] = "移植版自带的 60 帧补丁。在“游戏”页的帧率上限中设置。",
+1 -1
View File
@@ -88,7 +88,7 @@ typedef enum {
UI_MENU_MODS_EXEFS_OTHER,
UI_MENU_MODS_EXEFS_ON, // printf: its ExeFS patch files in use
UI_MENU_MODS_REPLACES_BUILTIN, // printf: its ExeFS patch files in use, the port's own patch sets they turn off
UI_MENU_MODS_OTHER_VERSION, // printf: files made for another game version, left out
UI_MENU_MODS_OTHER_VERSION, // printf: files named for another game version, read only when asked for by name
UI_MENU_MODS_UNUSED, // under the switch of a mod the port cannot use
UI_MENU_MODS_CHEATS, // printf: its cheats as read at start
UI_MENU_MODS_CHEATS_FILE, // printf: <build id>.txt, when none were read