Overdub combines several independently useful routines: whole ADPCM decode, recording-ring processing, a four-tap filter, saturating PCM mixing and whole re-encoding. The connected American V2 checks now execute those original routines together. They still stop at explicit hardware, cache and SDK arithmetic boundaries, rather than proving audible equivalence. [1]
Starting with existing BGM
Start 02030D10 sets recording byte +0x35, coded base/capacity/cursor at +0x38/+0x3C/+0x40 and clears carry count +0x60. With no existing raw bytes it clears old PCM pointer/count/rate at +0x50/+0x54/+0x58. Otherwise old sample count is (raw bytes − 4) × 2 and it claims 981,600 bytes for up to 490,800 preserved PCM samples. [1]
The alignment calculation adds thirty-two minus the remainder, including a full thirty-two bytes when already aligned. Shared-region claim 020322F4 records pointer and size in an interleaved table; release 02032374 clears its record and trims empty trailing slots. It does not free the one-megabyte backing allocation. Replacing this with arbitrary heap allocation/release would change ownership. [1]
Whole-decoder remainder
Decoder 020058B8 rounds the requested sample count down to a multiple of eight. Its remainder branch reads source +4 + rounded sample count, rather than rounded count divided by two, and copies the remainder PCM back at the destination base. A controlled twenty-sample request uses source byte offset twenty for its four-sample remainder, overwrites the first four samples and leaves its final four destination positions untouched. The tests provide explicit extra backing to observe these original reads safely. Which complete caller situations reach this branch and its intended audible result remain separate questions. [1]
Finalising and mixing
Finaliser 02030D90 derives new sample count from max(coded length − 4, 0) × 2. Full blocks are 818 samples with source advances of 409 bytes; temporary PCM is 49,080 bytes with a per-block capacity of 24,540 samples. Each block advances original ADPCM state, copies directly for equal effective counts or runs the persistent filter otherwise, then mixes against old PCM. [1]
Mixer 02030B58 adds overlaps with signed sixteen-bit saturation, copies extensions, preserves old samples beyond the new input and processes no more than destination capacity. It does not average or halve gain. The block converter decodes its complete requested ADPCM input before proportionally reducing filter input to fit a capped output, so predictor/index can advance further than the filter consumes. [1]
The full-block loop visits every block start below the logical new count, then adds a separate remainder. Logical count 820 therefore requests two full blocks and two more samples, yielding 1,638 mixed samples at equal rate. Exact counts 818 and 1,636 request one and two full blocks. This has now been reproduced with actual original codecs, filter and mixer, rather than only substituted PCM. It is recorded as original scheduling, without assigning an unverified hardware symptom. [1]
Re-encoding and release
Whole encoder 020057C8 pads to an eight-sample group and returns four header bytes plus coded data. Initialiser 02005718 tries all eighty-nine codec indices, testing the first sample and one, decoding with the mutated predictor and reset trial index, and retaining the earliest strictly lower error. It sets predictor zero and the chosen index. It leaves the fourth local header byte untouched, which the encoder subsequently copies; that stack byte is an explicit input in the checks. [1]
After encoding, the cursor moves to the coded end, old PCM ownership is released and its pointer/count cleared, then temporary PCM is released. A header-only old raw length of four claims the large region but has zero old samples; the finaliser's old-count test skips its release in the checked surrounding owners. This is a bounded ownership edge, not proof of the full UI's admission/cancellation policy. Start/capture/stop checks retain exact carry behaviour and source backing; complete recording cancellation and physical cursor/cache scheduling remain open. [1]
