Merge branch 'master' of https://github.com/pret/pokediamond into unk_0201C6B4

This commit is contained in:
GliMusings
2021-06-25 17:45:21 -05:00
63 changed files with 1290 additions and 1479 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
#include "MWC_string.h"
#include "function_target.h"
#include "nitro.h"
#include "nitro/types.h"
#include "constants/global.h"
#include "error_handling.h"
+1
View File
@@ -2,6 +2,7 @@
#define POKEDIAMOND_HEAP_H
#include "global.h"
#include "nitro/OS_arena_shared.h"
#include "NNS_FND_expheap.h"
#include "NNS_FND_allocator.h"
+1
View File
@@ -15,6 +15,7 @@
#include "nitro/types.h"
#include "nitro/OS_tick_shared.h"
#include "nitro/OS_thread_shared.h"
typedef void (*OSAlarmHandler) (void *);
+3
View File
@@ -15,6 +15,9 @@
#include "nitro/types.h"
/* UGLY HACK: include proc specific header for OSContext */
#include "OS_context.h"
typedef struct OSiAlarm OSAlarm;
typedef struct _OSThread OSThread;
+30
View File
@@ -0,0 +1,30 @@
/*
* NOTE:
* This file is shared between ARM9 and ARM7
* DO NOT PUT PROC SPECIFIC CODE IN HERE
* Thank You!
*/
/*
* DO NOT INCLUDE THIS FILE DIRECTLY
* Include SND_alarm.h from the specific proc's lib
*/
#ifndef POKEDIAMOND_SND_ALARM_SHARED_H
#define POKEDIAMOND_SND_ALARM_SHARED_H
#include "nitro/OS_tick_shared.h"
#include "nitro/OS_alarm_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
#define SND_ALARM_COUNT 8
#endif //POKEDIAMOND_SND_ALARM_SHARED_H
+176
View File
@@ -0,0 +1,176 @@
/*
* NOTE:
* This file is shared between ARM9 and ARM7
* DO NOT PUT PROC SPECIFIC CODE IN HERE
* Thank You!
*/
/*
* DO NOT INCLUDE THIS FILE DIRECTLY
* Include SND_main.h from the specific proc's lib
*/
#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;
u32 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
+46
View File
@@ -0,0 +1,46 @@
/*
* NOTE:
* This file is shared between ARM9 and ARM7
* DO NOT PUT PROC SPECIFIC CODE IN HERE
* Thank You!
*/
/*
* DO NOT INCLUDE THIS FILE DIRECTLY
* Include SND_work.h from the specific proc's lib
*/
#ifndef POKEDIAMOND_SND_WORK_SHARED_H
#define POKEDIAMOND_SND_WORK_SHARED_H
#include "nitro/SND_alarm_shared.h"
#include "nitro/SND_main_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 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
extern struct SNDWork SNDi_Work;
extern struct SNDSharedWork *SNDi_SharedWork;
#endif //POKEDIAMOND_SND_WORK_SHARED_H
+209
View File
@@ -0,0 +1,209 @@
#ifndef POKEDIAMOND_UNK_0202A1E0_H
#define POKEDIAMOND_UNK_0202A1E0_H
#include "mail_message.h"
#include "save_block_2.h"
typedef enum
{
DATA_GET = 0,
DATA_SET,
DATA_RESET,
DATA_INCREMENT,
DATA_DECREMENT,
DATA_ADD,
DATA_SUBSTRACT
}
DataSetMode;
typedef enum
{
FIELD_0x0_2 = 0,
FIELD_0x2,
FIELD_0x3,
FIELD_0x4,
FIELD_0x6,
FIELD_0x8,
FIELD_0x2C,
FIELD_flag0,
FIELD_0xC,
FIELD_0x0_5,
FIELD_0x28,
}
SaveStruct23_Substruct1_Field;
struct SaveStruct23_Substruct1
{
/* 0x000 */ u8 flag0 : 1;
u8 flag1 : 1;
u8 u_0_2 : 3;
u8 u_0_5 : 3;
/* 0x001 */ u8 u_1;
/* 0x002 */ u8 u_2;
/* 0x003 */ u8 u_3;
/* 0x004 */ u16 u_4;
/* 0x006 */ u16 u_6;
/* 0x008 */ s32 u_8;
/* 0x00C */ s32 u_C[7];
/* 0x028 */ u32 u_28;
/* 0x02C */ s32 u_2C[4];
}; // total size = 0x3C (60)
struct SaveStruct23_Substruct2
{
/* 0x000 */ u16 u_0;
/* 0x002 */ u8 u_2;
/* 0x003 */ u8 u_3;
/* 0x004 */ u32 u_4;
union
{
struct
{
/* 0x008 */ u16 flag0:1;
u16 flag1:1;
u16 flag2:1;
u16 flag3:1;
u16 flag4:1;
u16 filler_1:11;
};
/* 0x008 */ u16 flags;
};
/* 0x00A */ u8 filler_2[2];
/* 0x00C */ u16 u_C[5];
/* 0x016 */ u16 u_16;
/* 0x018 */ u8 u_18[168];
/* 0x0C0 */ u8 u_C0[168];
}; // total size 0x168 (360)
struct SaveStruct23_Messages
{
/* 0x000 */ struct MailMessage messages[4];
}; // total size 0x020 (32)
struct SaveStruct23_Substruct4_Substruct1
{
/* 0x000 */ u8 u_0[168];
/* 0x0A8 */ u8 u_A8[16];
/* 0x0B8 */ u8 filler_1[16];
/* 0x0C8 */ u8 u_C8_0:1;
u8 u_C8_1:1;
u8 filler_2:6;
/* 0x0C8 */ u8 u_C9;
/* 0x0CA */ u16 u_CA[4];
/* 0x0D2 */ u16 u_D2[4];
/* 0x0DA */ u16 u_DA[4];
/* 0x0E2 */ u8 filler_3[2];
}; // total size 0xE4 (228)
struct SaveStruct23_Substruct4_Substruct2
{
/* 0x00 */ u8 u_0[1020];
};
struct SaveStruct23_Substruct4
{
/* 0x000 */ u32 u_0;
/* 0x004 */ u8 flags[250];
/* 0x0FE */ u8 u_FE;
/* 0x0FF */ u8 u_FF;
/* 0x100 */ u8 u_100;
/* 0x101 */ u8 u_101;
/* 0x102 */ u8 u_102;
/* 0x103 */ u8 u_103;
/* 0x104 */ struct SaveStruct23_Substruct4_Substruct1 substruct1[7];
/* 0x740 */ struct SaveStruct23_Substruct4_Substruct2 substruct2;
}; // total size 0xB3C (2876)
struct SaveStruct23 // Struct fetched with SavArray_get(sav2, 23)
{
/* 0x000 */ struct SaveStruct23_Substruct1 substruct1;
/* 0x03C */ struct SaveStruct23_Substruct2 substruct2;
/* 0x1A4 */ struct SaveStruct23_Messages messages;
/* 0x1C4 */ struct SaveStruct23_Substruct4 substruct4;
}; // total size = 0xD00 (3328)
struct Unk0202A4B8
{
/* 0x000 */ u8 filler_1[2];
/* 0x002 */ u8 u_2;
/* 0x003 */ u8 u_3;
/* 0x004 */ u16 u_4;
/* 0x006 */ u16 u_6;
};
typedef struct Unk0202A68C
{
/* 0x000 */ u32 u_0;
/* 0x004 */ u32 u_4;
/* 0x008 */ u32 u_8;
/* 0x00C */ u32 u_C;
}
Unk0202A68C; // total size 0x10 (16)
struct Unk0202A784
{
/* 0x000 */ u8 u_0;
/* 0x001 */ u8 u_1;
};
struct Unk0202A798_substruct
{
/* 0x000 */ u32 u_0;
/* 0x004 */ u16 u_4;
/* 0x006 */ u8 filler_1[2];
/* 0x008 */ u16 u_8[8];
/* 0x018 */ u16 u_18[4];
/* 0x020 */ u16 u_20[4];
/* 0x028 */ u16 u_28[4];
}; // total size 0x30 (48)
struct Unk0202A798
{
/* 0x000 */ struct Unk0202A798_substruct u_0;
/* 0x030 */ u8 u_30[168];
};
s32 SaveStruct23_Substruct4_Substruct1_sizeof();
void SaveStruct23_Substruct1_Init(struct SaveStruct23_Substruct1 *substruct1);
void SaveStruct23_Substruct2_Init(struct SaveStruct23_Substruct2 *substruct2);
void SaveStruct23_Messages_Init(struct SaveStruct23_Messages *mailStruct);
void SaveStruct23_Substruct4_Init(struct SaveStruct23_Substruct4 *substruct4);
u32 SaveStruct23_Substruct1_GetField(struct SaveStruct23_Substruct1 *substruct1, SaveStruct23_Substruct1_Field field, void *dst);
void SaveStruct23_Substruct1_SetField(struct SaveStruct23_Substruct1 *substruct1, SaveStruct23_Substruct1_Field field, void *value);
void FUN_0202A36C(struct SaveStruct23_Substruct1 *substruct1, s32 arg1, s32 arg2, s32 arg3);
BOOL SaveStruct23_Substruct1_GetFlag1(struct SaveStruct23_Substruct1 *substruct1);
void SaveStruct23_Substruct1_SetFlag1(struct SaveStruct23_Substruct1 *substruct1, BOOL arg1);
u16 SaveStruct23_Substruct2_SetField_0x0(struct SaveStruct23_Substruct2 *substruct2, u16 value, DataSetMode mode);
u8 SaveStruct23_Substruct2_SetField_0x2(struct SaveStruct23_Substruct2 *substruct2, DataSetMode mode);
u8 SaveStruct23_Substruct2_SetField_0x3(struct SaveStruct23_Substruct2 *substruct2, DataSetMode mode);
void SaveStruct23_Substruct2_SetArray(struct SaveStruct23_Substruct2 *substruct2, s32 mode, void *src);
void SaveStruct23_Substruct2_GetArray(struct SaveStruct23_Substruct2 *substruct2, s32 mode, void *dst);
u16 SaveStruct23_Substruct2_SetField_0x16(struct SaveStruct23_Substruct2 *substruct2, struct Unk0202A4B8 *arg1);
u16 SaveStruct23_Substruct2_GetField_0x16(struct SaveStruct23_Substruct2 *substruct2);
u8 FUN_0202A524(struct SaveStruct23_Substruct2 *substruct2);
u16 SaveStruct23_Substruct2_SetField_0xC(struct SaveStruct23_Substruct2 *substruct2, u16 arg1, DataSetMode mode);
BOOL SaveStruct23_Substruct2_SetFlag(struct SaveStruct23_Substruct2 *substruct2, u16 flagNumber, DataSetMode mode);
void SaveStruct23_Substruct2_SetField_0x4(struct SaveStruct23_Substruct2 *substruct2, u32 arg1);
u32 SaveStruct23_Substruct2_GetField_0x4(struct SaveStruct23_Substruct2 *substruct2);
void SaveStruct23_SetMessage(struct SaveBlock2 *sav2, u32 index, struct MailMessage *message);
struct MailMessage *SaveStruct23_GetMessage(struct SaveBlock2 *sav2, u32 index);
void SaveStruct23_Substruct4_SetArrayFlag(struct SaveStruct23_Substruct4 *substruct4, u8 arg1, u8 arg2, struct Unk0202A68C *arg3);
void SaveStruct23_Substruct4_ClearArrayFlags(struct SaveStruct23_Substruct4 *substruct4);
BOOL StructUnk0202A68C_Compare(struct Unk0202A68C *struct1, struct Unk0202A68C *struct2);
BOOL SaveStruct23_Substruct4_GetArrayFlag(struct SaveStruct23_Substruct4 *substruct4, u8 arg1, u8 arg2, struct Unk0202A68C *arg3);
u8 SaveStruct23_Substruct4_GetField_0xFE(struct SaveStruct23_Substruct4 *substruct4);
u8 SaveStruct23_Substruct4_GetField_0xFF(struct SaveStruct23_Substruct4 *substruct4);
void SaveStruct23_Substruct4_SetSubstruct1(struct SaveStruct23_Substruct4 *substruct4, struct SaveStruct23_Substruct4_Substruct1 *substruct4_substruct1, u8 arg2, u8 arg3);
void FUN_0202A784(struct SaveStruct23_Substruct4 *substruct4, struct Unk0202A784 *dest);
void FUN_0202A798(struct SaveStruct23_Substruct4 *substruct4, struct Unk0202A798 *arg1, u32 arg2);
void FUN_0202A838(struct SaveStruct23_Substruct4 *substruct4, struct SaveStruct23_Substruct4_Substruct2 *substruct4_substruct2, u8 arg2, u8 arg3);
void FUN_0202A864(struct SaveStruct23_Substruct4 *substruct4, struct Unk0202A784 *dest);
struct SaveStruct23_Substruct4_Substruct2 *FUN_0202A878(struct SaveStruct23_Substruct4 *substruct4, u32 heap_id);
s32 SaveStruct23_sizeof();
void SaveStruct23_Init(struct SaveStruct23 *saveStruct23);
struct SaveStruct23_Substruct1 *SaveStruct23_GetSubstruct1(struct SaveBlock2* sav2);
struct SaveStruct23_Substruct2 *SaveStruct23_GetSubstruct2(struct SaveBlock2* sav2);
struct SaveStruct23_Substruct4 *SaveStruct23_GetSubstruct4(struct SaveBlock2* sav2);
#endif //POKEDIAMOND_UNK_0202A1E0_H