mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-23 05:25:56 +00:00
Read cheat files from the mods folder instead of shipping them
A cheat file is now part of a mod: mods/<mod>/cheats/<build id>.txt, or the Atmosphere places inside the mod folder, the file name in any case. The port ships no cheat files any more (the MyNXCheats files and their notice row are gone). - tools/cheats.py --mods builds the code cheats of every mod folder; a cheat's key hashes "<mod folder>/<name>", so two mods' cheats of one name keep their own switches. - The setup reads the cheats from <install>/mods and writes the status to build-cache/cheats.status. - runtime/cheats.c reads the files of the enabled mods the port can use, in the Mods tab order, and the status from build-cache. - A mod with only cheats is usable. The Cheats tab groups the cheats by mod, and the Mods tab says how many cheats a mod brought. - The cheat texts are in all four menu languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e584ea966
commit
ac69f39529
23 files changed
+296
-1093
No files matched your search
+72
-34
@@ -1,12 +1,14 @@
|
||||
// Cheats of an Atmosphere cheat file (cheats.h). The file is cheats\<build id>.txt next to totk.exe, the build id the
|
||||
// first 8 bytes of main's NSO build id, as Atmosphere and the emulators name it. Each cheat's switch is the setting
|
||||
// TOTK_CHEAT_<name hash> (cheat_<hash> under [cheats] in totk.ini).
|
||||
// Cheats of the mods' Atmosphere cheat files (cheats.h). Each enabled mod the port can use (mods.h) may hold
|
||||
// <build id>.txt in its cheats folder, the build id the first 8 bytes of main's NSO build id, as Atmosphere and the
|
||||
// emulators name it; the file name's case does not matter. Each cheat's switch is the setting TOTK_CHEAT_<hash>
|
||||
// (cheat_<hash> under [cheats] in totk.ini), the hash FNV-1a 32 of "<mod folder name>/<cheat name>", so two mods'
|
||||
// cheats of one name keep their own switches.
|
||||
//
|
||||
// Code cheats (opcode 0 writes into main's code) cannot be applied here: the game's code is lifted C. tools/cheats.py
|
||||
// turns them into patch sets cheat_<hash> when the game is built and writes cheats\<build id>.status, one line per
|
||||
// cheat: name hash, content hash, kind, buttons, note (tools/cheats.py has the format). A cheat whose status line is
|
||||
// missing or has another content hash was added or edited after the build: a data cheat runs anyway, a code cheat waits
|
||||
// for the setup to run again.
|
||||
// turns the code cheats of every mod into patch sets cheat_<hash> when the game is built and writes
|
||||
// build-cache\cheats.status next to totk.exe, one line per cheat: name hash, content hash, kind, buttons, note
|
||||
// (tools/cheats.py has the format). A cheat whose status line is missing or has another content hash was added or
|
||||
// edited after the build: a data cheat runs anyway, a code cheat waits for the setup to run again.
|
||||
//
|
||||
// Data cheats run in a VM after Atmosphere's dmnt cheat VM (opcodes 0-A; the 0xC.. and 0xF.. extensions are not
|
||||
// supported), every presented frame while their switch is on, with registers cleared before each cheat. Memory is the
|
||||
@@ -18,11 +20,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "cfg.h"
|
||||
#include "cheats.h"
|
||||
#include "host.h"
|
||||
#include "input.h"
|
||||
#include "mods.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -37,14 +41,16 @@ typedef struct {
|
||||
CheatInfo info;
|
||||
uint32_t *words;
|
||||
int n;
|
||||
int dup; // 1 for the first cheat of its name in its file, 2 for the next ...
|
||||
int set; // patch set, -1 none
|
||||
volatile int32_t on;
|
||||
char note[STATUS_MAX];
|
||||
} Cheat;
|
||||
|
||||
static Cheat *g_cheats;
|
||||
static int g_n, g_vm; // g_vm: some cheat needs cheats_frame
|
||||
static char g_file[64];
|
||||
static int g_n, g_cap, g_vm; // g_vm: some cheat needs cheats_frame
|
||||
static char g_file[64]; // "<build id>.txt"
|
||||
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
|
||||
|
||||
static uint32_t fnv(const char *s, size_t n) {
|
||||
@@ -340,8 +346,9 @@ static void add_word(Cheat *c, uint32_t v, int *cap) {
|
||||
c->words[c->n++] = v;
|
||||
}
|
||||
|
||||
static void parse(char *s) {
|
||||
int cap = 0, wcap = 0;
|
||||
// Appends the cheats of one mod's file; mod: the mod's folder name (kept).
|
||||
static void parse(char *s, const char *mod) {
|
||||
int first = g_n, wcap = 0;
|
||||
for (char *line = s; line && *line;) {
|
||||
char *end = strchr(line, '\n'), *next = end ? end + 1 : NULL;
|
||||
if (end) *end = 0;
|
||||
@@ -349,9 +356,9 @@ static void parse(char *s) {
|
||||
size_t len = strlen(line);
|
||||
while (len && (line[len - 1] == '\r' || line[len - 1] == ' ' || line[len - 1] == '\t')) line[--len] = 0;
|
||||
if (len >= 2 && (line[0] == '[' || line[0] == '{') && (line[len - 1] == ']' || line[len - 1] == '}')) {
|
||||
if (g_n == cap) {
|
||||
cap = cap ? cap * 2 : 32;
|
||||
g_cheats = (Cheat *)realloc(g_cheats, sizeof *g_cheats * (size_t)cap);
|
||||
if (g_n == g_cap) {
|
||||
g_cap = g_cap ? g_cap * 2 : 32;
|
||||
g_cheats = (Cheat *)realloc(g_cheats, sizeof *g_cheats * (size_t)g_cap);
|
||||
if (!g_cheats) rt_fatal("cheats: out of memory");
|
||||
}
|
||||
Cheat *c = &g_cheats[g_n++];
|
||||
@@ -362,10 +369,13 @@ static void parse(char *s) {
|
||||
size_t k = strlen(name);
|
||||
while (k && (name[k - 1] == ' ' || name[k - 1] == '\t')) name[--k] = 0;
|
||||
c->info.name = strdup(name);
|
||||
c->info.mod = mod;
|
||||
c->info.kind = line[0] == '{' ? CHEAT_MASTER : CHEAT_HEADING;
|
||||
c->set = -1;
|
||||
c->dup = 1; // a repeated name gets "#2", "#3" ... (tools/cheats.py parse)
|
||||
for (int j = first; j < g_n - 1; j++) c->dup += !strcmp(g_cheats[j].info.name, c->info.name);
|
||||
wcap = 0;
|
||||
} else if (g_n) {
|
||||
} else if (g_n > first) {
|
||||
for (char *tok = strtok(line, " \t"); tok; tok = strtok(NULL, " \t")) {
|
||||
char *e;
|
||||
unsigned long v = strtoul(tok, &e, 16);
|
||||
@@ -376,6 +386,27 @@ static void parse(char *s) {
|
||||
}
|
||||
}
|
||||
|
||||
// The file g_file in folder, its name in any case, into out; 0 when there is none.
|
||||
typedef struct {
|
||||
const char *dir;
|
||||
char *out;
|
||||
size_t cap;
|
||||
int found;
|
||||
} FindFile;
|
||||
static int find_cb(const char *name, int kind, uint64_t size, void *ctx) {
|
||||
(void)size;
|
||||
FindFile *f = (FindFile *)ctx;
|
||||
if (kind == PLAT_FS_FILE && !strcasecmp(name, g_file) &&
|
||||
snprintf(f->out, f->cap, "%s/%s", f->dir, name) < (int)f->cap)
|
||||
f->found = 1;
|
||||
return !f->found;
|
||||
}
|
||||
static int find_file(const char *folder, char *out, size_t cap) {
|
||||
FindFile f = {folder, out, cap, 0};
|
||||
plat_fs_list(folder, find_cb, &f);
|
||||
return f.found;
|
||||
}
|
||||
|
||||
// The status line of key, its fields split in place; 0 when none.
|
||||
static int status_of(char *status, const char *key, char **fields) {
|
||||
for (char *line = status; line && *line;) {
|
||||
@@ -409,31 +440,38 @@ static void plain_name(char *s) {
|
||||
|
||||
void cheats_init(void) {
|
||||
const RtLoaded *m = ldr_count() ? ldr_module(0) : NULL;
|
||||
char dir[PLAT_PATH_MAX], bid[17], path[PLAT_PATH_MAX + 64];
|
||||
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;
|
||||
g_main = m->base;
|
||||
g_main_size = m->size;
|
||||
g_code_end = m->base + ((m->text_end + 0xFFF) & ~0xFFFull);
|
||||
snprintf(g_file, sizeof g_file, "cheats" SEP "%s.txt", bid);
|
||||
snprintf(path, sizeof path, "%s%s", dir, g_file);
|
||||
char *text = read_text(path);
|
||||
if (!text) {
|
||||
rt_log("cheats: no %s", g_file);
|
||||
snprintf(g_file, sizeof g_file, "%s.txt", bid);
|
||||
mods_scan();
|
||||
for (int k = 0; k < mods_count(); k++) { // the Mods tab's order, top first
|
||||
const ModInfo *mod = mods_at(k);
|
||||
if (!mod->enabled || mod->problem != MOD_OK || !mod->cheats[0] || !find_file(mod->cheats, path, sizeof path))
|
||||
continue;
|
||||
char *text = read_text(path);
|
||||
if (!text) {
|
||||
rt_log("cheats: %s: cannot read %s", mod->name, path);
|
||||
continue;
|
||||
}
|
||||
parse(text, strdup(mod->name));
|
||||
free(text);
|
||||
g_files++;
|
||||
}
|
||||
if (!g_files) {
|
||||
rt_log("cheats: no enabled mod holds cheats/%s", g_file);
|
||||
return;
|
||||
}
|
||||
parse(text);
|
||||
free(text);
|
||||
snprintf(path, sizeof path, "%scheats" SEP "%s.status", dir, bid);
|
||||
snprintf(path, sizeof path, "%sbuild-cache" SEP "cheats.status", dir);
|
||||
char *status = read_text(path);
|
||||
int counts[CHEAT_UNSUPPORTED + 1] = {0}, seen_dups = 0;
|
||||
for (int i = 0; i < g_n; i++) {
|
||||
Cheat *c = &g_cheats[i];
|
||||
// the name hash: a repeated name gets "#2", "#3" ... (tools/cheats.py parse)
|
||||
int dup = 1;
|
||||
for (int j = 0; j < i; j++) dup += !strcmp(g_cheats[j].info.name, c->info.name);
|
||||
char named[600];
|
||||
snprintf(named, sizeof named, dup > 1 ? "%s#%d" : "%s", c->info.name, dup);
|
||||
seen_dups += dup > 1;
|
||||
char named[900];
|
||||
snprintf(named, sizeof named, c->dup > 1 ? "%s/%s#%d" : "%s/%s", c->info.mod, c->info.name, c->dup);
|
||||
seen_dups += c->dup > 1;
|
||||
char key[9], content[9];
|
||||
snprintf(key, sizeof key, "%08X", fnv(named, strlen(named)));
|
||||
size_t tn = (size_t)c->n * 9 + 1, tl = 0;
|
||||
@@ -476,9 +514,9 @@ void cheats_init(void) {
|
||||
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: %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",
|
||||
g_file, g_n, on, counts[CHEAT_CODE], counts[CHEAT_KEY], counts[CHEAT_DATA], counts[CHEAT_MASTER],
|
||||
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",
|
||||
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)" : "");
|
||||
}
|
||||
@@ -498,7 +536,7 @@ void cheats_set(int i, int on) {
|
||||
plat_xchg32(&c->on, on != 0);
|
||||
if (c->info.kind == CHEAT_CODE) rt_patch_switch(c->set, on); // CHEAT_KEY: cheats_frame follows the buttons
|
||||
cfg_set(c->info.key, on ? "1" : "0");
|
||||
rt_log("cheats: %s %s", c->info.name, on ? "on" : "off");
|
||||
rt_log("cheats: %s/%s %s", c->info.mod, c->info.name, on ? "on" : "off");
|
||||
}
|
||||
|
||||
void cheats_frame(uint64_t frame) {
|
||||
|
||||
+6
-5
@@ -1,5 +1,5 @@
|
||||
// Cheats of an Atmosphere cheat file (cheats.c): cheats\<build id>.txt next to totk.exe, switched from the menu's
|
||||
// Cheats tab. A cheat that writes the game's instructions is a code patch set that tools/cheats.py built into the game
|
||||
// Cheats of the mods' Atmosphere cheat files (cheats.c): mods\<mod>\cheats\<build id>.txt of each enabled mod,
|
||||
// switched from the menu's Cheats tab. A cheat that writes the game's instructions is a code patch set that tools/cheats.py built into the game
|
||||
// (switched with rt_patch_switch); one that writes data runs in the cheat VM every presented frame.
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
@@ -21,18 +21,19 @@ typedef enum {
|
||||
|
||||
typedef struct {
|
||||
const char *name; // UTF-8, as in the file
|
||||
const char *mod; // the mod's folder name; cheats come grouped by mod, in the Mods tab's order
|
||||
const char *note; // why it is unsupported ("" otherwise)
|
||||
CheatKind kind;
|
||||
uint32_t buttons; // CHEAT_KEY: HidNpadButton mask
|
||||
char key[24]; // its setting, TOTK_CHEAT_<name hash>
|
||||
char key[24]; // its setting, TOTK_CHEAT_<hash of "<mod>/<name>">
|
||||
} CheatInfo;
|
||||
|
||||
void cheats_init(void); // after rt_patches_init: reads the file and its build status
|
||||
void cheats_init(void); // after rt_patches_init: reads the mods' files and their build status
|
||||
int cheats_count(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)
|
||||
const char *cheats_file(void); // "cheats\<build id>.txt"
|
||||
const char *cheats_file(void); // "<build id>.txt", the name the files have for this game version
|
||||
// Every presented frame (the present path): the data cheats' VM and the button state of CHEAT_KEY cheats.
|
||||
void cheats_frame(uint64_t frame);
|
||||
// The button names of a mask ("ZL + Right stick left"), into buf.
|
||||
|
||||
+5
-7
@@ -120,7 +120,6 @@ static const char *problem_name(ModProblem p) {
|
||||
case MOD_EMPTY: return "empty";
|
||||
case MOD_PLUGIN: return "has a code module (subsdk or main), not supported; the whole mod stays off";
|
||||
case MOD_EXEFS_LATER: return "ExeFS patches need a game code rebuild, not applied; the whole mod stays off";
|
||||
case MOD_CHEATS_LATER: return "cheats only, not loaded yet";
|
||||
case MOD_BAD_NAME: return "its folder name holds '|', which the order list uses; rename the folder";
|
||||
default: return "ok";
|
||||
}
|
||||
@@ -151,12 +150,11 @@ static int scan_cb(const char *name, int kind, uint64_t size, void *ctx) {
|
||||
if (m->exefs[0]) plat_fs_list(m->exefs, exefs_cb, &m->kind);
|
||||
if (m->cheats[0]) plat_fs_list(m->cheats, cheats_cb, &m->kind);
|
||||
// a mod whose code part the port cannot use is off as a whole: its RomFS files may expect that code
|
||||
m->problem = strchr(m->name, '|') ? MOD_BAD_NAME
|
||||
: m->kind & MOD_SUBSDK ? MOD_PLUGIN
|
||||
: m->kind & MOD_EXEFS ? MOD_EXEFS_LATER
|
||||
: m->kind & MOD_ROMFS ? MOD_OK
|
||||
: m->kind & MOD_CHEATS ? MOD_CHEATS_LATER
|
||||
: MOD_EMPTY;
|
||||
m->problem = strchr(m->name, '|') ? MOD_BAD_NAME
|
||||
: m->kind & MOD_SUBSDK ? MOD_PLUGIN
|
||||
: m->kind & MOD_EXEFS ? MOD_EXEFS_LATER
|
||||
: m->kind & (MOD_ROMFS | MOD_CHEATS) ? MOD_OK
|
||||
: MOD_EMPTY;
|
||||
m->enabled = !listed(disabled, m->name);
|
||||
nmods++;
|
||||
return 1;
|
||||
|
||||
@@ -14,7 +14,6 @@ typedef enum {
|
||||
// whole mod stays off (its RomFS files may expect that code)
|
||||
MOD_EXEFS_LATER, // has ExeFS patches (.ips, .pchtxt): a rebuild of the game code applies them, not yet here; the
|
||||
// whole mod stays off until then
|
||||
MOD_CHEATS_LATER, // only cheat files, which the port does not load yet
|
||||
MOD_BAD_NAME, // its folder name holds '|', the separator of the order keys
|
||||
} ModProblem;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ int probe_mods(void) {
|
||||
CHECK(e->problem == MOD_PLUGIN, "subsdk-only mod is a plugin mod");
|
||||
CHECK(f->problem == MOD_EMPTY, "empty RomFS folder");
|
||||
CHECK(g->kind == (MOD_ROMFS | MOD_EXEFS) && g->problem == MOD_EXEFS_LATER, "RomFS + ExeFS mod");
|
||||
CHECK(jm->kind == MOD_CHEATS && jm->problem == MOD_CHEATS_LATER && ends_with(jm->cheats, "J/cheats"),
|
||||
CHECK(jm->kind == MOD_CHEATS && jm->problem == MOD_OK && ends_with(jm->cheats, "J/cheats"),
|
||||
"cheats-only mod");
|
||||
CHECK(km->kind == MOD_ROMFS && km->problem == MOD_OK && ends_with(km->romfs, "K/romfslite"), "TKMM romfslite");
|
||||
CHECK(lm->kind == (MOD_ROMFS | MOD_CHEATS) && lm->problem == MOD_OK, "RomFS + cheats, main.npdm is no code");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// The Cheats tab of the in-game menu: the cheats of cheats\<build id>.txt (cheats.c), a row per cheat in file order and
|
||||
// a heading per group label; a cheat that cannot be switched here is greyed out with the reason.
|
||||
// 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.
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -16,22 +17,24 @@ extern "C" void tab_cheats(float scale) {
|
||||
static char line[512], desc[768], buttons[192];
|
||||
int n = cheats_count();
|
||||
if (!n) {
|
||||
snprintf(line, sizeof line, menu_text(UI_MENU_CHEATS_NONE),
|
||||
cheats_file()[0] ? cheats_file() : "cheats\\<build id>.txt");
|
||||
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;
|
||||
}
|
||||
int listed = 0;
|
||||
for (int i = 0; i < n; i++) listed += cheats_info(i)->kind != CHEAT_HEADING;
|
||||
snprintf(line, sizeof line, menu_text(UI_MENU_CHEATS_FILE), cheats_file(), listed);
|
||||
opt_text_str(line);
|
||||
for (int i = 0; i < n; i++) {
|
||||
const CheatInfo *c = cheats_info(i);
|
||||
if (!i || strcmp(c->mod, cheats_info(i - 1)->mod)) {
|
||||
int listed = 0;
|
||||
for (int j = i; j < n && !strcmp(cheats_info(j)->mod, c->mod); j++)
|
||||
listed += cheats_info(j)->kind != CHEAT_HEADING;
|
||||
snprintf(line, sizeof line, menu_text(UI_MENU_CHEATS_MOD), c->mod, listed);
|
||||
opt_group_text(line);
|
||||
}
|
||||
UiTextId text = UI_MENU_CHEAT_CODE_DESC;
|
||||
switch (c->kind) {
|
||||
case CHEAT_HEADING:
|
||||
if (!strstr(c->name, "TID=")) opt_group_text(c->name); // the file's title line only names the game
|
||||
if (!strstr(c->name, "TID=")) opt_text_str(c->name); // the file's title line only names the game
|
||||
continue;
|
||||
case CHEAT_CODE: break;
|
||||
case CHEAT_KEY: text = UI_MENU_CHEAT_KEY_DESC; break;
|
||||
|
||||
+11
-3
@@ -36,6 +36,7 @@ static int g_font_bad;
|
||||
|
||||
extern "C" {
|
||||
#include "amiibo.h"
|
||||
#include "cheats.h"
|
||||
#include "cfg.h"
|
||||
#include "fs.h"
|
||||
#include "input.h"
|
||||
@@ -1048,16 +1049,23 @@ static void tab_mods(float scale) {
|
||||
char over[512] = "", other[512] = "";
|
||||
if (m->overridden) snprintf(over, sizeof over, menu_text(UI_MENU_MODS_OVERRIDDEN), m->overridden, m->overridden_by);
|
||||
if (m->other_version) snprintf(other, sizeof other, menu_text(UI_MENU_MODS_OTHER_VERSION), m->other_version);
|
||||
char cheat[256] = "";
|
||||
if (m->kind & MOD_CHEATS) { // its cheats as read at start, or the file they come from
|
||||
int count = 0;
|
||||
for (int j = 0; j < cheats_count(); j++)
|
||||
count += !strcmp(cheats_info(j)->mod, m->name) && cheats_info(j)->kind != CHEAT_HEADING;
|
||||
if (count) snprintf(cheat, sizeof cheat, menu_text(UI_MENU_MODS_CHEATS), count);
|
||||
else snprintf(cheat, sizeof cheat, menu_text(UI_MENU_MODS_CHEATS_FILE), cheats_file());
|
||||
}
|
||||
UiTextId problem = m->problem == MOD_EMPTY ? UI_MENU_MODS_EMPTY
|
||||
: m->problem == MOD_PLUGIN ? UI_MENU_MODS_SUBSDK
|
||||
: m->problem == MOD_EXEFS_LATER ? UI_MENU_MODS_EXEFS_LATER
|
||||
: m->problem == MOD_CHEATS_LATER ? UI_MENU_MODS_CHEATS_LATER
|
||||
: m->problem == MOD_BAD_NAME ? UI_MENU_MODS_BAD_NAME
|
||||
: UI_TEXT_COUNT;
|
||||
int k = snprintf(desc, sizeof desc, menu_text(UI_MENU_MODS_ROW_DESC), m->replaced, m->added);
|
||||
if (k >= 0 && k < (int)sizeof desc)
|
||||
snprintf(desc + k, sizeof desc - k, "%s%s%s%s%s%s\n\n%s", over[0] ? "\n\n" : "", over,
|
||||
other[0] ? "\n\n" : "", other, problem != UI_TEXT_COUNT ? "\n\n" : "",
|
||||
snprintf(desc + k, sizeof desc - k, "%s%s%s%s%s%s%s%s\n\n%s", over[0] ? "\n\n" : "", over,
|
||||
other[0] ? "\n\n" : "", other, cheat[0] ? "\n\n" : "", cheat, problem != UI_TEXT_COUNT ? "\n\n" : "",
|
||||
problem != UI_TEXT_COUNT ? menu_text(problem) : "", menu_text(UI_MENU_MODS_MOVE_HINT));
|
||||
const char *note = m->enabled && m->problem != MOD_OK ? menu_text(UI_MENU_MODS_UNUSED) : after;
|
||||
int s = opt_text_row(id, m->name, menu_text(m->enabled ? UI_MENU_ON : UI_MENU_OFF), note, desc, true);
|
||||
|
||||
+77
-4
@@ -173,7 +173,8 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
"load code modules, so the whole mod stays off.",
|
||||
[UI_MENU_MODS_EXEFS_LATER] = "This mod patches the game code (exefs). Code patches are not supported yet, so the "
|
||||
"whole mod stays off.",
|
||||
[UI_MENU_MODS_CHEATS_LATER] = "This mod holds only cheat files. Cheats are not supported yet.",
|
||||
[UI_MENU_MODS_CHEATS] = "Cheats: %d. Switch them on the Cheats tab.",
|
||||
[UI_MENU_MODS_CHEATS_FILE] = "Cheats for this game version are read at start from cheats\\%s in this mod.",
|
||||
[UI_MENU_MODS_BAD_NAME] = "The folder name contains |, which the mod list uses between names. Rename the folder.",
|
||||
[UI_MENU_MODS_OTHER_VERSION] = "%u of its files are made for another game version and are left out. Look for a "
|
||||
"version of this mod made for your game version.",
|
||||
@@ -414,6 +415,24 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1, sharpness %d%%", [UI_MENU_OV_SCALE_NONE] = "none (1:1)",
|
||||
[UI_MENU_OV_SCALE_BILINEAR] = "bilinear",
|
||||
[UI_MENU_OV_SCALE_DOWN] = "bilinear (FSR only enlarges)",
|
||||
[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.",
|
||||
[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.",
|
||||
[UI_MENU_CHEAT_DATA_DESC] = "Writes the game's memory every frame while it is on.",
|
||||
[UI_MENU_CHEAT_MASTER] = "always on",
|
||||
[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_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).",
|
||||
[UI_MENU_CHEAT_UNSUPPORTED] = "not supported",
|
||||
[UI_MENU_CHEAT_UNSUPPORTED_DESC] = "This cheat cannot be used with this version of the game:",
|
||||
};
|
||||
|
||||
static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
@@ -565,7 +584,8 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
"модули кода, поэтому мод выключен целиком.",
|
||||
[UI_MENU_MODS_EXEFS_LATER] = "Этот мод меняет код игры (exefs). Патчи кода пока не поддерживаются, поэтому мод "
|
||||
"выключен целиком.",
|
||||
[UI_MENU_MODS_CHEATS_LATER] = "В этом моде только файлы читов. Читы пока не поддерживаются.",
|
||||
[UI_MENU_MODS_CHEATS] = "Читов: %d. Они включаются на вкладке «Читы».",
|
||||
[UI_MENU_MODS_CHEATS_FILE] = "Читы для этой версии игры читаются при запуске из cheats\\%s в этом моде.",
|
||||
[UI_MENU_MODS_BAD_NAME] = "В имени папки есть символ |, которым список модов разделяет имена. Переименуйте папку.",
|
||||
[UI_MENU_MODS_OTHER_VERSION] = "Файлов для другой версии игры: %u, они пропущены. Поищите версию этого мода для "
|
||||
"вашей версии игры.",
|
||||
@@ -811,6 +831,23 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1, резкость %d%%", [UI_MENU_OV_SCALE_NONE] = "нет (1:1)",
|
||||
[UI_MENU_OV_SCALE_BILINEAR] = "билинейное",
|
||||
[UI_MENU_OV_SCALE_DOWN] = "билинейное (FSR только увеличивает)",
|
||||
[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. Включается и выключается сразу.",
|
||||
[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] = "Этот чит нельзя использовать с этой версией игры:",
|
||||
};
|
||||
|
||||
static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
@@ -834,7 +871,8 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
"carrega módulos de código, então o mod inteiro fica desligado.",
|
||||
[UI_MENU_MODS_EXEFS_LATER] = "Este mod altera o código do jogo (exefs). Patches de código ainda não são suportados, "
|
||||
"então o mod inteiro fica desligado.",
|
||||
[UI_MENU_MODS_CHEATS_LATER] = "Este mod tem só arquivos de cheats. Cheats ainda não são suportados.",
|
||||
[UI_MENU_MODS_CHEATS] = "Cheats: %d. Ligue-os na aba Cheats.",
|
||||
[UI_MENU_MODS_CHEATS_FILE] = "Os cheats desta versão do jogo são lidos ao iniciar de cheats\\%s neste mod.",
|
||||
[UI_MENU_MODS_BAD_NAME] = "O nome da pasta contém |, que a lista de mods usa entre os nomes. Renomeie a pasta.",
|
||||
[UI_MENU_MODS_OTHER_VERSION] = "%u dos seus arquivos são de outra versão do jogo e ficam de fora. Procure uma versão "
|
||||
"deste mod feita para a sua versão do jogo.",
|
||||
@@ -1235,6 +1273,25 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_FXAA] = "Antisserrilhado do jogo (FXAA)",
|
||||
[UI_MENU_FXAA_DESC] = "A suavização de bordas FXAA do próprio jogo. Borra um pouco os detalhes finos; com o DLAA "
|
||||
"ligado não é necessária.",
|
||||
[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.",
|
||||
[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.",
|
||||
[UI_MENU_CHEAT_DATA_DESC] = "Escreve na memória do jogo a cada quadro enquanto está ligado.",
|
||||
[UI_MENU_CHEAT_MASTER] = "sempre ligado",
|
||||
[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_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).",
|
||||
[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:",
|
||||
};
|
||||
|
||||
// Simplified Chinese: this row covers the software keyboard and the whole menu, so the menu and the overlay read Chinese
|
||||
@@ -1264,7 +1321,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_MODS_EMPTY] = "此文件夹中没有 romfs、exefs 或 cheats 文件。",
|
||||
[UI_MENU_MODS_SUBSDK] = "此模组带有自己的游戏代码(subsdk 插件或替换的 main)。移植版无法加载代码模块,因此整个模组保持关闭。",
|
||||
[UI_MENU_MODS_EXEFS_LATER] = "此模组修改游戏代码(exefs)。目前还不支持代码补丁,因此整个模组保持关闭。",
|
||||
[UI_MENU_MODS_CHEATS_LATER] = "此模组只有金手指文件。目前还不支持金手指。",
|
||||
[UI_MENU_MODS_CHEATS] = "金手指:%d 个。在“金手指”标签页中开关。",
|
||||
[UI_MENU_MODS_CHEATS_FILE] = "此游戏版本的金手指在启动时从此模组的 cheats\\%s 读取。",
|
||||
[UI_MENU_MODS_BAD_NAME] = "文件夹名称含有 |,模组列表用它分隔名称。请重命名该文件夹。",
|
||||
[UI_MENU_MODS_OTHER_VERSION] = "它有 %u 个文件是为其他游戏版本制作的,已被跳过。请寻找适用于你的游戏版本的此模组。",
|
||||
[UI_MENU_MODS_UNUSED] = "未使用",
|
||||
@@ -1760,6 +1818,21 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_DLSS_PERFORMANCE] = "性能",
|
||||
[UI_MENU_FXAA] = "游戏抗锯齿(FXAA)",
|
||||
[UI_MENU_FXAA_DESC] = "游戏自身的 FXAA 边缘平滑。会让细节略微模糊;开启 DLAA 时不需要。",
|
||||
[UI_MENU_TAB_CHEATS] = "金手指",
|
||||
[UI_MENU_CHEATS_NONE] = "此游戏版本没有金手指。模组的金手指是它的 cheats 文件夹中以游戏构建命名的 Atmosphere "
|
||||
"金手指文件:mods\\<模组>\\cheats\\%s。重启游戏后才会读取。修改游戏代码的金手指还需要对此文件夹重新运行安装程序。",
|
||||
[UI_MENU_CHEATS_MOD] = "%s:%d 个金手指",
|
||||
[UI_MENU_CHEAT_CODE_DESC] = "修改游戏代码。立即开关。",
|
||||
[UI_MENU_CHEAT_KEY_DESC] = "按住 %s 时修改游戏代码。立即开关。",
|
||||
[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] = "此金手指不能用于此游戏版本:",
|
||||
};
|
||||
|
||||
#define SWKBD_ONLY(name, ...) static const char *const name[UI_TEXT_COUNT] = {SWKBD(__VA_ARGS__)}
|
||||
|
||||
+5
-3
@@ -74,9 +74,11 @@ typedef enum {
|
||||
UI_MENU_MODS_ROW_DESC, // printf: files it replaces, files it adds (as of this start)
|
||||
UI_MENU_MODS_OVERRIDDEN, // printf: files a higher mod serves instead, that mod's name
|
||||
UI_MENU_MODS_MOVE_HINT,
|
||||
UI_MENU_MODS_EMPTY, UI_MENU_MODS_SUBSDK, UI_MENU_MODS_EXEFS_LATER, UI_MENU_MODS_CHEATS_LATER, UI_MENU_MODS_BAD_NAME,
|
||||
UI_MENU_MODS_EMPTY, UI_MENU_MODS_SUBSDK, UI_MENU_MODS_EXEFS_LATER, UI_MENU_MODS_BAD_NAME,
|
||||
UI_MENU_MODS_OTHER_VERSION, // printf: files made for another game version, left out
|
||||
UI_MENU_MODS_UNUSED, // under the switch of a mod the port cannot use
|
||||
UI_MENU_MODS_CHEATS, // printf: its cheats as read at start
|
||||
UI_MENU_MODS_CHEATS_FILE, // printf: <build id>.txt, when none were read
|
||||
UI_MENU_MODS_FPS60, UI_MENU_MODS_FPS60_DESC, UI_MENU_MODS_RES, UI_MENU_MODS_RES_DESC,
|
||||
UI_MENU_MODS_QUICKMENU, UI_MENU_MODS_QUICKMENU_DESC,
|
||||
|
||||
@@ -211,8 +213,8 @@ typedef enum {
|
||||
UI_MENU_OV_SCALE_DOWN, // FSR is selected but the image is larger than the window: FSR only enlarges
|
||||
// the Cheats tab (cheats.c): the file, the kinds of cheat and why one cannot be switched
|
||||
UI_MENU_TAB_CHEATS,
|
||||
UI_MENU_CHEATS_NONE, // "%s": cheats\<build id>.txt
|
||||
UI_MENU_CHEATS_FILE, // "%s": the file, "%d": its cheats
|
||||
UI_MENU_CHEATS_NONE, // "%s": <build id>.txt
|
||||
UI_MENU_CHEATS_MOD, // "%s": the mod, "%d": its 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,
|
||||
|
||||
Reference in new issue
Block a user