mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-18 20:15:56 +00:00
Merge task/pr1136: opt-in gameplay tweaks for keyboard and mouse, the wheel turns and moves an Ultrahand object, switches weapons, steps the D-pad strips and zooms the map smoothly (RxEmam)
Pull request #1136 with three fixes: the Russian and Portuguese rows name Ultrahand as the catalogs do, smooth map zoom takes the wheel only on the map menu_cursor.c finds, and the weapon bar opens only where the camera hooks saw free roam, a lock-on or a mount. Off by default (gameplay_tweaks_enabled = 0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
df3e90dc4c
15 files changed
+799
-3
No files matched your search
@@ -213,6 +213,18 @@ With `map_click = 1` (off by default, so each key presses one controller button
|
||||
|
||||
With `dialogue_click = 1` (off by default, so each key presses one controller button as everywhere else), on game 1.4.3, while a dialogue box is open (the layout `MessageDialog_00`: a character's lines and the game's own messages), the left mouse button presses B and the right one A, instead of the buttons they are bound to. B continues the text as A does and also shows the rest of a line that is still scrolling in; the left button's default, Y, would open the dialogue log there, and the log stays in the way until B closes it. Dialogue choices are a menu with the focus box, so the pointer above takes their clicks and a left click is A on the choice under it: clicking through a conversation fast does not pick the choice the focus starts on. A press is the dialogue's button or the binding from the moment the button goes down until it is released: the click that closes the last box does not become an attack while it is still held, and a button held when the box opens does not skip its first line. Between two lines of a conversation the game closes the box and opens it again, so both buttons stay B and A for 500 ms after the box was last open (`DIALOGUE_GAP_MS`); the first clicks after a conversation fall in that time too, as they do for a player who taps the button through the last line. `TOTK_MENU_CURSOR_LOG=1` logs how long each such gap was. The dialogue window has no focus box of its own: the scan of `eui::ScreenMgr`'s open screens (every 100 ms) finds its screen, and from then on that screen's state is read at every pad read (`dialogue_shown` in `runtime/menu_cursor.c`), so the first click after a box opens is already the dialogue's. `dialogue_click = 1` (`TOTK_DIALOGUE_CLICK=1`, live; the *Clicks in dialogue* row of the Controls tab) turns it on and `0`, the default, leaves both buttons on their bindings; the setting does not depend on `menu_cursor`. The log names the first box it sees (`menu_cursor: a dialogue box is open ...`).
|
||||
|
||||
## Gameplay tweaks
|
||||
|
||||
With `gameplay_tweaks_enabled = 1` (`TOTK_GAMEPLAY_TWEAKS_ENABLED=1`, live; off by default in `totk.ini`), the mouse wheel and keyboard can drive common gameplay interactions directly:
|
||||
|
||||
- **Ultrahand object rotation**: turning the mouse wheel while Ultrahand holds an object rotates it directly without holding R or pressing the D-pad (`gameplay_ultrahand_rotate = 1`, sensitivity `gameplay_rotation_sensitivity = 1`). Holding C while scrolling rotates around the alternate axis (`gameplay_ultrahand_c_axis = 1`).
|
||||
- **Ultrahand distance**: holding the right mouse button while scrolling pushes or pulls the held object closer or farther (`gameplay_ultrahand_distance = 1`, sensitivity `gameplay_distance_sensitivity = 1`).
|
||||
- **Free-roam weapon switching**: scrolling the mouse wheel in free roam steps through equipped weapons (`gameplay_weapon_wheel = 1`, sensitivity `gameplay_weapon_sensitivity = 1`). Press E to confirm the chosen weapon; right click or pressing B cancels.
|
||||
- **Quick-selection menus**: scrolling the mouse wheel browses items while a quick-selection menu (weapons, bows, shields, materials) is open (`gameplay_item_wheel = 1`, sensitivity `gameplay_item_sensitivity = 1`). A and D keys step left and right through the strip (`gameplay_item_ad = 1`).
|
||||
- **Smooth map zoom**: the mouse wheel performs continuous inertial zooming on the Purah Pad map (`gameplay_map_zoom = 1`, sensitivity `gameplay_map_zoom_sensitivity = 1`).
|
||||
|
||||
All sub-toggles default to 1 and sensitivities to 1 (range 0.25 to 4.0), so enabling `gameplay_tweaks_enabled` activates the full suite immediately while allowing individual features to be toggled or tuned.
|
||||
|
||||
## Nintendo Switch 2 controllers
|
||||
|
||||
Windows does not present the Switch 2 Pro Controller as a gamepad SDL can open (the log says `input: no gamepad`), so it needs a bridge program that wakes it and creates a virtual gamepad. The DS4Windows fork by hbashton ([github.com/hbashton/DS4Windows](https://github.com/hbashton/DS4Windows), tested with release VIIPERRC4.5.1, a pre-release) with the output set to an emulated DualSense gives buttons, rumble, gyro and accelerometer, and reads the sticks through the controller's calibration (they rest at 0 to 2%). The game reads its virtual DualSense directly; the log then shows `input: gamepad "DualSense Wireless Controller" (rumble, gyro and accelerometer, ...)` and `input: motion sensors on`. Its release notes also list Joy-Con 2 support, which is untested here.
|
||||
|
||||
+2
-1
@@ -22,7 +22,7 @@
|
||||
#include "nvn_api.h"
|
||||
#include "platform/platform.h"
|
||||
#include "vk.h"
|
||||
#include "platform/platform.h"
|
||||
#include "gameplay_tweaks.h"
|
||||
|
||||
#define SYM_INIT_START "_ZN2nn4init5StartEmmPFvvES2_S2_"
|
||||
// main: return addresses of nnMain's SetFocusHandlingMode call (1.1.0 and 1.2.1 from this port's analysis of main;
|
||||
@@ -347,6 +347,7 @@ void rt_boot(void) {
|
||||
rt_patches_init();
|
||||
mods_exefs_switch(); // after the patch sets' settings: an enabled mod's ExeFS patches on
|
||||
frame_step_init();
|
||||
gameplay_tweaks_init();
|
||||
res_init();
|
||||
cheats_init(); // after the patch sets: a cheat's set follows its setting
|
||||
cb_addr[0] = hostfn_register("<rtld loader_ready>", cb_loader_ready);
|
||||
|
||||
+21
-1
@@ -44,7 +44,12 @@ static const char *const known[] = {
|
||||
"DUMP_LOG", "DYNAMIC_RES", "DYN_DELTA", "EXEFS", "FEEDBACK", "FIXED_RES_PATCH", "FIX_C0", "FIX_ZERO", "FLIGHT", "FLIGHT_AT", "FLIGHT_DIR", "FLIGHT_FRAMES",
|
||||
"FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FLUSH_SPAN", "FOV", "FOV_PATCH", "FPS60", "FPS_LIMIT", "FRAME_QUEUE",
|
||||
"FREEZE_IDLE", "FREE_CORES",
|
||||
"FULLSCREEN", "FXAA", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "GRASS_RANGE", "HDR", "HDR_GAME_NITS", "HDR_HUE",
|
||||
"FULLSCREEN", "FXAA",
|
||||
"GAMEPLAY_DISTANCE_SENSITIVITY", "GAMEPLAY_ITEM_AD", "GAMEPLAY_ITEM_SENSITIVITY", "GAMEPLAY_ITEM_WHEEL",
|
||||
"GAMEPLAY_MAP_ZOOM", "GAMEPLAY_MAP_ZOOM_SENSITIVITY", "GAMEPLAY_ROTATION_SENSITIVITY", "GAMEPLAY_TWEAKS_ENABLED",
|
||||
"GAMEPLAY_ULTRAHAND_C_AXIS", "GAMEPLAY_ULTRAHAND_DISTANCE", "GAMEPLAY_ULTRAHAND_ROTATE", "GAMEPLAY_WEAPON_SENSITIVITY",
|
||||
"GAMEPLAY_WEAPON_WHEEL",
|
||||
"GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "GRASS_RANGE", "HDR", "HDR_GAME_NITS", "HDR_HUE",
|
||||
"HDR_PEAK_NITS", "HDR_UI_NITS", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "KSPIN_US", "LANG", "LIB_PREBUILD",
|
||||
"LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MAP_CLICK", "MEMORY", "MENU_LANG", "MENU_TEST", "MENU_FONT_FONTCONFIG",
|
||||
"MEM_RESERVE_MIB", "MENU_CURSOR", "MENU_CURSOR_LOG", "MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MODS_REBUILD", "MOTION", "MOUSE_AIM_SCALE", "MOUSE_MODE", "MOUSE_DIRECT_PATCH", "MOUSE_SENS", "MOVIE_ASPECT", "MOVIE_HOST", "MOVIE_PACE",
|
||||
@@ -107,6 +112,13 @@ static const struct { const char *key, *section; } sections[] = {
|
||||
{"TRACE", "diagnostics"}, {"FLIGHT", "diagnostics"}, {"PASS_CRUMBS", "diagnostics"}, {"FLIGHT_SPIKE_MS", "diagnostics"},
|
||||
{"WB_FENCE_LIMIT", "diagnostics"}, {"WB_MERGE", "diagnostics"}, {"WB_EXACT", "diagnostics"},
|
||||
{"MV_SURVEY", "diagnostics"},
|
||||
{"GAMEPLAY_TWEAKS_ENABLED", "gameplay tweaks"}, {"GAMEPLAY_ULTRAHAND_ROTATE", "gameplay tweaks"},
|
||||
{"GAMEPLAY_ULTRAHAND_C_AXIS", "gameplay tweaks"}, {"GAMEPLAY_ULTRAHAND_DISTANCE", "gameplay tweaks"},
|
||||
{"GAMEPLAY_ITEM_WHEEL", "gameplay tweaks"}, {"GAMEPLAY_ITEM_AD", "gameplay tweaks"},
|
||||
{"GAMEPLAY_MAP_ZOOM", "gameplay tweaks"}, {"GAMEPLAY_MAP_ZOOM_SENSITIVITY", "gameplay tweaks"},
|
||||
{"GAMEPLAY_ROTATION_SENSITIVITY", "gameplay tweaks"}, {"GAMEPLAY_DISTANCE_SENSITIVITY", "gameplay tweaks"},
|
||||
{"GAMEPLAY_ITEM_SENSITIVITY", "gameplay tweaks"},
|
||||
{"GAMEPLAY_WEAPON_WHEEL", "gameplay tweaks"}, {"GAMEPLAY_WEAPON_SENSITIVITY", "gameplay tweaks"},
|
||||
};
|
||||
|
||||
// The settings the menu shows: the value in effect when the key is unset, and what the key accepts. The only place a
|
||||
@@ -160,6 +172,14 @@ static const CfgMeta metas[] = {
|
||||
{"DIALOGUE_CLICK", "0", "0|1", LIVE}, // menu_cursor.c: in a dialogue box left click is B, right click A
|
||||
{"POINTER_IMAGE", "0", "0|1", LIVE}, // input_win.c / input_sdl.c: the game window's own pointer (cursor_art.c)
|
||||
{"WALK_KEY", "none", NULL, LIVE}, {"WALK_SCALE", "0.51", "0.2..0.9", LIVE},
|
||||
// Gameplay Tweaks
|
||||
{"GAMEPLAY_TWEAKS_ENABLED", "0", "0|1", LIVE},
|
||||
{"GAMEPLAY_ULTRAHAND_ROTATE", "1", "0|1", LIVE}, {"GAMEPLAY_ULTRAHAND_C_AXIS", "1", "0|1", LIVE},
|
||||
{"GAMEPLAY_ULTRAHAND_DISTANCE", "1", "0|1", LIVE}, {"GAMEPLAY_ITEM_WHEEL", "1", "0|1", LIVE},
|
||||
{"GAMEPLAY_ITEM_AD", "1", "0|1", LIVE}, {"GAMEPLAY_MAP_ZOOM", "1", "0|1", LIVE},
|
||||
{"GAMEPLAY_MAP_ZOOM_SENSITIVITY", "1", "0.25..4", LIVE}, {"GAMEPLAY_ROTATION_SENSITIVITY", "1", "0.25..4", LIVE},
|
||||
{"GAMEPLAY_DISTANCE_SENSITIVITY", "1", "0.25..4", LIVE}, {"GAMEPLAY_ITEM_SENSITIVITY", "1", "0.25..4", LIVE},
|
||||
{"GAMEPLAY_WEAPON_WHEEL", "1", "0|1", LIVE}, {"GAMEPLAY_WEAPON_SENSITIVITY", "1", "0.25..4", LIVE},
|
||||
{"MENU_LANG", "", "en|ru|pt-BR|zh-Hans", LIVE},
|
||||
// plat_font_path on Linux: 1 asks fontconfig which file draws the language, 0 keeps the fixed distribution
|
||||
// paths. A rebuild of the atlas reads it, so a change shows on the next window size or language switch.
|
||||
|
||||
@@ -0,0 +1,474 @@
|
||||
// Mouse wheel and keyboard gameplay tweaks with independent live settings.
|
||||
// The game's native R + D-pad object rotation and D-pad distance controls remain authoritative.
|
||||
#include "gameplay_tweaks.h"
|
||||
#include "cfg.h"
|
||||
#include "host.h"
|
||||
#include "input.h"
|
||||
#include "input_map.h"
|
||||
#include "input_wsys.h"
|
||||
#include "platform/platform.h"
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BIT(x) (1ull << (x))
|
||||
#define HOLD_FRAMES 3
|
||||
#define GAP_FRAMES 1
|
||||
#define MAX_QUEUED 16
|
||||
enum { NONE, ROTATE, DISTANCE, ITEMS, MAP_ZOOM, WEAPONS };
|
||||
enum { W_IDLE = 0, W_PRIME, W_HOLD, W_GAP, W_WAIT };
|
||||
#define WEAPON_PRIME_MIN_NS 75000000ull
|
||||
#define WEAPON_PRIME_MAX_NS 135000000ull
|
||||
#define WEAPON_HOLD_NS 42000000ull
|
||||
#define WEAPON_GAP_NS 36000000ull
|
||||
|
||||
static PlatMutex lock = PLAT_MUTEX_INIT;
|
||||
static unsigned seen = UINT_MAX;
|
||||
static struct {
|
||||
int available, rotate, c_axis, distance, wheel, keys, map_zoom, weapon_wheel;
|
||||
double rotation_speed, distance_speed, item_speed, map_zoom_speed, weapon_speed;
|
||||
} options;
|
||||
static struct {
|
||||
int kind, axis, direction, queued, hold, gap, primed, valid;
|
||||
double fraction;
|
||||
uint64_t frame, buttons;
|
||||
int32_t rx;
|
||||
} pulse;
|
||||
static struct {
|
||||
int active, phase, direction, scroll_dir, queued, polls_in_phase;
|
||||
int confirm_pending;
|
||||
double fraction;
|
||||
uint64_t phase_until_ns, prime_start_ns, last_frame;
|
||||
int32_t rx;
|
||||
} weapon;
|
||||
static double map_zoom_velocity;
|
||||
static int held_a, held_d;
|
||||
static int consumed_c, consumed_right;
|
||||
static int was_e_down, consumed_e;
|
||||
static uint64_t physical_buttons;
|
||||
|
||||
static void clear_weapon_locked(void) { memset(&weapon, 0, sizeof weapon); }
|
||||
static void clear_locked(void) { memset(&pulse, 0, sizeof pulse); clear_weapon_locked(); map_zoom_velocity = 0; }
|
||||
|
||||
static void refresh_locked(void) {
|
||||
unsigned version = cfg_version();
|
||||
if (seen == version) return;
|
||||
options.available = cfg_bool("TOTK_GAMEPLAY_TWEAKS_ENABLED");
|
||||
options.rotate = cfg_bool("TOTK_GAMEPLAY_ULTRAHAND_ROTATE");
|
||||
options.c_axis = cfg_bool("TOTK_GAMEPLAY_ULTRAHAND_C_AXIS");
|
||||
options.distance = cfg_bool("TOTK_GAMEPLAY_ULTRAHAND_DISTANCE");
|
||||
options.wheel = cfg_bool("TOTK_GAMEPLAY_ITEM_WHEEL");
|
||||
options.keys = cfg_bool("TOTK_GAMEPLAY_ITEM_AD");
|
||||
options.map_zoom = cfg_bool("TOTK_GAMEPLAY_MAP_ZOOM");
|
||||
options.weapon_wheel = cfg_bool("TOTK_GAMEPLAY_WEAPON_WHEEL");
|
||||
options.rotation_speed = cfg_double("TOTK_GAMEPLAY_ROTATION_SENSITIVITY");
|
||||
options.distance_speed = cfg_double("TOTK_GAMEPLAY_DISTANCE_SENSITIVITY");
|
||||
options.item_speed = cfg_double("TOTK_GAMEPLAY_ITEM_SENSITIVITY");
|
||||
options.map_zoom_speed = cfg_double("TOTK_GAMEPLAY_MAP_ZOOM_SENSITIVITY");
|
||||
options.weapon_speed = cfg_double("TOTK_GAMEPLAY_WEAPON_SENSITIVITY");
|
||||
if (!isfinite(options.rotation_speed) || options.rotation_speed < .25 || options.rotation_speed > 4) options.rotation_speed = 1;
|
||||
if (!isfinite(options.distance_speed) || options.distance_speed < .25 || options.distance_speed > 4) options.distance_speed = 1;
|
||||
if (!isfinite(options.item_speed) || options.item_speed < .25 || options.item_speed > 4) options.item_speed = 1;
|
||||
if (!isfinite(options.map_zoom_speed) || options.map_zoom_speed < .25 || options.map_zoom_speed > 4) options.map_zoom_speed = 1;
|
||||
if (!isfinite(options.weapon_speed) || options.weapon_speed < .25 || options.weapon_speed > 4) options.weapon_speed = 1;
|
||||
seen = version;
|
||||
clear_locked();
|
||||
}
|
||||
|
||||
static int item_menu(uint64_t buttons) {
|
||||
if (buttons & BIT(B_L)) return 0;
|
||||
const uint64_t held = BIT(B_LEFT) | BIT(B_UP) | BIT(B_RIGHT) | BIT(B_DOWN);
|
||||
return input_camera_context() == INPUT_CAM_MENU_WHEEL || (buttons & held) != 0;
|
||||
}
|
||||
|
||||
static int object_context(uint64_t buttons) {
|
||||
const uint64_t menus = BIT(B_L) | BIT(B_LEFT) | BIT(B_UP) | BIT(B_RIGHT) | BIT(B_DOWN) |
|
||||
BIT(B_B) | BIT(B_PLUS) | BIT(B_MINUS);
|
||||
return input_camera_context() == INPUT_CAM_ULTRAHAND_OBJECT && !(buttons & menus);
|
||||
}
|
||||
|
||||
static int map_zoom_allowed(uint64_t buttons) {
|
||||
if (!options.map_zoom) return 0;
|
||||
if (object_context(buttons) || item_menu(buttons)) return 0;
|
||||
if (buttons & (BIT(B_L) | BIT(B_ZL) | BIT(B_ZR) | BIT(B_R))) return 0;
|
||||
int ctx = input_camera_context();
|
||||
if (ctx == INPUT_CAM_AIM || ctx == INPUT_CAM_SCOPE ||
|
||||
ctx == INPUT_CAM_ULTRAHAND_OBJECT || ctx == INPUT_CAM_LOCK_ON) {
|
||||
return 0;
|
||||
}
|
||||
// Only the map menu_cursor.c finds: with menu_cursor = 0 (or on 1.2.1) the map is not read, and a fallback to
|
||||
// "allowed" would push the right stick's Y in free roam, where it tilts the camera.
|
||||
return menu_cursor_map();
|
||||
}
|
||||
|
||||
static int weapon_wheel_allowed(uint64_t buttons, int right_down, int already_active) {
|
||||
if (!options.available || !options.weapon_wheel) return 0;
|
||||
if (right_down) return 0;
|
||||
if (!ikb_captured() || menu_cursor_map() || menu_cursor_pointer()) return 0;
|
||||
const uint64_t forbidden = BIT(B_L) | BIT(B_R) | BIT(B_ZL) | BIT(B_ZR) |
|
||||
BIT(B_LEFT) | BIT(B_UP) | BIT(B_RIGHT) | BIT(B_DOWN) |
|
||||
BIT(B_PLUS) | BIT(B_MINUS);
|
||||
if (buttons & forbidden) return 0;
|
||||
|
||||
if (!already_active) {
|
||||
if (menu_cursor_shortcut() == 1 || menu_cursor_strip() || menu_cursor_camera() || menu_cursor_menu())
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ctx = input_camera_context();
|
||||
if (!already_active) {
|
||||
// Opening needs a camera the mouse_direct hooks saw this moment: an unclassified one is also a paused menu,
|
||||
// 1.2.1's menus or any screen menu_cursor.c does not read, where D-pad right and the right stick would move
|
||||
// the menu instead.
|
||||
if (ctx != INPUT_CAM_FREE_ROAM && ctx != INPUT_CAM_LOCK_ON && ctx != INPUT_CAM_VEHICLE)
|
||||
return 0;
|
||||
} else {
|
||||
if (ctx != INPUT_CAM_UNCLASSIFIED && ctx != INPUT_CAM_MENU_WHEEL &&
|
||||
ctx != INPUT_CAM_FREE_ROAM && ctx != INPUT_CAM_LOCK_ON && ctx != INPUT_CAM_VEHICLE)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int gameplay_tweaks_available(void) {
|
||||
plat_mutex_lock(&lock);
|
||||
refresh_locked();
|
||||
int available = options.available;
|
||||
plat_mutex_unlock(&lock);
|
||||
return available;
|
||||
}
|
||||
|
||||
int gameplay_tweaks_capture_needed(void) {
|
||||
plat_mutex_lock(&lock);
|
||||
refresh_locked();
|
||||
int active = options.available && (options.rotate || options.distance || options.wheel ||
|
||||
options.keys || options.map_zoom || options.weapon_wheel);
|
||||
plat_mutex_unlock(&lock);
|
||||
return active;
|
||||
}
|
||||
|
||||
int gameplay_tweaks_map_zoom(void) {
|
||||
plat_mutex_lock(&lock);
|
||||
refresh_locked();
|
||||
int active = options.available && options.map_zoom;
|
||||
plat_mutex_unlock(&lock);
|
||||
return active;
|
||||
}
|
||||
|
||||
int gameplay_tweaks_strip_wheel(uint64_t buttons) {
|
||||
plat_mutex_lock(&lock);
|
||||
refresh_locked();
|
||||
int active = options.available && (weapon.active || (options.wheel && item_menu(buttons)));
|
||||
plat_mutex_unlock(&lock);
|
||||
return active;
|
||||
}
|
||||
|
||||
void gameplay_tweaks_init(void) {
|
||||
gameplay_tweaks_available();
|
||||
}
|
||||
|
||||
void gameplay_tweaks_reset(void) {
|
||||
plat_mutex_lock(&lock);
|
||||
clear_locked();
|
||||
held_a = held_d = 0;
|
||||
physical_buttons = 0;
|
||||
was_e_down = consumed_e = 0;
|
||||
plat_mutex_unlock(&lock);
|
||||
}
|
||||
|
||||
void gameplay_tweaks_wheel(double delta, int c_down, int right_down) {
|
||||
if (!isfinite(delta) || delta == 0) return;
|
||||
if (delta > MAX_QUEUED) delta = MAX_QUEUED;
|
||||
if (delta < -MAX_QUEUED) delta = -MAX_QUEUED;
|
||||
plat_mutex_lock(&lock);
|
||||
refresh_locked();
|
||||
if (!options.available) {
|
||||
clear_locked();
|
||||
plat_mutex_unlock(&lock);
|
||||
return;
|
||||
}
|
||||
int kind = NONE, axis = 0;
|
||||
double sensitivity = 1;
|
||||
if (object_context(physical_buttons)) {
|
||||
if (right_down && options.distance) {
|
||||
kind = DISTANCE;
|
||||
sensitivity = options.distance_speed;
|
||||
} else if (options.rotate) {
|
||||
kind = ROTATE;
|
||||
axis = options.c_axis && c_down;
|
||||
sensitivity = options.rotation_speed;
|
||||
}
|
||||
} else if ((physical_buttons & (BIT(B_LEFT) | BIT(B_UP) | BIT(B_RIGHT) | BIT(B_DOWN))) &&
|
||||
options.wheel && item_menu(physical_buttons)) {
|
||||
kind = ITEMS;
|
||||
sensitivity = options.item_speed;
|
||||
} else if (map_zoom_allowed(physical_buttons)) {
|
||||
kind = MAP_ZOOM;
|
||||
sensitivity = options.map_zoom_speed;
|
||||
} else if (weapon_wheel_allowed(physical_buttons, right_down, weapon.active)) {
|
||||
kind = WEAPONS;
|
||||
}
|
||||
if (!kind) {
|
||||
clear_locked();
|
||||
plat_mutex_unlock(&lock);
|
||||
return;
|
||||
}
|
||||
if (kind == MAP_ZOOM) {
|
||||
if (weapon.active) clear_weapon_locked();
|
||||
map_zoom_velocity -= delta * sensitivity * 16000.0;
|
||||
if (map_zoom_velocity > 65536.0) map_zoom_velocity = 65536.0;
|
||||
if (map_zoom_velocity < -65536.0) map_zoom_velocity = -65536.0;
|
||||
plat_mutex_unlock(&lock);
|
||||
return;
|
||||
}
|
||||
if (kind == WEAPONS) {
|
||||
uint64_t now = plat_now_ns();
|
||||
int new_dir = delta > 0 ? 1 : -1;
|
||||
if (weapon.scroll_dir != 0 && new_dir != weapon.scroll_dir) {
|
||||
weapon.fraction = 0;
|
||||
weapon.queued = 0;
|
||||
if (weapon.active && weapon.phase == W_HOLD) {
|
||||
weapon.phase = W_GAP;
|
||||
weapon.rx = 0;
|
||||
weapon.polls_in_phase = 0;
|
||||
weapon.phase_until_ns = now + WEAPON_GAP_NS;
|
||||
}
|
||||
}
|
||||
weapon.scroll_dir = new_dir;
|
||||
weapon.fraction += delta * options.weapon_speed;
|
||||
int steps = (int)trunc(weapon.fraction);
|
||||
if (steps != 0) {
|
||||
weapon.confirm_pending = 0;
|
||||
weapon.fraction -= steps;
|
||||
weapon.direction = steps > 0 ? 1 : -1;
|
||||
weapon.queued += (steps > 0 ? steps : -steps);
|
||||
if (weapon.queued > MAX_QUEUED) weapon.queued = MAX_QUEUED;
|
||||
if (!weapon.active) {
|
||||
weapon.active = 1;
|
||||
weapon.phase = W_PRIME;
|
||||
weapon.polls_in_phase = 0;
|
||||
weapon.prime_start_ns = now;
|
||||
weapon.phase_until_ns = now + WEAPON_PRIME_MAX_NS;
|
||||
weapon.rx = 0;
|
||||
} else if (weapon.phase == W_WAIT) {
|
||||
weapon.phase = W_HOLD;
|
||||
weapon.polls_in_phase = 0;
|
||||
weapon.phase_until_ns = now + WEAPON_HOLD_NS;
|
||||
weapon.rx = 32767 * weapon.direction;
|
||||
if (weapon.queued > 0) weapon.queued--;
|
||||
}
|
||||
}
|
||||
plat_mutex_unlock(&lock);
|
||||
return;
|
||||
}
|
||||
if (weapon.active) clear_weapon_locked();
|
||||
if (kind != pulse.kind || axis != pulse.axis ||
|
||||
(delta > 0 && pulse.direction < 0) || (delta < 0 && pulse.direction > 0)) {
|
||||
clear_locked();
|
||||
}
|
||||
pulse.kind = kind;
|
||||
pulse.axis = axis;
|
||||
pulse.fraction += delta * sensitivity;
|
||||
int steps = (int)trunc(pulse.fraction);
|
||||
if (steps) {
|
||||
pulse.fraction -= steps;
|
||||
pulse.direction = steps > 0 ? 1 : -1;
|
||||
if (!pulse.queued && !pulse.hold && !pulse.gap) pulse.valid = 0;
|
||||
pulse.queued += steps > 0 ? steps : -steps;
|
||||
if (pulse.queued > MAX_QUEUED) pulse.queued = MAX_QUEUED;
|
||||
}
|
||||
plat_mutex_unlock(&lock);
|
||||
}
|
||||
|
||||
void gameplay_tweaks_prepare_keys(uint8_t *down, uint64_t pad_buttons) {
|
||||
plat_mutex_lock(&lock);
|
||||
refresh_locked();
|
||||
held_a = held_d = 0;
|
||||
int c = down[KEY_C], right = down[KEY_MOUSE_R];
|
||||
int e = down[KEY_E];
|
||||
int e_pressed = e && !was_e_down;
|
||||
was_e_down = e;
|
||||
if (!e) consumed_e = 0;
|
||||
if (!c) consumed_c = 0;
|
||||
if (!right) consumed_right = 0;
|
||||
if (options.available) {
|
||||
if (input_camera_context() == INPUT_CAM_ULTRAHAND_OBJECT) {
|
||||
if (options.rotate && options.c_axis && !(options.distance && right) && c) consumed_c = 1;
|
||||
if (options.distance && right) consumed_right = 1;
|
||||
if (pulse.kind == ROTATE && pulse.axis != (options.c_axis && c)) clear_locked();
|
||||
}
|
||||
if (weapon.active && e_pressed) {
|
||||
consumed_e = 1;
|
||||
weapon.confirm_pending = 1;
|
||||
}
|
||||
if (consumed_e) down[KEY_E] = 0;
|
||||
if (consumed_c) down[KEY_C] = 0;
|
||||
if (consumed_right) down[KEY_MOUSE_R] = 0;
|
||||
uint64_t buttons = pad_buttons | input_map_buttons(down);
|
||||
if (options.keys && item_menu(buttons) && !weapon.active) {
|
||||
held_a = down[KEY_A];
|
||||
held_d = down[KEY_D];
|
||||
down[KEY_A] = down[KEY_D] = 0;
|
||||
}
|
||||
} else {
|
||||
consumed_c = consumed_right = consumed_e = 0;
|
||||
}
|
||||
plat_mutex_unlock(&lock);
|
||||
}
|
||||
|
||||
static void sample_locked(uint64_t frame) {
|
||||
if (pulse.valid && pulse.frame == frame) return;
|
||||
pulse.buttons = 0;
|
||||
pulse.rx = 0;
|
||||
if (pulse.queued || pulse.hold || pulse.gap) {
|
||||
if (pulse.kind == ROTATE) pulse.buttons = BIT(B_R);
|
||||
if (pulse.kind == ROTATE && !pulse.primed) pulse.primed = 1;
|
||||
else if (pulse.gap) pulse.gap--;
|
||||
else {
|
||||
if (!pulse.hold && pulse.queued) {
|
||||
pulse.queued--;
|
||||
pulse.hold = HOLD_FRAMES;
|
||||
}
|
||||
if (pulse.hold) {
|
||||
if (pulse.kind == ROTATE)
|
||||
pulse.buttons |= pulse.axis ? (pulse.direction > 0 ? BIT(B_DOWN) : BIT(B_UP)) :
|
||||
(pulse.direction > 0 ? BIT(B_RIGHT) : BIT(B_LEFT));
|
||||
else if (pulse.kind == DISTANCE)
|
||||
pulse.buttons = pulse.direction < 0 ? BIT(B_UP) : BIT(B_DOWN);
|
||||
else pulse.rx = 32767 * pulse.direction;
|
||||
if (!--pulse.hold) pulse.gap = GAP_FRAMES;
|
||||
}
|
||||
}
|
||||
} else pulse.primed = 0;
|
||||
pulse.valid = 1;
|
||||
pulse.frame = frame;
|
||||
}
|
||||
|
||||
void gameplay_tweaks_apply(uint64_t frame, int active, uint64_t *buttons,
|
||||
int32_t *lx, int32_t *ly, int32_t *rx, int32_t *ry) {
|
||||
(void)lx;
|
||||
(void)ly;
|
||||
plat_mutex_lock(&lock);
|
||||
refresh_locked();
|
||||
physical_buttons = *buttons;
|
||||
if (!active || !options.available) {
|
||||
clear_locked();
|
||||
held_a = held_d = 0;
|
||||
plat_mutex_unlock(&lock);
|
||||
return;
|
||||
}
|
||||
int right = ikb_down(KEY_MOUSE_R);
|
||||
|
||||
if (weapon.active) {
|
||||
if (!weapon_wheel_allowed(physical_buttons, right, 1) || (physical_buttons & BIT(B_B))) {
|
||||
clear_weapon_locked();
|
||||
}
|
||||
}
|
||||
|
||||
if (weapon.active) {
|
||||
uint64_t now = plat_now_ns();
|
||||
if (weapon.last_frame != frame) {
|
||||
weapon.last_frame = frame;
|
||||
weapon.polls_in_phase++;
|
||||
}
|
||||
|
||||
switch (weapon.phase) {
|
||||
case W_PRIME: {
|
||||
uint64_t elapsed = now - weapon.prime_start_ns;
|
||||
int shortcut = (menu_cursor_shortcut() == 1);
|
||||
int ready = (elapsed >= WEAPON_PRIME_MIN_NS && weapon.polls_in_phase >= 3 && shortcut) ||
|
||||
(elapsed >= WEAPON_PRIME_MAX_NS && weapon.polls_in_phase >= 4);
|
||||
if (ready) {
|
||||
if (weapon.queued > 0) {
|
||||
weapon.phase = W_HOLD;
|
||||
weapon.polls_in_phase = 0;
|
||||
weapon.phase_until_ns = now + WEAPON_HOLD_NS;
|
||||
weapon.rx = 32767 * weapon.direction;
|
||||
weapon.queued--;
|
||||
} else if (weapon.confirm_pending) {
|
||||
clear_weapon_locked();
|
||||
} else {
|
||||
weapon.phase = W_WAIT;
|
||||
weapon.polls_in_phase = 0;
|
||||
weapon.rx = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case W_HOLD: {
|
||||
if (now >= weapon.phase_until_ns && weapon.polls_in_phase >= 2) {
|
||||
weapon.phase = W_GAP;
|
||||
weapon.polls_in_phase = 0;
|
||||
weapon.phase_until_ns = now + WEAPON_GAP_NS;
|
||||
weapon.rx = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case W_GAP: {
|
||||
if (now >= weapon.phase_until_ns && weapon.polls_in_phase >= 2) {
|
||||
if (weapon.queued > 0) {
|
||||
weapon.phase = W_HOLD;
|
||||
weapon.polls_in_phase = 0;
|
||||
weapon.phase_until_ns = now + WEAPON_HOLD_NS;
|
||||
weapon.rx = 32767 * weapon.direction;
|
||||
weapon.queued--;
|
||||
} else if (weapon.confirm_pending) {
|
||||
clear_weapon_locked();
|
||||
} else {
|
||||
weapon.phase = W_WAIT;
|
||||
weapon.polls_in_phase = 0;
|
||||
weapon.rx = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case W_WAIT: {
|
||||
if (weapon.confirm_pending) {
|
||||
clear_weapon_locked();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
clear_weapon_locked();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (weapon.active) {
|
||||
*buttons |= BIT(B_RIGHT);
|
||||
*rx = weapon.rx;
|
||||
*ry = 0;
|
||||
} else {
|
||||
int object = object_context(*buttons), items = item_menu(*buttons);
|
||||
if ((pulse.kind == ROTATE && (!object || !options.rotate || (right && options.distance))) ||
|
||||
(pulse.kind == DISTANCE && (!object || !right || !options.distance)) ||
|
||||
(pulse.kind == ITEMS && (!items || !options.wheel))) {
|
||||
clear_locked();
|
||||
}
|
||||
sample_locked(frame);
|
||||
if (!map_zoom_allowed(*buttons)) {
|
||||
map_zoom_velocity = 0;
|
||||
} else if (fabs(map_zoom_velocity) > 50.0) {
|
||||
int32_t stick_y = (int32_t)map_zoom_velocity;
|
||||
if (stick_y > 32767) stick_y = 32767;
|
||||
if (stick_y < -32767) stick_y = -32767;
|
||||
if (abs(stick_y) > abs(*ry)) *ry = stick_y;
|
||||
map_zoom_velocity *= 0.78;
|
||||
if (fabs(map_zoom_velocity) < 100.0) map_zoom_velocity = 0;
|
||||
}
|
||||
if (pulse.kind == ROTATE || pulse.kind == DISTANCE) {
|
||||
*buttons |= pulse.buttons;
|
||||
// Distance D-pad pulses do not own the look stick. R rotation does,
|
||||
// because the game's rotation mode would otherwise rotate both axes.
|
||||
if (pulse.kind == ROTATE && pulse.buttons) *rx = *ry = 0;
|
||||
} else if (pulse.kind == ITEMS && (pulse.queued || pulse.hold || pulse.gap || pulse.rx)) {
|
||||
*rx = pulse.rx;
|
||||
*ry = 0;
|
||||
} else if (items && options.keys && (held_a || held_d)) {
|
||||
*rx = ((held_d != 0) - (held_a != 0)) * 32767;
|
||||
*ry = 0;
|
||||
}
|
||||
}
|
||||
plat_mutex_unlock(&lock);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Mouse wheel and keyboard gameplay tweaks: Ultrahand rotation and distance, item and weapon wheel, map zoom.
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
int gameplay_tweaks_available(void);
|
||||
int gameplay_tweaks_capture_needed(void);
|
||||
int gameplay_tweaks_map_zoom(void);
|
||||
int gameplay_tweaks_strip_wheel(uint64_t buttons);
|
||||
void gameplay_tweaks_init(void);
|
||||
void gameplay_tweaks_reset(void);
|
||||
void gameplay_tweaks_wheel(double delta, int c_down, int right_down);
|
||||
void gameplay_tweaks_prepare_keys(uint8_t *down, uint64_t pad_buttons);
|
||||
void gameplay_tweaks_apply(uint64_t frame, int active, uint64_t *buttons,
|
||||
int32_t *lx, int32_t *ly, int32_t *rx, int32_t *ry);
|
||||
+11
-1
@@ -21,6 +21,7 @@
|
||||
#include "ui/menu.h"
|
||||
#include "vk.h"
|
||||
#include "platform/platform.h"
|
||||
#include "gameplay_tweaks.h"
|
||||
|
||||
enum { STICK_MAX = 32767, STICK_DIR = 16384, TRIGGER_ON = 16384, RESCAN_MS = 1000 };
|
||||
|
||||
@@ -33,6 +34,7 @@ static volatile int32_t g_block, g_menu; // text entry / host menu: 0 off, 1 o
|
||||
enum { PAD_USED = 16384, MOUSE_USED = 6 };
|
||||
static volatile int32_t g_kbm_last = 1;
|
||||
int input_kbm_last(void) { return __atomic_load_n(&g_kbm_last, __ATOMIC_RELAXED); }
|
||||
int input_gameplay_active(void) { return !g_menu && !g_block && ikb_foreground() && ikb_captured(); }
|
||||
static SDL_Gamepad *pad;
|
||||
static uint64_t next_scan;
|
||||
static int pad_rumble; // the open gamepad has rumble motors
|
||||
@@ -631,6 +633,8 @@ static void wheel_route(uint64_t *bp, int32_t sl[2], int32_t sr[2]) {
|
||||
: menu_cursor_camera() ? WHEEL_CAMERA
|
||||
: menu_cursor_menu() ? WHEEL_MENU
|
||||
: WHEEL_NONE;
|
||||
if (where == WHEEL_MAP && gameplay_tweaks_map_zoom()) where = WHEEL_NONE;
|
||||
else if (where == WHEEL_STRIP && gameplay_tweaks_strip_wheel(b)) where = WHEEL_NONE;
|
||||
int32_t v = wheel_stick(notches, where);
|
||||
if (!v) return;
|
||||
if (where == WHEEL_CAMERA) *bp |= 1ull << (v > 0 ? B_UP : B_DOWN);
|
||||
@@ -732,6 +736,8 @@ static void poll_merged(uint64_t *buttons, int32_t *lx, int32_t *ly, int32_t *rx
|
||||
else if (!click_held[i]) click_held[i] = 1, click_talk[i] = menu_cursor_dialogue();
|
||||
if (click_talk[i]) down[key] = 0, b |= 1ull << click_btn[i];
|
||||
}
|
||||
if (cap && !g_menu && !g_block) gameplay_tweaks_prepare_keys(down, b);
|
||||
else gameplay_tweaks_reset();
|
||||
b |= input_map_buttons(down);
|
||||
int32_t k[2];
|
||||
walk_get();
|
||||
@@ -768,6 +774,7 @@ static void poll_merged(uint64_t *buttons, int32_t *lx, int32_t *ly, int32_t *rx
|
||||
}
|
||||
script_apply(&b, sl, sr);
|
||||
wheel_route(&b, sl, sr);
|
||||
gameplay_tweaks_apply(__atomic_load_n(&gfx_counters.frames, __ATOMIC_RELAXED), input_gameplay_active(), &b, &sl[0], &sl[1], &sr[0], &sr[1]);
|
||||
rec_apply(b, sl, sr);
|
||||
// Minus and Plus held together (gamepad or keys) open or close the menu and never reach the game
|
||||
static int combo_held;
|
||||
@@ -799,10 +806,12 @@ static volatile uint64_t g_block_closed, g_menu_closed;
|
||||
|
||||
int input_cursor_allowed(void) {
|
||||
const char *in = cfg_get("TOTK_INPUT");
|
||||
return g_block != 1 && g_menu != 1 && mouse_sens_get() > 0 && !(in && !strcmp(in, "none")) && !menu_cursor_pointer();
|
||||
return g_block != 1 && g_menu != 1 && (gameplay_tweaks_capture_needed() || mouse_sens_get() > 0) &&
|
||||
!(in && !strcmp(in, "none")) && !menu_cursor_pointer();
|
||||
}
|
||||
|
||||
void input_block(int on) {
|
||||
if (on) gameplay_tweaks_reset();
|
||||
if (!on) __atomic_store_n(&g_block_closed, plat_now_ns(), __ATOMIC_RELEASE);
|
||||
plat_xchg32(&g_block, on ? 1 : 2);
|
||||
ikb_cursor_update();
|
||||
@@ -811,6 +820,7 @@ void input_block(int on) {
|
||||
// The in-game menu (ui/menu.cpp) blocks the game's input the same way: g_menu 0 closed, 1 open, 2 closed, waiting for
|
||||
// the release. The cursor is released while it is open, for the menu's mouse.
|
||||
void input_menu(int open) {
|
||||
if (open) gameplay_tweaks_reset();
|
||||
if (!open) __atomic_store_n(&g_menu_closed, plat_now_ns(), __ATOMIC_RELEASE);
|
||||
plat_xchg32(&g_menu, open ? 1 : 2);
|
||||
if (!open) ikb_menu_closed(); // the capture before Esc comes back
|
||||
|
||||
@@ -28,6 +28,20 @@ uint64_t input_buttons_last(void);
|
||||
// mouse_direct.c: the right stick's side a mouse shake gives while Ultrahand holds an object (-1 / +1), 0 while the
|
||||
// mouse does not shake; input.c puts it on the stick
|
||||
int input_direct_mouse_shake(void);
|
||||
enum {
|
||||
INPUT_CAM_UNCLASSIFIED = 0,
|
||||
INPUT_CAM_FREE_ROAM,
|
||||
INPUT_CAM_AIM,
|
||||
INPUT_CAM_SCOPE,
|
||||
INPUT_CAM_LOCK_ON,
|
||||
INPUT_CAM_MENU_WHEEL,
|
||||
INPUT_CAM_ABILITY,
|
||||
INPUT_CAM_ULTRAHAND_OBJECT,
|
||||
INPUT_CAM_VEHICLE,
|
||||
INPUT_CAM_DISABLED,
|
||||
};
|
||||
int input_camera_context(void);
|
||||
int input_gameplay_active(void);
|
||||
// menu_cursor.c: the L ability wheel or a D-pad strip has the focus: 1 / 0, -1 with the menu cursor off (not read)
|
||||
int menu_cursor_shortcut(void);
|
||||
// menu_cursor.c: the pointer in the game's menus (1.4.3). poll: once per pad read, adds a click's A or B; pointer: a
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "input_map.h"
|
||||
#include "input_sdl.h"
|
||||
#include "input_wsys.h"
|
||||
#include "gameplay_tweaks.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
static SDL_Window *win;
|
||||
@@ -145,6 +146,7 @@ static void cursor_apply(void) {
|
||||
plat_xchg32(&mouse_dy, 0);
|
||||
rem_x = rem_y = 0;
|
||||
plat_xchg32(&captured, want);
|
||||
if (!want) gameplay_tweaks_reset();
|
||||
}
|
||||
|
||||
// The pointer's place in the window (the window thread): x and y are SDL window units, the same space the mouse
|
||||
@@ -303,6 +305,10 @@ void input_sdl_event(const SDL_Event *e) {
|
||||
float y = e->wheel.direction == SDL_MOUSEWHEEL_FLIPPED ? -e->wheel.y : e->wheel.y;
|
||||
plat_add32(&mouse_wheel, (int32_t)(y * 120));
|
||||
}
|
||||
if (input_gameplay_active()) {
|
||||
double delta = e->wheel.direction == SDL_MOUSEWHEEL_FLIPPED ? e->wheel.y : -e->wheel.y;
|
||||
gameplay_tweaks_wheel(delta, ikb_down(KEY_C), ikb_down(KEY_MOUSE_R));
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_WINDOW_FOCUS_GAINED:
|
||||
plat_xchg32(&focused, 1);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "input_win.h"
|
||||
#include "input_map.h"
|
||||
#include "input_wsys.h"
|
||||
#include "gameplay_tweaks.h"
|
||||
#include "nvn_api.h"
|
||||
#include "ui/menu.h"
|
||||
#include "vk.h"
|
||||
@@ -119,6 +120,7 @@ static void cursor_update(HWND h) {
|
||||
if (cur_captured) ClipCursor(NULL);
|
||||
InterlockedExchange(&cur_captured, 0);
|
||||
}
|
||||
if (!cur_captured) gameplay_tweaks_reset();
|
||||
ReleaseSRWLockExclusive(&cur_lock);
|
||||
}
|
||||
|
||||
@@ -191,6 +193,11 @@ int input_window_msg(HWND h, UINT m, WPARAM w, LPARAM l, LRESULT *res) {
|
||||
InterlockedAdd(&mouse_wheel, (SHORT)ri.data.mouse.usButtonData);
|
||||
break; // DefWindowProc must see WM_INPUT for cleanup
|
||||
}
|
||||
case WM_MOUSEWHEEL:
|
||||
if (input_gameplay_active())
|
||||
gameplay_tweaks_wheel(-(double)(short)HIWORD(w) / WHEEL_DELTA,
|
||||
ikb_down(KEY_C), ikb_down(KEY_MOUSE_R));
|
||||
break;
|
||||
case WM_SETCURSOR:
|
||||
if (LOWORD(l) == HTCLIENT) {
|
||||
// pointer_image = 1: the pointer of cursor_art.c in place of the window class's arrow (0, the default:
|
||||
|
||||
@@ -121,6 +121,8 @@ void input_direct_mouse_row(int32_t dx, float sensitivity, uint64_t now, InputMo
|
||||
#define HOST_MOUSE_HAND (RT_PATCH_PAGE + 0xf90)
|
||||
#define HOST_MOUSE_ORBIT_STATE (RT_PATCH_PAGE + 0xf70)
|
||||
static _Thread_local uint64_t mouse_input_object;
|
||||
static volatile int32_t cam_blocked, cam_kind;
|
||||
static uint64_t cam_kind_at;
|
||||
|
||||
// Where a game version keeps what the hooks read and write (recomp/patches-v143.txt, patches-v121.txt). The camera
|
||||
// input update keeps its flags in w21, its input object in x20 and y in s10 in both; the free orbit's object is x0 at
|
||||
@@ -362,6 +364,7 @@ static void camera_input(Cpu *c) {
|
||||
const unsigned rx = mouse_layout()->input_x;
|
||||
mouse_input_object = 0;
|
||||
uint32_t flags = (uint32_t)c->x[21];
|
||||
__atomic_store_n(&cam_blocked, (flags & 1) != 0, __ATOMIC_RELAXED);
|
||||
int accept = !(flags & 1) && !input_direct_mouse_selector_active();
|
||||
__atomic_store_n(&accepts_mouse, accept, __ATOMIC_RELAXED);
|
||||
__atomic_store_n(&last_update, plat_now_ns(), __ATOMIC_RELEASE);
|
||||
@@ -456,6 +459,8 @@ static void camera_input(Cpu *c) {
|
||||
// directly and move its persistent pitch/yaw by the same amounts so the next update starts at the new orientation.
|
||||
// The controller still handles its gamepad input, following, collision and focus normally.
|
||||
static void orbit_begin(Cpu *c) {
|
||||
__atomic_store_n(&cam_kind, INPUT_CAM_FREE_ROAM, __ATOMIC_RELAXED);
|
||||
__atomic_store_n(&cam_kind_at, plat_now_ns(), __ATOMIC_RELEASE);
|
||||
orbit.object = 0;
|
||||
uint64_t object = c->x[0];
|
||||
if (direct_mode()) {
|
||||
@@ -1034,6 +1039,45 @@ static void camera_load(Cpu *c) {
|
||||
rt_log("mouse: load hook called from main+%#llx, no such site", (unsigned long long)offset);
|
||||
abort();
|
||||
}
|
||||
int mapped = INPUT_CAM_UNCLASSIFIED;
|
||||
switch (s->mode) {
|
||||
case MODE_AIM:
|
||||
case MODE_LOCKON_AIM:
|
||||
mapped = INPUT_CAM_AIM;
|
||||
break;
|
||||
case MODE_SCOPE:
|
||||
case MODE_FINDER:
|
||||
mapped = INPUT_CAM_SCOPE;
|
||||
break;
|
||||
case MODE_ABILITY:
|
||||
case MODE_ABILITY_OFFSET:
|
||||
mapped = INPUT_CAM_ABILITY;
|
||||
break;
|
||||
case MODE_LOCKON:
|
||||
mapped = INPUT_CAM_LOCK_ON;
|
||||
break;
|
||||
case MODE_HORSE:
|
||||
case MODE_HORSE_LOCKON:
|
||||
mapped = INPUT_CAM_VEHICLE;
|
||||
break;
|
||||
case MODE_TALK:
|
||||
case MODE_TALK_MANUAL:
|
||||
mapped = INPUT_CAM_DISABLED;
|
||||
break;
|
||||
case MODE_CLIMB:
|
||||
case MODE_WAKEBOARD:
|
||||
case MODE_SHIELD:
|
||||
case MODE_WATERFALL:
|
||||
case MODE_TAIL:
|
||||
mapped = INPUT_CAM_FREE_ROAM;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (mapped != INPUT_CAM_UNCLASSIFIED) {
|
||||
__atomic_store_n(&cam_kind, mapped, __ATOMIC_RELAXED);
|
||||
__atomic_store_n(&cam_kind_at, plat_now_ns(), __ATOMIC_RELEASE);
|
||||
}
|
||||
uint64_t at = load_address(c, s->insn);
|
||||
if (s->role == ROLE_BASE_STORE) { // performs the store, of the value plus the degrees when there are any
|
||||
uint32_t bits = (uint32_t)c->v[s->insn & 31];
|
||||
@@ -1099,4 +1143,23 @@ __attribute__((constructor)) static void mouse_direct_register(void) {
|
||||
rt_register_host(HOST_MOUSE_HAND, hand_input);
|
||||
rt_register_host(HOST_MOUSE_LOAD, camera_load);
|
||||
}
|
||||
|
||||
int input_camera_context(void) {
|
||||
static int patch_id = -2;
|
||||
if (patch_id == -2) patch_id = rt_patch_set("mouse_direct");
|
||||
if (patch_id < 0 || !rt_patch_enabled(patch_id)) return INPUT_CAM_UNCLASSIFIED;
|
||||
uint64_t now = plat_now_ns();
|
||||
if (hand_active(now)) return INPUT_CAM_ULTRAHAND_OBJECT;
|
||||
uint64_t kat = __atomic_load_n(&cam_kind_at, __ATOMIC_ACQUIRE);
|
||||
int kind = (kat && now - kat < 150000000ull) ? __atomic_load_n(&cam_kind, __ATOMIC_RELAXED) : INPUT_CAM_UNCLASSIFIED;
|
||||
if (kind == INPUT_CAM_SCOPE || kind == INPUT_CAM_AIM) return kind;
|
||||
uint64_t last = __atomic_load_n(&last_update, __ATOMIC_ACQUIRE);
|
||||
int cam_alive = last && now - last < 150000000ull;
|
||||
if (cam_alive && __atomic_load_n(&cam_blocked, __ATOMIC_RELAXED)) return INPUT_CAM_MENU_WHEEL;
|
||||
if (kind != INPUT_CAM_UNCLASSIFIED) return kind;
|
||||
if (cam_alive) return INPUT_CAM_FREE_ROAM;
|
||||
return INPUT_CAM_UNCLASSIFIED;
|
||||
}
|
||||
#else
|
||||
int input_camera_context(void) { return INPUT_CAM_UNCLASSIFIED; }
|
||||
#endif
|
||||
@@ -860,6 +860,32 @@ static void restart_confirm(void) {
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
static void rows_gameplay_tweaks(void) {
|
||||
opt_group(UI_MENU_GROUP_GAMEPLAY_TWEAKS);
|
||||
opt_toggle("TOTK_GAMEPLAY_TWEAKS_ENABLED", UI_MENU_GAMEPLAY_TWEAKS_ENABLED, UI_MENU_GAMEPLAY_TWEAKS_ENABLED_DESC);
|
||||
if (!cfg_bool("TOTK_GAMEPLAY_TWEAKS_ENABLED")) return;
|
||||
|
||||
opt_toggle("TOTK_GAMEPLAY_ULTRAHAND_ROTATE", UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE, UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE_DESC);
|
||||
opt_toggle("TOTK_GAMEPLAY_ULTRAHAND_C_AXIS", UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS, UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS_DESC);
|
||||
opt_slider("TOTK_GAMEPLAY_ROTATION_SENSITIVITY", UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY, 0.25f, 4.0f,
|
||||
UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY_DESC, 0.05f, "%.2fx");
|
||||
opt_toggle("TOTK_GAMEPLAY_ULTRAHAND_DISTANCE", UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE, UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE_DESC);
|
||||
opt_slider("TOTK_GAMEPLAY_DISTANCE_SENSITIVITY", UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY, 0.25f, 4.0f,
|
||||
UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY_DESC, 0.05f, "%.2fx");
|
||||
|
||||
opt_toggle("TOTK_GAMEPLAY_WEAPON_WHEEL", UI_MENU_GAMEPLAY_WEAPON_WHEEL, UI_MENU_GAMEPLAY_WEAPON_WHEEL_DESC);
|
||||
opt_slider("TOTK_GAMEPLAY_WEAPON_SENSITIVITY", UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY, 0.25f, 4.0f,
|
||||
UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY_DESC, 0.05f, "%.2fx");
|
||||
opt_toggle("TOTK_GAMEPLAY_ITEM_WHEEL", UI_MENU_GAMEPLAY_ITEM_WHEEL, UI_MENU_GAMEPLAY_ITEM_WHEEL_DESC);
|
||||
opt_slider("TOTK_GAMEPLAY_ITEM_SENSITIVITY", UI_MENU_GAMEPLAY_ITEM_SENSITIVITY, 0.25f, 4.0f,
|
||||
UI_MENU_GAMEPLAY_ITEM_SENSITIVITY_DESC, 0.05f, "%.2fx");
|
||||
opt_toggle("TOTK_GAMEPLAY_ITEM_AD", UI_MENU_GAMEPLAY_ITEM_AD, UI_MENU_GAMEPLAY_ITEM_AD_DESC);
|
||||
|
||||
opt_toggle("TOTK_GAMEPLAY_MAP_ZOOM", UI_MENU_GAMEPLAY_MAP_ZOOM, UI_MENU_GAMEPLAY_MAP_ZOOM_DESC);
|
||||
opt_slider("TOTK_GAMEPLAY_MAP_ZOOM_SENSITIVITY", UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY, 0.25f, 4.0f,
|
||||
UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY_DESC, 0.05f, "%.2fx");
|
||||
}
|
||||
|
||||
static void tab_controls(float scale) {
|
||||
opt_begin("##controls", scale);
|
||||
static const UiTextId layout[] = {UI_MENU_PAD_LAYOUT_AUTO, UI_MENU_PAD_LAYOUT_NINTENDO, UI_MENU_PAD_LAYOUT_XBOX};
|
||||
@@ -882,6 +908,7 @@ static void tab_controls(float scale) {
|
||||
opt_toggle("TOTK_POINTER_IMAGE", UI_MENU_POINTER_IMAGE, UI_MENU_POINTER_IMAGE_DESC);
|
||||
row_walk_key();
|
||||
opt_slider("TOTK_WALK_SCALE", UI_MENU_WALK_SCALE, 0.2f, 0.9f, UI_MENU_WALK_SCALE_DESC, 0.01f, "%.2f");
|
||||
rows_gameplay_tweaks();
|
||||
// Analog sticks: one dead zone row per stick, falling back to TOTK_STICK_DEADZONE (both sticks) while unset. With
|
||||
// a gamepad connected each row shows its stick's deflection now, before the dead zone: a drifting stick's resting
|
||||
// value, to set it above.
|
||||
|
||||
@@ -308,6 +308,33 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_WALK_SCALE] = "Walk scale",
|
||||
[UI_MENU_WALK_SCALE_DESC] = "The tilt the keyboard's sticks get while the walk key is held. Half is a walk, the "
|
||||
"full tilt a run.",
|
||||
[UI_MENU_GROUP_GAMEPLAY_TWEAKS] = "Gameplay tweaks",
|
||||
[UI_MENU_GAMEPLAY_TWEAKS_ENABLED] = "Gameplay tweaks",
|
||||
[UI_MENU_GAMEPLAY_TWEAKS_ENABLED_DESC] = "Mouse wheel controls for Ultrahand rotation and distance, item and weapon switching, and smooth map zoom.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE] = "Ultrahand wheel rotation",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE_DESC] = "Turn objects held by Ultrahand directly with the mouse wheel.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS] = "Ultrahand C rotation axis",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS_DESC] = "Hold C while scrolling to turn held objects around the alternate axis.",
|
||||
[UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY] = "Ultrahand rotation sensitivity",
|
||||
[UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY_DESC] = "How fast the mouse wheel turns held objects.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE] = "Ultrahand wheel distance",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE_DESC] = "Right-click + mouse wheel pushes or pulls held objects.",
|
||||
[UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY] = "Ultrahand distance sensitivity",
|
||||
[UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY_DESC] = "How fast the mouse wheel changes object distance.",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_WHEEL] = "Weapon wheel selection",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_WHEEL_DESC] = "Scroll mouse wheel in free roam to switch weapons. Confirm with E.",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY] = "Weapon wheel sensitivity",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY_DESC] = "Scroll steps needed to advance to the next weapon.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_WHEEL] = "Quick menu wheel selection",
|
||||
[UI_MENU_GAMEPLAY_ITEM_WHEEL_DESC] = "Scroll mouse wheel to browse items while a quick-selection menu is open.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_SENSITIVITY] = "Quick menu wheel sensitivity",
|
||||
[UI_MENU_GAMEPLAY_ITEM_SENSITIVITY_DESC] = "Scroll steps needed to advance through items in quick-selection menus.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_AD] = "Quick menu A / D navigation",
|
||||
[UI_MENU_GAMEPLAY_ITEM_AD_DESC] = "Press A / D to navigate left and right in quick-selection menus.",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM] = "Smooth map zoom",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_DESC] = "Smooth inertial zoom on the Purah Pad map using the mouse wheel.",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY] = "Map zoom sensitivity",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY_DESC] = "How fast the mouse wheel zooms the map.",
|
||||
[UI_MENU_STICK_SENS] = "Stick camera speed",
|
||||
[UI_MENU_STICK_SENS_DESC] = "Multiplies the game's own right-stick camera speed, top speed included, at each of the "
|
||||
"game's five camera sensitivities. The mouse keeps its own setting.",
|
||||
@@ -804,6 +831,33 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_WALK_SCALE] = "Сила шага",
|
||||
[UI_MENU_WALK_SCALE_DESC] = "Отклонение стиков клавиатуры при удержании клавиши шага. Половина — шаг, полное "
|
||||
"отклонение — бег.",
|
||||
[UI_MENU_GROUP_GAMEPLAY_TWEAKS] = "Геймплей",
|
||||
[UI_MENU_GAMEPLAY_TWEAKS_ENABLED] = "Настройки геймплея",
|
||||
[UI_MENU_GAMEPLAY_TWEAKS_ENABLED_DESC] = "Управление колесом мыши: вращение и дистанция предметов в Ультраруке, выбор оружия и предметов, плавный зум карты.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE] = "Вращение колесом (Ультрарука)",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE_DESC] = "Вращение удерживаемых Ультрарукой предметов колесом мыши без удержания R.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS] = "Ось C для вращения (Ультрарука)",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS_DESC] = "Удерживайте C при прокрутке колеса для вращения объекта вокруг третьей оси.",
|
||||
[UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY] = "Скорость вращения (Ультрарука)",
|
||||
[UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY_DESC] = "Как быстро колесо мыши поворачивает удерживаемый предмет.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE] = "Дистанция колесом (Ультрарука)",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE_DESC] = "Правая кнопка мыши + колесо приближает или отдаляет предмет.",
|
||||
[UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY] = "Скорость дистанции (Ультрарука)",
|
||||
[UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY_DESC] = "Как быстро колесо мыши меняет дистанцию до предмета.",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_WHEEL] = "Выбор оружия колесом",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_WHEEL_DESC] = "Прокрутите колесо в свободной игре для выбора оружия. Подтверждение клавишей E.",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY] = "Чувствительность выбора оружия",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY_DESC] = "Шаги колеса для переключения на следующее оружие.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_WHEEL] = "Выбор в быстром меню колесом",
|
||||
[UI_MENU_GAMEPLAY_ITEM_WHEEL_DESC] = "Прокрутка колеса листает предметы в открытом меню быстрого выбора.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_SENSITIVITY] = "Чувствительность быстрого меню",
|
||||
[UI_MENU_GAMEPLAY_ITEM_SENSITIVITY_DESC] = "Шаги колеса для перехода к следующему предмету в быстром меню.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_AD] = "Навигация A / D в быстром меню",
|
||||
[UI_MENU_GAMEPLAY_ITEM_AD_DESC] = "Клавиши A / D для выбора влево и вправо в меню быстрого выбора.",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM] = "Плавный зум карты",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_DESC] = "Плавное инерционное приближение карты Планшета путеводителя колесом мыши.",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY] = "Скорость зума карты",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY_DESC] = "Как быстро колесо мыши масштабирует карту.",
|
||||
[UI_MENU_STICK_SENS] = "Скорость камеры (стик)",
|
||||
[UI_MENU_STICK_SENS_DESC] = "Умножает скорость поворота камеры правым стиком, включая наибольшую, при каждой из пяти "
|
||||
"чувствительностей камеры в игре. На мышь не влияет.",
|
||||
@@ -1478,6 +1532,33 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
[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 "
|
||||
"é andar, a inclinação total é correr.",
|
||||
[UI_MENU_GROUP_GAMEPLAY_TWEAKS] = "Ajustes de jogabilidade",
|
||||
[UI_MENU_GAMEPLAY_TWEAKS_ENABLED] = "Ajustes de jogabilidade",
|
||||
[UI_MENU_GAMEPLAY_TWEAKS_ENABLED_DESC] = "Controles com a roda do mouse para rotação e distância na Ultramão, seleção de armas e itens, e zoom suave no mapa.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE] = "Rotação com roda (Ultramão)",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE_DESC] = "Gira objetos segurados pela Ultramão diretamente com a roda do mouse.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS] = "Eixo de rotação C (Ultramão)",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS_DESC] = "Segure C ao rolar a roda do mouse para girar o objeto no terceiro eixo.",
|
||||
[UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY] = "Sensibilidade de rotação (Ultramão)",
|
||||
[UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY_DESC] = "Define a velocidade de rotação do objeto com a roda do mouse.",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE] = "Distância com roda (Ultramão)",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE_DESC] = "Botão direito do mouse + roda aproxima ou afasta o objeto.",
|
||||
[UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY] = "Sensibilidade de distância (Ultramão)",
|
||||
[UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY_DESC] = "Define a velocidade de ajuste de distância com a roda do mouse.",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_WHEEL] = "Seleção de armas com a roda",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_WHEEL_DESC] = "Role a roda do mouse no modo livre para trocar de arma. Confirme com E.",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY] = "Sensibilidade de seleção de armas",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY_DESC] = "Passos da roda necessários para avançar para a próxima arma.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_WHEEL] = "Seleção do menu rápido com a roda",
|
||||
[UI_MENU_GAMEPLAY_ITEM_WHEEL_DESC] = "Role a roda do mouse para navegar por itens com o menu rápido aberto.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_SENSITIVITY] = "Sensibilidade do menu rápido",
|
||||
[UI_MENU_GAMEPLAY_ITEM_SENSITIVITY_DESC] = "Passos da roda necessários para avançar itens nos menus rápidos.",
|
||||
[UI_MENU_GAMEPLAY_ITEM_AD] = "Navegação A / D no menu rápido",
|
||||
[UI_MENU_GAMEPLAY_ITEM_AD_DESC] = "Teclas A / D para navegar para esquerda e direita nos menus rápidos.",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM] = "Zoom suave no mapa",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_DESC] = "Zoom inercial suave no mapa do Purah Pad usando a roda do mouse.",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY] = "Sensibilidade do zoom no mapa",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY_DESC] = "Define a velocidade de zoom no mapa com a roda do mouse.",
|
||||
[UI_MENU_OV_SCALE_DOWN] = "bilinear (o FSR só amplia)",
|
||||
[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 "
|
||||
@@ -2118,6 +2199,33 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_WALK_KEY_TAKEN] = "同时为 %s",
|
||||
[UI_MENU_WALK_SCALE] = "步行幅度",
|
||||
[UI_MENU_WALK_SCALE_DESC] = "按住步行键时键盘摇杆的推动幅度。一半为走路,推满为奔跑。",
|
||||
[UI_MENU_GROUP_GAMEPLAY_TWEAKS] = "游戏操作微调",
|
||||
[UI_MENU_GAMEPLAY_TWEAKS_ENABLED] = "启用操作微调",
|
||||
[UI_MENU_GAMEPLAY_TWEAKS_ENABLED_DESC] = "使用鼠标滚轮控制究极手物体旋转与距离、武器与道具切换以及地图平滑缩放。",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE] = "究极手滚轮旋转",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE_DESC] = "究极手抓取物体时直接使用鼠标滚轮旋转物体,无需按住 R 键。",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS] = "究极手 C 轴旋转",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS_DESC] = "滚动滚轮时按住 C 键可绕第三轴旋转物体。",
|
||||
[UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY] = "究极手旋转灵敏度",
|
||||
[UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY_DESC] = "鼠标滚轮旋转物体的灵敏度倍率。",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE] = "究极手滚轮推拉距离",
|
||||
[UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE_DESC] = "按住鼠标右键滚动滚轮可推远或拉近物体。",
|
||||
[UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY] = "究极手距离灵敏度",
|
||||
[UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY_DESC] = "鼠标滚轮推拉物体距离的灵敏度倍率。",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_WHEEL] = "自由状态滚轮切换武器",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_WHEEL_DESC] = "在自由行动时滚动鼠标滚轮切换武器,按 E 键确认。",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY] = "武器切换滚轮灵敏度",
|
||||
[UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY_DESC] = "滚轮切换下一个武器所需的滚动步数灵敏度。",
|
||||
[UI_MENU_GAMEPLAY_ITEM_WHEEL] = "快捷菜单滚轮选择",
|
||||
[UI_MENU_GAMEPLAY_ITEM_WHEEL_DESC] = "快捷菜单打开时通过鼠标滚轮快速切换选择物品。",
|
||||
[UI_MENU_GAMEPLAY_ITEM_SENSITIVITY] = "快捷菜单滚轮灵敏度",
|
||||
[UI_MENU_GAMEPLAY_ITEM_SENSITIVITY_DESC] = "在快捷菜单中切换下一个物品所需的滚轮灵敏度。",
|
||||
[UI_MENU_GAMEPLAY_ITEM_AD] = "快捷菜单 A / D 键切换",
|
||||
[UI_MENU_GAMEPLAY_ITEM_AD_DESC] = "快捷菜单打开时按 A / D 键向左或向右切换选择物品。",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM] = "地图平滑缩放",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_DESC] = "在普尔亚平板地图上使用鼠标滚轮进行平滑惯性缩放。",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY] = "地图缩放灵敏度",
|
||||
[UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY_DESC] = "鼠标滚轮缩放地图的灵敏度倍率。",
|
||||
[UI_MENU_OV_SCALE_DOWN] = "双线性(FSR 只能放大)",
|
||||
[UI_MENU_HDR_HUE] = "高光色调校正",
|
||||
[UI_MENU_HDR_HUE_DESC] = "火焰、火花等明亮色彩像游戏自身的 SDR 画面一样趋向白色,与它们发出的光一致;0 保持完全饱和。",
|
||||
|
||||
@@ -124,6 +124,22 @@ typedef enum {
|
||||
UI_MENU_MOUSE_SENS, UI_MENU_MOUSE_SENS_DESC,
|
||||
UI_MENU_WALK_KEY, UI_MENU_WALK_KEY_DESC, UI_MENU_WALK_KEY_TAKEN, UI_MENU_WALK_SCALE, UI_MENU_WALK_SCALE_DESC,
|
||||
|
||||
// Controls tab: Gameplay tweaks
|
||||
UI_MENU_GROUP_GAMEPLAY_TWEAKS,
|
||||
UI_MENU_GAMEPLAY_TWEAKS_ENABLED, UI_MENU_GAMEPLAY_TWEAKS_ENABLED_DESC,
|
||||
UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE, UI_MENU_GAMEPLAY_ULTRAHAND_ROTATE_DESC,
|
||||
UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS, UI_MENU_GAMEPLAY_ULTRAHAND_C_AXIS_DESC,
|
||||
UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY, UI_MENU_GAMEPLAY_ROTATION_SENSITIVITY_DESC,
|
||||
UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE, UI_MENU_GAMEPLAY_ULTRAHAND_DISTANCE_DESC,
|
||||
UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY, UI_MENU_GAMEPLAY_DISTANCE_SENSITIVITY_DESC,
|
||||
UI_MENU_GAMEPLAY_WEAPON_WHEEL, UI_MENU_GAMEPLAY_WEAPON_WHEEL_DESC,
|
||||
UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY, UI_MENU_GAMEPLAY_WEAPON_SENSITIVITY_DESC,
|
||||
UI_MENU_GAMEPLAY_ITEM_WHEEL, UI_MENU_GAMEPLAY_ITEM_WHEEL_DESC,
|
||||
UI_MENU_GAMEPLAY_ITEM_SENSITIVITY, UI_MENU_GAMEPLAY_ITEM_SENSITIVITY_DESC,
|
||||
UI_MENU_GAMEPLAY_ITEM_AD, UI_MENU_GAMEPLAY_ITEM_AD_DESC,
|
||||
UI_MENU_GAMEPLAY_MAP_ZOOM, UI_MENU_GAMEPLAY_MAP_ZOOM_DESC,
|
||||
UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY, UI_MENU_GAMEPLAY_MAP_ZOOM_SENSITIVITY_DESC,
|
||||
|
||||
// Controls tab: the remapping rows (ui/binds_page.cpp)
|
||||
UI_BINDS_HELP, UI_BINDS_COL_KEY1, UI_BINDS_COL_KEY2, UI_BINDS_COL_PAD,
|
||||
UI_BINDS_GROUP_BUTTONS, UI_BINDS_GROUP_MOVE, UI_BINDS_GROUP_CAMERA,
|
||||
|
||||
@@ -591,6 +591,14 @@ InputMap input_map;
|
||||
// Other input entry points are linked by PE unwind metadata; reaching them is outside this script-only test.
|
||||
void ikb_cursor_update(void) { abort(); }
|
||||
void ikb_menu_closed(void) { abort(); }
|
||||
int gameplay_tweaks_capture_needed(void) { return 0; }
|
||||
int gameplay_tweaks_map_zoom(void) { return 0; }
|
||||
int gameplay_tweaks_strip_wheel(uint64_t b) { (void)b; return 0; }
|
||||
void gameplay_tweaks_reset(void) {}
|
||||
void gameplay_tweaks_prepare_keys(uint8_t *d, uint64_t b) { (void)d; (void)b; }
|
||||
void gameplay_tweaks_apply(uint64_t f, int a, uint64_t *b, int32_t *lx, int32_t *ly, int32_t *rx, int32_t *ry) {
|
||||
(void)f; (void)a; (void)b; (void)lx; (void)ly; (void)rx; (void)ry;
|
||||
}
|
||||
int cfg_bool(const char *key) { (void)key; abort(); }
|
||||
int input_menu_gate(int *h,int open,uint64_t *b,int32_t s[4]) { (void)h;(void)open;(void)b;(void)s;abort(); }
|
||||
int input_overlay_gate(int *h,uint64_t *b) { (void)h;(void)b;abort(); }
|
||||
|
||||
@@ -437,6 +437,22 @@
|
||||
# Default: shared-fonts next to totk.exe. TOTK_SHARED_FONTS overrides it.
|
||||
# shared_fonts =
|
||||
|
||||
# Gameplay Tweaks: independent live switches.
|
||||
[gameplay tweaks]
|
||||
# gameplay_tweaks_enabled = 0
|
||||
# gameplay_ultrahand_rotate = 1
|
||||
# gameplay_ultrahand_c_axis = 1
|
||||
# gameplay_ultrahand_distance = 1
|
||||
# gameplay_weapon_wheel = 1
|
||||
# gameplay_weapon_sensitivity = 1
|
||||
# gameplay_item_wheel = 1
|
||||
# gameplay_item_ad = 1
|
||||
# gameplay_map_zoom = 1
|
||||
# gameplay_map_zoom_sensitivity = 1
|
||||
# gameplay_rotation_sensitivity = 1
|
||||
# gameplay_distance_sensitivity = 1
|
||||
# gameplay_item_sensitivity = 1
|
||||
|
||||
[cheats]
|
||||
# One line per cheat of the mods' cheat files, mods\<mod>\cheats\<build id>.txt (docs/cheats.md); the Cheats tab of
|
||||
# the menu writes them. cheat_<hash> = 1 switches a cheat on, the hash being FNV-1a 32 of "<mod folder>/<cheat name>".
|
||||
|
||||
Reference in new issue
Block a user