mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-17 11:29:58 -04:00
Make a moving floor carry Link above 100 fps as it does at 60 (set ofollow, floor_carry = 1).
The character controller's three follow-surface modules kept only a tenth of the floor's velocity whenever the physics' inverse step passed 100, which every update above 100 fps did. The gate now compares with 100 over frames per update from the patch page above 60 fps, and with the game's 100 at 60 and 30 fps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ static int save_ok = 1; // the last cfg_save_to wrote (o
|
||||
// Every name the runtime reads (and the patch sets in generated/), without the prefix. A file key outside this list is
|
||||
// logged as unknown. A new variable goes here too, or its ini key logs a harmless "unknown key" line.
|
||||
static const char *const known[] = {
|
||||
"CORES", "TM_DISPATCH", "NVN2_CS_TABLE", "SKIP_SHADERS", "MOVIE_DEBAND", "MOVIE_FPS", "MOVIE_SKIP", "MOVIE_OVERLAY", "MOVIES", "NPLN", "NVN2_PROGRAMS", "NVN_TRAP", "OCARINA_REALTIME", "ONESHOT_BUDGET", "ONESHOT_WAIT_MS", "OCARINA_STEP", "PHYSICS_STEPS", "PHYSICS_STEPS_FULL", "PICKUP_COUNT", "WATER_STEPS", "SOUND_STEPS", "FLOOR_PROBE", "FLOOR_SCAN", "MOVIE_PTS", "STEP_STEADY", "VI_HZ", "VI_VRR", "TIME_DUMP", "SHADER_DUMP", "SHOT_AFTER", "SHOT_DIR", "SHOT_EVERY", // Switch 2 port: movie skip (romfs.c), NVN2 proc traps (nvn_procs.c)
|
||||
"CORES", "TM_DISPATCH", "NVN2_CS_TABLE", "SKIP_SHADERS", "MOVIE_DEBAND", "MOVIE_FPS", "MOVIE_SKIP", "MOVIE_OVERLAY", "MOVIES", "NPLN", "NVN2_PROGRAMS", "NVN_TRAP", "OCARINA_REALTIME", "ONESHOT_BUDGET", "ONESHOT_WAIT_MS", "OCARINA_STEP", "PHYSICS_STEPS", "PHYSICS_STEPS_FULL", "PICKUP_COUNT", "WATER_STEPS", "SOUND_STEPS", "FLOOR_PROBE", "FLOOR_SCAN", "FLOOR_CARRY", "MOVIE_PTS", "STEP_STEADY", "VI_HZ", "VI_VRR", "TIME_DUMP", "SHADER_DUMP", "SHOT_AFTER", "SHOT_DIR", "SHOT_EVERY", // Switch 2 port: movie skip (romfs.c), NVN2 proc traps (nvn_procs.c)
|
||||
"AA", "AA_LOG", "AB", "AMIIBO_DIR", "ANISO", "APP_POOL", "ASPECT", "ASPECT_PATCH", "ASSUME_FOCUS", "ASTC", "ASTC_BC", "ASTC_TIME", "ASYNC_PREEMPT", "AUDIO", "AUDIO_CATCHUP", "AUDIO_CHANNELS", "AUDIO_DEVICE", "AUDIO_GAME_PRIO", "AUDIO_OFF", "AUDIO_PREFILL_MS", "AUDIO_RAMP", "AUDIO_STATS",
|
||||
"BARRIER_GAME", "MESH_AHEAD", "MESH_FALLBACK", "MESH_FALLBACK_MB", "MESH_FALLBACK_WORKERS", "PROBE_MESHFB_DIR",
|
||||
"BACKGROUND_WINDOW", "BIND_A", "BIND_B", "BIND_DOWN", "BIND_L", "BIND_LCLICK", "BIND_LEFT", "BIND_LSTICK_DOWN", "BIND_LSTICK_LEFT",
|
||||
@@ -104,7 +104,7 @@ static const struct { const char *key, *section; } sections[] = {
|
||||
{"FPS_LIMIT", "frame rate"}, {"FPS60", "frame rate"}, {"RTSS", "frame rate"},
|
||||
{"REALTIME", "frame rate"}, {"CLOTH_REALTIME", "frame rate"}, {"HIGHFPS_FIX", "frame rate"},
|
||||
{"PHYSICS_STEPS", "frame rate"}, {"PICKUP_COUNT", "frame rate"}, {"WATER_STEPS", "frame rate"},
|
||||
{"SOUND_STEPS", "frame rate"},
|
||||
{"SOUND_STEPS", "frame rate"}, {"FLOOR_CARRY", "frame rate"},
|
||||
{"MOVIE_PTS", "frame rate"}, {"STEP_STEADY", "frame rate"},
|
||||
{"FULLSCREEN", "display"}, {"WINDOW_SIZE", "display"}, {"PERF_OVERLAY", "display"}, {"VK_PRESENT", "display"},
|
||||
{"GPU_INDEX", "display"}, {"MONITOR", "display"}, {"OUTPUT_RES", "display"}, {"GAME_ASPECT", "display"}, {"GAME_RES", "display"}, {"RENDER_SCALE", "display"}, {"UPSCALER", "display"},
|
||||
@@ -243,6 +243,9 @@ static const CfgMeta metas[] = {
|
||||
{"WATER_STEPS", "1", "0|1", RESTART},
|
||||
// the set osound of patches-v111.txt (frame_rate.c frame_rate_sound_gate_host): the sound job at 60 Hz above 60 fps
|
||||
{"SOUND_STEPS", "1", "0|1", RESTART},
|
||||
// the set ofollow of patches-v111.txt (frame_rate.c floor_carry_store): a moving floor carries a character above
|
||||
// 100 fps as at 60
|
||||
{"FLOOR_CARRY", "1", "0|1", RESTART},
|
||||
// frame_rate.c floor_probe: lines about Link on a moving floor (0 off, 1 = 4000 lines, or a count)
|
||||
{"FLOOR_PROBE", "0", NULL, RESTART},
|
||||
// frame_rate.c floor_scan: finds the moving floor under Link in guest memory (0 off, 1 = 20000 lines, or a count)
|
||||
|
||||
@@ -68,6 +68,20 @@ static _Atomic uint64_t *step_word; // patch page +0: ratio (low float), secon
|
||||
static double step_now = STEP_FIRST_S; // the step the patch page holds: what the game steps each frame
|
||||
static _Atomic uint32_t *step_interval; // patch page +8: seconds * 60 (patches-v143.txt realtime)
|
||||
static _Atomic uint32_t *ostep_page; // patch page +256 with the set ostep: frames per update (patches-v111.txt)
|
||||
static _Atomic uint32_t *carry_page; // patch page +260 with the set ofollow: 100 / frames per update
|
||||
|
||||
// The set ofollow (patches-v111.txt): the three follow-surface modules of the character controller keep only a tenth
|
||||
// of the supporting floor's velocity when the physics' inverse step is over the number at page +260. The game compares
|
||||
// with 100, which the inverse step passed at every update above 100 fps; under one frame per update 100 / frames per
|
||||
// update makes the cut come where it came at 60 fps. At one frame or more it stays 100, so 60 and 30 fps keep the
|
||||
// game's own cut. Written with frames per update (ocarina_step_write).
|
||||
static void floor_carry_store(float frames) {
|
||||
if (!carry_page || !(frames > 0)) return;
|
||||
float cut = frames < 1.0f ? 100.0f / frames : 100.0f;
|
||||
uint32_t bits;
|
||||
memcpy(&bits, &cut, 4);
|
||||
atomic_store_explicit(carry_page, bits, memory_order_release);
|
||||
}
|
||||
static uint64_t last_ns;
|
||||
static double samples[STEP_SAMPLES];
|
||||
static unsigned sample_count, sample_next;
|
||||
@@ -96,6 +110,13 @@ void frame_step_init(void) {
|
||||
atomic_store_explicit(ostep_page, bits, memory_order_release);
|
||||
rt_log("frame rate: the game's frames per update follow the display interval (set ostep)");
|
||||
}
|
||||
int follow = rt_patch_set("ofollow");
|
||||
if (follow >= 0) {
|
||||
carry_page = (_Atomic uint32_t *)((uint8_t *)rt_patch_page() + 260);
|
||||
floor_carry_store(1.0f);
|
||||
rt_log("frame rate: a moving floor carries a character as at 60 fps: %s",
|
||||
rt_patch_enabled(follow) ? "on (set ofollow)" : "off, the game's cut above 100 fps (floor_carry = 0)");
|
||||
}
|
||||
// physics_steps (patches-v111.txt osolver and osolverfull): 0 the game's solver step count, trunc(frames per update
|
||||
// * 4 + 0.001); 1 (the default) that count rounded up; 2 rounded up and at least the 4 of a 60 Hz frame, every
|
||||
// update. The two sets patch the same words; this start keeps one of them on.
|
||||
@@ -725,6 +746,7 @@ static void ocarina_step_write(double dt) {
|
||||
uint32_t bits;
|
||||
memcpy(&bits, &f, 4);
|
||||
atomic_store_explicit(ostep_page, bits, memory_order_release);
|
||||
floor_carry_store(f);
|
||||
ostep_last = f;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user