Rebuild the game at start when an enabled mod has unbuilt code cheats

Code cheats need the game lifted and compiled with them. Running the setup
again did that, but it lifted and compiled everything and prepared the
shaders again.

- The setup keeps the generated C and the objects in its temp folder (about
  1.3 GB). gen.py rewrites only the chunks whose C changed, so Ninja
  recompiles only those. One new code cheat on 1.4.3 took a 47 s lift and
  19 s of compile and link on 24 cores.
- Prepare's key no longer follows the compile key, only the runtime, the
  translator and the game version, so a rebuild keeps the prepared shaders.
- The cleanup writes build-cache/rebuild.txt, the command that opens the
  setup window in a new --rebuild mode on the install folder. That mode runs
  at once and starts the game again when it succeeds.
- At start, runtime/cheats.c runs that command and exits when an enabled
  mod has code cheats the build lacks (plat_spawn, new for Windows and
  Linux). build-cache/rebuild.skip keeps a failed or cancelled rebuild from
  starting again for the same cheats. "Rebuild the game now" on the Cheats
  tab tries again, and [mods] mods_rebuild = off turns the rebuild off.
  Scripted runs never start it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-01 14:16:53 +03:00
1 parent 3dd7f846b8
commit 1bebcfd9ef
21 files changed
+337 -48

No files matched your search

