diff --git a/docs/installer.md b/docs/installer.md index 102f0c6a..1c681cac 100644 --- a/docs/installer.md +++ b/docs/installer.md @@ -26,6 +26,7 @@ The install folder (`main.c` `portable_paths()` reads this layout; it stays port exefs/, romfs/ extracted from the player's files shared-fonts/ the Switch system fonts, with Chinese, Korean or Traditional Chinese text profile/ saves + mods/ the player's mods, one folder per mod (created by the menu's "Open mods folder") logs/ totk.log of the last run, totk.1.log to totk.4.log of the runs before it shader and pipeline caches prepared by the setup; shader-cache/shader-cache.pack holds the translations totk-install.json what built this folder: release version, input hashes, finished steps diff --git a/docs/tester-guide.md b/docs/tester-guide.md index 08607ae6..acab477d 100644 --- a/docs/tester-guide.md +++ b/docs/tester-guide.md @@ -52,6 +52,26 @@ A laptop with an iGPU and a discrete GPU, or two cards, lists every GPU at the t The line `vk: using gpu N: ` says which one ran. +## Mods + +Mods made for emulators go into `mods/` next to `totk.exe`, one folder per mod, unpacked as they come: +`mods//romfs/...` (the Atmosphere layout `mods//atmosphere/contents/0100F2C0115B6000/romfs` works +too). The game loads them at the next start. The Mods tab of the in-game menu (F1) lists them: switch a mod off, or move +it up or down. When two mods change the same file, the higher one wins. + +- RomFS mods (textures, models, text, gameplay files) work. +- Mods packaged for TKMM (`.tkcl`, "TKMM only") and mods that change the same files: merge them in TKMM and set an + export location to an empty folder inside `mods/` (for example `mods/TKMM`). That folder is then one mod here. +- Files made for another game version (names with `.Product..` that this version does not have) are left out; + the Mods tab counts them. Look for the mod's release for your game version. +- Mods that patch the game code (`exefs/*.ips`, `exefs/*.pchtxt`) are listed but not applied yet; a mod with both kinds + of files stays off as a whole until they are. +- Mods with their own code (`exefs/subsdk*` or a replaced `exefs/main`, such as UltraCam) never load, their RomFS files + included. +- Cheat files (`/cheats/.txt`) are listed but not loaded yet. + +The log names every mod at the start (`mods: : ...`) and how many of its files it serves. + ## What to send back 1. `logs\totk.log` from each run. It contains no keys and no game files. The lines that matter most start with diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index f65aa3ef..95085a47 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -40,6 +40,7 @@ extern "C" { #include "fs.h" #include "input.h" #include "input_map.h" +#include "mods.h" #include "perfmon.h" #include "platform/platform.h" #include "sysinfo.h" @@ -370,7 +371,7 @@ extern "C" void menu_vk_release(void) { // TOTK_MENU_TEST_SET=:=[,=...][;:...]: cfg_set of each key (TOTK_ prefix // optional) at that presented frame; changes live settings with no input, menu open or not. totk.ini is written only by // the pseudo-key SAVE=1 (cfg_save, as a row change does; a failed write shows the menu's save note). -enum { TAB_SCREEN, TAB_GAME, TAB_SOUND, TAB_CONTROLS, TAB_AMIIBO, TAB_MENU, TAB_ADVANCED, TAB_COUNT }; +enum { TAB_SCREEN, TAB_GAME, TAB_MODS, TAB_SOUND, TAB_CONTROLS, TAB_AMIIBO, TAB_MENU, TAB_ADVANCED, TAB_COUNT }; enum { TEST_PAGE_FRAMES = 30, TEST_SETS = 16 }; struct TestSet { uint64_t frame; char key[64], value[64]; }; static struct { @@ -683,9 +684,6 @@ static void tab_screen(float scale) { static void tab_game(float scale) { opt_begin("##game", scale); row_fps_limit(); - opt_toggle("TOTK_REALTIME", UI_MENU_REALTIME, UI_MENU_REALTIME_DESC); - opt_toggle("TOTK_CLOTH_REALTIME", UI_MENU_CLOTH_REALTIME, UI_MENU_CLOTH_REALTIME_DESC); - opt_toggle("TOTK_HIGHFPS_FIX", UI_MENU_HIGHFPS_FIX, UI_MENU_HIGHFPS_FIX_DESC); row_game_lang(); static const UiTextId mode[] = {UI_MENU_MODE_DOCKED, UI_MENU_MODE_HANDHELD}; opt_choice("TOTK_OPERATION_MODE", UI_MENU_OPERATION_MODE, mode, 2, UI_MENU_OPERATION_MODE_DESC); @@ -1002,13 +1000,86 @@ static void tab_advanced(float scale) { } } -static const UiTextId kTabNames[TAB_COUNT] = {UI_MENU_TAB_SCREEN, UI_MENU_TAB_GAME, UI_MENU_TAB_SOUND, +static const UiTextId kTabNames[TAB_COUNT] = {UI_MENU_TAB_SCREEN, UI_MENU_TAB_GAME, UI_MENU_TAB_MODS, UI_MENU_TAB_SOUND, UI_MENU_TAB_CONTROLS, UI_MENU_TAB_AMIIBO, UI_MENU_TAB_MENU, UI_MENU_TAB_ADVANCED}; static int g_tab; // the tab shown static int g_tab_request = -1; // select this tab at the next layout; -1 none static int g_focus_page = -1; // this tab's first row takes the cursor once it is shown; -1 none +// A row of another tab: that tab opens with the row under the cursor. +static void go_to(int tab, const char *key) { + g_tab_request = tab; + opt_focus_key(key); +} + +// ---- Mods: the mods folder (mods.c) with switches and the load order, then the port's own patches. The folder was +// read at start; the rows change the order and switches for the next start. +static void mods_builtin_rows(void) { + opt_group(UI_MENU_MODS_BUILTIN); + char fps[64], res[64]; + const char *lim = cfg_value("TOTK_FPS_LIMIT"); + if (!strcmp(lim, "display")) snprintf(fps, sizeof fps, "%s", menu_text(UI_MENU_FPS_DISPLAY)); + else snprintf(fps, sizeof fps, "%s FPS", lim); + if (opt_button("##mods_fps60", UI_MENU_MODS_FPS60, UI_MENU_MODS_FPS60_DESC, fps)) go_to(TAB_GAME, "TOTK_FPS_LIMIT"); + int w = 0, h = 0; + sscanf(cfg_value("TOTK_OUTPUT_RES"), "%dx%d", &w, &h); + snprintf(res, sizeof res, "%d × %d", w, h); // U+00D7, as row_output_res shows it + if (opt_button("##mods_res", UI_MENU_MODS_RES, UI_MENU_MODS_RES_DESC, res)) go_to(TAB_SCREEN, "TOTK_OUTPUT_RES"); + opt_toggle("TOTK_REALTIME", UI_MENU_REALTIME, UI_MENU_REALTIME_DESC); + opt_toggle("TOTK_CLOTH_REALTIME", UI_MENU_CLOTH_REALTIME, UI_MENU_CLOTH_REALTIME_DESC); + opt_toggle("TOTK_HIGHFPS_FIX", UI_MENU_HIGHFPS_FIX, UI_MENU_HIGHFPS_FIX_DESC); + opt_button("##mods_quickmenu", UI_MENU_MODS_QUICKMENU, UI_MENU_MODS_QUICKMENU_DESC, + menu_text(romfs_patches_loaded() ? UI_MENU_ON : UI_MENU_OFF)); +} + +static void tab_mods(float scale) { + opt_begin("##mods", scale); + opt_group(UI_MENU_MODS_INSTALLED); + int n = mods_count(); + if (!n) opt_text(UI_MENU_MODS_NONE); + const char *after = mods_changed() ? menu_text(UI_MENU_AFTER_RESTART) : nullptr; + for (int i = 0; i < n; i++) { + const ModInfo *m = mods_at(i); + char id[32], desc[1536]; + snprintf(id, sizeof id, "##mod%d", i); + char over[512] = "", other[512] = ""; + if (m->overridden) snprintf(over, sizeof over, menu_text(UI_MENU_MODS_OVERRIDDEN), m->overridden, m->overridden_by); + if (m->other_version) snprintf(other, sizeof other, menu_text(UI_MENU_MODS_OTHER_VERSION), m->other_version); + UiTextId problem = m->problem == MOD_EMPTY ? UI_MENU_MODS_EMPTY + : m->problem == MOD_PLUGIN ? UI_MENU_MODS_SUBSDK + : m->problem == MOD_EXEFS_LATER ? UI_MENU_MODS_EXEFS_LATER + : m->problem == MOD_CHEATS_LATER ? UI_MENU_MODS_CHEATS_LATER + : m->problem == MOD_BAD_NAME ? UI_MENU_MODS_BAD_NAME + : UI_TEXT_COUNT; + int k = snprintf(desc, sizeof desc, menu_text(UI_MENU_MODS_ROW_DESC), m->replaced, m->added); + if (k >= 0 && k < (int)sizeof desc) + snprintf(desc + k, sizeof desc - k, "%s%s%s%s%s%s\n\n%s", over[0] ? "\n\n" : "", over, + other[0] ? "\n\n" : "", other, problem != UI_TEXT_COUNT ? "\n\n" : "", + problem != UI_TEXT_COUNT ? menu_text(problem) : "", menu_text(UI_MENU_MODS_MOVE_HINT)); + int s = opt_text_row(id, m->name, menu_text(m->enabled ? UI_MENU_ON : UI_MENU_OFF), after, desc, true); + if (s == 2 || s == -1 || s == 1) { + mods_set_enabled(i, !m->enabled); + opt_save_soon(); + } else if ((s == 3 && i > 0) || (s == 4 && i + 1 < n)) { + int to = s == 3 ? i - 1 : i + 1; + mods_move(i, to - i); + snprintf(id, sizeof id, "##mod%d", to); + opt_focus_key(id); // the cursor follows the mod + opt_save_soon(); + } + } + static uint64_t open_failed; // plat_now_ns until which the button says it failed + if (opt_button("##mods_open", UI_MENU_MODS_OPEN, UI_MENU_MODS_OPEN_DESC, + plat_now_ns() < open_failed ? menu_text(UI_MENU_ACTION_FAILED) : "")) { + bool ok = mods_dir()[0] != 0; + if (ok) plat_file_mkdir_p(mods_dir()); + if (!ok || !plat_open_folder(mods_dir())) open_failed = plat_now_ns() + 3000000000ull; + } + mods_builtin_rows(); + opt_end(); +} + // ---- the window: title, tabs (L / R or Q / E switch), the page, and the bottom row with "Continue" and "Quit game". // B on the gamepad and Esc close it. static void layout_menu(uint32_t w, uint32_t h, float scale) { @@ -1053,6 +1124,7 @@ static void layout_menu(uint32_t w, uint32_t h, float scale) { switch (k) { case TAB_SCREEN: tab_screen(scale); break; case TAB_GAME: tab_game(scale); break; + case TAB_MODS: tab_mods(scale); break; case TAB_SOUND: tab_sound(scale); break; case TAB_CONTROLS: tab_controls(scale); break; case TAB_AMIIBO: tab_amiibo(scale); break; diff --git a/runtime/ui/menu.h b/runtime/ui/menu.h index a1d5202b..c68ae9f6 100644 --- a/runtime/ui/menu.h +++ b/runtime/ui/menu.h @@ -5,8 +5,9 @@ // // F1 or Esc on the keyboard and Minus and Plus held together (consumed in poll_merged, input_menu_gate in input.h) open it; // F1, Esc, B or "Continue" close it. While it is open the game gets no input (input_menu, input.h) and keeps running; the -// cursor is released from the mouse camera. Tabs Screen, Game, Sound, Controls and Menu (L / R or Q / E switch them) hold -// option rows (ui/option_rows.h) over the cfg settings; the bottom row has "Continue" and "Quit game". +// cursor is released from the mouse camera. Tabs Screen, Game, Mods, Sound, Controls and Menu (L / R or Q / E switch +// them) hold option rows (ui/option_rows.h) over the cfg settings and the mods folder (mods.h); the bottom row has +// "Continue" and "Quit game". // Test hooks (ui/menu.cpp): TOTK_MENU_TEST=[:] opens the menu at that presented frame and saves // one swapchain shot per tab into TOTK_MENU_TEST_DIR; TOTK_MENU_TEST_SET=:=[,...][;...] sets settings // at given frames without input (SAVE=1 writes totk.ini). diff --git a/runtime/ui/option_rows.cpp b/runtime/ui/option_rows.cpp index 59a66917..0a15506e 100644 --- a/runtime/ui/option_rows.cpp +++ b/runtime/ui/option_rows.cpp @@ -40,8 +40,8 @@ struct Desc { char text[UI_DESC_BYTES]; }; static Desc g_hover, g_focus, g_first, g_shown; // disabled: the note of a row opt_disable_next greyed out, else NULL. -static void desc_set(Desc &d, UiTextId desc, const char *key, const CfgMeta *m, const char *disabled) { - int n = snprintf(d.text, sizeof d.text, "%s", menu_text(desc)); +static void desc_set(Desc &d, const char *desc, const char *key, const CfgMeta *m, const char *disabled) { + int n = snprintf(d.text, sizeof d.text, "%s", desc); if (n < 0 || n >= (int)sizeof d.text) return; if (disabled) snprintf(d.text + n, sizeof d.text - n, "\n\n%s", disabled); @@ -108,9 +108,10 @@ struct RowView { const char *note; // under the value instead of the "default" mark; NULL for none }; -// One row: draws it, handles A / click and left / right while selected. Returns 2 (A / click), -1 / +1 (left / right) or -// 0; always 0 for a row the environment fixes (greyed out, still selectable so its description shows). -static int row(const char *key, UiTextId label, UiTextId desc, const RowView &v) { +// One row: draws it, handles A / click and left / right while selected. Returns 2 (A / click), -1 / +1 (left / right), +// 3 / 4 (move up / down, movable rows only) or 0; always 0 for a row the environment fixes (greyed out, still selectable +// so its description shows). movable: the top / left face buttons, Ctrl+Up / Ctrl+Down and two drawn arrows move it. +static int row_text(const char *key, const char *label, const char *desc, const RowView &v, bool movable) { const CfgMeta *m = cfg_meta(key); const char *disabled = g_disable_next ? menu_text(g_disable_note) : NULL; g_disable_next = false; @@ -146,6 +147,13 @@ static int row(const char *key, UiTextId label, UiTextId desc, const RowView &v) // left and right belong to the row (navigation would otherwise move sideways into the description pane) ImGui::SetKeyOwner(k, ImGui::GetItemID()); } + if (movable) { + bool ctrl = ImGui::GetIO().KeyCtrl; + if (ImGui::IsKeyPressed(ImGuiKey_GamepadFaceUp, false) || (ctrl && ImGui::IsKeyPressed(ImGuiKey_UpArrow))) + step = 3; + if (ImGui::IsKeyPressed(ImGuiKey_GamepadFaceLeft, false) || (ctrl && ImGui::IsKeyPressed(ImGuiKey_DownArrow))) + step = 4; + } } if (foc) desc_set(g_focus, desc, key, m, disabled); if (hov) desc_set(g_hover, desc, key, m, disabled); @@ -175,11 +183,25 @@ static int row(const char *key, UiTextId label, UiTextId desc, const RowView &v) right = rx - gap; value_left = lx; } + if (movable) { // up and down arrows left of the value; a click on one moves the row + // a fixed value column (On / Off differ in width) keeps the arrows of the rows in one line + float aw = fs * 0.42f, gap = fs * 0.55f; + float cx = right - fmaxf(ImGui::CalcTextSize(v.value).x, fs * 2.8f) - gap * 2 - aw; + float uy = ty + fs * 0.12f, dy = ty + fs * 0.92f; + ImU32 ac = off ? kGrey : hov || foc ? kGold : IM_COL32(170, 170, 160, 255); + dl->AddTriangleFilled(ImVec2(cx, uy + aw * 0.7f), ImVec2(cx + aw, uy + aw * 0.7f), ImVec2(cx + aw * 0.5f, uy), ac); + dl->AddTriangleFilled(ImVec2(cx, dy - aw * 0.7f), ImVec2(cx + aw, dy - aw * 0.7f), ImVec2(cx + aw * 0.5f, dy), ac); + if (clicked && !off) { + ImVec2 mp = ImGui::GetIO().MousePos; + if (mp.x >= cx - gap * 0.5f && mp.x <= cx + aw + gap * 0.5f) step = mp.y < ty + fs * 0.52f ? 3 : 4; + } + value_left = cx - gap; + } if (v.value[0]) { float vx = right - ImGui::CalcTextSize(v.value).x; dl->AddText(ImVec2(vx, ty), off ? kGrey : v.is_default ? IM_COL32(205, 205, 195, 255) : IM_COL32(255, 255, 255, 255), v.value); - if (!v.arrows) value_left = vx; + if (!v.arrows && !movable) value_left = vx; } if (v.note || v.is_default) { // under the value, right-aligned with it const char *t = v.note ? v.note : menu_text(UI_MENU_DEFAULT_MARK); @@ -188,8 +210,7 @@ static int row(const char *key, UiTextId label, UiTextId desc, const RowView &v) } // the label and its note, clipped before the value ImVec4 clip(p.x, p.y, value_left - fs * 0.6f, p.y + h); - dl->AddText(font, fs, ImVec2(p.x + pad, ty), off ? kGrey : IM_COL32(240, 236, 224, 255), menu_text(label), NULL, 0, - &clip); + dl->AddText(font, fs, ImVec2(p.x + pad, ty), off ? kGrey : IM_COL32(240, 236, 224, 255), label, NULL, 0, &clip); const char *note = disabled ? disabled : off ? menu_text(UI_MENU_SET_BY_ENV) : m && !m->live ? menu_text(UI_MENU_AFTER_RESTART) @@ -199,6 +220,16 @@ static int row(const char *key, UiTextId label, UiTextId desc, const RowView &v) return off ? 0 : step; } +static int row(const char *key, UiTextId label, UiTextId desc, const RowView &v) { + return row_text(key, menu_text(label), menu_text(desc), v, false); +} + +int opt_text_row(const char *id, const char *label, const char *value, const char *note, const char *desc, + bool movable) { + RowView v = {value ? value : "", false, false, note}; + return row_text(id, label, desc, v, movable); +} + // ---- writing a setting: at once in memory (live settings follow), to totk.ini a moment later (opt_save_tick) static uint64_t g_save_at; // plat_now_ns deadline of the pending write; 0 none static bool g_save_logged; @@ -404,9 +435,9 @@ int opt_bind_row(const char *key, const char *label, UiTextId desc, const char * } char k[64]; snprintf(k, sizeof k, "TOTK_%s", key); - if (row_foc) desc_set(g_focus, desc, k, NULL, NULL); - if (row_hov) desc_set(g_hover, desc, k, NULL, NULL); - if (!g_first.text[0]) desc_set(g_first, desc, k, NULL, NULL); + if (row_foc) desc_set(g_focus, menu_text(desc), k, NULL, NULL); + if (row_hov) desc_set(g_hover, menu_text(desc), k, NULL, NULL); + if (!g_first.text[0]) desc_set(g_first, menu_text(desc), k, NULL, NULL); if (note && (row_foc || row_hov)) { // e.g. what moved here, after the description Desc &d = row_hov ? g_hover : g_focus; size_t n = strlen(d.text); diff --git a/runtime/ui/option_rows.h b/runtime/ui/option_rows.h index 1178f7bf..8e939c67 100644 --- a/runtime/ui/option_rows.h +++ b/runtime/ui/option_rows.h @@ -47,6 +47,11 @@ bool opt_choice_list(const char *key, UiTextId label, const char *const *values, // A row that runs an action: true on A or a click. id: unique on the page and not a setting ("##copy_info"); value: // shown on the right ("" none). bool opt_button(const char *id, UiTextId label, UiTextId desc, const char *value = ""); +// A row whose label, value, note (under the value) and description are text, not catalog ids: a mod's folder name. +// Returns 2 (A / click), -1 / +1 (left / right), 3 / 4 (move up / down: the top / left face buttons, Ctrl+Up / +// Ctrl+Down, the drawn arrows; movable rows only) or 0. +int opt_text_row(const char *id, const char *label, const char *value, const char *note, const char *desc, + bool movable); // lo..hi in steps of step (left and right held for a second go ten times as fast); fmt formats the value ("%.0f %%"). // note: a short line under the value in place of the "default" mark (NULL: none). fallback: the setting that applies // while key is unset; the row shows its value then, and a change sets key. diff --git a/runtime/ui_text.c b/runtime/ui_text.c index ff40f85a..f6b7ddd8 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -29,7 +29,7 @@ static const char *const text_en[UI_TEXT_COUNT] = { SWKBD("Text entry", "Enter a name", "Horse", "OK", "Cancel", "Controller: A = OK, B = Cancel"), [UI_MENU_TITLE] = "Settings", - [UI_MENU_TAB_SCREEN] = "Screen", [UI_MENU_TAB_GAME] = "Game", [UI_MENU_TAB_SOUND] = "Sound", + [UI_MENU_TAB_SCREEN] = "Screen", [UI_MENU_TAB_GAME] = "Game", [UI_MENU_TAB_MODS] = "Mods", [UI_MENU_TAB_SOUND] = "Sound", [UI_MENU_TAB_CONTROLS] = "Controls", [UI_MENU_TAB_AMIIBO] = "Amiibo", [UI_MENU_TAB_MENU] = "Menu", [UI_MENU_TAB_ADVANCED] = "Advanced", [UI_MENU_CONTINUE] = "Continue", [UI_MENU_QUIT] = "Quit game", [UI_MENU_ON] = "On", [UI_MENU_OFF] = "Off", [UI_MENU_AUTO] = "Automatic", [UI_MENU_DEFAULT_MARK] = "default", @@ -158,6 +158,35 @@ static const char *const text_en[UI_TEXT_COUNT] = { "window loses focus, as on the Switch when Home is pressed; a load interrupted that " "way can stop for good.", + [UI_MENU_MODS_BUILTIN] = "Built into the port", [UI_MENU_MODS_INSTALLED] = "Installed mods", + [UI_MENU_MODS_NONE] = "No mods yet. Unpack a mod into the mods folder, one folder per mod with its romfs folder " + "inside, and restart the game. TKMM can export its merged mods into a folder there too.", + [UI_MENU_MODS_OPEN] = "Open mods folder", + [UI_MENU_MODS_OPEN_DESC] = "Shows the folder the game loads mods from. It is created if it is missing.", + [UI_MENU_MODS_ROW_DESC] = "Game files it replaces: %u. New files it adds: %u.", + [UI_MENU_MODS_OVERRIDDEN] = "%u of its files come from %s, which is higher in the list.", + [UI_MENU_MODS_MOVE_HINT] = "The top face button or Ctrl+Up moves it up, the left face button or Ctrl+Down moves it " + "down. When two mods change the same file, the higher one wins. Changes apply after a " + "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.", + [UI_MENU_MODS_EXEFS_LATER] = "This mod patches the game code (exefs). Code patches are not supported yet, so the " + "whole mod stays off.", + [UI_MENU_MODS_CHEATS_LATER] = "This mod holds only cheat files. Cheats are not supported yet.", + [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_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 " + "Game tab.", + [UI_MENU_MODS_RES] = "Resolution patch", + [UI_MENU_MODS_RES_DESC] = "The port's own patch for resolutions above 1080p. Set it with Game resolution on the " + "Screen tab.", + [UI_MENU_MODS_QUICKMENU] = "Quick menu fix", + [UI_MENU_MODS_QUICKMENU_DESC] = "The port's fix for the black background of the weapon, shield and material menus " + "at 60 FPS.", + [UI_MENU_VOLUME] = "Volume", [UI_MENU_VOLUME_DESC] = "Master volume of the game.", [UI_MENU_MOTION] = "Motion controls", [UI_MENU_MOTION_DESC] = "Aiming with the controller's gyroscope.", @@ -390,7 +419,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = { SWKBD("Ввод текста", "Введите имя", "Лошадь", "ОК", "Отмена", "Контроллер: A — ОК, B — отмена"), [UI_MENU_TITLE] = "Настройки", - [UI_MENU_TAB_SCREEN] = "Экран", [UI_MENU_TAB_GAME] = "Игра", [UI_MENU_TAB_SOUND] = "Звук", + [UI_MENU_TAB_SCREEN] = "Экран", [UI_MENU_TAB_GAME] = "Игра", [UI_MENU_TAB_MODS] = "Моды", [UI_MENU_TAB_SOUND] = "Звук", [UI_MENU_TAB_CONTROLS] = "Управление", [UI_MENU_TAB_AMIIBO] = "Amiibo", [UI_MENU_TAB_MENU] = "Меню", [UI_MENU_TAB_ADVANCED] = "Дополнительно", [UI_MENU_CONTINUE] = "Продолжить", [UI_MENU_QUIT] = "Выйти из игры", [UI_MENU_ON] = "Вкл.", [UI_MENU_OFF] = "Выкл.", [UI_MENU_AUTO] = "Автоматически", @@ -521,6 +550,33 @@ static const char *const text_ru[UI_TEXT_COUNT] = { "когда окно теряет фокус, как на Switch при нажатии Home; прерванная так загрузка " "может остановиться насовсем.", + [UI_MENU_MODS_BUILTIN] = "Встроенные в порт", [UI_MENU_MODS_INSTALLED] = "Установленные моды", + [UI_MENU_MODS_NONE] = "Модов пока нет. Распакуйте мод в папку mods, каждый мод в свою папку с папкой romfs внутри, и " + "перезапустите игру. TKMM тоже может выгрузить туда объединённые моды отдельной папкой.", + [UI_MENU_MODS_OPEN] = "Открыть папку модов", + [UI_MENU_MODS_OPEN_DESC] = "Показывает папку, из которой игра загружает моды. Если её нет, она будет создана.", + [UI_MENU_MODS_ROW_DESC] = "Заменяет файлов игры: %u. Добавляет новых файлов: %u.", + [UI_MENU_MODS_OVERRIDDEN] = "%u его файлов берутся из мода %s, он выше в списке.", + [UI_MENU_MODS_MOVE_HINT] = "Верхняя кнопка или Ctrl+Вверх поднимает мод, левая кнопка или Ctrl+Вниз опускает. Если " + "два мода меняют один файл, побеждает верхний. Изменения действуют после перезапуска.", + [UI_MENU_MODS_EMPTY] = "В этой папке нет файлов romfs, exefs или cheats.", + [UI_MENU_MODS_SUBSDK] = "Этот мод приносит свой код игры (плагин subsdk или заменённый main). Порт не загружает " + "модули кода, поэтому мод выключен целиком.", + [UI_MENU_MODS_EXEFS_LATER] = "Этот мод меняет код игры (exefs). Патчи кода пока не поддерживаются, поэтому мод " + "выключен целиком.", + [UI_MENU_MODS_CHEATS_LATER] = "В этом моде только файлы читов. Читы пока не поддерживаются.", + [UI_MENU_MODS_BAD_NAME] = "В имени папки есть символ |, которым список модов разделяет имена. Переименуйте папку.", + [UI_MENU_MODS_OTHER_VERSION] = "Файлов для другой версии игры: %u, они пропущены. Поищите версию этого мода для " + "вашей версии игры.", + [UI_MENU_MODS_FPS60] = "Патч 60 FPS", + [UI_MENU_MODS_FPS60_DESC] = "Собственный патч порта для 60 кадров в секунду. Настраивается «Ограничением частоты " + "кадров» на вкладке «Игра».", + [UI_MENU_MODS_RES] = "Патч разрешения", + [UI_MENU_MODS_RES_DESC] = "Собственный патч порта для разрешений выше 1080p. Настраивается «Разрешением игры» на " + "вкладке «Экран».", + [UI_MENU_MODS_QUICKMENU] = "Исправление быстрого меню", + [UI_MENU_MODS_QUICKMENU_DESC] = "Исправление порта: чёрный фон меню оружия, щитов и материалов при 60 FPS.", + [UI_MENU_VOLUME] = "Громкость", [UI_MENU_VOLUME_DESC] = "Общая громкость игры.", [UI_MENU_MOTION] = "Управление движением", [UI_MENU_MOTION_DESC] = "Прицеливание гироскопом контроллера.", @@ -761,6 +817,34 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_TITLE] = "Configurações", [UI_MENU_TAB_SCREEN] = "Tela", [UI_MENU_TAB_GAME] = "Jogo", [UI_MENU_TAB_SOUND] = "Som", [UI_MENU_TAB_CONTROLS] = "Controles", [UI_MENU_TAB_AMIIBO] = "Amiibo", [UI_MENU_TAB_MENU] = "Menu", [UI_MENU_TAB_ADVANCED] = "Avançado", + [UI_MENU_TAB_MODS] = "Mods", + [UI_MENU_MODS_BUILTIN] = "Embutidos no port", [UI_MENU_MODS_INSTALLED] = "Mods instalados", + [UI_MENU_MODS_NONE] = "Nenhum mod ainda. Descompacte um mod na pasta mods, uma pasta por mod com a pasta romfs dentro, " + "e reinicie o jogo. O TKMM também pode exportar os mods mesclados para uma pasta ali.", + [UI_MENU_MODS_OPEN] = "Abrir pasta de mods", + [UI_MENU_MODS_OPEN_DESC] = "Mostra a pasta de onde o jogo carrega os mods. Ela é criada se não existir.", + [UI_MENU_MODS_ROW_DESC] = "Arquivos do jogo que substitui: %u. Arquivos novos que adiciona: %u.", + [UI_MENU_MODS_OVERRIDDEN] = "%u dos seus arquivos vêm de %s, que está acima na lista.", + [UI_MENU_MODS_MOVE_HINT] = "O botão de cima ou Ctrl+Cima sobe o mod, o botão da esquerda ou Ctrl+Baixo desce. " + "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.", + [UI_MENU_MODS_EXEFS_LATER] = "Este mod altera o código do jogo (exefs). Patches de código ainda não são suportados, " + "então o mod inteiro fica desligado.", + [UI_MENU_MODS_CHEATS_LATER] = "Este mod tem só arquivos de cheats. Cheats ainda não são suportados.", + [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_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 " + "Jogo.", + [UI_MENU_MODS_RES] = "Patch de resolução", + [UI_MENU_MODS_RES_DESC] = "O patch do próprio port para resoluções acima de 1080p. Ajuste em Resolução do jogo na aba " + "Tela.", + [UI_MENU_MODS_QUICKMENU] = "Correção do menu rápido", + [UI_MENU_MODS_QUICKMENU_DESC] = "A correção do port para o fundo preto dos menus de armas, escudos e materiais a 60 " + "FPS.", [UI_MENU_CONTINUE] = "Continuar", [UI_MENU_QUIT] = "Sair do jogo", [UI_MENU_ON] = "Ligado", [UI_MENU_OFF] = "Desligado", [UI_MENU_AUTO] = "Automático", [UI_MENU_DEFAULT_MARK] = "padrão", @@ -1164,6 +1248,28 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_TAB_AMIIBO] = "amiibo", [UI_MENU_TAB_MENU] = "菜单", [UI_MENU_TAB_ADVANCED] = "高级", + [UI_MENU_TAB_MODS] = "模组", + [UI_MENU_MODS_BUILTIN] = "移植版内置", [UI_MENU_MODS_INSTALLED] = "已安装的模组", + [UI_MENU_MODS_NONE] = "还没有模组。把模组解压到 mods 文件夹,每个模组一个文件夹,里面放 romfs 文件夹,然后重启游戏。" + "TKMM 也可以把合并后的模组导出到那里的一个文件夹。", + [UI_MENU_MODS_OPEN] = "打开模组文件夹", + [UI_MENU_MODS_OPEN_DESC] = "显示游戏加载模组的文件夹。不存在时会创建它。", + [UI_MENU_MODS_ROW_DESC] = "替换的游戏文件:%u。新增的文件:%u。", + [UI_MENU_MODS_OVERRIDDEN] = "它的 %u 个文件改用列表中更靠上的 %s 的文件。", + [UI_MENU_MODS_MOVE_HINT] = "上方按钮或 Ctrl+上 上移,左侧按钮或 Ctrl+下 下移。两个模组修改同一个文件时,以靠上的为准。" + "更改在重启后生效。", + [UI_MENU_MODS_EMPTY] = "此文件夹中没有 romfs、exefs 或 cheats 文件。", + [UI_MENU_MODS_SUBSDK] = "此模组带有自己的游戏代码(subsdk 插件或替换的 main)。移植版无法加载代码模块,因此整个模组保持关闭。", + [UI_MENU_MODS_EXEFS_LATER] = "此模组修改游戏代码(exefs)。目前还不支持代码补丁,因此整个模组保持关闭。", + [UI_MENU_MODS_CHEATS_LATER] = "此模组只有金手指文件。目前还不支持金手指。", + [UI_MENU_MODS_BAD_NAME] = "文件夹名称含有 |,模组列表用它分隔名称。请重命名该文件夹。", + [UI_MENU_MODS_OTHER_VERSION] = "它有 %u 个文件是为其他游戏版本制作的,已被跳过。请寻找适用于你的游戏版本的此模组。", + [UI_MENU_MODS_FPS60] = "60 FPS 补丁", + [UI_MENU_MODS_FPS60_DESC] = "移植版自带的 60 帧补丁。在“游戏”页的帧率上限中设置。", + [UI_MENU_MODS_RES] = "分辨率补丁", + [UI_MENU_MODS_RES_DESC] = "移植版自带的 1080p 以上分辨率补丁。在“显示”页的游戏分辨率中设置。", + [UI_MENU_MODS_QUICKMENU] = "快捷菜单修复", + [UI_MENU_MODS_QUICKMENU_DESC] = "移植版对 60 FPS 下武器、盾牌和材料快捷菜单黑色背景的修复。", [UI_MENU_CONTINUE] = "继续", [UI_MENU_QUIT] = "退出游戏", [UI_MENU_ON] = "开", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index beb87ac1..ee5e4234 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -15,7 +15,7 @@ typedef enum { // Simplified Chinese texts. UI_MENU_FIRST, UI_MENU_TITLE = UI_MENU_FIRST, - UI_MENU_TAB_SCREEN, UI_MENU_TAB_GAME, UI_MENU_TAB_SOUND, UI_MENU_TAB_CONTROLS, UI_MENU_TAB_AMIIBO, + UI_MENU_TAB_SCREEN, UI_MENU_TAB_GAME, UI_MENU_TAB_MODS, UI_MENU_TAB_SOUND, UI_MENU_TAB_CONTROLS, UI_MENU_TAB_AMIIBO, UI_MENU_TAB_MENU, UI_MENU_TAB_ADVANCED, UI_MENU_CONTINUE, UI_MENU_QUIT, UI_MENU_ON, UI_MENU_OFF, UI_MENU_AUTO, UI_MENU_DEFAULT_MARK, // "default" beside the default value @@ -67,6 +67,18 @@ typedef enum { UI_MENU_OPERATION_MODE, UI_MENU_OPERATION_MODE_DESC, UI_MENU_MODE_DOCKED, UI_MENU_MODE_HANDHELD, UI_MENU_ASSUME_FOCUS, UI_MENU_ASSUME_FOCUS_DESC, + // Mods: the port's own patches and the player's mods folder (mods.c) + UI_MENU_MODS_BUILTIN, UI_MENU_MODS_INSTALLED, + UI_MENU_MODS_NONE, // no mod folder yet: where to unpack one + UI_MENU_MODS_OPEN, UI_MENU_MODS_OPEN_DESC, + UI_MENU_MODS_ROW_DESC, // printf: files it replaces, files it adds (as of this start) + UI_MENU_MODS_OVERRIDDEN, // printf: files a higher mod serves instead, that mod's name + UI_MENU_MODS_MOVE_HINT, + UI_MENU_MODS_EMPTY, UI_MENU_MODS_SUBSDK, UI_MENU_MODS_EXEFS_LATER, UI_MENU_MODS_CHEATS_LATER, UI_MENU_MODS_BAD_NAME, + UI_MENU_MODS_OTHER_VERSION, // printf: files made for another game version, left out + UI_MENU_MODS_FPS60, UI_MENU_MODS_FPS60_DESC, UI_MENU_MODS_RES, UI_MENU_MODS_RES_DESC, + UI_MENU_MODS_QUICKMENU, UI_MENU_MODS_QUICKMENU_DESC, + // Sound UI_MENU_VOLUME, UI_MENU_VOLUME_DESC,