mirror of
https://github.com/pret/pmd-sky.git
synced 2026-08-26 20:59:05 -05:00
Decomp six DSE track-event handlers in lib/DSE
Decompile from asm: DseTrackEvent_SetOctave 0x02071AC0 DseTrackEvent_OctaveDelta 0x02071ACC DseTrackEvent_SetTuningJitterAmplitude 0x0207216C DseTrackEvent_SetUnknown2 0x020721B0 DseTrackEvent_SetKeyBendRange 0x020721C8 DseTrackEvent_Dummy2Bytes2 0x0207299C These are the same handler family as the previous two commits, but they live in lib/DSE, which is compiled with different flags: -O4,p and -enum int, where the arm9 modules use -O4,s and -enum min. Signatures follow the parameter names already used by the landed handlers in lib/DSE/src/main_02071A98.c rather than the ones the previous two commits introduced. Field names come from struct dse_channel in lib/DSE/include/dse.h and match the offsets the asm uses: bend_jitter_amplitude at 0xa, field_0x56 at 0x56, and bend_sensitivity_override at 0x59, whose meaning agrees with SetKeyBendRange writing to it. SetTuningJitterAmplitude and SetUnknown2 read their two operand bytes in opposite orders -- little-endian for the first, big-endian for the second -- which the asm's shift operands show directly. Landing these needed two adjustments the arm9 path does not. extract_function.py hardcodes asm/, src/, include/ and main.lsf, so it was run with lib/DSE as the working directory; the object lines it then inserts into main.lsf carry no lib/DSE/ prefix and were corrected by hand. It also emits .include "main_XXXX.inc", which is right for arm9 where the search path is ./asm/include, but lib asm is built with -Ilib/DSE/asm/ and its existing files use .include "include/main_XXXX.inc"; the four split files were fixed to match. 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:
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
.public _u32_div_f
|
||||
.public DseChannel_SetBank
|
||||
.public _u32_div_f
|
||||
@@ -1,41 +1,2 @@
|
||||
#pragma once
|
||||
.public _020B0D50
|
||||
.public _020B1310
|
||||
.public _020B1394
|
||||
.public _022B7370
|
||||
.public _022B7988
|
||||
.public _022B7A30
|
||||
.public _022B7A6C
|
||||
.public _022B8330
|
||||
.public _022B9584
|
||||
.public _s32_div_f
|
||||
.public DRIVER_WORK
|
||||
.public DseMem_Allocate
|
||||
.public DseMem_Free
|
||||
.public DseSwd_GetBankById
|
||||
.public DseSwd_GetInstrument
|
||||
.public DseSwd_GetNextSplitInRange
|
||||
.public DseUtil_GetRandomNumber
|
||||
.public ReadWaviEntry
|
||||
.public Snd_GetChannelStatus
|
||||
.public Snd_SetChannelPan
|
||||
.public Snd_SetChannelTimer
|
||||
.public Snd_SetChannelVolume
|
||||
.public Snd_SetupChannelNoise
|
||||
.public Snd_SetupChannelPcm
|
||||
.public Snd_SetupChannelPsg
|
||||
.public Snd_StartTimer
|
||||
.public Snd_StopTimer
|
||||
.public SoundEnvelope_Release
|
||||
.public SoundEnvelope_Reset
|
||||
.public SoundEnvelope_SetParameters
|
||||
.public SoundEnvelope_Stop
|
||||
.public SoundEnvelope_Stop2
|
||||
.public SoundEnvelope_Tick
|
||||
.public SoundEnvelopeParameters_CheckValidity
|
||||
.public SoundEnvelopeParameters_Reset
|
||||
.public SoundLfoBank_Reset
|
||||
.public SoundLfoBank_Set
|
||||
.public SoundLfoBank_SetConstEnvelopes
|
||||
.public SoundLfoBank_Tick
|
||||
.public UpdateTrackVolumeEnvelopes
|
||||
|
||||
2
lib/DSE/asm/include/main_02072184.inc
Normal file
2
lib/DSE/asm/include/main_02072184.inc
Normal file
@@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
.public DseChannel_SetKeyBend
|
||||
2
lib/DSE/asm/include/main_020721D4.inc
Normal file
2
lib/DSE/asm/include/main_020721D4.inc
Normal file
@@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
.public _s32_div_f
|
||||
41
lib/DSE/asm/include/main_020729A4.inc
Normal file
41
lib/DSE/asm/include/main_020729A4.inc
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
.public DRIVER_WORK
|
||||
.public DseMem_Allocate
|
||||
.public DseMem_Free
|
||||
.public DseSwd_GetBankById
|
||||
.public DseSwd_GetInstrument
|
||||
.public DseSwd_GetNextSplitInRange
|
||||
.public DseUtil_GetRandomNumber
|
||||
.public ReadWaviEntry
|
||||
.public Snd_GetChannelStatus
|
||||
.public Snd_SetChannelPan
|
||||
.public Snd_SetChannelTimer
|
||||
.public Snd_SetChannelVolume
|
||||
.public Snd_SetupChannelNoise
|
||||
.public Snd_SetupChannelPcm
|
||||
.public Snd_SetupChannelPsg
|
||||
.public Snd_StartTimer
|
||||
.public Snd_StopTimer
|
||||
.public SoundEnvelopeParameters_CheckValidity
|
||||
.public SoundEnvelopeParameters_Reset
|
||||
.public SoundEnvelope_Release
|
||||
.public SoundEnvelope_Reset
|
||||
.public SoundEnvelope_SetParameters
|
||||
.public SoundEnvelope_Stop
|
||||
.public SoundEnvelope_Stop2
|
||||
.public SoundEnvelope_Tick
|
||||
.public SoundLfoBank_Reset
|
||||
.public SoundLfoBank_Set
|
||||
.public SoundLfoBank_SetConstEnvelopes
|
||||
.public SoundLfoBank_Tick
|
||||
.public UpdateTrackVolumeEnvelopes
|
||||
.public _020B0D50
|
||||
.public _020B1310
|
||||
.public _020B1394
|
||||
.public _022B7370
|
||||
.public _022B7988
|
||||
.public _022B7A30
|
||||
.public _022B7A6C
|
||||
.public _022B8330
|
||||
.public _022B9584
|
||||
.public _s32_div_f
|
||||
@@ -1,26 +1,10 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "include/main_02071AC0.inc"
|
||||
.include "include/main_02071AE0.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DseTrackEvent_SetOctave
|
||||
DseTrackEvent_SetOctave: ; 0x02071AC0
|
||||
ldrb r1, [r0], #1
|
||||
strb r1, [r2, #4]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_SetOctave
|
||||
|
||||
arm_func_start DseTrackEvent_OctaveDelta
|
||||
DseTrackEvent_OctaveDelta: ; 0x02071ACC
|
||||
ldrb r3, [r2, #4]
|
||||
ldrsb r1, [r0], #1
|
||||
add r1, r3, r1
|
||||
strb r1, [r2, #4]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_OctaveDelta
|
||||
|
||||
arm_func_start DseTrackEvent_SetBpm
|
||||
DseTrackEvent_SetBpm: ; 0x02071AE0
|
||||
DseTrackEvent_SetBpm:
|
||||
stmdb sp!, {r4, r5, r6, lr}
|
||||
mov r6, r0
|
||||
mov r5, r1
|
||||
@@ -29,7 +13,7 @@ DseTrackEvent_SetBpm: ; 0x02071AE0
|
||||
mov r0, r0, asr #0x10
|
||||
mul r1, r0, r4
|
||||
movs r1, r1, lsr #8
|
||||
ldr r0, _02071B1C ; =0x03938700
|
||||
ldr r0, _02071B1C
|
||||
moveq r1, #1
|
||||
bl _u32_div_f
|
||||
str r0, [r5, #0x44]
|
||||
@@ -41,7 +25,7 @@ _02071B1C: .word 0x03938700
|
||||
arm_func_end DseTrackEvent_SetBpm
|
||||
|
||||
arm_func_start DseTrackEvent_SetBpm2
|
||||
DseTrackEvent_SetBpm2: ; 0x02071B20
|
||||
DseTrackEvent_SetBpm2:
|
||||
stmdb sp!, {r4, r5, r6, lr}
|
||||
mov r6, r0
|
||||
mov r5, r1
|
||||
@@ -50,7 +34,7 @@ DseTrackEvent_SetBpm2: ; 0x02071B20
|
||||
mov r0, r0, asr #0x10
|
||||
mul r1, r0, r4
|
||||
movs r1, r1, lsr #8
|
||||
ldr r0, _02071B5C ; =0x03938700
|
||||
ldr r0, _02071B5C
|
||||
moveq r1, #1
|
||||
bl _u32_div_f
|
||||
str r0, [r5, #0x44]
|
||||
@@ -62,7 +46,7 @@ _02071B5C: .word 0x03938700
|
||||
arm_func_end DseTrackEvent_SetBpm2
|
||||
|
||||
arm_func_start DseTrackEvent_SetBank
|
||||
DseTrackEvent_SetBank: ; 0x02071B60
|
||||
DseTrackEvent_SetBank:
|
||||
stmdb sp!, {r4, lr}
|
||||
mov r4, r0
|
||||
ldrb r2, [r4]
|
||||
@@ -77,7 +61,7 @@ DseTrackEvent_SetBank: ; 0x02071B60
|
||||
arm_func_end DseTrackEvent_SetBank
|
||||
|
||||
arm_func_start DseTrackEvent_SetBankMsb
|
||||
DseTrackEvent_SetBankMsb: ; 0x02071B8C
|
||||
DseTrackEvent_SetBankMsb:
|
||||
stmdb sp!, {r4, lr}
|
||||
mov r4, r0
|
||||
ldrh r1, [r3, #0xe]
|
||||
File diff suppressed because it is too large
Load Diff
19
lib/DSE/asm/main_02072184.s
Normal file
19
lib/DSE/asm/main_02072184.s
Normal file
@@ -0,0 +1,19 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "include/main_02072184.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DseTrackEvent_SetKeyBend
|
||||
DseTrackEvent_SetKeyBend: ; 0x02072184
|
||||
stmdb sp!, {r4, lr}
|
||||
mov r4, r0
|
||||
ldrb r2, [r4]
|
||||
ldrb r1, [r4, #1]
|
||||
mov r0, r3
|
||||
add r1, r1, r2, lsl #8
|
||||
mov r1, r1, lsl #0x10
|
||||
mov r1, r1, asr #0x10
|
||||
bl DseChannel_SetKeyBend
|
||||
add r0, r4, #2
|
||||
ldmia sp!, {r4, pc}
|
||||
arm_func_end DseTrackEvent_SetKeyBend
|
||||
624
lib/DSE/asm/main_020721D4.s
Normal file
624
lib/DSE/asm/main_020721D4.s
Normal file
@@ -0,0 +1,624 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "include/main_020721D4.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DseTrackEvent_SetupKeyBendLfo
|
||||
DseTrackEvent_SetupKeyBendLfo: ; 0x020721D4
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
ldrb r5, [r0]
|
||||
ldrb r4, [r0, #1]
|
||||
ldrb lr, [r0, #2]
|
||||
ldrb ip, [r0, #3]
|
||||
ldrb r2, [r0, #4]
|
||||
mov r1, #1
|
||||
add r4, r5, r4, lsl #8
|
||||
strb r1, [r3, #0x75]
|
||||
strb r1, [r3, #0x76]
|
||||
mov r1, r4, lsl #0x10
|
||||
strb r2, [r3, #0x77]
|
||||
mov r1, r1, asr #0x10
|
||||
str r1, [r3, #0x78]
|
||||
add r1, lr, ip, lsl #8
|
||||
strh r1, [r3, #0x7c]
|
||||
mov r1, #0
|
||||
strh r1, [r3, #0x7e]
|
||||
strh r1, [r3, #0x80]
|
||||
strb r1, [r3, #0x82]
|
||||
add r0, r0, #5
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end DseTrackEvent_SetupKeyBendLfo
|
||||
|
||||
arm_func_start DseTrackEvent_SetupKeyBendLfoEnvelope
|
||||
DseTrackEvent_SetupKeyBendLfoEnvelope: ; 0x0207222C
|
||||
ldrb r2, [r0]
|
||||
ldrb r1, [r0, #1]
|
||||
add r1, r2, r1, lsl #8
|
||||
strh r1, [r3, #0x7e]
|
||||
ldrb r2, [r0, #2]
|
||||
ldrb r1, [r0, #3]
|
||||
add r0, r0, #4
|
||||
add r1, r2, r1, lsl #8
|
||||
strh r1, [r3, #0x80]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_SetupKeyBendLfoEnvelope
|
||||
|
||||
arm_func_start DseTrackEvent_UseKeyBendLfo
|
||||
DseTrackEvent_UseKeyBendLfo: ; 0x02072254
|
||||
ldrb r1, [r0]
|
||||
add r0, r0, #1
|
||||
cmp r1, #2
|
||||
moveq r1, #1
|
||||
strb r1, [r3, #0x75]
|
||||
cmp r1, #0
|
||||
moveq r1, #0
|
||||
movne r1, #1
|
||||
strb r1, [r3, #0x76]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_UseKeyBendLfo
|
||||
|
||||
arm_func_start DseTrackEvent_SetVolume
|
||||
DseTrackEvent_SetVolume: ; 0x0207227C
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
ldrsb r4, [r0]
|
||||
mov r5, #0
|
||||
ldr r2, _02072308 ; =0x82061029
|
||||
mov r1, r4, lsl #0x10
|
||||
str r1, [r3, #0x34]
|
||||
str r1, [r3, #0x2c]
|
||||
strh r5, [r3, #0x38]
|
||||
ldr ip, [r3, #0xc4]
|
||||
ldrb r1, [r3, #0x50]
|
||||
ldrsb lr, [ip, #8]
|
||||
ldr ip, _0207230C ; =0x04000208
|
||||
smulbb r1, r4, r1
|
||||
mul r4, lr, r1
|
||||
smull r1, lr, r2, r4
|
||||
add lr, r4, lr
|
||||
mov r1, r4, lsr #0x1f
|
||||
add lr, r1, lr, asr #13
|
||||
strh lr, [r3, #0x18]
|
||||
ldrh r4, [ip]
|
||||
strh r5, [ip]
|
||||
ldr r2, [r3, #0xb4]
|
||||
cmp r2, #0
|
||||
beq _020722F4
|
||||
_020722DC:
|
||||
ldrh r1, [r2, #6]
|
||||
orr r1, r1, #0x20
|
||||
strh r1, [r2, #6]
|
||||
ldr r2, [r2, #0x154]
|
||||
cmp r2, #0
|
||||
bne _020722DC
|
||||
_020722F4:
|
||||
ldr r2, _0207230C ; =0x04000208
|
||||
add r0, r0, #1
|
||||
ldrh r1, [r2]
|
||||
strh r4, [r2]
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
.align 2, 0
|
||||
_02072308: .word 0x82061029
|
||||
_0207230C: .word 0x04000208
|
||||
arm_func_end DseTrackEvent_SetVolume
|
||||
|
||||
arm_func_start DseTrackEvent_VolumeDelta
|
||||
DseTrackEvent_VolumeDelta: ; 0x02072310
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
ldrsb r2, [r0]
|
||||
ldr r1, [r3, #0x2c]
|
||||
add r4, r2, r1, asr #16
|
||||
cmp r4, #0x7f
|
||||
movgt r4, #0x7f
|
||||
bgt _02072334
|
||||
cmp r4, #0
|
||||
movlt r4, #0
|
||||
_02072334:
|
||||
mov r1, r4, lsl #0x10
|
||||
str r1, [r3, #0x34]
|
||||
str r1, [r3, #0x2c]
|
||||
mov r5, #0
|
||||
strh r5, [r3, #0x38]
|
||||
ldrb r1, [r3, #0x50]
|
||||
ldr ip, [r3, #0xc4]
|
||||
ldr r2, _020723B8 ; =0x82061029
|
||||
mul r1, r4, r1
|
||||
ldrsb lr, [ip, #8]
|
||||
ldr ip, _020723BC ; =0x04000208
|
||||
mul r4, lr, r1
|
||||
smull r1, lr, r2, r4
|
||||
add lr, r4, lr
|
||||
mov r1, r4, lsr #0x1f
|
||||
add lr, r1, lr, asr #13
|
||||
strh lr, [r3, #0x18]
|
||||
ldrh r4, [ip]
|
||||
strh r5, [ip]
|
||||
ldr r2, [r3, #0xb4]
|
||||
cmp r2, #0
|
||||
beq _020723A4
|
||||
_0207238C:
|
||||
ldrh r1, [r2, #6]
|
||||
orr r1, r1, #0x20
|
||||
strh r1, [r2, #6]
|
||||
ldr r2, [r2, #0x154]
|
||||
cmp r2, #0
|
||||
bne _0207238C
|
||||
_020723A4:
|
||||
ldr r2, _020723BC ; =0x04000208
|
||||
add r0, r0, #1
|
||||
ldrh r1, [r2]
|
||||
strh r4, [r2]
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
.align 2, 0
|
||||
_020723B8: .word 0x82061029
|
||||
_020723BC: .word 0x04000208
|
||||
arm_func_end DseTrackEvent_VolumeDelta
|
||||
|
||||
arm_func_start DseTrackEvent_VolumeFade
|
||||
DseTrackEvent_VolumeFade: ; 0x020723C0
|
||||
stmdb sp!, {r4, r5, r6, lr}
|
||||
mov r5, r0
|
||||
ldrsb r1, [r5, #2]
|
||||
ldrb r2, [r5]
|
||||
ldrb r0, [r5, #1]
|
||||
mov r4, r3
|
||||
mov r1, r1, lsl #0x10
|
||||
add r0, r2, r0, lsl #8
|
||||
mov r0, r0, lsl #0x10
|
||||
str r1, [r4, #0x34]
|
||||
movs r6, r0, lsr #0x10
|
||||
streq r1, [r4, #0x2c]
|
||||
beq _02072410
|
||||
ldr r0, [r4, #0x2c]
|
||||
subs r0, r1, r0
|
||||
moveq r6, #0
|
||||
beq _02072410
|
||||
mov r1, r6
|
||||
bl _s32_div_f
|
||||
str r0, [r4, #0x30]
|
||||
_02072410:
|
||||
strh r6, [r4, #0x38]
|
||||
add r0, r5, #3
|
||||
ldmia sp!, {r4, r5, r6, pc}
|
||||
arm_func_end DseTrackEvent_VolumeFade
|
||||
|
||||
arm_func_start DseTrackEvent_SetExpression
|
||||
DseTrackEvent_SetExpression: ; 0x0207241C
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
ldrb r4, [r0]
|
||||
ldr r2, _020724A0 ; =0x82061029
|
||||
ldr lr, _020724A4 ; =0x04000208
|
||||
strb r4, [r3, #0x50]
|
||||
ldr r1, [r3, #0x2c]
|
||||
ldr ip, [r3, #0xc4]
|
||||
mov r1, r1, asr #0x10
|
||||
mul r4, r1, r4
|
||||
ldrsb r1, [ip, #8]
|
||||
mov ip, #0
|
||||
mul r4, r1, r4
|
||||
smull r1, r5, r2, r4
|
||||
add r5, r4, r5
|
||||
mov r1, r4, lsr #0x1f
|
||||
add r5, r1, r5, asr #13
|
||||
strh r5, [r3, #0x18]
|
||||
ldrh r4, [lr]
|
||||
strh ip, [lr]
|
||||
ldr r2, [r3, #0xb4]
|
||||
cmp r2, #0
|
||||
beq _0207248C
|
||||
_02072474:
|
||||
ldrh r1, [r2, #6]
|
||||
orr r1, r1, #0x20
|
||||
strh r1, [r2, #6]
|
||||
ldr r2, [r2, #0x154]
|
||||
cmp r2, #0
|
||||
bne _02072474
|
||||
_0207248C:
|
||||
ldr r2, _020724A4 ; =0x04000208
|
||||
add r0, r0, #1
|
||||
ldrh r1, [r2]
|
||||
strh r4, [r2]
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
.align 2, 0
|
||||
_020724A0: .word 0x82061029
|
||||
_020724A4: .word 0x04000208
|
||||
arm_func_end DseTrackEvent_SetExpression
|
||||
|
||||
arm_func_start DseTrackEvent_SetupVolumeLfo
|
||||
DseTrackEvent_SetupVolumeLfo: ; 0x020724A8
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
ldrb r5, [r0]
|
||||
ldrb r1, [r0, #1]
|
||||
ldrb r4, [r0, #2]
|
||||
ldrb lr, [r0, #3]
|
||||
ldrb ip, [r0, #4]
|
||||
mov r2, #1
|
||||
add r1, r5, r1, lsl #8
|
||||
mov r1, r1, lsl #0x10
|
||||
strb r2, [r3, #0x85]
|
||||
mov r2, #2
|
||||
strb r2, [r3, #0x86]
|
||||
strb ip, [r3, #0x87]
|
||||
mov r1, r1, asr #0x10
|
||||
str r1, [r3, #0x88]
|
||||
add r1, r4, lr, lsl #8
|
||||
strh r1, [r3, #0x8c]
|
||||
mov r1, #0
|
||||
strh r1, [r3, #0x8e]
|
||||
strh r1, [r3, #0x90]
|
||||
strb r1, [r3, #0x92]
|
||||
add r0, r0, #5
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end DseTrackEvent_SetupVolumeLfo
|
||||
|
||||
arm_func_start DseTrackEvent_SetupVolumeLfoEnvelope
|
||||
DseTrackEvent_SetupVolumeLfoEnvelope: ; 0x02072504
|
||||
ldrb r2, [r0]
|
||||
ldrb r1, [r0, #1]
|
||||
add r1, r2, r1, lsl #8
|
||||
strh r1, [r3, #0x8e]
|
||||
ldrb r2, [r0, #2]
|
||||
ldrb r1, [r0, #3]
|
||||
add r0, r0, #4
|
||||
add r1, r2, r1, lsl #8
|
||||
strh r1, [r3, #0x90]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_SetupVolumeLfoEnvelope
|
||||
|
||||
arm_func_start DseTrackEvent_UseVolumeLfo
|
||||
DseTrackEvent_UseVolumeLfo: ; 0x0207252C
|
||||
ldrb r1, [r0]
|
||||
add r0, r0, #1
|
||||
cmp r1, #2
|
||||
moveq r1, #1
|
||||
strb r1, [r3, #0x85]
|
||||
cmp r1, #0
|
||||
moveq r1, #0
|
||||
movne r1, #2
|
||||
strb r1, [r3, #0x86]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_UseVolumeLfo
|
||||
|
||||
arm_func_start DseTrackEvent_SetPan
|
||||
DseTrackEvent_SetPan: ; 0x02072554
|
||||
stmdb sp!, {r3, lr}
|
||||
ldrb lr, [r0]
|
||||
mov ip, #0
|
||||
cmp lr, #0x7f
|
||||
movgt lr, #0x7f
|
||||
mov r1, lr, lsl #0x10
|
||||
str r1, [r3, #0x44]
|
||||
str r1, [r3, #0x3c]
|
||||
strh ip, [r3, #0x48]
|
||||
ldr r2, [r3, #0xc4]
|
||||
ldr r1, _020725D0 ; =0x04000208
|
||||
ldrsb r2, [r2, #7]
|
||||
sub r2, r2, #0x40
|
||||
add r2, lr, r2
|
||||
strh r2, [r3, #0x1a]
|
||||
ldrh lr, [r1]
|
||||
strh ip, [r1]
|
||||
ldr r2, [r3, #0xb4]
|
||||
cmp r2, #0
|
||||
beq _020725BC
|
||||
_020725A4:
|
||||
ldrh r1, [r2, #6]
|
||||
orr r1, r1, #0x40
|
||||
strh r1, [r2, #6]
|
||||
ldr r2, [r2, #0x154]
|
||||
cmp r2, #0
|
||||
bne _020725A4
|
||||
_020725BC:
|
||||
ldr r2, _020725D0 ; =0x04000208
|
||||
add r0, r0, #1
|
||||
ldrh r1, [r2]
|
||||
strh lr, [r2]
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_020725D0: .word 0x04000208
|
||||
arm_func_end DseTrackEvent_SetPan
|
||||
|
||||
arm_func_start DseTrackEvent_PanDelta
|
||||
DseTrackEvent_PanDelta: ; 0x020725D4
|
||||
stmdb sp!, {r3, lr}
|
||||
ldrsb r2, [r0]
|
||||
ldr r1, [r3, #0x3c]
|
||||
add lr, r2, r1, asr #16
|
||||
cmp lr, #0x7f
|
||||
movgt lr, #0x7f
|
||||
bgt _020725F8
|
||||
cmp lr, #0
|
||||
movlt lr, #0
|
||||
_020725F8:
|
||||
mov r1, lr, lsl #0x10
|
||||
str r1, [r3, #0x44]
|
||||
str r1, [r3, #0x3c]
|
||||
mov ip, #0
|
||||
strh ip, [r3, #0x48]
|
||||
ldr r2, [r3, #0xc4]
|
||||
ldr r1, _02072664 ; =0x04000208
|
||||
ldrsb r2, [r2, #7]
|
||||
sub r2, r2, #0x40
|
||||
add r2, lr, r2
|
||||
strh r2, [r3, #0x1a]
|
||||
ldrh lr, [r1]
|
||||
strh ip, [r1]
|
||||
ldr r2, [r3, #0xb4]
|
||||
cmp r2, #0
|
||||
beq _02072650
|
||||
_02072638:
|
||||
ldrh r1, [r2, #6]
|
||||
orr r1, r1, #0x40
|
||||
strh r1, [r2, #6]
|
||||
ldr r2, [r2, #0x154]
|
||||
cmp r2, #0
|
||||
bne _02072638
|
||||
_02072650:
|
||||
ldr r2, _02072664 ; =0x04000208
|
||||
add r0, r0, #1
|
||||
ldrh r1, [r2]
|
||||
strh lr, [r2]
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_02072664: .word 0x04000208
|
||||
arm_func_end DseTrackEvent_PanDelta
|
||||
|
||||
arm_func_start DseTrackEvent_PanFade
|
||||
DseTrackEvent_PanFade: ; 0x02072668
|
||||
stmdb sp!, {r4, r5, r6, lr}
|
||||
mov r5, r0
|
||||
ldrsb r1, [r5, #2]
|
||||
ldrb r2, [r5]
|
||||
ldrb r0, [r5, #1]
|
||||
mov r4, r3
|
||||
mov r1, r1, lsl #0x10
|
||||
add r0, r2, r0, lsl #8
|
||||
mov r0, r0, lsl #0x10
|
||||
str r1, [r4, #0x44]
|
||||
movs r6, r0, lsr #0x10
|
||||
streq r1, [r4, #0x3c]
|
||||
beq _020726B8
|
||||
ldr r0, [r4, #0x3c]
|
||||
subs r0, r1, r0
|
||||
moveq r6, #0
|
||||
beq _020726B8
|
||||
mov r1, r6
|
||||
bl _s32_div_f
|
||||
str r0, [r4, #0x40]
|
||||
_020726B8:
|
||||
strh r6, [r4, #0x48]
|
||||
add r0, r5, #3
|
||||
ldmia sp!, {r4, r5, r6, pc}
|
||||
arm_func_end DseTrackEvent_PanFade
|
||||
|
||||
arm_func_start DseTrackEvent_SetupPanLfo
|
||||
DseTrackEvent_SetupPanLfo: ; 0x020726C4
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
ldrb r5, [r0]
|
||||
ldrb r1, [r0, #1]
|
||||
ldrb r4, [r0, #2]
|
||||
ldrb lr, [r0, #3]
|
||||
ldrb ip, [r0, #4]
|
||||
mov r2, #1
|
||||
add r1, r5, r1, lsl #8
|
||||
mov r1, r1, lsl #0x10
|
||||
strb r2, [r3, #0x95]
|
||||
mov r2, #3
|
||||
strb r2, [r3, #0x96]
|
||||
strb ip, [r3, #0x97]
|
||||
mov r1, r1, asr #0x10
|
||||
str r1, [r3, #0x98]
|
||||
add r1, r4, lr, lsl #8
|
||||
strh r1, [r3, #0x9c]
|
||||
mov r1, #0
|
||||
strh r1, [r3, #0x9e]
|
||||
strh r1, [r3, #0xa0]
|
||||
strb r1, [r3, #0xa2]
|
||||
add r0, r0, #5
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end DseTrackEvent_SetupPanLfo
|
||||
|
||||
arm_func_start DseTrackEvent_SetupPanLfoEnvelope
|
||||
DseTrackEvent_SetupPanLfoEnvelope: ; 0x02072720
|
||||
ldrb r2, [r0]
|
||||
ldrb r1, [r0, #1]
|
||||
add r1, r2, r1, lsl #8
|
||||
strh r1, [r3, #0x9e]
|
||||
ldrb r2, [r0, #2]
|
||||
ldrb r1, [r0, #3]
|
||||
add r0, r0, #4
|
||||
add r1, r2, r1, lsl #8
|
||||
strh r1, [r3, #0xa0]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_SetupPanLfoEnvelope
|
||||
|
||||
arm_func_start DseTrackEvent_UsePanLfo
|
||||
DseTrackEvent_UsePanLfo: ; 0x02072748
|
||||
ldrb r1, [r0]
|
||||
add r0, r0, #1
|
||||
cmp r1, #2
|
||||
moveq r1, #1
|
||||
strb r1, [r3, #0x95]
|
||||
cmp r1, #0
|
||||
moveq r1, #0
|
||||
movne r1, #3
|
||||
strb r1, [r3, #0x96]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_UsePanLfo
|
||||
|
||||
arm_func_start DseTrackEvent_SetupLfo
|
||||
DseTrackEvent_SetupLfo: ; 0x02072770
|
||||
stmdb sp!, {r4, lr}
|
||||
ldrb r2, [r0]
|
||||
ldrb r1, [r0, #1]
|
||||
ldrb ip, [r3, #0x61]
|
||||
add r3, r3, #0x74
|
||||
add r1, r2, r1, lsl #8
|
||||
mov r1, r1, lsl #0x10
|
||||
ldrb r4, [r0, #2]
|
||||
ldrb lr, [r0, #3]
|
||||
ldrb r2, [r0, #4]
|
||||
add r3, r3, ip, lsl #4
|
||||
mov r1, r1, asr #0x10
|
||||
strb r2, [r3, #3]
|
||||
str r1, [r3, #4]
|
||||
add r1, r4, lr, lsl #8
|
||||
strh r1, [r3, #8]
|
||||
mov r1, #0
|
||||
strh r1, [r3, #0xa]
|
||||
strh r1, [r3, #0xc]
|
||||
strb r1, [r3, #0xe]
|
||||
add r0, r0, #5
|
||||
ldmia sp!, {r4, pc}
|
||||
arm_func_end DseTrackEvent_SetupLfo
|
||||
|
||||
arm_func_start DseTrackEvent_SetupLfoEnvelope
|
||||
DseTrackEvent_SetupLfoEnvelope: ; 0x020727C8
|
||||
ldrb ip, [r3, #0x61]
|
||||
ldrb r2, [r0]
|
||||
ldrb r1, [r0, #1]
|
||||
add r3, r3, #0x74
|
||||
add r3, r3, ip, lsl #4
|
||||
add r1, r2, r1, lsl #8
|
||||
strh r1, [r3, #0xa]
|
||||
ldrb r2, [r0, #2]
|
||||
ldrb r1, [r0, #3]
|
||||
add r0, r0, #4
|
||||
add r1, r2, r1, lsl #8
|
||||
strh r1, [r3, #0xc]
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_SetupLfoEnvelope
|
||||
|
||||
arm_func_start DseTrackEvent_SetLfoParameter
|
||||
DseTrackEvent_SetLfoParameter: ; 0x020727FC
|
||||
ldrb r1, [r3, #0x61]
|
||||
ldrb ip, [r0]
|
||||
add r2, r3, #0x74
|
||||
add r1, r2, r1, lsl #4
|
||||
ldrb r2, [r0, #1]
|
||||
cmp ip, #0xa
|
||||
addls pc, pc, ip, lsl #2
|
||||
b _02072930
|
||||
_0207281C: ; jump table
|
||||
b _02072930 ; case 0
|
||||
b _02072848 ; case 1
|
||||
b _02072850 ; case 2
|
||||
b _02072858 ; case 3
|
||||
b _02072860 ; case 4
|
||||
b _02072868 ; case 5
|
||||
b _020728E0 ; case 6
|
||||
b _020728EC ; case 7
|
||||
b _020728FC ; case 8
|
||||
b _02072910 ; case 9
|
||||
b _02072924 ; case 10
|
||||
_02072848:
|
||||
strb r2, [r3, #0x61]
|
||||
b _02072930
|
||||
_02072850:
|
||||
strb r2, [r1, #1]
|
||||
b _02072930
|
||||
_02072858:
|
||||
strb r2, [r1, #2]
|
||||
b _02072930
|
||||
_02072860:
|
||||
strb r2, [r1, #3]
|
||||
b _02072930
|
||||
_02072868:
|
||||
ldrb r3, [r1, #2]
|
||||
cmp r3, #4
|
||||
addls pc, pc, r3, lsl #2
|
||||
b _020728CC
|
||||
_02072878: ; jump table
|
||||
b _020728CC ; case 0
|
||||
b _0207288C ; case 1
|
||||
b _0207289C ; case 2
|
||||
b _020728AC ; case 3
|
||||
b _020728BC ; case 4
|
||||
_0207288C:
|
||||
mov r3, #0xa
|
||||
mul r3, r2, r3
|
||||
mov r2, r3
|
||||
b _020728D8
|
||||
_0207289C:
|
||||
mvn r3, #0x13
|
||||
mul r3, r2, r3
|
||||
mov r2, r3
|
||||
b _020728D8
|
||||
_020728AC:
|
||||
mov r3, #0x14
|
||||
mul r3, r2, r3
|
||||
mov r2, r3
|
||||
b _020728D8
|
||||
_020728BC:
|
||||
mov r3, #0xa
|
||||
mul r3, r2, r3
|
||||
mov r2, r3
|
||||
b _020728D8
|
||||
_020728CC:
|
||||
mov r3, #0x14
|
||||
mul r3, r2, r3
|
||||
mov r2, r3
|
||||
_020728D8:
|
||||
str r2, [r1, #4]
|
||||
b _02072930
|
||||
_020728E0:
|
||||
add r2, r2, r2, lsl #2
|
||||
strh r2, [r1, #8]
|
||||
b _02072930
|
||||
_020728EC:
|
||||
mov r3, #0x14
|
||||
mul r3, r2, r3
|
||||
strh r3, [r1, #0xa]
|
||||
b _02072930
|
||||
_020728FC:
|
||||
ldrh r3, [r1, #0xa]
|
||||
and r3, r3, #0xff00
|
||||
orr r2, r3, r2
|
||||
strh r2, [r1, #0xa]
|
||||
b _02072930
|
||||
_02072910:
|
||||
ldrh r3, [r1, #0xa]
|
||||
and r3, r3, #0xff
|
||||
orr r2, r3, r2, lsl #8
|
||||
strh r2, [r1, #0xa]
|
||||
b _02072930
|
||||
_02072924:
|
||||
mov r3, #0x14
|
||||
mul r3, r2, r3
|
||||
strh r3, [r1, #0xc]
|
||||
_02072930:
|
||||
add r0, r0, #2
|
||||
bx lr
|
||||
arm_func_end DseTrackEvent_SetLfoParameter
|
||||
|
||||
arm_func_start DseTrackEvent_UseLfo
|
||||
DseTrackEvent_UseLfo: ; 0x02072938
|
||||
stmdb sp!, {r3, lr}
|
||||
ldrb ip, [r0, #1]
|
||||
ldrb r2, [r0]
|
||||
ldrb lr, [r0, #2]
|
||||
add r1, r3, #0x74
|
||||
cmp ip, #2
|
||||
strb r2, [r3, #0x61]
|
||||
add r1, r1, r2, lsl #4
|
||||
moveq ip, #1
|
||||
strb ip, [r1, #1]
|
||||
strb lr, [r1, #2]
|
||||
add r0, r0, #3
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end DseTrackEvent_UseLfo
|
||||
|
||||
arm_func_start DseTrackEvent_Signal
|
||||
DseTrackEvent_Signal: ; 0x0207296C
|
||||
stmdb sp!, {r4, lr}
|
||||
mov r4, r0
|
||||
ldrb r2, [r4]
|
||||
mov ip, r1
|
||||
mov r1, #8
|
||||
strb r2, [ip, #0x16]
|
||||
ldr r0, [ip, #0x28]
|
||||
ldr r3, [ip, #0xa0]
|
||||
ldr ip, [ip, #0x9c]
|
||||
blx ip
|
||||
add r0, r4, #1
|
||||
ldmia sp!, {r4, pc}
|
||||
arm_func_end DseTrackEvent_Signal
|
||||
2755
lib/DSE/asm/main_020729A4.s
Normal file
2755
lib/DSE/asm/main_020729A4.s
Normal file
File diff suppressed because it is too large
Load Diff
9
lib/DSE/include/main_02071AC0.h
Normal file
9
lib/DSE/include/main_02071AC0.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef PMDSKY_MAIN_02071AC0_H
|
||||
#define PMDSKY_MAIN_02071AC0_H
|
||||
|
||||
#include "dse.h"
|
||||
|
||||
u8* DseTrackEvent_SetOctave(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_OctaveDelta(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
|
||||
#endif
|
||||
8
lib/DSE/include/main_0207216C.h
Normal file
8
lib/DSE/include/main_0207216C.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef PMDSKY_MAIN_0207216C_H
|
||||
#define PMDSKY_MAIN_0207216C_H
|
||||
|
||||
#include "dse.h"
|
||||
|
||||
u8* DseTrackEvent_SetTuningJitterAmplitude(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
|
||||
#endif
|
||||
9
lib/DSE/include/main_020721B0.h
Normal file
9
lib/DSE/include/main_020721B0.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef PMDSKY_MAIN_020721B0_H
|
||||
#define PMDSKY_MAIN_020721B0_H
|
||||
|
||||
#include "dse.h"
|
||||
|
||||
u8* DseTrackEvent_SetUnknown2(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
u8* DseTrackEvent_SetKeyBendRange(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
|
||||
#endif
|
||||
8
lib/DSE/include/main_0207299C.h
Normal file
8
lib/DSE/include/main_0207299C.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef PMDSKY_MAIN_0207299C_H
|
||||
#define PMDSKY_MAIN_0207299C_H
|
||||
|
||||
#include "dse.h"
|
||||
|
||||
u8* DseTrackEvent_Dummy2Bytes2(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel);
|
||||
|
||||
#endif
|
||||
13
lib/DSE/src/main_02071AC0.c
Normal file
13
lib/DSE/src/main_02071AC0.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "main_02071AC0.h"
|
||||
|
||||
u8* DseTrackEvent_SetOctave(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->current_octave = *ptr_next_byte++;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_OctaveDelta(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
track->current_octave += *(s8 *)ptr_next_byte++;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
8
lib/DSE/src/main_0207216C.c
Normal file
8
lib/DSE/src/main_0207216C.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "main_0207216C.h"
|
||||
|
||||
u8* DseTrackEvent_SetTuningJitterAmplitude(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
channel->bend_jitter_amplitude = ptr_next_byte[0] + (ptr_next_byte[1] << 8);
|
||||
ptr_next_byte += 2;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
14
lib/DSE/src/main_020721B0.c
Normal file
14
lib/DSE/src/main_020721B0.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "main_020721B0.h"
|
||||
|
||||
u8* DseTrackEvent_SetUnknown2(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
channel->field_0x56 = (ptr_next_byte[0] << 8) + ptr_next_byte[1];
|
||||
ptr_next_byte += 2;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
|
||||
u8* DseTrackEvent_SetKeyBendRange(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
channel->bend_sensitivity_override = *ptr_next_byte++;
|
||||
return ptr_next_byte;
|
||||
}
|
||||
6
lib/DSE/src/main_0207299C.c
Normal file
6
lib/DSE/src/main_0207299C.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "main_0207299C.h"
|
||||
|
||||
u8* DseTrackEvent_Dummy2Bytes2(u8 *ptr_next_byte, struct dse_sequence *sequence, struct dse_track *track, struct dse_channel *channel)
|
||||
{
|
||||
return ptr_next_byte + 2;
|
||||
}
|
||||
9
main.lsf
9
main.lsf
@@ -255,9 +255,16 @@ Static main
|
||||
Object src/main_0207191C.o
|
||||
Object src/main_02071A14.o
|
||||
Object lib/DSE/src/main_02071A98.o
|
||||
Object lib/DSE/asm/main_02071AC0.o
|
||||
Object lib/DSE/src/main_02071AC0.o
|
||||
Object lib/DSE/asm/main_02071AE0.o
|
||||
Object lib/DSE/src/main_02071BF4.o
|
||||
Object lib/DSE/asm/main_02071EB4.o
|
||||
Object lib/DSE/src/main_0207216C.o
|
||||
Object lib/DSE/asm/main_02072184.o
|
||||
Object lib/DSE/src/main_020721B0.o
|
||||
Object lib/DSE/asm/main_020721D4.o
|
||||
Object lib/DSE/src/main_0207299C.o
|
||||
Object lib/DSE/asm/main_020729A4.o
|
||||
Object lib/DSE/src/dc_envelope.o
|
||||
Object lib/DSE/src/dc_lfo.o
|
||||
Object lib/DSE/asm/dc_lfo_1.o
|
||||
|
||||
Reference in New Issue
Block a user