Without an output_res the game makes the missing folders for the display's shape, so a prompts change on a wide display brings that shape back at the next start (#180)

The default output_res keeps the display's shape only while that shape has the
prompts' folder (cfg.c shape_keeps_prompts). After a switch to PlayStation
prompts on a 21:9 display the default was 1920x1080, so the start and the menu
asked only for the 16:9 folder and the game stayed 16:9. cfg_screen_size gives
the display's size while the player set no output_res.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-18 18:46:52 +03:00
1 parent 6f03ccd30d
commit 4a59088f04
5 files changed
+26 -9

No files matched your search

+7
View File
@@ -462,6 +462,13 @@ static void screen_default(void) {
sh, screen_res);
}
int cfg_screen_size(unsigned out[2]) {
unsigned w = 0, h = 0;
if (raw_get(PREFIX "OUTPUT_RES") || !screen_res[0] || sscanf(screen_res, "%ux%u", &w, &h) != 2) return 0;
out[0] = w, out[1] = h;
return 1;
}
const char *cfg_get(const char *name) {
const char *v = raw_get(name);
if (v || strncmp(name, PREFIX, PREFIX_LEN)) return v;
+6
View File
@@ -26,6 +26,12 @@ int cfg_is_set(const char *name);
// The folder size of w x h's shape (cfg.c SHAPED: the closest aspect ratio within 1%, the first of equal ones), the
// one romfs-patches-<w>x<h> the setup writes for it. 0 for 16:9 and for a shape without a UI layout.
int cfg_shape_size(unsigned w, unsigned h, unsigned out[2]);
// The size output_res defaults to on this display (its shape, cfg.c screen_default) while the player set no
// output_res, also when the default stays 1920x1080 because that shape lacks the prompts' folder. The generator the game
// starts for missing folders (romfs.c romfs_folders_prepare) makes them for this size, so after a prompts change the
// next start takes the display's shape again. 0 when the player set output_res, a device profile is in use or the
// display is 16:9.
int cfg_screen_size(unsigned out[2]);
// The device profile in use, "deck" or "desktop" (TOTK_DEVICE_PROFILE, else what the machine is).
const char *cfg_device_profile(void);
// Writes the keys cfg_set changed since the last save into totk.ini next to totk.exe (cfg_save_to: the file at path).
+4 -3
View File
@@ -1110,10 +1110,11 @@ static void overlay_init(void) {
// A folder the settings in effect ask for and the install lacks (an older setup, a failed setup step, a display
// of another shape): its generator starts in the background for the next start when the setup's tools are next to
// the game (romfs_folders_prepare). The size is the one output_res asks for: without its shape's layout the game
// draws 16:9 this time (resolution.c shape_fallback). Nothing with TOTK_ROMFS_PATCHES set; a source build has no
// build-cache/rebuild.txt and keeps the lines above.
// draws 16:9 this time (resolution.c shape_fallback). Without an output_res it is the display's shape, which the
// default keeps only while that shape has the prompts' folder (cfg.c cfg_screen_size). Nothing with
// TOTK_ROMFS_PATCHES set; a source build has no build-cache/rebuild.txt and keeps the lines above.
unsigned asked[2];
res_asked(asked);
if (!cfg_screen_size(asked)) res_asked(asked);
romfs_folders_prepare(asked[0], asked[1], prompts_wanted);
size_t prompts_end = noverlay;
char plain[2100]; // romfs-patches, when it has a manifest
+7 -4
View File
@@ -531,14 +531,17 @@ static int folders_tick(bool now) {
unsigned v = cfg_version();
if (v != g_folders.seen) {
g_folders.seen = v;
const char *res = cfg_value("TOTK_OUTPUT_RES"), *layout = cfg_value("TOTK_PAD_LAYOUT");
const char *layout = cfg_value("TOTK_PAD_LAYOUT");
const char *want = input_prompts_folder(input_prompts_pick(cfg_get("TOTK_PROMPTS"), layout), layout);
// Without an output_res the display's shape: the default falls back to 1920x1080 while that shape lacks the
// prompts' folder, and the folders made for it bring the shape back at the next start (cfg_screen_size).
unsigned s[2] = {0, 0};
if (!cfg_screen_size(s) && sscanf(cfg_value("TOTK_OUTPUT_RES"), "%ux%u", &s[0], &s[1]) != 2) s[0] = s[1] = 0;
char request[sizeof g_folders.request];
snprintf(request, sizeof request, "%s|%s|%s", res, cfg_value("TOTK_HUD_WIDTH"), want ? want : "");
snprintf(request, sizeof request, "%ux%u|%s|%s", s[0], s[1], cfg_value("TOTK_HUD_WIDTH"), want ? want : "");
if (strcmp(request, g_folders.request)) {
snprintf(g_folders.request, sizeof g_folders.request, "%s", request);
unsigned w = 0, h = 0;
if (sscanf(res, "%ux%u", &w, &h) != 2) w = h = 0;
unsigned w = s[0], h = s[1];
g_folders.w = w, g_folders.h = h, g_folders.want = want;
g_folders.missing = w && h ? romfs_folders_missing(w, h, want) : 0;
g_folders.at = g_folders.missing && strcmp(request, g_folders.asked) && romfs_folders_can_prepare()
+2 -2
View File
@@ -77,11 +77,11 @@ left by a run that was stopped is removed by the next run for that folder once i
"""
import argparse
import compression.zstd as zstd
import ctypes
import glob
import hashlib
import importlib.util
import json
import ctypes
import glob
import os
import re
import shutil