Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions gpu/vk/vk_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ extern "C" {

#define MKWVK_API_VERSION 10
enum { HOS_OPT_CHEAT_HEARTS = 32, HOS_OPT_CHEAT_FLIGHT, HOS_OPT_CHEAT_ACTION, HOS_OPT_CHEAT_CAMERA };
/* (hookshot) the Controls tab's motion rows (host/pad_sdl.c reads them, vk_replay.cpp's option answers them): Motion
controls on or off, the horizontal's and the vertical's sensitivity in percent, and each turned around */
enum { HOS_OPT_GYRO = 18, HOS_OPT_GYRO_SENS_X, HOS_OPT_GYRO_INV_X, HOS_OPT_GYRO_INV_Y, HOS_OPT_GYRO_SENS_Y };
/* (hookshot) the Motion page's rows (host/pad_sdl.c reads them, vk_replay.cpp's option answers them): Motion controls on
or off, the horizontal's and the vertical's sensitivity in percent, each turned around, and the deadzone (0 to 2) */
enum { HOS_OPT_GYRO = 18, HOS_OPT_GYRO_SENS_X, HOS_OPT_GYRO_INV_X, HOS_OPT_GYRO_INV_Y, HOS_OPT_GYRO_SENS_Y, HOS_OPT_GYRO_DEADZONE };
/* (hookshot) NVIDIA DLSS's camera jitter (host/rx_backend.c, gpu/vk/vk_dlss.cpp): the scene's width and height while DLSS
draws, 0 when there is to be no jitter, and the jitter sequence's length. 24 on: 18 to 22 are the motion rows' */
draws, 0 when there is to be no jitter, and the jitter sequence's length. 24 on: 18 to 23 are the motion rows' */
enum { HOS_OPT_DLSS_JITTER_W = 24, HOS_OPT_DLSS_JITTER_H, HOS_OPT_DLSS_JITTER_PHASES };

/* (hookshot) the controls' names (host/nn_hid.c, host/pad_sdl.c, the pad_ and key_ lines of hookshot_options.ini):
Expand Down Expand Up @@ -156,8 +156,8 @@ typedef struct MkwVkRenderer {
void (*nvn_event_signal)(uint64_t gpu, uint32_t value);
int (*option)(int id); /* (hookshot, the Insert menu) 0: game time follows the clock, 1: the menu is open, 2: dynamic resolution, 3: its fixed scale in percent, 4: the controllers count behind other windows, 5: text speed (0 normal to 3 instant), 6: native mouse look (host/mouse_native.c),
7: the mouse's sensitivity in percent, 8: its up and down swapped (host/nn_hid.c),
18: motion controls from a pad's gyroscope (host/pad_sdl.c), 19 and 22: their horizontal
and vertical sensitivity in percent, 20 and 21: each turned around */
18 to 23: the Motion page (HOS_OPT_GYRO*: motion controls from a pad's gyroscope, host/pad_sdl.c;
the horizontal and vertical sensitivity in percent, each turned around, the deadzone) */
/* a submit with its queue */
void (*nvn_submit_q)(const uint64_t *handles, int n, uint64_t queue);
/* (hookshot) a fence of one queue: the value its own last submission signals (nvnQueueFenceSync) */
Expand Down
42 changes: 30 additions & 12 deletions gpu/vk/vk_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ enum MenuTab {
TAB_GRAPHICS = 0,
TAB_GAMEPLAY = 1,
TAB_CONTROLS = 2,
TAB_COUNT = 3
TAB_COUNT = 3,
TAB_MOTION = TAB_COUNT // (hookshot: not a tab of the strip, the Motion page that the Controls tab's Motion row
// opens: one past the strip's tabs, so a tab added before TAB_COUNT moves it along)
};

struct Row {
Expand Down Expand Up @@ -333,6 +335,12 @@ const char* hn_mic(int v, int variant) {
return missing ? "Not plugged in: Default stands in until it is back." : "This microphone, by its name. A change applies at once.";
}
const char* tx_rumble(int v) { return v ? tx_percent(v) : "Off"; }
// (hookshot) the motion's deadzone: the console's three zero-drift modes, the rate under which the pad counts as still
const char* tx_deadzone(int v) {
static const char* t[] = {"Low", "Standard", "High"};
return t[v < 0 ? 0 : v > 2 ? 2 : v];
}

const char* tx_stick_dead_zone(int v) {
static const char* t[] = {"Default (24%)", "5%", "10%", "15%", "20%", "30%"};
return (unsigned)v < 6 ? t[v] : t[0];
Expand Down Expand Up @@ -503,7 +511,7 @@ Row rows[] = {
"What the ocarina hears when the game's microphone option is on (playing an instrument, or humming).", hn_mic, false,
true},

// Controls (15 rows)
// Controls (11 rows; the Motion row opens the 6 TAB_MOTION rows)
{TAB_CONTROLS, "Controller in background", &opts.pad_background, 0, 1, 1, tx_onoff,
"Whether the controller plays the game while another window has the focus.", hn_background},
{TAB_CONTROLS, "Mouse camera", &opts.mouse_native, 0, 1, 1, tx_mousecam, "How the captured mouse turns the camera.",
Expand All @@ -522,20 +530,25 @@ Row rows[] = {
"The game's own dead zone still follows.", nullptr, false, true},
{TAB_CONTROLS, "Rumble strength", &opts.rumble, 0, 150, 25, tx_rumble,
"How strongly the controller rumbles, in percent of the game's rumble. Off turns it off.", nullptr, false, true},
{TAB_CONTROLS, "Motion controls", &opts.gyro, 0, 1, 1, tx_gyro,
"Aiming and looking with the controller's gyroscope where the game uses motion, as on the Switch.", hn_gyro},
{TAB_CONTROLS, "Motion sensitivity X", &opts.gyro_sens_x, 10, 600, 10, tx_percent,
{TAB_MOTION, "Motion controls", &opts.gyro, 0, 1, 1, tx_gyro,
"Aiming and looking with the controller's gyroscope where the game uses motion, as on the Switch.", hn_gyro, false, true},
{TAB_MOTION, "Motion sensitivity X", &opts.gyro_sens_x, 10, 600, 10, tx_percent,
"How far the aim moves left and right for a given turn of the controller. 100% is the console's own.", nullptr, false,
true},
{TAB_CONTROLS, "Motion sensitivity Y", &opts.gyro_sens_y, 10, 300, 10, tx_percent,
{TAB_MOTION, "Motion sensitivity Y", &opts.gyro_sens_y, 10, 300, 10, tx_percent,
"How far the aim moves up and down for a given tilt of the controller. 100% is the console's own.", nullptr, false,
true},
{TAB_CONTROLS, "Invert motion X", &opts.gyro_inv_x, 0, 1, 1, tx_onoff, "Turns the motion aim's left and right around.",
{TAB_MOTION, "Invert motion X", &opts.gyro_inv_x, 0, 1, 1, tx_onoff, "Turns the motion aim's left and right around.",
nullptr, false, true},
{TAB_CONTROLS, "Invert motion Y", &opts.gyro_inv_y, 0, 1, 1, tx_onoff, "Turns the motion aim's up and down around.",
{TAB_MOTION, "Invert motion Y", &opts.gyro_inv_y, 0, 1, 1, tx_onoff, "Turns the motion aim's up and down around.",
nullptr, false, true},
{TAB_MOTION, "Motion deadzone", &opts.gyro_deadzone, 0, 2, 1, tx_deadzone,
"How slow a turn counts as none, the console's three settings: Standard is its own. High steadies a pad that jitters "
"when held still; Low keeps the smallest movements.", nullptr, false, true},
{TAB_CONTROLS, "Layout preset", &opts.pad_layout, 0, 3, 1, tx_pad_layout,
"Which face button is which. Binding one yourself on the Controls page makes it Custom.", hn_pad_layout},
{TAB_CONTROLS, "Motion", nullptr, 0, 0, 0, nullptr, // (hookshot: opens the Motion page, the TAB_MOTION rows)
"Motion controls: aiming with the controller's gyroscope, its sensitivity and its inverts."},
{TAB_CONTROLS, "Controls", nullptr, 0, 0, 0, nullptr, // (hookshot: opens its page)
"Which gamepad button and which keys press each of the Switch's buttons."},
// (Restart, Quit and Cheats stay the table's last three rows: kRestartRow, kQuitRow and kCheatsRow count back from its end)
Expand Down Expand Up @@ -639,7 +652,8 @@ constexpr int kRows = sizeof rows / sizeof rows[0];
constexpr int kMenuWidth = menu_hit::kWidth; // (at a scale of 1: 720 lines)

int cur_tab = TAB_GRAPHICS;
int tab_selected[TAB_COUNT] = {0, 0, 0};
int tab_selected[TAB_MOTION + 1] = {}; // (the strip's tabs and the Motion page's)
bool is_motion_row(const Row& r) { return r.tab == TAB_CONTROLS && !r.value && !strcmp(r.name, "Motion"); }

// ---- the rows that take a restart: their values at the start (menu_init, the GPU's at menu_set_gpu_count) ----
namespace mr = menu_restart;
Expand Down Expand Up @@ -1343,7 +1357,7 @@ void paint_menu(HDC dc, uint32_t w, uint32_t h, int s) {
const int center_start = menu_hit::kTabSide * s;
const int tab_slot_w = menu_hit::tab_slot_w(s, (int)w);
for (int t = 0; t < TAB_COUNT; t++) {
const bool active = (t == cur_tab);
const bool active = t == (cur_tab == TAB_MOTION ? TAB_CONTROLS : cur_tab); // (the Motion page: under Controls)
int slot_x = center_start + t * tab_slot_w;
SIZE tsz{};
GetTextExtentPoint32A(dc, tab_titles[t], (int)strlen(tab_titles[t]), &tsz);
Expand Down Expand Up @@ -1448,7 +1462,8 @@ void paint_menu(HDC dc, uint32_t w, uint32_t h, int s) {
}
SelectObject(dc, body);
SetTextColor(dc, RGB(140, 150, 144));
const char* hint = "Arrows change Q/E or LB/RB: tabs Insert, F1 or Home closes"; // (fits 448 px at 16 px)
const char* hint = cur_tab == TAB_MOTION ? "Arrows change Esc goes back Insert, F1 or Home closes"
: "Arrows change Q/E or LB/RB: tabs Insert, F1 or Home closes"; // (fits 448 px at 16 px)
TextOutA(dc, 16 * s, help_top + 4 * s + help_px + 10 * s, hint, (int)strlen(hint));
if (cur_tab == TAB_GRAPHICS && restart_pending()) { // (the rows that take a restart, changed: measure_pending's room)
SelectObject(dc, help);
Expand Down Expand Up @@ -2193,10 +2208,12 @@ void menu_tick() {
}
}
}
if (press[5] && cur_tab == TAB_MOTION) cur_tab = TAB_CONTROLS, press[5] = false, changed = true; // (back)
if (press[5] && pending) pending = nullptr, changed = true; // (a Restart or Quit waiting for its second press: cancelled)
else if (press[5] && restart_ask()) page = 5, ask_sel = 0, changed = true; // (the restart question first)
else if (press[5]) open_now = false;
// (the tabs: LB and RB, Q and E, or Tab)
// (the tabs: LB and RB, Q and E, or Tab; from the Motion page, as from Controls)
if ((tab_left || tab_right) && cur_tab == TAB_MOTION) cur_tab = TAB_CONTROLS;
if (tab_left) cur_tab = (cur_tab + TAB_COUNT - 1) % TAB_COUNT, changed = true;
else if (tab_right) cur_tab = (cur_tab + 1) % TAB_COUNT, changed = true;
const int tab_count = tab_row_count(cur_tab);
Expand Down Expand Up @@ -2224,6 +2241,7 @@ void menu_tick() {
}
}
} else if (press[7] && &r == &rows[kCheatsRow]) page = 2, changed = true;
else if (press[7] && is_motion_row(r)) cur_tab = TAB_MOTION, tab_selected[TAB_MOTION] = 0, press[7] = false, changed = true;
else if (press[7] && !r.value && can_bind()) page = 1, csel = 0, ccol = 0, changed = true;
if ((press[3] || press[4] || press[7]) && r.value) { // (Enter, or the bottom face button, as Right)
if (press[7]) press[4] = true;
Expand Down
1 change: 1 addition & 0 deletions gpu/vk/vk_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct Options {
int gyro_sens_y = 100; // the motion aim's vertical sensitivity in percent
int gyro_inv_x = 0; // the motion aim's horizontal turned around
int gyro_inv_y = 0; // the motion aim's vertical turned around
int gyro_deadzone = 1; // the motion's deadzone: 0 tight, 1 standard (the console's default), 2 loose
int robust = 0; // bounds-checked buffer access: 0 Auto (on), 1 Off, 2 On (gpu/vk/vk_main.cpp; RX_VK_ROBUST)
int preset = 0; // quality preset: 0 Custom, 1 Minimum (4GB), 2 Low (6GB), 3 Balanced (8GB), 4 High (12GB), 5 Ultra (16GB+)
int vram_mb = 0; // dynamic texture cache budget limit in MB
Expand Down
2 changes: 1 addition & 1 deletion gpu/vk/vk_replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3799,7 +3799,7 @@ void fill_replay_table(MkwVkRenderer& t) {
if (id == HOS_OPT_CHEAT_ACTION) return menu_take_cheat_action();
if (id == HOS_OPT_CHEAT_CAMERA) return menu_free_camera();
return id == 0 ? opts.realtime : id == 1 ? menu_is_open() : id == 2 ? resolution_auto() && !dlss_full_scale() : id == 3 ? (dlss_full_scale() ? 10000 : resolution_scale()) : id == 4 ? opts.pad_background : id == 5 ? opts.text_speed : id == 6 ? opts.mouse_native :
id == 7 ? opts.mouse_sens : id == 8 ? opts.mouse_invert : id == 9 ? opts.rumble : id == 16 ? opts.invert_cam_x : id == 17 ? opts.invert_cam_y : id == HOS_OPT_GYRO ? opts.gyro : id == HOS_OPT_GYRO_SENS_X ? opts.gyro_sens_x : id == HOS_OPT_GYRO_SENS_Y ? opts.gyro_sens_y : id == HOS_OPT_GYRO_INV_X ? opts.gyro_inv_x : id == HOS_OPT_GYRO_INV_Y ? opts.gyro_inv_y :
id == 7 ? opts.mouse_sens : id == 8 ? opts.mouse_invert : id == 9 ? opts.rumble : id == 16 ? opts.invert_cam_x : id == 17 ? opts.invert_cam_y : id == HOS_OPT_GYRO ? opts.gyro : id == HOS_OPT_GYRO_SENS_X ? opts.gyro_sens_x : id == HOS_OPT_GYRO_SENS_Y ? opts.gyro_sens_y : id == HOS_OPT_GYRO_INV_X ? opts.gyro_inv_x : id == HOS_OPT_GYRO_INV_Y ? opts.gyro_inv_y : id == HOS_OPT_GYRO_DEADZONE ? opts.gyro_deadzone :
id == HOS_OPT_DLSS_JITTER_W || id == HOS_OPT_DLSS_JITTER_H ? (int)dlss_jitter_size(id - HOS_OPT_DLSS_JITTER_W) :
id == HOS_OPT_DLSS_JITTER_PHASES ? (int)dlss_jitter_size(2) : 0;
};
Expand Down
Loading
Loading