mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 19:29:57 -04:00
Make F8 write a bug capture and add a test run that starts from one.
F8 now always writes a folder under logs/captures: the area, Link's position and rotation, the camera of the frame on screen and the game's own, the presented frame as a PNG, frame times around the press, the machine, the settings that differ from the defaults, the end of the log, the save, and the game's flags and texts. A note on screen names the capture. The flight recorder's F8 dump goes into the capture's folder. NX2NAVI_CAPTURE_REPLAY starts a run on a capture's settings, teleports to its area, walks Link to where he stood and puts the free camera where the camera was; tools/capture_run.py prepares the profile from the capture's save, runs it and compares the two captures. docs/bug-capture.md has the files and the steps. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bugcap.h"
|
||||
#include "cfg.h"
|
||||
#include "cfg_private.h"
|
||||
#include "discord_app.h"
|
||||
@@ -36,6 +37,7 @@ 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", "PICKUP_COUNT", "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_CHANNELS", "AUDIO_DEVICE", "AUDIO_GAME_PRIO", "AUDIO_OFF", "AUDIO_PREFILL_MS", "AUDIO_STATS",
|
||||
"BARRIER_GAME", "MESH_AHEAD", "MESH_FALLBACK", "MESH_FALLBACK_MB", "MESH_FALLBACK_WORKERS", "PROBE_MESHFB_DIR",
|
||||
"CAPTURE_AT", "CAPTURE_DIR", "CAPTURE_REPLAY", "CAPTURE_REPLAY_CAMERA", // bug captures and their replays (bugcap.c)
|
||||
"BACKGROUND_WINDOW", "BIND_A", "BIND_B", "BIND_DOWN", "BIND_L", "BIND_LCLICK", "BIND_LEFT", "BIND_LSTICK_DOWN", "BIND_LSTICK_LEFT",
|
||||
"BIND_LSTICK_RIGHT", "BIND_LSTICK_UP", "BIND_MINUS",
|
||||
"BIND_PLUS", "BIND_R", "BIND_RCLICK", "BIND_RIGHT", "BIND_RSTICK_DOWN", "BIND_RSTICK_LEFT", "BIND_RSTICK_RIGHT", "BIND_RSTICK_UP",
|
||||
@@ -1078,7 +1080,10 @@ static int find_ini(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// A replay of a bug capture (bugcap.c) runs on the capture's settings and leaves the player's nx2navi.ini as it is:
|
||||
// nothing is saved, whatever the run sets.
|
||||
int cfg_save(void) {
|
||||
if (bugcap_replay_dir()) return 1;
|
||||
if (find_ini()) return cfg_save_to(ini_path);
|
||||
__atomic_store_n(&save_ok, 0, __ATOMIC_RELEASE);
|
||||
return 0;
|
||||
@@ -1088,7 +1093,7 @@ int cfg_save(void) {
|
||||
// about 900 characters, and then the keys that are no settings of this version, which do nothing. A report's log then
|
||||
// shows which settings its run had and which of the file's lines had no effect; before, it held only the count of
|
||||
// keys, and a player who had added a line this version does not read could take it for the cause of what changed.
|
||||
static void log_file_settings(void) {
|
||||
static void log_file_settings(const char *file) {
|
||||
char line[1024];
|
||||
size_t k = 0;
|
||||
for (int i = 0; i < n_entries; i++) {
|
||||
@@ -1101,26 +1106,40 @@ static void log_file_settings(void) {
|
||||
size_t vl = strlen(value);
|
||||
if (vl > 200) vl = 200; // a long value (a list of mods) is cut: the line shows that the key is set
|
||||
if (k && k + strlen(key) + vl + 5 > 900) {
|
||||
rt_log("cfg: nx2navi.ini sets: %s", line);
|
||||
rt_log("cfg: %s sets: %s", file, line);
|
||||
k = 0;
|
||||
}
|
||||
k += (size_t)snprintf(line + k, sizeof line - k, "%s%s = %.*s", k ? ", " : "", key, (int)vl, value);
|
||||
}
|
||||
if (k) rt_log("cfg: nx2navi.ini sets: %s", line);
|
||||
if (k) rt_log("cfg: %s sets: %s", file, line);
|
||||
if (n_unknown)
|
||||
rt_log("cfg: nx2navi.ini has %d key%s that %s no setting of this version and %s nothing: %s%s", n_unknown,
|
||||
rt_log("cfg: %s has %d key%s that %s no setting of this version and %s nothing: %s%s", file, n_unknown,
|
||||
n_unknown == 1 ? "" : "s", n_unknown == 1 ? "is" : "are", n_unknown == 1 ? "does" : "do", unknown_keys,
|
||||
unknown_cut ? ", ..." : "");
|
||||
}
|
||||
|
||||
static void load_ini(void) {
|
||||
// NX2NAVI_CAPTURE_REPLAY=<a bug capture's folder>: the settings that capture was taken with (its settings.ini) stand
|
||||
// in for nx2navi.ini, which is neither read nor written in such a run; the environment still wins over them
|
||||
const char *replay = bugcap_replay_dir();
|
||||
if (replay) {
|
||||
char path[1100];
|
||||
snprintf(path, sizeof path, "%s/settings.ini", replay);
|
||||
int ok = cfg_load(path);
|
||||
rt_log(ok ? "cfg: replay of the bug capture in %s: its settings.ini (%d keys) in place of nx2navi.ini, which this run does not write"
|
||||
: "cfg: replay of the bug capture in %s: no settings.ini there, so every setting has its default (%d keys); "
|
||||
"nx2navi.ini is not read or written",
|
||||
replay, n_entries);
|
||||
if (ok) log_file_settings("the capture's settings.ini");
|
||||
return;
|
||||
}
|
||||
if (!find_ini()) return;
|
||||
if (!cfg_load(ini_path)) {
|
||||
rt_log("cfg: no settings file at %s", ini_path);
|
||||
return;
|
||||
}
|
||||
rt_log("cfg: read %s: %d keys", ini_path, n_entries);
|
||||
log_file_settings();
|
||||
log_file_settings("nx2navi.ini");
|
||||
for (int i = 0; i < n_entries; i++) {
|
||||
char var[128];
|
||||
snprintf(var, sizeof var, PREFIX "%s", entries[i].key);
|
||||
|
||||
Reference in New Issue
Block a user