diff --git a/docs/mods.md b/docs/mods.md index ab2d804f..5a5a9aee 100644 --- a/docs/mods.md +++ b/docs/mods.md @@ -113,7 +113,7 @@ keeps its textures at a quarter of the size. | This folder has no romfs, exefs or cheats files. | The archive was unpacked one level too deep (`mods\Mod\Mod\romfs`), or it holds no game files. | Move the folders up so `romfs` sits directly in the mod's folder. | | ... files carry another game version in their names. | The files are named for another update (`.Product..`) and the game's own files have no such name. They are still served under those names, as on a console, because the game sometimes asks for one; another update's resource size table is the exception and only lends its entries. | Nothing if the mod works. If it does nothing, download its release for your game update. | | Its code patches (exefs) are made for another game version. | The patch files name another update's build id. | Same: get the release for your update. | -| This mod brings its own game code (a subsdk plugin or a replaced main). | Mods such as UltraCam ship compiled Switch code. The port cannot load it. | No workaround; the whole mod stays off. | +| This mod brings its own game code (a subsdk plugin or a replaced main). | Mods such as UltraCam ship compiled Switch code. The port cannot load it. | The whole mod stays off. **Use mods without their code** on the Mods tab (`mods_without_code = 1` under `[mods]`) uses the rest of it, which may expect the missing code. | | This mod patches the game code (exefs) in a way the port cannot apply. | The patch writes the game's data, not its code, or changes code in a form the port cannot build. | No workaround; the reason follows on the row. | | The folder name contains \|. | The mod list uses `\|` between names. | Rename the folder. | diff --git a/runtime/cfg.c b/runtime/cfg.c index 2c297cc4..4b0b8496 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -53,7 +53,7 @@ static const char *const known[] = { "GYRO_BIAS_PAD", "GYRO_BIAS_X", "GYRO_BIAS_Y", "GYRO_BIAS_Z", "GYRO_CALIBRATION", "HDR", "HDR_GAME_NITS", "HDR_HUE", "HDR_PEAK_NITS", "HDR_UI_NITS", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "KSPIN_US", "LANG", "LIB_PREBUILD", "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LOD_STEADY", "LSTICK_DEADZONE", "MAP_CLICK", "MEMORY", "MEMX", "MENU_LANG", "MENU_TEST", "MENU_FONT_FONTCONFIG", - "MEM_RESERVE_MIB", "MENU_CURSOR", "MENU_CURSOR_LOG", "MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MODS_REBUILD", "MOTION", "MOUSE_AIM_SCALE", "MOUSE_MODE", "MOUSE_DIRECT_PATCH", "MOUSE_SENS", "MOVIE_ASPECT", "MOVIE_HOST", "MOVIE_PACE", + "MEM_RESERVE_MIB", "MENU_CURSOR", "MENU_CURSOR_LOG", "MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MODS_REBUILD", "MODS_WITHOUT_CODE", "MOTION", "MOUSE_AIM_SCALE", "MOUSE_MODE", "MOUSE_DIRECT_PATCH", "MOUSE_SENS", "MOVIE_ASPECT", "MOVIE_HOST", "MOVIE_PACE", "MVOBJ_ALL", "MVOBJ_BANKS", "MVOBJ_EQUAL", "MVOBJ_EXACT", "MVOBJ_EXEC", "MVOBJ_NOC4", "MVOBJ_ONLY", "MVOBJ_TIMES", "MVPREV_CHECK", "MVPREV_GROW", "MVPREV_SKIP", "MVPREV_TRUST", "MV_CHECK", "MV_SURVEY", "ONE_PER_CORE", "OPERATION_MODE", "OPTREF_GUARD", "OUTPUT_RES", "PAD_LAYOUT", "PASS_CRUMBS", "PATCH_OUTPUT", "PATCH_SCENE", "PCORE", "PCSS", "PCSS_K", "PERF_OVERLAY", "PERF_SLOW_MS", "PIPELINE_CACHE", "PIPE_MEMO", "PIPE_PREBUILD", "PIPE_SKIP", "PIPE_SYNC", "PIPE_WAIT", "POINTER_IMAGE", @@ -88,7 +88,7 @@ static const struct { const char *key, *section; } sections[] = { {"DISCORD_RPC", "discord"}, {"DISCORD_APP_ID", "discord"}, {"DISCORD_IMAGE", "discord"}, {"SHADOW_SCALE", "display"}, {"SHADOW_RANGE", "display"}, {"GRASS_RANGE", "display"}, {"CONTACT_SHADOWS", "display"}, {"PCSS", "display"}, - {"MODS_DIR", "mods"}, {"MODS_ORDER", "mods"}, {"MODS_DISABLED", "mods"}, {"MODS_REBUILD", "mods"}, + {"MODS_DIR", "mods"}, {"MODS_ORDER", "mods"}, {"MODS_DISABLED", "mods"}, {"MODS_REBUILD", "mods"}, {"MODS_WITHOUT_CODE", "mods"}, {"TEX_HEAP_EXTRA_MB", "mods"}, {"MENU_LANG", "language"}, {"MENU_FONT_FONTCONFIG", "language"}, {"LANG", "language"}, {"OPERATION_MODE", "language"}, {"VOLUME", "audio"}, {"VOLUME_MUSIC", "audio"}, {"VOLUME_SFX", "audio"}, {"VOLUME_VOICE", "audio"}, {"AUDIO_CHANNELS", "audio"}, @@ -160,6 +160,7 @@ static const CfgMeta metas[] = { {"FPS_LIMIT", "60", "30|40|45|60|90|120|144|display", LIVE}, {"FPS60", "1", "0|1", LIVE}, {"FRAME_QUEUE", "0", "0|1", LIVE}, {"REALTIME", "1", "0|1", RESTART}, {"CLOTH_REALTIME", "1", "0|1", RESTART}, {"MODS_REBUILD", "auto", "auto|off", RESTART}, + {"MODS_WITHOUT_CODE", "0", "0|1", RESTART}, // 1: a mod is used without the code module it cannot run (mods.c) {"HIGHFPS_FIX", "1", "0|1", RESTART}, {"CLIMB_FIX", "1", "0|1", RESTART}, {"LANG", "", "ja|en-US|fr|de|it|es|zh-CN|ko|nl|pt|ru|zh-TW|en-GB|fr-CA|es-419|zh-Hans|zh-Hant|pt-BR", RESTART}, {"OPERATION_MODE", "docked", "docked|handheld", RESTART}, diff --git a/runtime/mods.c b/runtime/mods.c index ba763632..9a63860c 100644 --- a/runtime/mods.c +++ b/runtime/mods.c @@ -18,6 +18,10 @@ // rebuild at start (cheats.c), and its mod stays off until then. A file's writes into main's data (.rodata, .data, // .bss) are lines of build-cache/exefs.data, stored into the loaded main before the game runs (mods_exefs_data), as // emulators apply a patch file to the module before its dynamic linker runs. +// +// Code modules: an exefs/subsdk* file is a plugin that patches main from its own start-up on the Switch, and a replaced +// exefs/main is another game code; the port cannot load either (ModInfo.code names them): their mod stays off unless +// mods_without_code = 1. #include #include #include @@ -72,14 +76,24 @@ static int ends_with_ci(const char *s, const char *tail) { return n >= t && !strcasecmp(s + n - t, tail); } +// A code module of m the port cannot run, named in m->code. +static void code_unrun(ModInfo *m, const char *name) { + size_t k = strlen(m->code); + snprintf(m->code + k, sizeof m->code - k, "%s%s", k ? ", " : "", name); +} + // What the ExeFS folder holds: MOD_EXEFS for patches (.ips, .pchtxt), MOD_SUBSDK for code modules (subsdk* plugins, a // replaced main). main.npdm alone is the process's metadata, not code: it counts as neither. static int exefs_cb(const char *name, int kind, uint64_t size, void *ctx) { (void)size; - int *k = ctx; + ModInfo *m = ctx; if (kind != PLAT_FS_FILE) return 1; - if (ends_with_ci(name, ".ips") || ends_with_ci(name, ".pchtxt")) *k |= MOD_EXEFS; - else if (!strncasecmp(name, "subsdk", 6) || !strcasecmp(name, "main")) *k |= MOD_SUBSDK; + if (ends_with_ci(name, ".ips") || ends_with_ci(name, ".pchtxt")) { + m->kind |= MOD_EXEFS; + } else if (!strncasecmp(name, "subsdk", 6) || !strcasecmp(name, "main")) { + m->kind |= MOD_SUBSDK; + code_unrun(m, name); + } return 1; } @@ -127,7 +141,9 @@ static int by_order(const void *a, const void *b) { static const char *problem_name(ModProblem p) { switch (p) { case MOD_EMPTY: return "empty"; - case MOD_PLUGIN: return "has a code module (subsdk or main), not supported; the whole mod stays off"; + case MOD_PLUGIN: + return "has a code module (subsdk or main), not supported; the whole mod stays off (mods_without_code = 1 uses " + "the rest of it)"; case MOD_EXEFS_LATER: return "ExeFS patches wait for a rebuild of the game code; the whole mod stays off"; case MOD_EXEFS_UNSUPPORTED: return "an ExeFS patch file cannot be applied; the whole mod stays off"; case MOD_EXEFS_OTHER: return "its ExeFS patches are for another game version"; @@ -334,12 +350,15 @@ static int scan_cb(const char *name, int kind, uint64_t size, void *ctx) { find_root(path, "exefs", m->exefs, sizeof m->exefs); find_root(path, "cheats", m->cheats, sizeof m->cheats); if (m->romfs[0] && has_file(m->romfs)) m->kind |= MOD_ROMFS; - if (m->exefs[0]) plat_fs_list(m->exefs, exefs_cb, &m->kind); + if (m->exefs[0]) plat_fs_list(m->exefs, exefs_cb, m); if (m->cheats[0]) plat_fs_list(m->cheats, cheats_cb, &m->kind); int unsupported = exefs_check(m, path); - // a mod whose code part the port cannot use is off as a whole: its RomFS files may expect that code + // A mod whose code part the port cannot use is off as a whole: its RomFS files may expect that code. A code + // module (m->code) never loads; with mods_without_code = 1 the rest of the mod is used, when it has a rest. + int rest = m->kind & (MOD_ROMFS | MOD_EXEFS | MOD_CHEATS); + int code_off = m->code[0] && (!cfg_bool("TOTK_MODS_WITHOUT_CODE") || !rest); m->problem = strchr(m->name, '|') ? MOD_BAD_NAME - : m->kind & MOD_SUBSDK ? MOD_PLUGIN + : code_off ? MOD_PLUGIN : unsupported ? MOD_EXEFS_UNSUPPORTED : m->pending ? MOD_EXEFS_LATER : m->nsets || m->ndata || m->kind & (MOD_ROMFS | MOD_CHEATS) ? MOD_OK @@ -412,6 +431,9 @@ void mods_scan(void) { m->kind & MOD_EXEFS ? " exefs" : "", m->kind & MOD_SUBSDK ? " subsdk" : "", m->kind & MOD_CHEATS ? " cheats" : "", m->kind ? "" : " no files", problem_name(m->problem), m->note[0] ? ": " : "", m->note); + if (m->code[0] && m->problem != MOD_PLUGIN) + rt_log("mods: %s: its code module (%s) does not load (mods_without_code = 1); the rest of the mod is used", + m->name, m->code); } rt_log("mods: %d folders in %s", nmods, dir); } diff --git a/runtime/mods.h b/runtime/mods.h index 8992c080..033dc89c 100644 --- a/runtime/mods.h +++ b/runtime/mods.h @@ -14,7 +14,8 @@ typedef enum { MOD_OK, MOD_EMPTY, // no RomFS file, no ExeFS patch, no cheat file MOD_PLUGIN, // has code modules (exefs/subsdk*, a replaced exefs/main): the port has no module loader, so the - // whole mod stays off (its RomFS files may expect that code) + // whole mod stays off (its RomFS files may expect that code); with TOTK_MODS_WITHOUT_CODE=1 the + // rest of such a mod is used, without those code modules (ModInfo.code names them) MOD_EXEFS_LATER, // has ExeFS patches for this game's main that the game was built without: the rebuild at the // next start builds them in; the whole mod stays off until then MOD_EXEFS_UNSUPPORTED, // an ExeFS patch file the port cannot apply (note says why): the whole mod stays off @@ -27,7 +28,8 @@ typedef struct { char romfs[2048]; // UTF-8 path of its RomFS root; "" none char exefs[2048]; // UTF-8 path of its ExeFS folder; "" none char cheats[2048]; // UTF-8 path of its cheats folder; "" none - int kind, enabled; + int kind, enabled; // kind: MOD_SUBSDK for any code module + char code[64]; // its code modules in exefs ("subsdk9", "main, subsdk9"): never loaded ModProblem problem; uint32_t replaced, added, overridden; // romfs.c: files served (replacing / added), files a higher mod serves uint32_t other_version; // files named for another game version: RomFS *.Product..* the RomFS diff --git a/runtime/mods_probe.c b/runtime/mods_probe.c index a348fc69..6e27cc30 100644 --- a/runtime/mods_probe.c +++ b/runtime/mods_probe.c @@ -126,6 +126,37 @@ static void probe_data(const char *root) { remove_tree(root); } +// A scan of mods with a code module the port cannot run, under mods_without_code. +static void probe_without_code(const char *root) { + remove_tree(root); + plat_file_mkdir_p(root); + static const char *const files[] = {"E/exefs/subsdk9", "H/romfs/h.bin", "H/exefs/subsdk9", "I/romfs/i.bin", + "I/exefs/main"}; + for (size_t i = 0; i < sizeof files / sizeof *files; i++) put(root, files[i]); + mods_probe_cache("", ""); + cfg_set("TOTK_MODS_DIR", root); + cfg_set("TOTK_MODS_ORDER", ""); + cfg_set("TOTK_MODS_DISABLED", ""); + cfg_set("TOTK_MODS_WITHOUT_CODE", "1"); + mods_rescan(); + mods_scan(); + ModInfo *e = by_name("E"), *h = by_name("H"), *im = by_name("I"); + CHECK(e && h && im, "without-code scan: three mods"); + if (e && h && im) { + CHECK(e->problem == MOD_PLUGIN, "mods_without_code: a mod with only a code module stays off"); + CHECK(h->problem == MOD_OK && EQ(h->code, "subsdk9"), "mods_without_code: RomFS + subsdk9 is used without it"); + CHECK(im->problem == MOD_OK && EQ(im->code, "main"), "mods_without_code: RomFS + replaced main is used"); + } + cfg_set("TOTK_MODS_WITHOUT_CODE", "0"); + mods_rescan(); + mods_scan(); + h = by_name("H"); + CHECK(h && h->problem == MOD_PLUGIN, "without mods_without_code a mod with a code module stays off"); + cfg_set("TOTK_MODS_WITHOUT_CODE", ""); + mods_probe_cache(NULL, NULL); + remove_tree(root); +} + // s ends in tail, either path separator matching either. static int ends_with(const char *s, const char *tail) { size_t n = strlen(s), t = strlen(tail); @@ -214,6 +245,7 @@ int probe_mods(void) { CHECK(mods_changed(), "changes seen"); } probe_data(root); + probe_without_code(root); printf("mods: %s\n", fails ? "FAIL" : "ok"); int table = restbl_probe(); return fails || table ? 1 : 0; diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index b7aee9dd..f9543f06 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -1254,7 +1254,9 @@ static void tab_mods(float scale) { if (count) snprintf(cheat, sizeof cheat, menu_text(UI_MENU_MODS_CHEATS), count); else snprintf(cheat, sizeof cheat, menu_text(UI_MENU_MODS_CHEATS_FILE), cheats_file()); } - char code[512] = "", problem[512] = ""; + char code[512] = "", problem[512] = "", skipped[512] = ""; + if (m->code[0] && m->problem != MOD_PLUGIN) // used without that code (mods_without_code = 1) + snprintf(skipped, sizeof skipped, menu_text(UI_MENU_MODS_CODE_SKIPPED), m->code); if (m->nsets && m->overrides[0]) snprintf(code, sizeof code, menu_text(UI_MENU_MODS_REPLACES_BUILTIN), m->nsets, m->overrides); else if (m->nsets || m->ndata) @@ -1271,7 +1273,7 @@ static void tab_mods(float scale) { default: break; } int k = snprintf(desc, sizeof desc, menu_text(UI_MENU_MODS_ROW_DESC), m->replaced, m->added); - const char *parts[] = {over, other, cheat, code, problem, menu_text(UI_MENU_MODS_MOVE_HINT)}; + const char *parts[] = {over, other, cheat, code, skipped, problem, menu_text(UI_MENU_MODS_MOVE_HINT)}; for (const char *part : parts) if (*part && k >= 0 && k < (int)sizeof desc) k += snprintf(desc + k, sizeof desc - k, "\n\n%s", part); const char *note = m->enabled && m->problem != MOD_OK ? menu_text(UI_MENU_MODS_UNUSED) : after; @@ -1287,6 +1289,10 @@ static void tab_mods(float scale) { opt_save_soon(); } } + // The switch for mods with their own code shows once a mod with a code module is there (or the switch is on) + bool code_mods = cfg_bool("TOTK_MODS_WITHOUT_CODE"); + for (int i = 0; i < n && !code_mods; i++) code_mods = mods_at(i)->code[0] != 0; + if (code_mods) opt_toggle("TOTK_MODS_WITHOUT_CODE", UI_MENU_MODS_WITHOUT_CODE, UI_MENU_MODS_WITHOUT_CODE_DESC); bool rebuild = cheats_rebuild_pending() && opt_button("##restart", UI_MENU_CHEATS_REBUILD, UI_MENU_CHEATS_REBUILD_DESC); static uint64_t open_failed; // plat_now_ns until which the button says it failed diff --git a/runtime/ui_text.c b/runtime/ui_text.c index bd2de95f..2d6b1edc 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -223,7 +223,8 @@ static const char *const text_en[UI_TEXT_COUNT] = { "restart.", [UI_MENU_MODS_EMPTY] = "This folder has no romfs, exefs or cheats files.", [UI_MENU_MODS_SUBSDK] = "This mod brings its own game code (a subsdk plugin or a replaced main). The port cannot " - "load code modules, so the whole mod stays off.", + "load code modules, so the whole mod stays off. \"Use mods without their code\" below uses " + "the rest of it.", [UI_MENU_MODS_EXEFS_LATER] = "This mod patches the game code (exefs). The game builds the patches in when it " "starts next (a rebuild of a few minutes); until then the whole mod stays off.", [UI_MENU_MODS_CHEATS] = "Cheats: %d. Switch them on the Cheats tab.", @@ -582,6 +583,14 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_MODS_EXEFS_ON] = "Code patches in use: %d files.", [UI_MENU_MODS_REPLACES_BUILTIN] = "Code patches in use: %d files. They replace the port's own patch %s, which " "stays off while this mod is on.", + [UI_MENU_MODS_CODE_SKIPPED] = "Its own game code (%s) does not load: the rest of the mod is used. Switch the mod " + "off if the game misbehaves with it.", + [UI_MENU_MODS_WITHOUT_CODE] = "Use mods without their code", + [UI_MENU_MODS_WITHOUT_CODE_DESC] = "A mod that brings its own game code (a subsdk plugin or a replaced main) " + "stays off as a whole, because the port cannot run that code. On: such a mod is " + "used without that code: its RomFS files, cheats and ExeFS patches load. Its " + "files may expect the missing code; switch the mod off if the game misbehaves. " + "Applies at the next start.", }; static const char *const text_ru[UI_TEXT_COUNT] = { @@ -773,7 +782,8 @@ static const char *const text_ru[UI_TEXT_COUNT] = { "два мода меняют один файл, побеждает верхний. Изменения действуют после перезапуска.", [UI_MENU_MODS_EMPTY] = "В этой папке нет файлов romfs, exefs или cheats.", [UI_MENU_MODS_SUBSDK] = "Этот мод приносит свой код игры (плагин subsdk или заменённый main). Порт не загружает " - "модули кода, поэтому мод выключен целиком.", + "модули кода, поэтому мод выключен целиком. «Моды без их кода» ниже включает остальную " + "часть мода.", [UI_MENU_MODS_EXEFS_LATER] = "Этот мод меняет код игры (exefs). Игра соберёт эти патчи при следующем запуске " "(пересборка на несколько минут); до тех пор мод выключен целиком.", [UI_MENU_MODS_CHEATS] = "Читов: %d. Они включаются на вкладке «Читы».", @@ -1136,6 +1146,14 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_MODS_EXEFS_ON] = "Патчи кода в работе: файлов: %d.", [UI_MENU_MODS_REPLACES_BUILTIN] = "Патчи кода в работе: файлов: %d. Они заменяют собственный патч порта %s, " "который выключен, пока этот мод включён.", + [UI_MENU_MODS_CODE_SKIPPED] = "Его собственный код игры (%s) не загружается: используется остальная часть мода. " + "Выключите мод, если игра с ним ведёт себя странно.", + [UI_MENU_MODS_WITHOUT_CODE] = "Моды без их кода", + [UI_MENU_MODS_WITHOUT_CODE_DESC] = "Мод со своим кодом игры (плагин subsdk или заменённый main) выключается " + "целиком, потому что порт не может запустить этот код. Вкл.: такой мод " + "используется без этого кода — загружаются его файлы RomFS, читы и патчи ExeFS. " + "Его файлы могут рассчитывать на отсутствующий код; выключите мод, если игра " + "ведёт себя странно. Применяется при следующем запуске.", }; static const char *const text_pt_br[UI_TEXT_COUNT] = { @@ -1160,7 +1178,8 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { "Quando dois mods mudam o mesmo arquivo, vale o de cima. As mudanças valem após reiniciar.", [UI_MENU_MODS_EMPTY] = "Esta pasta não tem arquivos romfs, exefs ou cheats.", [UI_MENU_MODS_SUBSDK] = "Este mod traz código próprio do jogo (um plugin subsdk ou um main substituído). O port não " - "carrega módulos de código, então o mod inteiro fica desligado.", + "carrega módulos de código, então o mod inteiro fica desligado. \"Usar mods sem o código " + "deles\", abaixo, usa o resto dele.", [UI_MENU_MODS_EXEFS_LATER] = "Este mod altera o código do jogo (exefs). O jogo compila esses patches na próxima " "vez que iniciar (uma recompilação de alguns minutos); até lá o mod inteiro fica " "desligado.", @@ -1725,6 +1744,15 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_MODS_EXEFS_ON] = "Patches de código em uso: %d arquivos.", [UI_MENU_MODS_REPLACES_BUILTIN] = "Patches de código em uso: %d arquivos. Eles substituem o patch do próprio port " "%s, que fica desligado enquanto este mod está ligado.", + [UI_MENU_MODS_CODE_SKIPPED] = "O código próprio do jogo dele (%s) não é carregado: o resto do mod é usado. " + "Desligue o mod se o jogo se comportar mal com ele.", + [UI_MENU_MODS_WITHOUT_CODE] = "Usar mods sem o código deles", + [UI_MENU_MODS_WITHOUT_CODE_DESC] = "Um mod que traz código próprio do jogo (um plugin subsdk ou um main " + "substituído) fica desligado por inteiro, porque o port não consegue rodar esse " + "código. Ligado: esse mod é usado sem esse código; os arquivos RomFS, cheats e " + "patches de ExeFS dele carregam. Os arquivos dele podem depender do código que " + "falta; desligue o mod se o jogo se comportar mal. Vale na próxima " + "inicialização.", }; // Simplified Chinese: this row covers the software keyboard and the whole menu, so the menu and the overlay read Chinese @@ -1756,7 +1784,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_MODS_MOVE_HINT] = "上方按钮或 Ctrl+上 上移,左侧按钮或 Ctrl+下 下移。两个模组修改同一个文件时,以靠上的为准。" "更改在重启后生效。", [UI_MENU_MODS_EMPTY] = "此文件夹中没有 romfs、exefs 或 cheats 文件。", - [UI_MENU_MODS_SUBSDK] = "此模组带有自己的游戏代码(subsdk 插件或替换的 main)。移植版无法加载代码模块,因此整个模组保持关闭。", + [UI_MENU_MODS_SUBSDK] = "此模组带有自己的游戏代码(subsdk 插件或替换的 main)。移植版无法加载代码模块,因此整个模组保持关闭。" + "打开下方的“不带代码使用模组”即可使用其余部分。", [UI_MENU_MODS_EXEFS_LATER] = "此模组修改游戏代码(exefs)。游戏会在下次启动时把这些补丁构建进去(重新构建需要几分钟);在此之前整个模组保持关闭。", [UI_MENU_MODS_CHEATS] = "金手指:%d 个。在“金手指”标签页中开关。", [UI_MENU_MODS_CHEATS_FILE] = "此游戏版本的金手指在启动时从此模组的 cheats\\%s 读取。", @@ -2395,6 +2424,11 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_MODS_EXEFS_OTHER] = "它的代码补丁(exefs)是为其他游戏版本制作的。", [UI_MENU_MODS_EXEFS_ON] = "正在使用的代码补丁:%d 个文件。", [UI_MENU_MODS_REPLACES_BUILTIN] = "正在使用的代码补丁:%d 个文件。它们取代本移植自带的补丁 %s,此模组开启时该补丁保持关闭。", + [UI_MENU_MODS_CODE_SKIPPED] = "它自带的游戏代码(%s)不会加载:模组的其余部分照常使用。如果游戏因此表现异常,请关闭此模组。", + [UI_MENU_MODS_WITHOUT_CODE] = "不带代码使用模组", + [UI_MENU_MODS_WITHOUT_CODE_DESC] = "带有自己游戏代码(subsdk 插件或替换的 main)的模组会整体关闭,因为移植版无法运行这些代码。" + "开启后:此类模组在没有这些代码的情况下使用,其 RomFS 文件、金手指和 ExeFS 补丁照常加载。" + "它的文件可能依赖缺失的代码;如果游戏表现异常,请关闭该模组。下次启动时生效。", }; #define SWKBD_ONLY(name, ...) static const char *const name[UI_TEXT_COUNT] = {SWKBD(__VA_ARGS__)} diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 9bf7ab40..142a92c0 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -91,6 +91,8 @@ 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_CODE_SKIPPED, // printf: its code modules in exefs, which do not load (mods_without_code = 1) + UI_MENU_MODS_WITHOUT_CODE, UI_MENU_MODS_WITHOUT_CODE_DESC, // the TOTK_MODS_WITHOUT_CODE switch 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 diff --git a/totk.ini.example b/totk.ini.example index b4b822a7..d616f567 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -473,6 +473,10 @@ # the setup's rebuild at start (a few minutes) and starts again after it. off: the game starts with the code it has. # A rebuild that failed or was cancelled is not started again for the same cheats. Default: auto. # mods_rebuild = auto +# 1: a mod that brings its own game code (exefs/subsdk*, a replaced exefs/main), which the port cannot run, is used +# without that code: its RomFS files, cheats and ExeFS patch files load. Its files may expect the missing code. 0: such +# a mod stays off as a whole. Read at start. Default: 0. +# mods_without_code = 0 # Extra room in MiB (0 to 4096) for the heap the world's textures stream into, for HD texture packs. Packs made for # emulators with 8 GB of DRAM grow it in their own HeapDef table (System/HeapSize/Product.Nin_NX_NVN.HeapDef.byml.zs): # the port reads that growth at start and applies it itself (about 3339 MiB for the HDPacks 4K pack), so such a pack