Files
Xenia-Canary/src/xenia/cpu/cpu_flags.cc
MechaCat02 201553aea3
Some checks failed
Orchestrator / Commit Message Validation (push) Has been skipped
Orchestrator / Lint (push) Failing after 1m52s
Orchestrator / Windows (x86-64) (push) Has been skipped
Orchestrator / Linux (x86-64) (push) Has been skipped
Orchestrator / Create Release (push) Has been skipped
Instrument: file.read offset tracer + XMA-PARAM probe (voice RE)
Additive, cvar-gated instrumentation used to reverse-engineer Project
Sylpheed's cutscene-voice storage (movie -> continuous sound-stream cue
region). Default-off; no behaviour change.

- event_log.cc: MaybeEmitFileRead emits `file.read` events with the real
  NtReadFile ByteOffset (from r10), length, handle->path, and buffer VA, so a
  sound.pNN read offset can be mapped to a sound.pak TOC entry.
  Gate: --phase_a_fileio_only=true --phase_a_event_log_path=<file>.
- cpu_flags.cc: phase_a_fileio_only cvar (+ xma_param_probe).
- xma_context_new.cc: XMA-PARAM probe in XmaContextNew::Decode (the decoder the
  title actually uses) logging ctx/buffer/read-offset/channels/packets/byte_size
  /signature — to confirm which bytes get decoded for a given cutscene.

Used to produce /tmp/rt_fileio.jsonl (RT01A playthrough), which cracked the
movie->voice mapping now implemented in sylpheed-reborn. Next: run the same
file.read trace on an unbound hokyu (e.g. hokyu_LS_s03A) to resolve which
VOICE_D the game streams for the 13 manifest-unbound resupply cutscenes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 06:56:45 +02:00

91 lines
4.2 KiB
C++

/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "xenia/cpu/cpu_flags.h"
DEFINE_string(cpu, "any", "Does nothing. CPU backend [any, x64].", "CPU");
DEFINE_string(
load_module_map, "",
"Loads a .map for symbol names and to diff with the generated symbol "
"database.",
"CPU");
DEFINE_bool(disassemble_functions, false,
"Disassemble functions during generation.", "CPU");
DEFINE_bool(trace_functions, false, "Generate tracing for function statistics.",
"CPU");
DEFINE_bool(trace_function_coverage, false,
"Generate tracing for function instruction coverage statistics.",
"CPU");
DEFINE_bool(trace_function_references, false,
"Generate tracing for function address references.", "CPU");
DEFINE_bool(trace_function_data, false,
"Generate tracing for function result data.", "CPU");
DEFINE_bool(validate_hir, false,
"Perform validation checks on the HIR during compilation.", "CPU");
// https://github.com/bitsh1ft3r/Xenon/blob/091e8cd4dc4a7c697b4979eb200be7c9dee3590b/Xenon/Core/XCPU/PPU/PowerPC.h#L370
DEFINE_uint64(
pvr, 0x710700,
"Known PVR's.\n"
" 0x710200 = Used by Zephyr \n"
" 0x710300 = Used by Zephyr\n"
" 0x710500 = Used by Jasper\n"
" 0x710700 = Default\n"
" 0x710800 = Used by Corona V1 & V2\n"
"Processor version and revision number.\nBits 0 to 15 are the version "
"number.\nBits 16 to 31 are the revision number.\nNote: Some XEXs (such as "
"mfgbootlauncher.xex) may check for a value that's less than 0x710700.",
"CPU");
// Breakpoints:
DEFINE_uint64(break_on_instruction, 0,
"int3 before the given guest address is executed.", "CPU");
DEFINE_int32(break_condition_gpr, -1, "GPR compared to", "CPU");
DEFINE_uint64(break_condition_value, 0, "value compared against", "CPU");
DEFINE_string(break_condition_op, "eq", "comparison operator", "CPU");
DEFINE_bool(break_condition_truncate, true, "truncate value to 32-bits", "CPU");
DEFINE_bool(break_on_debugbreak, true, "int3 on JITed __debugbreak requests.",
"CPU");
// Phase A — expansive extraction tracing (game-data RE); see kernel/event_log.h.
// All default-off so instrument-current behaviour is unchanged when unused.
DEFINE_string(phase_a_event_log_path, "",
"Phase A: write schema-v1 JSONL event log to this path. "
"Empty (default) = disabled.",
"Audit");
DEFINE_bool(phase_a_event_log_mem_writes, false,
"Phase A: include mem.write events in the JSONL log. RESERVED — "
"not wired in this phase. Default false.",
"Audit");
DEFINE_bool(phase_a_trace_args, false,
"Phase A extraction: populate the kernel.call args (raw r3..r10) and "
"args_resolved (file I/O path/offset/length/buffer, alloc size, "
"handle names) fields, and emit file.read events. Default false.",
"Audit");
DEFINE_bool(phase_a_fileio_only, false,
"Phase A extraction (LIGHTWEIGHT): emit ONLY file opens (path) and "
"file.read events (path/offset/length) — no per-export import/kernel "
"call spam. Use to trace which sound.pak/movie bytes a title reads "
"(e.g. movie->voice mapping) without perturbing timing. Default false.",
"Audit");
DEFINE_string(phase_a_hash_probe, "",
"Phase A extraction: CSV of guest PCs — RESERVED (the HIR/emitter "
"trap that drives it is not ported to instrument-current). Inert. "
"Default empty (off).",
"Audit");
DEFINE_bool(kernel_emit_contention, false,
"Phase D Stage 1: emit `contention.observed` events. Default false "
"(zero cost when disabled). Requires --phase_a_event_log_path.",
"Audit");