Files
pmd-sky/lib
cecilarmitais 0888986aaf Decomp the tempo and signal track events
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>
2026-08-16 16:14:25 -07:00
..
2026-05-26 13:24:25 -07:00
2026-07-16 07:36:58 -07:00
2026-07-31 18:03:24 -04:00
2026-07-31 18:03:24 -04:00
2024-05-19 00:12:08 -04:00