Make every settings menu row work for Ocarina and give the controls Ocarina's actions and keys.

The Screen tab hides Game resolution when the build has no output and scene patch sets, and the resolution code no
longer grows the memory pool for it. FSR sharpness now also runs when the game image is shrunk to the window, which is
always the case for Ocarina's 2560x1440 picture at 1920x1080, and the overlay drops NX2navi's fixed 3D scene size. A colour
profile set in nx2navi.ini now applies without the menu. The Game tab hides the frame limit in builds without frame-rate
patch sets and lists the game languages the RomFS ships, adding Polish and Brazilian Portuguese. 5.1 sound is reported to
the game's virtual output device. The remap page describes each button as Ocarina's controls screen does, gives each
D-pad direction its own description and drops NX2navi's shake row; the keyboard defaults follow Ocarina (Shift dashes on A,
Ctrl puts away on B, O and N for the ocarina and Navi, middle mouse resets the camera). docs/controls.md is updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-06 11:33:06 -05:00
parent 618b9ba4e5
commit 9a5b1163f3
18 changed files with 385 additions and 174 deletions

View File

@@ -8,31 +8,37 @@ Input comes from the first SDL3 gamepad, the keyboard and the mouse, merged into
- `xbox`: south A, east B, west X, north Y, as an Xbox pad labels them; on a PlayStation pad cross is A, circle B, square X, triangle Y. - `xbox`: south A, east B, west X, north Y, as an Xbox pad labels them; on a PlayStation pad cross is A, circle B, square X, triangle Y.
- `auto` (default): `nintendo` for a pad whose east button SDL reports labelled A (Switch Pro Controller, Nintendo-layout pads), `xbox` for the others. - `auto` (default): `nintendo` for a pad whose east button SDL reports labelled A (Switch Pro Controller, Nintendo-layout pads), `xbox` for the others.
The log names the layout in effect (`input: gamepad layout ...`); the menu shows it under *Automatic*. Which controller's buttons the game's prompts show is `NX2NAVI_PROMPTS` (see Xbox button prompts below). 0.1.9's `pad_layout = xbox_prompts` is read as `pad_layout = nintendo` with `prompts = xbox`, and the menu writes it that way. The log names the layout in effect (`input: gamepad layout ...`); the menu shows it under *Automatic*. Ocarina's prompts always show the Switch letters: the Xbox and PC prompt folders below are made from NX2navi's files and do not exist for Ocarina, so its menu has no *Button prompts* row. 0.1.9's `pad_layout = xbox_prompts` is read as `pad_layout = nintendo` with `prompts = xbox`, and the menu writes it that way.
The actions are Ocarina's, as its own *Basic Controls* screen (Plus menu, System) names them:
| Switch | Gamepad (by position, Nintendo layout) | Keyboard and mouse | Action in the world | | Switch | Gamepad (by position, Nintendo layout) | Keyboard and mouse | Action in the world |
|---|---|---|---| |---|---|---|---|
| Left stick | left stick | W A S D | move | | Left stick | left stick | W A S D | move |
| Right stick | right stick | mouse; arrow keys as a second source | camera | | Right stick | right stick | mouse; arrow keys as a second source | camera |
| Y | west | left mouse button | attack | | A | east | E, Left Shift | actions (talk, open, pick up, climb, grab); held, dash |
| ZL | left trigger (over 50%) | right mouse button, Z | shield, lock on | | B | south | Left Ctrl, Backspace | put away, cancel, back |
| ZR | right trigger (over 50%) | F, X | bow |
| X | north | Space | jump | | X | north | Space | jump |
| B | south | Left Shift | run, cancel | | Y | west | left mouse button | attack with the sword |
| A | east | E | interact, pick up | | ZL | left trigger (over 50%) | right mouse button, Z | target (hold or toggle, the game's *Targeting Type* option) |
| L | left shoulder | Q | abilities | | ZR | right trigger (over 50%) | F, X | use the selected item (slingshot, bow, boomerang, hookshot, bombs, bottles) |
| R | right shoulder | R | throw weapon | | L | left shoulder | Q | quick-select items; previous page in the game's menus |
| Left stick click | left stick click | Left Ctrl | crouch | | R | right shoulder | R | quick-select items; next page in the game's menus |
| Right stick click | right stick click | C | first-person view | | Left stick click | left stick click | V | (not on the game's controls screen) |
| D-pad left, up, right, down | D-pad | 1 2 3 4 | quick-select | | Right stick click | right stick click | C, middle mouse button | reset the camera behind Link |
| Plus | Start | Tab | menu, inventory | | D-pad left | D-pad left | 1, O | play the ocarina |
| D-pad up | D-pad up | 2 | put the accessory on or take it off |
| D-pad right | D-pad right | 3, N | talk to Navi |
| D-pad down | D-pad down | 4 | change boots |
| Plus | Start | Tab | menu: items, equipment, collection, system |
| Minus | Back | M | map | | Minus | Back | M | map |
| Right stick shaken left and right | shake the right stick | G | detach a fused part from what object holds |
Esc is unbound in the game; it opens the settings menu and releases the mouse cursor (see Mouse camera). Z and X duplicate ZL and ZR so menu pages turn with two neighbouring keys; the menu tabs (L, R) are Q and R. The mouse wheel is unbound. The bindings are the tables of `input_map` in `runtime/input_map.c`: the keys (platform-neutral key ids) and one gamepad table per layout (gamepad inputs by position); `runtime/input_win.c` translates Win32 virtual keys and SDL buttons. The game's *Swap Jump Controls* option trades B and X (jump on B, put away on X); the bindings stay on the Switch buttons, so Space then puts away and Left Ctrl jumps. Left Shift is A, so holding it dashes; E presses A once for talking and opening. Esc is unbound in the game; it opens the settings menu and releases the mouse cursor (see Mouse camera). Z and X duplicate ZL and ZR on neighbouring keys. The mouse wheel is unbound. The right-stick shake (`bind_SHAKE`, NX2navi's object) has no default key and no row in Ocarina's menu. The bindings are the tables of `input_map` in `runtime/input_map.c`: the keys (platform-neutral key ids) and one gamepad table per layout (gamepad inputs by position); `runtime/input_win.c` translates Win32 virtual keys and SDL buttons.
## Xbox button prompts ## Xbox button prompts
NX2navi only: the folders are made from NX2navi's UI archive and fonts (`Font/Font*.Nin_NX_NVN.bfarc.zs`); Ocarina's are `Font2/*.Nin_Ounce_NVN2` and have no such folders.
`NX2NAVI_PROMPTS` (`prompts`, the *Button prompts* row on the Controls tab, read at start) picks the controller whose buttons the game's prompts show: `nintendo` (default) keeps the game's own, `xbox` shows an Xbox controller's, `pc` the keyboard and mouse (PC button prompts, below). `NX2NAVI_PROMPTS` (`prompts`, the *Button prompts* row on the Controls tab, read at start) picks the controller whose buttons the game's prompts show: `nintendo` (default) keeps the game's own, `xbox` shows an Xbox controller's, `pc` the keyboard and mouse (PC button prompts, below).
- L, R, ZL, ZR, Plus and Minus become LB, RB, LT, RT, Menu and View, and the d-pad prompts a cross with an arrow for each direction meant. The letters on the keys are cut out in the game's own text font. - L, R, ZL, ZR, Plus and Minus become LB, RB, LT, RT, Menu and View, and the d-pad prompts a cross with an arrow for each direction meant. The letters on the keys are cut out in the game's own text font.
@@ -59,6 +65,8 @@ The Switch prompts stay, with a note under *Button prompts* and a `RomFS overlay
## PC button prompts ## PC button prompts
NX2navi only, as the Xbox prompts above.
`prompts = pc` (*PC* on the *Button prompts* row) shows the key or mouse button the default keyboard bindings press each Switch button with, whatever the pad layout. The game loads `romfs-patches-pc` in place of `romfs-patches`, written by `tools/make_romfs_patches.py --prompts pc` (`button_icons.py`, `pc_icons`), which the setup runs next to the Xbox ones: `prompts = pc` (*PC* on the *Button prompts* row) shows the key or mouse button the default keyboard bindings press each Switch button with, whatever the pad layout. The game loads `romfs-patches-pc` in place of `romfs-patches`, written by `tools/make_romfs_patches.py --prompts pc` (`button_icons.py`, `pc_icons`), which the setup runs next to the Xbox ones:
| Switch | Prompt | | Switch | Prompt |
@@ -87,9 +95,9 @@ The Minus+Plus combo never reaches the game. In the menu the arrow keys, the D-p
## Remapping ## Remapping
The *Controls* tab of the settings menu lists, under the button layout, every Switch button, the eight stick directions the keys drive (movement and camera) and the shake key, each with two key cells and a controller cell. Select a cell, press A or Enter, then press the new key, mouse button or controller button; Esc or five seconds without a press cancel, and a controller button cancels a key cell. Delete, Backspace or X clears the selected cell. A key another action has moves to the new one (the description names the action it left); a controller button swaps with the one it replaces. A remapped controller button is physical: from then on the face buttons (A B X Y) stay where they are in both layouts, until the buttons are put back as the layout in use has them or *Reset all buttons* is chosen. F1, F8, F10, F11 and Esc cannot be bound (the menu, the flight recorder and the window keep them). Punctuation keys are named by their place on a US keyboard; the menu shows the character the keyboard layout in use puts there. The *Controls* tab of the settings menu lists, under the button layout, every Switch button and the eight stick directions the keys drive (movement and camera), each with two key cells and a controller cell. Each row's description says what the button does in Ocarina. Select a cell, press A or Enter, then press the new key, mouse button or controller button; Esc or five seconds without a press cancel, and a controller button cancels a key cell. Delete, Backspace or X clears the selected cell. A key another action has moves to the new one (the description names the action it left); a controller button swaps with the one it replaces. A remapped controller button is physical: from then on the face buttons (A B X Y) stay where they are in both layouts, until the buttons are put back as the layout in use has them or *Reset all buttons* is chosen. F1, F8, F10, F11 and Esc cannot be bound (the menu, the flight recorder and the window keep them). Punctuation keys are named by their place on a US keyboard; the menu shows the character the keyboard layout in use puts there.
The tab writes `nx2navi.ini` lines, one per Switch button or stick direction: `bind_<button> = <entry>, <entry>, ...`. The button is `A B X Y L R ZL ZR PLUS MINUS LEFT UP RIGHT DOWN LCLICK RCLICK`, or a stick direction `LSTICK_LEFT LSTICK_UP LSTICK_RIGHT LSTICK_DOWN` (movement, W A S D by default) and `RSTICK_...` (camera, the arrow keys), or `SHAKE` (keys only, G by default). An entry is `pad:<name>` or `key:<name>`: The tab writes `nx2navi.ini` lines, one per Switch button or stick direction: `bind_<button> = <entry>, <entry>, ...`. The button is `A B X Y L R ZL ZR PLUS MINUS LEFT UP RIGHT DOWN LCLICK RCLICK`, or a stick direction `LSTICK_LEFT LSTICK_UP LSTICK_RIGHT LSTICK_DOWN` (movement, W A S D by default) and `RSTICK_...` (camera, the arrow keys), or `SHAKE` (keys only, no default key; NX2navi's object shake). An entry is `pad:<name>` or `key:<name>`:
- pad names: `south east west north l r zl zr start back lstick rstick dpad_left dpad_up dpad_right dpad_down lpaddle1 rpaddle1 lpaddle2 rpaddle2` (`zl`, `zr` are the triggers; the paddles are the back buttons of an Xbox Elite, DualSense Edge or Steam Controller, upper pair 1, lower pair 2, and no Switch button has them by default) - pad names: `south east west north l r zl zr start back lstick rstick dpad_left dpad_up dpad_right dpad_down lpaddle1 rpaddle1 lpaddle2 rpaddle2` (`zl`, `zr` are the triggers; the paddles are the back buttons of an Xbox Elite, DualSense Edge or Steam Controller, upper pair 1, lower pair 2, and no Switch button has them by default)
- key names: `a` to `z`, `0` to `9`, `f2` to `f7`, `f9`, `f12`, `num0` to `num9`, `space tab enter backspace lshift rshift lctrl rctrl lalt capslock insert delete home end pageup pagedown up down left right`, `num_add num_sub num_mul num_div num_decimal`, `minus equals lbracket rbracket semicolon apostrophe comma period slash backslash grave`, `mouse_l mouse_r mouse_m mouse_x1 mouse_x2` - key names: `a` to `z`, `0` to `9`, `f2` to `f7`, `f9`, `f12`, `num0` to `num9`, `space tab enter backspace lshift rshift lctrl rctrl lalt capslock insert delete home end pageup pagedown up down left right`, `num_add num_sub num_mul num_div num_decimal`, `minus equals lbracket rbracket semicolon apostrophe comma period slash backslash grave`, `mouse_l mouse_r mouse_m mouse_x1 mouse_x2`
@@ -101,14 +109,16 @@ A line replaces every default of that button, pad and keyboard, so list the keys
A pad that reports its face buttons swapped (A/B and X/Y, as some GuliKit models do) is fixed with: A pad that reports its face buttons swapped (A/B and X/Y, as some GuliKit models do) is fixed with:
``` ```
bind_A = pad:south, key:E bind_A = pad:south, key:default
bind_B = pad:east, key:lshift bind_B = pad:east, key:default
bind_X = pad:west, key:space bind_X = pad:west, key:space
bind_Y = pad:north, key:mouse_l bind_Y = pad:north, key:mouse_l
``` ```
## Mouse camera ## Mouse camera
Ocarina's build has no code patch sets, so the mouse always turns its camera by stick emulation (the last paragraphs of this section) and its menu has no *Mouse camera* row; the direct mode below is NX2navi 1.4.3's.
`mouse_mode = direct` (the default) turns the camera by the raw mouse motion on game 1.4.3, through hooks in the game's camera code (`runtime/mouse_direct.c`, the `mouse_direct` sites of `recomp/patches-v143.txt`). None of them changes a step of the gamepad alone. The free-orbit camera receives raw-count `mouse_mode = direct` (the default) turns the camera by the raw mouse motion on game 1.4.3, through hooks in the game's camera code (`runtime/mouse_direct.c`, the `mouse_direct` sites of `recomp/patches-v143.txt`). None of them changes a step of the gamepad alone. The free-orbit camera receives raw-count
angular increments at its final spherical-angle output: 0.08 degrees per count on both axes at sensitivity 1, with angular increments at its final spherical-angle output: 0.08 degrees per count on both axes at sensitivity 1, with
no time multiplier, curve or carry into later frames. The controller's persistent pitch/yaw move with the output. no time multiplier, curve or carry into later frames. The controller's persistent pitch/yaw move with the output.
@@ -145,6 +155,8 @@ The stick direction bits (`StickLLeft` to `StickRDown`) are derived from the sti
## Mouse in the game's menus ## Mouse in the game's menus
NX2navi 1.4.3 only (the screens it reads are NX2navi's eui menus); Ocarina's menus take the keys and the pad.
On game 1.4.3, while one of the game's menus has its focus box (the frame the d-pad moves: the title, the save list, the inventory and its System tab, Options, shops, dialogue choices), the cursor is released from the mouse camera and shown in the middle of the window. The item under the pointer takes the focus as if the d-pad had moved there, with the game's highlight, sound and description; a left click is A on it, a right click is B. The keys and the pad keep working, and the focus moves only when the pointer moves. This happens only while the keyboard and mouse are the device used last: after a gamepad button press or a stick pushed past half way the menus are as on the console, with no pointer, until the mouse moves or a key is pressed (`input_kbm_last` in `runtime/input.c`). The ability wheel, the d-pad strips, Autobuild, the Purah Pad's camera and the map stay gameplay: the mouse keeps the camera there. When the menu closes the cursor is captured again. On game 1.4.3, while one of the game's menus has its focus box (the frame the d-pad moves: the title, the save list, the inventory and its System tab, Options, shops, dialogue choices), the cursor is released from the mouse camera and shown in the middle of the window. The item under the pointer takes the focus as if the d-pad had moved there, with the game's highlight, sound and description; a left click is A on it, a right click is B. The keys and the pad keep working, and the focus moves only when the pointer moves. This happens only while the keyboard and mouse are the device used last: after a gamepad button press or a stick pushed past half way the menus are as on the console, with no pointer, until the mouse moves or a key is pressed (`input_kbm_last` in `runtime/input.c`). The ability wheel, the d-pad strips, Autobuild, the Purah Pad's camera and the map stay gameplay: the mouse keeps the camera there. When the menu closes the cursor is captured again.
`runtime/menu_cursor.c` reads eui's screens at each pad read and moves the focus with the writes `eui::BoxCursorMgr::moveBoxCursor` makes, so no game code is called. `menu_cursor = 0` (`NX2NAVI_MENU_CURSOR=0`, live; the *Mouse in the game's menus* row of the Controls tab) turns it off; `NX2NAVI_MENU_CURSOR_LOG=1` logs every screen it reads (by default the first six), with the layout size, the node count and the hit panes it uses. `runtime/menu_cursor.c` reads eui's screens at each pad read and moves the focus with the writes `eui::BoxCursorMgr::moveBoxCursor` makes, so no game code is called. `menu_cursor = 0` (`NX2NAVI_MENU_CURSOR=0`, live; the *Mouse in the game's menus* row of the Controls tab) turns it off; `NX2NAVI_MENU_CURSOR_LOG=1` logs every screen it reads (by default the first six), with the layout size, the node count and the hit panes it uses.

View File

@@ -1038,7 +1038,10 @@ static void virtual_device_manager_handler(IpcSession *s, const IpcRequest *rq,
case 401: { // GetVirtualOutputDeviceProperties(name) -> block case 401: { // GetVirtualOutputDeviceProperties(name) -> block
uint8_t block[0x228] = {0}; uint8_t block[0x228] = {0};
memcpy(block, virtual_output, sizeof virtual_output); memcpy(block, virtual_output, sizeof virtual_output);
uint32_t v[4] = {3, 2, 2, 48000}; // type, (2), channels, sample rate // type, (2), channels, sample rate. The channels are this run's output (output_channels), as IAudioDevice's
// GetActiveChannelCount reports: a Switch 2 game (Ocarina) sizes its mix from this block, so a constant 2
// here kept 5.1 at stereo
uint32_t v[4] = {3, 2, (uint32_t)output_channels(), 48000};
memcpy(block + 0x100, v, sizeof v); memcpy(block + 0x100, v, sizeof v);
memcpy(block + 0x110, device_name, sizeof device_name); memcpy(block + 0x110, device_name, sizeof device_name);
uint64_t latency_ns = 10000000; uint64_t latency_ns = 10000000;

View File

@@ -139,7 +139,7 @@ static const CfgMeta metas[] = {
{"REALTIME", "1", "0|1", RESTART}, {"CLOTH_REALTIME", "1", "0|1", RESTART}, {"REALTIME", "1", "0|1", RESTART}, {"CLOTH_REALTIME", "1", "0|1", RESTART},
{"MODS_REBUILD", "auto", "auto|off", RESTART}, {"MODS_REBUILD", "auto", "auto|off", RESTART},
{"HIGHFPS_FIX", "1", "0|1", 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}, {"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|pl", RESTART},
{"OPERATION_MODE", "docked", "docked|handheld", RESTART}, {"OPERATION_MODE", "docked", "docked|handheld", RESTART},
{"ASSUME_FOCUS", "1", "0|1", LIVE}, // read on every focus change (ov_system.c) {"ASSUME_FOCUS", "1", "0|1", LIVE}, // read on every focus change (ov_system.c)
// Sound, Controls, Menu // Sound, Controls, Menu

View File

@@ -230,13 +230,18 @@ int probe_cfg(void) {
dn[KEY_MOUSE_R] = dn[KEY_Z] = 1; dn[KEY_MOUSE_R] = dn[KEY_Z] = 1;
CHECK(input_map_buttons(dn) == (1ull << B_Y | 1ull << B_ZL), "keys: right mouse button and Z both press ZL"); CHECK(input_map_buttons(dn) == (1ull << B_Y | 1ull << B_ZL), "keys: right mouse button and Z both press ZL");
memset(dn, 0, sizeof dn); memset(dn, 0, sizeof dn);
dn[KEY_X] = dn[KEY_TAB] = dn[KEY_M] = dn[KEY_LCTRL] = dn[KEY_3] = 1; dn[KEY_X] = dn[KEY_TAB] = dn[KEY_M] = dn[KEY_V] = dn[KEY_3] = 1;
CHECK(input_map_buttons(dn) == (1ull << B_ZR | 1ull << B_PLUS | 1ull << B_MINUS | 1ull << B_STICK_L | 1ull << B_RIGHT), CHECK(input_map_buttons(dn) == (1ull << B_ZR | 1ull << B_PLUS | 1ull << B_MINUS | 1ull << B_STICK_L | 1ull << B_RIGHT),
"keys: X ZR, Tab Plus, M Minus, Left Ctrl stick click, 3 D-pad right"); "keys: X ZR, Tab Plus, M Minus, V stick click, 3 D-pad right");
memset(dn, 0, sizeof dn);
dn[KEY_LSHIFT] = 1;
CHECK(input_map_buttons(dn) == 1ull << B_A, "keys: Left Shift is A (Ocarina dashes on A held)");
dn[KEY_LSHIFT] = 0, dn[KEY_LCTRL] = dn[KEY_O] = dn[KEY_N] = 1;
CHECK(input_map_buttons(dn) == (1ull << B_B | 1ull << B_LEFT | 1ull << B_RIGHT),
"keys: Left Ctrl puts away (B), O the ocarina (D-pad left), N Navi (D-pad right)");
memset(dn, 0, sizeof dn); memset(dn, 0, sizeof dn);
dn[KEY_G] = 1; dn[KEY_G] = 1;
CHECK(input_map_buttons(dn) == 0 && input_map_held(dn, B_SHAKE) && !input_map_held(dn, B_A), CHECK(input_map_buttons(dn) == 0 && !input_map_held(dn, B_SHAKE), "keys: G is free (no shake key by default)");
"keys: G shakes and presses no button");
memset(dn, 0, sizeof dn); memset(dn, 0, sizeof dn);
dn[KEY_W] = 1; dn[KEY_W] = 1;
input_map_stick(dn, 0, st); input_map_stick(dn, 0, st);
@@ -376,7 +381,7 @@ int probe_cfg(void) {
CHECK(!line[0], "edit: an action at its defaults needs no line"); CHECK(!line[0], "edit: an action at its defaults needs no line");
CHECK(input_map_set_key(&mp, B_A, 0, KEY_F) == B_ZR, "edit: F taken from ZR"); CHECK(input_map_set_key(&mp, B_A, 0, KEY_F) == B_ZR, "edit: F taken from ZR");
input_map_line(&mp, B_A, line, sizeof line); input_map_line(&mp, B_A, line, sizeof line);
CHECK(!strcmp(line, "key:f, pad:default"), "edit: A's line is key:f, pad:default"); CHECK(!strcmp(line, "key:f, key:lshift, pad:default"), "edit: A's line is key:f, key:lshift (its second key), pad:default");
input_map_line(&mp, B_ZR, line, sizeof line); input_map_line(&mp, B_ZR, line, sizeof line);
CHECK(!strcmp(line, "key:x, pad:default"), "edit: ZR keeps X"); CHECK(!strcmp(line, "key:x, pad:default"), "edit: ZR keeps X");
CHECK(input_map_set_key(&mp, B_ZL, 1, KEY_NONE) == -1, "edit: clearing a key takes from no one"); CHECK(input_map_set_key(&mp, B_ZL, 1, KEY_NONE) == -1, "edit: clearing a key takes from no one");

View File

@@ -113,6 +113,11 @@ int frame_step_realtime(void) { return step_word != NULL; }
#define LIMIT_MIN_HZ 30 #define LIMIT_MIN_HZ 30
#define LIMIT_MAX_HZ 240 // 1 / STEP_MIN_S #define LIMIT_MAX_HZ 240 // 1 / STEP_MIN_S
static int fps60_set = -2; static int fps60_set = -2;
static int game_interval = 1; // the present interval of the newest frame (frame_step_present)
// The limit can change anything only with the fps60 or realtime patch set (NX2navi's builds). Without them (Ocarina) the
// game picks its own present interval and the pacer follows it (nvn_api_obj.c present_period).
int frame_limit_adjustable(void) { return rt_patch_set("fps60") >= 0 || rt_patch_set("realtime") >= 0; }
static unsigned limit_seen; static unsigned limit_seen;
static int limit_read; static int limit_read;
static int limit_hz = -1; // 0: display; -1 before the first read static int limit_hz = -1; // 0: display; -1 before the first read
@@ -141,6 +146,12 @@ static void frame_limit_live(void) {
int hz = limit_parse(); int hz = limit_parse();
if (hz == limit_hz) return; if (hz == limit_hz) return;
limit_hz = hz; limit_hz = hz;
if (!frame_limit_adjustable()) {
if (hz != 60)
rt_log("frame rate: NX2NAVI_FPS_LIMIT=%s does nothing in this build (no fps60 or realtime patch set); the "
"game sets its own rate", cfg_value("NX2NAVI_FPS_LIMIT"));
return;
}
if (fps60_set == -2) fps60_set = rt_patch_set("fps60"); if (fps60_set == -2) fps60_set = rt_patch_set("fps60");
if (fps60_set >= 0) rt_patch_switch(fps60_set, hz != 30); if (fps60_set >= 0) rt_patch_switch(fps60_set, hz != 30);
if ((hz > 60 || hz == 0) && !step_word) if ((hz > 60 || hz == 0) && !step_word)
@@ -159,8 +170,10 @@ uint64_t frame_step_cap_ns(void) {
} }
// The frame rate the limit gives, for the performance overlay: the setting, the monitor's rate for "display", 60 at // The frame rate the limit gives, for the performance overlay: the setting, the monitor's rate for "display", 60 at
// most without the real-time step; 0 before the first frame read the setting. // most without the real-time step; the game's own rate (60 Hz over its present interval) in a build without the patch
// sets; 0 before the first frame read the setting.
double frame_step_limit_hz(void) { double frame_step_limit_hz(void) {
if (!frame_limit_adjustable()) return 60.0 / game_interval;
int hz = limit_hz; int hz = limit_hz;
if (hz < 0) return 0; if (hz < 0) return 0;
double r = hz ? hz : gfx_window_refresh_hz(); double r = hz ? hz : gfx_window_refresh_hz();
@@ -265,6 +278,7 @@ static void world_clock(double dt, double step) {
} }
void frame_step_present(uint64_t display_ns, int interval) { void frame_step_present(uint64_t display_ns, int interval) {
game_interval = interval > 0 ? interval : 1;
frame_limit_live(); frame_limit_live();
double step = 0, dt = last_ns ? (double)(display_ns - last_ns) * 1e-9 : 0; double step = 0, dt = last_ns ? (double)(display_ns - last_ns) * 1e-9 : 0;
if (step_word && last_ns) { if (step_word && last_ns) {

View File

@@ -114,7 +114,8 @@ static VkSwapchainKHR g_sc;
static VkFormat g_sc_fmt; static VkFormat g_sc_fmt;
static int g_sc_hdr; // HDR10 (NX2NAVI_HDR, vk_hdr.c): PQ code values in Rec. 2020 static int g_sc_hdr; // HDR10 (NX2NAVI_HDR, vk_hdr.c): PQ code values in Rec. 2020
static VkExtent2D g_sc_ext; static VkExtent2D g_sc_ext;
static int g_scaler; // the last present: 0 the game image 1:1, 1 scaled by the blit, 2 by FSR static int g_scaler; // the last present: 0 the game image 1:1, 1 scaled by the blit, 2 by FSR,
// 3 shrunk by the blit and sharpened by RCAS
static uint32_t g_sc_n; static uint32_t g_sc_n;
static VkImage g_sc_img[MAX_IMAGES]; static VkImage g_sc_img[MAX_IMAGES];
static VkImageView g_sc_view[MAX_IMAGES]; // colour attachment views for the menu overlay static VkImageView g_sc_view[MAX_IMAGES]; // colour attachment views for the menu overlay
@@ -806,9 +807,10 @@ static void present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w
VkImage psrc = graded ? graded : src; VkImage psrc = graded ? graded : src;
VkFormat pfmt = graded ? VK_FORMAT_R16G16B16A16_SFLOAT : fmt; VkFormat pfmt = graded ? VK_FORMAT_R16G16B16A16_SFLOAT : fmt;
const int *prect = graded ? grect : rect; const int *prect = graded ? grect : rect;
// FSR (NX2NAVI_UPSCALER) when the picture's rectangle is larger than the crop; else the bilinear blit // FSR (NX2NAVI_UPSCALER): EASU when the picture's rectangle is larger than the crop, the shrink and RCAS when it is
int fsr = general && vk_fsr_record(cb, slot, psrc, pfmt, graded ? cw : w, graded ? ch : h, prect, dst, to); // smaller; else the bilinear blit
g_scaler = fsr ? 2 : cw != to[2] || ch != to[3]; int fsr = general ? vk_fsr_record(cb, slot, psrc, pfmt, graded ? cw : w, graded ? ch : h, prect, dst, to) : 0;
g_scaler = fsr == 2 ? 3 : fsr ? 2 : cw != to[2] || ch != to[3];
if (!fsr) { if (!fsr) {
if (general) // a GENERAL source (vk_texture.c images): earlier submissions' writes become visible to the blit here if (general) // a GENERAL source (vk_texture.c images): earlier submissions' writes become visible to the blit here
sync_barrier(cb, psrc, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, sync_barrier(cb, psrc, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,

View File

@@ -272,6 +272,7 @@ void res_fn_hit(uint64_t addr, uint64_t x0); // main.c fnprof_hit:
void res_present(Cpu *c); // nvnQueuePresentTexture: applies a pending scene size void res_present(Cpu *c); // nvnQueuePresentTexture: applies a pending scene size
void res_sizes(unsigned out[2], unsigned scene[2]); // the output and scene sizes in effect (the game's own void res_sizes(unsigned out[2], unsigned scene[2]); // the output and scene sizes in effect (the game's own
// until res_init switched the sets on) // until res_init switched the sets on)
int res_adjustable(void); // the build has the output and scene patch sets (NX2navi)
int res_is_16x9(unsigned w, unsigned h); // within 1% of 16:9 (the test res_init and romfs.c share) int res_is_16x9(unsigned w, unsigned h); // within 1% of 16:9 (the test res_init and romfs.c share)
int res_wants_wide_overlay(const unsigned out[2]); // not 16:9 on a game version with the camera aspect patch int res_wants_wide_overlay(const unsigned out[2]); // not 16:9 on a game version with the camera aspect patch
void res_wanted(unsigned out[2]); // the output size NX2NAVI_OUTPUT_RES asks for void res_wanted(unsigned out[2]); // the output size NX2NAVI_OUTPUT_RES asks for
@@ -288,6 +289,7 @@ void *rt_patch_page(void); // the page the patch
void frame_step_init(void); // after rt_patches_init: the real-time step's first value void frame_step_init(void); // after rt_patches_init: the real-time step's first value
int frame_step_realtime(void); // the real-time step is on: presents ignore the interval int frame_step_realtime(void); // the real-time step is on: presents ignore the interval
uint64_t frame_step_cap_ns(void); // with the real-time step: the shortest frame in ns uint64_t frame_step_cap_ns(void); // with the real-time step: the shortest frame in ns
int frame_limit_adjustable(void); // the build has the fps60 or realtime patch set
double frame_step_limit_hz(void); // the frame rate the limit gives (overlay); 0 unknown double frame_step_limit_hz(void); // the frame rate the limit gives (overlay); 0 unknown
int64_t frame_step_world_us(void); // game time since the loaded save's first frame, -1 before int64_t frame_step_world_us(void); // game time since the loaded save's first frame, -1 before
// (NX2NAVI_FPS_LIMIT, live) // (NX2NAVI_FPS_LIMIT, live)

View File

@@ -13,14 +13,20 @@
#define DIAGONAL 23170 // STICK_MAX / sqrt(2) #define DIAGONAL 23170 // STICK_MAX / sqrt(2)
#define MOUSE_FULL_CPS 3000.0 #define MOUSE_FULL_CPS 3000.0
// Ocarina's controls (its Basic Controls screen, LayoutMsg/PlusMenu_00 of the game's messages): A actions and, held,
// dash; B put away; X jump; Y the sword; ZL target; ZR the selected item; L and R quick-select items; the d-pad plays
// the ocarina (left), puts the accessory on (up), calls Navi (right) and changes boots (down); the right stick's press
// resets the camera. So E acts and Left Shift, held, dashes (both A); Space jumps; Left Ctrl and Backspace put away; the
// mouse buttons attack (left), target (right) and reset the camera (middle); O and N are the ocarina and Navi besides 1
// to 4. SHAKE (NX2navi's object shake) has no key: Ocarina has no use for it, and bind_shake still sets one.
#define DEFAULT_KEYS \ #define DEFAULT_KEYS \
{KEY_W, B_SL_UP}, {KEY_A, B_SL_LEFT}, {KEY_S, B_SL_DOWN}, {KEY_D, B_SL_RIGHT}, /* move */ \ {KEY_W, B_SL_UP}, {KEY_A, B_SL_LEFT}, {KEY_S, B_SL_DOWN}, {KEY_D, B_SL_RIGHT}, /* move */ \
{KEY_UP, B_SR_UP}, {KEY_LEFT, B_SR_LEFT}, {KEY_DOWN, B_SR_DOWN}, {KEY_RIGHT, B_SR_RIGHT}, /* camera, second source */ \ {KEY_UP, B_SR_UP}, {KEY_LEFT, B_SR_LEFT}, {KEY_DOWN, B_SR_DOWN}, {KEY_RIGHT, B_SR_RIGHT}, /* camera, second source */ \
{KEY_MOUSE_L, B_Y}, {KEY_MOUSE_R, B_ZL}, {KEY_Z, B_ZL}, {KEY_F, B_ZR}, {KEY_X, B_ZR}, \ {KEY_MOUSE_L, B_Y}, {KEY_MOUSE_R, B_ZL}, {KEY_Z, B_ZL}, {KEY_F, B_ZR}, {KEY_X, B_ZR}, \
{KEY_SPACE, B_X}, {KEY_LSHIFT, B_B}, {KEY_E, B_A}, {KEY_Q, B_L}, {KEY_R, B_R}, \ {KEY_SPACE, B_X}, {KEY_E, B_A}, {KEY_LSHIFT, B_A}, {KEY_LCTRL, B_B}, {KEY_BACKSPACE, B_B}, {KEY_Q, B_L}, \
{KEY_LCTRL, B_STICK_L}, {KEY_C, B_STICK_R}, \ {KEY_R, B_R}, {KEY_V, B_STICK_L}, {KEY_C, B_STICK_R}, {KEY_MOUSE_M, B_STICK_R}, \
{KEY_1, B_LEFT}, {KEY_2, B_UP}, {KEY_3, B_RIGHT}, {KEY_4, B_DOWN}, \ {KEY_1, B_LEFT}, {KEY_O, B_LEFT}, {KEY_2, B_UP}, {KEY_3, B_RIGHT}, {KEY_N, B_RIGHT}, {KEY_4, B_DOWN}, \
{KEY_TAB, B_PLUS}, {KEY_M, B_MINUS}, {KEY_G, B_SHAKE} {KEY_TAB, B_PLUS}, {KEY_M, B_MINUS}
// By position: south is Switch B, east A, west Y, north X (Nintendo layout); the Xbox layout swaps A with B and X with Y // By position: south is Switch B, east A, west Y, north X (Nintendo layout); the Xbox layout swaps A with B and X with Y
// (south A, as the Xbox labels; cross A on a PlayStation pad). The triggers are ZL and ZR. // (south A, as the Xbox labels; cross A on a PlayStation pad). The triggers are ZL and ZR.
@@ -31,7 +37,7 @@
{PAD_ZR, B_ZR} {PAD_ZR, B_ZR}
#define NINTENDO_PADS DEFAULT_PADS(B_B, B_A, B_Y, B_X) #define NINTENDO_PADS DEFAULT_PADS(B_B, B_A, B_Y, B_X)
#define XBOX_PADS DEFAULT_PADS(B_A, B_B, B_X, B_Y) #define XBOX_PADS DEFAULT_PADS(B_A, B_B, B_X, B_Y)
enum { DEFAULT_KEY_COUNT = 27, DEFAULT_PAD_COUNT = 16 }; enum { DEFAULT_KEY_COUNT = 31, DEFAULT_PAD_COUNT = 16 };
_Static_assert(sizeof (Binding[]){DEFAULT_KEYS} / sizeof (Binding) == DEFAULT_KEY_COUNT, "DEFAULT_KEY_COUNT"); _Static_assert(sizeof (Binding[]){DEFAULT_KEYS} / sizeof (Binding) == DEFAULT_KEY_COUNT, "DEFAULT_KEY_COUNT");
static const InputMap defaults = {{DEFAULT_KEYS}, DEFAULT_KEY_COUNT, {{NINTENDO_PADS}, {XBOX_PADS}}, static const InputMap defaults = {{DEFAULT_KEYS}, DEFAULT_KEY_COUNT, {{NINTENDO_PADS}, {XBOX_PADS}},

View File

@@ -74,9 +74,11 @@ static const char *switch_language(const char *tag) {
p += k; p += k;
} }
if (!strcmp(lang, "ja") || !strcmp(lang, "de") || !strcmp(lang, "it") || !strcmp(lang, "nl") || if (!strcmp(lang, "ja") || !strcmp(lang, "de") || !strcmp(lang, "it") || !strcmp(lang, "nl") ||
!strcmp(lang, "ru") || !strcmp(lang, "ko") || !strcmp(lang, "pt")) !strcmp(lang, "ru") || !strcmp(lang, "ko") || !strcmp(lang, "pl"))
return !strcmp(lang, "ja") ? "ja" : !strcmp(lang, "de") ? "de" : !strcmp(lang, "it") ? "it" return !strcmp(lang, "ja") ? "ja" : !strcmp(lang, "de") ? "de" : !strcmp(lang, "it") ? "it"
: !strcmp(lang, "nl") ? "nl" : !strcmp(lang, "ru") ? "ru" : !strcmp(lang, "ko") ? "ko" : "pt"; : !strcmp(lang, "nl") ? "nl" : !strcmp(lang, "ru") ? "ru" : !strcmp(lang, "ko") ? "ko" : "pl";
// Brazil's Portuguese is a language of its own on the Switch (pt-BR, Mals/USpt); Portugal's is pt
if (!strcmp(lang, "pt")) return !strcmp(region, "BR") ? "pt-BR" : "pt";
if (!strcmp(lang, "fr")) return !strcmp(region, "CA") ? "fr-CA" : "fr"; if (!strcmp(lang, "fr")) return !strcmp(region, "CA") ? "fr-CA" : "fr";
if (!strcmp(lang, "es")) return *region && strcmp(region, "ES") ? "es-419" : "es"; if (!strcmp(lang, "es")) return *region && strcmp(region, "ES") ? "es-419" : "es";
if (!strcmp(lang, "zh")) if (!strcmp(lang, "zh"))
@@ -93,7 +95,7 @@ static const char *switch_language(const char *tag) {
// spellings, which older nx2navi.ini files and menus wrote, are mapped to them. // spellings, which older nx2navi.ini files and menus wrote, are mapped to them.
const char *ov_language(void) { const char *ov_language(void) {
static const char *const codes[] = {"ja", "en-US", "fr", "de", "it", "es", "ko", "nl", "pt", "ru", static const char *const codes[] = {"ja", "en-US", "fr", "de", "it", "es", "ko", "nl", "pt", "ru",
"en-GB", "fr-CA", "es-419", "zh-Hans", "zh-Hant", "pt-BR"}; "en-GB", "fr-CA", "es-419", "zh-Hans", "zh-Hant", "pt-BR", "pl"};
const char *code = cfg_get("NX2NAVI_LANG"); // no fixed default: NX2NAVI_LOCALE or the Windows user locale decides when unset const char *code = cfg_get("NX2NAVI_LANG"); // no fixed default: NX2NAVI_LOCALE or the Windows user locale decides when unset
if (code && *code) { if (code && *code) {
if (!strcmp(code, "zh-CN")) return "zh-Hans"; if (!strcmp(code, "zh-CN")) return "zh-Hans";

View File

@@ -174,9 +174,13 @@ static uint64_t shadow_kib(void) {
return R.shadow > SHADOW_BASE ? ((uint64_t)R.shadow * R.shadow - SHADOW_BASE * SHADOW_BASE) * 8 * 3 / 1024 : 0; return R.shadow > SHADOW_BASE ? ((uint64_t)R.shadow * R.shadow - SHADOW_BASE * SHADOW_BASE) * 8 * 3 / 1024 : 0;
} }
// The generated C carries the output and scene patch sets (NX2navi's builds). Without them (Ocarina) the game draws at its
// own sizes whatever the settings say, so nothing grows for them: no larger pool or HeapDef, no grown sizes reported.
int res_adjustable(void) { return rt_patch_set("output") >= 0 && rt_patch_set("scene") >= 0; }
static int bigger(void) { static int bigger(void) {
decide(); decide();
return R.ow != BASE_W || R.oh != BASE_H || R.scene_set || shadow_kib(); return res_adjustable() && (R.ow != BASE_W || R.oh != BASE_H || R.scene_set || shadow_kib());
} }
uint64_t res_heap_extra_kib(void) { uint64_t res_heap_extra_kib(void) {
@@ -320,16 +324,17 @@ static void res_shadow_range(void) {
void res_init(void) { void res_init(void) {
res_shadow_range(); res_shadow_range();
if (!res_adjustable()) {
rt_log("resolution: the game's own (this build has no output and scene patch sets; output_res and render_scale "
"do nothing)");
return;
}
if (!bigger()) { if (!bigger()) {
rt_log("resolution: the game's own (output 1920x1080, scene 1600x900)"); rt_log("resolution: the game's own (output 1920x1080, scene 1600x900)");
shadow_init(rt_patch_page()); shadow_init(rt_patch_page());
return; return;
} }
int output = rt_patch_set("output"), scene = rt_patch_set("scene"); int output = rt_patch_set("output"), scene = rt_patch_set("scene");
if (output < 0 || scene < 0) {
rt_log("resolution: the generated C has no output and scene patch sets; the game keeps its own resolution");
return;
}
fs_init(); // romfs.c serves the grown HeapDef from here on (res_heapdef_served) fs_init(); // romfs.c serves the grown HeapDef from here on (res_heapdef_served)
if (res_heap_extra_kib() && !R.heapdef_ok) { // sizes at or below the shipped ones fit the shipped heaps if (res_heap_extra_kib() && !R.heapdef_ok) { // sizes at or below the shipped ones fit the shipped heaps
rt_log("resolution: no grown HeapDef table; the game keeps its own resolution"); rt_log("resolution: no grown HeapDef table; the game keeps its own resolution");

View File

@@ -19,7 +19,7 @@ void rt_log(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
} }
static_assert(UI_BIND_SHAKE - UI_BIND_A == ACTION_COUNT - 1 && B_SHAKE == ACTION_COUNT - 1, "UI_BIND_* follow the actions"); static_assert(UI_BIND_SHAKE - UI_BIND_A == ACTION_COUNT - 1 && B_SHAKE == ACTION_COUNT - 1, "UI_BIND_* follow the actions");
static_assert(UI_BIND_DESC_MINUS - UI_BIND_DESC_A == B_MINUS, "UI_BIND_DESC_* follow the actions"); static_assert(UI_BIND_DESC_DOWN - UI_BIND_DESC_A == B_DOWN, "UI_BIND_DESC_* follow the actions");
static_assert(UI_KEY_PAGEDOWN - UI_KEY_SPACE == KEY_PAGEDOWN - KEY_SPACE, "UI_KEY_* follow the key ids"); static_assert(UI_KEY_PAGEDOWN - UI_KEY_SPACE == KEY_PAGEDOWN - KEY_SPACE, "UI_KEY_* follow the key ids");
static_assert(UI_PAD_RPADDLE2 - UI_PAD_SOUTH == PAD_RPADDLE2 - PAD_SOUTH && PAD_RPADDLE2 == PAD_COUNT - 1, static_assert(UI_PAD_RPADDLE2 - UI_PAD_SOUTH == PAD_RPADDLE2 - PAD_SOUTH && PAD_RPADDLE2 == PAD_COUNT - 1,
"UI_PAD_* follow the pad ids"); "UI_PAD_* follow the pad ids");
@@ -46,8 +46,7 @@ static uint64_t g_note_until;
static const char *action_label(int a) { return menu_text((UiTextId)(UI_BIND_A + a)); } static const char *action_label(int a) { return menu_text((UiTextId)(UI_BIND_A + a)); }
static UiTextId action_desc(int a) { static UiTextId action_desc(int a) {
if (a <= B_MINUS) return (UiTextId)(UI_BIND_DESC_A + a); if (a <= B_DOWN) return (UiTextId)(UI_BIND_DESC_A + a); // Ocarina gives each D-pad direction its own action
if (a <= B_DOWN) return UI_BIND_DESC_DPAD;
if (a == B_SHAKE) return UI_BIND_DESC_SHAKE; if (a == B_SHAKE) return UI_BIND_DESC_SHAKE;
return a <= B_SL_DOWN ? UI_BIND_DESC_MOVE : UI_BIND_DESC_CAMERA; return a <= B_SL_DOWN ? UI_BIND_DESC_MOVE : UI_BIND_DESC_CAMERA;
} }
@@ -237,7 +236,7 @@ void binds_rows(float scale) {
for (int a : kMove) row_action(a, m, layout); for (int a : kMove) row_action(a, m, layout);
opt_group(UI_BINDS_GROUP_CAMERA); opt_group(UI_BINDS_GROUP_CAMERA);
for (int a : kCamera) row_action(a, m, layout); for (int a : kCamera) row_action(a, m, layout);
row_action(B_SHAKE, m, layout); // keys only; its controller cell shows the right stick, which the pad shakes itself // No row for B_SHAKE: it shook NX2navi's object loose and Ocarina has no use for it (bind_shake still sets a key)
ImGui::Dummy(ImVec2(0, 6 * scale)); ImGui::Dummy(ImVec2(0, 6 * scale));
g_reset_asked = opt_button("##binds_reset", UI_BINDS_RESET, UI_BINDS_RESET_DESC); g_reset_asked = opt_button("##binds_reset", UI_BINDS_RESET, UI_BINDS_RESET_DESC);
} }

View File

@@ -52,7 +52,10 @@ void rt_log(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
void vk_queue_lock(void); void vk_queue_lock(void);
void vk_queue_unlock(void); void vk_queue_unlock(void);
void res_sizes(unsigned out[2], unsigned scene[2]); void res_sizes(unsigned out[2], unsigned scene[2]);
int res_adjustable(void);
const char *const *vk_color_preset(const char *name);
double frame_step_limit_hz(void); double frame_step_limit_hz(void);
int frame_limit_adjustable(void);
extern const int rt_game_version; extern const int rt_game_version;
extern const char rt_port_version[]; extern const char rt_port_version[];
void cheats_frame(uint64_t frame); // cheats.c void cheats_frame(uint64_t frame); // cheats.c
@@ -582,12 +585,36 @@ static void row_gpu(void) {
opt_choice_list("NX2NAVI_GPU_INDEX", UI_MENU_GPU, vals, names, g_gpu_n + 1, UI_MENU_GPU_DESC); opt_choice_list("NX2NAVI_GPU_INDEX", UI_MENU_GPU, vals, names, g_gpu_n + 1, UI_MENU_GPU_DESC);
} }
// The game language: one entry per Mals language file the running game build ships (ui_text_game_langs), each under // The regions of the Mals/<region>.Product.<n>.sarc.zs files in the RomFS index ("USen", "EUpl"), listed once; 0 when
// its own name. A code that names no entry exactly (older "en", "fr-CA" on a build without it) selects the first entry // the index has none (no RomFS yet).
// of the same catalog language. static int mals_regions(const char *out[24]) {
static char reg[24][5];
static int n = -1; // -1: not scanned (the index may load after the menu first draws)
if (n < 0 && romfs_file_count()) {
n = 0;
for (uint64_t i = 0, c = romfs_file_count(); i < c && n < 24; i++) {
uint64_t off, size;
const char *p = romfs_entry(i, &off, &size);
if (!p || strncmp(p, "Mals/", 5) || strlen(p) < 10 || p[9] != '.') continue;
memcpy(reg[n], p + 5, 4);
reg[n][4] = 0;
bool seen = false;
for (int j = 0; j < n; j++) seen |= !strcmp(reg[j], reg[n]);
if (!seen) n++;
}
}
for (int i = 0; i < n; i++) out[i] = reg[i];
return n > 0 ? n : 0;
}
// The game language: one entry per Mals language file the game ships (ui_text_game_langs_in from the RomFS index, else
// ui_text_game_langs by version), each under its own name. A code that names no entry exactly (older "en", "fr-CA" on
// a build without it) selects the first entry of the same catalog language.
static void row_game_lang(void) { static void row_game_lang(void) {
UiGameLang langs[16]; UiGameLang langs[16];
int n = ui_text_game_langs(rt_game_version, langs, 16); const char *regions[24];
int nr = mals_regions(regions);
int n = nr ? ui_text_game_langs_in(regions, nr, langs, 16) : ui_text_game_langs(rt_game_version, langs, 16);
const char *vals[17], *names[17]; const char *vals[17], *names[17];
vals[0] = ""; vals[0] = "";
names[0] = menu_text(UI_MENU_GAME_LANG_AUTO); names[0] = menu_text(UI_MENU_GAME_LANG_AUTO);
@@ -644,22 +671,23 @@ static const char *present_note(void) {
} }
// ---- the tabs // ---- the tabs
// Colour adjustment (vk_color.c): a profile writes the four values (STS78721's presets, issue #136); moving one of them // Colour adjustment (vk_color.c): a profile's values (vk_color_preset; STS78721's presets, issue #136) win over the four
// makes the profile Custom. // settings, which the rows keep equal to them so the sliders show what is applied: when the profile changes here, and
// when it came from nx2navi.ini or a test hook with other values. Moving a slider makes the profile Custom.
static void rows_color(void) { static void rows_color(void) {
static const struct { const char *name, *b, *c, *s, *g; } presets[] = {
{"default", "0", "100", "100", "1"}, {"vivid", "0", "115", "135", "0.95"}, {"clarity", "2", "110", "115", "1"}};
static const UiTextId names[] = {UI_MENU_COLOR_DEFAULT, UI_MENU_COLOR_VIVID, UI_MENU_COLOR_CLARITY, static const UiTextId names[] = {UI_MENU_COLOR_DEFAULT, UI_MENU_COLOR_VIVID, UI_MENU_COLOR_CLARITY,
UI_MENU_COLOR_CUSTOM}; UI_MENU_COLOR_CUSTOM};
static const char *const keys[4] = {"NX2NAVI_COLOR_BRIGHTNESS", "NX2NAVI_COLOR_CONTRAST", "NX2NAVI_COLOR_SATURATION",
"NX2NAVI_COLOR_GAMMA"};
opt_group(UI_MENU_COLOR); opt_group(UI_MENU_COLOR);
if (opt_choice("NX2NAVI_COLOR_PRESET", UI_MENU_COLOR_PRESET, names, 4, UI_MENU_COLOR_PRESET_DESC)) { opt_choice("NX2NAVI_COLOR_PRESET", UI_MENU_COLOR_PRESET, names, 4, UI_MENU_COLOR_PRESET_DESC);
const char *p = cfg_value("NX2NAVI_COLOR_PRESET"); if (const char *const *p = vk_color_preset(cfg_value("NX2NAVI_COLOR_PRESET"))) {
for (const auto &e : presets) bool differ = false;
if (!strcmp(p, e.name)) { for (int i = 0; i < 4; i++) differ |= strtod(cfg_value(keys[i]), nullptr) != strtod(p[i], nullptr);
cfg_set("NX2NAVI_COLOR_BRIGHTNESS", e.b), cfg_set("NX2NAVI_COLOR_CONTRAST", e.c); if (differ) {
cfg_set("NX2NAVI_COLOR_SATURATION", e.s), cfg_set("NX2NAVI_COLOR_GAMMA", e.g); for (int i = 0; i < 4; i++) cfg_set(keys[i], p[i]);
cfg_save(); cfg_save();
} }
} }
bool moved = opt_slider("NX2NAVI_COLOR_BRIGHTNESS", UI_MENU_COLOR_BRIGHTNESS, -30, 30, UI_MENU_COLOR_BRIGHTNESS_DESC, 1, bool moved = opt_slider("NX2NAVI_COLOR_BRIGHTNESS", UI_MENU_COLOR_BRIGHTNESS, -30, 30, UI_MENU_COLOR_BRIGHTNESS_DESC, 1,
"%+.0f %%"); "%+.0f %%");
@@ -683,9 +711,13 @@ static void tab_screen(float scale) {
static const UiTextId perf[] = {UI_MENU_PERF_OFF, UI_MENU_PERF_FPS, UI_MENU_PERF_FULL}; static const UiTextId perf[] = {UI_MENU_PERF_OFF, UI_MENU_PERF_FPS, UI_MENU_PERF_FULL};
opt_choice("NX2NAVI_PERF_OVERLAY", UI_MENU_PERF_OVERLAY, perf, 3, UI_MENU_PERF_OVERLAY_DESC); opt_choice("NX2NAVI_PERF_OVERLAY", UI_MENU_PERF_OVERLAY, perf, 3, UI_MENU_PERF_OVERLAY_DESC);
opt_group(UI_MENU_GRAPHICS); opt_group(UI_MENU_GRAPHICS);
row_output_res(); // The game resolution needs the output and scene patch sets (resolution.c res_adjustable): Ocarina's build has
// none and always draws its own size, so the row would change nothing
if (res_adjustable()) row_output_res();
static const UiTextId up[] = {UI_MENU_UPSCALER_FSR, UI_MENU_UPSCALER_BILINEAR}; static const UiTextId up[] = {UI_MENU_UPSCALER_FSR, UI_MENU_UPSCALER_BILINEAR};
opt_choice("NX2NAVI_UPSCALER", UI_MENU_UPSCALER, up, 2, UI_MENU_UPSCALER_DESC); opt_choice("NX2NAVI_UPSCALER", UI_MENU_UPSCALER, up, 2, UI_MENU_UPSCALER_DESC);
// RCAS runs only under FSR (vk_fsr.c vk_fsr_record): with bilinear the slider would do nothing
if (strcmp(cfg_value("NX2NAVI_UPSCALER"), "fsr")) opt_disable_next(UI_MENU_SHARPNESS_NEEDS_FSR);
opt_slider("NX2NAVI_SHARPNESS", UI_MENU_SHARPNESS, 0, 100, UI_MENU_SHARPNESS_DESC, 5, "%.0f %%"); opt_slider("NX2NAVI_SHARPNESS", UI_MENU_SHARPNESS, 0, 100, UI_MENU_SHARPNESS_DESC, 5, "%.0f %%");
static const UiTextId aspect[] = {UI_MENU_ASPECT_FIT, UI_MENU_ASPECT_STRETCH}; static const UiTextId aspect[] = {UI_MENU_ASPECT_FIT, UI_MENU_ASPECT_STRETCH};
opt_choice("NX2NAVI_ASPECT", UI_MENU_ASPECT, aspect, 2, UI_MENU_ASPECT_DESC); opt_choice("NX2NAVI_ASPECT", UI_MENU_ASPECT, aspect, 2, UI_MENU_ASPECT_DESC);
@@ -695,7 +727,9 @@ static void tab_screen(float scale) {
static void tab_game(float scale) { static void tab_game(float scale) {
opt_begin("##game", scale); opt_begin("##game", scale);
row_fps_limit(); // The limit needs the fps60 or realtime patch set (frame_rate.c frame_limit_adjustable): Ocarina's build has
// neither and runs at the rate it picks itself, so the row would change nothing
if (frame_limit_adjustable()) row_fps_limit();
row_game_lang(); row_game_lang();
static const UiTextId mode[] = {UI_MENU_MODE_DOCKED, UI_MENU_MODE_HANDHELD}; static const UiTextId mode[] = {UI_MENU_MODE_DOCKED, UI_MENU_MODE_HANDHELD};
opt_choice("NX2NAVI_OPERATION_MODE", UI_MENU_OPERATION_MODE, mode, 2, UI_MENU_OPERATION_MODE_DESC); opt_choice("NX2NAVI_OPERATION_MODE", UI_MENU_OPERATION_MODE, mode, 2, UI_MENU_OPERATION_MODE_DESC);
@@ -724,7 +758,7 @@ static const char *pad_layout_note(void) {
return note; return note;
} }
// The action a key presses, or -1: the walk key is a key of its own, but Shift is B in the default bindings, and a // The action a key presses, or -1: the walk key is a key of its own, but Shift is A (dash) in the default bindings, and a
// walk key that also presses something walks and does that something at the same time. The bindings come from a // walk key that also presses something walks and does that something at the same time. The bindings come from a
// snapshot, and every key of an action is looked at: binds_refresh rebuilds the live table on the polling thread while // snapshot, and every key of an action is looked at: binds_refresh rebuilds the live table on the polling thread while
// the menu draws, and an action may hold more than the two keys its cells show. // the menu draws, and an action may hold more than the two keys its cells show.
@@ -1066,11 +1100,14 @@ static void perf_picture(const MenuTarget *t, const ImVec4 &c) {
snprintf(v[0], sizeof v[0], menu_text(UI_MENU_OV_FMT_SIZE), t->width, t->height); snprintf(v[0], sizeof v[0], menu_text(UI_MENU_OV_FMT_SIZE), t->width, t->height);
snprintf(v[1], sizeof v[1], menu_text(UI_MENU_OV_FMT_SIZE), (unsigned)t->image_w, (unsigned)t->image_h); snprintf(v[1], sizeof v[1], menu_text(UI_MENU_OV_FMT_SIZE), (unsigned)t->image_w, (unsigned)t->image_h);
snprintf(v[2], sizeof v[2], menu_text(UI_MENU_OV_FMT_SCENE), scene[0], scene[1], scene[0] * 100.0 / out[0]); snprintf(v[2], sizeof v[2], menu_text(UI_MENU_OV_FMT_SCENE), scene[0], scene[1], scene[0] * 100.0 / out[0]);
int sharp = cfg_int("NX2NAVI_SHARPNESS");
sharp = sharp < 0 ? 0 : sharp > 100 ? 100 : sharp;
if (t->scaler == 2) { if (t->scaler == 2) {
int s = cfg_int("NX2NAVI_SHARPNESS"); snprintf(v[3], sizeof v[3], menu_text(UI_MENU_OV_FMT_FSR), sharp);
snprintf(v[3], sizeof v[3], menu_text(UI_MENU_OV_FMT_FSR), s < 0 ? 0 : s > 100 ? 100 : s); } else if (t->scaler == 3) { // shrunk by the blit, then RCAS (vk_fsr.c shrink_sharpen)
snprintf(v[3], sizeof v[3], menu_text(UI_MENU_OV_FMT_SHRINK), sharp);
} else { } else {
// FSR enlarges only (vk_fsr_record): an image larger than the window is shrunk by the blit even with FSR selected // FSR with sharpness 0 and an image larger than the window: the plain shrink blit (vk_fsr_record)
int down = t->scaler == 1 && !strcmp(cfg_value("NX2NAVI_UPSCALER"), "fsr") && int down = t->scaler == 1 && !strcmp(cfg_value("NX2NAVI_UPSCALER"), "fsr") &&
(t->image_w > (int)t->width || t->image_h > (int)t->height); (t->image_w > (int)t->width || t->image_h > (int)t->height);
snprintf(v[3], sizeof v[3], "%s", snprintf(v[3], sizeof v[3], "%s",
@@ -1083,12 +1120,16 @@ static void perf_picture(const MenuTarget *t, const ImVec4 &c) {
snprintf(v[5], sizeof v[5], "%s", pm ? pm : menu_text(UI_MENU_OV_NONE)); snprintf(v[5], sizeof v[5], "%s", pm ? pm : menu_text(UI_MENU_OV_NONE));
static const UiTextId labels[6] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, static const UiTextId labels[6] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE,
UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT}; UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT};
// The 3D scene's size is known only where resolution.c sets it (NX2navi's patch sets); Ocarina sizes its own scene
// dynamically and res_sizes would report NX2navi's fixed 1600x900, so the line is left out
bool scene_known = res_adjustable() != 0;
if (!ImGui::BeginTable("##perfp", 2, ImGuiTableFlags_SizingFixedFit)) return; if (!ImGui::BeginTable("##perfp", 2, ImGuiTableFlags_SizingFixedFit)) return;
float vw = 0; float vw = 0;
for (auto &s : v) vw = fmaxf(vw, ImGui::CalcTextSize(s).x); for (auto &s : v) vw = fmaxf(vw, ImGui::CalcTextSize(s).x);
ImGui::TableSetupColumn("##p0", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##p0", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("##p1", ImGuiTableColumnFlags_WidthFixed, vw); ImGui::TableSetupColumn("##p1", ImGuiTableColumnFlags_WidthFixed, vw);
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
if (i == 2 && !scene_known) continue;
perf_label(labels[i], c); perf_label(labels[i], c);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
perf_right(v[i], false); perf_right(v[i], false);

View File

@@ -45,7 +45,8 @@ typedef struct {
VkFormat format; // of the swapchain image, a colour attachment VkFormat format; // of the swapchain image, a colour attachment
uint32_t width, height; uint32_t width, height;
int image_w, image_h; // the game image this present shows (its crop) int image_w, image_h; // the game image this present shows (its crop)
int scaler; // how the last present scaled it to the window: 0 not, 1 bilinear blit, 2 FSR 1 int scaler; // how the last present scaled it to the window: 0 not, 1 bilinear blit, 2 FSR 1,
// 3 bilinear shrink + FSR sharpening (RCAS)
} MenuTarget; } MenuTarget;
// Lays out this frame's overlay; 1 when there is something to draw. frame: the presented frame (0 unknown). *shot: a // Lays out this frame's overlay; 1 when there is something to draw. frame: the presented frame (0 unknown). *shot: a
// path when the test hook wants this frame's swapchain image saved, else NULL. The first open starts ImGui's Vulkan // path when the test hook wants this frame's swapchain image saved, else NULL. The first open starts ImGui's Vulkan

View File

@@ -19,7 +19,8 @@ typedef struct { const char *lang; const char *const *text; } Row;
[UI_MENU_LANGNAME_NL] = "Nederlands", [UI_MENU_LANGNAME_RU] = "Русский", \ [UI_MENU_LANGNAME_NL] = "Nederlands", [UI_MENU_LANGNAME_RU] = "Русский", \
[UI_MENU_LANGNAME_ZH_HANS] = "简体中文", [UI_MENU_LANGNAME_ZH_HANT] = "繁體中文", [UI_MENU_LANGNAME_KO] = "한국어", \ [UI_MENU_LANGNAME_ZH_HANS] = "简体中文", [UI_MENU_LANGNAME_ZH_HANT] = "繁體中文", [UI_MENU_LANGNAME_KO] = "한국어", \
[UI_MENU_LANGNAME_PT_BR] = "Português (Brasil)", [UI_MENU_LANGNAME_EN_GB] = "English (UK)", \ [UI_MENU_LANGNAME_PT_BR] = "Português (Brasil)", [UI_MENU_LANGNAME_EN_GB] = "English (UK)", \
[UI_MENU_LANGNAME_FR_CA] = "Français (Canada)", [UI_MENU_LANGNAME_ES_419] = "Español (Latinoamérica)" [UI_MENU_LANGNAME_FR_CA] = "Français (Canada)", [UI_MENU_LANGNAME_ES_419] = "Español (Latinoamérica)", \
[UI_MENU_LANGNAME_PL] = "Polski"
// SWKBD: TITLE, PROMPT, DEFAULT_NAME (at most 9 UTF-16 units, no '@' '%' '\'), OK, CANCEL, PAD_HINT. // SWKBD: TITLE, PROMPT, DEFAULT_NAME (at most 9 UTF-16 units, no '@' '%' '\'), OK, CANCEL, PAD_HINT.
#define SWKBD(title, prompt, name, ok, cancel, hint) \ #define SWKBD(title, prompt, name, ok, cancel, hint) \
@@ -72,8 +73,9 @@ static const char *const text_en[UI_TEXT_COUNT] = {
"that size. Above 100 % smooths jagged edges (supersampling) at a high GPU cost.", "that size. Above 100 % smooths jagged edges (supersampling) at a high GPU cost.",
[UI_MENU_RENDER_SCALE_GAME] = "Game (83 %)", [UI_MENU_RENDER_SCALE_GAME] = "Game (83 %)",
[UI_MENU_UPSCALER] = "Scaling to the window", [UI_MENU_UPSCALER] = "Scaling to the window",
[UI_MENU_UPSCALER_DESC] = "How the picture is scaled when the window is larger than the game resolution. FSR keeps " [UI_MENU_UPSCALER_DESC] = "How the game's picture is fitted to the window. Larger window: FSR keeps edges and detail "
"edges and detail sharper than bilinear.", "sharper than bilinear. Smaller window (Ocarina draws 2560 x 1440): the picture is shrunk "
"and FSR sharpens it by the strength below.",
[UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_BILINEAR] = "Bilinear", [UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_BILINEAR] = "Bilinear",
[UI_MENU_ASPECT] = "Picture shape", [UI_MENU_ASPECT] = "Picture shape",
[UI_MENU_ASPECT_DESC] = "When the window's shape differs from the game resolution's (a 16:9 picture on a 21:9 " [UI_MENU_ASPECT_DESC] = "When the window's shape differs from the game resolution's (a 16:9 picture on a 21:9 "
@@ -91,7 +93,9 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_ANISO_DESC] = "Anisotropic filtering of surface textures: ground, roads and walls seen at a shallow angle stay sharp into the distance instead of blurring. Game: the level the game asks for, as on the Switch.", [UI_MENU_ANISO_DESC] = "Anisotropic filtering of surface textures: ground, roads and walls seen at a shallow angle stay sharp into the distance instead of blurring. Game: the level the game asks for, as on the Switch.",
[UI_MENU_ANISO_GAME] = "Game", [UI_MENU_ANISO_GAME] = "Game",
[UI_MENU_SHARPNESS] = "FSR sharpness", [UI_MENU_SHARPNESS] = "FSR sharpness",
[UI_MENU_SHARPNESS_DESC] = "Sharpening after FSR scaling; 0 turns it off.", [UI_MENU_SHARPNESS_DESC] = "Sharpening after FSR scaling, also when the picture is shrunk to the window; 0 turns it "
"off.",
[UI_MENU_SHARPNESS_NEEDS_FSR] = "only with AMD FSR 1",
[UI_MENU_COLOR] = "Colour", [UI_MENU_COLOR] = "Colour",
[UI_MENU_COLOR_PRESET] = "Colour profile", [UI_MENU_COLOR_PRESET] = "Colour profile",
[UI_MENU_COLOR_PRESET_DESC] = "Sets the four values below. Vivid: more contrast and saturation, shadows opened a " [UI_MENU_COLOR_PRESET_DESC] = "Sets the four values below. Vivid: more contrast and saturation, shadows opened a "
@@ -162,8 +166,8 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_FXAA_DESC] = "The game's own FXAA edge smoothing. It blurs fine detail a little; with DLAA on it is not needed.", [UI_MENU_FXAA_DESC] = "The game's own FXAA edge smoothing. It blurs fine detail a little; with DLAA on it is not needed.",
[UI_MENU_FPS_LIMIT] = "Frame rate limit", [UI_MENU_FPS_LIMIT] = "Frame rate limit",
[UI_MENU_FPS_LIMIT_DESC] = "The most frames per second the game draws. Above 60 is experimental and needs Game speed " [UI_MENU_FPS_LIMIT_DESC] = "The most frames per second the game draws. Above 60 is experimental and needs the "
"follows the clock.", "real-time step (realtime = 1 in nx2navi.ini, the default).",
[UI_MENU_FPS_30] = "30 FPS", [UI_MENU_FPS_40] = "40 FPS", [UI_MENU_FPS_45] = "45 FPS", [UI_MENU_FPS_30] = "30 FPS", [UI_MENU_FPS_40] = "40 FPS", [UI_MENU_FPS_45] = "45 FPS",
[UI_MENU_FPS_60] = "60 FPS", [UI_MENU_FPS_90] = "90 FPS", [UI_MENU_FPS_120] = "120 FPS", [UI_MENU_FPS_144] = "144 FPS", [UI_MENU_FPS_60] = "60 FPS", [UI_MENU_FPS_90] = "90 FPS", [UI_MENU_FPS_120] = "120 FPS", [UI_MENU_FPS_144] = "144 FPS",
// the monitor's refresh rate; printf format with the rate in Hz when it is known // the monitor's refresh rate; printf format with the rate in Hz when it is known
@@ -232,8 +236,8 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_PAD_LAYOUT] = "Button layout", [UI_MENU_PAD_LAYOUT] = "Button layout",
[UI_MENU_PAD_LAYOUT_DESC] = "Which button is A. Nintendo: the right one, as on a Switch. Xbox: the bottom one, as " [UI_MENU_PAD_LAYOUT_DESC] = "Which button is A. Nintendo: the right one, as on a Switch. Xbox: the bottom one, as "
"labelled on an Xbox controller (cross on a PlayStation controller). Automatic picks " "labelled on an Xbox controller (cross on a PlayStation controller). Automatic picks "
"Nintendo for controllers with Nintendo labels and Xbox for the others. Which " "Nintendo for controllers with Nintendo labels and Xbox for the others. The game's "
"controller the game's prompts show is set under Button prompts.", "prompts always show the Switch letters.",
[UI_MENU_PAD_LAYOUT_AUTO] = "Automatic", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo (A right)", [UI_MENU_PAD_LAYOUT_AUTO] = "Automatic", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo (A right)",
[UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A bottom)", [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A bottom)",
[UI_MENU_PAD_LAYOUT_IN_USE] = "in use: %s", [UI_MENU_PAD_LAYOUT_IN_USE] = "in use: %s",
@@ -300,18 +304,24 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_BIND_LSTICK_DOWN] = "Move back", [UI_BIND_LSTICK_DOWN] = "Move back",
[UI_BIND_RSTICK_LEFT] = "Camera left", [UI_BIND_RSTICK_UP] = "Camera up", [UI_BIND_RSTICK_RIGHT] = "Camera right", [UI_BIND_RSTICK_LEFT] = "Camera left", [UI_BIND_RSTICK_UP] = "Camera up", [UI_BIND_RSTICK_RIGHT] = "Camera right",
[UI_BIND_RSTICK_DOWN] = "Camera down", [UI_BIND_RSTICK_DOWN] = "Camera down",
[UI_BIND_DESC_A] = "Interact, pick up, talk.", [UI_BIND_DESC_B] = "Run, cancel, go back.", [UI_BIND_DESC_A] = "Actions: talk, open, pick up, climb, grab. Hold to dash.",
[UI_BIND_DESC_X] = "Jump.", [UI_BIND_DESC_Y] = "Attack.", [UI_BIND_DESC_LCLICK] = "Crouch.", [UI_BIND_DESC_B] = "Put away, cancel, back. Jump when Swap Jump Controls is on in the game's Options.",
[UI_BIND_DESC_RCLICK] = "First-person view.", [UI_BIND_DESC_L] = "Abilities.", [UI_BIND_DESC_X] = "Jump. Put away when Swap Jump Controls is on in the game's Options.",
[UI_BIND_DESC_R] = "Throw a weapon.", [UI_BIND_DESC_ZL] = "Shield, lock on.", [UI_BIND_DESC_ZR] = "Bow.", [UI_BIND_DESC_Y] = "Attack with the sword.",
[UI_BIND_DESC_PLUS] = "Menu, inventory.", [UI_BIND_DESC_MINUS] = "Map.", [UI_BIND_DESC_LCLICK] = "Left stick press (not on the game's controls screen).",
[UI_BIND_DESC_DPAD] = "Quick-select.", [UI_BIND_DESC_RCLICK] = "Reset the camera behind Link.",
[UI_BIND_DESC_L] = "Quick-select items; the previous page in the game's menus.",
[UI_BIND_DESC_R] = "Quick-select items; the next page in the game's menus.",
[UI_BIND_DESC_ZL] = "Target (hold or toggle: Targeting Type in the game's Options).",
[UI_BIND_DESC_ZR] = "Use the selected item: slingshot, bow, boomerang, hookshot, bombs, bottles.",
[UI_BIND_DESC_PLUS] = "Menu: items, equipment, collection, system.", [UI_BIND_DESC_MINUS] = "Map.",
[UI_BIND_DESC_LEFT] = "Play the ocarina.", [UI_BIND_DESC_UP] = "Put the accessory on or take it off.",
[UI_BIND_DESC_RIGHT] = "Talk to Navi.", [UI_BIND_DESC_DOWN] = "Change boots.",
[UI_BIND_DESC_MOVE] = "Moves Link like the left stick. The controller's left stick always works too.", [UI_BIND_DESC_MOVE] = "Moves Link like the left stick. The controller's left stick always works too.",
[UI_BIND_DESC_CAMERA] = "Turns the camera like the right stick. The mouse and the controller's right stick always " [UI_BIND_DESC_CAMERA] = "Turns the camera like the right stick. The mouse and the controller's right stick always "
"work too.", "work too.",
[UI_BIND_SHAKE] = "Shake the camera stick", [UI_BIND_SHAKE] = "Shake the camera stick",
[UI_BIND_DESC_SHAKE] = "Swings the right stick left and right for the game: detaches a fused part from what " [UI_BIND_DESC_SHAKE] = "Swings the right stick left and right for the game. Holding the key keeps shaking.",
"object holds. Holding the key keeps shaking.",
[UI_KEY_SPACE] = "Space", [UI_KEY_TAB] = "Tab", [UI_KEY_LSHIFT] = "Left Shift", [UI_KEY_LCTRL] = "Left Ctrl", [UI_KEY_SPACE] = "Space", [UI_KEY_TAB] = "Tab", [UI_KEY_LSHIFT] = "Left Shift", [UI_KEY_LCTRL] = "Left Ctrl",
[UI_KEY_UP] = "Up arrow", [UI_KEY_DOWN] = "Down arrow", [UI_KEY_LEFT] = "Left arrow", [UI_KEY_UP] = "Up arrow", [UI_KEY_DOWN] = "Down arrow", [UI_KEY_LEFT] = "Left arrow",
[UI_KEY_RIGHT] = "Right arrow", [UI_KEY_RIGHT] = "Right arrow",
@@ -462,8 +472,9 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_OV_SCALING] = "Scaling", [UI_MENU_OV_LIMIT] = "Frame limit", [UI_MENU_OV_PRESENT] = "Presentation", [UI_MENU_OV_SCALING] = "Scaling", [UI_MENU_OV_LIMIT] = "Frame limit", [UI_MENU_OV_PRESENT] = "Presentation",
[UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%",
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1, sharpness %d%%", [UI_MENU_OV_SCALE_NONE] = "none (1:1)", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, sharpness %d%%", [UI_MENU_OV_SCALE_NONE] = "none (1:1)",
[UI_MENU_OV_FMT_SHRINK] = "bilinear + FSR sharpening %d%%",
[UI_MENU_OV_SCALE_BILINEAR] = "bilinear", [UI_MENU_OV_SCALE_BILINEAR] = "bilinear",
[UI_MENU_OV_SCALE_DOWN] = "bilinear (FSR only enlarges)", [UI_MENU_OV_SCALE_DOWN] = "bilinear (FSR sharpness 0)",
[UI_MENU_TAB_CHEATS] = "Cheats", [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 " [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 " "cheats folder, named after the game's build: mods\\<mod>\\cheats\\%s. Restart the game to "
@@ -535,8 +546,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
"Выше 100 % сглаживает лесенки на краях (суперсэмплинг) ценой большой нагрузки на GPU.", "Выше 100 % сглаживает лесенки на краях (суперсэмплинг) ценой большой нагрузки на GPU.",
[UI_MENU_RENDER_SCALE_GAME] = "Как в игре (83 %)", [UI_MENU_RENDER_SCALE_GAME] = "Как в игре (83 %)",
[UI_MENU_UPSCALER] = "Масштабирование под окно", [UI_MENU_UPSCALER] = "Масштабирование под окно",
[UI_MENU_UPSCALER_DESC] = "Как картинка растягивается, когда окно больше разрешения игры. FSR сохраняет края и " [UI_MENU_UPSCALER_DESC] = "Как картинка игры вписывается в окно. Окно больше: FSR сохраняет края и детали чётче "
"детали чётче билинейного.", "билинейного. Окно меньше (Ocarina рисует 2560 × 1440): картинка уменьшается, и FSR "
"повышает её резкость на величину ниже.",
[UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_BILINEAR] = "Билинейное", [UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_BILINEAR] = "Билинейное",
[UI_MENU_ASPECT] = "Форма картинки", [UI_MENU_ASPECT] = "Форма картинки",
[UI_MENU_ASPECT_DESC] = "Когда форма окна отличается от разрешения игры (картинка 16:9 на экране 21:9): сохранить " [UI_MENU_ASPECT_DESC] = "Когда форма окна отличается от разрешения игры (картинка 16:9 на экране 21:9): сохранить "
@@ -554,7 +566,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_ANISO_DESC] = "Анизотропная фильтрация текстур поверхностей: земля, дороги и стены под острым углом остаются чёткими вдали, а не размываются. Игра: уровень, который запрашивает игра, как на Switch.", [UI_MENU_ANISO_DESC] = "Анизотропная фильтрация текстур поверхностей: земля, дороги и стены под острым углом остаются чёткими вдали, а не размываются. Игра: уровень, который запрашивает игра, как на Switch.",
[UI_MENU_ANISO_GAME] = "Игра", [UI_MENU_ANISO_GAME] = "Игра",
[UI_MENU_SHARPNESS] = "Резкость FSR", [UI_MENU_SHARPNESS] = "Резкость FSR",
[UI_MENU_SHARPNESS_DESC] = "Повышение резкости после масштабирования FSR; 0 выключает его.", [UI_MENU_SHARPNESS_DESC] = "Повышение резкости после масштабирования FSR, в том числе когда картинка уменьшается "
"под окно; 0 выключает его.",
[UI_MENU_SHARPNESS_NEEDS_FSR] = "только с AMD FSR 1",
[UI_MENU_COLOR] = "Цвет", [UI_MENU_COLOR] = "Цвет",
[UI_MENU_COLOR_PRESET] = "Цветовой профиль", [UI_MENU_COLOR_PRESET] = "Цветовой профиль",
[UI_MENU_COLOR_PRESET_DESC] = "Задаёт четыре значения ниже. «Яркий»: больше контраста и насыщенности, тени немного " [UI_MENU_COLOR_PRESET_DESC] = "Задаёт четыре значения ниже. «Яркий»: больше контраста и насыщенности, тени немного "
@@ -626,8 +640,8 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_FXAA_DESC] = "Собственное сглаживание FXAA. Слегка размывает мелкие детали; с DLAA оно не нужно.", [UI_MENU_FXAA_DESC] = "Собственное сглаживание FXAA. Слегка размывает мелкие детали; с DLAA оно не нужно.",
[UI_MENU_FPS_LIMIT] = "Ограничение частоты кадров", [UI_MENU_FPS_LIMIT] = "Ограничение частоты кадров",
[UI_MENU_FPS_LIMIT_DESC] = "Наибольшее число кадров в секунду. Выше 60 — экспериментальный режим, нужна «Скорость " [UI_MENU_FPS_LIMIT_DESC] = "Наибольшее число кадров в секунду. Выше 60 — экспериментальный режим, нужен шаг по "
"игры по часам».", "реальному времени (realtime = 1 в nx2navi.ini, по умолчанию).",
[UI_MENU_FPS_30] = "30 FPS", [UI_MENU_FPS_40] = "40 FPS", [UI_MENU_FPS_45] = "45 FPS", [UI_MENU_FPS_30] = "30 FPS", [UI_MENU_FPS_40] = "40 FPS", [UI_MENU_FPS_45] = "45 FPS",
[UI_MENU_FPS_60] = "60 FPS", [UI_MENU_FPS_90] = "90 FPS", [UI_MENU_FPS_120] = "120 FPS", [UI_MENU_FPS_144] = "144 FPS", [UI_MENU_FPS_60] = "60 FPS", [UI_MENU_FPS_90] = "90 FPS", [UI_MENU_FPS_120] = "120 FPS", [UI_MENU_FPS_144] = "144 FPS",
[UI_MENU_FPS_DISPLAY] = "Как у монитора", [UI_MENU_FPS_DISPLAY_HZ] = "Как у монитора (%.0f Гц)", [UI_MENU_FPS_DISPLAY] = "Как у монитора", [UI_MENU_FPS_DISPLAY_HZ] = "Как у монитора (%.0f Гц)",
@@ -693,8 +707,8 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_PAD_LAYOUT] = "Раскладка кнопок", [UI_MENU_PAD_LAYOUT] = "Раскладка кнопок",
[UI_MENU_PAD_LAYOUT_DESC] = "Какая кнопка работает как A. Nintendo: правая, как на Switch. Xbox: нижняя, как " [UI_MENU_PAD_LAYOUT_DESC] = "Какая кнопка работает как A. Nintendo: правая, как на Switch. Xbox: нижняя, как "
"подписано на контроллере Xbox (крест на контроллере PlayStation). Автоматически: " "подписано на контроллере Xbox (крест на контроллере PlayStation). Автоматически: "
"Nintendo для контроллеров с подписями Nintendo, Xbox для остальных. Кнопки какого " "Nintendo для контроллеров с подписями Nintendo, Xbox для остальных. Подсказки игры "
"контроллера показывают подсказки игры, задаётся в строке «Подсказки кнопок».", "всегда показывают буквы Switch.",
[UI_MENU_PAD_LAYOUT_AUTO] = "Автоматически", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo (A справа)", [UI_MENU_PAD_LAYOUT_AUTO] = "Автоматически", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo (A справа)",
[UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A снизу)", [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A снизу)",
[UI_MENU_PAD_LAYOUT_IN_USE] = "сейчас: %s", [UI_MENU_PAD_LAYOUT_IN_USE] = "сейчас: %s",
@@ -764,18 +778,24 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_BIND_LSTICK_DOWN] = "Назад", [UI_BIND_LSTICK_DOWN] = "Назад",
[UI_BIND_RSTICK_LEFT] = "Камера влево", [UI_BIND_RSTICK_UP] = "Камера вверх", [UI_BIND_RSTICK_LEFT] = "Камера влево", [UI_BIND_RSTICK_UP] = "Камера вверх",
[UI_BIND_RSTICK_RIGHT] = "Камера вправо", [UI_BIND_RSTICK_DOWN] = "Камера вниз", [UI_BIND_RSTICK_RIGHT] = "Камера вправо", [UI_BIND_RSTICK_DOWN] = "Камера вниз",
[UI_BIND_DESC_A] = "Взаимодействие, подобрать, поговорить.", [UI_BIND_DESC_B] = "Бег, отмена, назад.", [UI_BIND_DESC_A] = "Действия: поговорить, открыть, подобрать, залезть, схватить. Удерживать — рывок.",
[UI_BIND_DESC_X] = "Прыжок.", [UI_BIND_DESC_Y] = "Атака.", [UI_BIND_DESC_LCLICK] = "Присесть.", [UI_BIND_DESC_B] = "Убрать, отмена, назад. Прыжок, если в настройках игры включена смена кнопки прыжка.",
[UI_BIND_DESC_RCLICK] = "Вид от первого лица.", [UI_BIND_DESC_L] = "Способности.", [UI_BIND_DESC_X] = "Прыжок. Убрать, если в настройках игры включена смена кнопки прыжка.",
[UI_BIND_DESC_R] = "Бросок оружия.", [UI_BIND_DESC_ZL] = "Щит, захват цели.", [UI_BIND_DESC_ZR] = "Лук.", [UI_BIND_DESC_Y] = "Удар мечом.",
[UI_BIND_DESC_PLUS] = "Меню, инвентарь.", [UI_BIND_DESC_MINUS] = "Карта.", [UI_BIND_DESC_LCLICK] = "Нажатие левого стика (нет на экране управления игры).",
[UI_BIND_DESC_DPAD] = "Быстрый выбор.", [UI_BIND_DESC_RCLICK] = "Вернуть камеру за спину Линка.",
[UI_BIND_DESC_L] = "Быстрый выбор предметов; предыдущая страница в меню игры.",
[UI_BIND_DESC_R] = "Быстрый выбор предметов; следующая страница в меню игры.",
[UI_BIND_DESC_ZL] = "Захват цели (удерживать или переключать: тип захвата в настройках игры).",
[UI_BIND_DESC_ZR] = "Использовать выбранный предмет: рогатка, лук, бумеранг, крюк, бомбы, бутылки.",
[UI_BIND_DESC_PLUS] = "Меню: предметы, снаряжение, коллекция, система.", [UI_BIND_DESC_MINUS] = "Карта.",
[UI_BIND_DESC_LEFT] = "Играть на окарине.", [UI_BIND_DESC_UP] = "Надеть или снять аксессуар.",
[UI_BIND_DESC_RIGHT] = "Поговорить с Нави.", [UI_BIND_DESC_DOWN] = "Сменить сапоги.",
[UI_BIND_DESC_MOVE] = "Двигает Линка, как левый стик. Левый стик контроллера тоже всегда работает.", [UI_BIND_DESC_MOVE] = "Двигает Линка, как левый стик. Левый стик контроллера тоже всегда работает.",
[UI_BIND_DESC_CAMERA] = "Поворачивает камеру, как правый стик. Мышь и правый стик контроллера тоже всегда " [UI_BIND_DESC_CAMERA] = "Поворачивает камеру, как правый стик. Мышь и правый стик контроллера тоже всегда "
"работают.", "работают.",
[UI_BIND_SHAKE] = "Встряхнуть стик камеры", [UI_BIND_SHAKE] = "Встряхнуть стик камеры",
[UI_BIND_DESC_SHAKE] = "Качает правый стик влево-вправо: отцепляет приклеенную деталь от того, что держит " [UI_BIND_DESC_SHAKE] = "Качает правый стик влево-вправо. Пока клавиша зажата, тряска продолжается.",
"Ультрарука. Пока клавиша зажата, тряска продолжается.",
[UI_KEY_SPACE] = "Пробел", [UI_KEY_TAB] = "Tab", [UI_KEY_LSHIFT] = "Левый Shift", [UI_KEY_LCTRL] = "Левый Ctrl", [UI_KEY_SPACE] = "Пробел", [UI_KEY_TAB] = "Tab", [UI_KEY_LSHIFT] = "Левый Shift", [UI_KEY_LCTRL] = "Левый Ctrl",
[UI_KEY_UP] = "Стрелка вверх", [UI_KEY_DOWN] = "Стрелка вниз", [UI_KEY_LEFT] = "Стрелка влево", [UI_KEY_UP] = "Стрелка вверх", [UI_KEY_DOWN] = "Стрелка вниз", [UI_KEY_LEFT] = "Стрелка влево",
[UI_KEY_RIGHT] = "Стрелка вправо", [UI_KEY_RIGHT] = "Стрелка вправо",
@@ -929,8 +949,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_OV_SCALING] = "Масштабирование", [UI_MENU_OV_LIMIT] = "Лимит кадров", [UI_MENU_OV_PRESENT] = "Вывод кадров", [UI_MENU_OV_SCALING] = "Масштабирование", [UI_MENU_OV_LIMIT] = "Лимит кадров", [UI_MENU_OV_PRESENT] = "Вывод кадров",
[UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%",
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1, резкость %d%%", [UI_MENU_OV_SCALE_NONE] = "нет (1:1)", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, резкость %d%%", [UI_MENU_OV_SCALE_NONE] = "нет (1:1)",
[UI_MENU_OV_FMT_SHRINK] = "билинейное + резкость FSR %d%%",
[UI_MENU_OV_SCALE_BILINEAR] = "билинейное", [UI_MENU_OV_SCALE_BILINEAR] = "билинейное",
[UI_MENU_OV_SCALE_DOWN] = "билинейное (FSR только увеличивает)", [UI_MENU_OV_SCALE_DOWN] = "билинейное (резкость FSR 0)",
[UI_MENU_TAB_CHEATS] = "Читы", [UI_MENU_TAB_CHEATS] = "Читы",
[UI_MENU_CHEATS_NONE] = "Для этой версии игры читов нет. Читы мода — это файл читов Atmosphere в его папке cheats " [UI_MENU_CHEATS_NONE] = "Для этой версии игры читов нет. Читы мода — это файл читов Atmosphere в его папке cheats "
"с именем по сборке игры: mods\\<мод>\\cheats\\%s. Перезапустите игру, чтобы они " "с именем по сборке игры: mods\\<мод>\\cheats\\%s. Перезапустите игру, чтобы они "
@@ -1033,19 +1054,22 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
"GPU.", "GPU.",
[UI_MENU_RENDER_SCALE_GAME] = "Jogo (83 %)", [UI_MENU_RENDER_SCALE_GAME] = "Jogo (83 %)",
[UI_MENU_UPSCALER] = "Escala para a janela", [UI_MENU_UPSCALER] = "Escala para a janela",
[UI_MENU_UPSCALER_DESC] = "Como a imagem é ampliada quando a janela é maior que a resolução do jogo. O FSR mantém " [UI_MENU_UPSCALER_DESC] = "Como a imagem do jogo se ajusta à janela. Janela maior: o FSR mantém bordas e detalhes "
"bordas e detalhes mais nítidos que o bilinear.", "mais nítidos que o bilinear. Janela menor (Ocarina desenha 2560 x 1440): a imagem é "
"reduzida e o FSR aumenta a nitidez com a intensidade abaixo.",
[UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_BILINEAR] = "Bilinear", [UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_BILINEAR] = "Bilinear",
[UI_MENU_ASPECT] = "Formato da imagem", [UI_MENU_ASPECT] = "Formato da imagem",
[UI_MENU_ASPECT_DESC] = "Quando o formato da janela difere do da resolução do jogo (uma imagem 16:9 numa tela " [UI_MENU_ASPECT_DESC] = "Quando o formato da janela difere do da resolução do jogo (uma imagem 16:9 numa tela "
"21:9): manter o formato da imagem com barras pretas ou esticá-la sobre a janela.", "21:9): manter o formato da imagem com barras pretas ou esticá-la sobre a janela.",
[UI_MENU_ASPECT_FIT] = "Barras pretas", [UI_MENU_ASPECT_STRETCH] = "Esticar", [UI_MENU_ASPECT_FIT] = "Barras pretas", [UI_MENU_ASPECT_STRETCH] = "Esticar",
[UI_MENU_SHARPNESS] = "Nitidez do FSR", [UI_MENU_SHARPNESS] = "Nitidez do FSR",
[UI_MENU_SHARPNESS_DESC] = "Aumento de nitidez após a ampliação do FSR; 0 desliga.", [UI_MENU_SHARPNESS_DESC] = "Aumento de nitidez após a escala do FSR, também quando a imagem é reduzida à janela; 0 "
"desliga.",
[UI_MENU_SHARPNESS_NEEDS_FSR] = "só com AMD FSR 1",
[UI_MENU_FPS_LIMIT] = "Limite de quadros", [UI_MENU_FPS_LIMIT] = "Limite de quadros",
[UI_MENU_FPS_LIMIT_DESC] = "O máximo de quadros por segundo que o jogo desenha. Acima de 60 é experimental e " [UI_MENU_FPS_LIMIT_DESC] = "O máximo de quadros por segundo que o jogo desenha. Acima de 60 é experimental e "
"precisa de Velocidade do jogo pelo relógio.", "precisa do passo em tempo real (realtime = 1 no nx2navi.ini, o padrão).",
[UI_MENU_FPS_30] = "30 FPS", [UI_MENU_FPS_40] = "40 FPS", [UI_MENU_FPS_45] = "45 FPS", [UI_MENU_FPS_30] = "30 FPS", [UI_MENU_FPS_40] = "40 FPS", [UI_MENU_FPS_45] = "45 FPS",
[UI_MENU_FPS_60] = "60 FPS", [UI_MENU_FPS_90] = "90 FPS", [UI_MENU_FPS_120] = "120 FPS", [UI_MENU_FPS_144] = "144 FPS", [UI_MENU_FPS_60] = "60 FPS", [UI_MENU_FPS_90] = "90 FPS", [UI_MENU_FPS_120] = "120 FPS", [UI_MENU_FPS_144] = "144 FPS",
[UI_MENU_ASSUME_FOCUS] = "Continuar rodando fora de foco", [UI_MENU_ASSUME_FOCUS] = "Continuar rodando fora de foco",
@@ -1078,11 +1102,8 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_MENU_PAD_LAYOUT] = "Layout dos botões", [UI_MENU_PAD_LAYOUT] = "Layout dos botões",
[UI_MENU_PAD_LAYOUT_DESC] = "Qual botão é o A. Nintendo: o da direita, como no Switch. Xbox: o de baixo, como " [UI_MENU_PAD_LAYOUT_DESC] = "Qual botão é o A. Nintendo: o da direita, como no Switch. Xbox: o de baixo, como "
"indicado no controle de Xbox (cruz no controle de PlayStation). Automático escolhe " "indicado no controle de Xbox (cruz no controle de PlayStation). Automático escolhe "
"Nintendo para controles com os rótulos da Nintendo e Xbox para os demais. Ícones de " "Nintendo para controles com os rótulos da Nintendo e Xbox para os demais. As dicas do "
"Xbox: o A é o da direita, como no Nintendo, e o jogo mostra os rótulos do Xbox (B no " "jogo sempre mostram as letras do Switch.",
"lugar de A, A no lugar de B, Y no lugar de X, X no lugar de Y); os ícones mudam após "
"reiniciar. As letras fazem parte dos arquivos do jogo, então um botão remapeado em "
"Controles continua com a letra antiga na tela.",
[UI_MENU_PAD_LAYOUT_AUTO] = "Automático", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo (A à direita)", [UI_MENU_PAD_LAYOUT_AUTO] = "Automático", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo (A à direita)",
[UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A embaixo)", [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A embaixo)",
[UI_MENU_PAD_LAYOUT_IN_USE] = "em uso: %s", [UI_MENU_PAD_LAYOUT_IN_USE] = "em uso: %s",
@@ -1118,19 +1139,25 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_BIND_LSTICK_RIGHT] = "Mover para a direita", [UI_BIND_LSTICK_DOWN] = "Mover para trás", [UI_BIND_LSTICK_RIGHT] = "Mover para a direita", [UI_BIND_LSTICK_DOWN] = "Mover para trás",
[UI_BIND_RSTICK_LEFT] = "Câmera para a esquerda", [UI_BIND_RSTICK_UP] = "Câmera para cima", [UI_BIND_RSTICK_LEFT] = "Câmera para a esquerda", [UI_BIND_RSTICK_UP] = "Câmera para cima",
[UI_BIND_RSTICK_RIGHT] = "Câmera para a direita", [UI_BIND_RSTICK_DOWN] = "Câmera para baixo", [UI_BIND_RSTICK_RIGHT] = "Câmera para a direita", [UI_BIND_RSTICK_DOWN] = "Câmera para baixo",
[UI_BIND_DESC_A] = "Interagir, pegar, conversar.", [UI_BIND_DESC_B] = "Correr, cancelar, voltar.", [UI_BIND_DESC_A] = "Ações: conversar, abrir, pegar, escalar, agarrar. Segure para correr.",
[UI_BIND_DESC_X] = "Pular.", [UI_BIND_DESC_Y] = "Atacar.", [UI_BIND_DESC_LCLICK] = "Agachar.", [UI_BIND_DESC_B] = "Guardar, cancelar, voltar. Pular quando a troca do botão de pulo está ligada nas opções do jogo.",
[UI_BIND_DESC_RCLICK] = "Visão em primeira pessoa.", [UI_BIND_DESC_L] = "Habilidades.", [UI_BIND_DESC_X] = "Pular. Guardar quando a troca do botão de pulo está ligada nas opções do jogo.",
[UI_BIND_DESC_R] = "Arremessar a arma.", [UI_BIND_DESC_ZL] = "Escudo, travar a mira.", [UI_BIND_DESC_ZR] = "Arco.", [UI_BIND_DESC_Y] = "Atacar com a espada.",
[UI_BIND_DESC_PLUS] = "Menu, inventário.", [UI_BIND_DESC_MINUS] = "Mapa.", [UI_BIND_DESC_LCLICK] = "Pressionar o analógico esquerdo (não aparece na tela de controles do jogo).",
[UI_BIND_DESC_DPAD] = "Seleção rápida.", [UI_BIND_DESC_RCLICK] = "Voltar a câmera para trás do Link.",
[UI_BIND_DESC_L] = "Seleção rápida de itens; a página anterior nos menus do jogo.",
[UI_BIND_DESC_R] = "Seleção rápida de itens; a próxima página nos menus do jogo.",
[UI_BIND_DESC_ZL] = "Mirar (segurar ou alternar: tipo de mira nas opções do jogo).",
[UI_BIND_DESC_ZR] = "Usar o item escolhido: estilingue, arco, bumerangue, gancho, bombas, garrafas.",
[UI_BIND_DESC_PLUS] = "Menu: itens, equipamento, coleção, sistema.", [UI_BIND_DESC_MINUS] = "Mapa.",
[UI_BIND_DESC_LEFT] = "Tocar a ocarina.", [UI_BIND_DESC_UP] = "Pôr ou tirar o acessório.",
[UI_BIND_DESC_RIGHT] = "Falar com a Navi.", [UI_BIND_DESC_DOWN] = "Trocar de botas.",
[UI_BIND_DESC_MOVE] = "Move o Link como o analógico esquerdo. O analógico esquerdo do controle também sempre " [UI_BIND_DESC_MOVE] = "Move o Link como o analógico esquerdo. O analógico esquerdo do controle também sempre "
"funciona.", "funciona.",
[UI_BIND_DESC_CAMERA] = "Gira a câmera como o analógico direito. O mouse e o analógico direito do controle também " [UI_BIND_DESC_CAMERA] = "Gira a câmera como o analógico direito. O mouse e o analógico direito do controle também "
"sempre funcionam.", "sempre funcionam.",
[UI_BIND_SHAKE] = "Sacudir o analógico da câmera", [UI_BIND_SHAKE] = "Sacudir o analógico da câmera",
[UI_BIND_DESC_SHAKE] = "Balança o analógico direito para os lados: solta uma peça fundida do que a Ultramão segura. " [UI_BIND_DESC_SHAKE] = "Balança o analógico direito para os lados. Segurar a tecla continua sacudindo.",
"Segurar a tecla continua sacudindo.",
[UI_KEY_SPACE] = "Espaço", [UI_KEY_TAB] = "Tab", [UI_KEY_LSHIFT] = "Shift esquerdo", [UI_KEY_SPACE] = "Espaço", [UI_KEY_TAB] = "Tab", [UI_KEY_LSHIFT] = "Shift esquerdo",
[UI_KEY_LCTRL] = "Ctrl esquerdo", [UI_KEY_LCTRL] = "Ctrl esquerdo",
[UI_KEY_UP] = "Seta para cima", [UI_KEY_DOWN] = "Seta para baixo", [UI_KEY_LEFT] = "Seta para a esquerda", [UI_KEY_UP] = "Seta para cima", [UI_KEY_DOWN] = "Seta para baixo", [UI_KEY_LEFT] = "Seta para a esquerda",
@@ -1288,6 +1315,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_MENU_OV_SCALING] = "Escala", [UI_MENU_OV_LIMIT] = "Limite de quadros", [UI_MENU_OV_PRESENT] = "Apresentação", [UI_MENU_OV_SCALING] = "Escala", [UI_MENU_OV_LIMIT] = "Limite de quadros", [UI_MENU_OV_PRESENT] = "Apresentação",
[UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%",
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1, nitidez %d%%", [UI_MENU_OV_SCALE_NONE] = "nenhuma (1:1)", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, nitidez %d%%", [UI_MENU_OV_SCALE_NONE] = "nenhuma (1:1)",
[UI_MENU_OV_FMT_SHRINK] = "bilinear + nitidez FSR %d%%",
[UI_MENU_OV_SCALE_BILINEAR] = "bilinear", [UI_MENU_OV_SCALE_BILINEAR] = "bilinear",
[UI_MENU_FOV] = "Campo de visão", [UI_MENU_FOV] = "Campo de visão",
[UI_MENU_FOV_DESC] = "Quanto do mundo a câmera mostra, em porcentagem do original do jogo. Só na versão 1.4.3 do " [UI_MENU_FOV_DESC] = "Quanto do mundo a câmera mostra, em porcentagem do original do jogo. Só na versão 1.4.3 do "
@@ -1377,7 +1405,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_MENU_WALK_SCALE] = "Intensidade do andar", [UI_MENU_WALK_SCALE] = "Intensidade do andar",
[UI_MENU_WALK_SCALE_DESC] = "A inclinação dos analógicos do teclado enquanto a tecla de andar está segura. Metade " [UI_MENU_WALK_SCALE_DESC] = "A inclinação dos analógicos do teclado enquanto a tecla de andar está segura. Metade "
"é andar, a inclinação total é correr.", "é andar, a inclinação total é correr.",
[UI_MENU_OV_SCALE_DOWN] = "bilinear (o FSR só amplia)", [UI_MENU_OV_SCALE_DOWN] = "bilinear (nitidez FSR 0)",
[UI_MENU_HDR_HUE] = "Correção de matiz dos realces", [UI_MENU_HDR_HUE] = "Correção de matiz dos realces",
[UI_MENU_HDR_HUE_DESC] = "Cores fortes como fogo e faíscas vão para o branco como na imagem SDR do próprio jogo e " [UI_MENU_HDR_HUE_DESC] = "Cores fortes como fogo e faíscas vão para o branco como na imagem SDR do próprio jogo e "
"combinam com a luz que emitem; 0 as mantém totalmente saturadas.", "combinam com a luz que emitem; 0 as mantém totalmente saturadas.",
@@ -1540,8 +1568,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
"高于 100% 会平滑锯齿边缘(超采样),但 GPU 开销很高。", "高于 100% 会平滑锯齿边缘(超采样),但 GPU 开销很高。",
[UI_MENU_RENDER_SCALE_GAME] = "游戏(83%)", [UI_MENU_RENDER_SCALE_GAME] = "游戏(83%)",
[UI_MENU_UPSCALER] = "放大到窗口", [UI_MENU_UPSCALER] = "放大到窗口",
[UI_MENU_UPSCALER_DESC] = "窗口大于游戏分辨率时画面的放大方式。" [UI_MENU_UPSCALER_DESC] = "游戏画面适配窗口的方式。窗口更大时:FSR 比双线性更能保留边缘和细节。"
"FSR 比双线性更能保留边缘和细节。", "窗口更小时(Ocarina 绘制 2560 × 1440):画面被缩小,FSR 按下方强度锐化。",
[UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_FSR] = "AMD FSR 1",
[UI_MENU_UPSCALER_BILINEAR] = "双线性", [UI_MENU_UPSCALER_BILINEAR] = "双线性",
[UI_MENU_ASPECT] = "画面宽高比", [UI_MENU_ASPECT] = "画面宽高比",
@@ -1553,7 +1581,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_FOV_DESC] = "镜头能看到多大范围,以游戏自身视野的百分比表示。" [UI_MENU_FOV_DESC] = "镜头能看到多大范围,以游戏自身视野的百分比表示。"
"仅限游戏版本 1.4.3。", "仅限游戏版本 1.4.3。",
[UI_MENU_SHARPNESS] = "FSR 锐度", [UI_MENU_SHARPNESS] = "FSR 锐度",
[UI_MENU_SHARPNESS_DESC] = "FSR 缩放后的锐化强度;0 为关闭。", [UI_MENU_SHARPNESS_DESC] = "FSR 缩放后的锐化强度,画面缩小到窗口时同样生效;0 为关闭。",
[UI_MENU_SHARPNESS_NEEDS_FSR] = "仅限 AMD FSR 1",
[UI_MENU_COLOR] = "色彩", [UI_MENU_COLOR] = "色彩",
[UI_MENU_COLOR_PRESET] = "色彩配置", [UI_MENU_COLOR_PRESET] = "色彩配置",
[UI_MENU_COLOR_PRESET_DESC] = "同时设置下面四项。鲜艳:对比度和饱和度更高,暗部略微提亮(为 OLED 屏幕调校)。" [UI_MENU_COLOR_PRESET_DESC] = "同时设置下面四项。鲜艳:对比度和饱和度更高,暗部略微提亮(为 OLED 屏幕调校)。"
@@ -1572,7 +1601,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_COLOR_GAMMA_DESC] = "小于 1 提亮暗部与中间调,大于 1 压暗;1 表示不调整。", [UI_MENU_COLOR_GAMMA_DESC] = "小于 1 提亮暗部与中间调,大于 1 压暗;1 表示不调整。",
[UI_MENU_FPS_LIMIT] = "帧率上限", [UI_MENU_FPS_LIMIT] = "帧率上限",
[UI_MENU_FPS_LIMIT_DESC] = "游戏每秒绘制的最高帧数。高于 60 帧为实验性功能," [UI_MENU_FPS_LIMIT_DESC] = "游戏每秒绘制的最高帧数。高于 60 帧为实验性功能,"
"需要开启“游戏速度跟随时钟”。", "需要实时步进(nx2navi.ini 中 realtime = 1,默认开启)。",
[UI_MENU_FPS_30] = "30 FPS", [UI_MENU_FPS_30] = "30 FPS",
[UI_MENU_FPS_40] = "40 FPS", [UI_MENU_FPS_40] = "40 FPS",
[UI_MENU_FPS_45] = "45 FPS", [UI_MENU_FPS_45] = "45 FPS",
@@ -1615,10 +1644,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_PAD_LAYOUT_DESC] = "哪个按键是 A。Nintendo:右侧按键,与 Switch 相同。Xbox:下方按键," [UI_MENU_PAD_LAYOUT_DESC] = "哪个按键是 A。Nintendo:右侧按键,与 Switch 相同。Xbox:下方按键,"
"与 Xbox 手柄上的标注一致(PlayStation 手柄上为叉键)。自动:" "与 Xbox 手柄上的标注一致(PlayStation 手柄上为叉键)。自动:"
"带 Nintendo 标注的手柄使用 Nintendo 布局,其他手柄使用 Xbox 布局。" "带 Nintendo 标注的手柄使用 Nintendo 布局,其他手柄使用 Xbox 布局。"
"Xbox 按键提示:A 仍是右侧键,但游戏显示 Xbox 标注(A 显示为 B、" "游戏的按键提示始终显示 Switch 字母。",
"B 显示为 A、X 显示为 Y、Y 显示为 X),重启后生效。"
"这些字母来自游戏文件,因此在“操作”中重映射过的按键,"
"屏幕上仍显示原来的字母。",
[UI_MENU_PAD_LAYOUT_AUTO] = "自动", [UI_MENU_PAD_LAYOUT_AUTO] = "自动",
[UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo(A 在右)", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo(A 在右)",
[UI_MENU_PAD_LAYOUT_XBOX] = "Xbox(A 在下)", [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox(A 在下)",
@@ -1672,23 +1698,26 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_BIND_RSTICK_UP] = "视角上抬", [UI_BIND_RSTICK_UP] = "视角上抬",
[UI_BIND_RSTICK_RIGHT] = "视角右转", [UI_BIND_RSTICK_RIGHT] = "视角右转",
[UI_BIND_RSTICK_DOWN] = "视角下压", [UI_BIND_RSTICK_DOWN] = "视角下压",
[UI_BIND_DESC_A] = "互动、拾取、对话。", [UI_BIND_DESC_A] = "动作:对话、打开、拾取、攀爬、抓住。按住可冲刺。",
[UI_BIND_DESC_B] = "奔跑、取消、返回。", [UI_BIND_DESC_B] = "收起、取消、返回。在游戏选项中开启“交换跳跃按键”时为跳跃。",
[UI_BIND_DESC_X] = "跳跃。", [UI_BIND_DESC_X] = "跳跃。在游戏选项中开启“交换跳跃按键”时为收起。",
[UI_BIND_DESC_Y] = "攻击。", [UI_BIND_DESC_Y] = "挥剑攻击。",
[UI_BIND_DESC_LCLICK] = "蹲下。", [UI_BIND_DESC_LCLICK] = "按下左摇杆(游戏的操作说明中没有)。",
[UI_BIND_DESC_RCLICK] = "第一人称视角。", [UI_BIND_DESC_RCLICK] = "把视角转回林克身后。",
[UI_BIND_DESC_L] = "能力。", [UI_BIND_DESC_L] = "快捷选择道具;游戏菜单中的上一页。",
[UI_BIND_DESC_R] = "投掷武器。", [UI_BIND_DESC_R] = "快捷选择道具;游戏菜单中的下一页。",
[UI_BIND_DESC_ZL] = "举盾、锁定。", [UI_BIND_DESC_ZL] = "注目(按住或切换:游戏选项中的注目方式)。",
[UI_BIND_DESC_ZR] = "弓箭。", [UI_BIND_DESC_ZR] = "使用所选道具:弹弓、弓、回旋镖、钩爪、炸弹、瓶子。",
[UI_BIND_DESC_PLUS] = "菜单、背包。", [UI_BIND_DESC_PLUS] = "菜单:道具、装备、收集、系统。",
[UI_BIND_DESC_MINUS] = "地图。", [UI_BIND_DESC_MINUS] = "地图。",
[UI_BIND_DESC_DPAD] = "快捷选择。", [UI_BIND_DESC_LEFT] = "吹奏陶笛。",
[UI_BIND_DESC_UP] = "戴上或摘下饰品。",
[UI_BIND_DESC_RIGHT] = "和娜薇说话。",
[UI_BIND_DESC_DOWN] = "更换靴子。",
[UI_BIND_DESC_MOVE] = "像左摇杆一样移动林克。手柄的左摇杆始终可用。", [UI_BIND_DESC_MOVE] = "像左摇杆一样移动林克。手柄的左摇杆始终可用。",
[UI_BIND_DESC_CAMERA] = "像右摇杆一样转动视角。鼠标和手柄的右摇杆始终可用。", [UI_BIND_DESC_CAMERA] = "像右摇杆一样转动视角。鼠标和手柄的右摇杆始终可用。",
[UI_BIND_SHAKE] = "晃动视角摇杆", [UI_BIND_SHAKE] = "晃动视角摇杆",
[UI_BIND_DESC_SHAKE] = "让右摇杆左右晃动:把究极手抓着的物体上粘着的零件拆下。按住该键会一直晃动。", [UI_BIND_DESC_SHAKE] = "让右摇杆左右晃动。按住该键会一直晃动。",
[UI_KEY_SPACE] = "空格", [UI_KEY_SPACE] = "空格",
[UI_KEY_TAB] = "Tab", [UI_KEY_TAB] = "Tab",
[UI_KEY_LSHIFT] = "左 Shift", [UI_KEY_LSHIFT] = "左 Shift",
@@ -1927,6 +1956,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SIZE] = "%ux%u",
[UI_MENU_OV_FMT_SCENE] = "%ux%u,%.0f%%", [UI_MENU_OV_FMT_SCENE] = "%ux%u,%.0f%%",
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1,锐度 %d%%", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1,锐度 %d%%",
[UI_MENU_OV_FMT_SHRINK] = "双线性 + FSR 锐化 %d%%",
[UI_MENU_OV_SCALE_NONE] = "无(1:1)", [UI_MENU_OV_SCALE_NONE] = "无(1:1)",
[UI_MENU_OV_SCALE_BILINEAR] = "双线性", [UI_MENU_OV_SCALE_BILINEAR] = "双线性",
[UI_MENU_SHADOW_RES] = "阴影贴图尺寸", [UI_MENU_SHADOW_RES] = "阴影贴图尺寸",
@@ -1978,7 +2008,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_WALK_KEY_TAKEN] = "同时为 %s", [UI_MENU_WALK_KEY_TAKEN] = "同时为 %s",
[UI_MENU_WALK_SCALE] = "步行幅度", [UI_MENU_WALK_SCALE] = "步行幅度",
[UI_MENU_WALK_SCALE_DESC] = "按住步行键时键盘摇杆的推动幅度。一半为走路,推满为奔跑。", [UI_MENU_WALK_SCALE_DESC] = "按住步行键时键盘摇杆的推动幅度。一半为走路,推满为奔跑。",
[UI_MENU_OV_SCALE_DOWN] = "双线性(FSR 只能放大)", [UI_MENU_OV_SCALE_DOWN] = "双线性(FSR 锐度 0)",
[UI_MENU_HDR_HUE] = "高光色调校正", [UI_MENU_HDR_HUE] = "高光色调校正",
[UI_MENU_HDR_HUE_DESC] = "火焰、火花等明亮色彩像游戏自身的 SDR 画面一样趋向白色,与它们发出的光一致;0 保持完全饱和。", [UI_MENU_HDR_HUE_DESC] = "火焰、火花等明亮色彩像游戏自身的 SDR 画面一样趋向白色,与它们发出的光一致;0 保持完全饱和。",
[UI_MENU_SHADOW_SCALE] = "阴影分辨率", [UI_MENU_SHADOW_SCALE] = "阴影分辨率",
@@ -2063,19 +2093,34 @@ const char *ui_text_lang(const char *code) {
return code; return code;
} }
// Every game language: the Mals files EUen/USen, USfr/EUfr, USes/EUes ship in both builds; USpt only from 1.4.3. // Every game language with the Mals file it reads: EUen/USen, USfr/EUfr, USes/EUes ship in both NX2navi builds; USpt only
// from 1.4.3; EUpl only in Ocarina (since 999: never by version, ui_text_game_langs_in finds it by its file).
static const struct { const char *code; UiTextId name; int since; const char *mals; } all_langs[] = {
{"en-US", UI_MENU_LANGNAME_EN, 0, "USen"}, {"en-GB", UI_MENU_LANGNAME_EN_GB, 0, "EUen"},
{"ja", UI_MENU_LANGNAME_JA, 0, "JPja"}, {"fr", UI_MENU_LANGNAME_FR, 0, "EUfr"},
{"fr-CA", UI_MENU_LANGNAME_FR_CA, 0, "USfr"}, {"de", UI_MENU_LANGNAME_DE, 0, "EUde"},
{"it", UI_MENU_LANGNAME_IT, 0, "EUit"}, {"es", UI_MENU_LANGNAME_ES, 0, "EUes"},
{"es-419", UI_MENU_LANGNAME_ES_419, 0, "USes"}, {"pt-BR", UI_MENU_LANGNAME_PT_BR, 143, "USpt"},
{"nl", UI_MENU_LANGNAME_NL, 0, "EUnl"}, {"ru", UI_MENU_LANGNAME_RU, 0, "EUru"},
{"zh-Hans", UI_MENU_LANGNAME_ZH_HANS, 0, "CNzh"}, {"zh-Hant", UI_MENU_LANGNAME_ZH_HANT, 0, "TWzh"},
{"ko", UI_MENU_LANGNAME_KO, 0, "KRko"}, {"pl", UI_MENU_LANGNAME_PL, 999, "EUpl"},
};
int ui_text_game_langs(int game_version, UiGameLang *out, int max) { int ui_text_game_langs(int game_version, UiGameLang *out, int max) {
static const struct { const char *code; UiTextId name; int since; } all[] = {
{"en-US", UI_MENU_LANGNAME_EN, 0}, {"en-GB", UI_MENU_LANGNAME_EN_GB, 0}, {"ja", UI_MENU_LANGNAME_JA, 0},
{"fr", UI_MENU_LANGNAME_FR, 0}, {"fr-CA", UI_MENU_LANGNAME_FR_CA, 0}, {"de", UI_MENU_LANGNAME_DE, 0},
{"it", UI_MENU_LANGNAME_IT, 0}, {"es", UI_MENU_LANGNAME_ES, 0}, {"es-419", UI_MENU_LANGNAME_ES_419, 0},
{"pt-BR", UI_MENU_LANGNAME_PT_BR, 143}, {"nl", UI_MENU_LANGNAME_NL, 0}, {"ru", UI_MENU_LANGNAME_RU, 0},
{"zh-Hans", UI_MENU_LANGNAME_ZH_HANS, 0}, {"zh-Hant", UI_MENU_LANGNAME_ZH_HANT, 0},
{"ko", UI_MENU_LANGNAME_KO, 0},
};
int n = 0; int n = 0;
for (size_t i = 0; i < sizeof all / sizeof *all && n < max; i++) for (size_t i = 0; i < sizeof all_langs / sizeof *all_langs && n < max; i++)
if (game_version >= all[i].since) out[n++] = (UiGameLang){all[i].code, all[i].name}; if (game_version >= all_langs[i].since) out[n++] = (UiGameLang){all_langs[i].code, all_langs[i].name};
return n;
}
int ui_text_game_langs_in(const char *const *regions, int nregions, UiGameLang *out, int max) {
int n = 0;
for (size_t i = 0; i < sizeof all_langs / sizeof *all_langs && n < max; i++)
for (int r = 0; r < nregions; r++)
if (!strcmp(regions[r], all_langs[i].mals)) {
out[n++] = (UiGameLang){all_langs[i].code, all_langs[i].name};
break;
}
return n; return n;
} }

View File

@@ -40,7 +40,7 @@ typedef enum {
UI_MENU_FOV, UI_MENU_FOV_DESC, UI_MENU_FOV, UI_MENU_FOV_DESC,
UI_MENU_SHADOW_RES, UI_MENU_SHADOW_RES_DESC, UI_MENU_SHADOW_RES_GAME, UI_MENU_SHADOW_RES, UI_MENU_SHADOW_RES_DESC, UI_MENU_SHADOW_RES_GAME,
UI_MENU_ANISO, UI_MENU_ANISO_DESC, UI_MENU_ANISO_GAME, UI_MENU_ANISO, UI_MENU_ANISO_DESC, UI_MENU_ANISO_GAME,
UI_MENU_SHARPNESS, UI_MENU_SHARPNESS_DESC, UI_MENU_SHARPNESS, UI_MENU_SHARPNESS_DESC, UI_MENU_SHARPNESS_NEEDS_FSR,
UI_MENU_COLOR, // group heading over the colour rows UI_MENU_COLOR, // group heading over the colour rows
UI_MENU_COLOR_PRESET, UI_MENU_COLOR_PRESET_DESC, UI_MENU_COLOR_DEFAULT, UI_MENU_COLOR_VIVID, UI_MENU_COLOR_CLARITY, UI_MENU_COLOR_PRESET, UI_MENU_COLOR_PRESET_DESC, UI_MENU_COLOR_DEFAULT, UI_MENU_COLOR_VIVID, UI_MENU_COLOR_CLARITY,
UI_MENU_COLOR_CUSTOM, UI_MENU_COLOR_CUSTOM,
@@ -129,7 +129,8 @@ typedef enum {
// what an action does in the world, in action order up to Minus // what an action does in the world, in action order up to Minus
UI_BIND_DESC_A, UI_BIND_DESC_B, UI_BIND_DESC_X, UI_BIND_DESC_Y, UI_BIND_DESC_LCLICK, UI_BIND_DESC_RCLICK, UI_BIND_DESC_A, UI_BIND_DESC_B, UI_BIND_DESC_X, UI_BIND_DESC_Y, UI_BIND_DESC_LCLICK, UI_BIND_DESC_RCLICK,
UI_BIND_DESC_L, UI_BIND_DESC_R, UI_BIND_DESC_ZL, UI_BIND_DESC_ZR, UI_BIND_DESC_PLUS, UI_BIND_DESC_MINUS, UI_BIND_DESC_L, UI_BIND_DESC_R, UI_BIND_DESC_ZL, UI_BIND_DESC_ZR, UI_BIND_DESC_PLUS, UI_BIND_DESC_MINUS,
UI_BIND_DESC_DPAD, UI_BIND_DESC_MOVE, UI_BIND_DESC_CAMERA, UI_BIND_DESC_SHAKE, UI_BIND_DESC_LEFT, UI_BIND_DESC_UP, UI_BIND_DESC_RIGHT, UI_BIND_DESC_DOWN, UI_BIND_DESC_MOVE, UI_BIND_DESC_CAMERA,
UI_BIND_DESC_SHAKE,
// key names, in key id order KEY_SPACE .. KEY_PAGEDOWN (letters, digits, F keys and punctuation show as themselves) // key names, in key id order KEY_SPACE .. KEY_PAGEDOWN (letters, digits, F keys and punctuation show as themselves)
UI_KEY_SPACE, UI_KEY_TAB, UI_KEY_LSHIFT, UI_KEY_LCTRL, UI_KEY_UP, UI_KEY_DOWN, UI_KEY_LEFT, UI_KEY_RIGHT, UI_KEY_SPACE, UI_KEY_TAB, UI_KEY_LSHIFT, UI_KEY_LCTRL, UI_KEY_UP, UI_KEY_DOWN, UI_KEY_LEFT, UI_KEY_RIGHT,
UI_KEY_MOUSE_L, UI_KEY_MOUSE_R, UI_KEY_MOUSE_M, UI_KEY_MOUSE_X1, UI_KEY_MOUSE_X2, UI_KEY_MOUSE_L, UI_KEY_MOUSE_R, UI_KEY_MOUSE_M, UI_KEY_MOUSE_X1, UI_KEY_MOUSE_X2,
@@ -161,7 +162,7 @@ typedef enum {
UI_MENU_LANGNAME_EN, UI_MENU_LANGNAME_JA, UI_MENU_LANGNAME_FR, UI_MENU_LANGNAME_DE, UI_MENU_LANGNAME_IT, UI_MENU_LANGNAME_EN, UI_MENU_LANGNAME_JA, UI_MENU_LANGNAME_FR, UI_MENU_LANGNAME_DE, UI_MENU_LANGNAME_IT,
UI_MENU_LANGNAME_ES, UI_MENU_LANGNAME_NL, UI_MENU_LANGNAME_RU, UI_MENU_LANGNAME_ZH_HANS, UI_MENU_LANGNAME_ES, UI_MENU_LANGNAME_NL, UI_MENU_LANGNAME_RU, UI_MENU_LANGNAME_ZH_HANS,
UI_MENU_LANGNAME_ZH_HANT, UI_MENU_LANGNAME_KO, UI_MENU_LANGNAME_PT_BR, UI_MENU_LANGNAME_EN_GB, UI_MENU_LANGNAME_ZH_HANT, UI_MENU_LANGNAME_KO, UI_MENU_LANGNAME_PT_BR, UI_MENU_LANGNAME_EN_GB,
UI_MENU_LANGNAME_FR_CA, UI_MENU_LANGNAME_ES_419, UI_MENU_LANGNAME_FR_CA, UI_MENU_LANGNAME_ES_419, UI_MENU_LANGNAME_PL,
// Advanced // Advanced
UI_MENU_ADV_WARNING, UI_MENU_ADV_WARNING,
@@ -223,6 +224,7 @@ typedef enum {
UI_MENU_OV_FMT_SIZE, // "%ux%u" UI_MENU_OV_FMT_SIZE, // "%ux%u"
UI_MENU_OV_FMT_SCENE, // "%ux%u, %.0f%%": the scene and its share of the game image's width UI_MENU_OV_FMT_SCENE, // "%ux%u, %.0f%%": the scene and its share of the game image's width
UI_MENU_OV_FMT_FSR, // "AMD FSR 1, sharpness %d%%" UI_MENU_OV_FMT_FSR, // "AMD FSR 1, sharpness %d%%"
UI_MENU_OV_FMT_SHRINK, // the image is larger than the window: "bilinear + FSR sharpening %d%%"
UI_MENU_OV_SCALE_NONE, UI_MENU_OV_SCALE_BILINEAR, UI_MENU_OV_SCALE_NONE, UI_MENU_OV_SCALE_BILINEAR,
UI_MENU_OV_SCALE_DOWN, // FSR is selected but the image is larger than the window: FSR only enlarges 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 // the Cheats tab (cheats.c): the file, the kinds of cheat and why one cannot be switched
@@ -260,6 +262,10 @@ const char *ui_text_lang(const char *switch_code);
// Fills out (room for max entries) and returns the count. // Fills out (room for max entries) and returns the count.
typedef struct { const char *code; UiTextId name; } UiGameLang; typedef struct { const char *code; UiTextId name; } UiGameLang;
int ui_text_game_langs(int game_version, UiGameLang *out, int max); int ui_text_game_langs(int game_version, UiGameLang *out, int max);
// The same list from the Mals files the RomFS ships (Ocarina: Polish and Brazilian Portuguese, no Portugal Portuguese):
// regions holds the four-letter prefix of each Mals/<region>.Product... file ("USen", "EUpl"); the version gates are
// not used. Returns the count.
int ui_text_game_langs_in(const char *const *regions, int nregions, UiGameLang *out, int max);
// Menu text: ui_text_in(menu language, id). The menu language is NX2NAVI_MENU_LANG ("en", "ru", "pt-BR", "zh-Hans"); // Menu text: ui_text_in(menu language, id). The menu language is NX2NAVI_MENU_LANG ("en", "ru", "pt-BR", "zh-Hans");
// unset, the system UI language when the catalog has menu text for it (English, Russian, Brazilian Portuguese, // unset, the system UI language when the catalog has menu text for it (English, Russian, Brazilian Portuguese,

View File

@@ -141,8 +141,9 @@ void vk_present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w, in
// queues it. The next blit or a swapchain rebuild queues a waiting present first. // queues it. The next blit or a swapchain rebuild queues a waiting present first.
void vk_present_blit(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]); void vk_present_blit(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]);
// FSR 1 on the present (vk_fsr.c): records EASU (+ RCAS) of src's crop rectangle {x, y, w, h} into the rectangle out // FSR 1 on the present (vk_fsr.c): records EASU (+ RCAS) of src's crop rectangle {x, y, w, h} into the rectangle out
// {x, y, w, h} of dst, a swapchain image in TRANSFER_DST; src is in GENERAL and fmt its format. 0 = nothing recorded // {x, y, w, h} of dst, a swapchain image in TRANSFER_DST; src is in GENERAL and fmt its format. 1 = EASU enlarged it,
// (the setting says bilinear, no upscale is needed, or FSR is not available): the caller blits. // 2 = a bilinear blit shrank it and RCAS sharpened it (the picture is smaller than the crop), 0 = nothing recorded (the
// setting says bilinear, the sizes are equal, a shrink without sharpening, or FSR is not available): the caller blits.
int vk_fsr_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, int sw, int sh, const int crop[4], int vk_fsr_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, int sw, int sh, const int crop[4],
VkImage dst, const int out[4]); VkImage dst, const int out[4]);
void vk_fsr_release(void); // before the device goes away void vk_fsr_release(void); // before the device goes away
@@ -151,6 +152,9 @@ void vk_fsr_release(void); // before the device goes away
// scales that one instead, crop {0, 0, w, h}); VK_NULL_HANDLE = nothing recorded. src is in GENERAL, fmt its format. // scales that one instead, crop {0, 0, w, h}); VK_NULL_HANDLE = nothing recorded. src is in GENERAL, fmt its format.
VkImage vk_color_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, const int crop[4]); VkImage vk_color_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, const int crop[4]);
void vk_color_release(void); // before the device goes away void vk_color_release(void); // before the device goes away
// The brightness, contrast, saturation and gamma values (as the settings write them) of a colour profile, NULL for
// custom or an unknown name (vk_color.c).
const char *const *vk_color_preset(const char *name);
// HDR output (vk_hdr.c). vk_hdr_wanted: NX2NAVI_HDR, read once. vk_hdr_surface_format: the HDR10 surface format when wanted // HDR output (vk_hdr.c). vk_hdr_wanted: NX2NAVI_HDR, read once. vk_hdr_surface_format: the HDR10 surface format when wanted
// and offered (1). vk_hdr_set_active: gfx_present.c says whether the swapchain is HDR10 (vk_hdr_active). vk_hdr_encode: // and offered (1). vk_hdr_set_active: gfx_present.c says whether the swapchain is HDR10 (vk_hdr_active). vk_hdr_encode:
// like vk_color_record, src's crop as PQ code values (RGBA16F, crop {0, 0, w, h}). vk_hdr_ui_target / vk_hdr_ui_compose: // like vk_color_record, src's crop as PQ code values (RGBA16F, crop {0, 0, w, h}). vk_hdr_ui_target / vk_hdr_ui_compose:

View File

@@ -1,8 +1,10 @@
// Colour adjustment on the present (vk_color.h): brightness, contrast, saturation and gamma of the game's picture, after // Colour adjustment on the present (vk_color.h): brightness, contrast, saturation and gamma of the game's picture, after
// the game and before the FSR 1 pass or the blit scale it to the window. Settings NX2NAVI_COLOR_BRIGHTNESS (-30..30, % // the game and before the FSR 1 pass or the blit scale it to the window. Settings NX2NAVI_COLOR_BRIGHTNESS (-30..30, %
// added), NX2NAVI_COLOR_CONTRAST and NX2NAVI_COLOR_SATURATION (%, 100 = unchanged) and NX2NAVI_COLOR_GAMMA (exponent, 1 = // added), NX2NAVI_COLOR_CONTRAST and NX2NAVI_COLOR_SATURATION (%, 100 = unchanged) and NX2NAVI_COLOR_GAMMA (exponent, 1 =
// unchanged), read when the settings change; the menu's colour profiles only write these four. At the default values // unchanged), read when the settings change. NX2NAVI_COLOR_PRESET names a profile (vk_color_preset) whose values win
// nothing is recorded and the present is what it was. Design and preset values: STS78721's colour profiles (issue #136). // over the four, so a profile set in nx2navi.ini or by NX2NAVI_MENU_TEST_SET applies without the menu; custom uses the
// four. At the default values nothing is recorded and the present is what it was. Design and preset values: STS78721's
// colour profiles (issue #136).
// //
// One compute pass (shaders/color_grade.comp) reads the crop rectangle of the game's image and writes an RGBA16F image // One compute pass (shaders/color_grade.comp) reads the crop rectangle of the game's image and writes an RGBA16F image
// of its size, which present_image then hands to FSR or the blit in place of the game's image. The HUD is part of that // of its size, which present_image then hands to FSR or the blit in place of the game's image. The HUD is part of that
@@ -11,6 +13,7 @@
// the output image is shared by all slots, and each frame's first barrier orders it after the previous frame's reads. // the output image is shared by all slots, and each frame's first barrier orders it after the previous frame's reads.
#include "vk.h" #include "vk.h"
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "cfg.h" #include "cfg.h"
@@ -111,15 +114,29 @@ static int ensure_image(VkCtx *c, uint32_t w, uint32_t h) {
return 1; return 1;
} }
// The four values from the settings, re-read when they change. 1 when any differs from "unchanged". const char *const *vk_color_preset(const char *name) {
static const char *const presets[][5] = {
{"default", "0", "100", "100", "1"}, {"vivid", "0", "115", "135", "0.95"}, {"clarity", "2", "110", "115", "1"}};
for (size_t i = 0; i < sizeof presets / sizeof *presets; i++)
if (!strcmp(name, presets[i][0])) return presets[i] + 1;
return NULL;
}
// The four values from the profile, or from their own settings under custom (or an unknown profile name); re-read when
// the settings change. 1 when any differs from "unchanged".
static int adjusting(void) { static int adjusting(void) {
unsigned v = cfg_version(); unsigned v = cfg_version();
if (v != C.seen) { if (v != C.seen) {
C.seen = v; C.seen = v;
C.adj[0] = (float)cfg_double("NX2NAVI_COLOR_BRIGHTNESS") / 100.0f; const char *const *p = vk_color_preset(cfg_value("NX2NAVI_COLOR_PRESET"));
C.adj[1] = (float)cfg_double("NX2NAVI_COLOR_CONTRAST") / 100.0f; static const char *const keys[4] = {"NX2NAVI_COLOR_BRIGHTNESS", "NX2NAVI_COLOR_CONTRAST",
C.adj[2] = (float)cfg_double("NX2NAVI_COLOR_SATURATION") / 100.0f; "NX2NAVI_COLOR_SATURATION", "NX2NAVI_COLOR_GAMMA"};
C.adj[3] = (float)cfg_double("NX2NAVI_COLOR_GAMMA"); double d[4];
for (int i = 0; i < 4; i++) d[i] = p ? strtod(p[i], NULL) : cfg_double(keys[i]);
C.adj[0] = (float)d[0] / 100.0f;
C.adj[1] = (float)d[1] / 100.0f;
C.adj[2] = (float)d[2] / 100.0f;
C.adj[3] = (float)d[3];
} }
return C.adj[0] != 0.0f || C.adj[1] != 1.0f || C.adj[2] != 1.0f || C.adj[3] != 1.0f; return C.adj[0] != 0.0f || C.adj[1] != 1.0f || C.adj[2] != 1.0f || C.adj[3] != 1.0f;
} }

View File

@@ -1,7 +1,9 @@
// AMD FidelityFX Super Resolution 1 on the present path (gfx_present.c present_image): when the window is larger than // AMD FidelityFX Super Resolution 1 on the present path (gfx_present.c present_image): when the window is larger than
// the game's output, EASU scales the game's crop rectangle to the swapchain size and RCAS sharpens it, in place of the // the game's output, EASU scales the game's crop rectangle to the swapchain size and RCAS sharpens it, in place of the
// bilinear vkCmdBlitImage. NX2NAVI_UPSCALER=fsr|bilinear picks it, NX2NAVI_SHARPNESS (0..100, 0 = no RCAS pass) sets RCAS; // bilinear vkCmdBlitImage. When the game's output is larger than the window (Ocarina draws 2560x1440 docked, so a
// both apply at the next frame. // 1920x1080 window shrinks it), EASU does not apply (it only enlarges): a bilinear blit shrinks the crop into the first
// intermediate image and RCAS sharpens that, which gives back some of the detail the shrink blurs. NX2NAVI_UPSCALER=
// fsr|bilinear picks it, NX2NAVI_SHARPNESS (0..100, 0 = no RCAS pass) sets RCAS; both apply at the next frame.
// //
// Per frame: EASU reads the source through a view of its own format (the same colour conversion the blit does) and // Per frame: EASU reads the source through a view of its own format (the same colour conversion the blit does) and
// writes an RGBA16F image of the picture's size on the swapchain (all of it, or the part between black bars, // writes an RGBA16F image of the picture's size on the swapchain (all of it, or the part between black bars,
@@ -111,7 +113,7 @@ static int ensure_images(VkCtx *c, uint32_t w, uint32_t h) {
.format = VK_FORMAT_R16G16B16A16_SFLOAT, .extent = {w, h, 1}, .mipLevels = 1, .format = VK_FORMAT_R16G16B16A16_SFLOAT, .extent = {w, h, 1}, .mipLevels = 1,
.arrayLayers = 1, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = VK_IMAGE_TILING_OPTIMAL, .arrayLayers = 1, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = VK_IMAGE_TILING_OPTIMAL,
.usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | .usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT}; VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT};
VmaAllocationCreateInfo ai = {.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE}; VmaAllocationCreateInfo ai = {.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE};
if (vmaCreateImage(c->vma, &ci, &ai, &F.img[i], &F.alloc[i], NULL) != VK_SUCCESS) { if (vmaCreateImage(c->vma, &ci, &ai, &F.img[i], &F.alloc[i], NULL) != VK_SUCCESS) {
F.img[i] = VK_NULL_HANDLE; F.img[i] = VK_NULL_HANDLE;
@@ -156,14 +158,62 @@ static void bind_pass(VkCommandBuffer cb, VkPipeline p, VkImageView in, VkImageV
vkCmdPushConstants(cb, F.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, 32, pc); vkCmdPushConstants(cb, F.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, 32, pc);
} }
// The shrink path: the crop of src (GENERAL) shrunk by a bilinear blit into F.img[0], RCAS into F.img[1], a 1:1 copy into
// dst. Returns 2.
static int shrink_sharpen(VkCommandBuffer cb, VkImage src, const int crop[4], VkImage dst, const int out[4], int sharp) {
uint32_t dw = (uint32_t)out[2], dh = (uint32_t)out[3];
if (F.logged != 2) {
F.logged = 2;
rt_log("vk: FSR sharpens the shrunk picture: %dx%d to %ux%u (sharpness %d; FSR's EASU only enlarges)", crop[2],
crop[3], dw, dh, sharp);
}
const VkPipelineStageFlags2 CS = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, XF = VK_PIPELINE_STAGE_2_TRANSFER_BIT;
// the game's writes to the source become visible to the blit; the earlier frame's reads of the intermediates finish
// before this frame writes them
barrier(cb, src, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_ACCESS_2_MEMORY_WRITE_BIT, XF, VK_ACCESS_2_TRANSFER_READ_BIT);
barrier(cb, F.img[0], VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL, CS | XF, 0, XF, VK_ACCESS_2_TRANSFER_WRITE_BIT);
barrier(cb, F.img[1], VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL, CS | XF, 0, CS,
VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT);
VkImageBlit shrink = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.srcOffsets = {{crop[0], crop[1], 0}, {crop[0] + crop[2], crop[1] + crop[3], 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.dstOffsets = {{0, 0, 0}, {(int)dw, (int)dh, 1}}};
vkCmdBlitImage(cb, src, VK_IMAGE_LAYOUT_GENERAL, F.img[0], VK_IMAGE_LAYOUT_GENERAL, 1, &shrink, VK_FILTER_LINEAR);
// later submissions that write the source wait for the blit's read
barrier(cb, src, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, XF, 0, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, 0);
barrier(cb, F.img[0], VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, XF, VK_ACCESS_2_TRANSFER_WRITE_BIT, CS,
VK_ACCESS_2_SHADER_SAMPLED_READ_BIT);
float rcas[8] = {(float)dw, (float)dh, (float)(100 - sharp) / 50.0f, 0, 0, 0, 0, 0};
bind_pass(cb, F.rcas, F.view[0], F.view[1], rcas);
vkCmdDispatch(cb, (dw + 15) / 16, (dh + 15) / 16, 1);
barrier(cb, F.img[1], VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, CS, VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT, XF,
VK_ACCESS_2_TRANSFER_READ_BIT);
VkImageBlit copy = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.srcOffsets = {{0, 0, 0}, {(int)dw, (int)dh, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.dstOffsets = {{out[0], out[1], 0}, {out[0] + (int)dw, out[1] + (int)dh, 1}}};
vkCmdBlitImage(cb, F.img[1], VK_IMAGE_LAYOUT_GENERAL, dst, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &copy,
VK_FILTER_NEAREST);
return 2;
}
int vk_fsr_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, int sw, int sh, const int crop[4], int vk_fsr_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, int sw, int sh, const int crop[4],
VkImage dst, const int out[4]) { VkImage dst, const int out[4]) {
int cw = crop[2], ch = crop[3]; int cw = crop[2], ch = crop[3];
uint32_t dw = (uint32_t)out[2], dh = (uint32_t)out[3]; uint32_t dw = (uint32_t)out[2], dh = (uint32_t)out[3];
if (strcmp(cfg_value("NX2NAVI_UPSCALER"), "fsr") || (dw <= (uint32_t)cw && dh <= (uint32_t)ch) || !fmt) return 0; if (strcmp(cfg_value("NX2NAVI_UPSCALER"), "fsr") || !fmt || (dw == (uint32_t)cw && dh == (uint32_t)ch)) return 0;
int sharp = cfg_int("NX2NAVI_SHARPNESS");
if (sharp < 0) sharp = 0;
if (sharp > 100) sharp = 100;
// EASU only enlarges: a picture smaller than the crop in either direction takes the shrink path, which without
// sharpening is the plain blit of the caller
int shrink = dw < (uint32_t)cw || dh < (uint32_t)ch;
if (shrink && !sharp) return 0;
VkCtx *c = vk_ctx(); VkCtx *c = vk_ctx();
if (!F.tried) init(c); if (!F.tried) init(c);
if (!F.ok || !ensure_images(c, dw, dh)) return 0; if (!F.ok || !ensure_images(c, dw, dh)) return 0;
if (shrink) return shrink_sharpen(cb, src, crop, dst, out, sharp);
slot %= SLOTS; slot %= SLOTS;
if (F.src_view[slot]) vkDestroyImageView(c->device, F.src_view[slot], NULL); if (F.src_view[slot]) vkDestroyImageView(c->device, F.src_view[slot], NULL);
VkImageViewCreateInfo vi = {.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .image = src, VkImageViewCreateInfo vi = {.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .image = src,
@@ -175,10 +225,7 @@ int vk_fsr_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt,
F.src_view[slot] = VK_NULL_HANDLE; F.src_view[slot] = VK_NULL_HANDLE;
return 0; return 0;
} }
int sharp = cfg_int("NX2NAVI_SHARPNESS"); if (F.logged != 1) {
if (sharp < 0) sharp = 0;
if (sharp > 100) sharp = 100;
if (!F.logged) {
F.logged = 1; F.logged = 1;
rt_log("vk: FSR upscales %dx%d to %ux%u (sharpness %d)", cw, ch, dw, dh, sharp); rt_log("vk: FSR upscales %dx%d to %ux%u (sharpness %d)", cw, ch, dw, dh, sharp);
} }