Write RomFS layout folders only for the screen shapes and prompts this player uses

The setup wrote 64 patch folders: every prompts style for all 15 shaped game resolutions. The new shapes step
(installer/screens.py) writes romfs-patches-<w>x<h> only for the shapes of the connected displays, the output_res the
game defaults to on each and the totk.ini output_res, and the prompts' shaped folder only for the style totk.ini
selects. One folder per shape: the runtime maps the game resolution to its shape's size (cfg.c cfg_shape_size, the
closest ratio within 1%), and an exact-size folder from an older install still wins. The settings menu marks a game
resolution whose shape has no folder and can start the generator for it in the background, for the next start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-12 19:02:31 +03:00
1 parent df3e90dc4c
commit bc578148ab
18 files changed
+624 -101

No files matched your search

+32 -3
View File
@@ -515,7 +515,35 @@ static void row_output_res(void) {
snprintf(shown[i], sizeof shown[i], "%d × %d", w, h); // U+00D7, the multiplication sign
names[i] = shown[i];
}
opt_choice_list("TOTK_OUTPUT_RES", UI_MENU_OUTPUT_RES, vals, names, N, UI_MENU_OUTPUT_RES_DESC);
// A size of another shape needs that shape's folders (romfs.c overlay_init): the layout, and with Xbox or PC
// prompts the prompts' one too. The setup writes them for the displays it saw (installer/steps.py Shapes); at a
// shape without them the game draws 16:9 with bars or keeps the Switch prompts, so the row says so and offers to
// start the generator for the next start (romfs_shape_prepare; a child process, the menu does not wait). The file
// checks run again only when a setting or the started generation changes.
static unsigned seen = ~0u;
static int missing, started; // started: 0 not asked, 1 running, -1 failed to start
static char asked[16];
const char *now = cfg_value("TOTK_OUTPUT_RES");
if (seen != cfg_version()) {
seen = cfg_version();
unsigned w = 0, h = 0;
const char *layout = cfg_value("TOTK_PAD_LAYOUT");
const char *want = input_prompts_folder(input_prompts_pick(cfg_get("TOTK_PROMPTS"), layout), layout);
missing = sscanf(now, "%ux%u", &w, &h) == 2 && romfs_shape_missing(w, h, want);
}
int here = started && !strcmp(asked, now); // the generation started for the value shown
const char *note = !missing ? nullptr
: here ? menu_text(started > 0 ? UI_MENU_OUTPUT_RES_PREPARING : UI_MENU_SHAPE_PREPARE_FAILED)
: menu_text(UI_MENU_OUTPUT_RES_NO_LAYOUT);
opt_choice_list("TOTK_OUTPUT_RES", UI_MENU_OUTPUT_RES, vals, names, N, UI_MENU_OUTPUT_RES_DESC, -1, note);
if (!missing || here || !romfs_shape_can_prepare()) return;
if (!opt_button("##shape_prepare", UI_MENU_SHAPE_PREPARE, UI_MENU_SHAPE_PREPARE_DESC)) return;
unsigned w = 0, h = 0;
const char *layout = cfg_value("TOTK_PAD_LAYOUT");
sscanf(now, "%ux%u", &w, &h);
snprintf(asked, sizeof asked, "%s", now);
started = romfs_shape_prepare(w, h, input_prompts_folder(input_prompts_pick(cfg_get("TOTK_PROMPTS"), layout), layout))
? 1 : -1;
}
static void row_render_scale(void) {
@@ -807,8 +835,9 @@ static const char *prompts_note(bool *restart) {
const char *layout = cfg_value("TOTK_PAD_LAYOUT"), *used = romfs_prompts();
const char *want = input_prompts_folder(input_prompts_pick(cfg_get("TOTK_PROMPTS"), layout), layout);
if (want == used || (want && used && !strcmp(want, used))) return nullptr;
// A game resolution of another shape needs a folder of its own for the prompts (<folder>-<w>x<h>). The setup writes
// one for each size the Screen tab offers; at any other size the shape is the reason, not the setup.
// A game resolution of another shape needs a folder of its own for the prompts (<folder>-<w>x<h>, one per shape).
// The setup writes it for the shapes of the displays it saw and the prompts totk.ini had then; at another shape
// the shape is the reason (row_output_res offers to make it), not a damaged install.
int off = romfs_prompts_off(want);
if (want && !romfs_prompts_ready(want) && off != ROMFS_PROMPTS_SHAPE) return menu_text(UI_MENU_PROMPTS_MISSING);
switch (off) {