mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-24 03:06:51 -05:00
Decompile from asm: DseTrackEvent_SetBpm 0x02071AE0 DseTrackEvent_SetBpm2 0x02071B20 DseTrackEvent_Signal 0x0207296C SetBpm and SetBpm2 have identical bodies. The two differ only in the label their literal pool uses, so they are the same routine reached from two opcodes rather than variants of one; both are decompiled as written rather than one calling the other, because that is what the target does. They scale the sequence's tempo fade by the new bpm and divide 0x03938700 -- sixty million microseconds, i.e. one minute -- by the result to get microseconds_per_beat, guarding a zero divisor by substituting 1. The shifts type the intermediate: the tempo is read with an arithmetic shift and the product with a logical one, so the value handed to _u32_div_f is unsigned. Signal writes the stream byte to the sequence and passes it to the sequence's signal_callback with code 8, following DseTrackEvent_SetInstrument in lib/DSE/src/main_02071BF4.c, which makes the same call with a different code. The callback's four arguments -- id, code, value, callback_arg -- come from the existing function-pointer type in dse.h, not from the call site. 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>