+3 -2
View File
@@ -43,7 +43,7 @@ static const char *const known[] = {
"FULLSCREEN", "FXAA", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "HDR", "HDR_GAME_NITS",
"HDR_PEAK_NITS", "HDR_UI_NITS", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "LANG", "LIB_PREBUILD",
"LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MEMORY", "MENU_LANG", "MENU_TEST",
"MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MOTION", "MOUSE_SENS", "MOVIE_HOST", "MOVIE_PACE",
"MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MODS_REBUILD", "MOTION", "MOUSE_SENS", "MOVIE_HOST", "MOVIE_PACE",
"ONE_PER_CORE", "OPERATION_MODE", "OUTPUT_RES", "PAD_LAYOUT", "PATCH_OUTPUT", "PATCH_SCENE", "PCSS", "PCSS_K", "PERF_OVERLAY", "PERF_SLOW_MS", "PIPELINE_CACHE", "PIPE_MEMO", "PIPE_PREBUILD", "PIPE_SKIP", "PIPE_SYNC", "PIPE_WAIT",
"PREWARM_XLATE", "PROBE_MOVIE", "PROBE_MOVIE_SHOT", "PROFILE", "PROFILE_CHAINS", "PROFILE_DIR", "PROFILE_FRAMES",
"PROFILE_MAIN", "PROFILE_RENDER", "PROMPTS", "PUSH_SKIP", "PUSH_STAGE", "RDOC", "RDOC_DIR", "RDOC_DLL", "REALTIME", "REC_END", "REEXEC",
@@ -74,7 +74,7 @@ static const struct { const char *key, *section; } sections[] = {
{"DEVICE_PROFILE", "display"}, {"ASSUME_FOCUS", "display"},
{"SHADOW_SCALE", "display"}, {"SHADOW_RANGE", "display"}, {"CONTACT_SHADOWS", "display"},
{"PCSS", "display"},
{"MODS_DIR", "mods"}, {"MODS_ORDER", "mods"}, {"MODS_DISABLED", "mods"},
{"MODS_DIR", "mods"}, {"MODS_ORDER", "mods"}, {"MODS_DISABLED", "mods"}, {"MODS_REBUILD", "mods"},
{"MENU_LANG", "language"}, {"LANG", "language"}, {"OPERATION_MODE", "language"},
{"VOLUME", "audio"},
{"MOTION", "input"}, {"RUMBLE_STRENGTH", "input"}, {"RUMBLE_CURVE", "input"}, {"RUMBLE_TRIGGERS", "input"},
@@ -129,6 +129,7 @@ static const CfgMeta metas[] = {
// Game
{"FPS_LIMIT", "60", "30|40|45|60|90|120|144|display", LIVE}, {"FPS60", "1", "0|1", LIVE},
{"REALTIME", "1", "0|1", RESTART}, {"CLOTH_REALTIME", "1", "0|1", RESTART},
{"MODS_REBUILD", "auto", "auto|off", RESTART},
{"HIGHFPS_FIX", "1", "0|1", RESTART},
{"LANG", "", "ja|en-US|fr|de|it|es|zh-CN|ko|nl|pt|ru|zh-TW|en-GB|fr-CA|es-419|zh-Hans|zh-Hant|pt-BR", RESTART},
{"OPERATION_MODE", "docked", "docked|handheld", RESTART},
+84 -2
View File
@@ -42,6 +42,7 @@ typedef struct {
uint32_t *words;
int n;
int dup; // 1 for the first cheat of its name in its file, 2 for the next ...
uint32_t content; // FNV-1a 32 of its words as tools/cheats.py writes them
int set; // patch set, -1 none
volatile int32_t on;
char note[STATUS_MAX];
@@ -50,6 +51,7 @@ typedef struct {
static Cheat *g_cheats;
static int g_n, g_cap, g_vm; // g_vm: some cheat needs cheats_frame
static char g_file[64]; // "<build id>.txt"
static char g_dir[PLAT_PATH_MAX]; // the folder of totk.exe, with a trailing separator
static int g_files; // mods whose file was read
static uint64_t g_main, g_main_size, g_code_end; // main's image; its code with the padding up to .rodata
@@ -438,10 +440,74 @@ static void plain_name(char *s) {
}
}
// ---- rebuild: code cheats the build lacks
// The setup writes build-cache\rebuild.txt (installer/steps.py write_rebuild_command), the command that starts its
// window in rebuild mode on this install folder, one argument per line. When an enabled mod has code cheats this build
// lacks (CHEAT_REBUILD), the game runs it and exits; the setup lifts and compiles them in and starts the game again.
// build-cache\rebuild.skip holds the key of the cheats a rebuild was started for: a rebuild that failed or was
// cancelled leaves them unbuilt, and the same set does not start it again. TOTK_MODS_REBUILD=off never starts it.
// Scripted runs (--seconds, --boot) never start it.
static void rebuild_if_needed(const char *dir) {
uint32_t key = 0x811C9DC5u;
int need = 0;
for (int i = 0; i < g_n; i++) {
const Cheat *c = &g_cheats[i];
if (c->info.kind != CHEAT_REBUILD) continue;
need++;
key = (key ^ fnv(c->info.key, strlen(c->info.key))) * 0x01000193u;
key = (key ^ c->content) * 0x01000193u;
}
if (!need) return;
char cmd_path[PLAT_PATH_MAX + 64], skip_path[PLAT_PATH_MAX + 64], skip[16] = "", want[16];
snprintf(cmd_path, sizeof cmd_path, "%sbuild-cache" SEP "rebuild.txt", dir);
snprintf(skip_path, sizeof skip_path, "%sbuild-cache" SEP "rebuild.skip", dir);
snprintf(want, sizeof want, "%08X", key);
char *old = read_text(skip_path);
if (old) snprintf(skip, sizeof skip, "%.8s", old);
free(old);
const char *why = !strcmp(cfg_value("TOTK_MODS_REBUILD"), "off") ? "mods_rebuild = off"
: rt_config()->seconds || rt_config()->boot ? "a scripted run"
: !strcmp(skip, want) ? "the last rebuild for them failed or was cancelled"
: NULL;
char *cmd = why ? NULL : read_text(cmd_path);
if (!why && !cmd) why = "no build-cache/rebuild.txt (a build without the setup)";
if (why) {
rt_log("cheats: %d code cheats are not built into the game; no rebuild: %s", need, why);
free(cmd);
return;
}
const char *argv[32];
int argc = 0;
for (char *line = cmd; line && *line && argc < 31;) {
char *end = strchr(line, '\n'), *next = end ? end + 1 : NULL;
if (end) *end = 0;
size_t n = strlen(line);
if (n && line[n - 1] == '\r') line[n - 1] = 0;
if (*line) argv[argc++] = line;
line = next;
}
argv[argc] = NULL;
if (argc < 2 || !plat_file_write(skip_path, want, strlen(want))) {
rt_log("cheats: %d code cheats are not built into the game; cannot start the rebuild (%s)", need, cmd_path);
free(cmd);
return;
}
rt_log("cheats: %d code cheats are not built into the game; starting the rebuild: %s", need, argv[0]);
int ok = plat_spawn(argv, dir);
free(cmd);
if (!ok) {
rt_log("cheats: the rebuild did not start; the game starts with the code it has");
return;
}
prof_write(); // plat_exit runs no atexit handlers
plat_exit(0);
}
void cheats_init(void) {
const RtLoaded *m = ldr_count() ? ldr_module(0) : NULL;
char dir[PLAT_PATH_MAX], bid[17], path[2400]; // path: a mod's cheats folder (ModInfo.cheats) + the file
if (!m || !exe_dir(dir, sizeof dir) || !build_id(bid)) return;
snprintf(g_dir, sizeof g_dir, "%s", dir);
g_main = m->base;
g_main_size = m->size;
g_code_end = m->base + ((m->text_end + 0xFFF) & ~0xFFFull);
@@ -479,7 +545,8 @@ void cheats_init(void) {
if (!t) rt_fatal("cheats: out of memory");
t[0] = 0;
for (int k = 0; k < c->n; k++) tl += (size_t)snprintf(t + tl, tn - tl, k ? " %08X" : "%08X", c->words[k]);
snprintf(content, sizeof content, "%08X", fnv(t, tl));
c->content = fnv(t, tl);
snprintf(content, sizeof content, "%08X", c->content);
free(t);
snprintf(c->info.key, sizeof c->info.key, "TOTK_CHEAT_%s", key);
int master = c->info.kind == CHEAT_MASTER;
@@ -511,16 +578,31 @@ void cheats_init(void) {
counts[kind]++;
}
free(status);
rebuild_if_needed(dir);
for (int i = 0; i < g_n; i++) plain_name((char *)g_cheats[i].info.name); // the hashes above read the file's bytes
int on = 0;
for (int i = 0; i < g_n; i++) on += g_cheats[i].on && g_cheats[i].info.kind != CHEAT_HEADING;
rt_log("cheats: %s in %d mods: %d cheats, %d on; %d code, %d while buttons are held, %d data, %d master, "
"%d restore, %d headings, %d need the setup again, %d not supported%s",
"%d restore, %d headings, %d wait for a rebuild, %d not supported%s",
g_file, g_files, g_n, on, counts[CHEAT_CODE], counts[CHEAT_KEY], counts[CHEAT_DATA], counts[CHEAT_MASTER],
counts[CHEAT_RESTORE], counts[CHEAT_HEADING], counts[CHEAT_REBUILD], counts[CHEAT_UNSUPPORTED],
seen_dups ? " (repeated names numbered)" : "");
}
int cheats_rebuild_pending(void) {
char path[PLAT_PATH_MAX + 64];
snprintf(path, sizeof path, "%sbuild-cache" SEP "rebuild.txt", g_dir);
for (int i = 0; i < g_n; i++)
if (g_cheats[i].info.kind == CHEAT_REBUILD) return g_dir[0] && plat_file_exists(path);
return 0;
}
void cheats_rebuild_allow(void) {
char path[PLAT_PATH_MAX + 64];
snprintf(path, sizeof path, "%sbuild-cache" SEP "rebuild.skip", g_dir);
plat_fs_unlink(path);
}
int cheats_count(void) { return g_n; }
const CheatInfo *cheats_info(int i) { return i >= 0 && i < g_n ? &g_cheats[i].info : NULL; }
+4
View File
@@ -30,6 +30,10 @@ typedef struct {
void cheats_init(void); // after rt_patches_init: reads the mods' files and their build status
int cheats_count(void);
// 1 when a cheat of an enabled mod waits for a rebuild (CHEAT_REBUILD) and the setup left its rebuild command.
int cheats_rebuild_pending(void);
// The next start rebuilds again for cheats whose last rebuild failed or was cancelled (the menu restarts after it).
void cheats_rebuild_allow(void);
const CheatInfo *cheats_info(int i);
int cheats_on(int i); // the player's switch (1 for a master cheat)
void cheats_set(int i, int on); // switches at once and sets the cheat's setting (the menu saves totk.ini)
+20
View File
@@ -1711,6 +1711,26 @@ int plat_restart(void) {
return e == 0;
}
int plat_spawn(const char *const *argv, const char *cwd) {
posix_spawn_file_actions_t fa;
posix_spawn_file_actions_init(&fa);
posix_spawn_file_actions_addclosefrom_np(&fa, 3);
posix_spawn_file_actions_addchdir_np(&fa, cwd);
posix_spawnattr_t at;
posix_spawnattr_init(&at);
sigset_t none, all;
sigemptyset(&none);
sigfillset(&all);
posix_spawnattr_setsigmask(&at, &none);
posix_spawnattr_setsigdefault(&at, &all);
posix_spawnattr_setflags(&at, POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSID);
pid_t pid;
int e = posix_spawn(&pid, argv[0], &fa, &at, (char *const *)argv, environ);
posix_spawnattr_destroy(&at);
posix_spawn_file_actions_destroy(&fa);
return e == 0;
}
int plat_restart_wait(uint32_t timeout_ms) {
const char *v = getenv(RESTART_WAIT);
if (!v) return 0;
+3
View File
@@ -416,6 +416,9 @@ long plat_child_read(PlatChild *c, void *buf, size_t cap); // bytes read
// Starts this executable again with the same command line, environment and working folder, and no handle of this
// process. 1 when it started; the caller then exits.
int plat_restart(void);
// Starts argv[0] with the arguments argv[1..] (NULL-terminated, UTF-8) in folder cwd, detached from this process: no
// console, no handle of this one. 1 when it started (the setup window that rebuilds the game, runtime/cheats.c).
int plat_spawn(const char *const *argv, const char *cwd);
// In a process plat_restart started: waits, at most timeout_ms, until the process that started it has exited. 1 after
// the wait, -1 on timeout, 0 when there is nothing to wait for (not started by plat_restart, or that process is gone).
int plat_restart_wait(uint32_t timeout_ms);
+45
View File
@@ -1554,6 +1554,51 @@ int plat_restart(void) {
return 1;
}
// One argument of a command line as CommandLineToArgvW reads it back: in quotes, a backslash run doubled before a quote
// and at the end, a quote escaped.
static size_t quote_arg(const wchar_t *a, wchar_t *out, size_t cap, size_t at) {
#define PUT(c) do { if (at + 1 < cap) out[at] = (c); at++; } while (0)
PUT(L'"');
for (const wchar_t *p = a;; p++) {
size_t slashes = 0;
while (*p == L'\\') p++, slashes++;
size_t times = !*p || *p == L'"' ? 2 : 1;
for (size_t k = 0; k < slashes * times; k++) PUT(L'\\');
if (!*p) break;
if (*p == L'"') PUT(L'\\');
PUT(*p);
}
PUT(L'"');
PUT(L' ');
#undef PUT
return at;
}
int plat_spawn(const char *const *argv, const char *cwd) {
enum { CMD = 32768 };
wchar_t *cmd = calloc(CMD, sizeof *cmd), *arg = malloc(WPATH * sizeof *arg), *dir = malloc(WPATH * sizeof *dir);
int ok = cmd && arg && dir && argv[0] && widen(cwd, dir, WPATH);
size_t at = 0;
for (int i = 0; ok && argv[i]; i++) {
ok = widen(argv[i], arg, WPATH);
if (ok) at = quote_arg(arg, cmd, CMD, at);
}
ok = ok && at < CMD && at > 0;
if (ok) cmd[at - 1] = 0; // the last separator
STARTUPINFOW si = {.cb = sizeof si};
PROCESS_INFORMATION pi;
ok = ok && CreateProcessW(NULL, cmd, NULL, NULL, FALSE, DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP, NULL, dir, &si,
&pi);
if (ok) {
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
}
free(cmd);
free(arg);
free(dir);
return ok;
}
int plat_restart_wait(uint32_t timeout_ms) {
char v[48];
if (!plat_getenv(RESTART_WAIT, v, sizeof v)) return 0;
+8 -3
View File
@@ -1,6 +1,7 @@
// The Cheats tab of the in-game menu: the cheats of the mods' cheat files (cheats.c), a heading per mod in the Mods
// tab's order, then a row per cheat in file order and a line per group label of the file; a cheat that cannot be
// switched here is greyed out with the reason.
// switched here is greyed out with the reason. While code cheats wait for a rebuild, a row on top restarts the game
// into it.
#include <stdio.h>
#include <string.h>
@@ -12,7 +13,8 @@ extern "C" {
#include "ui_text.h"
}
extern "C" void tab_cheats(float scale) {
// Returns true when "Rebuild the game now" was chosen: the menu then asks to restart (ui/menu.cpp restart_confirm).
extern "C" bool tab_cheats(float scale) {
opt_begin("##cheats", scale);
static char line[512], desc[768], buttons[192];
int n = cheats_count();
@@ -20,8 +22,10 @@ extern "C" void tab_cheats(float scale) {
snprintf(line, sizeof line, menu_text(UI_MENU_CHEATS_NONE), cheats_file()[0] ? cheats_file() : "<build id>.txt");
opt_text_str(line);
opt_end();
return;
return false;
}
bool rebuild =
cheats_rebuild_pending() && opt_button("##restart", UI_MENU_CHEATS_REBUILD, UI_MENU_CHEATS_REBUILD_DESC);
for (int i = 0; i < n; i++) {
const CheatInfo *c = cheats_info(i);
if (!i || strcmp(c->mod, cheats_info(i - 1)->mod)) {
@@ -58,4 +62,5 @@ extern "C" void tab_cheats(float scale) {
}
}
opt_end();
return rebuild;
}
+16 -4
View File
@@ -56,7 +56,7 @@ double frame_step_limit_hz(void);
extern const int rt_game_version;
extern const char rt_port_version[];
void cheats_frame(uint64_t frame); // cheats.c
void tab_cheats(float scale); // ui/cheats_tab.cpp
bool tab_cheats(float scale); // ui/cheats_tab.cpp; true: restart into the rebuild
}
// Roboto Medium (Apache-2.0, ui/fonts/LICENSE-Roboto.txt) with Latin and Cyrillic glyphs.
@@ -771,7 +771,9 @@ static const char *prompts_note(bool *restart) {
// The confirmation of "Restart now", over the menu; Cancel has the cursor first. Restart writes totk.ini, then closes
// the game as Quit does and starts it again (gfx_window_request_restart). It waits while the game writes a save, and
// the game stays when totk.ini cannot be written, as the new prompts would not come back.
// the game stays when totk.ini cannot be written, as the new prompts would not come back. From the Cheats tab
// (restart_rebuild) Restart also lets the next start rebuild for cheats whose last rebuild failed (cheats_rebuild_allow).
static bool restart_rebuild;
static void restart_confirm(void) {
g_modal = false;
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
@@ -792,12 +794,16 @@ static void restart_confirm(void) {
if (ImGui::IsWindowAppearing()) ImGui::SetItemDefaultFocus();
ImGui::SameLine();
ImGui::BeginDisabled(saving);
if (ImGui::Button(yes, ImVec2(bw, 0)) && cfg_save()) gfx_window_request_restart();
if (ImGui::Button(yes, ImVec2(bw, 0)) && cfg_save()) {
if (restart_rebuild) cheats_rebuild_allow();
gfx_window_request_restart();
}
ImGui::EndDisabled();
if (ImGui::IsKeyPressed(ImGuiKey_Escape, false) || ImGui::IsKeyPressed(ImGuiKey_GamepadFaceRight, false))
close = true;
if (close) {
ImGui::CloseCurrentPopup();
restart_rebuild = false;
opt_focus_key("##restart"); // back on the row it came from
}
ImGui::EndPopup();
@@ -1140,7 +1146,13 @@ static void layout_menu(uint32_t w, uint32_t h, float scale) {
case TAB_CONTROLS: tab_controls(scale); break;
case TAB_AMIIBO: tab_amiibo(scale); break;
case TAB_MENU: tab_menu(scale); break;
case TAB_CHEATS: tab_cheats(scale); break;
case TAB_CHEATS:
if (tab_cheats(scale)) {
restart_rebuild = true;
ImGui::OpenPopup("##restart_confirm");
}
restart_confirm();
break;
case TAB_ADVANCED: tab_advanced(scale); break;
}
ImGui::EndTabItem();
+36 -16
View File
@@ -418,8 +418,8 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_TAB_CHEATS] = "Cheats",
[UI_MENU_CHEATS_NONE] = "No cheats for this game version. A mod's cheats are an Atmosphere cheat file in its "
"cheats folder, named after the game's build: mods\\<mod>\\cheats\\%s. Restart the game to "
"read them. Cheats that change the game's code also need the setup run again on this "
"folder.",
"read them. For cheats that change the game's code, the game rebuilds itself at start (a "
"few minutes).",
[UI_MENU_CHEATS_MOD] = "%s: %d cheats",
[UI_MENU_CHEAT_CODE_DESC] = "Changes the game's code. Switches at once.",
[UI_MENU_CHEAT_KEY_DESC] = "Changes the game's code while you hold %s. Switches at once.",
@@ -428,11 +428,17 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_CHEAT_MASTER_DESC] = "The file's master code: it is always on.",
[UI_MENU_CHEAT_RESTORE] = "not needed",
[UI_MENU_CHEAT_RESTORE_DESC] = "It only writes the game's own code back. Switching a cheat off already does that.",
[UI_MENU_CHEAT_REBUILD] = "run the setup again",
[UI_MENU_CHEAT_REBUILD] = "after the rebuild",
[UI_MENU_CHEAT_REBUILD_DESC] = "This cheat changes the game's code and is new or edited since the game was built. "
"Run the setup again on this folder to build it (about three minutes).",
"The game builds it in when it starts next (a few minutes), or use Rebuild the game "
"now.",
[UI_MENU_CHEAT_UNSUPPORTED] = "not supported",
[UI_MENU_CHEAT_UNSUPPORTED_DESC] = "This cheat cannot be used with this version of the game:",
[UI_MENU_CHEATS_REBUILD] = "Rebuild the game now",
[UI_MENU_CHEATS_REBUILD_DESC] = "Some cheats change the game's code and are not built into it: they are new or "
"edited, or their last rebuild failed or was cancelled. Closes the game; the setup "
"builds them in (a few minutes) and starts the game again. Progress since your "
"last save is lost.",
};
static const char *const text_ru[UI_TEXT_COUNT] = {
@@ -834,7 +840,8 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_TAB_CHEATS] = "Читы",
[UI_MENU_CHEATS_NONE] = "Для этой версии игры читов нет. Читы мода — это файл читов Atmosphere в его папке cheats "
"с именем по сборке игры: mods\\<мод>\\cheats\\%s. Перезапустите игру, чтобы они "
"прочитались. Для читов, меняющих код игры, ещё раз запустите установщик для этой папки.",
"прочитались. Для читов, меняющих код игры, игра пересоберётся сама при запуске (несколько "
"минут).",
[UI_MENU_CHEATS_MOD] = "%s — читов: %d",
[UI_MENU_CHEAT_CODE_DESC] = "Меняет код игры. Включается и выключается сразу.",
[UI_MENU_CHEAT_KEY_DESC] = "Меняет код игры, пока вы держите %s. Включается и выключается сразу.",
@@ -843,11 +850,16 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_CHEAT_MASTER_DESC] = "Главный код файла: включён всегда.",
[UI_MENU_CHEAT_RESTORE] = "не нужен",
[UI_MENU_CHEAT_RESTORE_DESC] = "Он только возвращает исходный код игры. Выключение чита уже делает это.",
[UI_MENU_CHEAT_REBUILD] = "запустите установщик",
[UI_MENU_CHEAT_REBUILD_DESC] = "Этот чит меняет код игры и появился или изменился после сборки игры. Запустите "
"установщик для этой папки ещё раз, чтобы собрать его (около трёх минут).",
[UI_MENU_CHEAT_REBUILD] = "после пересборки",
[UI_MENU_CHEAT_REBUILD_DESC] = "Этот чит меняет код игры и появился или изменился после сборки игры. Игра соберёт "
"его при следующем запуске (несколько минут), или нажмите «Пересобрать игру сейчас».",
[UI_MENU_CHEAT_UNSUPPORTED] = "не поддерживается",
[UI_MENU_CHEAT_UNSUPPORTED_DESC] = "Этот чит нельзя использовать с этой версией игры:",
[UI_MENU_CHEATS_REBUILD] = "Пересобрать игру сейчас",
[UI_MENU_CHEATS_REBUILD_DESC] = "Некоторые читы меняют код игры и ещё не собраны в неё: они новые или изменены, "
"либо прошлая пересборка не удалась или была отменена. Закрывает игру; установщик "
"собирает их (несколько минут) и снова запускает игру. Прогресс после последнего "
"сохранения будет потерян.",
};
static const char *const text_pt_br[UI_TEXT_COUNT] = {
@@ -1276,8 +1288,8 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_MENU_TAB_CHEATS] = "Cheats",
[UI_MENU_CHEATS_NONE] = "Nenhum cheat para esta versão do jogo. Os cheats de um mod são um arquivo de cheats do "
"Atmosphere na pasta cheats dele, com o nome da build do jogo: mods\\<mod>\\cheats\\%s. "
"Reinicie o jogo para lê-los. Cheats que alteram o código do jogo também precisam que o "
"instalador seja executado de novo nesta pasta.",
"Reinicie o jogo para lê-los. Para cheats que alteram o código do jogo, o jogo se recompila "
"sozinho ao iniciar (alguns minutos).",
[UI_MENU_CHEATS_MOD] = "%s: %d cheats",
[UI_MENU_CHEAT_CODE_DESC] = "Altera o código do jogo. Liga e desliga na hora.",
[UI_MENU_CHEAT_KEY_DESC] = "Altera o código do jogo enquanto você segura %s. Liga e desliga na hora.",
@@ -1286,12 +1298,17 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_MENU_CHEAT_MASTER_DESC] = "O código mestre do arquivo: está sempre ligado.",
[UI_MENU_CHEAT_RESTORE] = "desnecessário",
[UI_MENU_CHEAT_RESTORE_DESC] = "Ele só escreve de volta o código original do jogo. Desligar um cheat já faz isso.",
[UI_MENU_CHEAT_REBUILD] = "execute o instalador",
[UI_MENU_CHEAT_REBUILD] = "após recompilar",
[UI_MENU_CHEAT_REBUILD_DESC] = "Este cheat altera o código do jogo e é novo ou foi editado depois que o jogo foi "
"compilado. Execute o instalador de novo nesta pasta para compilá-lo (cerca de três "
"minutos).",
"compilado. O jogo o compila na próxima vez que iniciar (alguns minutos), ou use "
"Recompilar o jogo agora.",
[UI_MENU_CHEAT_UNSUPPORTED] = "não suportado",
[UI_MENU_CHEAT_UNSUPPORTED_DESC] = "Este cheat não pode ser usado com esta versão do jogo:",
[UI_MENU_CHEATS_REBUILD] = "Recompilar o jogo agora",
[UI_MENU_CHEATS_REBUILD_DESC] = "Alguns cheats alteram o código do jogo e ainda não foram compilados nele: são "
"novos ou editados, ou a última recompilação falhou ou foi cancelada. Fecha o "
"jogo; o instalador os compila (alguns minutos) e inicia o jogo de novo. O "
"progresso desde o último salvamento é perdido.",
};
// Simplified Chinese: this row covers the software keyboard and the whole menu, so the menu and the overlay read Chinese
@@ -1820,7 +1837,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_FXAA_DESC] = "游戏自身的 FXAA 边缘平滑。会让细节略微模糊;开启 DLAA 时不需要。",
[UI_MENU_TAB_CHEATS] = "金手指",
[UI_MENU_CHEATS_NONE] = "此游戏版本没有金手指。模组的金手指是它的 cheats 文件夹中以游戏构建命名的 Atmosphere "
"金手指文件:mods\\<模组>\\cheats\\%s。重启游戏后才会读取。修改游戏代码的金手指还需要对此文件夹重新运行安装程序。",
"金手指文件:mods\\<模组>\\cheats\\%s。重启游戏后才会读取。对于修改游戏代码的金手指,"
"游戏会在启动时自行重新构建(几分钟)。",
[UI_MENU_CHEATS_MOD] = "%s:%d 个金手指",
[UI_MENU_CHEAT_CODE_DESC] = "修改游戏代码。立即开关。",
[UI_MENU_CHEAT_KEY_DESC] = "按住 %s 时修改游戏代码。立即开关。",
@@ -1829,10 +1847,12 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_CHEAT_MASTER_DESC] = "文件的主代码:始终开启。",
[UI_MENU_CHEAT_RESTORE] = "无需使用",
[UI_MENU_CHEAT_RESTORE_DESC] = "它只会写回游戏原本的代码。关闭金手指时已经会这样做。",
[UI_MENU_CHEAT_REBUILD] = "重新运行安装程序",
[UI_MENU_CHEAT_REBUILD_DESC] = "此金手指修改游戏代码,并且是在游戏构建后新增或修改的。对此文件夹重新运行安装程序来构建它(约三分钟)。",
[UI_MENU_CHEAT_REBUILD] = "重新构建后",
[UI_MENU_CHEAT_REBUILD_DESC] = "此金手指修改游戏代码,并且是在游戏构建后新增或修改的。游戏会在下次启动时把它构建进去(几分钟),也可以使用“立即重新构建游戏”。",
[UI_MENU_CHEAT_UNSUPPORTED] = "不支持",
[UI_MENU_CHEAT_UNSUPPORTED_DESC] = "此金手指不能用于此游戏版本:",
[UI_MENU_CHEATS_REBUILD] = "立即重新构建游戏",
[UI_MENU_CHEATS_REBUILD_DESC] = "有些金手指会修改游戏代码,但尚未构建进游戏:它们是新增或修改的,或上次重新构建失败或被取消。将关闭游戏;安装程序会把它们构建进去(几分钟)并重新启动游戏。上次存档之后的进度会丢失。",
};
#define SWKBD_ONLY(name, ...) static const char *const name[UI_TEXT_COUNT] = {SWKBD(__VA_ARGS__)}
+1
View File
@@ -215,6 +215,7 @@ typedef enum {
UI_MENU_TAB_CHEATS,
UI_MENU_CHEATS_NONE, // "%s": <build id>.txt
UI_MENU_CHEATS_MOD, // "%s": the mod, "%d": its cheats
UI_MENU_CHEATS_REBUILD, UI_MENU_CHEATS_REBUILD_DESC, // restart into the rebuild for unbuilt code cheats
UI_MENU_CHEAT_CODE_DESC, UI_MENU_CHEAT_KEY_DESC /* "%s": the buttons */, UI_MENU_CHEAT_DATA_DESC,
UI_MENU_CHEAT_MASTER, UI_MENU_CHEAT_MASTER_DESC, UI_MENU_CHEAT_RESTORE, UI_MENU_CHEAT_RESTORE_DESC,
UI_MENU_CHEAT_REBUILD, UI_MENU_CHEAT_REBUILD_DESC, UI_MENU_CHEAT_UNSUPPORTED, UI_MENU_CHEAT_UNSUPPORTED_DESC,