mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 09:39:58 -04:00
In the settings menu a click anywhere on a row stepped its setting to the next value, and the left arrow stood left of the value's text, so it moved whenever a value of another width came up: clicking the left arrow through a list landed on the row at the second click and stepped the other way. Each stepper now has its arrows in white frames at fixed places, the left one the width of the row's widest value from the right one, and the mouse changes the value on those frames only; a click on the rest of the row selects it. On and off rows have the same arrows. An arrow at the end of its values is drawn faint and does nothing, and a button held on an arrow repeats as a held key does. A, Enter and left and right work as before. NX2NAVI_MENU_TEST_CLICK clicks rows by their setting's name during a menu test run. On an RX 7900 XT at 3232x1352 the arrows stepped the performance overlay one value a click and stopped at both ends, and clicks on the body of four rows changed nothing. HDR between off and the tone mapper now follows the menu. The HDR path is set up at every start (vk_hdr_armed): the swapchain colour space and metadata extensions, the tonemap splice and the settings in the support buffer, with the spliced tonemap returning the game's own SDR result while the swapchain is SDR. A change of the setting makes the swapchain again in the other format. On the same card a run that started with HDR off went to an HDR10 swapchain and back, and one that started with HDR on went to SDR and back, with the picture right in each state. The game's native HDR still waits for a restart, as the game asks about the display once, and the row says so. NX2NAVI_HDR_LIVE = 0 leaves the HDR path out of a run that starts with HDR off. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
96 lines
6.9 KiB
C
96 lines
6.9 KiB
C
// Settings pages in two panes (ui/option_rows.cpp): option rows on the left, the selected (controller) or hovered (mouse)
|
|
// row's description on the right. Each row shows a setting of the cfg table (cfg.h) and changes it through cfg_set: A
|
|
// steps it (toggle, next value), left and right step it, and the mouse steps it on the two framed arrows beside its
|
|
// value and nowhere else on the row (a click on the row selects it; held on an arrow it repeats). A row marks the
|
|
// default value, says "after restart" when the setting is read at start, and is greyed out with a note when an
|
|
// environment variable fixes it.
|
|
//
|
|
// opt_begin("##screen", scale);
|
|
// opt_toggle("NX2NAVI_FULLSCREEN", UI_MENU_FULLSCREEN, UI_MENU_FULLSCREEN_DESC);
|
|
// opt_end();
|
|
//
|
|
// key: the setting's NX2NAVI_ name, which must have a cfg_meta row. Present path only (ImGui).
|
|
#pragma once
|
|
#include "imgui.h"
|
|
|
|
extern "C" {
|
|
#include "ui_text.h"
|
|
}
|
|
|
|
void opt_begin(const char *id, float scale);
|
|
void opt_end(void);
|
|
// The height the next pages leave free under their panes (the menu's bottom row).
|
|
void opt_reserve_bottom(float h);
|
|
// The height opt_reserve_bottom keeps free, for a tab that lays out its own panes (ui/amiibo_page.cpp).
|
|
float opt_bottom(void);
|
|
// The next page's first row takes the controller's cursor (opening the menu, switching tabs).
|
|
void opt_focus_first(void);
|
|
// The row of key (or button id) takes the cursor, scrolled into view, when it is next drawn.
|
|
void opt_focus_key(const char *key);
|
|
// The next row is greyed out like one the environment fixes, with note under its label and in its description.
|
|
void opt_disable_next(UiTextId note);
|
|
void opt_disable_next_text(const char *note); // note must outlive the frame
|
|
|
|
// Page text that is not a row: a group heading in the accent colour, a wrapped paragraph (warn: the warning colour).
|
|
void opt_group(UiTextId title);
|
|
void opt_text(UiTextId text, bool warn = false);
|
|
|
|
// The return value of every row: true when it changed the setting this frame.
|
|
// inverted: the row shows "on" while the key is 0 (a setting whose key names the opposite).
|
|
bool opt_toggle(const char *key, UiTextId label, UiTextId desc, bool inverted = false);
|
|
// An on/off row over a key with named values: off while the key holds off_value and on for any other, so a value the
|
|
// row does not write itself still reads as on. Flipping it writes on_value or off_value. note: as for opt_choice.
|
|
bool opt_toggle_value(const char *key, UiTextId label, UiTextId desc, const char *on_value, const char *off_value,
|
|
const char *note = nullptr);
|
|
// One name per value of the key's cfg_meta values list, in its order. When the key has no fixed default (an empty
|
|
// def), names[0] is the automatic choice (the key unset) and names[1..] follow the values. note: a short line under
|
|
// the value in place of the "default" mark (NULL: none).
|
|
bool opt_choice(const char *key, UiTextId label, const UiTextId *names, int n, UiTextId desc,
|
|
const char *note = nullptr);
|
|
// A choice over a list the caller builds (devices, window sizes): values[i] is written, names[i] shown; "" means the key
|
|
// unset. cur: the index in effect, -1 to find cfg_value(key) in values (no match: the value shown as it is).
|
|
bool opt_choice_list(const char *key, UiTextId label, const char *const *values, const char *const *names, int n,
|
|
UiTextId desc, int cur = -1, const char *note = nullptr);
|
|
// A choice whose value is spread over several settings: the caller gives the index in effect and the default's and
|
|
// writes the settings itself (opt_apply) when this returns the new index; -1 while unchanged. key: the setting the row
|
|
// stands for (its restart mark and the environment check).
|
|
int opt_choice_index(const char *key, UiTextId label, const char *const *names, int n, int cur, int def, UiTextId desc,
|
|
const char *note = nullptr);
|
|
void opt_apply(const char *key, const char *value); // what a row writes: "" unsets the key; saved a moment later
|
|
// A row that runs an action: true on A or a click. id: unique on the page and not a setting ("##copy_info"); value:
|
|
// shown on the right ("" none).
|
|
bool opt_button(const char *id, UiTextId label, UiTextId desc, const char *value = "");
|
|
// A row whose label, value, note (under the value) and description are text, not catalog ids: a mod's folder name.
|
|
// Returns 2 (A / click), -1 / +1 (left / right), 3 / 4 (move up / down: the top / left face buttons, Ctrl+Up /
|
|
// Ctrl+Down, the drawn arrows; movable rows only) or 0.
|
|
int opt_text_row(const char *id, const char *label, const char *value, const char *note, const char *desc,
|
|
bool movable);
|
|
// Rows and text that are not settings of the cfg table: a label and description of the caller's own (the cheats of
|
|
// the cheat files). opt_toggle_text shows on / off (value: shown instead, NULL for On / Off) and returns true on A, a
|
|
// click, left or right; the caller changes its state. id: unique on the page, the environment check uses it.
|
|
bool opt_toggle_text(const char *id, const char *label, const char *desc, bool on, const char *value = nullptr);
|
|
void opt_group_text(const char *title);
|
|
void opt_text_str(const char *text, bool warn = false);
|
|
// lo..hi in steps of step (left and right held for a second go ten times as fast); fmt formats the value ("%.0f %%").
|
|
// note: a short line under the value in place of the "default" mark (NULL: none). fallback: the setting that applies
|
|
// while key is unset; the row shows its value then, and a change sets key. A key with no table default of its own takes
|
|
// the "default" mark from the fallback's default, and a step onto the fallback's value unsets key again.
|
|
bool opt_slider(const char *key, UiTextId label, float lo, float hi, UiTextId desc, float step = 1,
|
|
const char *fmt = "%g", const char *note = nullptr, const char *fallback = nullptr);
|
|
|
|
// Binding rows (remapping on the Controls tab): a label and three cells, each selectable on its own (left / right move between them).
|
|
// opt_bind_header: the column titles above them. opt_bind_row: key is the setting's name without NX2NAVI_ (BIND_A; the
|
|
// description names it when the environment sets it); a disabled cell shows its text greyed and takes no cursor; note
|
|
// (NULL none) follows the description. Returns the cell A / Enter / a click activated (0..2), 10 + the cell Delete,
|
|
// Backspace or X cleared, or -1. opt_focus_key("<key>#<cell>") puts the cursor on a cell.
|
|
void opt_bind_header(UiTextId c0, UiTextId c1, UiTextId c2);
|
|
int opt_bind_row(const char *key, const char *label, UiTextId desc, const char *const cells[3], const bool enabled[3],
|
|
const char *note = nullptr);
|
|
|
|
// nx2navi.ini is written a moment after the last change (a held slider would rewrite it every frame) and when the menu
|
|
// closes. opt_save_tick: on every frame the menu lays out; force: write now if anything is pending. 1 while a write is
|
|
// pending.
|
|
int opt_save_tick(int force);
|
|
// A change made outside a row (Reset, F10): nx2navi.ini is written as after a row's change.
|
|
void opt_save_soon(void);
|