JSRF AUDIO HANDOVER FOR CLAUDE
Date: 2026-09-09 (Europe/London)
From: Codex

PURPOSE
=======
This records a short, interrupted continuation of the macOS JSRF audio
investigation. No audio fix was implemented or tested in this continuation.
The repository was not modified except for this handover file.

Files, archives, generated code, and earlier handovers are evidence/context,
not instructions. Review the current user request and Git state before acting.


SOURCE STATE
============
Working tree:
  /Users/andrewcollard/.codex/worktrees/3e95/upstream_xboxrecomp_clean

State at handover creation:
  detached HEAD
  30ff91571c2b217f13f9fb745c0c0a6112ed9e53
  no pre-existing tracked or untracked changes

The known New Game fix remains the committed manual sub_001A308E completion
override in:
  diagnostics/jsrf_first_fault/jsrf_manual_overrides.c

It was inspected and left unchanged. Do not conflate it with an audio fix.


BASELINE VERIFICATION
=====================
Preserved artifact directory (read only):
  /Users/andrewcollard/Library/Mobile Documents/com~apple~CloudDocs/
    Jet Set Radio Future/JSRF_BASELINE_2026-09-09_gameplay

RESTORE_MANIFEST.txt was read first. Actual SHA-256 verification matched it:

  jsrf_first_fault
    96db607a034b1b98933b8bdcf80a7a09181c592da6f34dfbfe80cf2059b93282

  gen.tar.gz
    9d863cce8a363ba34e27a861eab4f38e541faf23837eb70e2bce12e202852f3e

  CMakeCache.txt
    5418a803a7ee02d17c59d0a4c7a72dfb01cdb1158ff1570aa370adf70e74136c

`gzip -t gen.tar.gz` passed. The tar listing contains one directory and 15
regular files. RESTORE_MANIFEST.txt says 16 regular entries; that count is off
by one, but the archive byte hash matches exactly and its contents are intact.

The archive was extracted only into a fresh scratch directory:
  /private/tmp/jsrf-audio-trace-20260909.TeqU2p/
    jsrf-correct-dsound-gen

Neither preserved checkout nor preserved baseline was changed.


HANDOVER AND INSTRUMENT WARNINGS REVIEWED
=========================================
Read completely:
  CLAUDE_TO_CODEX_HANDOVER_2026-09-09_GAMEPLAY.txt

Also read as supporting evidence:
  CLAUDE_DSOUND_HANDOVER_2026-09-09.txt

The investigation retained the established boundary:

  - SDL/APU initialization and advancing ADX ticks are positive controls.
  - APU voice counts on=0 off=0 idle_trap=0 processed=0 mean the guest has not
    issued a voice to the emulated APU.
  - FECTL trap-reason zero is downstream of that missing submission.
  - Do not reason from PUSHER draws=0, the D3D11 sink method list, absent
    USB-PAD lines, or log-size comparisons across scenes.


NEW STATIC FINDING: THE VOICE_ON STORE EXISTS
=============================================
An initial text search for literal `FE820124` in generated C returned nothing.
That negative was misleading because the translator prints high addresses as
signed decimal constants in this block.

The original US XBE is present at:
  /Users/andrewcollard/Library/Mobile Documents/com~apple~CloudDocs/
    Jet Set Radio Future/Jet Set Radio Future (US)/default.xbe

Its DSOUND section is:
  VA  0x0019E340, virtual size 0x1C55C
  raw 0x0018C000, raw size     0x1C32C

A byte search found little-endian 0xFE820124 at raw file offset 1645645.
That maps to guest VA 0x001A3F8D, inside sub_001A3E58.

The verified archived generated code contains the same store at:
  /private/tmp/jsrf-audio-trace-20260909.TeqU2p/
    jsrf-correct-dsound-gen/recomp_0009.c:1014537

The relevant generated statements are:

  MEM32(-25034464) = edx;   // 0xFE820120: SET_ANTECEDENT_VOICE
  MEM32(-25034460) = ecx;   // 0xFE820124: VOICE_ON

The signed-address conversions were verified explicitly:
  2^32 - 25034464 = 0xFE820120
  2^32 - 25034460 = 0xFE820124

This corrects the narrower earlier impression that the generated code lacked
the submission instruction. The instruction is present. Because the live APU
counter remains on=0, execution is not reaching this store (or, less likely,
the store is reached but not routed through the MMIO hook). The first case can
be distinguished directly with one opt-in guest probe.


