From 3fdad08888cb5f9b72e30613e1b1c951e3a07be6 Mon Sep 17 00:00:00 2001 From: red031000 Date: Sun, 22 Aug 2021 04:03:11 +0100 Subject: MOD59_SetupBg --- include/font.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/font.h b/include/font.h index 3c0f4267..8b16b9c7 100644 --- a/include/font.h +++ b/include/font.h @@ -31,7 +31,7 @@ u32 FUN_02002DE0(u32 param0, u16 *str, u32 param2); u32 FUN_02002E14(u32 param0, struct String *str, u32 param2); s32 GetFontAttribute(u8 fontId, s32 attr); void FUN_02002ED0(enum GFBgLayer layer, u32 baseAddr, u32 heap_id); -void FUN_02002EEC(u32 layer, u32 baseAddr, u32 heap_id); +void FUN_02002EEC(enum GFBgLayer layer, u32 baseAddr, u32 heap_id); s32 FUN_02002F08(u32 param0, struct String *str, u32 param2); u32 FUN_02002F40(u32 param0, struct String *str, u32 param2, u32 param3); u32 FUN_02002F58(const u16 *str); -- cgit v1.2.3 From fe565be6ef25a91f9372dbb791fddf789e5a64c7 Mon Sep 17 00:00:00 2001 From: red031000 Date: Sun, 22 Aug 2021 16:23:59 +0100 Subject: some cleanup --- include/render_window.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/render_window.h b/include/render_window.h index 385c61ad..6fcd6dde 100644 --- a/include/render_window.h +++ b/include/render_window.h @@ -43,7 +43,7 @@ struct UnkStruct_0200CABC_3 u32 FUN_0200CABC(struct BgConfig *bgConfig, u32 layer, u32 numTiles, u32 param3, u32 heap_id); s32 FUN_0200CAFC(void); void FUN_0200CB00( - struct BgConfig *bg_config, u32 layer, u32 num_tiles, u32 param3, u8 param4, u32 heap_id); + struct BgConfig *bg_config, u32 layer, u32 num_tiles, u32 param3, u8 frame_id, u32 heap_id); void DrawFrame1(struct BgConfig *bgConfig, u8 bgId, u8 x, @@ -57,7 +57,7 @@ void ClearFrameAndWindow1(struct Window *window, BOOL copy_to_vram); s32 FUN_0200CD60(s32 param0); s32 FUN_0200CD64(s32 param0); void FUN_0200CD68( - struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5); + struct BgConfig *bg_config, u32 layer, u32 param2, u32 param3, u8 frame_id, u32 heap_id); void DrawFrame2(struct BgConfig *bgConfig, u8 bgId, u8 x, -- cgit v1.2.3 From 69200d83f7bf3c189e226f3561cef3a6ee7ee6ce Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Fri, 25 Jun 2021 15:01:22 +0200 Subject: move PXI function declarations from OS_reset to their respective headers --- include/nitro/PXI_fifo_shared.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include') diff --git a/include/nitro/PXI_fifo_shared.h b/include/nitro/PXI_fifo_shared.h index 297625a1..a4ed454f 100644 --- a/include/nitro/PXI_fifo_shared.h +++ b/include/nitro/PXI_fifo_shared.h @@ -13,6 +13,8 @@ #ifndef POKEDIAMOND_PXI_FIFO_SHARED_H #define POKEDIAMOND_PXI_FIFO_SHARED_H +#include "nitro/types.h" + typedef enum { PXI_PROC_ARM9 = 0, @@ -40,4 +42,27 @@ typedef enum { PXI_MAX_FIFO_TAG = 32 // MAX FIFO TAG } PXIFifoTag; +typedef enum +{ + PXI_FIFO_SUCCESS = 0, + PXI_FIFO_FAIL_SEND_ERR = -1, + PXI_FIFO_FAIL_SEND_FULL = -2, + PXI_FIFO_FAIL_RECV_ERR = -3, + PXI_FIFO_FAIL_RECV_EMPTY = -4, + PXI_FIFO_NO_CALLBACK_ENTRY = -5 +} PXIFifoStatus; + +typedef union +{ + struct + { + u32 tag:5; + u32 err:1; + u32 data:26; + } e; + u32 raw; +} PXIFifoMessage; + +typedef void (*PXIFifoCallback) (PXIFifoTag tag, u32 data, BOOL err); + #endif //POKEDIAMOND_PXI_FIFO_SHARED_H -- cgit v1.2.3 From 130696200f1d68628520ba361355f5358d16847b Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Sat, 26 Jun 2021 18:59:04 +0200 Subject: move more sound structs from arm9 to common include --- include/nitro/SND_bank_shared.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 include/nitro/SND_bank_shared.h (limited to 'include') diff --git a/include/nitro/SND_bank_shared.h b/include/nitro/SND_bank_shared.h new file mode 100644 index 00000000..58b1fd8f --- /dev/null +++ b/include/nitro/SND_bank_shared.h @@ -0,0 +1,35 @@ +#ifndef GUARD_SND_BANK_SHARED_H +#define GUARD_SND_BANK_SHARED_H + +#include "nitro/types.h" + +#define SND_INST_MAX_KEYSPLIT 8 + +struct SNDInstParam { + u16 wave[2]; // 0x0 + u8 rootKey; // 0x4 + u8 envAttack; // 0x5 + u8 envDecay; // 0x6 + u8 envSustain; // 0x7 + u8 envRelease; // 0x8 + u8 pan; // 0x9 +}; // size = 0xA + +struct SNDInstData { + u8 type; // 0x0 + u8 unk_1; // 0x1 + struct SNDInstParam param; // 0x2 +}; // size = 0xC + +struct SNDKeySplit { + u8 key[SND_INST_MAX_KEYSPLIT]; // 0x0 + struct SNDInstData instruments[]; // 0x8 +}; // size = 0x8 + +struct SNDDrumSet { + u8 minKey; + u8 maxKey; + struct SNDInstData instruments[]; +}; // size = 0x2 + +#endif //GUARD_SND_BANK_SHARED_H -- cgit v1.2.3 From d049ab8b4a071b7718461dc8b513f34466fec931 Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Wed, 30 Jun 2021 19:03:31 +0200 Subject: add some more sound header stuff --- include/nitro/SND_exChannel_shared.h | 25 +++++++++++++++++++++++++ include/nitro/SND_main_shared.h | 4 ++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 include/nitro/SND_exChannel_shared.h (limited to 'include') diff --git a/include/nitro/SND_exChannel_shared.h b/include/nitro/SND_exChannel_shared.h new file mode 100644 index 00000000..eb702f16 --- /dev/null +++ b/include/nitro/SND_exChannel_shared.h @@ -0,0 +1,25 @@ +#ifndef GUARD_SND_EXCHANNEL_SHARED_H +#define GUARD_SND_EXCHANNEL_SHARED_H + +#include "nitro/types.h" + +#define SND_ENV_ATTACK 0 +#define SND_ENV_DECAY 1 +#define SND_ENV_SUSTAIN 2 +#define SND_ENV_RELEASE 3 + +#define SND_CHN_TYPE_PCM 0 +#define SND_CHN_TYPE_PSG 1 +#define SND_CHN_TYPE_NOISE 2 + +#define SND_CHN_SYNC_START 0x1 +#define SND_CHN_SYNC_STOP 0x2 +#define SND_CHN_SYNC_TIMER 0x4 +#define SND_CHN_SYNC_VOLUME 0x8 +#define SND_CHN_SYNC_PAN 0x10 + +#define SND_LFO_PITCH 0 +#define SND_LFO_VOLUME 1 +#define SND_LFO_PAN 2 + +#endif //GUARD_SND_EXCHANNEL_SHARED_H diff --git a/include/nitro/SND_main_shared.h b/include/nitro/SND_main_shared.h index d77273ed..154d93b6 100644 --- a/include/nitro/SND_main_shared.h +++ b/include/nitro/SND_main_shared.h @@ -83,7 +83,7 @@ struct SNDExChannel { union { const void *waveDataPtr; - u32 dutyCycle; + s32 dutyCycle; }; // 0x44 void (*callback)(struct SNDExChannel *chn, u32 status, void *userData); // 0x48 @@ -173,4 +173,4 @@ struct SNDTrack { }; // size = 0x40 #endif //POKEDIAMOND_SND_MAIN_SHARED_H - \ No newline at end of file + -- cgit v1.2.3 From 3f2b6670db01714364e1f1941c75e91df0f478fa Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Fri, 2 Jul 2021 23:55:05 +0200 Subject: refactor sound headers --- include/nitro/SND_bank_shared.h | 53 +++++++++++ include/nitro/SND_exChannel_shared.h | 79 ++++++++++++++++ include/nitro/SND_main_shared.h | 176 ++++------------------------------- include/nitro/SND_seq_shared.h | 84 +++++++++++++++++ include/nitro/SND_work_shared.h | 4 +- 5 files changed, 235 insertions(+), 161 deletions(-) create mode 100644 include/nitro/SND_seq_shared.h (limited to 'include') diff --git a/include/nitro/SND_bank_shared.h b/include/nitro/SND_bank_shared.h index 58b1fd8f..f5292bcc 100644 --- a/include/nitro/SND_bank_shared.h +++ b/include/nitro/SND_bank_shared.h @@ -3,8 +3,27 @@ #include "nitro/types.h" +#include "nitro/SND_exChannel_shared.h" +#include "nitro/SND_main_shared.h" + #define SND_INST_MAX_KEYSPLIT 8 +#define SND_INST_ILLEGAL 0 +#define SND_INST_PCM 1 +#define SND_INST_PSG 2 +#define SND_INST_NOISE 3 +#define SND_INST_DIRECTPCM 4 +#define SND_INST_DUMMY 5 +#define SND_INST_DRUM_TABLE 16 +#define SND_INST_KEY_SPLIT 17 + +#define SND_BANK_MAX_WAVEARC 4 + +#define SND_INST_OFFSET_TYPE(off) ((u8)off) +#define SND_INST_OFFSET_NORMAL(bank, off) ((struct SNDInstParam *)((u8 *)bank + (u32)(off >> 8))) +#define SND_INST_OFFSET_DRUMS(bank, off) ((struct SNDDrumSet *)((u8 *)bank + (u32)(off >> 8))) +#define SND_INST_OFFSET_KEYSPL(bank, off) ((struct SNDKeySplit *)((u8 *)bank + (u32)(off >> 8))) + struct SNDInstParam { u16 wave[2]; // 0x0 u8 rootKey; // 0x4 @@ -32,4 +51,38 @@ struct SNDDrumSet { struct SNDInstData instruments[]; }; // size = 0x2 +struct SNDWaveArc; + +struct SNDWaveArcLink { + struct SNDWaveArc *waveArc; // 0x0 + struct SNDWaveArcLink *waveArcLLnext; // 0x4 +}; // size = 0x8 + +struct SNDBankData { + struct SNDBinaryFileHeader fileHeader; // 0x00 + struct SNDBinaryBlockHeader blockHeader; // 0x10 + struct SNDWaveArcLink waveArcLinks[SND_BANK_MAX_WAVEARC]; // 0x18 + u32 instCount; // 0x38 + u32 instOffsets[]; // 0x3C +}; // size = 0x40 + +struct SNDWaveArc { + struct SNDBinaryFileHeader fileHeader; // 0x00 + struct SNDBinaryBlockHeader blockHeader; // 0x10 + struct SNDWaveArcLink *waveArcLLHead; // 0x18 + u8 unk_1C[28]; // 0x1C + u32 waveCount; // 0x38 + u32 waveOffsets[]; // 0x3C +}; // size = 0x3C + +struct SNDInstPos { + u32 program; // 0x0 + u32 index; // 0x4 +}; // size = 0x8 + +struct SNDWaveData { + struct SNDWaveParam param; // 0x0 + u8 sampleData[]; // 0xC +}; // size = 0xC + #endif //GUARD_SND_BANK_SHARED_H diff --git a/include/nitro/SND_exChannel_shared.h b/include/nitro/SND_exChannel_shared.h index eb702f16..386e6ac8 100644 --- a/include/nitro/SND_exChannel_shared.h +++ b/include/nitro/SND_exChannel_shared.h @@ -22,4 +22,83 @@ #define SND_LFO_VOLUME 1 #define SND_LFO_PAN 2 +struct SNDWaveParam { + u8 format; // 0x0 + u8 loopEnabled; // 0x1 + u16 samplerate; // 0x2 + u16 timer; // 0x4 + u16 loopStart; // 0x6 + u32 loopLength; // 0x8 +}; // size = 0xC + +struct SNDLfoParam { + u8 target; // 0x0 + u8 speed; // 0x1 + u8 depth; // 0x2 + u8 range; // 0x3 + u16 delay; // 0x4 +}; // size = 0x6 + +struct SNDLfo { + struct SNDLfoParam param; // 0x0 + u16 delayCounter; // 0x6 + u16 counter; // 0x8 +}; // size = 0xA + +struct SNDExChannel { + u8 id; // 0x00 + u8 type; // 0x01 + u8 envStatus; // 0x02 + + struct { + u8 active : 1; + u8 start : 1; + u8 autoSweep : 1; + u8 syncFlag : 5; + } flags; // 0x03 + + u8 panRange; // 0x04 + u8 rootMidiKey; // 0x05 + s16 userDecay2; // 0x06 + + u8 midiKey; // 0x08 + u8 velocity; // 0x09 + s8 initPan; // 0x0A + s8 userPan; // 0x0B + + s16 userDecay; // 0x0C + s16 userPitch; // 0x0E + + s32 envAttenuation; // 0x10 + s32 sweepCounter; // 0x14 + s32 sweepLength; // 0x18 + + u8 envAttack; // 0x1C + u8 envSustain; // 0x1D + u16 envDecay; // 0x1E + u16 envRelease; // 0x20 + u8 priority; // 0x22 + u8 pan; // 0x23 + u16 volume; // 0x24 + u16 timer; // 0x26 + + struct SNDLfo lfo; // 0x28 + + s16 sweepPitch; // 0x32 + + s32 length; // 0x34 + + struct SNDWaveParam waveParam; // 0x38 + + union { + const void *waveDataPtr; + s32 dutyCycle; + }; // 0x44 + + void (*callback)(struct SNDExChannel *chn, u32 status, void *userData); // 0x48 + void *callbackUserData; // 0x4C + + struct SNDExChannel *channelLLNext; // 0x50 +}; // size = 0x54 + #endif //GUARD_SND_EXCHANNEL_SHARED_H diff --git a/include/nitro/SND_main_shared.h b/include/nitro/SND_main_shared.h index 154d93b6..9b238245 100644 --- a/include/nitro/SND_main_shared.h +++ b/include/nitro/SND_main_shared.h @@ -13,164 +13,20 @@ #ifndef POKEDIAMOND_SND_MAIN_SHARED_H #define POKEDIAMOND_SND_MAIN_SHARED_H -struct SNDWaveParam { - u8 format; // 0x0 - u8 loopEnabled; // 0x1 - u16 samplerate; // 0x2 - u16 timer; // 0x4 - u16 loopStart; // 0x6 - u32 loopLength; // 0x8 -}; // size = 0xC - -struct SNDLfoParam { - u8 target; // 0x0 - u8 speed; // 0x1 - u8 depth; // 0x2 - u8 range; // 0x3 - u16 delay; // 0x4 -}; // size = 0x6 - -struct SNDLfo { - struct SNDLfoParam param; // 0x0 - u16 delayCounter; // 0x6 - u16 counter; // 0x8 -}; // size = 0xA - -struct SNDExChannel { - u8 id; // 0x00 - u8 type; // 0x01 - u8 envStatus; // 0x02 - - struct { - u8 active : 1; - u8 start : 1; - u8 autoSweep : 1; - u8 syncFlag : 5; - } flags; // 0x03 - - u8 panRange; // 0x04 - u8 rootMidiKey; // 0x05 - s16 userDecay2; // 0x06 - - u8 midiKey; // 0x08 - u8 velocity; // 0x09 - s8 initPan; // 0x0A - s8 userPan; // 0x0B - - s16 userDecay; // 0x0C - s16 userPitch; // 0x0E - - s32 envAttenuation; // 0x10 - s32 sweepCounter; // 0x14 - s32 sweepLength; // 0x18 - - u8 envAttack; // 0x1C - u8 envSustain; // 0x1D - u16 envDecay; // 0x1E - u16 envRelease; // 0x20 - u8 priority; // 0x22 - u8 pan; // 0x23 - u16 volume; // 0x24 - u16 timer; // 0x26 - - struct SNDLfo lfo; // 0x28 - - s16 sweepPitch; // 0x32 - - s32 length; // 0x34 - - struct SNDWaveParam waveParam; // 0x38 - - union { - const void *waveDataPtr; - s32 dutyCycle; - }; // 0x44 - - void (*callback)(struct SNDExChannel *chn, u32 status, void *userData); // 0x48 - void *callbackUserData; // 0x4C - - struct SNDExChannel *channelLLNext; // 0x50 -}; // size = 0x54 - -#define SND_TRACK_COUNT_PER_PLAYER 16 -#define SND_INVALID_TRACK_INDEX 0xFF - -struct SNDBankData; - -struct SNDPlayer { - struct { - u8 active : 1; - u8 prepared : 1; - u8 paused : 1; - } flags; // 0x0 - - u8 playerId; // 0x1 - u8 unk_2[2]; // 0x2 - - u8 prio; // 0x4 - u8 volume; // 0x5 - s16 extFader; // 0x6 - - u8 tracks[SND_TRACK_COUNT_PER_PLAYER]; // 0x8 - - u16 tempo; // 0x18 - u16 tempoRatio; // 0x1A - u16 tempoCounter; // 0x1C - u8 unk_1E[2]; // 0x1E - - struct SNDBankData *bank; // 0x20 -}; // size = 0x24 - -#define SND_TRACK_MAX_CALL 3 - -struct SNDTrack { - struct { - u8 active : 1; - u8 noteWait : 1; - u8 muted : 1; - u8 tie : 1; - u8 noteFinishWait : 1; - u8 portamento : 1; - u8 cmp : 1; // ??? - u8 channelMask : 1; - } flags; // 0x00 - - u8 panRange; // 0x01 - u16 program; // 0x02 - - u8 volume; // 0x04 - u8 expression; // 0x05 - s8 pitchBend; // 0x06 - u8 bendRange; // 0x07 - - s8 pan; // 0x08 - s8 extPan; // 0x09 - s16 extFader; // 0x0A - s16 extPitch; // 0x0C - u8 envAttack; // 0x0E - u8 envDecay; // 0x0F - u8 envSustain; // 0x10 - u8 envRelease; // 0x11 - u8 priority; // 0x12 - s8 transpose; // 0x13 - - u8 portamentoKey; // 0x14 - u8 portamentoTime; // 0x15 - s16 sweepPitch; // 0x16 - - struct SNDLfoParam mod; // 0x18 - u16 channelMask; // 0x1E - - s32 wait; // 0x20 - - const u8 *trackDataStart; // 0x24 - const u8 *trackDataPos; // 0x28 - const u8 *posCallStack[SND_TRACK_MAX_CALL]; // 0x34 - u8 loopCount[SND_TRACK_MAX_CALL]; // 0x38 - u8 callStackDepth; // 0x3B - - struct SNDExChannel *channelLLHead; // 0x3C -}; // size = 0x40 - - #endif //POKEDIAMOND_SND_MAIN_SHARED_H +#include "nitro/types.h" + +struct SNDBinaryFileHeader { + s8 signature[4]; // 0x0 + u16 byteOrder; // 0x4 + u16 version; // 0x6 + u32 fileSize; // 0x8 + u16 headerSize; // 0xC + u16 dataBlocks; // 0xE +}; // size = 0x10 + +typedef struct SNDBinaryBlockHeader { + u32 type; // 0x0 + u32 size; // 0x4 +} SNDBinaryBlockHeader; // size = 0x8 +#endif //POKEDIAMOND_SND_MAIN_SHARED_H diff --git a/include/nitro/SND_seq_shared.h b/include/nitro/SND_seq_shared.h new file mode 100644 index 00000000..6ff6189c --- /dev/null +++ b/include/nitro/SND_seq_shared.h @@ -0,0 +1,84 @@ +#ifndef GUARD_SND_SEQ_SHARED_H +#define GUARD_SND_SEQ_SHARED_H + +#define SND_TRACK_COUNT_PER_PLAYER 16 +#define SND_INVALID_TRACK_INDEX 0xFF + +struct SNDBankData; + +struct SNDPlayer { + struct { + u8 active : 1; + u8 prepared : 1; + u8 paused : 1; + } flags; // 0x0 + + u8 playerId; // 0x1 + u8 unk_2[2]; // 0x2 + + u8 prio; // 0x4 + u8 volume; // 0x5 + s16 extFader; // 0x6 + + u8 tracks[SND_TRACK_COUNT_PER_PLAYER]; // 0x8 + + u16 tempo; // 0x18 + u16 tempoRatio; // 0x1A + u16 tempoCounter; // 0x1C + u8 unk_1E[2]; // 0x1E + + struct SNDBankData *bank; // 0x20 +}; // size = 0x24 + +#define SND_TRACK_MAX_CALL 3 + +struct SNDTrack { + struct { + u8 active : 1; + u8 noteWait : 1; + u8 muted : 1; + u8 tie : 1; + u8 noteFinishWait : 1; + u8 portamento : 1; + u8 cmp : 1; // ??? + u8 channelMask : 1; + } flags; // 0x00 + + u8 panRange; // 0x01 + u16 program; // 0x02 + + u8 volume; // 0x04 + u8 expression; // 0x05 + s8 pitchBend; // 0x06 + u8 bendRange; // 0x07 + + s8 pan; // 0x08 + s8 extPan; // 0x09 + s16 extFader; // 0x0A + s16 extPitch; // 0x0C + u8 envAttack; // 0x0E + u8 envDecay; // 0x0F + u8 envSustain; // 0x10 + u8 envRelease; // 0x11 + u8 priority; // 0x12 + s8 transpose; // 0x13 + + u8 portamentoKey; // 0x14 + u8 portamentoTime; // 0x15 + s16 sweepPitch; // 0x16 + + struct SNDLfoParam mod; // 0x18 + u16 channelMask; // 0x1E + + s32 wait; // 0x20 + + const u8 *trackDataStart; // 0x24 + const u8 *trackDataPos; // 0x28 + const u8 *posCallStack[SND_TRACK_MAX_CALL]; // 0x34 + u8 loopCount[SND_TRACK_MAX_CALL]; // 0x38 + u8 callStackDepth; // 0x3B + + struct SNDExChannel *channelLLHead; // 0x3C +}; // size = 0x40 + +#endif //GUARD_SND_SEQ_SHARED_H diff --git a/include/nitro/SND_work_shared.h b/include/nitro/SND_work_shared.h index 0de3981e..08eda013 100644 --- a/include/nitro/SND_work_shared.h +++ b/include/nitro/SND_work_shared.h @@ -13,8 +13,10 @@ #ifndef POKEDIAMOND_SND_WORK_SHARED_H #define POKEDIAMOND_SND_WORK_SHARED_H -#include "nitro/SND_alarm_shared.h" #include "nitro/SND_main_shared.h" +#include "nitro/SND_alarm_shared.h" +#include "nitro/SND_bank_shared.h" +#include "nitro/SND_seq_shared.h" #define SND_PLAYER_COUNT 16 #define SND_CHANNEL_COUNT 16 -- cgit v1.2.3 From 6fda29badc3e915d019ab6f6c1cddc19d18614b2 Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Wed, 7 Jul 2021 02:27:19 +0200 Subject: arm7: decompile SND_channel --- include/nitro/SND_exChannel_shared.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/nitro/SND_exChannel_shared.h b/include/nitro/SND_exChannel_shared.h index 386e6ac8..c7743cd6 100644 --- a/include/nitro/SND_exChannel_shared.h +++ b/include/nitro/SND_exChannel_shared.h @@ -45,6 +45,10 @@ struct SNDLfo { u16 counter; // 0x8 }; // size = 0xA +struct SNDExChannel; + +typedef void (*SNDExChannelCallback)(struct SNDExChannel *chn, int status, void *userData); + struct SNDExChannel { u8 id; // 0x00 u8 type; // 0x01 @@ -95,7 +99,7 @@ struct SNDExChannel { s32 dutyCycle; }; // 0x44 - void (*callback)(struct SNDExChannel *chn, u32 status, void *userData); // 0x48 + SNDExChannelCallback callback; // 0x48 void *callbackUserData; // 0x4C struct SNDExChannel *channelLLNext; // 0x50 -- cgit v1.2.3 From 62059593a2d5dc7369ff898e0664fa0ae82c577c Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Wed, 7 Jul 2021 23:32:03 +0200 Subject: refactor snd headers --- include/nitro/SND_command_shared.h | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 include/nitro/SND_command_shared.h (limited to 'include') diff --git a/include/nitro/SND_command_shared.h b/include/nitro/SND_command_shared.h new file mode 100644 index 00000000..40dbe283 --- /dev/null +++ b/include/nitro/SND_command_shared.h @@ -0,0 +1,54 @@ +#ifndef GUARD_SND_COMMAND_SHARED_H +#define GUARD_SND_COMMAND_SHARED_H + +#include "nitro/types.h" + +#define SND_CMD_COUNT 256 +#define SND_CMD_ARG_MAX 4 + +#define SND_CMD_FLAG_NOBLOCK 0x0 +#define SND_CMD_FLAG_BLOCK 0x1 +#define SND_CMD_FLAG_IMMEDIATE 0x2 + +#define SND_CMD_START_SEQ 0x00 +#define SND_CMD_STOP_SEQ 0x01 +#define SND_CMD_PREPARE_SEQ 0x02 +#define SND_CMD_START_PREPARED_SEQ 0x03 +#define SND_CMD_PAUSE_SEQ 0x04 +#define SND_CMD_SKIP_SEQ 0x05 +#define SND_CMD_PLAYER_PARAM 0x06 +#define SND_CMD_TRACK_PARAM 0x07 +#define SND_CMD_MUTE_TRACK 0x08 +#define SND_CMD_ALLOCATABLE_CHANNEL 0x09 +#define SND_CMD_PLAYER_LOCAL_VAR 0x0A +#define SND_CMD_PLAYER_GLOBAL_VAR 0x0B +#define SND_CMD_START_TIMER 0x0C +#define SND_CMD_STOP_TIMER 0x0D +#define SND_CMD_SETUP_CHANNEL_PCM 0x0E +#define SND_CMD_SETUP_CHANNEL_PSG 0x0F +#define SND_CMD_SETUP_CHANNEL_NOISE 0x10 +#define SND_CMD_SETUP_CAPTURE 0x11 +#define SND_CMD_SETUP_ALARM 0x12 +#define SND_CMD_CHANNEL_TIMER 0x13 +#define SND_CMD_CHANNEL_VOLUME 0x14 +#define SND_CMD_CHANNEL_PAN 0x15 +#define SND_CMD_SURROUND_DECAY 0x16 +#define SND_CMD_MASTER_VOLUME 0x17 +#define SND_CMD_MASTER_PAN 0x18 +#define SND_CMD_OUTPUT_SELECTOR 0x19 +#define SND_CMD_LOCK_CHANNEL 0x1A +#define SND_CMD_UNLOCK_CHANNEL 0x1B +#define SND_CMD_STOP_UNLOCKED_CHANNEL 0x1C +#define SND_CMD_SET_SHARED_WORK 0x1D +#define SND_CMD_INVALIDATE_SEQ 0x1E +#define SND_CMD_INVALIDATE_BANK 0x1F +#define SND_CMD_INVALIDATE_WAVE 0x20 +#define SND_CMD_READ_DRIVER_INFO 0x21 + +struct SNDCommand { + struct SNDCommand *llNext; // 0x0 + s32 id; // 0x4 + u32 arg[SND_CMD_ARG_MAX]; // 0x8 +}; // size = 0x18 + +#endif //GUARD_SND_COMMAND_SHARED_H -- cgit v1.2.3 From 4fbf785bbdfee9be474724caf8b804b0544d0f79 Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Thu, 8 Jul 2021 15:28:40 +0200 Subject: arm7: decompile SND_command --- include/nitro/SND_work_shared.h | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'include') diff --git a/include/nitro/SND_work_shared.h b/include/nitro/SND_work_shared.h index 08eda013..02cc8bff 100644 --- a/include/nitro/SND_work_shared.h +++ b/include/nitro/SND_work_shared.h @@ -42,6 +42,51 @@ struct SNDSharedWork { s16 globalVars[16]; // 0x260 }; // size = 0x280 +struct SNDDriverInfo { + struct SNDWork work; // 0x0000 + u32 channelControls[SND_CHANNEL_COUNT]; // 0x1180 + struct SNDWork *workPtr; // 0x11C0 + u32 lockedChannels; // 0x11C4 + u8 unk_XXX[24]; // 0x11C8 +}; // size = 0x11E0 + +struct SNDChannelInfo { + struct { + BOOL active : 1; + BOOL locked: 1; + } flags; // 0x0 + u16 volume; // 0x4 + u8 pan; // 0x6 + u8 unk_7; // 0x7 + s32 envStatus; // 0x8 +}; // size = 0xC + +struct SNDPlayerInfo { + struct { + BOOL active : 1; + BOOL paused : 1; + } flags; // 0x0 + u16 trackBitMask; // 0x4 + u16 tempo; // 0x6 + u8 volume; // 0x8 + u8 unk_9[3]; // 0x9 +}; // size = 0xC + +struct SNDTrackInfo { + u16 program; // 0x0 + u8 volume; // 0x2 + u8 expression; // 0x3 + + s8 pitchBend; // 0x4 + u8 bendRange; // 0x5 + u8 pan; // 0x6 + s8 transpose; // 0x7 + + u8 unk_8; // 0x8 + u8 chnCount; // 0x9 + u8 channel[SND_CHANNEL_COUNT]; // 0xA +}; // size = 0x1A + extern struct SNDWork SNDi_Work; extern struct SNDSharedWork *SNDi_SharedWork; -- cgit v1.2.3 From 5cc94282b5c8e2b991a443f9e64e91c466cb00f1 Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Fri, 9 Jul 2021 01:47:28 +0200 Subject: fix small error in seq header --- include/nitro/SND_seq_shared.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/nitro/SND_seq_shared.h b/include/nitro/SND_seq_shared.h index 6ff6189c..ff73e951 100644 --- a/include/nitro/SND_seq_shared.h +++ b/include/nitro/SND_seq_shared.h @@ -72,9 +72,9 @@ struct SNDTrack { s32 wait; // 0x20 - const u8 *trackDataStart; // 0x24 - const u8 *trackDataPos; // 0x28 - const u8 *posCallStack[SND_TRACK_MAX_CALL]; // 0x34 + const u8 *base; // 0x24 + const u8 *cur; // 0x28 + const u8 *posCallStack[SND_TRACK_MAX_CALL]; // 0x2C u8 loopCount[SND_TRACK_MAX_CALL]; // 0x38 u8 callStackDepth; // 0x3B -- cgit v1.2.3 From c2bd97bebcecbe1d1743572ea99fa82fb9019832 Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Sun, 1 Aug 2021 02:45:26 +0200 Subject: arm7: decompile SND_unk_037FD440 --- include/nitro/SND_seq_shared.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/nitro/SND_seq_shared.h b/include/nitro/SND_seq_shared.h index ff73e951..d76fc8d0 100644 --- a/include/nitro/SND_seq_shared.h +++ b/include/nitro/SND_seq_shared.h @@ -1,6 +1,8 @@ #ifndef GUARD_SND_SEQ_SHARED_H #define GUARD_SND_SEQ_SHARED_H +#include "nitro/SND_exChannel_shared.h" + #define SND_TRACK_COUNT_PER_PLAYER 16 #define SND_INVALID_TRACK_INDEX 0xFF -- cgit v1.2.3 From d72270d4bd4c3160f98812de51cfb76fb6b47295 Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Tue, 3 Aug 2021 18:44:55 +0200 Subject: arm7: run clang-format on SND_* --- include/nitro/SND_alarm_shared.h | 21 +++--- include/nitro/SND_bank_shared.h | 135 +++++++++++++++++++---------------- include/nitro/SND_command_shared.h | 87 +++++++++++----------- include/nitro/SND_exChannel_shared.h | 100 ++++++++++++++------------ include/nitro/SND_main_shared.h | 30 ++++---- include/nitro/SND_seq_shared.h | 110 ++++++++++++++-------------- include/nitro/SND_work_shared.h | 123 ++++++++++++++++--------------- 7 files changed, 319 insertions(+), 287 deletions(-) (limited to 'include') diff --git a/include/nitro/SND_alarm_shared.h b/include/nitro/SND_alarm_shared.h index a1e8ed9d..2c9e02e4 100644 --- a/include/nitro/SND_alarm_shared.h +++ b/include/nitro/SND_alarm_shared.h @@ -13,18 +13,19 @@ #ifndef POKEDIAMOND_SND_ALARM_SHARED_H #define POKEDIAMOND_SND_ALARM_SHARED_H -#include "nitro/OS_tick_shared.h" #include "nitro/OS_alarm_shared.h" +#include "nitro/OS_tick_shared.h" -struct SNDAlarm { - u8 enable; // 0x00 - u8 id; // 0x01 - u16 unk_2; // 0x02 - OSTick tick; // 0x04 - OSTick period; // 0x0C - OSAlarm alarm; // 0x14 -}; // size = 0x40 +struct SNDAlarm +{ + u8 enable; // 0x00 + u8 id; // 0x01 + u16 unk_2; // 0x02 + OSTick tick; // 0x04 + OSTick period; // 0x0C + OSAlarm alarm; // 0x14 +}; // size = 0x40 #define SND_ALARM_COUNT 8 -#endif //POKEDIAMOND_SND_ALARM_SHARED_H +#endif // POKEDIAMOND_SND_ALARM_SHARED_H diff --git a/include/nitro/SND_bank_shared.h b/include/nitro/SND_bank_shared.h index f5292bcc..02fe7bba 100644 --- a/include/nitro/SND_bank_shared.h +++ b/include/nitro/SND_bank_shared.h @@ -8,14 +8,14 @@ #define SND_INST_MAX_KEYSPLIT 8 -#define SND_INST_ILLEGAL 0 -#define SND_INST_PCM 1 -#define SND_INST_PSG 2 -#define SND_INST_NOISE 3 -#define SND_INST_DIRECTPCM 4 -#define SND_INST_DUMMY 5 +#define SND_INST_ILLEGAL 0 +#define SND_INST_PCM 1 +#define SND_INST_PSG 2 +#define SND_INST_NOISE 3 +#define SND_INST_DIRECTPCM 4 +#define SND_INST_DUMMY 5 #define SND_INST_DRUM_TABLE 16 -#define SND_INST_KEY_SPLIT 17 +#define SND_INST_KEY_SPLIT 17 #define SND_BANK_MAX_WAVEARC 4 @@ -24,65 +24,74 @@ #define SND_INST_OFFSET_DRUMS(bank, off) ((struct SNDDrumSet *)((u8 *)bank + (u32)(off >> 8))) #define SND_INST_OFFSET_KEYSPL(bank, off) ((struct SNDKeySplit *)((u8 *)bank + (u32)(off >> 8))) -struct SNDInstParam { - u16 wave[2]; // 0x0 - u8 rootKey; // 0x4 - u8 envAttack; // 0x5 - u8 envDecay; // 0x6 - u8 envSustain; // 0x7 - u8 envRelease; // 0x8 - u8 pan; // 0x9 -}; // size = 0xA - -struct SNDInstData { - u8 type; // 0x0 - u8 unk_1; // 0x1 - struct SNDInstParam param; // 0x2 -}; // size = 0xC - -struct SNDKeySplit { - u8 key[SND_INST_MAX_KEYSPLIT]; // 0x0 - struct SNDInstData instruments[]; // 0x8 -}; // size = 0x8 - -struct SNDDrumSet { +struct SNDInstParam +{ + u16 wave[2]; // 0x0 + u8 rootKey; // 0x4 + u8 envAttack; // 0x5 + u8 envDecay; // 0x6 + u8 envSustain; // 0x7 + u8 envRelease; // 0x8 + u8 pan; // 0x9 +}; // size = 0xA + +struct SNDInstData +{ + u8 type; // 0x0 + u8 unk_1; // 0x1 + struct SNDInstParam param; // 0x2 +}; // size = 0xC + +struct SNDKeySplit +{ + u8 key[SND_INST_MAX_KEYSPLIT]; // 0x0 + struct SNDInstData instruments[]; // 0x8 +}; // size = 0x8 + +struct SNDDrumSet +{ u8 minKey; u8 maxKey; struct SNDInstData instruments[]; -}; // size = 0x2 +}; // size = 0x2 struct SNDWaveArc; -struct SNDWaveArcLink { - struct SNDWaveArc *waveArc; // 0x0 - struct SNDWaveArcLink *waveArcLLnext; // 0x4 -}; // size = 0x8 - -struct SNDBankData { - struct SNDBinaryFileHeader fileHeader; // 0x00 - struct SNDBinaryBlockHeader blockHeader; // 0x10 - struct SNDWaveArcLink waveArcLinks[SND_BANK_MAX_WAVEARC]; // 0x18 - u32 instCount; // 0x38 - u32 instOffsets[]; // 0x3C -}; // size = 0x40 - -struct SNDWaveArc { - struct SNDBinaryFileHeader fileHeader; // 0x00 - struct SNDBinaryBlockHeader blockHeader; // 0x10 - struct SNDWaveArcLink *waveArcLLHead; // 0x18 - u8 unk_1C[28]; // 0x1C - u32 waveCount; // 0x38 - u32 waveOffsets[]; // 0x3C -}; // size = 0x3C - -struct SNDInstPos { - u32 program; // 0x0 - u32 index; // 0x4 -}; // size = 0x8 - -struct SNDWaveData { - struct SNDWaveParam param; // 0x0 - u8 sampleData[]; // 0xC -}; // size = 0xC - -#endif //GUARD_SND_BANK_SHARED_H +struct SNDWaveArcLink +{ + struct SNDWaveArc *waveArc; // 0x0 + struct SNDWaveArcLink *waveArcLLnext; // 0x4 +}; // size = 0x8 + +struct SNDBankData +{ + struct SNDBinaryFileHeader fileHeader; // 0x00 + struct SNDBinaryBlockHeader blockHeader; // 0x10 + struct SNDWaveArcLink waveArcLinks[SND_BANK_MAX_WAVEARC]; // 0x18 + u32 instCount; // 0x38 + u32 instOffsets[]; // 0x3C +}; // size = 0x40 + +struct SNDWaveArc +{ + struct SNDBinaryFileHeader fileHeader; // 0x00 + struct SNDBinaryBlockHeader blockHeader; // 0x10 + struct SNDWaveArcLink *waveArcLLHead; // 0x18 + u8 unk_1C[28]; // 0x1C + u32 waveCount; // 0x38 + u32 waveOffsets[]; // 0x3C +}; // size = 0x3C + +struct SNDInstPos +{ + u32 program; // 0x0 + u32 index; // 0x4 +}; // size = 0x8 + +struct SNDWaveData +{ + struct SNDWaveParam param; // 0x0 + u8 sampleData[]; // 0xC +}; // size = 0xC + +#endif // GUARD_SND_BANK_SHARED_H diff --git a/include/nitro/SND_command_shared.h b/include/nitro/SND_command_shared.h index 40dbe283..9e6e3b30 100644 --- a/include/nitro/SND_command_shared.h +++ b/include/nitro/SND_command_shared.h @@ -6,49 +6,50 @@ #define SND_CMD_COUNT 256 #define SND_CMD_ARG_MAX 4 -#define SND_CMD_FLAG_NOBLOCK 0x0 -#define SND_CMD_FLAG_BLOCK 0x1 -#define SND_CMD_FLAG_IMMEDIATE 0x2 +#define SND_CMD_FLAG_NOBLOCK 0x0 +#define SND_CMD_FLAG_BLOCK 0x1 +#define SND_CMD_FLAG_IMMEDIATE 0x2 -#define SND_CMD_START_SEQ 0x00 -#define SND_CMD_STOP_SEQ 0x01 -#define SND_CMD_PREPARE_SEQ 0x02 -#define SND_CMD_START_PREPARED_SEQ 0x03 -#define SND_CMD_PAUSE_SEQ 0x04 -#define SND_CMD_SKIP_SEQ 0x05 -#define SND_CMD_PLAYER_PARAM 0x06 -#define SND_CMD_TRACK_PARAM 0x07 -#define SND_CMD_MUTE_TRACK 0x08 -#define SND_CMD_ALLOCATABLE_CHANNEL 0x09 -#define SND_CMD_PLAYER_LOCAL_VAR 0x0A -#define SND_CMD_PLAYER_GLOBAL_VAR 0x0B -#define SND_CMD_START_TIMER 0x0C -#define SND_CMD_STOP_TIMER 0x0D -#define SND_CMD_SETUP_CHANNEL_PCM 0x0E -#define SND_CMD_SETUP_CHANNEL_PSG 0x0F -#define SND_CMD_SETUP_CHANNEL_NOISE 0x10 -#define SND_CMD_SETUP_CAPTURE 0x11 -#define SND_CMD_SETUP_ALARM 0x12 -#define SND_CMD_CHANNEL_TIMER 0x13 -#define SND_CMD_CHANNEL_VOLUME 0x14 -#define SND_CMD_CHANNEL_PAN 0x15 -#define SND_CMD_SURROUND_DECAY 0x16 -#define SND_CMD_MASTER_VOLUME 0x17 -#define SND_CMD_MASTER_PAN 0x18 -#define SND_CMD_OUTPUT_SELECTOR 0x19 -#define SND_CMD_LOCK_CHANNEL 0x1A -#define SND_CMD_UNLOCK_CHANNEL 0x1B -#define SND_CMD_STOP_UNLOCKED_CHANNEL 0x1C -#define SND_CMD_SET_SHARED_WORK 0x1D -#define SND_CMD_INVALIDATE_SEQ 0x1E -#define SND_CMD_INVALIDATE_BANK 0x1F -#define SND_CMD_INVALIDATE_WAVE 0x20 -#define SND_CMD_READ_DRIVER_INFO 0x21 +#define SND_CMD_START_SEQ 0x00 +#define SND_CMD_STOP_SEQ 0x01 +#define SND_CMD_PREPARE_SEQ 0x02 +#define SND_CMD_START_PREPARED_SEQ 0x03 +#define SND_CMD_PAUSE_SEQ 0x04 +#define SND_CMD_SKIP_SEQ 0x05 +#define SND_CMD_PLAYER_PARAM 0x06 +#define SND_CMD_TRACK_PARAM 0x07 +#define SND_CMD_MUTE_TRACK 0x08 +#define SND_CMD_ALLOCATABLE_CHANNEL 0x09 +#define SND_CMD_PLAYER_LOCAL_VAR 0x0A +#define SND_CMD_PLAYER_GLOBAL_VAR 0x0B +#define SND_CMD_START_TIMER 0x0C +#define SND_CMD_STOP_TIMER 0x0D +#define SND_CMD_SETUP_CHANNEL_PCM 0x0E +#define SND_CMD_SETUP_CHANNEL_PSG 0x0F +#define SND_CMD_SETUP_CHANNEL_NOISE 0x10 +#define SND_CMD_SETUP_CAPTURE 0x11 +#define SND_CMD_SETUP_ALARM 0x12 +#define SND_CMD_CHANNEL_TIMER 0x13 +#define SND_CMD_CHANNEL_VOLUME 0x14 +#define SND_CMD_CHANNEL_PAN 0x15 +#define SND_CMD_SURROUND_DECAY 0x16 +#define SND_CMD_MASTER_VOLUME 0x17 +#define SND_CMD_MASTER_PAN 0x18 +#define SND_CMD_OUTPUT_SELECTOR 0x19 +#define SND_CMD_LOCK_CHANNEL 0x1A +#define SND_CMD_UNLOCK_CHANNEL 0x1B +#define SND_CMD_STOP_UNLOCKED_CHANNEL 0x1C +#define SND_CMD_SET_SHARED_WORK 0x1D +#define SND_CMD_INVALIDATE_SEQ 0x1E +#define SND_CMD_INVALIDATE_BANK 0x1F +#define SND_CMD_INVALIDATE_WAVE 0x20 +#define SND_CMD_READ_DRIVER_INFO 0x21 -struct SNDCommand { - struct SNDCommand *llNext; // 0x0 - s32 id; // 0x4 - u32 arg[SND_CMD_ARG_MAX]; // 0x8 -}; // size = 0x18 +struct SNDCommand +{ + struct SNDCommand *llNext; // 0x0 + s32 id; // 0x4 + u32 arg[SND_CMD_ARG_MAX]; // 0x8 +}; // size = 0x18 -#endif //GUARD_SND_COMMAND_SHARED_H +#endif // GUARD_SND_COMMAND_SHARED_H diff --git a/include/nitro/SND_exChannel_shared.h b/include/nitro/SND_exChannel_shared.h index c7743cd6..8c01b5cc 100644 --- a/include/nitro/SND_exChannel_shared.h +++ b/include/nitro/SND_exChannel_shared.h @@ -22,87 +22,93 @@ #define SND_LFO_VOLUME 1 #define SND_LFO_PAN 2 -struct SNDWaveParam { - u8 format; // 0x0 +struct SNDWaveParam +{ + u8 format; // 0x0 u8 loopEnabled; // 0x1 u16 samplerate; // 0x2 - u16 timer; // 0x4 - u16 loopStart; // 0x6 + u16 timer; // 0x4 + u16 loopStart; // 0x6 u32 loopLength; // 0x8 }; // size = 0xC -struct SNDLfoParam { - u8 target; // 0x0 - u8 speed; // 0x1 - u8 depth; // 0x2 - u8 range; // 0x3 - u16 delay; // 0x4 +struct SNDLfoParam +{ + u8 target; // 0x0 + u8 speed; // 0x1 + u8 depth; // 0x2 + u8 range; // 0x3 + u16 delay; // 0x4 }; // size = 0x6 -struct SNDLfo { - struct SNDLfoParam param; // 0x0 - u16 delayCounter; // 0x6 - u16 counter; // 0x8 +struct SNDLfo +{ + struct SNDLfoParam param; // 0x0 + u16 delayCounter; // 0x6 + u16 counter; // 0x8 }; // size = 0xA struct SNDExChannel; typedef void (*SNDExChannelCallback)(struct SNDExChannel *chn, int status, void *userData); -struct SNDExChannel { - u8 id; // 0x00 - u8 type; // 0x01 - u8 envStatus; // 0x02 +struct SNDExChannel +{ + u8 id; // 0x00 + u8 type; // 0x01 + u8 envStatus; // 0x02 - struct { + struct + { u8 active : 1; u8 start : 1; u8 autoSweep : 1; u8 syncFlag : 5; - } flags; // 0x03 + } flags; // 0x03 - u8 panRange; // 0x04 - u8 rootMidiKey; // 0x05 - s16 userDecay2; // 0x06 + u8 panRange; // 0x04 + u8 rootMidiKey; // 0x05 + s16 userDecay2; // 0x06 - u8 midiKey; // 0x08 - u8 velocity; // 0x09 - s8 initPan; // 0x0A - s8 userPan; // 0x0B + u8 midiKey; // 0x08 + u8 velocity; // 0x09 + s8 initPan; // 0x0A + s8 userPan; // 0x0B - s16 userDecay; // 0x0C - s16 userPitch; // 0x0E + s16 userDecay; // 0x0C + s16 userPitch; // 0x0E s32 envAttenuation; // 0x10 - s32 sweepCounter; // 0x14 - s32 sweepLength; // 0x18 + s32 sweepCounter; // 0x14 + s32 sweepLength; // 0x18 - u8 envAttack; // 0x1C - u8 envSustain; // 0x1D - u16 envDecay; // 0x1E - u16 envRelease; // 0x20 - u8 priority; // 0x22 - u8 pan; // 0x23 - u16 volume; // 0x24 - u16 timer; // 0x26 + u8 envAttack; // 0x1C + u8 envSustain; // 0x1D + u16 envDecay; // 0x1E + u16 envRelease; // 0x20 + u8 priority; // 0x22 + u8 pan; // 0x23 + u16 volume; // 0x24 + u16 timer; // 0x26 - struct SNDLfo lfo; // 0x28 + struct SNDLfo lfo; // 0x28 - s16 sweepPitch; // 0x32 + s16 sweepPitch; // 0x32 - s32 length; // 0x34 + s32 length; // 0x34 - struct SNDWaveParam waveParam; // 0x38 + struct SNDWaveParam waveParam; // 0x38 - union { + union + { const void *waveDataPtr; s32 dutyCycle; - }; // 0x44 + }; // 0x44 SNDExChannelCallback callback; // 0x48 void *callbackUserData; // 0x4C struct SNDExChannel *channelLLNext; // 0x50 -}; // size = 0x54 +}; // size = 0x54 -#endif //GUARD_SND_EXCHANNEL_SHARED_H +#endif // GUARD_SND_EXCHANNEL_SHARED_H diff --git a/include/nitro/SND_main_shared.h b/include/nitro/SND_main_shared.h index 9b238245..52addda0 100644 --- a/include/nitro/SND_main_shared.h +++ b/include/nitro/SND_main_shared.h @@ -15,18 +15,20 @@ #include "nitro/types.h" -struct SNDBinaryFileHeader { - s8 signature[4]; // 0x0 - u16 byteOrder; // 0x4 - u16 version; // 0x6 - u32 fileSize; // 0x8 - u16 headerSize; // 0xC - u16 dataBlocks; // 0xE -}; // size = 0x10 +struct SNDBinaryFileHeader +{ + s8 signature[4]; // 0x0 + u16 byteOrder; // 0x4 + u16 version; // 0x6 + u32 fileSize; // 0x8 + u16 headerSize; // 0xC + u16 dataBlocks; // 0xE +}; // size = 0x10 -typedef struct SNDBinaryBlockHeader { - u32 type; // 0x0 - u32 size; // 0x4 -} SNDBinaryBlockHeader; // size = 0x8 - -#endif //POKEDIAMOND_SND_MAIN_SHARED_H +typedef struct SNDBinaryBlockHeader +{ + u32 type; // 0x0 + u32 size; // 0x4 +} SNDBinaryBlockHeader; // size = 0x8 + +#endif // POKEDIAMOND_SND_MAIN_SHARED_H diff --git a/include/nitro/SND_seq_shared.h b/include/nitro/SND_seq_shared.h index d76fc8d0..00a0ea74 100644 --- a/include/nitro/SND_seq_shared.h +++ b/include/nitro/SND_seq_shared.h @@ -8,34 +8,38 @@ struct SNDBankData; -struct SNDPlayer { - struct { +struct SNDPlayer +{ + struct + { u8 active : 1; u8 prepared : 1; u8 paused : 1; - } flags; // 0x0 + } flags; // 0x0 - u8 playerId; // 0x1 - u8 unk_2[2]; // 0x2 + u8 playerId; // 0x1 + u8 unk_2[2]; // 0x2 - u8 prio; // 0x4 - u8 volume; // 0x5 - s16 extFader; // 0x6 + u8 prio; // 0x4 + u8 volume; // 0x5 + s16 extFader; // 0x6 - u8 tracks[SND_TRACK_COUNT_PER_PLAYER]; // 0x8 + u8 tracks[SND_TRACK_COUNT_PER_PLAYER]; // 0x8 - u16 tempo; // 0x18 - u16 tempoRatio; // 0x1A - u16 tempoCounter; // 0x1C - u8 unk_1E[2]; // 0x1E + u16 tempo; // 0x18 + u16 tempoRatio; // 0x1A + u16 tempoCounter; // 0x1C + u8 unk_1E[2]; // 0x1E - struct SNDBankData *bank; // 0x20 -}; // size = 0x24 + struct SNDBankData *bank; // 0x20 +}; // size = 0x24 #define SND_TRACK_MAX_CALL 3 -struct SNDTrack { - struct { +struct SNDTrack +{ + struct + { u8 active : 1; u8 noteWait : 1; u8 muted : 1; @@ -44,43 +48,43 @@ struct SNDTrack { u8 portamento : 1; u8 cmp : 1; // ??? u8 channelMask : 1; - } flags; // 0x00 - - u8 panRange; // 0x01 - u16 program; // 0x02 - - u8 volume; // 0x04 - u8 expression; // 0x05 - s8 pitchBend; // 0x06 - u8 bendRange; // 0x07 - - s8 pan; // 0x08 - s8 extPan; // 0x09 - s16 extFader; // 0x0A - s16 extPitch; // 0x0C - u8 envAttack; // 0x0E - u8 envDecay; // 0x0F - u8 envSustain; // 0x10 - u8 envRelease; // 0x11 - u8 priority; // 0x12 - s8 transpose; // 0x13 - - u8 portamentoKey; // 0x14 - u8 portamentoTime; // 0x15 - s16 sweepPitch; // 0x16 - - struct SNDLfoParam mod; // 0x18 - u16 channelMask; // 0x1E - - s32 wait; // 0x20 - - const u8 *base; // 0x24 - const u8 *cur; // 0x28 + } flags; // 0x00 + + u8 panRange; // 0x01 + u16 program; // 0x02 + + u8 volume; // 0x04 + u8 expression; // 0x05 + s8 pitchBend; // 0x06 + u8 bendRange; // 0x07 + + s8 pan; // 0x08 + s8 extPan; // 0x09 + s16 extFader; // 0x0A + s16 extPitch; // 0x0C + u8 envAttack; // 0x0E + u8 envDecay; // 0x0F + u8 envSustain; // 0x10 + u8 envRelease; // 0x11 + u8 priority; // 0x12 + s8 transpose; // 0x13 + + u8 portamentoKey; // 0x14 + u8 portamentoTime; // 0x15 + s16 sweepPitch; // 0x16 + + struct SNDLfoParam mod; // 0x18 + u16 channelMask; // 0x1E + + s32 wait; // 0x20 + + const u8 *base; // 0x24 + const u8 *cur; // 0x28 const u8 *posCallStack[SND_TRACK_MAX_CALL]; // 0x2C - u8 loopCount[SND_TRACK_MAX_CALL]; // 0x38 - u8 callStackDepth; // 0x3B + u8 loopCount[SND_TRACK_MAX_CALL]; // 0x38 + u8 callStackDepth; // 0x3B struct SNDExChannel *channelLLHead; // 0x3C -}; // size = 0x40 +}; // size = 0x40 -#endif //GUARD_SND_SEQ_SHARED_H +#endif // GUARD_SND_SEQ_SHARED_H diff --git a/include/nitro/SND_work_shared.h b/include/nitro/SND_work_shared.h index 02cc8bff..ec2d3c84 100644 --- a/include/nitro/SND_work_shared.h +++ b/include/nitro/SND_work_shared.h @@ -13,81 +13,90 @@ #ifndef POKEDIAMOND_SND_WORK_SHARED_H #define POKEDIAMOND_SND_WORK_SHARED_H -#include "nitro/SND_main_shared.h" #include "nitro/SND_alarm_shared.h" #include "nitro/SND_bank_shared.h" +#include "nitro/SND_main_shared.h" #include "nitro/SND_seq_shared.h" - + #define SND_PLAYER_COUNT 16 #define SND_CHANNEL_COUNT 16 #define SND_TRACK_COUNT 32 -struct SNDWork { - struct SNDExChannel channels[SND_CHANNEL_COUNT]; // 0x00 - struct SNDPlayer players[SND_PLAYER_COUNT]; // 0x540 - struct SNDTrack tracks[SND_TRACK_COUNT]; // 0x780 - struct SNDAlarm alarms[SND_ALARM_COUNT]; // 0xF80 -}; // size = 0x1180 +struct SNDWork +{ + struct SNDExChannel channels[SND_CHANNEL_COUNT]; // 0x00 + struct SNDPlayer players[SND_PLAYER_COUNT]; // 0x540 + struct SNDTrack tracks[SND_TRACK_COUNT]; // 0x780 + struct SNDAlarm alarms[SND_ALARM_COUNT]; // 0xF80 +}; // size = 0x1180 -struct SNDSharedWork { - u32 finishedCommandTag; // 0x0 - u32 playerStatus; // 0x4 - u16 channelStatus; // 0x8 - u16 captureStatus; // 0xA - u8 unk_C[0x14]; // 0xC - struct { - s16 localVars[16]; // local 0x0 - u32 tickCounter; // local 0x20 - } players[SND_PLAYER_COUNT]; // 0x20 - s16 globalVars[16]; // 0x260 -}; // size = 0x280 +struct SNDSharedWork +{ + u32 finishedCommandTag; // 0x0 + u32 playerStatus; // 0x4 + u16 channelStatus; // 0x8 + u16 captureStatus; // 0xA + u8 unk_C[0x14]; // 0xC + struct + { + s16 localVars[16]; // local 0x0 + u32 tickCounter; // local 0x20 + } players[SND_PLAYER_COUNT]; // 0x20 + s16 globalVars[16]; // 0x260 +}; // size = 0x280 -struct SNDDriverInfo { - struct SNDWork work; // 0x0000 +struct SNDDriverInfo +{ + struct SNDWork work; // 0x0000 u32 channelControls[SND_CHANNEL_COUNT]; // 0x1180 - struct SNDWork *workPtr; // 0x11C0 - u32 lockedChannels; // 0x11C4 - u8 unk_XXX[24]; // 0x11C8 -}; // size = 0x11E0 + struct SNDWork *workPtr; // 0x11C0 + u32 lockedChannels; // 0x11C4 + u8 unk_XXX[24]; // 0x11C8 +}; // size = 0x11E0 -struct SNDChannelInfo { - struct { +struct SNDChannelInfo +{ + struct + { BOOL active : 1; - BOOL locked: 1; - } flags; // 0x0 - u16 volume; // 0x4 - u8 pan; // 0x6 - u8 unk_7; // 0x7 - s32 envStatus; // 0x8 -}; // size = 0xC + BOOL locked : 1; + } flags; // 0x0 + u16 volume; // 0x4 + u8 pan; // 0x6 + u8 unk_7; // 0x7 + s32 envStatus; // 0x8 +}; // size = 0xC -struct SNDPlayerInfo { - struct { +struct SNDPlayerInfo +{ + struct + { BOOL active : 1; BOOL paused : 1; - } flags; // 0x0 - u16 trackBitMask; // 0x4 - u16 tempo; // 0x6 - u8 volume; // 0x8 - u8 unk_9[3]; // 0x9 -}; // size = 0xC + } flags; // 0x0 + u16 trackBitMask; // 0x4 + u16 tempo; // 0x6 + u8 volume; // 0x8 + u8 unk_9[3]; // 0x9 +}; // size = 0xC -struct SNDTrackInfo { - u16 program; // 0x0 - u8 volume; // 0x2 - u8 expression; // 0x3 +struct SNDTrackInfo +{ + u16 program; // 0x0 + u8 volume; // 0x2 + u8 expression; // 0x3 - s8 pitchBend; // 0x4 - u8 bendRange; // 0x5 - u8 pan; // 0x6 - s8 transpose; // 0x7 + s8 pitchBend; // 0x4 + u8 bendRange; // 0x5 + u8 pan; // 0x6 + s8 transpose; // 0x7 - u8 unk_8; // 0x8 - u8 chnCount; // 0x9 - u8 channel[SND_CHANNEL_COUNT]; // 0xA -}; // size = 0x1A + u8 unk_8; // 0x8 + u8 chnCount; // 0x9 + u8 channel[SND_CHANNEL_COUNT]; // 0xA +}; // size = 0x1A extern struct SNDWork SNDi_Work; extern struct SNDSharedWork *SNDi_SharedWork; - - #endif //POKEDIAMOND_SND_WORK_SHARED_H + +#endif // POKEDIAMOND_SND_WORK_SHARED_H -- cgit v1.2.3