From 34716558b1f8bc4e9f07e90d3727ea44e74ddd9d Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Thu, 15 Feb 2018 16:54:34 -0600 Subject: Almost finish decompiling intro --- include/gba/io_reg.h | 17 ----------------- include/graphics.h | 20 ++++++++++++++++++++ include/intro.h | 2 +- include/intro_credits_graphics.h | 18 ++++++++++++++++++ include/libgcnmultiboot.h | 17 +++++++++++++++++ include/multiboot_pokemon_colosseum.h | 6 ++++++ include/save.h | 18 +++++++++--------- 7 files changed, 71 insertions(+), 27 deletions(-) create mode 100644 include/intro_credits_graphics.h create mode 100644 include/libgcnmultiboot.h create mode 100644 include/multiboot_pokemon_colosseum.h (limited to 'include') diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 1847b688f..0364c38bc 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -623,23 +623,6 @@ #define TIMER_INTR_ENABLE 0x40 #define TIMER_ENABLE 0x80 -// BGCNT -#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs. -#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data. -#define BGCNT_MOSAIC 0x0040 -#define BGCNT_16COLOR 0x0000 // 4 bits per pixel -#define BGCNT_256COLOR 0x0080 // 8 bits per pixel -#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for tile map. -#define BGCNT_WRAP 0x2000 // Only affects affine BGs. Text BGs wrap by default. -#define BGCNT_TXT256x256 0x0000 // Internal screen size size of text mode BG in pixels. -#define BGCNT_TXT512x256 0x4000 -#define BGCNT_TXT256x512 0x8000 -#define BGCNT_TXT512x512 0xC000 -#define BGCNT_AFF128x128 0x0000 // Internal screen size size of affine mode BG in pixels. -#define BGCNT_AFF256x256 0x4000 -#define BGCNT_AFF512x512 0x8000 -#define BGCNT_AFF1024x1024 0xC000 - // serial #define SIO_ID 0x0030 // Communication ID diff --git a/include/graphics.h b/include/graphics.h index 6e5de9ef4..76eaff28f 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2725,4 +2725,24 @@ extern const u16 gBagScreenFemale_Pal[]; extern const u16 gBagScreenMale_Pal[]; extern const u8 gBagMenuHMIcon_Gfx[]; +//intro graphics +extern const u8 gIntro3GroudonGfx[]; +extern const u8 gIntro3GroudonTilemap[]; +extern const u8 gIntro3LegendBgGfx[]; +extern const u8 gIntro3GroudonBgTilemap[]; +extern const u8 gIntro3GroudonBgTilemap[]; +extern const u8 gIntro3BgPal[0x200]; +extern const u8 gIntro3KyogreGfx[]; +extern const u8 gIntro3KyogreTilemap[]; +extern const u8 gIntro3KyogreBgTilemap[]; +extern const u8 gIntro3CloudsGfx[]; +extern const u8 gIntro3Clouds1Tilemap[]; +extern const u8 gIntro3Clouds2Tilemap[]; +extern const u8 gIntro3Clouds3Tilemap[]; +extern const u8 gIntro3Clouds4Tilemap[]; +extern const u8 gIntro3RayquazaTilemap[]; +extern const u8 gIntro3RayquazaGfx[]; +extern const u8 gIntro3Clouds2Gfx[]; +extern const u16 gIntro1GameFreakTextFadePal[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/intro.h b/include/intro.h index aae3438fe..b1bfe20a4 100644 --- a/include/intro.h +++ b/include/intro.h @@ -6,7 +6,7 @@ // Exported RAM declarations // Exported ROM declarations -void c2_copyright_1(void); +void CB2_InitCopyrightScreenAfterBootup(void); void CB2_InitCopyrightScreenAfterBootup(void); void CB2_InitCopyrightScreenAfterTitleScreen(void); void sub_816F2A8(u16, u16, u16, u16); diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h new file mode 100644 index 000000000..c63861d87 --- /dev/null +++ b/include/intro_credits_graphics.h @@ -0,0 +1,18 @@ +#ifndef GUARD_INTRO_CREDITS_GRAPHICS_H +#define GUARD_INTRO_CREDITS_GRAPHICS_H + +extern const struct CompressedSpriteSheet gIntro2BrendanSpriteSheet[]; +extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[]; +extern const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[]; +extern const struct CompressedSpriteSheet gIntro2FlygonSpriteSheet[]; +extern const struct SpritePalette gUnknown_085F530C[]; + +void load_intro_part2_graphics(u8 a); +void sub_817B150(u8 a); +u8 sub_817B3DC(u8 a, u16 b, u16 c, u16 d); +void sub_817B540(u8); +u8 intro_create_brendan_sprite(s16 a, s16 b); +u8 intro_create_may_sprite(s16 a, s16 b); +u8 intro_create_flygon_sprite(s16 a, s16 b); + +#endif // GUARD_INTRO_CREDITS_GRAPHICS_H diff --git a/include/libgcnmultiboot.h b/include/libgcnmultiboot.h new file mode 100644 index 000000000..7d347df05 --- /dev/null +++ b/include/libgcnmultiboot.h @@ -0,0 +1,17 @@ +#ifndef GUARD_LIBGCMMULTIBOOT_H +#define GUARD_LIBGCNMULTIBOOT_H + +struct GcmbStruct +{ + u16 gcmb_field_0; + vu8 gcmb_field_2; + u8 filler3[0x2C - 0x3]; +}; + +void GameCubeMultiBoot_Main(struct GcmbStruct *pStruct); +void GameCubeMultiBoot_ExecuteProgram(struct GcmbStruct *pStruct); +void GameCubeMultiBoot_Init(struct GcmbStruct *pStruct); +void GameCubeMultiBoot_HandleSerialInterrupt(struct GcmbStruct *pStruct); +void GameCubeMultiBoot_Quit(void); + +#endif // GUARD_LIBGCNMULTIBOOT_H diff --git a/include/multiboot_pokemon_colosseum.h b/include/multiboot_pokemon_colosseum.h new file mode 100644 index 000000000..33e4bc33c --- /dev/null +++ b/include/multiboot_pokemon_colosseum.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MULTIBOOT_POKEMON_COLOSSEUM_H +#define GUARD_MULTIBOOT_POKEMON_COLOSSEUM_H + +extern const u16 gMultiBootProgram_PokemonColosseum_Start[0x14000]; + +#endif // GUARD_MULTIBOOT_POKEMON_COLOSSEUM_H diff --git a/include/save.h b/include/save.h index 3bd1ff8cf..f06db2955 100644 --- a/include/save.h +++ b/include/save.h @@ -47,19 +47,19 @@ enum // Do save types enum { - NORMAL_SAVE, - LINK_SAVE, - //EREADER_SAVE, // depreciated in Emerald - LINK2_SAVE, // unknown 2nd link save - HOF_SAVE, - DIFFERENT_FILE_SAVE, - HOF_DELETE_SAVE // unused + SAVE_NORMAL, + SAVE_LINK, + //EREADER_SAVE, // deprecated in Emerald + SAVE_LINK2, // unknown 2nd link save + SAVE_HALL_OF_FAME, + SAVE_OVERWRITE_DIFFERENT_FILE, + SAVE_HALL_OF_FAME_ERASE_BEFORE // unused }; #define SECTION_ID_RECORDED_BATTLE 31 void ClearSaveData(void); -void ResetSaveCounters(void); +void Save_ResetSaveCounters(void); bool32 SetDamagedSectorBits(u8 op, u8 bit); u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location); u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location); @@ -88,7 +88,7 @@ u8 sub_81533E0(void); u8 sub_8153408(void); u8 sub_8153430(void); bool8 sub_8153474(void); -u8 sub_81534D0(u8 a1); +u8 Save_LoadGameData(u8 a1); u16 sub_815355C(void); u32 TryCopySpecialSaveSection(u8 sector, u8* dst); u32 sub_8153634(u8 sector, u8* src); -- cgit v1.2.3 From 0a206ee52c19963c778e6e15e4b92e1f0c58a13f Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Thu, 15 Feb 2018 22:30:39 -0600 Subject: Finish decompiling intro --- include/constants/rgb.h | 1 + include/global.h | 6 ++++++ include/graphics.h | 15 +++++++++++++++ include/intro_credits_graphics.h | 4 ++++ 4 files changed, 26 insertions(+) (limited to 'include') diff --git a/include/constants/rgb.h b/include/constants/rgb.h index 8b323799f..fd9c5c5a7 100644 --- a/include/constants/rgb.h +++ b/include/constants/rgb.h @@ -12,5 +12,6 @@ #define RGB_YELLOW RGB(31, 31, 0) #define RGB_MAGENTA RGB(31, 0, 31) #define RGB_CYAN RGB(0, 31, 31) +#define RGB_WHITEALPHA RGB_WHITE | 0x8000 #endif // GUARD_RGB_H diff --git a/include/global.h b/include/global.h index 4a71a8a87..94afcde91 100644 --- a/include/global.h +++ b/include/global.h @@ -35,6 +35,12 @@ // Converts a number to Q4.12 fixed-point format #define Q_4_12(n) ((s16)((n) * 4096)) +// Converts a Q8.8 fixed-point format number to a regular integer +#define Q_8_8_TO_INT(n) ((int)((n) / 256)) + +// Converts a Q4.12 fixed-point format number to a regular integer +#define Q_4_12_TO_INT(n) ((int)((n) / 4096)) + #define PARTY_SIZE 6 #define POKEMON_NAME_LENGTH 10 diff --git a/include/graphics.h b/include/graphics.h index 76eaff28f..770a01ade 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2726,6 +2726,21 @@ extern const u16 gBagScreenMale_Pal[]; extern const u8 gBagMenuHMIcon_Gfx[]; //intro graphics +extern const u8 gIntro1SparkleGfx[]; +extern const u8 gIntro1FlygonGfx[]; +extern const u16 gIntro3LightningPal[]; +extern const u8 gIntroCopyright_Gfx[]; +extern const u8 gIntroCopyright_Tilemap[]; +extern const u16 gIntroCopyright_Pal[]; +extern const u8 gIntro2VolbeatGfx[]; +extern const u8 gIntro2TorchicGfx[]; +extern const u8 gIntro2ManectricGfx[]; +extern const u16 gIntro2VolbeatPal[]; +extern const u16 gIntro2TorchicPal[]; +extern const u16 gIntro2ManectricPal[]; +extern const u8 gIntro2BubblesGfx[]; +extern const u16 gIntro2BubblesPal[]; +extern const u8 gIntro3LightningGfx[]; extern const u8 gIntro3GroudonGfx[]; extern const u8 gIntro3GroudonTilemap[]; extern const u8 gIntro3LegendBgGfx[]; diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h index c63861d87..4e5d025a5 100644 --- a/include/intro_credits_graphics.h +++ b/include/intro_credits_graphics.h @@ -1,6 +1,10 @@ #ifndef GUARD_INTRO_CREDITS_GRAPHICS_H #define GUARD_INTRO_CREDITS_GRAPHICS_H +extern u16 gUnknown_0203BD24; +extern u16 gUnknown_0203BD26; +extern u16 gUnknown_0203BD28; + extern const struct CompressedSpriteSheet gIntro2BrendanSpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[]; -- cgit v1.2.3 From bc4bb5b32e68d225bd714dc36e24a75bc6c3cab4 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Fri, 16 Feb 2018 13:08:21 -0600 Subject: Start intro_credits_graphics decomp --- include/intro_credits_graphics.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h index 4e5d025a5..07c2e51a0 100644 --- a/include/intro_credits_graphics.h +++ b/include/intro_credits_graphics.h @@ -2,8 +2,8 @@ #define GUARD_INTRO_CREDITS_GRAPHICS_H extern u16 gUnknown_0203BD24; -extern u16 gUnknown_0203BD26; -extern u16 gUnknown_0203BD28; +extern s16 gUnknown_0203BD26; +extern s16 gUnknown_0203BD28; extern const struct CompressedSpriteSheet gIntro2BrendanSpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[]; @@ -14,6 +14,7 @@ extern const struct SpritePalette gUnknown_085F530C[]; void load_intro_part2_graphics(u8 a); void sub_817B150(u8 a); u8 sub_817B3DC(u8 a, u16 b, u16 c, u16 d); +void sub_817B458(u8); void sub_817B540(u8); u8 intro_create_brendan_sprite(s16 a, s16 b); u8 intro_create_may_sprite(s16 a, s16 b); -- cgit v1.2.3 From 1605f6253564e4e5f67dd295a1ac70145e5c1c9d Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Sat, 17 Feb 2018 03:55:32 -0600 Subject: Decompile credits --- include/credits.h | 11 +++++++++++ include/decompress.h | 1 - include/graphics.h | 12 +++++++++++- include/intro_credits_graphics.h | 9 ++++++++- include/pokedex.h | 1 + include/starter_choose.h | 5 +++++ 6 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 include/credits.h (limited to 'include') diff --git a/include/credits.h b/include/credits.h new file mode 100644 index 000000000..faad1058a --- /dev/null +++ b/include/credits.h @@ -0,0 +1,11 @@ +#ifndef GUARD_CREDITS_H +#define GUARD_CREDITS_H + +// Exported type declarations + +// Exported RAM declarations +extern EWRAM_DATA bool8 gHasHallOfFameRecords; + +// Exported ROM declarations + +#endif //GUARD_CREDITS_H diff --git a/include/decompress.h b/include/decompress.h index b7515250a..34a678cda 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -28,7 +28,6 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic); void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic); -extern u8 gDecompressionBuffer[]; u32 sub_8034974(const u8 *ptr); #endif // GUARD_DECOMPRESS_H diff --git a/include/graphics.h b/include/graphics.h index 770a01ade..e0c9431ac 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2731,7 +2731,7 @@ extern const u8 gIntro1FlygonGfx[]; extern const u16 gIntro3LightningPal[]; extern const u8 gIntroCopyright_Gfx[]; extern const u8 gIntroCopyright_Tilemap[]; -extern const u16 gIntroCopyright_Pal[]; +extern const u16 gIntroCopyright_Pal[16]; extern const u8 gIntro2VolbeatGfx[]; extern const u8 gIntro2TorchicGfx[]; extern const u8 gIntro2ManectricGfx[]; @@ -2760,4 +2760,14 @@ extern const u8 gIntro3RayquazaGfx[]; extern const u8 gIntro3Clouds2Gfx[]; extern const u16 gIntro1GameFreakTextFadePal[]; +//intro/credits graphics +extern const u8 gIntro2BrendanNoTurnGfx[]; +extern const u8 gIntro2MayNoTurnGfx[]; +extern const u16 gIntro2BrendanNoTurnPal[]; +extern const u16 gIntro2FlygonPal[]; +extern const u8 gIntro2FlygonGfx[]; + +//credits +extern const u8 gCreditsCopyrightEnd_Gfx[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h index 07c2e51a0..354d62e05 100644 --- a/include/intro_credits_graphics.h +++ b/include/intro_credits_graphics.h @@ -10,11 +10,18 @@ extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2FlygonSpriteSheet[]; extern const struct SpritePalette gUnknown_085F530C[]; +extern const struct CompressedSpriteSheet gUnknown_085F5334[]; +extern const struct CompressedSpriteSheet gUnknown_085F5344[]; +extern const struct CompressedSpriteSheet gUnknown_085F5354[]; +extern const struct CompressedSpriteSheet gUnknown_085F53AC[]; +extern const struct CompressedSpriteSheet gUnknown_085F53BC[]; +extern const struct SpritePalette gUnknown_085F5384[]; void load_intro_part2_graphics(u8 a); void sub_817B150(u8 a); +void sub_817B1C8(u8); +void sub_817B3A8(u8); u8 sub_817B3DC(u8 a, u16 b, u16 c, u16 d); -void sub_817B458(u8); void sub_817B540(u8); u8 intro_create_brendan_sprite(s16 a, s16 b); u8 intro_create_may_sprite(s16 a, s16 b); diff --git a/include/pokedex.h b/include/pokedex.h index 236feac45..91968279e 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -19,5 +19,6 @@ enum s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); u16 pokedex_count(u8); u16 sub_80C0844(u8); +u16 sub_80C0E9C(u16, s16, s16, u16); #endif // GUARD_POKEDEX_H diff --git a/include/starter_choose.h b/include/starter_choose.h index 61bc17735..18af478aa 100644 --- a/include/starter_choose.h +++ b/include/starter_choose.h @@ -1,6 +1,11 @@ #ifndef GUARD_STARTER_CHOOSE_H #define GUARD_STARTER_CHOOSE_H +extern const u16 gBirchBagGrassPal[2][16]; +extern const u8 gBirchBagTilemap[]; +extern const u8 gBirchGrassTilemap[]; +extern const u8 gBirchHelpGfx[]; + u16 GetStarterPokemon(u16 chosenStarterId); void CB2_ChooseStarter(void); -- cgit v1.2.3