diff --git a/include/code_809447C.h b/include/code_809447C.h index cfd1c94d5..08cbc077c 100644 --- a/include/code_809447C.h +++ b/include/code_809447C.h @@ -2,12 +2,12 @@ #define GUARD_CODE_809447C_H // size: 0xC -struct unkStruct_80928C0 +typedef struct unkStruct_80928C0 { u32 unk0; s32 unk4; u8 unk8; u8 unk9; -}; +} unkStruct_80928C0; -#endif \ No newline at end of file +#endif // GUARD_CODE_809447C_H \ No newline at end of file diff --git a/include/code_8094F88.h b/include/code_8094F88.h index 6706343a8..e4563104e 100644 --- a/include/code_8094F88.h +++ b/include/code_8094F88.h @@ -60,7 +60,7 @@ u32 *sub_8095108(void); unkStruct_203B48C *sub_8095110(void); void sub_8095118(void); s32 FindOpenMailSlot(void); -bool8 sub_80951BC(unkStruct_203B480 *); +bool8 sub_80951BC(unkStruct_203B480 *mail); bool8 sub_80951FC(unkStruct_203B480 *); unkStruct_203B480 * GetMailatIndex(u8); void DeleteMailAtIndex(u8); @@ -76,4 +76,4 @@ s32 GetFirstIndexofMailType(u8); void sub_8095824(struct unkStruct_8094924 *, unkStruct_203B480 *); void sub_8095774(struct unkStruct_8094924 *, unkStruct_203B480 *); -#endif +#endif // GUARD_CODE_8094F88_H \ No newline at end of file diff --git a/include/code_80958E8.h b/include/code_80958E8.h index f8cadd87c..965c9b7f0 100644 --- a/include/code_80958E8.h +++ b/include/code_80958E8.h @@ -4,28 +4,27 @@ #include "wonder_mail.h" #include "constants/mailbox.h" -struct subStruct_203B490 +// size: 0xC +typedef struct subStruct_203B490 { - // size: 0xC - DungeonLocation dungeon; - u32 seed; + /* 0x0 */ DungeonLocation dungeon; + /* 0x4 */ u32 seed; u32 unk8; -}; - +} subStruct_203B490; -struct unkStruct_203B490 +// size: 0x32C? +typedef struct unkStruct_203B490 { - // size: 0x330? /* 0x0 */ WonderMail mailboxSlots[NUM_MAILBOX_SLOTS]; /* 0x50 */ WonderMail pelipperBoardJobs[MAX_ACCEPTED_JOBS]; /* 0xF0 */ WonderMail jobSlots[MAX_ACCEPTED_JOBS]; u8 unk190[0x28]; u8 unk1B8[0x78]; - struct subStruct_203B490 unk230[16]; - u8 PKMNNewsReceived[NUM_POKEMON_NEWS]; + subStruct_203B490 unk230[16]; + /* 0x2F0 */ u8 PKMNNewsReceived[NUM_POKEMON_NEWS]; bool8 unk328; -}; +} unkStruct_203B490; -extern struct unkStruct_203B490 *gUnknown_203B490; +extern unkStruct_203B490 *gUnknown_203B490; #endif // GUARD_CODE_80958E8_H \ No newline at end of file diff --git a/include/code_80958E8_1.h b/include/code_80958E8_1.h index 7e68cb418..144bd84dc 100644 --- a/include/code_80958E8_1.h +++ b/include/code_80958E8_1.h @@ -3,7 +3,7 @@ #include "wonder_mail.h" -s32 CountJobsinDungeon(u8); -WonderMail *GetJobSlotInfo(u8); +s32 CountJobsinDungeon(u8 dungeon); +WonderMail *GetJobSlotInfo(u8 index); #endif // GUARD_CODE_80958E8_1_H \ No newline at end of file diff --git a/include/code_80972F4.h b/include/code_80972F4.h index 7a018146e..c589b0e4b 100644 --- a/include/code_80972F4.h +++ b/include/code_80972F4.h @@ -2,18 +2,18 @@ #define GUARD_CODE_80972F4_H // size: 0x8 -struct MissionText +typedef struct MissionText { /* 0x0 */ u8 *text; u8 unk4; u8 unk5; u8 unk6; u8 unk7; -}; +} MissionText; const u8 *GetCurrentMissionText(s16); // TODO: this should probably be bool8 but can't get a match just yet -bool32 IsMazeCompleted(s16); +bool32 IsMazeCompleted(s16 mazeIndex); bool8 sub_8097504(s16); const u8 *sub_80975DC(u32); diff --git a/include/dungeon_pokemon_sprites.h b/include/dungeon_pokemon_sprites.h index 27948e745..62da2adfe 100644 --- a/include/dungeon_pokemon_sprites.h +++ b/include/dungeon_pokemon_sprites.h @@ -3,37 +3,40 @@ #include "position.h" -DungeonPokemonStatusSprite +// size: 0x8 +typedef struct DungeonPokemonStatusSprite { - u32 status; - u32 frame; -}; + /* 0x0 */ u32 status; + /* 0x4 */ u32 frame; +} DungeonPokemonStatusSprite; -DungeonPokemonSprite +// size: 0x40 +typedef struct DungeonPokemonSprite { - /* 0x0000 */ u8 exists; - /* 0x0004 */ u32 id; - /* 0x0008 */ u16 species; // Or sprite ID? - /* 0x000A */ u16 unkA; - /* 0x000C */ u32 status; - /* 0x0010 */ u8 visible; - /* 0x0011 */ u8 unk11; - /* 0x0014 */ Position pos; - /* 0x0018 */ Position statusOffsets[2]; - /* 0x0020 */ u32 unk20; - /* 0x0024 */ u32 unk24; - /* 0x0028 */ DungeonPokemonStatusSprite statusSprites[2]; - /* 0x0038 */ u8 unk38; - /* 0x003C */ u16 unk3C; - /* 0x003E */ u16 unk3E; -} + /* 0x0 */ u8 exists; + /* 0x4 */ u32 id; + /* 0x8 */ u16 species; // Or sprite ID? + /* 0xA */ u16 unkA; + /* 0xC */ u32 status; + /* 0x10 */ u8 visible; + /* 0x11 */ u8 unk11; + /* 0x14 */ Position pos; + /* 0x18 */ Position statusOffsets[2]; + /* 0x20 */ u32 unk20; + /* 0x24 */ u32 unk24; + /* 0x28 */ DungeonPokemonStatusSprite statusSprites[2]; + /* 0x38 */ u8 unk38; + /* 0x3C */ u16 unk3C; + /* 0x3E */ u16 unk3E; +} DungeonPokemonSprite; -DungeonPokemonSprites +// size: 0x584 +typedef struct DungeonPokemonSprites { - u32 frame; - DungeonPokemonSprites sprites[22]; -}; + /* 0x0 */ u32 frame; + /* 0x4 */ struct DungeonPokemonSprites sprites[22]; +} DungeonPokemonSprites; extern DungeonPokemonSprites *gDungeonPokemonSprites; -#endif +#endif // GUARD_DUNGEON_POKEMON_SPRITES_H \ No newline at end of file diff --git a/include/friend_area.h b/include/friend_area.h index 7d23a5c51..bb34660ba 100644 --- a/include/friend_area.h +++ b/include/friend_area.h @@ -21,7 +21,7 @@ typedef struct unkStruct_8092638 extern bool8 *gFriendAreas; bool8 *GetBoughtFriendAreas(void); -const u8 *GetFriendAreaDescription(u8); +const u8 *GetFriendAreaDescription(u8 index); const u8 *GetFriendAreaName(u8); s32 GetFriendAreaPrice(u8); bool8 GetFriendAreaStatus(u8); diff --git a/include/gulpin_shop.h b/include/gulpin_shop.h index 069dbb053..c108eab7c 100644 --- a/include/gulpin_shop.h +++ b/include/gulpin_shop.h @@ -36,7 +36,7 @@ typedef struct GulpinShopWork UnkTextStruct2 unk12C[4]; } GulpinShopWork; -bool8 CreateGulpinShop(s32, s16, Move *); +bool8 CreateGulpinShop(s32 isAsleep, s16 pokeSpecies, Move *moves); void DestroyGulpinShop(void); bool8 GulpinIsNextMoveLinked(void); diff --git a/include/gulpin_shop_801FB50.h b/include/gulpin_shop_801FB50.h index a51a0c3e0..081235d48 100644 --- a/include/gulpin_shop_801FB50.h +++ b/include/gulpin_shop_801FB50.h @@ -8,7 +8,7 @@ #include "text.h" // size: 0x1E0 -struct unkStruct_203B27C +typedef struct unkStruct_203B27C { /* 0x0 */ bool32 isAsleep; /* 0x4 */ s32 state; @@ -42,7 +42,7 @@ struct unkStruct_203B27C u8 unk17A; OpenedFile **unk17C; UnkTextStruct2 unk180[4]; -}; +} unkStruct_203B27C; bool8 sub_801FB50(u32); u32 sub_801FC40(void); diff --git a/include/kangaskhan_storage1.h b/include/kangaskhan_storage1.h index aa591fdba..4b2e9310e 100644 --- a/include/kangaskhan_storage1.h +++ b/include/kangaskhan_storage1.h @@ -54,7 +54,7 @@ struct KangaskhanStorageWork UnkTextStruct2 unkEC[4]; }; -bool8 CreateKangaskhanStorage(u32); +bool8 CreateKangaskhanStorage(u32 mode); void DeleteKangaskhanStorage(void); u32 KangaskhanStorageCallback(void); diff --git a/include/kangaskhan_storage2.h b/include/kangaskhan_storage2.h index 08f72664b..84c6ab0b1 100644 --- a/include/kangaskhan_storage2.h +++ b/include/kangaskhan_storage2.h @@ -6,7 +6,7 @@ #include "text.h" // size: 0x150 -struct unkStruct_203B20C +typedef struct unkStruct_203B20C { /* 0x0 */ u32 state; u8 unk4[4]; @@ -30,7 +30,7 @@ struct unkStruct_203B20C u32 unkE0; u8 fillE4[0xF0 - 0xE4]; UnkTextStruct2 unkF0[4]; -}; +} unkStruct_203B20C; bool8 sub_8017E1C(void); u32 sub_8017E54(void); diff --git a/include/kecleon_bros2.h b/include/kecleon_bros2.h index bb49bd30f..0c72df25d 100644 --- a/include/kecleon_bros2.h +++ b/include/kecleon_bros2.h @@ -5,14 +5,14 @@ #include "text.h" // size: 0xA0 -struct unkStruct_203B214 +typedef struct unkStruct_203B214 { /* 0x0 */ MenuInputStruct input; u32 unk34; UnkTextStruct2 *unk38; UnkTextStruct2 unk3C[4]; u8 unk9C[4]; -}; +} unkStruct_203B214; bool8 sub_8019E40(u32); u32 sub_8019EDC(u8); diff --git a/include/kecleon_bros3.h b/include/kecleon_bros3.h index 92b34579d..797e7d555 100644 --- a/include/kecleon_bros3.h +++ b/include/kecleon_bros3.h @@ -5,14 +5,14 @@ #include "text.h" // size: 0xA0 -struct unkStruct_203B21C +typedef struct unkStruct_203B21C { /* 0x0 */ MenuInputStruct input; u32 unk34; UnkTextStruct2 *unk38; UnkTextStruct2 unk3C[4]; u8 unk9C[4]; -}; +} unkStruct_203B21C; u8 sub_801A20C(u32); u32 sub_801A2A8(u8); diff --git a/include/kecleon_bros4.h b/include/kecleon_bros4.h index 2cce6b984..fcd754231 100644 --- a/include/kecleon_bros4.h +++ b/include/kecleon_bros4.h @@ -6,7 +6,7 @@ #include "text.h" // size: 0xF4 -struct unkStruct_203B224 +typedef struct unkStruct_203B224 { u32 unk0; u32 unk4[INVENTORY_SIZE]; @@ -15,7 +15,7 @@ struct unkStruct_203B224 UnkTextStruct2 *unk8C; UnkTextStruct2 unk90[4]; u8 unkF0[4]; -}; +} unkStruct_203B224; bool8 sub_801A5D8(u32, s32, UnkTextStruct2_sub *, u32); u32 sub_801A6E8(bool8); diff --git a/include/moves.h b/include/moves.h index b557ac7f0..d1a80f606 100644 --- a/include/moves.h +++ b/include/moves.h @@ -76,8 +76,8 @@ bool8 UnlinkMovesAfter(s32, Move *); void UnSetMove(s32, Move *); u8 sub_809287C(Move *); -void sub_80928A0(u8 *, Move *, const struct unkStruct_80928C0 *); -void sub_80928C0(u8 *, Move *, const struct unkStruct_80928C0 *); +void sub_80928A0(u8 *, Move *, const unkStruct_80928C0 *); +void sub_80928C0(u8 *, Move *, const unkStruct_80928C0 *); void sub_8092AA8(Move *, u16); void sub_8092C84(u8 *, u16); s32 sub_8092DB8(Move *, s32); diff --git a/include/music.h b/include/music.h index 1238c1032..6298927e1 100644 --- a/include/music.h +++ b/include/music.h @@ -1,45 +1,6 @@ #ifndef GUARD_MUSIC_H #define GUARD_MUSIC_H -// size: 0x8. PMD keeps its own copy of music players for some reason -struct PMDMusicPlayer -{ - u16 unk0; - u16 songIndex; - u16 volume; - bool8 isNotMaxVolume; -}; - -void InitMusic(void); - -void StopBGMusicVSync(void); -void StartBGMusicVSync(void); -bool8 IsValidSong(u32 songIndex); -void StartNewBGM(u16 songIndex); -bool8 IsBGSong(u32 songIndex); -bool8 IsSoundEffect(u32 songIndex); -bool8 IsFanfare(u32 songIndex); -u16 GetMusicPlayerIndex(u16 songIndex); -bool8 IsMusicPlayerPlaying(u16 songIndex); -void StartNewBGM(u16 songIndex); -void FadeInNewBGM(u16 songIndex, u16 speed); -u16 GetCurrentBGSong(void); -void QueueBGM(u16 songIndex); -void StopBGM(void); // stops all BGM, fanfares and SE's -void FadeOutBGM(u16 speed); -void PlayFanfareSE(u16 songIndex, u16 volume); -void StopFanfareSE(u16 songIndex); -void FadeOutFanfareSE(u16 songIndex, u16 speed); -bool8 IsFanfareSEPlaying(u16 songIndex); -void SoundBiasReset(void); -void SoundBiasSet(void); -void UpdateSound(void); -void SoundVSync(void); -void nullsub_18(void); - -void nullsub_19(void); -void nullsub_20(u16 songIndex); - #define NUM_FANFARES 19 #define FANFARE_START_INDEX 200 @@ -80,4 +41,34 @@ enum Fanfare_Player_State FANFARE_PLAYER_STATE_PLAYING = 3, }; +// size: 0x8. PMD keeps its own copy of music players for some reason +typedef struct PMDMusicPlayer +{ + u16 unk0; + u16 songIndex; + u16 volume; + bool8 isNotMaxVolume; +} PMDMusicPlayer; + +void FadeInNewBGM(u16 songIndex, u16 speed); +void FadeOutBGM(u16 speed); +void FadeOutFanfareSE(u16 songIndex, u16 speed); +u16 GetCurrentBGSong(void); +void InitMusic(void); +bool8 IsFanfareSEPlaying(u16 songIndex); +void nullsub_18(void); +void PlayFanfareSE(u16 songIndex, u16 volume); +void QueueBGM(u16 songIndex); +void SoundVSync(void); +void StartBGMusicVSync(void); +void StartNewBGM(u16 songIndex); +void StopBGM(void); // Stops all BGM, fanfares and SE's +void StopBGMusicVSync(void); +void StopFanfareSE(u16 songIndex); +void UpdateSound(void); + +// libagbsyscall +extern void SoundBiasReset(void); +extern void SoundBiasSet(void); + #endif //GUARD_MUSIC_H \ No newline at end of file diff --git a/include/pokemon.h b/include/pokemon.h index 24fe27145..bcd909324 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -202,7 +202,7 @@ void CopyMonsterNametoBuffer(u8 * buffer, s16 index); void CopyYellowMonsterNametoBuffer(u8 *buffer, s16 index); void PrintColoredPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon, s32 colorNum); void sub_808D930(u8 *buffer, s32 index); -void sub_808D9DC(u8 *, PokemonStruct2 *, s32); +void sub_808D9DC(u8 *buffer, PokemonStruct2 *, s32 colorNum); void sub_808DA0C(u8 *, PokemonStruct2 *); void PeekPokemonItem(s16 index_, BulkItem* item); void GivePokemonItem(s16 index_, BulkItem* item); diff --git a/include/save.h b/include/save.h index 5993310e1..91c11b2c3 100644 --- a/include/save.h +++ b/include/save.h @@ -53,7 +53,7 @@ struct UnkStruct_203B184 { /* 0xC */ unkStruct_203B484 *unkC; /* 0x10 */ u32 *unk10; /* 0x14 */ unkStruct_203B48C *unk14; - /* 0x18 */ struct unkStruct_203B490 *mailInfo; + /* 0x18 */ unkStruct_203B490 *mailInfo; /* 0x1C */ struct RescueTeamData *RescueTeamInfo; /* 0x20 */ struct unkStruct_203B494 *unk20; /* 0x24 */ struct ExclusivePokemonData *ExclusivePokemon; diff --git a/include/save_read.h b/include/save_read.h index 4d237bde1..f32d454a1 100644 --- a/include/save_read.h +++ b/include/save_read.h @@ -2,11 +2,11 @@ #define GUARD_SAVE_READ_H // size: 0x8 -struct SavePakRead +typedef struct SavePakRead { /* 0x0 */ u32 state; /* 0x4 */ u32 readStatus; -}; +} SavePakRead; void PrepareSavePakRead(void); bool8 ReadSavePak(void); diff --git a/include/wigglytuff_shop.h b/include/wigglytuff_shop.h index 661306fd8..39f6372b0 100644 --- a/include/wigglytuff_shop.h +++ b/include/wigglytuff_shop.h @@ -5,34 +5,6 @@ #include "menu.h" #include "text.h" -// size: 0x138 -typedef struct WigglytuffShop -{ - bool32 isAsleep; - s32 state; - s32 fallbackState; - s32 friendAreaPrice; - u8 chosenFriendArea; - s16 chosenSpecies; - u32 menuAction1; - u32 menuAction2; - MenuItem unk1C[8]; - u16 unk5C[0x8]; - MenuStruct unk6C; - /* 0xBC */ OpenedFile *faceFile; - /* 0xC0 */ u8 *faceData; - u16 unkC4; - u16 unkC6; - u8 unkC8; - u8 unkC9; - u8 unkCA; - u8 fillCB; - OpenedFile **unkCC; - UnkTextStruct2 unkD0[4]; - u32 unk130; - u32 unk134; -} WigglytuffShop; - enum WigglytuffStates { WIGGLYTUFF_INIT = 0, @@ -66,8 +38,36 @@ enum WigglytuffStates WIGGLYTUFF_CHECK_LEGENDARY = 28, }; -bool8 sub_80211AC(u32, u32); -bool8 sub_8021774(u8, bool8, s32); +// size: 0x138 +typedef struct WigglytuffShop +{ + bool32 isAsleep; + s32 state; + s32 fallbackState; + s32 friendAreaPrice; + u8 chosenFriendArea; + s16 chosenSpecies; + u32 menuAction1; + u32 menuAction2; + MenuItem unk1C[8]; + u16 unk5C[0x8]; + MenuStruct unk6C; + /* 0xBC */ OpenedFile *faceFile; + /* 0xC0 */ u8 *faceData; + u16 unkC4; + u16 unkC6; + u8 unkC8; + u8 unkC9; + u8 unkCA; + u8 fillCB; + OpenedFile **unkCC; + UnkTextStruct2 unkD0[4]; + u32 unk130; + u32 unk134; +} WigglytuffShop; + +bool8 sub_80211AC(u32 mode, u32); +bool8 sub_8021774(u8 friendArea, bool8, s32); u32 sub_8021274(bool8); u8 sub_802132C(void); void sub_8021354(bool8); diff --git a/src/code_80958E8.c b/src/code_80958E8.c index 00805ab02..ee0953b18 100644 --- a/src/code_80958E8.c +++ b/src/code_80958E8.c @@ -19,17 +19,18 @@ extern void ResetPelipperBoardSlot(u8); extern void ResetJobSlot(u8); extern bool8 ValidateWonderMail(WonderMail *); -EWRAM_DATA_2 struct unkStruct_203B490 *gUnknown_203B490 = {0}; -EWRAM_DATA struct unkStruct_203B490 gUnknown_2039448 = {0}; +static EWRAM_DATA unkStruct_203B490 sUnknown_2039448 = {0}; + +EWRAM_DATA_2 unkStruct_203B490 *gUnknown_203B490 = {0}; void LoadMailInfo(void) { - gUnknown_203B490 = &gUnknown_2039448; + gUnknown_203B490 = &sUnknown_2039448; } -struct unkStruct_203B490 *GetMailInfo(void) +unkStruct_203B490 *GetMailInfo(void) { - return &gUnknown_2039448; + return &sUnknown_2039448; } void InitializeMailJobsNews(void) diff --git a/src/code_80972F4.c b/src/code_80972F4.c index 037b21ede..d9d83e2d1 100644 --- a/src/code_80972F4.c +++ b/src/code_80972F4.c @@ -9,7 +9,7 @@ #include "code_80A26CC.h" #include "code_80972F4.h" -extern struct MissionText gStoryMissionText[]; +extern MissionText gStoryMissionText[]; extern const char gFinalScenarioText[]; extern const char gMeetNinetalesText[]; extern const char gAvoidCaptureText[]; @@ -32,7 +32,7 @@ bool8 sub_8096F50(WonderMail *mail) { s32 index; s32 temp2; - struct subStruct_203B490 *temp; + subStruct_203B490 *temp; temp2 = sub_8096EB0(mail); @@ -276,7 +276,7 @@ void sub_8097418(s16 index,u32 param_2) u8 param_2_u8 = param_2; if (index_s32 != 0xd) { if ((param_2_u8 != 0) && (sub_800199C(0,0x2c,index_s32,0), index_s32 < 0x1f)) { - struct MissionText *mt = &gStoryMissionText[index_s32]; + MissionText *mt = &gStoryMissionText[index_s32]; if (mt->unk4 != 0xFF) { sub_8097FA8(mt->unk4); } @@ -320,7 +320,7 @@ const u8 *GetCurrentMissionText(s16 index) { if(index < 0x1F) { - struct MissionText *mt = &gStoryMissionText[index]; + MissionText *mt = &gStoryMissionText[index]; return mt->text; } else diff --git a/src/data/post_office_guide1.h b/src/data/post_office_guide1.h index e48a03c7d..0db013b7f 100644 --- a/src/data/post_office_guide1.h +++ b/src/data/post_office_guide1.h @@ -21,8 +21,6 @@ enum PostOfficeMenuActions SEND_THANK_YOU_MAIL }; -// - static const u8 sPostOffice[]; static const u8 sBulletinBoard[]; static const u8 sDelivery[]; @@ -45,8 +43,6 @@ ALIGNED(4) static const u8 sDelivery[] = _("Delivery"); ALIGNED(4) static const u8 sBulletinBoard[] = _("Bulletin Board"); ALIGNED(4) static const u8 sPostOffice[] = _("Post Office"); -// - static const u8 sFriendRescueInfo[]; static const u8 sGoRescue[]; static const u8 sGetHelp[]; @@ -69,8 +65,6 @@ ALIGNED(4) static const u8 sGetHelp[] = _("{COLOR_1 YELLOW}Get help{END_COLOR_TE ALIGNED(4) static const u8 sGoRescue[] = _("{COLOR_1 YELLOW}Go rescue{END_COLOR_TEXT_1} "); ALIGNED(4) static const u8 sFriendRescueInfo[] = _("Friend Rescue Info"); -// - static const MenuItem sPostOfficeHelpGoRescueMenu[] = { {"Rescue Procedures", RESCUE_PROCEDURES}, @@ -82,8 +76,6 @@ static const MenuItem sPostOfficeHelpGoRescueMenu[] = {NULL, EXIT} }; -// - static const MenuItem sPostOfficeHelpGetHelpMenu[] = { {"Getting Help", GETTING_HELP}, @@ -94,8 +86,6 @@ static const MenuItem sPostOfficeHelpGetHelpMenu[] = {NULL, EXIT} }; -// - ALIGNED(4) static const u8 sWhatdYouWantToKnow[] = _(" So{COMMA} what{APOSTROPHE}d you want to\n" "know?"); diff --git a/src/gulpin_shop_801FB50.c b/src/gulpin_shop_801FB50.c index 15c311dfd..68cd83752 100644 --- a/src/gulpin_shop_801FB50.c +++ b/src/gulpin_shop_801FB50.c @@ -16,7 +16,7 @@ #include "text1.h" #include "text2.h" -EWRAM_DATA_2 struct unkStruct_203B27C *gUnknown_203B27C = {0}; +EWRAM_DATA_2 unkStruct_203B27C *gUnknown_203B27C = {0}; extern u8 gAvailablePokemonNames[]; // 202DF98 extern u8 gUnknown_202DFE8[]; @@ -72,7 +72,7 @@ bool8 sub_801FB50(u32 mode) ResetUnusedInputStruct(); sub_800641C(NULL, TRUE, TRUE); - gUnknown_203B27C = MemoryAlloc(sizeof(struct unkStruct_203B27C), 0x8); + gUnknown_203B27C = MemoryAlloc(sizeof(unkStruct_203B27C), 0x8); gUnknown_203B27C->menuAction2 = 0; gUnknown_203B27C->menuAction3 = 0; gUnknown_203B27C->menuAction4 = 0; diff --git a/src/kangaskhan_storage2.c b/src/kangaskhan_storage2.c index dc18ff9cf..075eb2558 100644 --- a/src/kangaskhan_storage2.c +++ b/src/kangaskhan_storage2.c @@ -10,7 +10,7 @@ #include "text1.h" #include "text2.h" -EWRAM_DATA_2 struct unkStruct_203B20C *gUnknown_203B20C = {0}; +EWRAM_DATA_2 unkStruct_203B20C *gUnknown_203B20C = {0}; extern const u8 *gUnknown_80D4934[]; extern const u8 *gUnknown_80D4958[]; @@ -39,7 +39,7 @@ bool8 sub_8017E1C(void) { ResetUnusedInputStruct(); sub_800641C(NULL, TRUE, TRUE); - gUnknown_203B20C = MemoryAlloc(sizeof(struct unkStruct_203B20C), 8); + gUnknown_203B20C = MemoryAlloc(sizeof(unkStruct_203B20C), 8); gUnknown_203B20C->menuAction1 = 0; gUnknown_203B20C->menuAction2 = 0; gUnknown_203B20C->menuAction3 = 0; diff --git a/src/kecleon_bros2.c b/src/kecleon_bros2.c index fca0771cd..ae50a2a8d 100644 --- a/src/kecleon_bros2.c +++ b/src/kecleon_bros2.c @@ -9,7 +9,7 @@ #include "text1.h" #include "text2.h" -static EWRAM_DATA_2 struct unkStruct_203B214 *gUnknown_203B214 = {0}; +static EWRAM_DATA_2 unkStruct_203B214 *gUnknown_203B214 = {0}; static EWRAM_DATA_2 u16 gUnknown_203B218 = {0}; #include "data/kecleon_bros2.h" @@ -21,7 +21,7 @@ bool8 sub_8019E40(u32 r0) if (CountKecleonShopItems() == 0) return FALSE; - gUnknown_203B214 = MemoryAlloc(sizeof(struct unkStruct_203B214), 8); + gUnknown_203B214 = MemoryAlloc(sizeof(unkStruct_203B214), 8); gUnknown_203B214->unk34 = r0; gUnknown_203B214->unk38 = &gUnknown_203B214->unk3C[gUnknown_203B214->unk34]; sub_8006518(gUnknown_203B214->unk3C); diff --git a/src/kecleon_bros3.c b/src/kecleon_bros3.c index 9108d3ce5..633619d52 100644 --- a/src/kecleon_bros3.c +++ b/src/kecleon_bros3.c @@ -9,7 +9,7 @@ #include "text1.h" #include "text2.h" -static EWRAM_DATA_2 struct unkStruct_203B21C *gUnknown_203B21C = {0}; +static EWRAM_DATA_2 unkStruct_203B21C *gUnknown_203B21C = {0}; static EWRAM_DATA_2 u16 gUnknown_203B220 = {0}; #include "data/kecleon_bros3.h" @@ -21,7 +21,7 @@ u8 sub_801A20C(u32 r0) if (CountKecleonWareItems() == 0) return 0; - gUnknown_203B21C = MemoryAlloc(sizeof(struct unkStruct_203B21C), 8); + gUnknown_203B21C = MemoryAlloc(sizeof(unkStruct_203B21C), 8); gUnknown_203B21C->unk34 = r0; gUnknown_203B21C->unk38 = &gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34]; sub_8006518(gUnknown_203B21C->unk3C); diff --git a/src/kecleon_bros4.c b/src/kecleon_bros4.c index bba0e2a4d..eefd235df 100644 --- a/src/kecleon_bros4.c +++ b/src/kecleon_bros4.c @@ -13,7 +13,7 @@ extern u8 gUnknown_202DE58[]; -static EWRAM_DATA_2 struct unkStruct_203B224 *gUnknown_203B224 = {0}; +static EWRAM_DATA_2 unkStruct_203B224 *gUnknown_203B224 = {0}; static EWRAM_DATA_2 u16 gUnknown_203B228 = {0}; static EWRAM_DATA_2 u16 gUnknown_203B22A = {0}; @@ -30,7 +30,7 @@ bool8 sub_801A5D8(u32 param_1, s32 param_2, UnkTextStruct2_sub *param_3, u32 par return FALSE; if (gUnknown_203B224 == NULL) - gUnknown_203B224 = MemoryAlloc(sizeof(struct unkStruct_203B224), 8); + gUnknown_203B224 = MemoryAlloc(sizeof(unkStruct_203B224), 8); gUnknown_203B224->unk0 = param_1; FillInventoryGaps(); @@ -425,7 +425,7 @@ static void SortInventoryItems(void) } } -UNUSED static struct unkStruct_203B224 *sub_801AF98(void) +UNUSED static unkStruct_203B224 *sub_801AF98(void) { return gUnknown_203B224; } \ No newline at end of file diff --git a/src/mailbox_8095F8C.c b/src/mailbox_8095F8C.c index 5e3ff99f5..4f4996b81 100644 --- a/src/mailbox_8095F8C.c +++ b/src/mailbox_8095F8C.c @@ -2,7 +2,7 @@ #include "wonder_mail.h" #include "code_80958E8.h" -extern struct unkStruct_203B490 *gUnknown_203B490; +extern unkStruct_203B490 *gUnknown_203B490; bool8 IsMailSlotEmpty(u8); void ResetMailboxSlot(u8); diff --git a/src/moves.c b/src/moves.c index 5dbcee221..525fee219 100644 --- a/src/moves.c +++ b/src/moves.c @@ -18,7 +18,7 @@ extern u32 gUnknown_202DE30; extern u8 gAvailablePokemonNames[]; // 202DF98 // data_8107010.s -extern const struct unkStruct_80928C0 gUnknown_81098C4; +extern const unkStruct_80928C0 gUnknown_81098C4; extern const u8 gUnknown_81098D0[]; extern const u8 gUnknown_81098DC[]; extern const u8 gUnknown_81098E0[]; @@ -72,14 +72,14 @@ u8 sub_809287C(Move *move) return 50; } -void sub_80928A0(u8 *buffer, Move *move, const struct unkStruct_80928C0 *a2) +void sub_80928A0(u8 *buffer, Move *move, const unkStruct_80928C0 *a2) { Move stack; CopyAndResetMove(&stack, move); sub_80928C0(buffer, &stack, a2); } -void sub_80928C0(u8 *buffer, Move *move, const struct unkStruct_80928C0 *param_3) +void sub_80928C0(u8 *buffer, Move *move, const unkStruct_80928C0 *param_3) { u32 uVar2; u32 basePP; diff --git a/src/music.c b/src/music.c index 24b1b209c..27654f880 100644 --- a/src/music.c +++ b/src/music.c @@ -4,24 +4,32 @@ #include "main.h" #include "music.h" -EWRAM_DATA u16 gBGMusicPlayerState = {0}; -EWRAM_DATA u16 gCurrentBGSong = {0}; -EWRAM_DATA u16 gQueuedBGSong = {0}; -EWRAM_DATA u16 gCurrentFanfareSong = {0}; -EWRAM_DATA u16 gFanfareMusicPlayerState = {0}; -EWRAM_DATA u16 gMusicTransitionCounter = {0}; -EWRAM_DATA bool8 gRestartBGM = {0}; +static EWRAM_DATA u16 sBGMusicPlayerstate = {0}; +static EWRAM_DATA u16 sCurrentBGSong = {0}; +static EWRAM_DATA u16 sQueuedBGSong = {0}; +static EWRAM_DATA u16 sCurrentFanfareSong = {0}; +static EWRAM_DATA u16 sFanfareMusicPlayerState = {0}; +static EWRAM_DATA u16 sMusicTransitionCounter = {0}; +static EWRAM_DATA bool8 sRestartBGM = {0}; -IWRAM_DATA struct PMDMusicPlayer gBGMusicPlayers[NUM_BG_PLAYERS] = {0}; -IWRAM_DATA struct PMDMusicPlayer gSEMusicPlayers[NUM_SE_PLAYERS] = {0}; +static IWRAM_DATA PMDMusicPlayer sBGMusicPlayers[NUM_BG_PLAYERS] = {0}; +static IWRAM_DATA PMDMusicPlayer sSEMusicPlayers[NUM_SE_PLAYERS] = {0}; -void nullsub_21(u16); +static u16 GetMusicPlayerIndex(u16 songIndex); +static bool8 IsBGSong(u32 songIndex); +static bool8 IsFanfare(u32 songIndex); +static bool8 IsMusicPlayerPlaying(u16 playerIndex); +static bool8 IsSoundEffect(u32 songIndex); + +static void nullsub_19(void); +static void nullsub_20(u16 songIndex); +static void nullsub_21(u16 songIndex); void InitMusic(void) { s32 playerIndex; - struct PMDMusicPlayer *musicPlayer; + PMDMusicPlayer *musicPlayer; DmaStop(0); DmaStop(1); @@ -30,25 +38,25 @@ void InitMusic(void) m4aSoundInit(); - gBGMusicPlayerState = 0; - gCurrentBGSong = STOP_BGM; - gQueuedBGSong = STOP_BGM; - gCurrentFanfareSong = STOP_SOUND_EFFECT; - gFanfareMusicPlayerState = 0; - gMusicTransitionCounter = 0; - gRestartBGM = FALSE; + sBGMusicPlayerstate = 0; + sCurrentBGSong = STOP_BGM; + sQueuedBGSong = STOP_BGM; + sCurrentFanfareSong = STOP_SOUND_EFFECT; + sFanfareMusicPlayerState = 0; + sMusicTransitionCounter = 0; + sRestartBGM = FALSE; - for(playerIndex = INDEX_BGM, musicPlayer = &gBGMusicPlayers[0]; playerIndex < INDEX_SE6 + 1; playerIndex++, musicPlayer++) - { + for (playerIndex = INDEX_BGM, musicPlayer = &sBGMusicPlayers[0]; playerIndex < INDEX_SE6 + 1; playerIndex++, musicPlayer++) { musicPlayer->unk0 = 0; musicPlayer->songIndex = STOP_SOUND_EFFECT; musicPlayer->volume = 0; musicPlayer->isNotMaxVolume = FALSE; } + nullsub_19(); } -void StopAllMusic(void) +UNUSED static void StopAllMusic(void) { StopBGM(); StopFanfareSE(STOP_FANFARE); @@ -59,30 +67,28 @@ void StartNewBGM(u16 songIndex) { bool8 interrupt_flag; - if(!IsBGSong(songIndex)) + if (!IsBGSong(songIndex)) return; - if(songIndex == STOP_BGM) + if (songIndex == STOP_BGM) return; - if(songIndex == gCurrentBGSong) - { - if((u16)(gBGMusicPlayerState - 1) <= 1) + if (songIndex == sCurrentBGSong) { + if ((u16)(sBGMusicPlayerstate - 1) <= 1) return; } - if(GetMusicPlayerIndex(songIndex) != INDEX_BGM) - { + if (GetMusicPlayerIndex(songIndex) != INDEX_BGM) { nullsub_20(songIndex); return; } - interrupt_flag = DisableInterrupts(); - gCurrentBGSong = songIndex; - gRestartBGM = TRUE; - if(gFanfareMusicPlayerState == 0) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; + interrupt_flag = DisableInterrupts(); + sCurrentBGSong = songIndex; + sRestartBGM = TRUE; + + if (sFanfareMusicPlayerState == 0) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; m4aSongNumStart(songIndex); } - if(interrupt_flag) + if (interrupt_flag) EnableInterrupts(); } @@ -90,70 +96,63 @@ void FadeInNewBGM(u16 songIndex, u16 speed) { bool8 interrupt_flag; - if(!IsBGSong(songIndex)) + if (!IsBGSong(songIndex)) return; - if(songIndex == STOP_BGM) + if (songIndex == STOP_BGM) return; - if(songIndex == gCurrentBGSong) - { - if((u16)(gBGMusicPlayerState - 1) <= 1) + if (songIndex == sCurrentBGSong) { + if ((u16)(sBGMusicPlayerstate - 1) <= 1) return; } - if((speed > 256)) - { + if (speed > 256) speed = 16; - - } - else - { - if((speed >>= 4) == 0) - { + else { + speed >>= 4; + if (speed == 0) speed = 1; - } } interrupt_flag = DisableInterrupts(); - gCurrentBGSong = songIndex; - gRestartBGM = TRUE; + sCurrentBGSong = songIndex; + sRestartBGM = TRUE; - if(gFanfareMusicPlayerState == 0) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; + if (sFanfareMusicPlayerState == 0) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; m4aSongNumStart(songIndex); m4aMPlayImmInit(&gMPlayInfo_BGM); m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFF, 0); m4aSongNumStop(songIndex); m4aMPlayFadeIn(&gMPlayInfo_BGM, speed); } - if(interrupt_flag) + + if (interrupt_flag) EnableInterrupts(); } void QueueBGM(u16 songIndex) { - if(gCurrentBGSong == STOP_BGM) - { + if (sCurrentBGSong == STOP_BGM) { StartNewBGM(songIndex); - gQueuedBGSong = STOP_BGM; + sQueuedBGSong = STOP_BGM; } else - gQueuedBGSong = songIndex; + sQueuedBGSong = songIndex; } void StopBGM(void) { bool8 interrupt_flag = DisableInterrupts(); - if(gFanfareMusicPlayerState == 0) - { - if(gCurrentBGSong != STOP_BGM) - { + + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) m4aMPlayStop(&gMPlayInfo_BGM); - } } - gCurrentBGSong = STOP_BGM; - gQueuedBGSong = STOP_BGM; - if(interrupt_flag) + + sCurrentBGSong = STOP_BGM; + sQueuedBGSong = STOP_BGM; + + if (interrupt_flag) EnableInterrupts(); } @@ -161,225 +160,208 @@ void FadeOutBGM(u16 speed) { bool8 interrupt_flag; - if(speed > ((0x80 << 17) / 65536)) - { +// TODO: int16 memes + if (speed > (0x80 << 17) / 65536) speed = 16; - } - else - { - if((speed >>= 4) == 0) - { + else { + speed >>= 4; + if (speed == 0) speed = 1; - } } + interrupt_flag = DisableInterrupts(); - if(gFanfareMusicPlayerState == 0) - { - if(gCurrentBGSong != STOP_BGM) - { - if(gBGMusicPlayerState == 2) - { - gBGMusicPlayerState = 3; + + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) { + if (sBGMusicPlayerstate == 2) { + sBGMusicPlayerstate = 3; m4aMPlayFadeOut(&gMPlayInfo_BGM, speed); } - else - { - gCurrentBGSong = STOP_BGM; + else { + sCurrentBGSong = STOP_BGM; m4aMPlayStop(&gMPlayInfo_BGM); } } } else - { - gCurrentBGSong = STOP_BGM; - } - gQueuedBGSong = STOP_BGM; - if(interrupt_flag) + sCurrentBGSong = STOP_BGM; + + sQueuedBGSong = STOP_BGM; + + if (interrupt_flag) EnableInterrupts(); } u16 GetCurrentBGSong(void) { - return gCurrentBGSong; + return sCurrentBGSong; } void PlayFanfareSE(u16 songIndex, u16 volume) { - bool8 interrupt_flag; - bool8 interrupt_flag2; - u16 playerIndex; - struct PMDMusicPlayer *musicPlayer; + bool8 interrupt_flag; + bool8 interrupt_flag2; + u16 playerIndex; + PMDMusicPlayer *musicPlayer; - if (songIndex == STOP_SOUND_EFFECT) - return; - if (volume > MAX_VOLUME) - volume = MAX_VOLUME; + if (songIndex == STOP_SOUND_EFFECT) + return; + if (volume > MAX_VOLUME) + volume = MAX_VOLUME; - if (IsFanfare(songIndex)) - { - if (GetMusicPlayerIndex(songIndex) == INDEX_FANFARE) { - interrupt_flag = DisableInterrupts(); - gCurrentFanfareSong = songIndex; - if(gFanfareMusicPlayerState == 0) - { - if (gCurrentBGSong != STOP_BGM) - { - if ((u16)(gBGMusicPlayerState - 1) < 2) - { - gFanfareMusicPlayerState = 1; - gMusicTransitionCounter = 16; - gRestartBGM = FALSE; - m4aMPlayFadeOutTemporarily(&gMPlayInfo_BGM, 1); + if (IsFanfare(songIndex)) { + if (GetMusicPlayerIndex(songIndex) == INDEX_FANFARE) { + interrupt_flag = DisableInterrupts(); + sCurrentFanfareSong = songIndex; + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) { + if ((u16)(sBGMusicPlayerstate - 1) < 2) { + sFanfareMusicPlayerState = 1; + sMusicTransitionCounter = 16; + sRestartBGM = FALSE; + m4aMPlayFadeOutTemporarily(&gMPlayInfo_BGM, 1); + } + else if (sBGMusicPlayerstate == 3) + sFanfareMusicPlayerState = 2; + else { + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + m4aMPlayStop(&gMPlayInfo_BGM); + m4aSongNumStart(sCurrentFanfareSong); + } + } + else { + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + m4aMPlayStop(&gMPlayInfo_BGM); + m4aSongNumStart(sCurrentFanfareSong); + } } - else if (gBGMusicPlayerState == 3) - gFanfareMusicPlayerState = 2; - else - { - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; - m4aMPlayStop(&gMPlayInfo_BGM); - m4aSongNumStart(gCurrentFanfareSong); + else { + if (1 < (u16)(sFanfareMusicPlayerState - 1)) { + m4aMPlayStop(&gMPlayInfo_BGM); + m4aSongNumStart(sCurrentFanfareSong); + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + } } + + switch (sCurrentBGSong) { + case MUS_RAYQUAZAS_DOMAIN: + case MUS_FRIEND_AREA_STRATOS_LOOKOUT: + case MUS_FRIEND_AREA_RAINBOW_PEAK: + case MUS_DREAM_EATER: + case MUS_FRIEND_AREA_DEEPSEA_CURRENT: + case MUS_FRIEND_AREA_SEAFLOOR_CAVE: + case MUS_FRIEND_AREA_VOLCANIC_PIT: + case MUS_FRIEND_AREA_CRYPTIC_CAVE: + case MUS_THE_OTHER_SIDE: + case MUS_THE_MOUNTAIN_OF_FIRE: + case MUS_FRIEND_AREA_LEGENDARY_ISLAND: + case MUS_FRIEND_AREA_SOUTHERN_ISLAND: + case MUS_FRIEND_AREA_ENCLOSED_ISLAND: + case MUS_FRIEND_AREA_FINAL_ISLAND: + case MUS_FRIEND_AREA_HEALING_FOREST: + sRestartBGM = TRUE; + break; + default: + break; + } + + if (interrupt_flag) + EnableInterrupts(); } + else + nullsub_20(songIndex); + } + else { + if (!IsSoundEffect(songIndex)) + return; + + playerIndex = GetMusicPlayerIndex(songIndex); + musicPlayer = &sBGMusicPlayers[playerIndex]; // need to load this before comparison to match + + if (playerIndex < INDEX_SE1) + nullsub_20(songIndex); else { - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; - m4aMPlayStop(&gMPlayInfo_BGM); - m4aSongNumStart(gCurrentFanfareSong); + interrupt_flag2 = DisableInterrupts(); + m4aSongNumStart(songIndex); + musicPlayer->unk0 = 1; + musicPlayer->songIndex = songIndex; + + if (volume == MAX_VOLUME) + musicPlayer->isNotMaxVolume = FALSE; + else + musicPlayer->isNotMaxVolume = TRUE; + + musicPlayer->volume = volume; + if (interrupt_flag2) + EnableInterrupts(); } - } - else - { - if (1 < (u16)(gFanfareMusicPlayerState - 1)) - { - m4aMPlayStop(&gMPlayInfo_BGM); - m4aSongNumStart(gCurrentFanfareSong); - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; - } - } - switch(gCurrentBGSong) - { - case MUS_RAYQUAZAS_DOMAIN: - case MUS_FRIEND_AREA_STRATOS_LOOKOUT: - case MUS_FRIEND_AREA_RAINBOW_PEAK: - case MUS_DREAM_EATER: - case MUS_FRIEND_AREA_DEEPSEA_CURRENT: - case MUS_FRIEND_AREA_SEAFLOOR_CAVE: - case MUS_FRIEND_AREA_VOLCANIC_PIT: - case MUS_FRIEND_AREA_CRYPTIC_CAVE: - case MUS_THE_OTHER_SIDE: - case MUS_THE_MOUNTAIN_OF_FIRE: - case MUS_FRIEND_AREA_LEGENDARY_ISLAND: - case MUS_FRIEND_AREA_SOUTHERN_ISLAND: - case MUS_FRIEND_AREA_ENCLOSED_ISLAND: - case MUS_FRIEND_AREA_FINAL_ISLAND: - case MUS_FRIEND_AREA_HEALING_FOREST: - gRestartBGM = TRUE; - break; - default: - break; - } - if (interrupt_flag) - EnableInterrupts(); } - else - { - nullsub_20(songIndex); - } - } - else - { - if (!IsSoundEffect(songIndex)) - return; - playerIndex = GetMusicPlayerIndex(songIndex); - musicPlayer = &gBGMusicPlayers[playerIndex]; // need to load this before comparison to match - if (playerIndex < INDEX_SE1) - nullsub_20(songIndex); - else - { - interrupt_flag2 = DisableInterrupts(); - m4aSongNumStart(songIndex); - musicPlayer->unk0 = 1; - musicPlayer->songIndex = songIndex; - if(volume == MAX_VOLUME) - { - musicPlayer->isNotMaxVolume = FALSE; - } - else - { - musicPlayer->isNotMaxVolume = TRUE; - } - musicPlayer->volume = volume; - if (interrupt_flag2) - EnableInterrupts(); - } - } } -void SetSoundEffectVolume(u16 songIndex, u16 volume) +UNUSED static void SetSoundEffectVolume(u16 songIndex, u16 volume) { - bool8 interrupt_flag; - u16 playerIndex; - struct MusicPlayerInfo *info; - struct PMDMusicPlayer *musicPlayer; + bool8 interrupt_flag; + u16 playerIndex; + struct MusicPlayerInfo *info; + PMDMusicPlayer *musicPlayer; - if (MAX_VOLUME < volume) { - volume = MAX_VOLUME; - } + if (MAX_VOLUME < volume) + volume = MAX_VOLUME; - if ((!IsFanfare(songIndex)) && (IsSoundEffect(songIndex))) { - playerIndex = GetMusicPlayerIndex(songIndex); - info = gMPlayTable[playerIndex].info; - musicPlayer = &gBGMusicPlayers[playerIndex]; - if (playerIndex >= INDEX_SE1) { - interrupt_flag = DisableInterrupts(); - if (musicPlayer->songIndex == songIndex) { - m4aMPlayVolumeControl(info, 0xf, volume); - } - if (interrupt_flag) - EnableInterrupts(); + if (!IsFanfare(songIndex) && IsSoundEffect(songIndex)) { + playerIndex = GetMusicPlayerIndex(songIndex); + info = gMPlayTable[playerIndex].info; + musicPlayer = &sBGMusicPlayers[playerIndex]; + if (playerIndex >= INDEX_SE1) { + interrupt_flag = DisableInterrupts(); + if (musicPlayer->songIndex == songIndex) + m4aMPlayVolumeControl(info, 0xf, volume); + + if (interrupt_flag) + EnableInterrupts(); + } } - } } void StopFanfareSE(u16 songIndex) { // Each section needs a var for interrupts.. - char cVar1; - char cVar2; - char cVar3; - char cVar4; + bool8 cVar1; + bool8 cVar2; + bool8 cVar3; + bool8 cVar4; u32 playerIndex; s32 playerIndex2; struct MusicPlayerInfo *info; - struct PMDMusicPlayer *musicPlayer; - struct PMDMusicPlayer *musicPlayer1; + PMDMusicPlayer *musicPlayer; + PMDMusicPlayer *musicPlayer1; if (songIndex == STOP_SOUND_EFFECT) { cVar1 = DisableInterrupts(); - for(playerIndex2 = INDEX_SE1, musicPlayer1 = &gSEMusicPlayers[0]; playerIndex2 < INDEX_SE6; playerIndex2++, musicPlayer1++) - { + for (playerIndex2 = INDEX_SE1, musicPlayer1 = &sSEMusicPlayers[0]; playerIndex2 < INDEX_SE6; playerIndex2++, musicPlayer1++) { m4aMPlayStop(gMPlayTable[playerIndex2].info); musicPlayer1->unk0 = 0; musicPlayer1->songIndex = STOP_SOUND_EFFECT; musicPlayer1->volume = 0; musicPlayer1->isNotMaxVolume = FALSE; } - if (cVar1 != '\0') { + + if (cVar1) EnableInterrupts(); - } } - else if (IsSoundEffect(songIndex)) - { + else if (IsSoundEffect(songIndex)) { playerIndex = GetMusicPlayerIndex(songIndex); info = gMPlayTable[playerIndex].info; - musicPlayer = &gBGMusicPlayers[playerIndex]; - if (playerIndex < INDEX_SE1) { + musicPlayer = &sBGMusicPlayers[playerIndex]; + + if (playerIndex < INDEX_SE1) nullsub_21(songIndex); - } else { cVar2 = DisableInterrupts(); + if (musicPlayer->songIndex == songIndex) { m4aMPlayStop(info); musicPlayer->unk0 = 0; @@ -387,73 +369,69 @@ void StopFanfareSE(u16 songIndex) musicPlayer->volume = 0; musicPlayer->isNotMaxVolume = FALSE; } - if (cVar2 != '\0') { + + if (cVar2) EnableInterrupts(); - } } } - else if (songIndex == STOP_FANFARE) - { + else if (songIndex == STOP_FANFARE) { cVar3 = DisableInterrupts(); - if (gFanfareMusicPlayerState != 0) { - if (gCurrentFanfareSong != STOP_SOUND_EFFECT) { - gCurrentFanfareSong = STOP_SOUND_EFFECT; + + if (sFanfareMusicPlayerState != 0) { + if (sCurrentFanfareSong != STOP_SOUND_EFFECT) { + sCurrentFanfareSong = STOP_SOUND_EFFECT; m4aMPlayStop(&gMPlayInfo_Fanfare); } } - if (cVar3 != '\0') { + + if (cVar3) EnableInterrupts(); - } } - else if (IsFanfare(songIndex)) - { + else if (IsFanfare(songIndex)) { cVar4 = DisableInterrupts(); - if (gFanfareMusicPlayerState != 0) { - if (gCurrentFanfareSong == songIndex) { - gCurrentFanfareSong = STOP_SOUND_EFFECT; + + if (sFanfareMusicPlayerState != 0) { + if (sCurrentFanfareSong == songIndex) { + sCurrentFanfareSong = STOP_SOUND_EFFECT; m4aMPlayStop(&gMPlayInfo_Fanfare); } } - if (cVar4 != '\0') { + + if (cVar4) EnableInterrupts(); - } } } void FadeOutFanfareSE(u16 songIndex, u16 speed) { - char cVar1; - char cVar2; - char cVar3; - char cVar4; + bool8 cVar1; + bool8 cVar2; + bool8 cVar3; + bool8 cVar4; u32 comparison; s32 playerIndex2; u32 playerIndex; - struct PMDMusicPlayer *musicPlayer; - struct PMDMusicPlayer *musicPlayer1; + PMDMusicPlayer *musicPlayer; + PMDMusicPlayer *musicPlayer1; struct MusicPlayerInfo *playerInfo; +// TODO: int16 memes comparison = 0x80 << 17; // 16777216 - if((speed * 65536) > comparison) - { + if (speed * 65536 > comparison) speed = 16; - } - else - { - if((speed >>= 4) == 0) - { + else { + speed >>= 4; + if (speed == 0) speed = 1; - } } if (songIndex == STOP_SOUND_EFFECT) { cVar1 = DisableInterrupts(); - for(playerIndex2 = INDEX_SE1, musicPlayer1 = &gSEMusicPlayers[0]; playerIndex2 < INDEX_SE6; playerIndex2++, musicPlayer1++) - { + + for(playerIndex2 = INDEX_SE1, musicPlayer1 = &sSEMusicPlayers[0]; playerIndex2 < INDEX_SE6; playerIndex2++, musicPlayer1++) { if (musicPlayer1->songIndex != STOP_SOUND_EFFECT) { - if (IsMusicPlayerPlaying(playerIndex2)) { - m4aMPlayFadeOut(gMPlayTable[playerIndex2].info,speed); - } + if (IsMusicPlayerPlaying(playerIndex2)) + m4aMPlayFadeOut(gMPlayTable[playerIndex2].info, speed); else { m4aMPlayStop(gMPlayTable[playerIndex2].info); musicPlayer1->unk0 = 0; @@ -463,19 +441,19 @@ void FadeOutFanfareSE(u16 songIndex, u16 speed) } } } - if (cVar1 != '\0') { + + if (cVar1) EnableInterrupts(); - } } else if (IsSoundEffect(songIndex)) { playerIndex = GetMusicPlayerIndex(songIndex); - musicPlayer = &gBGMusicPlayers[playerIndex]; + musicPlayer = &sBGMusicPlayers[playerIndex]; playerInfo = gMPlayTable[playerIndex].info; cVar2 = DisableInterrupts(); + if (musicPlayer->songIndex != STOP_SOUND_EFFECT) { - if (IsMusicPlayerPlaying(playerIndex)) { - m4aMPlayFadeOut(playerInfo,speed); - } + if (IsMusicPlayerPlaying(playerIndex)) + m4aMPlayFadeOut(playerInfo, speed); else { m4aMPlayStop(playerInfo); musicPlayer->unk0 = 0; @@ -484,253 +462,228 @@ void FadeOutFanfareSE(u16 songIndex, u16 speed) musicPlayer->isNotMaxVolume = FALSE; } } - if (cVar2 != '\0') { + + if (cVar2) EnableInterrupts(); - } } else if (songIndex == STOP_FANFARE) { cVar3 = DisableInterrupts(); - if ((gFanfareMusicPlayerState != 0) && (gCurrentFanfareSong != STOP_SOUND_EFFECT)) { - if (IsMusicPlayerPlaying(INDEX_FANFARE)) { - m4aMPlayFadeOut(&gMPlayInfo_Fanfare,speed); - } + + if (sFanfareMusicPlayerState != 0 && sCurrentFanfareSong != STOP_SOUND_EFFECT) { + if (IsMusicPlayerPlaying(INDEX_FANFARE)) + m4aMPlayFadeOut(&gMPlayInfo_Fanfare, speed); else { m4aMPlayStop(&gMPlayInfo_Fanfare); - gCurrentFanfareSong = STOP_SOUND_EFFECT; + sCurrentFanfareSong = STOP_SOUND_EFFECT; } } - if (cVar3 != '\0') { + + if (cVar3) EnableInterrupts(); - } } else if (IsFanfare(songIndex)) { cVar4 = DisableInterrupts(); - if ((gFanfareMusicPlayerState != 0) && (gCurrentFanfareSong == songIndex)) { - if (IsMusicPlayerPlaying(INDEX_FANFARE)) { - m4aMPlayFadeOut(&gMPlayInfo_Fanfare,speed); - } + + if (sFanfareMusicPlayerState != 0 && sCurrentFanfareSong == songIndex) { + if (IsMusicPlayerPlaying(INDEX_FANFARE)) + m4aMPlayFadeOut(&gMPlayInfo_Fanfare, speed); else { m4aMPlayStop(&gMPlayInfo_Fanfare); - gCurrentFanfareSong = STOP_SOUND_EFFECT; + sCurrentFanfareSong = STOP_SOUND_EFFECT; } } - if (cVar4 != '\0') { + + if (cVar4) EnableInterrupts(); - } } } bool8 IsFanfareSEPlaying(u16 songIndex) { - u32 playerIndex; - struct PMDMusicPlayer *musicPlayer; -#ifndef NONMATCHING - register u32 songIndex_u32 asm("r4"); - register u32 songIndex_u32_2 asm("r5"); -#else - u32 songIndex_u32; - u32 songIndex_u32_2; -#endif + u32 playerIndex; + PMDMusicPlayer *musicPlayer; + #ifndef NONMATCHING + register u32 songIndex_u32 asm("r4"); + register u32 songIndex_u32_2 asm("r5"); + #else + u32 songIndex_u32; + u32 songIndex_u32_2; + #endif - songIndex_u32 = songIndex; - songIndex_u32_2 = songIndex_u32; + songIndex_u32 = songIndex; + songIndex_u32_2 = songIndex_u32; - if (IsFanfare(songIndex_u32)) { - if ((gFanfareMusicPlayerState != 0) && (gCurrentFanfareSong == songIndex_u32)) { - return TRUE; + if (IsFanfare(songIndex_u32)) { + if (sFanfareMusicPlayerState != 0 && sCurrentFanfareSong == songIndex_u32) + return TRUE; } - } - else - { - if (IsSoundEffect(songIndex_u32)) { - playerIndex = GetMusicPlayerIndex(songIndex_u32); - musicPlayer = &gBGMusicPlayers[playerIndex]; - if ((INDEX_SE1 <= playerIndex) && (musicPlayer->songIndex == songIndex_u32_2)) { - return TRUE; - } + else { + if (IsSoundEffect(songIndex_u32)) { + playerIndex = GetMusicPlayerIndex(songIndex_u32); + musicPlayer = &sBGMusicPlayers[playerIndex]; + if (INDEX_SE1 <= playerIndex && musicPlayer->songIndex == songIndex_u32_2) + return TRUE; + } } - } - return FALSE; + + return FALSE; } void SoundVSync(void) { - u8 cVar1; + bool8 cVar1; - cVar1 = DisableInterrupts(); - m4aSoundVSync(); - if(cVar1) - EnableInterrupts(); + cVar1 = DisableInterrupts(); + + m4aSoundVSync(); + + if (cVar1) + EnableInterrupts(); } - void nullsub_18(void) { } void UpdateSound(void) { - struct PMDMusicPlayer *musicPlayer; // r4 + PMDMusicPlayer *musicPlayer; // r4 s32 musicPlayerIndex; // r5 - + m4aSoundMain(); - if(gFanfareMusicPlayerState != 0) - { - switch(gFanfareMusicPlayerState) - { + if (sFanfareMusicPlayerState != 0) { + switch (sFanfareMusicPlayerState) { case 1: - if (gMusicTransitionCounter != 0) - { - gMusicTransitionCounter--; + if (sMusicTransitionCounter != 0) + sMusicTransitionCounter--; + else if (sCurrentFanfareSong == STOP_SOUND_EFFECT) { + sFanfareMusicPlayerState = 4; + sMusicTransitionCounter = 32; } - else if (gCurrentFanfareSong == STOP_SOUND_EFFECT) - { - gFanfareMusicPlayerState = 4; - gMusicTransitionCounter = 32; - } - else - { - m4aSongNumStart(gCurrentFanfareSong); - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + else { + m4aSongNumStart(sCurrentFanfareSong); + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; } break; case 2: - if ((gCurrentBGSong != STOP_BGM) && (IsMusicPlayerPlaying(INDEX_BGM))) + if (sCurrentBGSong != STOP_BGM && IsMusicPlayerPlaying(INDEX_BGM)) break; - if (gCurrentFanfareSong == STOP_SOUND_EFFECT) - { - gFanfareMusicPlayerState = 4; - gMusicTransitionCounter = 32; + + if (sCurrentFanfareSong == STOP_SOUND_EFFECT) { + sFanfareMusicPlayerState = 4; + sMusicTransitionCounter = 32; } - else - { - m4aSongNumStart(gCurrentFanfareSong); - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + else { + m4aSongNumStart(sCurrentFanfareSong); + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; } break; case 3: - if ((gCurrentFanfareSong != STOP_SOUND_EFFECT) && (!IsMusicPlayerPlaying(INDEX_FANFARE))) // INDEX_FANFARE + if (sCurrentFanfareSong != STOP_SOUND_EFFECT && !IsMusicPlayerPlaying(INDEX_FANFARE)) // INDEX_FANFARE break; - else { - gFanfareMusicPlayerState = 4; - gMusicTransitionCounter = 32; - } + + sFanfareMusicPlayerState = 4; + sMusicTransitionCounter = 32; break; case 4: - if (gCurrentFanfareSong != STOP_SOUND_EFFECT) - { - if (IsMusicPlayerPlaying(INDEX_FANFARE)) break; // INDEX_FANFARE + if (sCurrentFanfareSong != STOP_SOUND_EFFECT) { + if (IsMusicPlayerPlaying(INDEX_FANFARE)) + break; // INDEX_FANFARE } else m4aMPlayStop(&gMPlayInfo_Fanfare); - if (gMusicTransitionCounter != 0) - { - gMusicTransitionCounter--; + if (sMusicTransitionCounter != 0) { + sMusicTransitionCounter--; break; } - else if (gCurrentBGSong != STOP_BGM) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; - if (gRestartBGM) - m4aSongNumStart(gCurrentBGSong); + + if (sCurrentBGSong != STOP_BGM) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; + + if (sRestartBGM) + m4aSongNumStart(sCurrentBGSong); else m4aMPlayFadeIn(&gMPlayInfo_BGM,4); } - else - { - gBGMusicPlayerState = 0; + else { + sBGMusicPlayerstate = 0; m4aMPlayStop(&gMPlayInfo_BGM); } - gFanfareMusicPlayerState = 0; - gCurrentFanfareSong = STOP_SOUND_EFFECT; + + sFanfareMusicPlayerState = 0; + sCurrentFanfareSong = STOP_SOUND_EFFECT; break; } } - else if (gBGMusicPlayerState != BG_PLAYER_STATE_INITIALIZE) - { - switch(gBGMusicPlayerState) - { - + else if (sBGMusicPlayerstate != BG_PLAYER_STATE_INITIALIZE) { + switch (sBGMusicPlayerstate) { case BG_PLAYER_STATE_PLAYING: - if ((gCurrentBGSong == STOP_BGM) || IsMusicPlayerPlaying(INDEX_BGM)) // INDEX_BGM - { - gBGMusicPlayerState = 2; - } + if (sCurrentBGSong == STOP_BGM || IsMusicPlayerPlaying(INDEX_BGM)) // INDEX_BGM + sBGMusicPlayerstate = 2; break; case 2: case 3: - if (gCurrentBGSong != STOP_BGM) - { - if (IsMusicPlayerPlaying(INDEX_BGM)) break; // INDEX_BGM + if (sCurrentBGSong != STOP_BGM) { + if (IsMusicPlayerPlaying(INDEX_BGM)) + break; // INDEX_BGM } else m4aMPlayStop(&gMPlayInfo_BGM); - gBGMusicPlayerState = 0; - gCurrentBGSong = STOP_BGM; + + sBGMusicPlayerstate = 0; + sCurrentBGSong = STOP_BGM; break; - case BG_PLAYER_STATE_STOPPED: // can also be other constants + case BG_PLAYER_STATE_STOPPED: // Can also be other constants break; } } - else - { - if (!IsMusicPlayerPlaying(INDEX_BGM)) - { + else { + if (!IsMusicPlayerPlaying(INDEX_BGM)) { #ifndef NONMATCHING - register u16 r2 asm("r2") = gQueuedBGSong, r1 = r2; + register u16 r2 asm("r2") = sQueuedBGSong, r1 = r2; #else u16 r2, r1; - r2 = gQueuedBGSong, r1 = r2; + r2 = sQueuedBGSong, r1 = r2; #endif - if (r1 != STOP_BGM) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; - gCurrentBGSong = r2; + if (r1 != STOP_BGM) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; + sCurrentBGSong = r2; m4aSongNumStart(r1); - gQueuedBGSong = STOP_BGM; + sQueuedBGSong = STOP_BGM; } - else - { - gBGMusicPlayerState = 0; - gCurrentBGSong = STOP_BGM; + else { + sBGMusicPlayerstate = 0; + sCurrentBGSong = STOP_BGM; } } } - for(musicPlayerIndex = INDEX_SE1, musicPlayer = &gSEMusicPlayers[0]; musicPlayerIndex < INDEX_SE6; musicPlayerIndex++, musicPlayer++) - { - if (musicPlayer->songIndex != STOP_SOUND_EFFECT) - { - switch(musicPlayer->unk0) - { - case 1: - if ((musicPlayer->songIndex == STOP_BGM) || (IsMusicPlayerPlaying(musicPlayerIndex))) - { - musicPlayer->unk0 = 2; - } - break; - case 2: - if (IsMusicPlayerPlaying(musicPlayerIndex)) - { - if(musicPlayer->isNotMaxVolume) - { - musicPlayer->isNotMaxVolume = FALSE; - m4aMPlayVolumeControl(gMPlayTable[musicPlayerIndex].info,0xff,musicPlayer->volume); - } - } - else - { - musicPlayer->unk0 = 0; - musicPlayer->songIndex = STOP_SOUND_EFFECT; - musicPlayer->volume = 0; + for (musicPlayerIndex = INDEX_SE1, musicPlayer = &sSEMusicPlayers[0]; musicPlayerIndex < INDEX_SE6; musicPlayerIndex++, musicPlayer++) { + if (musicPlayer->songIndex != STOP_SOUND_EFFECT) { + switch (musicPlayer->unk0){ + case 1: + if (musicPlayer->songIndex == STOP_BGM || IsMusicPlayerPlaying(musicPlayerIndex)) + musicPlayer->unk0 = 2; + break; + case 2: + if (IsMusicPlayerPlaying(musicPlayerIndex)) { + if (musicPlayer->isNotMaxVolume) { musicPlayer->isNotMaxVolume = FALSE; + m4aMPlayVolumeControl(gMPlayTable[musicPlayerIndex].info, 0xFF, musicPlayer->volume); } - break; - case 3: - case 0: - break; + } + else { + musicPlayer->unk0 = 0; + musicPlayer->songIndex = STOP_SOUND_EFFECT; + musicPlayer->volume = 0; + musicPlayer->isNotMaxVolume = FALSE; + } + break; + case 3: + case 0: + break; } } } @@ -745,144 +698,116 @@ void StopBGMusicVSync(void) FadeOutFanfareSE(STOP_FANFARE, 0x10); interrupt_flag = DisableInterrupts(); - if(gFanfareMusicPlayerState == 0) - { - if(gCurrentBGSong != STOP_BGM) - { - temp = gBGMusicPlayerState - 1; - if(temp <= 1) - { - if(gBGMusicPlayerState == 2) - { - gRestartBGM = FALSE; - } - else if(gBGMusicPlayerState == BG_PLAYER_STATE_PLAYING) - { - gRestartBGM = TRUE; - } - gBGMusicPlayerState = BG_PLAYER_STATE_STOPPED; + + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) { + temp = sBGMusicPlayerstate - 1; + if (temp <= 1) { + if (sBGMusicPlayerstate == 2) + sRestartBGM = FALSE; + else if (sBGMusicPlayerstate == BG_PLAYER_STATE_PLAYING) + sRestartBGM = TRUE; + + sBGMusicPlayerstate = BG_PLAYER_STATE_STOPPED; } } } + m4aMPlayStop(&gMPlayInfo_BGM); m4aSoundVSyncOff(); - if(interrupt_flag) - { + + if (interrupt_flag) EnableInterrupts(); - } } void StartBGMusicVSync(void) { bool8 interrupt_flag = DisableInterrupts(); + m4aSoundVSyncOn(); - if(gFanfareMusicPlayerState == 0) - { - if(gCurrentBGSong != STOP_BGM) - { - if(gBGMusicPlayerState == BG_PLAYER_STATE_STOPPED) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; - if(gRestartBGM) - { - m4aSongNumStart(gCurrentBGSong); - } + + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) { + if (sBGMusicPlayerstate == BG_PLAYER_STATE_STOPPED) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; + + if (sRestartBGM) + m4aSongNumStart(sCurrentBGSong); else - { m4aMPlayContinue(&gMPlayInfo_BGM); - } } } } - if(interrupt_flag) - { + + if (interrupt_flag) EnableInterrupts(); - } - } -void nullsub_179(void) +UNUSED static void nullsub_179(void) { } -// Unused -bool8 IsValidSong(u32 songIndex) +UNUSED static bool8 IsValidSong(u32 songIndex) { - if(IsBGSong(songIndex)) - { - if(GetMusicPlayerIndex(songIndex) == INDEX_BGM) - { + if (IsBGSong(songIndex)) { + if (GetMusicPlayerIndex(songIndex) == INDEX_BGM) return TRUE; - } } - if(IsFanfare(songIndex)) - { - if(GetMusicPlayerIndex(songIndex) == INDEX_FANFARE) - { + + if (IsFanfare(songIndex)) { + if (GetMusicPlayerIndex(songIndex) == INDEX_FANFARE) return TRUE; - } } - else if(IsSoundEffect(songIndex)) - { - if(GetMusicPlayerIndex(songIndex) >= INDEX_SE1) - { + else if (IsSoundEffect(songIndex)) { + if (GetMusicPlayerIndex(songIndex) >= INDEX_SE1) return TRUE; - } } + return FALSE; } -void nullsub_19(void) +static void nullsub_19(void) { } -bool8 IsBGSong(u32 songIndex) +static bool8 IsBGSong(u32 songIndex) { - if(songIndex <= NUM_BG_SONGS) - { + if (songIndex <= NUM_BG_SONGS) return TRUE; - } return FALSE; } -bool8 IsSoundEffect(u32 songIndex) +static bool8 IsSoundEffect(u32 songIndex) { - if(songIndex - SOUND_EFFECTS_START_INDEX <= NUM_SOUND_EFFECTS) - { + if (songIndex - SOUND_EFFECTS_START_INDEX <= NUM_SOUND_EFFECTS) return TRUE; - } return FALSE; } -bool8 IsFanfare(u32 songIndex) +static bool8 IsFanfare(u32 songIndex) { - if(songIndex - FANFARE_START_INDEX <= NUM_FANFARES) - { + if (songIndex - FANFARE_START_INDEX <= NUM_FANFARES) return TRUE; - } return FALSE; } -u16 GetMusicPlayerIndex(u16 songIndex) +static u16 GetMusicPlayerIndex(u16 songIndex) { return gSongTable[songIndex].ms; } -bool8 IsMusicPlayerPlaying(u16 playerIndex) +static bool8 IsMusicPlayerPlaying(u16 playerIndex) { // Had to cast this.. m4a_internal header has this as u32 - if((u16)gMPlayTable[playerIndex].info->status == 0) - { + if ((u16)gMPlayTable[playerIndex].info->status == 0) return FALSE; - } return TRUE; } -void nullsub_20(u16 songIndex) +static void nullsub_20(u16 songIndex) { } -void nullsub_21(u16 songIndex) +static void nullsub_21(u16 songIndex) { -} - +} \ No newline at end of file diff --git a/src/save.c b/src/save.c index 76a40262e..341b673b0 100644 --- a/src/save.c +++ b/src/save.c @@ -57,7 +57,7 @@ extern u32 sub_8097D60(u8 *, u32); extern u32 sub_8097D98(void* a, s32 b); extern void sub_800135C(void); extern void sub_80958E4(u32 *a, u32 b); -extern struct unkStruct_203B490 *GetMailInfo(void); +extern unkStruct_203B490 *GetMailInfo(void); extern void InitializeMailJobsNews(void); extern void sub_80972F4(void); extern void sub_80974E8(void); diff --git a/src/save_read.c b/src/save_read.c index 7000111bb..a5f1a8111 100644 --- a/src/save_read.c +++ b/src/save_read.c @@ -4,13 +4,13 @@ #include "save.h" #include "save_read.h" -EWRAM_DATA_2 struct SavePakRead *gSavePakRead = {0}; +EWRAM_DATA_2 SavePakRead *gSavePakRead = {0}; #include "data/save_read.h" void PrepareSavePakRead(void) { - gSavePakRead = MemoryAlloc(sizeof(struct SavePakRead), 5); + gSavePakRead = MemoryAlloc(sizeof(SavePakRead), 5); gSavePakRead->state = 1; }