mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-29 04:18:49 -04:00
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:
92
host/nn_vi.c
92
host/nn_vi.c
@@ -7,6 +7,7 @@
|
||||
#include "pace_steady.h" /* ((Triforce) the Steady frame rate row: steady_period) */
|
||||
#include "movie_pace.h" /* ((Triforce, 11-22, PRESENT-30) paced at 240 while a movie plays at the 60 cap) */
|
||||
#include "n64_pace.h" /* ((Triforce, 11-22, N64 Classic) paced at its frame rate: n64_pace_decide, pace_fps */
|
||||
#include "res_follow.h" /* ((Triforce, 11-26) the Render resolution's scale as the menu applies it: realtime_step */
|
||||
#include "../gpu/vk/vk_api.h" /* (HOS_OPT_HDR_*: the Insert menu's HDR, answered by the renderer) */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@@ -361,6 +362,23 @@ static int pace_fps(void) {
|
||||
return n64_pace_fps(n64_rate, movie_pace_fps(movie_raise, fps_max()));
|
||||
}
|
||||
static void n64_pace_decide(void); /* (below) */
|
||||
/* ((Triforce, 11-26) The Frame pacing row's Steady frame rate, PACE_STEADY_*: HOS_FPS_STEADY, else the row as it is now
|
||||
(gpu/vk/vk_menu.cpp menu_steady_row, HOS_OPT_STEADY_ROW: each present, so a change is taken at once; it was the options
|
||||
file's at the start, and a change took a restart), else, until the renderer answers, the options file's */
|
||||
static int steady_mode(void) {
|
||||
static int env = -2, file = -2;
|
||||
int rx_option(int id, int otherwise);
|
||||
if (env == -2) {
|
||||
const char *e = getenv("HOS_FPS_STEADY");
|
||||
env = e && *e ? atoi(e) : -1;
|
||||
}
|
||||
int v = env >= 0 ? env : rx_option(HOS_OPT_STEADY_ROW, -1);
|
||||
if (v < 0) {
|
||||
if (file == -2) file = hos_ini_option("steady_frame_rate", PACE_STEADY_OFF);
|
||||
v = file;
|
||||
}
|
||||
return v < PACE_STEADY_OFF || v > PACE_STEADY_REFRESH ? PACE_STEADY_OFF : v;
|
||||
}
|
||||
static void movie_pace_decide(void) {
|
||||
static int on = -1, steady = -1;
|
||||
static long long raised;
|
||||
@@ -374,11 +392,7 @@ static void movie_pace_decide(void) {
|
||||
hos_log("vi: no movie pacing in a run that records or plays an input recording (HOS_INPUT_RECORD, HOS_INPUT_PLAY)");
|
||||
}
|
||||
}
|
||||
if (steady < 0) { /* (the Steady frame rate row, read as steady_period reads it) */
|
||||
const char *e = getenv("HOS_FPS_STEADY");
|
||||
steady = e && *e ? atoi(e) : hos_ini_option("steady_frame_rate", PACE_STEADY_OFF);
|
||||
if (steady < PACE_STEADY_OFF || steady > PACE_STEADY_REFRESH) steady = PACE_STEADY_OFF;
|
||||
}
|
||||
steady = steady_mode(); /* (the Steady frame rate row, read as steady_period reads it: ((Triforce, 11-26)) each present) */
|
||||
const int raise = movie_pace_raise(on, fps_max(), steady != PACE_STEADY_OFF, movie_plays());
|
||||
if (raise && !movie_raise)
|
||||
hos_log("vi: a movie plays at the 60 cap: frames paced at %d while it does (HOS_MOVIE_PACE=0: the cap kept)", MOVIE_PACE_FPS);
|
||||
@@ -631,6 +645,9 @@ static int realtime_rate(double ratio, int maximum, double *carry) {
|
||||
}
|
||||
static void realtime_step(int64_t now) {
|
||||
int rx_option(int id, int otherwise);
|
||||
/* ((Triforce, 11-26) the menu's Render resolution Auto as applied: 1 Auto (the game's dynamic path), 0 a fixed scale, -1
|
||||
before the renderer answers */
|
||||
static int res_dyn = -1;
|
||||
/* (Resolution 100% from the start once came out black (the dynamic block's fields unset), so the dynamic path ran 30
|
||||
frames first. Those frames left the 3D at the controller's size, 60% of 1440p (1536x864, then the game's network to
|
||||
2048x1152), whatever the fixed scale said. 11-08: from the first frame, as EvilOOT's Max Resolution patch, the 3D
|
||||
@@ -645,12 +662,17 @@ static void realtime_step(int64_t now) {
|
||||
frame++;
|
||||
const int pulsed = pulse >= 0 && frame >= pulse && frame < pulse + 240;
|
||||
if (pulse >= 0 && (frame == pulse || frame == pulse + 240)) hos_log("vi: resolution pulse: %s at frame %lld", pulsed ? "Auto" : "back to fixed", frame);
|
||||
/* (the menu's Resolution is read once, at the start: switching to Auto in game ran the dynamic path, whose size the
|
||||
/* (the menu's Resolution was read once, at the start: switching to Auto in game ran the dynamic path, whose size the
|
||||
game keeps elsewhere, and 100% after it stayed at that size; putting the resolution object back did not undo it.
|
||||
Read when the renderer answers: before, rx_option gives its fallback) */
|
||||
static int dyn_at_start = -1;
|
||||
if (dyn_at_start < 0) dyn_at_start = rx_option(2, -1);
|
||||
hos_fixed_resolution = !pulsed && dyn_at_start == 0 && hos_dynres_runs >= from;
|
||||
((Triforce, 11-26) Each present now, as the menu applies it (gpu/vk/vk_menu.cpp menu_apply): the fixed path asks the
|
||||
game for its recompute while the 3D's scale is not the chosen one (nx2/oot_patches.py APPLY_NEW), and that undoes
|
||||
the dynamic path's size too. Before the renderer answers, rx_option gives its fallback: the last answer stays) */
|
||||
const int asked = rx_option(2, -1);
|
||||
if (asked >= 0 && asked != res_dyn) {
|
||||
if (res_dyn >= 0) hos_log("vi: resolution: %s from frame %lld (the menu's Apply)", asked ? "Auto, the game's dynamic path," : "fixed", frame);
|
||||
res_dyn = asked;
|
||||
}
|
||||
hos_fixed_resolution = !pulsed && res_dyn == 0 && hos_dynres_runs >= from;
|
||||
}
|
||||
{ /* (Evil Hookshot, HOS_RES_LOG=1: the resolution switch's state every 600 frames) */
|
||||
static int on = -1;
|
||||
@@ -670,13 +692,31 @@ static void realtime_step(int64_t now) {
|
||||
void hos_evil_hd_tick(int row);
|
||||
hos_evil_hd_tick(rx_option(HOS_OPT_EVIL_HD, 0));
|
||||
}
|
||||
{ /* (the Insert menu's Resolution: the fixed path's scale in 1/10000, read once at the start as the mode above;
|
||||
HOS_RES_SCALE below stays over it) */
|
||||
static int scale = -1;
|
||||
if (scale < 0) scale = rx_option(3, -1);
|
||||
if (scale > 0 && !getenv("HOS_RES_SCALE")) {
|
||||
const float v = scale / 10000.0f;
|
||||
memcpy((void *)&hos_fixed_scale_bits, &v, 4);
|
||||
{ /* (the Insert menu's Resolution: the fixed path's scale in 1/10000, ((Triforce, 11-26)) each present as the mode above,
|
||||
so the menu's Apply reaches the 3D in play; HOS_RES_SCALE below stays over it) */
|
||||
/* (host/res_follow.h: where the render targets' pool is held to its size, a 3D larger than any this run has had waits
|
||||
for the next start, and the menu says so, HOS_OPT_RES_HELD; smaller ones are taken) */
|
||||
static ResFollow follow = {-1, 0, 0};
|
||||
static int env = -1;
|
||||
if (env < 0) env = getenv("HOS_RES_SCALE") != NULL;
|
||||
if (!env) {
|
||||
extern int hos_rt_pool_pinned(void);
|
||||
void rx_option_set(int id, int value);
|
||||
const int asked = rx_option(3, -1), was = follow.scale, was_held = follow.held;
|
||||
const int pinned = asked > 0 && asked != was ? hos_rt_pool_pinned() : 0; /* (asked only when it matters) */
|
||||
const int what = res_follow(&follow, res_dyn, asked, pinned);
|
||||
if (what == RES_TAKE) {
|
||||
if (was > 0) hos_log("vi: resolution: the 3D's scale %.3f, was %.3f (the menu's Apply)", follow.scale / 10000.0, was / 10000.0);
|
||||
if (was_held) rx_option_set(HOS_OPT_RES_HELD, 0);
|
||||
const float v = follow.scale / 10000.0f;
|
||||
memcpy((void *)&hos_fixed_scale_bits, &v, 4);
|
||||
} else if (what == RES_HOLD) {
|
||||
hos_log("vi: resolution: the 3D's scale %.3f is kept for the next start: the render targets' pool is held to its "
|
||||
"size at this output, and %.3f is the largest this run has had", asked / 10000.0, follow.largest / 10000.0);
|
||||
rx_option_set(HOS_OPT_RES_HELD, asked);
|
||||
} else if (what == RES_FREE) {
|
||||
rx_option_set(HOS_OPT_RES_HELD, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -895,10 +935,20 @@ static int64_t steady_period(int64_t base, int64_t now) {
|
||||
const int64_t other = (int64_t)__atomic_exchange_n(&frame_waited_other_ns, 0, __ATOMIC_RELAXED);
|
||||
const int handed = __atomic_exchange_n(&frame_handed, 0, __ATOMIC_RELAXED) != 0;
|
||||
frame_waited_own_ns = 0, last = now;
|
||||
if (mode < 0) {
|
||||
const char *e = getenv("HOS_FPS_STEADY");
|
||||
mode = e && *e ? atoi(e) : hos_ini_option("steady_frame_rate", PACE_STEADY_OFF);
|
||||
if (mode < PACE_STEADY_OFF || mode > PACE_STEADY_REFRESH) mode = PACE_STEADY_OFF;
|
||||
{ /* ((Triforce, 11-26) the row as it is now (steady_mode): another choice in play starts its set again, from the cap, as a
|
||||
start does; Off lets the frames go at once, and the renderer no longer holds them to a Steady period */
|
||||
const int want = steady_mode();
|
||||
if (want != mode) {
|
||||
if (mode >= 0)
|
||||
hos_log("vi: steady frame rate: %s now (the Frame pacing row, in play)",
|
||||
want == PACE_STEADY_OFF ? "off" : want == PACE_STEADY_REFRESH ? "steps of the display's refresh" : "any rate");
|
||||
if (mode > PACE_STEADY_OFF) {
|
||||
pace_steady_reset(&steady);
|
||||
rx_option_set(HOS_OPT_PACE_STEADY, 0);
|
||||
}
|
||||
mode = want, cap = 0, frames = 0;
|
||||
window.n = window.frames = 0, window.own = window.other = window.held = 0, window.since = now;
|
||||
}
|
||||
}
|
||||
if (mode == PACE_STEADY_OFF) return base;
|
||||
frames++;
|
||||
|
||||
Reference in New Issue
Block a user