mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-20 12:45:57 +00:00
The game makes a missing layout or prompts folder in the background, at start and when a setting asks for it (#180, #378)
When the game resolution, the HUD width, the button prompts or the pad layout need a folder the install lacks (an older setup, a failed setup step, a new display), totk.exe starts the setup's generator for it in the background with the tools build-cache/rebuild.txt names, once per folder and process: at start for the settings in effect (the resolution output_res asks for, also when the missing layout made this start 16:9), and from the settings menu once a changed choice has stayed for 1.5 seconds or the menu closes. A missing 16:9 prompts folder is made too, the PC prompts from totk.ini's bindings. The notes under Game resolution and Button prompts say the files are being made and are used at the next start; when the tools did not start they say so and Try again starts them again. The Prepare button is gone. Source builds without rebuild.txt and TOTK_ROMFS_PATCHES keep the old behaviour. romfs_shape_missing and romfs_shape_prepare become romfs_folders_missing (a mask of the missing folders) and romfs_folders_prepare; --probe-cfg and tests/romfs_shapes_check.py check the new decisions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
77dce74028
commit
00b04df8b2
13 files changed
+331
-162
No files matched your search
+3
-1
@@ -241,7 +241,9 @@ HUD pane/animation and generator naming regressions run with Python 3.14+: `test
|
||||
Set `HUD_TEST_ROMFS` to a verified extracted RomFS directory to include a real-archive comparison against the
|
||||
pre-port layout generator; all game-derived temporary data stays under `build/`.
|
||||
`python tests/romfs_shapes_check.py --cc <clang>` compiles the production folder-selection and preparation helpers
|
||||
to check canonical aliases, capped/full fallback, prompt arguments and generation deduplication without game files.
|
||||
to check canonical aliases, capped/full fallback, prompt arguments, the missing 16:9 prompts and generation
|
||||
deduplication without game files. `tests/romfs_prompts_test.py` checks that two `--background` runs for one folder
|
||||
publish it once and that a folder with a manifest is kept.
|
||||
A change to the mods' ExeFS patches
|
||||
(`tools/exefs_patches.py`, `runtime/mods.c`, the `folded.txt` of `recomp/gen.py`) passes
|
||||
`.venv\Scripts\python tests\exefs_patches_test.py`, which makes its own modules and runs `gen.py` on one with a jump
|
||||
|
||||
+4
-2
@@ -71,9 +71,11 @@ The game reads its UI archive and fonts once at boot, so the prompts change at t
|
||||
|
||||
With `prompts = playstation` the game loads `romfs-patches-playstation` (`pad_layout = nintendo`) or `romfs-patches-playstation-xbox` (`xbox`, `auto`) the same way, written by `tools/make_romfs_patches.py --prompts playstation` and `--prompts playstation-xbox`: the same 60 fps patches, with the face buttons' images and the diamond's letters drawn as ○ × △ □, the shoulders and triggers as L1 R1 L2 R2, Options and Share, and the button guide's L and ZL images. The game's text fonts already have the four shapes, so the diamond's panes and messages hold those characters instead of the letters.
|
||||
|
||||
The Switch prompts stay, with a note under *Button prompts* and a `RomFS overlay: ...` line in the log, when the folder is missing (an install made by an older setup, or one where the setup could not prepare it and showed a warning; running the setup again on the install folder writes it), when it fails its check, with a game resolution of another shape than 16:9 that has no folder of its own (below), and when the `romfs_mods` folder replaces one of its files: `romfs-patches` then loads in its place, where two overlays replacing one file would stop the game. In a source build, `.venv-py314\Scripts\python tools\make_romfs_patches.py --version <ver> --prompts xbox` (and `--prompts xbox-label`) writes `build\<ver>␍omfs-patches-xbox` (`-label`); `--prompts playstation` and `--prompts playstation-xbox` write `build\<ver>␍omfs-patches-playstation` and `-playstation-xbox` the same way. It needs fontTools from `tools/requirements-py314.txt`. `--xbox-prompts` is the older name of `--prompts xbox`.
|
||||
The Switch prompts stay, with a note under *Button prompts* and a `RomFS overlay: ...` line in the log, when the folder is missing (an install made by an older setup, or one where the setup could not prepare it and showed a warning; running the setup again on the install folder writes it; an install whose setup's tools sit next to the game makes it itself, see below), when it fails its check, with a game resolution of another shape than 16:9 that has no folder of its own (below), and when the `romfs_mods` folder replaces one of its files: `romfs-patches` then loads in its place, where two overlays replacing one file would stop the game. In a source build, `.venv-py314\Scripts\python tools\make_romfs_patches.py --version <ver> --prompts xbox` (and `--prompts xbox-label`) writes `build\<ver>␍omfs-patches-xbox` (`-label`); `--prompts playstation` and `--prompts playstation-xbox` write `build\<ver>␍omfs-patches-playstation` and `-playstation-xbox` the same way. It needs fontTools from `tools/requirements-py314.txt`. `--xbox-prompts` is the older name of `--prompts xbox`.
|
||||
|
||||
At a game resolution of another shape than 16:9 the game loads `romfs-patches-<style>-<w>x<h>` (`romfs-patches-xbox-<w>x<h>`, `-xbox-label-`, `-playstation-` or `-playstation-xbox-`) in place of `romfs-patches-<w>x<h>`: the same prompts with that shape's UI layout, `make_romfs_patches.py --prompts <style> --aspect <w>x<h> --reuse <install>␍omfs-patches-<style> --out <install>␍omfs-patches-<style>-<w>x<h>`. The setup writes it for the shapes of the connected displays and `output_res`, for the selected prompts only (installer Shapes step), as for the PC prompts below. At another size, without that folder, the Switch prompts stay (*off at this game resolution*).
|
||||
A missing prompts folder, at 16:9 or of a game resolution's shape, is made by the game itself on an install whose setup left its tools next to the game (`build-cache/rebuild.txt`): choosing those prompts or a pad layout that needs it, or starting the game with them selected, starts `make_romfs_patches.py --background` for it (`runtime/romfs.c`, `romfs_folders_prepare`; `runtime/ui/menu.cpp`, `folders_tick`, once the choice has stayed for 1.5 seconds). The note says *prompt files being made in the background; used at the next start*; when the tools did not start it says so and *Try again* starts them again. A source build has no `rebuild.txt` and keeps the notes above.
|
||||
|
||||
At a game resolution of another shape than 16:9 the game loads `romfs-patches-<style>-<w>x<h>` (`romfs-patches-xbox-<w>x<h>`, `-xbox-label-`, `-playstation-` or `-playstation-xbox-`) in place of `romfs-patches-<w>x<h>`: the same prompts with that shape's UI layout, `make_romfs_patches.py --prompts <style> --aspect <w>x<h> --reuse <install>␍omfs-patches-<style> --out <install>␍omfs-patches-<style>-<w>x<h>`. The setup writes it for the shapes of the connected displays and `output_res`, for the selected prompts only (installer Shapes step), as for the PC prompts below. At another size, without that folder, the Switch prompts stay (*off at this game resolution*) until the game has made it in the background (above).
|
||||
|
||||
## PC button prompts
|
||||
|
||||
|
||||
+7
-3
@@ -110,9 +110,13 @@ loads the saves 1.4.3 wrote.
|
||||
`output_res` (`installer/screens.py`). One folder per shape, named after the shape's size in `ASPECT_SIZES` (the
|
||||
closest within 1%; `5120x2160` uses `2560x1080`); `runtime/romfs.c` `overlay_init` maps the game resolution the
|
||||
same way, and a folder of the exact size from an older setup still wins. A 16:9 player gets none. The step runs
|
||||
again when the displays, the prompts or the patches change; at a game resolution whose shape has no folder the
|
||||
game draws 16:9 with bars, and the settings menu marks such sizes and can write the shape's folders in the
|
||||
background for the next start.
|
||||
again when the displays, the prompts or the patches change. At a game resolution whose shape has no folder the
|
||||
game draws 16:9 with bars and starts the generator itself, in the background, for the next start: at start and
|
||||
when the settings menu changes the resolution, the HUD width, the prompts or the pad layout
|
||||
(`runtime/romfs.c`, `romfs_folders_prepare`, with the Python and tools that `build-cache/rebuild.txt` names; a
|
||||
missing 16:9 prompts folder too). Those runs use `--background`: below-normal priority, and a folder that has a
|
||||
manifest is never written into. Every `make_romfs_patches.py` run writes `<folder>.part-<pid>` and renames it into
|
||||
place when complete; the clean-up step removes the `.part` folders of stopped runs once they are an hour old.
|
||||
9. **DLSS** (the window's tick box, on by default, or `--dlss`; Windows with an NVIDIA RTX GPU): download
|
||||
`nvngx_dlss.dll` from NVIDIA's own DLSS SDK repository (github.com/NVIDIA/DLSS, a pinned tag, NVIDIA RTX SDK
|
||||
license) into the install folder and check its size and SHA-256 (`steps.py`, `Dlss`). The release does not ship
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ Many rows below are developer tools that only act together with another setting
|
||||
|
||||
| Setting | What it does | Effect of changing it | Safety |
|
||||
| --- | --- | --- | --- |
|
||||
| `hud_width` (default `full`) | `full` places the HUD at the screen's edges; `21:9` or `16:9` constrains it to that centered area on a wider game resolution. A cap that is not narrower than the screen, and 16:9 or taller output, keep the full layout. | Read at start. The Shapes installer step builds the selected cap only for needed screen shapes and button prompts. Changing it in the Screen tab may require preparing the layout there or rerunning setup before restarting. If a capped folder is missing the full layout loads with a log message. Explicit overlay overrides and player UI mods keep their precedence. | Safe |
|
||||
| `hud_width` (default `full`) | `full` places the HUD at the screen's edges; `21:9` or `16:9` constrains it to that centered area on a wider game resolution. A cap that is not narrower than the screen, and 16:9 or taller output, keep the full layout. | Read at start. The Shapes installer step builds the selected cap only for needed screen shapes and button prompts. After a change in the Screen tab an install makes a missing layout in the background; it loads at the next start. If a capped folder is missing the full layout loads with a log message. Explicit overlay overrides and player UI mods keep their precedence. | Safe |
|
||||
|
||||
## Diagnostics and logging
|
||||
|
||||
|
||||
+26
-6
@@ -396,7 +396,7 @@ int probe_cfg(void) {
|
||||
!romfs_shaped_prompts_ready("romfs-patches-pc", 5120, 2160),
|
||||
"shape: an older install's exact-size prompts folder serves that size only");
|
||||
cfg_set("TOTK_HUD_WIDTH", "16:9");
|
||||
CHECK(romfs_shaped_ready(5120, 2160) && romfs_shape_missing(5120, 2160, NULL),
|
||||
CHECK(romfs_shaped_ready(5120, 2160) && romfs_folders_missing(5120, 2160, NULL) == ROMFS_NEED_LAYOUT,
|
||||
"HUD: a full layout allows wide output but does not hide a missing selected cap");
|
||||
for (size_t i = 0; i < sizeof capped / sizeof *capped; i++) {
|
||||
snprintf(f, sizeof f, "%s/%s", dir, capped[i]);
|
||||
@@ -404,19 +404,39 @@ int probe_cfg(void) {
|
||||
snprintf(f, sizeof f, "%s/%s/manifest.tsv", dir, capped[i]);
|
||||
plat_file_write(f, "#\n", 2);
|
||||
}
|
||||
CHECK(!romfs_shape_missing(5120, 2160, "romfs-patches-xbox") &&
|
||||
romfs_shape_missing(5120, 2160, "romfs-patches-pc"),
|
||||
CHECK(romfs_folders_missing(5120, 2160, "romfs-patches-xbox") == ROMFS_NEED_PROMPTS &&
|
||||
romfs_folders_missing(5120, 2160, "romfs-patches-pc") ==
|
||||
(ROMFS_NEED_PROMPTS | ROMFS_NEED_SHAPED_PROMPTS),
|
||||
"HUD: canonical capped layouts serve aliases, including Xbox; missing PC prompts still need preparation");
|
||||
cfg_set("TOTK_HUD_WIDTH", "21:9");
|
||||
CHECK(romfs_shape_missing(5120, 2160, NULL) && !romfs_shape_missing(5120, 1440, NULL),
|
||||
CHECK(romfs_folders_missing(5120, 2160, NULL) && !romfs_folders_missing(5120, 1440, NULL),
|
||||
"HUD: a different cap needs a different folder; 5120x1440 uses the 3840x1080 shape");
|
||||
cfg_set("TOTK_HUD_WIDTH", "full");
|
||||
CHECK(!romfs_shaped_ready(5120, 1440), "HUD: switching to full does not reuse a capped-only layout");
|
||||
cfg_set("TOTK_HUD_WIDTH", "21:9");
|
||||
CHECK(!romfs_shape_missing(1920, 1080, NULL), "HUD: 16:9 output ignores a wider cap");
|
||||
CHECK(!romfs_folders_missing(1920, 1080, NULL), "HUD: 16:9 output ignores a wider cap");
|
||||
// The 16:9 prompts' folder is needed at every shape (an older setup or a failed step left it out); at 16:9
|
||||
// nothing shaped is
|
||||
CHECK(romfs_folders_missing(1920, 1080, "romfs-patches-playstation") == ROMFS_NEED_PROMPTS &&
|
||||
romfs_folders_missing(2560, 1440, "romfs-patches-playstation") == ROMFS_NEED_PROMPTS,
|
||||
"folders: missing 16:9 prompts are asked for at 16:9, without a shaped folder");
|
||||
snprintf(f, sizeof f, "%s/romfs-patches-playstation", dir);
|
||||
plat_file_mkdir_p(f);
|
||||
snprintf(f, sizeof f, "%s/romfs-patches-playstation/manifest.tsv", dir);
|
||||
plat_file_write(f, "#\n", 2);
|
||||
CHECK(!romfs_folders_missing(1920, 1080, "romfs-patches-playstation") &&
|
||||
(romfs_folders_missing(5120, 2160, "romfs-patches-playstation") &
|
||||
(ROMFS_NEED_PROMPTS | ROMFS_NEED_SHAPED_PROMPTS)) == ROMFS_NEED_SHAPED_PROMPTS,
|
||||
"folders: present 16:9 prompts leave only the shaped folder to make");
|
||||
plat_file_delete(f);
|
||||
plat_setenv("TOTK_ROMFS_PATCHES", "0");
|
||||
CHECK(!romfs_shape_missing(5120, 2160, NULL), "HUD: explicit overlay overrides do not request generated layouts");
|
||||
CHECK(!romfs_folders_missing(5120, 2160, NULL) && !romfs_folders_missing(1920, 1080, "romfs-patches-pc"),
|
||||
"HUD: explicit overlay overrides do not request generated layouts or prompts");
|
||||
plat_setenv("TOTK_ROMFS_PATCHES", NULL);
|
||||
// Without build-cache/rebuild.txt (a source build) nothing starts: the menu's notes keep "run the setup
|
||||
// again" and the start spawns nothing (romfs.c overlay_init)
|
||||
CHECK(!romfs_folders_can_prepare() && !romfs_folders_prepare(5120, 2160, "romfs-patches-pc"),
|
||||
"folders: no setup's tools, no generator");
|
||||
cfg_set("TOTK_HUD_WIDTH", "full");
|
||||
for (size_t i = 0; i < sizeof capped / sizeof *capped; i++) {
|
||||
snprintf(f, sizeof f, "%s/%s/manifest.tsv", dir, capped[i]);
|
||||
|
||||
+12
-7
@@ -47,14 +47,19 @@ enum { ROMFS_PROMPTS_OK, ROMFS_PROMPTS_MISSING, ROMFS_PROMPTS_FAILED, ROMFS_PROM
|
||||
ROMFS_PROMPTS_PATCHES };
|
||||
const char *romfs_prompts(void);
|
||||
int romfs_prompts_ready(const char *folder);
|
||||
// 1 when w x h is of another shape whose selected HUD layout or prompts_folder's selected variant is missing.
|
||||
// NULL prompts_folder means the game's own prompts; a full-layout fallback does not satisfy a requested HUD cap.
|
||||
int romfs_shape_missing(unsigned w, unsigned h, const char *prompts_folder);
|
||||
// The folders a start at game resolution w x h with prompts_folder (input_prompts_folder; NULL for the game's own
|
||||
// prompts) and the selected HUD width needs and that have no manifest: ROMFS_NEED_PROMPTS, prompts_folder itself (16:9);
|
||||
// at another shape (res_wants_wide_overlay) ROMFS_NEED_LAYOUT, its romfs-patches-<w>x<h>[-hud..], and
|
||||
// ROMFS_NEED_SHAPED_PROMPTS, <prompts_folder>-<w>x<h>[-hud..]. A full-layout fallback does not satisfy a requested HUD
|
||||
// cap. 0 with TOTK_ROMFS_PATCHES set.
|
||||
enum { ROMFS_NEED_LAYOUT = 1, ROMFS_NEED_PROMPTS = 2, ROMFS_NEED_SHAPED_PROMPTS = 4 };
|
||||
int romfs_folders_missing(unsigned w, unsigned h, const char *prompts_folder);
|
||||
// 1 when build-cache/rebuild.txt names the setup's Python and tools/make_romfs_patches.py and both exist, with romfs/.
|
||||
int romfs_shape_can_prepare(void);
|
||||
// Starts the generator for w x h's shape and selected HUD width (including prompts_folder's variant when needed) as
|
||||
// child processes the game does not wait for; the next start loads the result. 1 when every one started.
|
||||
int romfs_shape_prepare(unsigned w, unsigned h, const char *prompts_folder);
|
||||
int romfs_folders_can_prepare(void);
|
||||
// Starts the generator for each folder romfs_folders_missing names, once per folder in this process, as child
|
||||
// processes the game does not wait for; the next start loads the result. 1 when every one runs, 0 when none was
|
||||
// missing, the tools are not there or one could not start.
|
||||
int romfs_folders_prepare(unsigned w, unsigned h, const char *prompts_folder);
|
||||
int romfs_prompts_off(const char *folder);
|
||||
const char *romfs_overlay(size_t k, const char **file, uint64_t *size, int *is_added); // RomFS path of overlay k
|
||||
void fs_trace(const char *what, const char *path); // TOTK_TRACE=fs: one line per open
|
||||
|
||||
@@ -323,6 +323,7 @@ int romfs_shaped_ready(unsigned w, unsigned h); // romfs-patches-<w>x
|
||||
int romfs_shaped_prompts_ready(const char *folder, unsigned w, unsigned h); // the same for <folder>-<w>x<h>, a
|
||||
// prompts' folder (romfs-patches-xbox, -xbox-label, -pc)
|
||||
void res_wanted(unsigned out[2]); // the output size TOTK_OUTPUT_RES asks for
|
||||
void res_asked(unsigned out[2]); // the same before a missing shaped layout made it 16:9
|
||||
void res_fov_live(void); // TOTK_FOV to the camera (set fov); on a settings change
|
||||
void res_dynres_live(void); // TOTK_DYNAMIC_RES to the game (set fixres); on a settings change
|
||||
// ---- code patches (patches.c) and the frame step (frame_rate.c)
|
||||
|
||||
+10
-4
@@ -58,6 +58,7 @@
|
||||
static struct {
|
||||
int decided;
|
||||
unsigned ow, oh, sw, sh; // output and scene
|
||||
unsigned aw, ah; // the output TOTK_OUTPUT_RES asks for, before shape_fallback
|
||||
int scene_set; // the scene differs from the game's 5/6 of the output
|
||||
int heapdef_ok; // romfs.c serves the grown HeapDef
|
||||
int on; // res_init switched the patch sets on
|
||||
@@ -161,14 +162,14 @@ static void shape_fallback(void) {
|
||||
static void decide(void) {
|
||||
if (R.decided) return;
|
||||
R.decided = 1;
|
||||
R.ow = BASE_W;
|
||||
R.oh = BASE_H;
|
||||
R.ow = R.aw = BASE_W;
|
||||
R.oh = R.ah = BASE_H;
|
||||
const char *o = cfg_value("TOTK_OUTPUT_RES");
|
||||
unsigned w = 0, h = 0;
|
||||
char tail;
|
||||
if (sscanf(o, "%ux%u%c", &w, &h, &tail) == 2 && w >= 1280 && h >= 720 && w <= 7680 && h <= 4320) {
|
||||
R.ow = w & ~1u;
|
||||
R.oh = h & ~1u;
|
||||
R.ow = R.aw = w & ~1u;
|
||||
R.oh = R.ah = h & ~1u;
|
||||
shape_fallback();
|
||||
} else {
|
||||
rt_log("resolution: TOTK_OUTPUT_RES=%s is not <width>x<height> in 1280x720..7680x4320; 1920x1080", o);
|
||||
@@ -677,6 +678,11 @@ void res_wanted(unsigned out[2]) {
|
||||
out[0] = R.ow, out[1] = R.oh;
|
||||
}
|
||||
|
||||
void res_asked(unsigned out[2]) {
|
||||
decide();
|
||||
out[0] = R.aw, out[1] = R.ah;
|
||||
}
|
||||
|
||||
// A TOTK_DLSS change while the game runs (vk_dlaa.c, at a present): the new scene size goes to the patch page, where
|
||||
// the game reads it when it sets its render size (main+0x585e48). 1.4.3 does that once, at start: its renderer setup
|
||||
// (main+0x7000e67028) calls main+0x585bd0(renderer, force), which picks the console mode's sizes and flags the render
|
||||
|
||||
+96
-64
@@ -1040,8 +1040,8 @@ static void overlay_init(void) {
|
||||
rt_log("RomFS overlay: the UI layout for %ux%u from %s", out[0], out[1], name);
|
||||
const char *suffix = hud_suffix(out[0], out[1]);
|
||||
if (*suffix && !ends_with(name, suffix))
|
||||
rt_log("RomFS overlay: the selected HUD layout is missing; using the full HUD. Prepare it in the "
|
||||
"Screen tab, rerun setup, or run tools/make_romfs_patches.py --aspect %ux%u --hud %s",
|
||||
rt_log("RomFS overlay: the selected HUD layout is missing; using the full HUD (an install makes it "
|
||||
"in the background below; a source build: tools/make_romfs_patches.py --aspect %ux%u --hud %s)",
|
||||
shape[0], shape[1], cfg_value("TOTK_HUD_WIDTH"));
|
||||
} else {
|
||||
rt_log("RomFS overlay: no %s for this game resolution, the UI keeps its 16:9 layout (run the setup again, "
|
||||
@@ -1076,8 +1076,8 @@ static void overlay_init(void) {
|
||||
if (prompts_wanted && !strcmp(prompts_folders[i].name, prompts_wanted)) wanted_dir = prompts_folders[i].dir;
|
||||
const char *suffix = hud_suffix(out[0], out[1]);
|
||||
if (wide && prompts_wanted && romfs_prompts_ready(prompts_wanted) && *suffix && !ends_with(wanted_dir, suffix))
|
||||
rt_log("RomFS overlay: the %s prompts have no selected HUD layout; their full HUD loads instead. Prepare "
|
||||
"the layout in the Screen tab or rerun setup", style);
|
||||
rt_log("RomFS overlay: the %s prompts have no selected HUD layout; their full HUD loads instead (an "
|
||||
"install makes it in the background below)", style);
|
||||
prompts_off = !prompts_wanted ? ROMFS_PROMPTS_OK
|
||||
: patches && !wide ? ROMFS_PROMPTS_PATCHES
|
||||
: !romfs_prompts_ready(prompts_wanted) ? (wide ? ROMFS_PROMPTS_SHAPE : ROMFS_PROMPTS_MISSING)
|
||||
@@ -1107,6 +1107,14 @@ static void overlay_init(void) {
|
||||
rt_log("RomFS overlay: prompts = %s, but %s; Switch prompts stay",
|
||||
pick == PROMPTS_PC ? "pc" : pick == PROMPTS_PLAYSTATION ? "playstation" : "xbox", why);
|
||||
}
|
||||
// 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.
|
||||
unsigned asked[2];
|
||||
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
|
||||
int plain_ok = snprintf(plain, sizeof plain, "%s/romfs-patches/manifest.tsv", index_dir) < (int)sizeof plain &&
|
||||
@@ -1180,14 +1188,19 @@ int romfs_shaped_ready(unsigned w, unsigned h) { return shaped_folder_ready("rom
|
||||
// loads in its place with those prompts.
|
||||
int romfs_shaped_prompts_ready(const char *folder, unsigned w, unsigned h) { return shaped_folder_ready(folder, w, h, 1); }
|
||||
|
||||
// ---- the layout for a new screen, from the settings menu (ui/menu.cpp row_output_res)
|
||||
// The setup writes the shaped folders for the displays connected when it ran (installer/steps.py Shapes). After a
|
||||
// monitor change the menu can start the same generator for the shape of the game resolution: the setup's Python and
|
||||
// tools/make_romfs_patches.py, which build-cache/rebuild.txt names (installer/steps.py write_rebuild_command: line 1 the
|
||||
// Python, pythonw on Windows, so no console opens; line 4 the setup's folder; both relative to the install folder for
|
||||
// the build kit, installer/layout.py), on the install folder's romfs/. Child
|
||||
// processes the game does not wait for: the generator writes manifest.tsv last, so a folder it has not finished is not
|
||||
// taken, and the next start loads the finished one.
|
||||
// ---- missing folders, made in the background (the settings menu, ui/menu.cpp folders_tick, and the start,
|
||||
// overlay_init)
|
||||
// The setup writes the 16:9 prompts' folders on every install (installer/steps.py Prepare, PcPrompts) and the shaped
|
||||
// folders for the displays connected when it ran (Shapes). An install by an older setup, a failed setup step, a
|
||||
// monitor change or a change of resolution, HUD width, prompts or pad layout can ask for a folder it did not write.
|
||||
// The game then starts the same generator: the setup's Python and tools/make_romfs_patches.py, which
|
||||
// build-cache/rebuild.txt names (installer/steps.py write_rebuild_command: line 1 the Python, pythonw on Windows, so
|
||||
// no console opens; line 4 the setup's folder; both relative to the install folder for the build kit,
|
||||
// installer/layout.py), on the install folder's romfs/. Child processes the game does not wait for. With --background
|
||||
// the generator writes into a folder of its own beside the output and renames it into place at the end, unless a
|
||||
// folder with a manifest is there by then: a folder this game or another start loaded is never written into, and two
|
||||
// generators for one folder (the menu and the start, or a restart while the last one runs) do not mix their files.
|
||||
// The next start loads the finished folder.
|
||||
static int prepare_tools(char *python, size_t pcap, char *script, size_t scap, char *dir, size_t dcap) {
|
||||
char path[2400];
|
||||
index_folder(dir, dcap);
|
||||
@@ -1216,14 +1229,24 @@ static int prepare_tools(char *python, size_t pcap, char *script, size_t scap, c
|
||||
return ok && plat_file_exists(python) && plat_file_exists(script) && plat_file_exists(path);
|
||||
}
|
||||
|
||||
int romfs_shape_missing(unsigned w, unsigned h, const char *prompts_folder) {
|
||||
unsigned out[2] = {w, h};
|
||||
if (cfg_get("TOTK_ROMFS_PATCHES") || !res_wants_wide_overlay(out)) return 0;
|
||||
return !shaped_folder_ready("romfs-patches", w, h, 0) ||
|
||||
(prompts_folder && !shaped_folder_ready(prompts_folder, w, h, 0));
|
||||
// 1 when folder (a name next to romfs-index.bin) has a manifest.
|
||||
static int plain_folder_ready(const char *folder) {
|
||||
char dir[2100], path[2400];
|
||||
index_folder(dir, sizeof dir);
|
||||
return snprintf(path, sizeof path, "%s/%s/manifest.tsv", dir, folder) < (int)sizeof path && plat_file_exists(path);
|
||||
}
|
||||
|
||||
int romfs_shape_can_prepare(void) {
|
||||
int romfs_folders_missing(unsigned w, unsigned h, const char *prompts_folder) {
|
||||
unsigned out[2] = {w, h};
|
||||
if (cfg_get("TOTK_ROMFS_PATCHES")) return 0;
|
||||
int need = prompts_folder && !plain_folder_ready(prompts_folder) ? ROMFS_NEED_PROMPTS : 0;
|
||||
if (!res_wants_wide_overlay(out)) return need;
|
||||
if (!shaped_folder_ready("romfs-patches", w, h, 0)) need |= ROMFS_NEED_LAYOUT;
|
||||
if (prompts_folder && !shaped_folder_ready(prompts_folder, w, h, 0)) need |= ROMFS_NEED_SHAPED_PROMPTS;
|
||||
return need;
|
||||
}
|
||||
|
||||
int romfs_folders_can_prepare(void) {
|
||||
static int known = -1;
|
||||
if (known < 0) {
|
||||
char python[1024], script[1100], dir[2100];
|
||||
@@ -1232,9 +1255,10 @@ int romfs_shape_can_prepare(void) {
|
||||
return known;
|
||||
}
|
||||
|
||||
// The folders a generator was started for in this process. The menu thread alone calls romfs_shape_prepare, so no
|
||||
// lock. The game picks its overlay at start, so a folder is not started twice before the next start, even when its
|
||||
// generator has ended: a second click, or the same size chosen again, starts no second generator writing into it.
|
||||
// The folders a generator was started for in this process, under shape_lock: the start (overlay_init) and the menu
|
||||
// thread both start them. The game picks its overlay at start, so a folder is not started twice before the next start,
|
||||
// even when its generator has ended: the same setting chosen again starts no second generator for it.
|
||||
static PlatMutex shape_lock = PLAT_MUTEX_INIT;
|
||||
static char (*shape_started)[160];
|
||||
static int shape_started_n, shape_started_cap;
|
||||
|
||||
@@ -1245,63 +1269,71 @@ static int shape_was_started(const char *folder) {
|
||||
}
|
||||
|
||||
// Starts the generator for folder (a name in dir) unless one was started for it before. 1 when one runs for it, 0 when
|
||||
// it could not start. plat_spawn starts it detached and closes its handles without waiting, so a click costs the menu
|
||||
// thread one CreateProcess.
|
||||
// it could not start. plat_spawn starts it detached and closes its handles without waiting, so a start costs the
|
||||
// calling thread one CreateProcess.
|
||||
static int shape_spawn(const char *const *argv, const char *dir, const char *folder) {
|
||||
if (shape_was_started(folder)) return 1;
|
||||
if (shape_started_n == shape_started_cap) {
|
||||
int cap = shape_started_cap ? shape_started_cap * 2 : 8;
|
||||
void *grown = realloc(shape_started, (size_t)cap * sizeof *shape_started);
|
||||
if (!grown) return 0; // never start a writer whose folder cannot be remembered for deduplication
|
||||
shape_started = grown;
|
||||
shape_started_cap = cap;
|
||||
plat_mutex_lock(&shape_lock);
|
||||
int ok = 1;
|
||||
if (!shape_was_started(folder)) {
|
||||
if (shape_started_n == shape_started_cap) {
|
||||
int cap = shape_started_cap ? shape_started_cap * 2 : 8;
|
||||
void *grown = realloc(shape_started, (size_t)cap * sizeof *shape_started);
|
||||
if (grown) shape_started = grown, shape_started_cap = cap;
|
||||
}
|
||||
// never start a writer whose folder cannot be remembered for deduplication
|
||||
ok = shape_started_n < shape_started_cap && plat_spawn(argv, dir);
|
||||
if (ok) snprintf(shape_started[shape_started_n++], sizeof *shape_started, "%s", folder);
|
||||
}
|
||||
if (!plat_spawn(argv, dir)) return 0;
|
||||
snprintf(shape_started[shape_started_n++], sizeof *shape_started, "%s", folder);
|
||||
return 1;
|
||||
plat_mutex_unlock(&shape_lock);
|
||||
return ok;
|
||||
}
|
||||
|
||||
int romfs_shape_prepare(unsigned w, unsigned h, const char *prompts_folder) {
|
||||
int romfs_folders_prepare(unsigned w, unsigned h, const char *prompts_folder) {
|
||||
char python[1024], script[1100], dir[2100], romfs[2200], out[2300], reuse[2300], binds[2300], size[32], version[8],
|
||||
name[128], folder[160];
|
||||
unsigned s[2];
|
||||
if (!cfg_shape_size(w, h, s) || !prepare_tools(python, sizeof python, script, sizeof script, dir, sizeof dir))
|
||||
return 0;
|
||||
folder[160];
|
||||
int need = romfs_folders_missing(w, h, prompts_folder);
|
||||
if (!need || !prepare_tools(python, sizeof python, script, sizeof script, dir, sizeof dir)) return 0;
|
||||
unsigned s[2] = {w, h};
|
||||
int shaped = cfg_shape_size(w, h, s);
|
||||
snprintf(size, sizeof size, "%ux%u", s[0], s[1]);
|
||||
snprintf(version, sizeof version, "v%d", rt_game_version);
|
||||
snprintf(romfs, sizeof romfs, "%s/romfs", dir);
|
||||
const char *suffix = hud_suffix(w, h), *hud = *suffix ? cfg_value("TOTK_HUD_WIDTH") : "full";
|
||||
const char *suffix = shaped ? hud_suffix(w, h) : "", *hud = *suffix ? cfg_value("TOTK_HUD_WIDTH") : "full";
|
||||
const char *style = prompts_folder ? prompts_folder + strlen("romfs-patches-") : NULL;
|
||||
// The keyboard and mouse prompts are drawn from totk.ini's bind_ lines, as the setup's PcPrompts and Shapes steps
|
||||
// draw them (installer/steps.py pc_binds); a file without such lines gives the keyboard defaults.
|
||||
snprintf(binds, sizeof binds, "%s/totk.ini", dir);
|
||||
int pc = style && !strcmp(style, "pc") && plat_file_exists(binds);
|
||||
static const int order[3] = {ROMFS_NEED_PROMPTS, ROMFS_NEED_LAYOUT, ROMFS_NEED_SHAPED_PROMPTS};
|
||||
int started = 0, failed = 0;
|
||||
if (!selected_shape(dir, "romfs-patches", w, h, name, sizeof name, 0)) {
|
||||
snprintf(folder, sizeof folder, "romfs-patches-%s%s", size, suffix);
|
||||
for (int k = 0; k < 3; k++) {
|
||||
int what = order[k];
|
||||
if (!(need & what) || (what != ROMFS_NEED_PROMPTS && !shaped)) continue;
|
||||
if (what == ROMFS_NEED_PROMPTS) snprintf(folder, sizeof folder, "%s", prompts_folder);
|
||||
else if (what == ROMFS_NEED_LAYOUT) snprintf(folder, sizeof folder, "romfs-patches-%s%s", size, suffix);
|
||||
else snprintf(folder, sizeof folder, "%s-%s%s", prompts_folder, size, suffix);
|
||||
snprintf(out, sizeof out, "%s/%s", dir, folder);
|
||||
const char *argv[] = {python, script, "--version", version, "--romfs", romfs, "--out", out, "--aspect", size,
|
||||
"--hud", hud, NULL};
|
||||
if (shape_spawn(argv, dir, folder)) started++;
|
||||
else failed++;
|
||||
}
|
||||
if (prompts_folder && !selected_shape(dir, prompts_folder, w, h, name, sizeof name, 0)) {
|
||||
const char *style = prompts_folder + strlen("romfs-patches-");
|
||||
snprintf(reuse, sizeof reuse, "%s/%s/manifest.tsv", dir, prompts_folder);
|
||||
int can_reuse = plat_file_exists(reuse);
|
||||
snprintf(reuse, sizeof reuse, "%s/%s", dir, prompts_folder);
|
||||
snprintf(folder, sizeof folder, "%s-%s%s", prompts_folder, size, suffix);
|
||||
snprintf(out, sizeof out, "%s/%s", dir, folder);
|
||||
// The keyboard and mouse prompts are drawn from totk.ini's bind_ lines, as the setup's PcPrompts and Shapes
|
||||
// steps draw them (installer/steps.py pc_binds); a file without such lines gives the keyboard defaults.
|
||||
snprintf(binds, sizeof binds, "%s/totk.ini", dir);
|
||||
int pc = !strcmp(style, "pc") && plat_file_exists(binds);
|
||||
const char *argv[24] = {python, script, "--version", version, "--romfs", romfs, "--out", out, "--prompts", style,
|
||||
"--aspect", size, "--hud", hud};
|
||||
int argc = 14;
|
||||
if (can_reuse) argv[argc++] = "--reuse", argv[argc++] = reuse;
|
||||
if (pc) argv[argc++] = "--binds", argv[argc++] = binds;
|
||||
const char *argv[24] = {python, script, "--version", version, "--romfs", romfs, "--out", out, "--background"};
|
||||
int argc = 9;
|
||||
if (what != ROMFS_NEED_LAYOUT) argv[argc++] = "--prompts", argv[argc++] = style;
|
||||
if (what != ROMFS_NEED_PROMPTS) {
|
||||
argv[argc++] = "--aspect", argv[argc++] = size;
|
||||
argv[argc++] = "--hud", argv[argc++] = hud;
|
||||
}
|
||||
// The shaped prompts differ from their 16:9 folder in the UI archive alone, so its fonts are linked, not
|
||||
// compressed again; a 16:9 folder still being made has nothing to link yet.
|
||||
if (what == ROMFS_NEED_SHAPED_PROMPTS && !(need & ROMFS_NEED_PROMPTS)) {
|
||||
snprintf(reuse, sizeof reuse, "%s/%s", dir, prompts_folder);
|
||||
argv[argc++] = "--reuse", argv[argc++] = reuse;
|
||||
}
|
||||
if (pc && what != ROMFS_NEED_LAYOUT) argv[argc++] = "--binds", argv[argc++] = binds;
|
||||
argv[argc] = NULL;
|
||||
if (shape_spawn(argv, dir, folder)) started++;
|
||||
else failed++;
|
||||
}
|
||||
rt_log("RomFS overlay: making the layout for %s in the background (%d generators running, %d failed; %s)", size,
|
||||
started, failed, script);
|
||||
rt_log("RomFS overlay: making %d missing folder%s for %ux%u%s%s in the background (%d failed to start; %s)",
|
||||
started + failed, started + failed == 1 ? "" : "s", w, h, style ? ", prompts " : "", style ? style : "",
|
||||
failed, script);
|
||||
return started && !failed;
|
||||
}
|
||||
|
||||
|
||||
+95
-40
@@ -499,6 +499,70 @@ static void row_window_size(void) {
|
||||
opt_choice_list("TOTK_WINDOW_SIZE", UI_MENU_WINDOW_SIZE, pv, pn, n, UI_MENU_WINDOW_SIZE_DESC);
|
||||
}
|
||||
|
||||
// ---- the folders the next start needs (romfs.c romfs_folders_missing): a game resolution of another shape needs its
|
||||
// layout's folder, and Xbox, PlayStation or PC prompts their folder, at that shape too. The setup writes them for the
|
||||
// displays it saw and the prompts totk.ini had then (installer/steps.py Prepare, PcPrompts, Shapes). When the
|
||||
// resolution, the HUD width, the prompts or the pad layout ask for one it lacks, the generator starts for the next
|
||||
// start (romfs_folders_prepare: child processes, the menu does not wait), once per request: a request stays the same
|
||||
// for SETTLE_NS first, so stepping through the sizes starts none for the ones passed. The notes under the resolution
|
||||
// and the prompts say so (row_output_res, prompts_note); when it could not start they say that and offer a retry. The
|
||||
// file checks run only when the request changes, after a settings change (cfg_version).
|
||||
enum { SETTLE_NS = 1500000000 };
|
||||
static struct {
|
||||
unsigned seen; // cfg_version of the last look at the settings
|
||||
char request[160]; // output_res|hud_width|prompts folder in the settings
|
||||
unsigned w, h;
|
||||
const char *want; // input_prompts_folder of the settings (a string literal), NULL for the game's own
|
||||
int missing; // ROMFS_NEED_* for request
|
||||
uint64_t at; // plat_now_ns from which request starts; 0 none waiting
|
||||
char asked[160]; // the request started last
|
||||
int started; // for asked: 1 running, -1 failed to start
|
||||
} g_folders = {~0u, "", 0, 0, nullptr, 0, 0, "", 0};
|
||||
|
||||
static void folders_start(void) {
|
||||
g_folders.at = 0;
|
||||
snprintf(g_folders.asked, sizeof g_folders.asked, "%s", g_folders.request);
|
||||
g_folders.started = romfs_folders_prepare(g_folders.w, g_folders.h, g_folders.want) ? 1 : -1;
|
||||
}
|
||||
|
||||
// On every frame the menu lays out (now: start a waiting request at once, as the menu closes). 1 while a request
|
||||
// waits.
|
||||
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 *want = input_prompts_folder(input_prompts_pick(cfg_get("TOTK_PROMPTS"), layout), layout);
|
||||
char request[sizeof g_folders.request];
|
||||
snprintf(request, sizeof request, "%s|%s|%s", res, 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;
|
||||
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()
|
||||
? plat_now_ns() + SETTLE_NS : 0;
|
||||
}
|
||||
}
|
||||
if (!g_folders.at || (!now && plat_now_ns() < g_folders.at)) return g_folders.at != 0;
|
||||
folders_start();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// What happens to the folders of the request in the settings that need (a mask of ROMFS_NEED_*): 0 none missing or
|
||||
// no tools to make them, 1 being made (or about to start), -1 the generator did not start.
|
||||
static int folders_state(int need) {
|
||||
if (!(g_folders.missing & need)) return 0;
|
||||
if (g_folders.at) return 1;
|
||||
return g_folders.started && !strcmp(g_folders.asked, g_folders.request) ? g_folders.started : 0;
|
||||
}
|
||||
|
||||
// The retry under a row whose folders did not start.
|
||||
static void folders_retry(const char *id, int need) {
|
||||
if (folders_state(need) < 0 && opt_button(id, UI_MENU_PREPARE_RETRY, UI_MENU_PREPARE_RETRY_DESC)) folders_start();
|
||||
}
|
||||
|
||||
// The game resolution (resolution.c): 16:9 sizes from its smallest, 1280x720 (for weak GPUs), up, the common 21:9 and
|
||||
// 32:9 monitor sizes, the 16:10 screens of the Steam Deck, handhelds and laptops and the 3:2 screens of laptops and
|
||||
// tablets (Surface, Framework; the camera and the HUD follow
|
||||
@@ -518,35 +582,18 @@ 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];
|
||||
}
|
||||
// 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[128];
|
||||
char request[128];
|
||||
const char *now = cfg_value("TOTK_OUTPUT_RES");
|
||||
const char *layout = cfg_value("TOTK_PAD_LAYOUT");
|
||||
const char *want = input_prompts_folder(input_prompts_pick(cfg_get("TOTK_PROMPTS"), layout), layout);
|
||||
snprintf(request, sizeof request, "%s|%s|%s", now, cfg_value("TOTK_HUD_WIDTH"), want ? want : "");
|
||||
if (seen != cfg_version()) {
|
||||
seen = cfg_version();
|
||||
unsigned w = 0, h = 0;
|
||||
missing = sscanf(now, "%ux%u", &w, &h) == 2 && romfs_shape_missing(w, h, want);
|
||||
}
|
||||
int here = started && !strcmp(asked, request); // resolution, selected HUD width and button prompts
|
||||
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);
|
||||
// A size of another shape needs that shape's folders (romfs.c overlay_init): the layout, and with Xbox,
|
||||
// PlayStation or PC prompts the prompts' one too. Without them the game draws 16:9 with bars or keeps the Switch
|
||||
// prompts; folders_tick starts their generator, and the row says they are being made, or that the setup's tools
|
||||
// are missing or did not start.
|
||||
const int need = ROMFS_NEED_LAYOUT | ROMFS_NEED_SHAPED_PROMPTS;
|
||||
int state = folders_state(need);
|
||||
const char *note = !(g_folders.missing & need) ? nullptr
|
||||
: state > 0 ? menu_text(UI_MENU_OUTPUT_RES_PREPARING)
|
||||
: state < 0 ? menu_text(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;
|
||||
sscanf(now, "%ux%u", &w, &h);
|
||||
snprintf(asked, sizeof asked, "%s", request);
|
||||
started = romfs_shape_prepare(w, h, want) ? 1 : -1;
|
||||
folders_retry("##shape_prepare", need);
|
||||
}
|
||||
|
||||
// Offer only caps narrower than the canonical layout, using the same tolerance as romfs.c hud_suffix and Shapes.
|
||||
@@ -895,10 +942,11 @@ static void row_quicksave_keys(void) {
|
||||
|
||||
// The note under the prompts. The settings name a folder of prompts (input_prompts_folder: the prompts and the pad
|
||||
// layout, as a layout that puts A on the right button needs the face buttons named the other way round), but the game
|
||||
// reads its fonts and UI archive once at start (romfs.c overlay_init). While the folder in use differs: "files
|
||||
// missing" when the setup did not write the one asked for, why it was left out at start (damaged, a game resolution
|
||||
// that is not 16:9, a RomFS mod with the same files, TOTK_ROMFS_PATCHES), else "prompts change after restart", and only then
|
||||
// *restart is set: a restart would bring the prompts asked for. NULL when they match.
|
||||
// reads its fonts and UI archive once at start (romfs.c overlay_init). While the folder in use differs: when the
|
||||
// install lacks the one asked for (folders_tick looked), that it is being made in the background, or that it is
|
||||
// missing (no setup's tools) or could not be made; else why it was left out at start (damaged, a RomFS mod with the
|
||||
// same files, TOTK_ROMFS_PATCHES), else "prompts change after restart", and only then *restart is set: a restart would
|
||||
// bring the prompts asked for. NULL when they match.
|
||||
static const char *prompts_note(bool *restart) {
|
||||
*restart = false;
|
||||
const char *layout = cfg_value("TOTK_PAD_LAYOUT"), *used = romfs_prompts();
|
||||
@@ -906,12 +954,15 @@ static const char *prompts_note(bool *restart) {
|
||||
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>, 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) {
|
||||
// the shape is the reason, not a damaged install.
|
||||
int need = g_folders.missing & (ROMFS_NEED_PROMPTS | ROMFS_NEED_SHAPED_PROMPTS), state = folders_state(need);
|
||||
if (state > 0) return menu_text(UI_MENU_PROMPTS_PREPARING);
|
||||
if (state < 0) return menu_text(UI_MENU_SHAPE_PREPARE_FAILED);
|
||||
if (need & ROMFS_NEED_PROMPTS) return menu_text(UI_MENU_PROMPTS_MISSING);
|
||||
if (need) return menu_text(UI_MENU_PROMPTS_OFF_SHAPE);
|
||||
// ROMFS_PROMPTS_MISSING and _SHAPE: the folder the start lacked is there now, or the resolution needs another one
|
||||
switch (romfs_prompts_off(want)) {
|
||||
case ROMFS_PROMPTS_FAILED: return menu_text(UI_MENU_PROMPTS_FAILED);
|
||||
case ROMFS_PROMPTS_SHAPE: return menu_text(UI_MENU_PROMPTS_OFF_SHAPE);
|
||||
case ROMFS_PROMPTS_MODS: return menu_text(UI_MENU_PROMPTS_OFF_MODS);
|
||||
case ROMFS_PROMPTS_PATCHES: return menu_text(UI_MENU_PROMPTS_OFF_PATCHES);
|
||||
default: *restart = true; return menu_text(UI_MENU_PROMPTS_RESTART);
|
||||
@@ -993,6 +1044,7 @@ static void tab_controls(float scale) {
|
||||
bool restart;
|
||||
const char *note = prompts_note(&restart);
|
||||
opt_choice("TOTK_PROMPTS", UI_MENU_PROMPTS, prompts, 4, UI_MENU_PROMPTS_DESC, note);
|
||||
folders_retry("##prompts_prepare", ROMFS_NEED_PROMPTS | ROMFS_NEED_SHAPED_PROMPTS);
|
||||
bool ask = restart && opt_button("##restart", UI_MENU_RESTART, UI_MENU_RESTART_DESC);
|
||||
opt_toggle("TOTK_MOTION", UI_MENU_MOTION, UI_MENU_MOTION_DESC);
|
||||
opt_toggle("TOTK_GYRO_CALIBRATION", UI_MENU_GYRO_CALIBRATION, UI_MENU_GYRO_CALIBRATION_DESC);
|
||||
@@ -1477,7 +1529,8 @@ static void layout_menu(uint32_t w, uint32_t h, float scale) {
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
static int g_save_pending; // a changed setting still waits for its write to totk.ini (opt_save_tick)
|
||||
// a changed setting still waits for its write to totk.ini (opt_save_tick) or for its folders to start (folders_tick)
|
||||
static int g_save_pending;
|
||||
|
||||
// ---- the performance overlay (TOTK_PERF_OVERLAY), in the top right corner. "fps": the frame rate over the presents of
|
||||
// the last half second. "full": a panel of perfmon.c's numbers, in the style of SavageWindRecomp's perf_overlay_draw
|
||||
@@ -1785,7 +1838,8 @@ extern "C" int menu_overlay_frame(uint64_t frame, const MenuTarget *t, const cha
|
||||
amiibo_tick();
|
||||
bool open = g_open.load(std::memory_order_relaxed);
|
||||
if (!open) {
|
||||
if (g_save_pending) g_save_pending = opt_save_tick(1); // closed: the last change goes to totk.ini now
|
||||
// closed: the last change goes to totk.ini now, and the folders it needs start being made
|
||||
if (g_save_pending) g_save_pending = opt_save_tick(1) | folders_tick(true);
|
||||
if (g_test.at && !g_test.opened && frame >= g_test.at) {
|
||||
g_test.opened = frame;
|
||||
g_test.page = 0;
|
||||
@@ -1842,11 +1896,12 @@ extern "C" int menu_overlay_frame(uint64_t frame, const MenuTarget *t, const cha
|
||||
}
|
||||
ImGui_ImplVulkan_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
int folders_wait = open ? folders_tick(false) : 0; // before the rows, whose notes it sets
|
||||
if (open) layout_menu(t->width, t->height, scale);
|
||||
perf_draw(t, scale);
|
||||
toast_draw(t, scale);
|
||||
ImGui::Render();
|
||||
if (open) g_save_pending = opt_save_tick(0);
|
||||
if (open) g_save_pending = opt_save_tick(0) | folders_wait;
|
||||
g_cost_ns += plat_now_ns() - t0;
|
||||
if (g_test.page >= 0 && frame >= g_test.opened + g_test.per_page * (uint64_t)(g_test.page + 1)) {
|
||||
static char path[512]; // this frame's image goes to a file; then the next tab, or the menu closes
|
||||
|
||||
+16
-12
@@ -70,7 +70,7 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_HUD_WIDTH] = "HUD width",
|
||||
[UI_MENU_HUD_WIDTH_DESC] = "On a screen wider than 16:9, how far apart the HUD's left and right sides are. Full puts "
|
||||
"them at the screen's edges; 21:9 or 16:9 keeps the HUD within the middle of the screen "
|
||||
"of that shape. Prepare a missing layout in this tab or rerun setup, then restart.",
|
||||
"of that shape. A missing layout is made in the background and used after a restart.",
|
||||
[UI_MENU_HUD_WIDTH_FULL] = "Full screen",
|
||||
[UI_MENU_RENDER_SCALE] = "3D render scale",
|
||||
[UI_MENU_RENDER_SCALE_DESC] = "Size of the 3D scene relative to the game resolution; the game's FSR scales it to "
|
||||
@@ -310,8 +310,9 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_PROMPTS_OFF_SHAPE] = "off at this game resolution (no layout made for it)",
|
||||
[UI_MENU_OUTPUT_RES_NO_LAYOUT] = "no layout made for this shape: run the setup again",
|
||||
[UI_MENU_OUTPUT_RES_PREPARING] = "layout being made in the background; used at the next start",
|
||||
[UI_MENU_SHAPE_PREPARE] = "Prepare the layout for this screen",
|
||||
[UI_MENU_SHAPE_PREPARE_DESC] = "Makes the interface layout and the chosen button prompts for this game resolution's shape in the background, with the setup's tools, as the setup does for the displays it saw. The game keeps running; it uses them from its next start.",
|
||||
[UI_MENU_PROMPTS_PREPARING] = "prompt files being made in the background; used at the next start",
|
||||
[UI_MENU_PREPARE_RETRY] = "Try again",
|
||||
[UI_MENU_PREPARE_RETRY_DESC] = "Starts the setup's tools again to make the missing interface layout or button prompt files in the background. The game keeps running; it uses them from its next start.",
|
||||
[UI_MENU_SHAPE_PREPARE_FAILED] = "the setup's tools did not start: run the setup again",
|
||||
[UI_MENU_PROMPTS_OFF_MODS] = "off: a RomFS mod replaces their files",
|
||||
[UI_MENU_PROMPTS_OFF_PATCHES] = "off while TOTK_ROMFS_PATCHES is set",
|
||||
@@ -676,7 +677,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_HUD_WIDTH] = "Ширина интерфейса",
|
||||
[UI_MENU_HUD_WIDTH_DESC] = "На экране шире 16:9: как далеко друг от друга левая и правая части интерфейса. "
|
||||
"«Весь экран» ставит их у краёв экрана; 21:9 или 16:9 держит интерфейс в середине "
|
||||
"экрана такой формы. Подготовьте недостающую раскладку на этой вкладке или повторите установку, затем перезапустите игру.",
|
||||
"экрана такой формы. Недостающая раскладка создаётся в фоне и будет после перезапуска.",
|
||||
[UI_MENU_HUD_WIDTH_FULL] = "Весь экран",
|
||||
[UI_MENU_RENDER_SCALE] = "Масштаб 3D-отрисовки",
|
||||
[UI_MENU_RENDER_SCALE_DESC] = "Размер 3D-сцены относительно разрешения игры; FSR игры доводит её до этого размера. "
|
||||
@@ -915,8 +916,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_PROMPTS_OFF_SHAPE] = "выкл. при этом разрешении игры (для него нет раскладки)",
|
||||
[UI_MENU_OUTPUT_RES_NO_LAYOUT] = "для этой формы нет раскладки: запустите установщик снова",
|
||||
[UI_MENU_OUTPUT_RES_PREPARING] = "раскладка создаётся в фоне; будет при следующем запуске",
|
||||
[UI_MENU_SHAPE_PREPARE] = "Подготовить раскладку для этого экрана",
|
||||
[UI_MENU_SHAPE_PREPARE_DESC] = "Создаёт в фоне раскладку интерфейса и выбранные подсказки кнопок для формы этого разрешения игры инструментами установщика, как установщик делает для мониторов, которые видел. Игра продолжает работать; раскладка будет со следующего запуска.",
|
||||
[UI_MENU_PROMPTS_PREPARING] = "файлы подсказок создаются в фоне; будут при следующем запуске",
|
||||
[UI_MENU_PREPARE_RETRY] = "Повторить",
|
||||
[UI_MENU_PREPARE_RETRY_DESC] = "Снова запускает инструменты установщика, чтобы создать в фоне недостающую раскладку интерфейса или файлы подсказок кнопок. Игра продолжает работать; они будут со следующего запуска.",
|
||||
[UI_MENU_SHAPE_PREPARE_FAILED] = "инструменты установщика не запустились: запустите установщик снова",
|
||||
[UI_MENU_PROMPTS_OFF_MODS] = "выкл.: мод RomFS заменяет их файлы",
|
||||
[UI_MENU_PROMPTS_OFF_PATCHES] = "выкл., пока задан TOTK_ROMFS_PATCHES",
|
||||
@@ -1323,7 +1325,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_HUD_WIDTH] = "Largura do HUD",
|
||||
[UI_MENU_HUD_WIDTH_DESC] = "Em uma tela mais larga que 16:9: a distância entre os lados esquerdo e direito do HUD. "
|
||||
"Tela cheia os coloca nas bordas da tela; 21:9 ou 16:9 mantém o HUD no meio da tela "
|
||||
"desse formato. Prepare o layout ausente nesta aba ou execute a instalação novamente e reinicie o jogo.",
|
||||
"desse formato. Um layout ausente é feito em segundo plano e usado depois de reiniciar o jogo.",
|
||||
[UI_MENU_HUD_WIDTH_FULL] = "Tela cheia",
|
||||
[UI_MENU_RENDER_SCALE] = "Escala da renderização 3D",
|
||||
[UI_MENU_RENDER_SCALE_DESC] = "Tamanho da cena 3D em relação à resolução do jogo; o FSR do jogo a amplia até esse "
|
||||
@@ -1730,8 +1732,9 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_PROMPTS_OFF_SHAPE] = "desligados nesta resolução de jogo (sem layout feito para ela)",
|
||||
[UI_MENU_OUTPUT_RES_NO_LAYOUT] = "sem layout feito para este formato: rode o instalador de novo",
|
||||
[UI_MENU_OUTPUT_RES_PREPARING] = "layout sendo feito em segundo plano; usado na próxima vez que o jogo abrir",
|
||||
[UI_MENU_SHAPE_PREPARE] = "Preparar o layout para esta tela",
|
||||
[UI_MENU_SHAPE_PREPARE_DESC] = "Faz em segundo plano o layout da interface e os botões escolhidos para o formato desta resolução de jogo, com as ferramentas do instalador, como o instalador faz para os monitores que viu. O jogo continua rodando; ele os usa a partir da próxima vez que abrir.",
|
||||
[UI_MENU_PROMPTS_PREPARING] = "arquivos dos ícones sendo feitos em segundo plano; usados na próxima vez que o jogo abrir",
|
||||
[UI_MENU_PREPARE_RETRY] = "Tentar de novo",
|
||||
[UI_MENU_PREPARE_RETRY_DESC] = "Abre de novo as ferramentas do instalador para fazer em segundo plano o layout da interface ou os arquivos dos ícones que faltam. O jogo continua rodando; ele os usa a partir da próxima vez que abrir.",
|
||||
[UI_MENU_SHAPE_PREPARE_FAILED] = "as ferramentas do instalador não abriram: rode o instalador de novo",
|
||||
[UI_MENU_PROMPTS_OFF_MODS] = "desligados: um mod de RomFS substitui os arquivos deles",
|
||||
[UI_MENU_PROMPTS_OFF_PATCHES] = "desligados enquanto TOTK_ROMFS_PATCHES está definido",
|
||||
@@ -1979,7 +1982,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_HUD_WIDTH] = "界面宽度",
|
||||
[UI_MENU_HUD_WIDTH_DESC] = "在比 16:9 更宽的屏幕上,界面左右两侧相距多远。"
|
||||
"“整个屏幕”把它们放在屏幕边缘;21:9 或 16:9 则把界面保持在屏幕中间该比例的区域内。"
|
||||
"请在此选项卡准备缺少的布局,或重新运行安装程序,然后重启游戏。",
|
||||
"缺少的布局会在后台制作,重启游戏后生效。",
|
||||
[UI_MENU_HUD_WIDTH_FULL] = "整个屏幕",
|
||||
[UI_MENU_RENDER_SCALE] = "3D 渲染比例",
|
||||
[UI_MENU_RENDER_SCALE_DESC] = "3D 场景相对于游戏分辨率的尺寸;"
|
||||
@@ -2480,8 +2483,9 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_PROMPTS_OFF_SHAPE] = "此游戏分辨率下关闭(未为其制作布局)",
|
||||
[UI_MENU_OUTPUT_RES_NO_LAYOUT] = "未为此比例制作布局:请重新运行安装程序",
|
||||
[UI_MENU_OUTPUT_RES_PREPARING] = "布局正在后台制作;下次启动时使用",
|
||||
[UI_MENU_SHAPE_PREPARE] = "为此屏幕准备布局",
|
||||
[UI_MENU_SHAPE_PREPARE_DESC] = "使用安装程序的工具,在后台为此游戏分辨率的比例制作界面布局和所选按键提示,与安装程序为其检测到的显示器所做的相同。游戏继续运行;下次启动时生效。",
|
||||
[UI_MENU_PROMPTS_PREPARING] = "按键提示文件正在后台制作;下次启动时使用",
|
||||
[UI_MENU_PREPARE_RETRY] = "重试",
|
||||
[UI_MENU_PREPARE_RETRY_DESC] = "再次启动安装程序的工具,在后台制作缺少的界面布局或按键提示文件。游戏继续运行;下次启动时生效。",
|
||||
[UI_MENU_SHAPE_PREPARE_FAILED] = "安装程序的工具未能启动:请重新运行安装程序",
|
||||
[UI_MENU_PROMPTS_OFF_MODS] = "已关闭:RomFS 模组替换了它们的文件",
|
||||
[UI_MENU_PROMPTS_OFF_PATCHES] = "设置了 TOTK_ROMFS_PATCHES 时关闭",
|
||||
|
||||
+3
-2
@@ -137,8 +137,9 @@ typedef enum {
|
||||
UI_MENU_PROMPTS_PC,
|
||||
// the notes under the prompts: their files are missing or damaged, they change after restart, or why they are off
|
||||
UI_MENU_PROMPTS_MISSING, UI_MENU_PROMPTS_FAILED, UI_MENU_PROMPTS_RESTART, UI_MENU_PROMPTS_OFF_SHAPE,
|
||||
UI_MENU_OUTPUT_RES_NO_LAYOUT, UI_MENU_OUTPUT_RES_PREPARING, UI_MENU_SHAPE_PREPARE, UI_MENU_SHAPE_PREPARE_DESC,
|
||||
UI_MENU_SHAPE_PREPARE_FAILED,
|
||||
// the missing layout and prompts' folders, which the game makes in the background (ui/menu.cpp folders_tick)
|
||||
UI_MENU_OUTPUT_RES_NO_LAYOUT, UI_MENU_OUTPUT_RES_PREPARING, UI_MENU_PROMPTS_PREPARING, UI_MENU_SHAPE_PREPARE_FAILED,
|
||||
UI_MENU_PREPARE_RETRY, UI_MENU_PREPARE_RETRY_DESC,
|
||||
UI_MENU_PROMPTS_OFF_MODS, UI_MENU_PROMPTS_OFF_PATCHES,
|
||||
// "Restart now" under the prompts while they change after restart, and its confirmation (Cancel: UI_MENU_RESET_NO)
|
||||
UI_MENU_RESTART, UI_MENU_RESTART_DESC, UI_MENU_RESTART_CONFIRM, UI_MENU_RESTART_YES, UI_MENU_RESTART_SAVING,
|
||||
|
||||
+57
-20
@@ -20,6 +20,7 @@ HARNESS = r'''
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "cfg.h"
|
||||
#include "fs.h"
|
||||
#include "host.h"
|
||||
#include "platform/platform.h"
|
||||
#include "shape_functions.h"
|
||||
@@ -50,10 +51,16 @@ uint8_t *plat_file_read(const char *p,uint64_t *size) {
|
||||
uint8_t *b=calloc(1,*size+1); assert(b); assert(fread(b,1,*size,f)==*size); fclose(f); return b;
|
||||
}
|
||||
int plat_exe_path(char *out,size_t cap) { (void)out;(void)cap;abort(); }
|
||||
static int locked;
|
||||
void plat_mutex_lock(PlatMutex *m) { (void)m; assert(!locked); locked=1; }
|
||||
void plat_mutex_unlock(PlatMutex *m) { (void)m; assert(locked); locked=0; }
|
||||
void rt_fatal(const char *fmt,...) { (void)fmt;abort(); }
|
||||
void rt_log(const char *fmt,...) { (void)fmt; }
|
||||
static int spawn_fails;
|
||||
int plat_spawn(const char *const *args,const char *cwd) {
|
||||
assert(cwd && *cwd); spawns++;
|
||||
assert(cwd && *cwd && locked);
|
||||
if (spawn_fails) return 0;
|
||||
spawns++;
|
||||
int i; for (i=0;args[i];i++) { assert(i<23); snprintf(args_test[i],sizeof args_test[i],"%s",args[i]); }
|
||||
args_test[i][0]=0; return 1;
|
||||
}
|
||||
@@ -61,6 +68,10 @@ static const char *arg(const char *key) {
|
||||
for (int i=0;args_test[i][0];i++) if (!strcmp(args_test[i],key)) return args_test[i+1];
|
||||
return NULL;
|
||||
}
|
||||
static int has(const char *flag) {
|
||||
for (int i=0;args_test[i][0];i++) if (!strcmp(args_test[i],flag)) return 1;
|
||||
return 0;
|
||||
}
|
||||
static void output_ends(const char *suffix) {
|
||||
const char *p=arg("--out"); assert(p && strlen(p)>=strlen(suffix));
|
||||
assert(!strcmp(p+strlen(p)-strlen(suffix),suffix));
|
||||
@@ -77,28 +88,51 @@ int main(int argc,char **argv) {
|
||||
assert(selected_shape(base,"romfs-patches",5120,1440,name,sizeof name,1));
|
||||
assert(!strcmp(name,"romfs-patches-3840x1080"));
|
||||
assert(!selected_shape(base,"romfs-patches",5120,1440,name,sizeof name,0));
|
||||
assert(romfs_shape_missing(5120,1440,NULL));
|
||||
override_test="0"; assert(!romfs_shape_missing(5120,1440,NULL)); override_test=NULL;
|
||||
assert(!romfs_shape_missing(1920,1080,NULL));
|
||||
assert(romfs_folders_missing(5120,1440,NULL)==ROMFS_NEED_LAYOUT);
|
||||
override_test="0"; assert(!romfs_folders_missing(5120,1440,NULL)); override_test=NULL;
|
||||
assert(!romfs_folders_missing(1920,1080,NULL));
|
||||
assert(romfs_folders_missing(1920,1080,"romfs-patches-pc")==ROMFS_NEED_PROMPTS);
|
||||
snprintf(index_test,sizeof index_test,"%s/generation/romfs-index.bin",argv[1]);
|
||||
hud_test="16:9";
|
||||
assert(romfs_shape_prepare(5120,2160,"romfs-patches-pc")); assert(spawns==2);
|
||||
// Nothing missing: no generator, no log line
|
||||
assert(!romfs_folders_prepare(1920,1080,"romfs-patches-xbox")); assert(spawns==0);
|
||||
assert(romfs_folders_prepare(5120,2160,"romfs-patches-pc")); assert(spawns==2);
|
||||
assert(has("--background"));
|
||||
assert(!strcmp(arg("--aspect"),"2560x1080")); assert(!strcmp(arg("--hud"),"16:9"));
|
||||
assert(!strcmp(arg("--version"),"v143")); assert(!strcmp(arg("--prompts"),"pc"));
|
||||
assert(arg("--reuse") && strstr(arg("--reuse"),"/romfs-patches-pc"));
|
||||
assert(arg("--binds") && strstr(arg("--binds"),"/totk.ini")); assert(!args_test[18][0]); output_ends("romfs-patches-pc-2560x1080-hud16x9");
|
||||
assert(romfs_shape_prepare(5120,2160,"romfs-patches-pc")); assert(spawns==2);
|
||||
assert(arg("--binds") && strstr(arg("--binds"),"/totk.ini")); assert(!args_test[19][0]); output_ends("romfs-patches-pc-2560x1080-hud16x9");
|
||||
assert(romfs_folders_prepare(5120,2160,"romfs-patches-pc")); assert(spawns==2);
|
||||
hud_test="full";
|
||||
assert(romfs_shape_prepare(5120,2160,"romfs-patches-xbox")); assert(spawns==4);
|
||||
assert(romfs_folders_prepare(5120,2160,"romfs-patches-xbox")); assert(spawns==4);
|
||||
assert(!strcmp(arg("--hud"),"full")); assert(!strcmp(arg("--prompts"),"xbox"));
|
||||
assert(arg("--reuse") && !arg("--binds")); output_ends("romfs-patches-xbox-2560x1080");
|
||||
hud_test="21:9";
|
||||
assert(romfs_shape_prepare(5120,1440,"romfs-patches-xbox-label")); assert(spawns==6);
|
||||
// The 16:9 xbox-label folder is missing too: it is made first (no --aspect), and the shaped one cannot link it
|
||||
assert(romfs_folders_prepare(5120,1440,"romfs-patches-xbox-label")); assert(spawns==7);
|
||||
assert(!strcmp(arg("--hud"),"21:9")); assert(!strcmp(arg("--prompts"),"xbox-label"));
|
||||
assert(!arg("--reuse") && !arg("--binds")); output_ends("romfs-patches-xbox-label-3840x1080-hud21x9");
|
||||
// A cap wider than a tall canvas becomes full, never an invalid generator request.
|
||||
assert(romfs_shape_prepare(1280,800,NULL)); assert(spawns==7);
|
||||
assert(romfs_folders_prepare(1280,800,NULL)); assert(spawns==8);
|
||||
assert(!strcmp(arg("--hud"),"full")); output_ends("romfs-patches-1280x800");
|
||||
// Missing 16:9 prompts at 16:9: only that folder, without --aspect or --hud; pc takes totk.ini's binds
|
||||
hud_test="16:9";
|
||||
snprintf(index_test,sizeof index_test,"%s/sixteen/romfs-index.bin",argv[1]);
|
||||
assert(romfs_folders_prepare(1920,1080,"romfs-patches-pc")); assert(spawns==9);
|
||||
assert(!strcmp(arg("--prompts"),"pc") && !arg("--aspect") && !arg("--hud") && !arg("--reuse"));
|
||||
assert(arg("--binds") && has("--background")); output_ends("/romfs-patches-pc");
|
||||
assert(romfs_folders_prepare(1920,1080,"romfs-patches-pc")); assert(spawns==9); // once per process
|
||||
assert(romfs_folders_prepare(2560,1440,"romfs-patches-playstation")); assert(spawns==10);
|
||||
assert(!strcmp(arg("--prompts"),"playstation") && !arg("--binds")); output_ends("/romfs-patches-playstation");
|
||||
// A generator that does not start is not remembered: the menu's retry starts it
|
||||
spawn_fails=1;
|
||||
assert(!romfs_folders_prepare(1920,1080,"romfs-patches-xbox")); assert(spawns==10);
|
||||
spawn_fails=0;
|
||||
assert(romfs_folders_prepare(1920,1080,"romfs-patches-xbox")); assert(spawns==11);
|
||||
// Without the setup's tools nothing starts
|
||||
snprintf(index_test,sizeof index_test,"%s/selection/romfs-index.bin",argv[1]);
|
||||
assert(!romfs_folders_can_prepare() && !romfs_folders_prepare(1920,1080,"romfs-patches-xbox-label"));
|
||||
assert(spawns==11);
|
||||
// Beyond the old eight-folder limit every new folder must still be remembered.
|
||||
const char *dummy[]={"python","script",NULL};
|
||||
for (int i=0;i<12;i++) {
|
||||
@@ -120,9 +154,10 @@ def production_functions():
|
||||
source = (ROOT / 'runtime/romfs.c').read_text()
|
||||
names = ('need', 'hud_suffix', 'shaped_name', 'selected_shape', 'index_path', 'index_folder',
|
||||
'shaped_folder_ready', 'romfs_shaped_ready', 'romfs_shaped_prompts_ready', 'prepare_tools',
|
||||
'romfs_shape_missing', 'shape_was_started', 'shape_spawn', 'romfs_shape_prepare')
|
||||
state = re.findall(r'(?m)^static [^;\n]*\bshape_started[^;\n]*;', source)
|
||||
assert len(state) == 2, 'update harness extraction for changed generation cache declarations'
|
||||
'plain_folder_ready', 'romfs_folders_missing', 'romfs_folders_can_prepare', 'shape_was_started',
|
||||
'shape_spawn', 'romfs_folders_prepare')
|
||||
state = re.findall(r'(?m)^static [^;\n]*\bshape_(?:started|lock)[^;\n]*;', source)
|
||||
assert len(state) == 3, 'update harness extraction for changed generation cache declarations'
|
||||
functions = []
|
||||
for name in names:
|
||||
match = re.search(r'(?m)^[^\n;{}]*\b' + name + r'\([^;{}]*?\)\s*\{', source)
|
||||
@@ -153,13 +188,15 @@ def main():
|
||||
manifest.parent.mkdir(parents=True, exist_ok=True)
|
||||
manifest.write_text('# synthetic\n')
|
||||
generation = folder / 'generation'
|
||||
for name in ('build-cache', 'romfs', 'tools', 'romfs-patches-pc', 'romfs-patches-xbox'):
|
||||
(generation / name).mkdir(parents=True, exist_ok=True)
|
||||
for name in ('romfs/romfs.bin', 'tools/make_romfs_patches.py', 'fake-python', 'totk.ini',
|
||||
'romfs-patches-pc/manifest.tsv', 'romfs-patches-xbox/manifest.tsv'):
|
||||
(generation / name).write_text('# synthetic\n')
|
||||
(generation / 'build-cache/rebuild.txt').write_text(
|
||||
f'{(generation / "fake-python").as_posix()}\n-c\nunused\n{generation.as_posix()}\n')
|
||||
for install, prompts in ((folder / 'generation', ('romfs-patches-pc', 'romfs-patches-xbox')),
|
||||
(folder / 'sixteen', ())): # an older setup's install without the prompts' folders
|
||||
for name in ('build-cache', 'romfs', 'tools', *prompts):
|
||||
(install / name).mkdir(parents=True, exist_ok=True)
|
||||
for name in ('romfs/romfs.bin', 'tools/make_romfs_patches.py', 'fake-python', 'totk.ini',
|
||||
*(f'{p}/manifest.tsv' for p in prompts)):
|
||||
(install / name).write_text('# synthetic\n')
|
||||
(install / 'build-cache/rebuild.txt').write_text(
|
||||
f'{(install / "fake-python").as_posix()}\n-c\nunused\n{install.as_posix()}\n')
|
||||
(folder / 'shape_functions.h').write_text(production_functions())
|
||||
source = folder / 'harness.c'
|
||||
source.write_text(HARNESS)
|
||||
|
||||
Reference in new issue
Block a user