mirror of
https://github.com/pret/pmd-sky.git
synced 2026-08-20 01:25:24 -05:00
Use the established parameter names for the arm9 DSE handlers
The eleven handlers decompiled in the two previous commits used (position, seq, track, channel). The handlers already landed in lib/DSE/src/main_02071A98.c, which are the same dispatch family reached from the same SMD_EVENTS_FUN_TABLE, use (ptr_next_byte, sequence, track, channel). This renames the arm9 ones to match so the family reads consistently, and follows the existing pointer spelling for the sub-loop local. Parameter names do not affect code generation; the rebuild below is to confirm that rather than to assume it. 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>
This commit is contained in:
@@ -6,13 +6,13 @@
|
||||
s32 DseVoice_CountNumActiveInChannel(struct dse_channel* channel);
|
||||
void DseChannel_DeallocateVoices(struct dse_channel* channel);
|
||||
|
||||
u8* DseTrackEvent_Invalid(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_WaitSame(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_WaitDelta(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_Wait8(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_Wait16(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_Wait24(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_WaitUntilFadeout(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_EndTrack(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_Invalid(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_WaitSame(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_WaitDelta(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_Wait8(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_Wait16(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_Wait24(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_WaitUntilFadeout(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_EndTrack(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "dse.h"
|
||||
|
||||
u8* DseTrackEvent_MainLoopBegin(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_SubLoopBegin(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_SubLoopEnd(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel);
|
||||
u8* DseTrackEvent_MainLoopBegin(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_SubLoopBegin(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_SubLoopEnd(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
#include "main_0207191C.h"
|
||||
|
||||
u8* DseTrackEvent_Invalid(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_Invalid(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->is_playing = FALSE;
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_WaitSame(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_WaitSame(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->wait_ticks_left = track->previous_wait_ticks;
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_WaitDelta(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_WaitDelta(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->previous_wait_ticks += *(s8*)position++;
|
||||
track->previous_wait_ticks += *(s8 *)ptr_next_byte++;
|
||||
track->wait_ticks_left = track->previous_wait_ticks;
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_Wait8(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_Wait8(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->previous_wait_ticks = *position++;
|
||||
track->previous_wait_ticks = *ptr_next_byte++;
|
||||
track->wait_ticks_left = track->previous_wait_ticks;
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_Wait16(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_Wait16(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->previous_wait_ticks = position[0] + (position[1] << 8);
|
||||
position += 2;
|
||||
track->previous_wait_ticks = ptr_next_byte[0] + (ptr_next_byte[1] << 8);
|
||||
ptr_next_byte += 2;
|
||||
track->wait_ticks_left = track->previous_wait_ticks;
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_Wait24(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_Wait24(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->previous_wait_ticks = position[0] + (position[1] << 8) + (position[2] << 16);
|
||||
position += 3;
|
||||
track->previous_wait_ticks = ptr_next_byte[0] + (ptr_next_byte[1] << 8) + (ptr_next_byte[2] << 16);
|
||||
ptr_next_byte += 3;
|
||||
track->wait_ticks_left = track->previous_wait_ticks;
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_WaitUntilFadeout(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_WaitUntilFadeout(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
if (DseVoice_CountNumActiveInChannel(channel) > 0) {
|
||||
track->wait_ticks_left = *position;
|
||||
position--;
|
||||
track->wait_ticks_left = *ptr_next_byte;
|
||||
ptr_next_byte--;
|
||||
} else {
|
||||
position++;
|
||||
ptr_next_byte++;
|
||||
}
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_EndTrack(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_EndTrack(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
if (track->loop_start == NULL) {
|
||||
track->is_playing = FALSE;
|
||||
position--;
|
||||
ptr_next_byte--;
|
||||
DseChannel_DeallocateVoices(channel);
|
||||
} else {
|
||||
track->main_loop_count++;
|
||||
seq->field_0x0.has_looped = TRUE;
|
||||
position = track->loop_start;
|
||||
sequence->field_0x0.has_looped = TRUE;
|
||||
ptr_next_byte = track->loop_start;
|
||||
}
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
#include "main_02071A14.h"
|
||||
|
||||
u8* DseTrackEvent_MainLoopBegin(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_MainLoopBegin(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->loop_start = position;
|
||||
return position;
|
||||
track->loop_start = ptr_next_byte;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_SubLoopBegin(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_SubLoopBegin(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
u8 idx = track->loop_stack_index;
|
||||
u8 count = *position++;
|
||||
struct dse_sub_loop* loop = &track->loop_stack[idx];
|
||||
u8 count = *ptr_next_byte++;
|
||||
struct dse_sub_loop *loop = &track->loop_stack[idx];
|
||||
|
||||
loop->start = position;
|
||||
loop->start = ptr_next_byte;
|
||||
loop->end = NULL;
|
||||
loop->count = count;
|
||||
loop->octave = track->current_octave;
|
||||
track->loop_stack_index = idx + 1;
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_SubLoopEnd(u8* position, struct dse_sequence* seq, struct dse_track* track, struct dse_channel* channel)
|
||||
u8* DseTrackEvent_SubLoopEnd(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
int idx = track->loop_stack_index - 1;
|
||||
struct dse_sub_loop* loop = &track->loop_stack[idx];
|
||||
struct dse_sub_loop *loop = &track->loop_stack[idx];
|
||||
int count = loop->count - 1;
|
||||
|
||||
if (count != 0) {
|
||||
loop->end = position;
|
||||
loop->end = ptr_next_byte;
|
||||
loop->count = count;
|
||||
track->current_octave = loop->octave;
|
||||
return loop->start;
|
||||
}
|
||||
track->loop_stack_index = idx;
|
||||
return position;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user