Triforce v0.8.5

A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-28 10:54:41 -06:00
parent 2df08c751e
commit b527e29adb
203 changed files with 18821 additions and 2051 deletions

View File

@@ -625,6 +625,30 @@ static void stick_max(int32_t stick[4], const int32_t v[4]) {
if ((v[i] < 0 ? -v[i] : v[i]) > (stick[i] < 0 ? -stick[i] : stick[i])) stick[i] = v[i];
}
/* ((Triforce, 11-27) What last pushed the right stick, by source, for host/mouse_native.c's camera lines: a report of the
camera that stopped following Link at a load until R3 (state 4, the player's) said a Pro controller had just connected;
which source turned it is asked of the next such log. Written on the reading threads, read for a log line: no lock */
enum { RS_SCRIPT, RS_PADS, RS_MOUSE, RS_KEYS, RS_N };
static volatile struct { int64_t ns; int32_t x, y; } rs_seen[RS_N];
static void rs_note(int src, const int32_t v[4]) {
if (v[2] || v[3]) rs_seen[src].x = v[2], rs_seen[src].y = v[3], rs_seen[src].ns = hos_now_ns();
}
void hos_hid_rstick_said(char *out, size_t n) {
static const char *const names[RS_N] = {"a script or the control bridge", "a controller", "the mouse", "the camera keys"};
const int64_t now = hos_now_ns();
size_t at = 0;
out[0] = 0;
for (int i = 0; i < RS_N && at + 1 < n; i++) {
const int64_t ns = rs_seen[i].ns;
if (!ns || now - ns > 3000000000LL) continue;
const int w = snprintf(out + at, n - at, "%s%s (%d, %d) %lld ms ago", at ? "; " : "", names[i], (int)rs_seen[i].x,
(int)rs_seen[i].y, (long long)((now - ns) / 1000000));
if (w < 0) break;
at += (size_t)w;
}
if (!out[0]) snprintf(out, n, "nothing in the last 3 s");
}
/* ---- (hookshot) the controls: the gamepad input (by position) and the keys that press each Switch button, from
triforce_options.ini beside the executable when it has them: pad_<button>=<HOS_PAD_* position, -1 none> and
key_<button>=<key code>,<key code> (Windows key codes, 0 none), <button> one of bind_names. Read once, at the
@@ -691,6 +715,7 @@ static int oc_live; /* (oc_notes ran this read with a button w
static volatile LONG toggle_reset;
static HoldToggle toggles;
static uint64_t host_taps_now; /* (read_input: the host's own presses of this read, in its buttons too) */
static uint64_t script_now; /* ((Triforce) read_input: the script's and the live input file's presses of this read */
void hos_input_clear_toggles(void) { InterlockedExchange(&toggle_reset, 1); }
static void binds_default(void) {
@@ -1437,6 +1462,8 @@ static void read_input(uint64_t *buttons, int32_t stick[4]) {
kept apart: npad_states takes them out for the hold-to-toggle latch) */
uint64_t taps = 0;
scripted_input(buttons, &taps, stick);
rs_note(RS_SCRIPT, stick);
script_now = *buttons; /* ((Triforce) the test's own presses alone: the buttons were 0 before them) */
*buttons |= taps;
host_taps_now = taps;
/* ((Triforce, 11-19) benchmark mode (host/hos_bench.c) drives the game itself: its presses and stick alone, with the window
@@ -1451,7 +1478,9 @@ static void read_input(uint64_t *buttons, int32_t stick[4]) {
}
/* (Triforce) HOS_CONTROL: the control bridge's presses (host/control.c); one that asked to be exclusive keeps the
player's devices out while it lasts. Without HOS_CONTROL: one load and back */
if (hos_control_input(buttons, stick)) return;
const int bridge_only = hos_control_input(buttons, stick);
rs_note(RS_SCRIPT, stick); /* ((Triforce, 11-27) the bridge's presses beside the script's */
if (bridge_only) return;
/* A scripted run (a test) takes no input from the player's devices until 5 s after its last press (a variable
left set in a shell no longer leaves the game without controls), and otherwise the pads count only
while the game's window is in front, like the keyboard: XInput is global, so a test run in the background
@@ -1485,6 +1514,7 @@ static void read_input(uint64_t *buttons, int32_t stick[4]) {
if (!rx_option(1, 0)) {
*buttons |= pb;
stick_max(stick, ps);
rs_note(RS_PADS, ps);
}
}
hud_shortcut(0, 0); /* ((Triforce) Toggle HUD: with the window in front only) */
@@ -1539,6 +1569,7 @@ static void read_input(uint64_t *buttons, int32_t stick[4]) {
if (pad_after_menu & rs) gs[2] = gs[3] = 0;
*buttons |= pad_after_menu ? bound_pad_buttons(pad_raw_game & ~pad_after_menu) : pb;
stick_max(stick, gs);
rs_note(RS_PADS, gs);
}
const int pushed = ps[0] > 12000 || ps[0] < -12000 || ps[1] > 12000 || ps[1] < -12000 || ps[2] > 12000 || ps[2] < -12000 ||
ps[3] > 12000 || ps[3] < -12000;
@@ -1587,7 +1618,7 @@ static void read_input(uint64_t *buttons, int32_t stick[4]) {
if (as_stick) {
captured = mouse_stick(&mouse[2], &mouse[3], (int)((*buttons | toggles.latched) >> B_L & 1));
if (deck_builtin_input) mouse[2] = mouse[3] = 0; /* (taken for the pointer's sake, never the camera's) */
if (captured) stick_max(stick, mouse);
if (captured) stick_max(stick, mouse), rs_note(RS_MOUSE, mouse);
}
/* (the side buttons in the game's menus) */
int hos_mouse_in_game_menu(void); /* display.c */
@@ -1613,6 +1644,7 @@ static void read_input(uint64_t *buttons, int32_t stick[4]) {
controller's stick and the scripted presses are as they are) */
if (walk_vk && key(walk_vk)) walk_keys(keys, rx_option(HOS_OPT_WALK_SCALE, 51));
stick_max(stick, keys);
rs_note(RS_KEYS, keys);
if (keys[0] || keys[1] || keys[2] || keys[3]) player_used(); /* (display.c: the game menus' cursor hides again) */
}
@@ -1670,6 +1702,21 @@ static void mods_input(uint64_t *buttons_io, int32_t stick[4]) {
last_ns = 0;
}
was_down = down;
{ /* ((Triforce) the title's tabs, Mods and Save Select at the top left (gpu/vk/vk_menu.cpp draw_title_tabs): a controller's
button bound to X or Y is taken by the renderer itself, from the pad (it reads the pads while its menu is shut too).
What it cannot see is a test's scripted press (the script, the live input file: script_now; the lab's first run of
the tabs looked at host_taps_now, the host's own presses alone, and a scripted X went to the game), which reaches
no pad: told here, 6 Mods and 7 Save Select, and not given to the game */
int hos_oot_title_tabs(void);
static uint64_t taps_was;
const uint64_t taps = script_now, fresh = taps & ~taps_was;
taps_was = taps;
if (fresh & (1ULL << B_X | 1ULL << B_Y)) {
const int tabs = hos_oot_title_tabs();
if ((fresh >> B_X & 1) && (tabs & 1)) rx_option_set(HOS_OPT_MODS_ENTER, 6), buttons &= ~(1ULL << B_X);
else if ((fresh >> B_Y & 1) && (tabs & 2)) rx_option_set(HOS_OPT_MODS_ENTER, 7), buttons &= ~(1ULL << B_Y);
}
}
static uint64_t prev, held_over;
static int sel_was, stick_over, stick_was;
const int sel = rx_option(HOS_OPT_MODS_SELECTED, 0) != 0;