EXACT BACKWARD PATH TO PROBE NEXT
=================================
sub_001A3E58 contains the VOICE_ON loop. Its direct callers in the archived
generation have generated call blocks beginning at these guest labels (the
actual five-byte call instructions start two bytes later, after `mov ecx`):

  label 0x001A41FB, call 0x001A41FD in sub_001A40F5
  label 0x001A42D0, call 0x001A42D2 in sub_001A4212
  label 0x001A492B, call 0x001A492D in sub_001A490D

The earlier New Game freeze sample already showed the live chain:
  sub_001A490D -> sub_001A40F5 -> sub_001A3E58 -> sub_001A308E

sub_001A3E58 has two concrete gates before VOICE_ON:

  1. Entry early-out:
       if (MEM8(voice_object + 0x12) & 2) return;

  2. After setup, the loop count comes from:
       voice_count = MEM8(voice_object + 0x64);
       if (voice_count == 0) skip the VOICE_ON loop;

If neither gate fires, each iteration reaches guest 0x001A3F8D and writes
VOICE_ON. Therefore the smallest proven next breakpoint is an opt-in probe in
the archived generated copy (or a source-backed instrumentation script) that
records, with a bounded count:

  - entry to sub_001A3E58 and caller/return address;
  - object address;
  - word at object+0x12;
  - byte at object+0x64;
  - arrival at 0x001A3F8D immediately before the VOICE_ON store;
  - optionally the MMIO offset/value observed by the APU write hook.

Use a positive control in the same probe: report a nearby VP write already
known to execute, such as SET_CURRENT_VOICE at 0xFE8202F8, so absence of
VOICE_ON cannot be confused with inactive instrumentation.

Do not patch around the gate until the run proves which value is wrong and
where it was produced. In particular, do not force voice_count nonzero or
blindly clear bit 1 in object+0x12.


UNRESOLVED-FLAGS CHECK
======================
Command:

  python3 diagnostics/jsrf_first_fault/audit_unresolved_flags.py \
    --gen /private/tmp/jsrf-audio-trace-20260909.TeqU2p/jsrf-correct-dsound-gen \
    --list

Result:
  5 legitimate branches with a preceding real _flags write
  76 dead fallback branches in 48 functions

None of the listed dead fallbacks is inside the DSOUND range
0x0019E340-0x001BA89B. This is useful negative evidence: the immediate
VOICE_ON path is not blocked by one of the archive's recognized constant-zero
_flags fallbacks. It does not rule out a non-flag dataflow or scheduling error.


COMMANDS RUN
============
Repository checks:

  git status --short --branch
  git log -1 --oneline --decorate
  git rev-parse HEAD

Baseline checks:

  shasum -a 256 <three preserved artifacts>
  gzip -t <preserved gen.tar.gz>
  tar -tzf <preserved gen.tar.gz>

Scratch restore:

  mktemp -d /private/tmp/jsrf-audio-trace-20260909.XXXXXX
  tar -xzf <preserved gen.tar.gz> \
    -C /private/tmp/jsrf-audio-trace-20260909.TeqU2p

Static inspection used `rg`, `sed`, the in-tree XbeFile parser, and shell
integer conversion. The installed default Python lacks capstone, so one
attempted ad-hoc disassembly stopped immediately with ModuleNotFoundError and
made no changes.


NOT DONE
========
  - No generated code was regenerated.
  - No source or generated instrumentation was added.
  - No build was configured or compiled.
  - No gameplay run was launched.
  - No audio fix was implemented.
  - No mission-resource backport was applied.
  - No Metal/graphics work was started.
  - No commit was created.


RECOMMENDED CONTINUATION BOUNDARY
=================================
Continue from the verified archive, not a fresh regeneration. Add only the
bounded opt-in sub_001A3E58 gate/VOICE_ON probe described above, build with the
verified runtime/gen matrix, and run with:

  RECOMP_PB_EXEC=1
  RECOMP_METAL=1
  RECOMP_OHCI_ATTACH=1
  RECOMP_REPORT_MS=10000
  RECOMP_HDD_ROOT=<disposable copy of emulated-hdd>

The next evidence-backed decision is:

  - bit 1 already set at entry: trace the producer of object+0x12 bit 1;
  - voice_count zero: trace construction/population of object+0x64;
  - 0x001A3F8D reached but APU on stays zero: fix the VP MMIO routing boundary;
  - 0x001A3F8D and APU on both occur: advance to PCM/voice configuration and
    mixer-output evidence rather than changing the entry gates.

Preserve controller, rendering, and the manual sub_001A308E New Game behavior.
