mirror of
https://github.com/pret/pmd-sky.git
synced 2026-08-28 22:01:33 -05:00
Decompile from asm: DseTrackEvent_SetNoteRandomRegion 0x02072144 DseTrackEvent_SetupLfoEnvelope 0x020727C8 DseTrackEvent_UseLfo 0x02072938 SetNoteRandomRegion reads two bytes and stores the smaller in note_random_region_begin and the larger in note_random_region_end, so the pair is sorted regardless of the order it was written in. SetupLfoEnvelope and UseLfo are the indexed forms of the per-slot handlers added in the previous commit: instead of a fixed lfo_settings entry they take the index from channel + 0x61, which UseLfo also writes. That byte falls inside dse.h's field_0x5A[10], so it is spelled field_0x5A[7]; a name for it would have to come from a real pmdsky-debug sync. UseLfo needed the sub-struct bound to a pointer local. Indexing channel->lfo_settings[idx] directly folds the array's 0x74 base into each store's offset, giving strb [r1, #0x75]; the target computes the element address once, add r1, r3, #0x74 then add r1, r1, idx lsl #4, and stores at [r1, #1] and [r1, #2]. Binding struct dse_lfo_settings *lfo also reproduces the frame push the target has, which no arrangement of the indexed form did. No comments are added to any pmd-sky file. Authored by Claude (Opus 5) under human direction. Confirmed by a matching build: build/pmdsky.us/pmdsky.us.nds: OK. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>