diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-07-25 13:23:02 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-07-25 13:23:02 -0400 |
commit | 5e0e326b75402a36c4d31502b8b5a05b862ac23c (patch) | |
tree | 1b5807c1efb72dbdd9d01f329cefb41171913a64 /include | |
parent | 1f9d4503c898f9138422215132b53224571a281a (diff) | |
parent | 68d7aa47cc52ef822220e0e35890863d7cad479f (diff) |
Merge remote-tracking branch 'origin/master' into pikalax_work
Diffstat (limited to 'include')
32 files changed, 1159 insertions, 60 deletions
diff --git a/include/communication_error.h b/include/communication_error.h new file mode 100644 index 00000000..2e8ad1c7 --- /dev/null +++ b/include/communication_error.h @@ -0,0 +1,7 @@ +#ifndef POKEDIAMOND_COMMUNICATION_ERROR_H +#define POKEDIAMOND_COMMUNICATION_ERROR_H + +void FUN_02033F50(void); +void ShowCommunicationError(u32 heap_id, u32 error, u32 error_code); + +#endif diff --git a/include/font.h b/include/font.h index 6617f8ef..963e36bc 100644 --- a/include/font.h +++ b/include/font.h @@ -27,5 +27,10 @@ u32 FUN_02002E14(u32 param0, struct String *str, u32 param2); s32 GetFontAttribute(u8 fontId, s32 attr); void FUN_02002ED0(u32 layer, u32 baseAddr, u32 heap_id); void FUN_02002EEC(u32 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); +u32 FUN_02002F90(struct String *str); +s32 FUN_02002F9C(u32 param0, struct String *str); #endif // POKEDIAMOND_FONT_H diff --git a/include/game_init.h b/include/game_init.h index bf6569c4..0d2c9332 100644 --- a/include/game_init.h +++ b/include/game_init.h @@ -3,6 +3,18 @@ #include "main.h" +typedef volatile struct +{ + u8 sys_and_irq_stack[0x3F80]; + u8 svc_stack[0x40]; + u8 reserved[0x38]; + u32 intr_check; + void * intr_vector; +} +OS_DTCM; + +#define DTCM (*(OS_DTCM *)HW_DTCM) + void FUN_02015EA0(void); void FUN_02015ED4(void); void FUN_02015EF4(void); diff --git a/include/global.h b/include/global.h index 1853dbc3..8353ed2c 100644 --- a/include/global.h +++ b/include/global.h @@ -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" diff --git a/include/heap.h b/include/heap.h index 36c747a7..57cd88e8 100644 --- a/include/heap.h +++ b/include/heap.h @@ -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" diff --git a/include/map_header.h b/include/map_header.h index 20677025..60c8baaf 100644 --- a/include/map_header.h +++ b/include/map_header.h @@ -17,10 +17,10 @@ struct MapHeader u8 weather_type; u8 camera_type; u8 unk16; - u8 unk17_0:4; + u8 battle_bg:4; u8 is_bike_allowed:1; - u8 unk17_5:1; - u8 unk17_6:1; + u8 is_running_allowed:1; // unused + u8 is_escape_rope_allowed:1; u8 is_fly_allowed:1; }; @@ -38,24 +38,24 @@ u16 MapHeader_GetEventsBank(u32 mapno); u16 MapHeader_GetMapSec(u32 mapno); u8 MapHeader_GetWeatherType(u32 mapno); u8 MapHeader_GetCameraType(u32 mapno); -u8 MapHeader_GetField17_0(u32 mapno); -u8 MapHeader_GetField17_6(u32 mapno); +u8 MapHeader_GetBattleBg(u32 mapno); +u8 MapHeader_IsEscapeRopeAllowed(u32 mapno); u8 MapHeader_IsFlyAllowed(u32 mapno); u8 MapHeader_IsBikeAllowed(u32 mapno); u8 MapHeader_GetField16(u32 mapno); BOOL FUN_020348E4(u32 mapno); -BOOL MapHeader_MapIsOnOverworldMatrix(u32 mapno); +BOOL MapHeader_MapIsOnMainMatrix(u32 mapno); BOOL FUN_0203491C(u32 mapno); BOOL FUN_02034930(u32 mapno); BOOL FUN_02034944(u32 mapno); BOOL FUN_02034964(u32 mapno); BOOL FUN_02034984(u32 mapno); -BOOL FUN_02034998(u32 mapno); -BOOL FUN_020349AC(u32 mapno); -BOOL FUN_020349B8(u32 mapno); -BOOL FUN_020349CC(u32 mapno); -BOOL FUN_020349D8(u32 mapno); -BOOL FUN_020349E4(u16 a0); -u16 FUN_02034A04(u16 a0); +BOOL MapHeader_MapIsUnionRoom(u32 mapno); +BOOL MapHeader_MapIsMtCoronetFeebasRoom(u32 mapno); +BOOL MapHeader_MapIsTrophyGarden(u32 mapno); +BOOL MapHeader_MapIsAmitySquare(u32 mapno); +BOOL MapHeader_MapIsSpearPillar(u32 mapno); +BOOL MapHeader_MapIsPokemonCenterSecondFloor(u32 mapno); +u16 MapHeader_GetMapEvolutionMethod(u32 mapno); #endif //POKEDIAMOND_MAP_HEADER_H diff --git a/include/map_matrix.h b/include/map_matrix.h new file mode 100644 index 00000000..87e732dc --- /dev/null +++ b/include/map_matrix.h @@ -0,0 +1,54 @@ +#ifndef POKEDIAMOND_MAP_MATRIX_H +#define POKEDIAMOND_MAP_MATRIX_H + +#define MAP_MATRIX_MAX_WIDTH 30 +#define MAP_MATRIX_MAX_HEIGHT 30 +#define MAP_MATRIX_MAX_SIZE (MAP_MATRIX_MAX_WIDTH * MAP_MATRIX_MAX_HEIGHT) + +#define MAP_MATRIX_MAX_NAME_LENGTH 16 + +struct MapData +{ + u16 data[MAP_MATRIX_MAX_SIZE]; +}; + +struct MapMatrixData +{ + u8 height; + u8 width; + u16 headers[MAP_MATRIX_MAX_SIZE]; + u8 altitudes[MAP_MATRIX_MAX_SIZE]; + struct MapData maps; + u8 name[MAP_MATRIX_MAX_NAME_LENGTH]; +}; + +struct MapMatrix +{ + u8 width; + u8 height; + u8 matrix_id; + struct MapMatrixData data; +}; + +struct MapMatrix *MapMatrix_New(void); +void MapMatrix_Load(u16 map_id, struct MapMatrix *map_matrix); +void MapMatrix_Free(struct MapMatrix *map_matrix); +u16 MapMatrix_GetMapData(s32 map_id, struct MapMatrix *map_matrix); +u8 MapMatrix_GetWidth(struct MapMatrix *map_matrix); +u8 MapMatrix_GetHeight(struct MapMatrix *map_matrix); +u16 MapMatrix_GetMapHeader(struct MapMatrix *map_matrix, s32 x, s32 y); +u16 MapMatrix_GetMapHeaderFromID(struct MapMatrix *map_matrix, s32 map_id); +u8 MapMatrix_GetMatrixID(struct MapMatrix *map_matrix); +u32 MapMatrix_GetMapAltitude( + struct MapMatrix *map_matrix, u8 param1, s16 x, s16 y, int matrix_width); + +struct MapData *MapMatrix_MapData_New(u32 heap_id); +void MapMatrix_MapData_Free(struct MapData *map_data); +u16 MapMatrix_MapData_GetData(struct MapData *map_data, s32 x, s32 y); + +u16 GetMapHeader(u32 file_id, u16 x, u16 y); +u16 GetMapData(s32 map_id, struct MapMatrix *map_matrix); +void FUN_02034678(struct MapMatrix *map_matrix); +void FUN_020346CC(struct MapMatrix *map_matrix); + +#endif // POKEDIAMOND_MAP_MATRIX_H diff --git a/include/nitro/FX_types.h b/include/nitro/FX_types.h new file mode 100644 index 00000000..3c48b6c6 --- /dev/null +++ b/include/nitro/FX_types.h @@ -0,0 +1,109 @@ +#ifndef GUARD_FX_TYPES_H
+#define GUARD_FX_TYPES_H
+
+#include "nitro/types.h"
+
+
+typedef s16 fx16;
+typedef s32 fx32;
+typedef s64 fx64;
+typedef s64 fx64c;
+
+#define FX16_INT_MASK 0xF000
+#define FX16_INT_ABS_MASK 0x7000
+#define FX16_FRAC_MASK 0x0FFF
+#define FX16_INT_SHIFT 0xC
+
+#define FX32_INT_MASK 0xFFFFF000
+#define FX32_INT_ABS_MASK 0x7FFFF000
+#define FX32_FRAC_MASK 0x00000FFF
+#define FX32_INT_SHIFT 0xC
+
+#define FX64_INT_MASK 0xFFFFFFFFFFFFF000
+#define FX64_INT_ABS_MASK 0x7FFFFFFFFFFFF000
+#define FX64_FRAC_MASK 0x0000000000000FFF
+#define FX64_INT_SHIFT 0xC
+
+#define FX64C_INT_MASK 0xFFFFFFFF00000000
+#define FX64C_INT_ABS_MASK 0x7FFFFFFF00000000
+#define FX64C_FRAC_MASK 0x00000000FFFFFFFF
+#define FX64C_INT_SHIFT 0x20
+
+#define FX_INT(TYPE, x) (((x) & TYPE ## _INT_MASK) >> TYPE ## _INT_SHIFT)
+#define FX_INT_ABS(TYPE, x) (((x) & TYPE ## _INT_ABS_MASK) >> TYPE ## _INT_SHIFT)
+#define FX_FRAC(TYPE, x) ((x) & TYPE ## _FRAC_MASK)
+
+#define FX16_INT(x) FX_INT(FX16, x)
+#define FX16_INT_ABS(x) FX_INT_ABS(FX16, x)
+#define FX16_FRAC(x) FX_FRAC(FX16, x)
+
+#define FX32_INT(x) FX_INT(FX32, x)
+#define FX32_INT_ABS(x) FX_INT_ABS(FX32, x)
+#define FX32_FRAC(x) FX_FRAC(FX32, x)
+
+#define FX64_INT(x) FX_INT(FX64, x)
+#define FX64_INT_ABS(x) FX_INT_ABS(FX64, x)
+#define FX64_FRAC(x) FX_FRAC(FX64, x)
+
+#define FX64C_INT(x) FX_INT(FX64C, x)
+#define FX64C_INT_ABS(x) FX_INT_ABS(FX64C, x)
+#define FX64C_FRAC(x) FX_FRAC(FX64C, x)
+
+//TODO: clean up these macros
+#define FX32_MUL_NO_ROUND(a, b) ((fx32)(((fx64)(a) * (b)) >> FX32_INT_SHIFT))
+#define FX32_MUL(a, b) ((fx32)((((fx64)(a) * (b) + (1 << (FX32_INT_SHIFT - 1))) >> FX32_INT_SHIFT)))
+#define FX32_MUL_ADD_MUL(a, b, c, d) ((fx32)(((fx64)(a) * (b) + (fx64)c * d) >> FX32_INT_SHIFT))
+//the extra term here is for rounding
+#define FX32_MUL_SUB_MUL(a, b, c, d) ((fx32)(((fx64)(a) * (b) - (fx64)c * d + (1 << (FX32_INT_SHIFT - 1))) >> FX32_INT_SHIFT))
+
+#define FX_MUL_FX32_FX64C(a, b) ((fx32)((((a) * (b) + ((fx64)1 << (FX64C_INT_SHIFT - 1))) >> FX64C_INT_SHIFT)))
+
+#define FX_FX16_TO_F32(x) ((f32)((x) / (f32)(1 << FX16_SHIFT)))
+#define FX_F32_TO_FX16(x) ((fx16)(((x) > 0) ? \
+ (fx16)((x) * (1 << FX16_INT_SHIFT) + 0.5f ) : \
+ (fx16)((x) * (1 << FX16_INT_SHIFT) - 0.5f )))
+#define FX_F32_TO_FX32(x) ((fx32)(((x) > 0) ? \
+ (fx32)((x) * (1 << FX32_INT_SHIFT) + 0.5f ) : \
+ (fx32)((x) * (1 << FX32_INT_SHIFT) - 0.5f )))
+#define FX16_CONST(x) FX_F32_TO_FX16(x)
+#define FX32_CONST(x) FX_F32_TO_FX32(x)
+
+#define FX16_ONE ((fx16)0x1000)
+#define FX32_ONE ((fx32)0x00001000L)
+
+typedef struct Vecx32
+{
+ fx32 x;
+ fx32 y;
+ fx32 z;
+} VecFx32;
+
+typedef struct Vecx16
+{
+ fx16 x;
+ fx16 y;
+ fx16 z;
+} VecFx16;
+
+//Matrices are indexed as [column][row]
+typedef struct Mtx44
+{
+ fx32 _[16];
+} MtxFx44;
+
+typedef struct Mtx43
+{
+ fx32 _[12];
+} MtxFx43;
+
+typedef struct Mtx33
+{
+ fx32 _[9];
+} MtxFx33;
+
+typedef struct Mtx22
+{
+ fx32 _[4];
+} MtxFx22;
+
+#endif //GUARD_FX_TYPES_H
diff --git a/include/nitro/NNS_g3d.h b/include/nitro/NNS_g3d.h new file mode 100644 index 00000000..f9a3a1b8 --- /dev/null +++ b/include/nitro/NNS_g3d.h @@ -0,0 +1,89 @@ +#ifndef GUARD_NNS_G3D_H
+#define GUARD_NNS_G3D_H
+
+#include "fx.h"
+
+typedef enum
+{
+ NNS_G3D_GLB_FLAG_FLUSH_WVP = 0x00000001,
+ NNS_G3D_GLB_FLAG_FLUSH_VP = 0x00000002,
+ NNS_G3D_GLB_FLAG_INVBASE_UPTODATE = 0x00000004,
+ NNS_G3D_GLB_FLAG_INVCAMERA_UPTODATE = 0x00000008,
+ NNS_G3D_GLB_FLAG_INVPROJ_UPTODATE = 0x00000010,
+ NNS_G3D_GLB_FLAG_INVBASECAMERA_UPTODATE = 0x00000020,
+ NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE = 0x00000040,
+
+ NNS_G3D_GLB_FLAG_BASECAMERA_UPTODATE = 0x00000080,
+
+ NNS_G3D_GLB_FLAG_SRTCAMERA_UPTODATE = NNS_G3D_GLB_FLAG_BASECAMERA_UPTODATE,
+ NNS_G3D_GLB_FLAG_FLUSH_ALT = NNS_G3D_GLB_FLAG_FLUSH_WVP
+}
+ NNSG3dGlbFlag;
+
+typedef struct
+{
+ /*0x000*/ u32 cmd0;
+ /*0x004*/ u32 mtxmode_proj;
+ /*0x008*/ MtxFx44 projMtx;
+
+ /*0x048*/ u32 mtxmode_posvec;
+ /*0x04C*/ MtxFx43 cameraMtx;
+
+ /*0x07C*/ u32 cmd1;
+ /*0x080*/ u32 lightVec[4];
+
+ /*0x090*/ u32 cmd2;
+ /*0x094*/ u32 prmMatColor0;
+ /*0x098*/ u32 prmMatColor1;
+ /*0x09C*/ u32 prmPolygonAttr;
+ /*0x0A0*/ u32 prmViewPort;
+
+ /*0x0A4*/ u32 cmd3;
+ /*0x0A8*/ u32 lightColor[4];
+
+ /*0x0B8*/ u32 cmd4;
+ /*0x0BC*/ MtxFx33 prmBaseRot;
+ /*0x0E0*/ VecFx32 prmBaseTrans;
+ /*0x0EC*/ VecFx32 prmBaseScale;
+ /*0x0F8*/ u32 prmTexImageParam;
+
+ /*0x0FC*/ u32 flag;
+ /*0x100*/ MtxFx43 invCameraMtx;
+ /*0x130*/ MtxFx43 srtCameraMtx;
+ /*0x160*/ MtxFx43 invSrtCameraMtx;
+
+ /*0x190*/ MtxFx43 invBaseMtx;
+
+ /*0x1C0*/ MtxFx44 invProjMtx;
+ /*0x200*/ MtxFx44 invCameraProjMtx;
+
+ /*0x240*/ VecFx32 camPos;
+ /*0x24C*/ VecFx32 camUp;
+ /*0x258*/ VecFx32 camTarget;
+}
+NNSG3dGlb;
+
+extern NNSG3dGlb NNS_G3dGlb;
+
+static inline void NNS_G3dGlbLookAt(const VecFx32 * camPos, const VecFx32 * camUp, const VecFx32 * camTarget)
+{
+ NNS_G3dGlb.camPos = *camPos;
+ NNS_G3dGlb.camUp = *camUp;
+ NNS_G3dGlb.camTarget = *camTarget;
+ MTX_LookAt(camPos, camUp, camTarget, &NNS_G3dGlb.cameraMtx);
+ NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVCAMERA_UPTODATE | NNS_G3D_GLB_FLAG_INVBASECAMERA_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE | NNS_G3D_GLB_FLAG_BASECAMERA_UPTODATE);
+}
+
+static inline void NNS_G3dGlbPerspective(fx32 fovySin, fx32 fovyCos, fx32 aspect, fx32 n, fx32 f)
+{
+ MTX_Perspective(fovySin, fovyCos, aspect, n, f, &NNS_G3dGlb.projMtx);
+ NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVPROJ_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE);
+}
+
+static inline void NNS_G3dGlbOrtho(fx32 t, fx32 b, fx32 l, fx32 r, fx32 n, fx32 f)
+{
+ MTX_Ortho(t, b, l, r, n, f, &NNS_G3dGlb.projMtx);
+ NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVPROJ_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE);
+}
+
+#endif //GUARD_NNS_G3D_H
diff --git a/include/nitro/OS_alarm_shared.h b/include/nitro/OS_alarm_shared.h index fe549351..1a24f139 100644 --- a/include/nitro/OS_alarm_shared.h +++ b/include/nitro/OS_alarm_shared.h @@ -15,6 +15,7 @@ #include "nitro/types.h" #include "nitro/OS_tick_shared.h" +#include "nitro/OS_thread_shared.h" typedef void (*OSAlarmHandler) (void *); diff --git a/include/nitro/OS_thread_shared.h b/include/nitro/OS_thread_shared.h index a0cce54d..0c0e7f9a 100644 --- a/include/nitro/OS_thread_shared.h +++ b/include/nitro/OS_thread_shared.h @@ -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; diff --git a/include/nitro/SND_alarm_shared.h b/include/nitro/SND_alarm_shared.h new file mode 100644 index 00000000..a1e8ed9d --- /dev/null +++ b/include/nitro/SND_alarm_shared.h @@ -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 diff --git a/include/nitro/SND_main_shared.h b/include/nitro/SND_main_shared.h new file mode 100644 index 00000000..d77273ed --- /dev/null +++ b/include/nitro/SND_main_shared.h @@ -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 +
\ No newline at end of file diff --git a/include/nitro/SND_work_shared.h b/include/nitro/SND_work_shared.h new file mode 100644 index 00000000..0de3981e --- /dev/null +++ b/include/nitro/SND_work_shared.h @@ -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 diff --git a/include/palette.h b/include/palette.h new file mode 100644 index 00000000..7f14ddb4 --- /dev/null +++ b/include/palette.h @@ -0,0 +1,141 @@ +#ifndef POKEDIAMOND_PALETTE_H +#define POKEDIAMOND_PALETTE_H + +#include "global.h" +#include "filesystem.h" + +struct PlttData +{ + u16 r : 5; // red + u16 g : 5; // green + u16 b : 5; // blue + u16 unused_15 : 1; +}; + +struct PaletteFadeControl +{ + u16 selectedPalettes; + + u16 delay : 6; + u16 y : 5; + u16 targetY : 5; + + u16 blendColor : 15; + u16 yDec : 1; + + u16 deltaY : 4; + u16 delayCounter : 6; + u16 unk06_a : 6; +}; + +struct Palette +{ + u16 *unfadedBuf; + u16 *fadedBuf; + u32 bufSize; + struct PaletteFadeControl fadeCtrl; +}; + +struct PaletteData +{ + struct Palette pltt[14]; + + u16 unk118_0 : 2; + u16 activeFadePalettes : 14; + u16 unk11a_0 : 14; + u16 unk11a_e : 1; + u16 unk11a_f : 1; + u8 unk11c; + u8 unk11d; + u16 unk11e; +}; + +struct PaletteData *FUN_02002FD0(u32 heap_id); +void FUN_02002FEC(struct PaletteData *ptr); +void PaletteData_SetBuffers( + struct PaletteData *paletteData, u32 index, void *unfadedBuf, void *fadedBuf, u32 size); +void PaletteData_AllocBuffers(struct PaletteData *paletteData, u32 index, u32 size, u32 heap_id); +void PaletteData_FreeBuffers(struct PaletteData *paletteData, u32 index); +void PaletteData_LoadPalette( + struct PaletteData *paletteData, const void *src, u32 index, u32 offset, u16 size); +void PaletteData_LoadFromNarc(struct PaletteData *paletteData, + NarcId narcId, + s32 memberId, + u32 heap_id, + u32 index, + u32 size, + u16 offset, + u16 param7); +void PaletteData_LoadNarc(struct PaletteData *paletteData, + NarcId narcId, + s32 memberId, + u32 heap_id, + u32 index, + u32 size, + u16 offset); +void FUN_02003108(struct PaletteData *paletteData, u32 index, u16 offset, u32 size); +void CopyPaletteFromNarc( + NarcId narcId, s32 memberId, u32 heap_id, u32 size, u16 offset, void *dest); +void PaletteData_CopyPalette(struct PaletteData *paletteData, + u32 srcIdx, + u16 srcOffset, + u32 destIdx, + u16 destOffset, + u16 size); +u16 *PaletteData_GetUnfadedBuf(struct PaletteData *paletteData, u32 index); +u16 *PaletteData_GetFadedBuf(struct PaletteData *paletteData, u32 index); +u32 FUN_02003210(struct PaletteData *paletteData, + u16 param1, + u16 param2, + s16 delay, + u8 startY, + u8 targetY, + u16 color); +u8 IsPaletteSelected(u16 selectedPalettes, u16 index); +void FUN_02003328(struct PaletteData *param0, u16 param1); +void FUN_02003368(s32 param0, struct Palette *param1, u16 *param2); +void FUN_020033A4(struct PaletteFadeControl *paletteFade, + u16 selectedPalettes, + s16 delay, + u8 startY, + u8 targetY, + u16 color); +void FUN_02003464(u32 param0, struct PaletteData *param1); +void FUN_02003500(struct PaletteData *param0); +void FUN_02003520(struct PaletteData *param0); +void FUN_02003540(struct PaletteData *paletteData, u8 index, u32 param2); +void FUN_0200359C(struct PaletteData *paletteData, u32 index, u32 param2); +void FUN_020035F8(u16 *src, u16 *dest, struct PaletteFadeControl *fadeCtrl, u32 numEntries); +void FUN_02003684(struct PaletteData *paletteData, u8 index, struct PaletteFadeControl *fadeCtrl); +void FUN_0200372C(struct PaletteData *paletteData); +u16 FUN_020038E4(struct PaletteData *paletteData); +void FUN_020038F0(struct PaletteData *paletteData, u32 param1); +void PaletteData_FillPalette(struct PaletteData *paletteData, + u32 index, + u32 selection, + u16 value, + u16 startOffset, + u16 endOffset); +void BlendPalette(u16 *src, u16 *dest, u16 numEntries, u8 coeff, u16 blendColor); +void BlendPaletteUnfaded(struct PaletteData *paletteData, + u32 index, + u16 offset, + u16 numEntries, + u8 coeff, + u16 blendColor); +void BlendPalettes(u16 *src, u16 *dest, u16 selectedPalettes, u8 coeff, u16 blendColor); +void BlendPalettesUnfaded( + struct PaletteData *paletteData, u32 index, u16 selectedPalettes, u8 coeff, u16 blendColor); +void TintPalette_CustomTone(u16 *palette, s32 count, s32 rTone, s32 gTone, s32 bTone); +void FUN_02003B40(struct PaletteData *paletteData, + NarcId narcId, + s32 memberId, + u32 heap_id, + u32 index, + u32 size, + u16 offset, + s32 rTone, + s32 gTone, + s32 bTone); + +#endif // POKEDIAMOND_PALETTE_H diff --git a/include/scrcmd.h b/include/scrcmd.h index 826b74d3..5e28a4d0 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -106,6 +106,8 @@ BOOL ScrCmd_Unk0048(struct ScriptContext *ctx); BOOL ScrCmd_Unk02CF(struct ScriptContext *ctx); BOOL ScrCmd_Unk02D0(struct ScriptContext *ctx); BOOL ScrCmd_Unk005E(struct ScriptContext *ctx); +BOOL ScrCmd_Unk02A1(struct ScriptContext *ctx); +BOOL ScrCmd_WaitForMovement(struct ScriptContext *ctx); // scrcmd_mart.c BOOL ScrCmd_NormalMart(struct ScriptContext * ctx); diff --git a/include/script.h b/include/script.h index 75b65f90..f6eec142 100644 --- a/include/script.h +++ b/include/script.h @@ -33,7 +33,8 @@ struct UnkSavStruct80 struct UnkStruct_0204639C *unk10;
u8 padding2[0x8];
u32 *mapId; //0x1C
- u8 padding3[0x18];
+ u8 padding3[0x14];
+ u32 unk34;
u32 unk38;
u8 padding4[0x24];
u32 unk60;
diff --git a/include/sound.h b/include/sound.h index 781c6b5b..11053cd6 100644 --- a/include/sound.h +++ b/include/sound.h @@ -62,8 +62,9 @@ BOOL GF_Snd_LoadSeq(int seqNo); BOOL GF_Snd_LoadSeqEx(int seqNo, u32 loadFlag); BOOL GF_Snd_LoadWaveArc(int waveArcNo); BOOL GF_Snd_LoadBank(int bankNo); -u32 * FUN_02003FF4(int playerNo); -u32 FUN_02004018(u32 a0); +u32 * GetSoundPlayer(int playerNo); +int FUN_02004018(u32 a0); void DoSoundUpdateFrame(void); +void FUN_02003CE8(int); #endif //POKEDIAMOND_SOUND_H diff --git a/include/text.h b/include/text.h index ad0698a0..6ecf1b08 100644 --- a/include/text.h +++ b/include/text.h @@ -76,7 +76,7 @@ struct FontInfo }; void SetFontsPointer(const struct FontInfo *fonts); -u8 FUN_0201BCC8(void (*func)(u32, struct TextPrinter *), struct TextPrinter *printer, u32 param2); +u8 FUN_0201BCC8(void (*func)(u32, void *), void *printer, u32 param2); void FUN_0201BCFC(u32 param0); BOOL FUN_0201BD44(u32 param0); void FUN_0201BD5C(void); diff --git a/include/unk_02002F08.h b/include/unk_02002F08.h deleted file mode 100644 index 773d9246..00000000 --- a/include/unk_02002F08.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef POKEDIAMOND_UNK_02002F08_H -#define POKEDIAMOND_UNK_02002F08_H - -#include "global.h" -#include "gf_gfx_loader.h" -#include "string16.h" - - -struct UnkStruct_02002F08 -{ - struct - { - u16 *unk00; - u16 *unk04; - u32 unk08; - u32 unk0c; - u32 unk10; - } unk000[14]; - - u32 unk118; - u32 unk11c; -}; - -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); -u32 FUN_02002F90(struct String *str); -s32 FUN_02002F9C(u32 param0, struct String *str); -struct UnkStruct_02002F08 *FUN_02002FD0(u32 heap_id); -void FUN_02002FEC(struct UnkStruct_02002F08 *ptr); -void FUN_02002FF4(struct UnkStruct_02002F08 *param0, u32 param1, void *param2, void *param3, u32 size); -void FUN_02003008(struct UnkStruct_02002F08 *param0, u32 param1, u32 size, u32 heap_id); -void FUN_02003038(struct UnkStruct_02002F08 *param0, u32 param1); -void FUN_02003054(struct UnkStruct_02002F08 *param0, const void *param1, u32 param2, u32 offset, u16 size); -void FUN_02003084(struct UnkStruct_02002F08 *param0, NarcId narcId, s32 memberId, u32 heap_id, u32 param4, u32 size, u16 offset, u16 param7); -void FUN_020030E8(struct UnkStruct_02002F08 *param0, NarcId narcId, s32 memberId, u32 heap_id, u32 param4, u32 size, u16 offset); - -#endif //POKEDIAMOND_UNK_02002F08_H diff --git a/include/unk_020040F4.h b/include/unk_020040F4.h new file mode 100644 index 00000000..413e853f --- /dev/null +++ b/include/unk_020040F4.h @@ -0,0 +1,116 @@ +#ifndef POKEDIAMOND_UNK_020040F4_H +#define POKEDIAMOND_UNK_020040F4_H + +#include "global.h" + +struct WaveArcInfo +{ + u32 unk00 : 24; +}; + +struct UnkStruct_020040F4_1 +{ + void *unk00; + u32 unk04; + void *unk08; + u32 unk0c; + u32 unk10; + u32 unk14; + u32 unk18; + s32 unk1c; + u32 unk20; + s32 unk24; +}; + +struct UnkStruct_020040F4_2 +{ + u32 unk00; + u32 unk04; + u32 unk08; + u8 unk0c[9]; +}; + +void FUN_020040F4(u8 param0); +u8 FUN_02004104(); +void FUN_02004110(u16 param0); +u16 FUN_02004124(); +void FUN_02004130(u16 param0); +u16 FUN_02004140(); +void FUN_0200414C(u16 param0); +void FUN_0200415C(u8 param0); +BOOL FUN_02004180(s32 param0); +BOOL FUN_0200433C(u8 param0, int param1, u32 param2); +void FUN_020044A8(s32 param0); +void FUN_020044D4(int seqNo, u32 param1); +void FUN_02004568(int seqNo, u16 param1); +void FUN_020045C4(int seqNo, u32 param1); +void FUN_02004648(int param0, u32 param1); +void FUN_02004680(int param0, u32 param1); +void FUN_020046A0(int param0, u32 param1); +void FUN_020046C4(int param0, u32 param1); +void FUN_020046E8(s32 param0); +void FUN_02004704(s32 param0, int param1, u32 param2); +void FUN_02004724(int param0); +void FUN_02004738(); +int FUN_02004748(s32 param0); +void FUN_020047C8(u8 param0, u8 param1); +void FUN_02004810(); +void GF_SndPlayerMoveVolume(int playerNo, s32 param1, s32 param2); +void GF_SndPlayerSetInitialVolume(int playerNo, s32 param1); +void FUN_02004858(u32 param0, int playerNo); +void FUN_0200488C(u16 param0, u16 param1); +void GF_SndArcPlayerStartSeqEx(int playerNo, u32 param1, u32 param2); +u16 GF_SndPlayerCountPlayingSeqByPlayerNo(int playerNo); +u8 FUN_020048D0(u16 param0); +u32 GF_SndPlayerGetSeqNo(u32 *param0); +u32 FUN_020048F4(u16 param0); +u16 FUN_02004900(u32 param0); +u32 GF_MIC_StartAutoSampling(u32 param0); +u32 GF_MIC_StopAutoSampling(u32 param0); +u32 GF_MIC_DoSamplingAsync(u32 param0, u32 param1, u32 param2, u32 param3); +void *FUN_02004930(u32 param0); +BOOL FUN_02004984(u32 param0); +void FUN_02004A04(u32 param0); +u32 FUN_02004A6C(struct UnkStruct_020040F4_1 *param0, u32 param1); +void FUN_02004AAC(u32 param0); +BOOL FUN_02004ABC(u32 param0); +void FUN_02004ACC(u32 param0, u32 param1); +void FUN_02004AE4(u32 param0, u32 param1); +void FUN_02004AF8(u32 param0, s32 param1); +u32 FUN_02004B30(u32 param0, s32 param1, s32 param2, u32 param3, u32 param4); +void FUN_02004C1C(u8 *param0, u32 param1); +void FUN_02004C3C(u32 param0); +BOOL GF_SndCaptureIsActive(); +u32 GF_SndCaptureStartReverb(u32 param0); +void GF_SndCaptureStopReverb(u32 param0); +void GF_SndCaptureSetReverbVolume(u32 param0, u32 param1); +void FUN_02004CB4(); +void GF_SndCaptureStopEffect(); +void FUN_02004D04(s32 param0); +void GF_SndPlayerSetTrackPitch(int playerNo, u32 param1, s32 param2); +void FUN_02004D34(u16 param0, u32 param1, s32 param2); +void GF_SndPlayerSetTrackPan(int playerNo, u32 param1, s32 param2); +void GF_SndSetMonoFlag(u32 param0); +void FUN_02004D74(s32 param0); +void FUN_02004D84(u32 param0); +u16 FUN_02004D94(); +u8 *FUN_02004DB4(); +void FUN_02004DBC(u8 param0); +u32 FUN_02004DCC(u32 param0, u16 param1, u32 param2, u32 param3, u8 param4, u32 param5); +u32 FUN_02004E08( + u32 param0, u16 param1, u32 param2, u32 param3, u32 param35, u8 param4, u32 param5); +void FUN_02004E44(u32 param0, u16 param1, u32 param2, u32 param3, u8 param4, u32 param5); +u32 FUN_02004E80(u32 param0); +u32 FUN_02004E8C(u32 *param0); +u32 FUN_02004E98(s32 param0); +u32 FUN_02004ED0(s32 param0); +u32 FUN_02004F28(u32 param0, struct UnkStruct_020040F4_2 *param1, s32 param2); +u32 GF_SndPlayerGetTick(int playerNo); +void FUN_02004F70(struct UnkStruct_020040F4_2 *param0, u8 *param1, int param2, s32 param3); +void FUN_02005068(s16 *param0, s16 *param1, u32 param2, u32 param3, void *param4); +void FUN_02005160(u32 param0); +void FUN_0200516C(u32 param0); +void FUN_020051AC(); +void GF_SndPlayerSetPlayerVolume(u32 param0, u8 param1); + +#endif // POKEDIAMOND_UNK_020040F4_H diff --git a/include/unk_020051F4.h b/include/unk_020051F4.h new file mode 100644 index 00000000..05be8db7 --- /dev/null +++ b/include/unk_020051F4.h @@ -0,0 +1,45 @@ +#ifndef POKEDIAMOND_UNK_020051F4_H +#define POKEDIAMOND_UNK_020051F4_H + +#include "global.h" + + +u32 FUN_020051F4(u16 param0); +u32 FUN_0200521C(u16 param0); +void FUN_0200526C(u16 param0, int playerNo); +u32 FUN_02005288(u16 param0, u32 param1, int playerNo); +u32 FUN_020052B8(u16 param0, u32 param1, int playerNo); +u32 FUN_02005308(u32 param0, u16 param1); +void FUN_02005350(u16 param0, u32 param1); +void FUN_02005374(); +void FUN_0200538C(s32 param0, u16 param1, u32 param2); +void FUN_020053CC(s32 param0, s32 param1); +u16 FUN_02005404(); +u16 FUN_02005410(u16 param0); +void FUN_0200541C(); +void FUN_02005454(); +u32 FUN_020054A8(u16 param0, u32 param1); +u32 PlaySE(u16 param0); +void FUN_020054F0(u32 param0, u32 param1); +void FUN_020054F8(s32 param0, u32 param1); +u16 FUN_02005508(u16 param0); +BOOL FUN_02005514(); +void FUN_02005530(u16 param0, u32 param1, u32 param2); +void FUN_0200554C(u32 param0); +u32 FUN_02005578(u16 species); +void FUN_02005614(u32 param0); +BOOL FUN_02005670(); +u32 FUN_020056AC(u32 param0, u16 param1, s32 param2, s32 param3, u32 param4); +void FUN_02005AC8(u32 param0, int playerNo, s32 param2); +void FUN_02005AE0(u32 param0, u32 param1); +void FUN_02005B2C(u32 param0, s32 *param1); +void FUN_02005BA0(); +u32 FUN_02005BC8(u16 param0, s32 param1); +void FUN_02005BF8(u32 param0, s32 param1, s32 param2, s32 param3, u32 param4); +u32 PlaySound(u16 param0); +BOOL FUN_02005C74(); +void FUN_02005CA0(u32 param0); +BOOL FUN_02005CBC(); +void FUN_02005CEC(u16 param0); + +#endif //POKEDIAMOND_UNK_020051F4_H diff --git a/include/unk_020061E8.h b/include/unk_020061E8.h new file mode 100644 index 00000000..121900c3 --- /dev/null +++ b/include/unk_020061E8.h @@ -0,0 +1,10 @@ +#ifndef POKEDIAMOND_UNK_020061E8_H
+#define POKEDIAMOND_UNK_020061E8_H
+
+#include "nitro/types.h"
+#include "text.h"
+
+BOOL FUN_020061E8(void (*r0)(u32, void *), u32 r1, u32 r2, u32 r3);
+void FUN_0200621C(s32 r0);
+
+#endif // POKEDIAMOND_UNK_020061E8_H
diff --git a/include/unk_0200CA44.h b/include/unk_0200CA44.h index 6dd208c3..065f3fc0 100644 --- a/include/unk_0200CA44.h +++ b/include/unk_0200CA44.h @@ -3,10 +3,10 @@ #include "text.h" -BOOL FUN_0200CA44(void (*r0)(u32, struct TextPrinter *), struct TextPrinter * r1, u32 r2); -BOOL FUN_0200CA60(void (*r0)(u32, struct TextPrinter *), struct TextPrinter * r1, u32 r2); -BOOL FUN_0200CA7C(void (*r0)(u32, struct TextPrinter *), struct TextPrinter * r1, u32 r2); -BOOL FUN_0200CA98(void (*r0)(u32, struct TextPrinter *), struct TextPrinter * r1, u32 r2); +BOOL FUN_0200CA44(void (*r0)(u32, void *), void * r1, u32 r2); +BOOL FUN_0200CA60(void (*r0)(u32, void *), void * r1, u32 r2); +BOOL FUN_0200CA7C(void (*r0)(u32, void *), void * r1, u32 r2); +BOOL FUN_0200CA98(void (*r0)(u32, void *), void * r1, u32 r2); void FUN_0200CAB4(s32 unk1); #endif //POKEDIAMOND_UNK_0200CA44_H diff --git a/include/unk_0201C6B4.h b/include/unk_0201C6B4.h new file mode 100644 index 00000000..0a501954 --- /dev/null +++ b/include/unk_0201C6B4.h @@ -0,0 +1,10 @@ +#ifndef POKEDIAMOND_UNK_0201C6B4_H +#define POKEDIAMOND_UNK_0201C6B4_H + +s32 FUN_0201C6B4(s8 * r0); +s8 * FUN_0201C6C8(s8 * r0, s8 * r1, s8 r2); +s32 FUN_0201C70C(s8 * r4); +void FUN_0201C750(s8 * r5, s8 * r4); +BOOL FUN_0201C78C(u32 r0); + +#endif // POKEDIAMOND_UNK_0201C6B4_H diff --git a/include/unk_020222E8.h b/include/unk_020222E8.h new file mode 100644 index 00000000..ac6e1932 --- /dev/null +++ b/include/unk_020222E8.h @@ -0,0 +1,11 @@ +#ifndef POKEDIAMOND_UNK_020222E8_H
+#define POKEDIAMOND_UNK_020222E8_H
+
+void * FUN_020222E8();
+void * FUN_020222F0();
+void * FUN_020222F8();
+void * FUN_02022300();
+void * FUN_02022308();
+void * FUN_02022310();
+
+#endif // POKEDIAMOND_UNK_020222E8_H
diff --git a/include/unk_02022450.h b/include/unk_02022450.h new file mode 100644 index 00000000..1224107a --- /dev/null +++ b/include/unk_02022450.h @@ -0,0 +1,18 @@ +#ifndef POKEDIAMOND_UNK_02022450_H +#define POKEDIAMOND_UNK_02022450_H + +struct CARD_Header { + u8 title[12]; + u32 tid; + u16 maker_code; + u8 filler[44]; + u32 header_40; + u32 header_44; + u32 header_48; + u32 header_4C; +}; + +void FUN_02022450(); +void Reset_To_File(const char* path); + +#endif //POKEDIAMOND_UNK_02022450_H diff --git a/include/unk_0202A1E0.h b/include/unk_0202A1E0.h new file mode 100644 index 00000000..8c1e5da9 --- /dev/null +++ b/include/unk_0202A1E0.h @@ -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
\ No newline at end of file diff --git a/include/unk_0204AF24.h b/include/unk_0204AF24.h new file mode 100644 index 00000000..e77bcc35 --- /dev/null +++ b/include/unk_0204AF24.h @@ -0,0 +1,19 @@ +#ifndef POKEDIAMOND_UNK_0204AF24_H
+#define POKEDIAMOND_UNK_0204AF24_H
+
+#include "nitro/types.h"
+#include "unk_0204639C.h"
+
+BOOL FUN_0204AF24(struct UnkStruct_0204639C * arg0);
+void FUN_0204AF3C(struct UnkStruct_0204639C * r5);
+BOOL FUN_0204AF6C(struct UnkStruct_0204639C * arg0);
+void FUN_0204AF84(struct UnkStruct_0204639C * r5);
+BOOL FUN_0204AFB4(struct UnkStruct_0204639C * arg0);
+void FUN_0204AFC8(struct UnkStruct_0204639C * r4);
+void FUN_0204B00C(struct UnkStruct_0204639C * r4);
+BOOL FUN_0204B050(struct UnkStruct_0204639C * r5);
+void FUN_0204B090(struct UnkStruct_0204639C * r0);
+BOOL FUN_0204B0A0(struct UnkStruct_0204639C * r5);
+void FUN_0204B0E8(struct UnkStruct_0204639C * r0);
+
+#endif // POKEDIAMOND_UNK_0204AF24_H
diff --git a/include/unk_02064E20.h b/include/unk_02064E20.h new file mode 100644 index 00000000..a9bcd0e0 --- /dev/null +++ b/include/unk_02064E20.h @@ -0,0 +1,8 @@ +#ifndef POKEDIAMOND_UNK_02064E20_H
+#define POKEDIAMOND_UNK_02064E20_H
+
+#include "script.h"
+
+void FUN_02064E20(struct UnkSavStruct80* unk0);
+
+#endif // POKEDIAMOND_UNK_02064E20_H
diff --git a/include/unk_02088DD8.h b/include/unk_02088DD8.h index 318a98fb..7b023c56 100644 --- a/include/unk_02088DD8.h +++ b/include/unk_02088DD8.h @@ -1,6 +1,8 @@ #ifndef POKEDIAMOND_UNK_02088DD8_H #define POKEDIAMOND_UNK_02088DD8_H +#include "unk_020377F0.h" + struct Options; struct PlayerData; struct Pokemon; @@ -16,4 +18,9 @@ struct UnkStruct_02088DD8 u8 padding2[0x2]; }; +struct UnkStruct_02088DD8* FUN_02088DD8(u32 heap_id); +void FUN_02088DF0(struct UnkStruct_02037CF0 *r0); +u16* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id); +BOOL FUN_02088EF8(u16 *r0); + #endif diff --git a/include/wfc_user_info_warning.h b/include/wfc_user_info_warning.h new file mode 100644 index 00000000..2ddb8890 --- /dev/null +++ b/include/wfc_user_info_warning.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_WFC_USER_INFO_WARNING_H +#define POKEDIAMOND_WFC_USER_INFO_WARNING_H + +void ShowWFCUserInfoWarning(u32 heap_id, u32 a1); + +#endif |