Almost finish decompiling intro

This commit is contained in:
Diegoisawesome 2018-02-15 16:54:34 -06:00
parent 398e775d90
commit 34716558b1
20 changed files with 2422 additions and 6058 deletions

View File

@ -2678,7 +2678,7 @@ _08176B54:
bl LoadSpritePalettes
movs r0, 0x78
movs r1, 0x2E
bl sub_817B834
bl intro_create_brendan_sprite
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gTasks
@ -2703,7 +2703,7 @@ _08176B54:
movs r0, 0x88
lsls r0, 1
movs r1, 0x2E
bl sub_817B88C
bl intro_create_may_sprite
b _08176C2C
.pool
_08176BD8:
@ -2717,7 +2717,7 @@ _08176BD8:
bl LoadSpritePalettes
movs r0, 0x78
movs r1, 0x2E
bl sub_817B88C
bl intro_create_may_sprite
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gTasks
@ -2742,7 +2742,7 @@ _08176BD8:
movs r0, 0x88
lsls r0, 1
movs r1, 0x2E
bl sub_817B834
bl intro_create_brendan_sprite
_08176C2C:
lsls r0, 24
lsrs r2, r0, 24

File diff suppressed because it is too large Load Diff

View File

@ -828,8 +828,8 @@ sub_817B7C4: @ 817B7C4
.pool
thumb_func_end sub_817B7C4
thumb_func_start sub_817B834
sub_817B834: @ 817B834
thumb_func_start intro_create_brendan_sprite
intro_create_brendan_sprite: @ 817B834
push {r4-r6,lr}
adds r5, r0, 0
adds r4, r1, 0
@ -866,10 +866,10 @@ sub_817B834: @ 817B834
pop {r1}
bx r1
.pool
thumb_func_end sub_817B834
thumb_func_end intro_create_brendan_sprite
thumb_func_start sub_817B88C
sub_817B88C: @ 817B88C
thumb_func_start intro_create_may_sprite
intro_create_may_sprite: @ 817B88C
push {r4-r6,lr}
adds r5, r0, 0
adds r4, r1, 0
@ -906,7 +906,7 @@ sub_817B88C: @ 817B88C
pop {r1}
bx r1
.pool
thumb_func_end sub_817B88C
thumb_func_end intro_create_may_sprite
thumb_func_start nullsub_66
nullsub_66: @ 817B8E4
@ -1019,8 +1019,8 @@ sub_817B948: @ 817B948
.pool
thumb_func_end sub_817B948
thumb_func_start sub_817B9C4
sub_817B9C4: @ 817B9C4
thumb_func_start intro_create_flygon_sprite
intro_create_flygon_sprite: @ 817B9C4
push {r4-r6,lr}
mov r6, r8
push {r6}
@ -1072,6 +1072,6 @@ sub_817B9C4: @ 817B9C4
pop {r1}
bx r1
.pool
thumb_func_end sub_817B9C4
thumb_func_end intro_create_flygon_sprite
.align 2, 0 @ Don't pad with nop.

View File

@ -230,9 +230,12 @@ gUnknown_085E4C4C:: @ 85E4C4C
.align 2
gUnknown_085E4C64:: @ 85E4C64
.2byte 0x0068, 0x0000, 0x00c0, 0x008e, 0x0003, 0x0280, 0x0053, 0x0001
.2byte 0x0180, 0x009b, 0x0000, 0x0080, 0x0038, 0x0002, 0x0200, 0x00ae
.2byte 0x0001, 0x0100
.2byte 0x0068, 0x0000, 0x00c0
.2byte 0x008e, 0x0003, 0x0280
.2byte 0x0053, 0x0001, 0x0180
.2byte 0x009b, 0x0000, 0x0080
.2byte 0x0038, 0x0002, 0x0200
.2byte 0x00ae, 0x0001, 0x0100
.align 2
gUnknown_085E4C88:: @ 85E4C88
@ -246,11 +249,18 @@ gUnknown_085E4C98:: @ 85E4C98
.align 2
gUnknown_085E4CA8:: @ 85E4CA8
.2byte 0x0042, 0x0040, 0x0001, 0x0060, 0x0060, 0x0008, 0x0080, 0x0040
.2byte 0x0001, 0x0090, 0x0030, 0x0008, 0x00a0, 0x0048, 0x0001, 0x00b0
.2byte 0x0060, 0x0008, 0x0060, 0x0060, 0x0004, 0x0070, 0x0068, 0x0008
.2byte 0x0080, 0x0060, 0x0004, 0x0058, 0x0020, 0x0004, 0x0068, 0x0018
.2byte 0x0008, 0x0078, 0x0020, 0x0004
.2byte 0x0042, 0x0040, 0x0001
.2byte 0x0060, 0x0060, 0x0008
.2byte 0x0080, 0x0040, 0x0001
.2byte 0x0090, 0x0030, 0x0008
.2byte 0x00a0, 0x0048, 0x0001
.2byte 0x00b0, 0x0060, 0x0008
.2byte 0x0060, 0x0060, 0x0004
.2byte 0x0070, 0x0068, 0x0008
.2byte 0x0080, 0x0060, 0x0004
.2byte 0x0058, 0x0020, 0x0004
.2byte 0x0068, 0x0018, 0x0008
.2byte 0x0078, 0x0020, 0x0004
.align 2
gUnknown_085E4CF0:: @ 85E4CF0
@ -420,10 +430,22 @@ gUnknown_085E4E90:: @ 85E4E90
.align 2
gUnknown_085E4E94:: @ 85E4E94
.2byte 0x0000, 0xffb8, 0x0001, 0xffc8, 0x0002, 0xffd8, 0x0003, 0xffe8
.2byte 0x0004, 0x0008, 0x0005, 0x0018, 0x0003, 0x0028, 0x0001, 0x0038
.2byte 0x0006, 0x0048, 0x0000, 0xffe4, 0x0001, 0xffec, 0x0002, 0xfff4
.2byte 0x0003, 0xfffc, 0x0002, 0x0004, 0x0004, 0x000c, 0x0005, 0x0014
.2byte 0x0000, 0xffb8
.2byte 0x0001, 0xffc8
.2byte 0x0002, 0xffd8
.2byte 0x0003, 0xffe8
.2byte 0x0004, 0x0008
.2byte 0x0005, 0x0018
.2byte 0x0003, 0x0028
.2byte 0x0001, 0x0038
.2byte 0x0006, 0x0048
.2byte 0x0000, 0xffe4
.2byte 0x0001, 0xffec
.2byte 0x0002, 0xfff4
.2byte 0x0003, 0xfffc
.2byte 0x0002, 0x0004
.2byte 0x0004, 0x000c
.2byte 0x0005, 0x0014
.2byte 0x0003, 0x001c
.align 2

View File

@ -383,17 +383,17 @@ gUnknown_085F52A4:: @ 85F52A4
spr_template 0x03ed, 0x03ed, gUnknown_085F526C, gUnknown_085F5284, NULL, gDummySpriteAffineAnimTable, nullsub_66
.align 2
gUnknown_085F52BC:: @ 85F52BC
gIntro2BrendanSpriteSheet:: @ 85F52BC
obj_tiles gIntro2BrendanNoTurnGfx, 0x2000, 0x03ea
null_obj_tiles
.align 2
gUnknown_085F52CC:: @ 85F52CC
gIntro2MaySpriteSheet:: @ 85F52CC
obj_tiles gIntro2MayNoTurnGfx, 0x2000, 0x03eb
null_obj_tiles
.align 2
gUnknown_085F52DC:: @ 85F52DC
gIntro2BicycleSpriteSheet:: @ 85F52DC
obj_tiles gIntro2BicycleGfx, 0x1000, 0x03e9
null_obj_tiles
@ -403,7 +403,7 @@ gUnknown_085F52EC:: @ 85F52EC
null_obj_tiles
.align 2
gUnknown_085F52FC:: @ 85F52FC
gIntro2FlygonSpriteSheet:: @ 85F52FC
obj_tiles gIntro2FlygonGfx, 0x1000, 0x03ed
null_obj_tiles

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

17
include/libgcnmultiboot.h Normal file
View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -218,6 +218,7 @@ SECTIONS {
asm/use_pokeblock.o(.text);
src/battle_controller_wally.o(.text);
asm/player_pc.o(.text);
src/intro.o(.text);
asm/intro.o(.text);
src/reset_save_heap.o(.text);
src/field_region_map.o(.text);

View File

@ -516,7 +516,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId)
}
else
{
if (sub_81534D0(3) != TRUE)
if (Save_LoadGameData(3) != TRUE)
memset(gDecompressionBuffer, 0, 0x2000);
}
@ -885,7 +885,7 @@ void CB2_DoHallOfFamePC(void)
static void Task_HofPC_CopySaveData(u8 taskId)
{
sub_81980F0(0, 0x1E, 0, 0xC, 0x226);
if (sub_81534D0(3) != 1)
if (Save_LoadGameData(3) != 1)
{
gTasks[taskId].func = Task_HofPC_PrintDataIsCorrupted;
}

2281
src/intro.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -166,7 +166,7 @@ static void InitMainCallbacks(void)
gUnknown_0203CF5C = NULL;
gMain.vblankCounter2 = 0;
gMain.callback1 = NULL;
SetMainCallback2(c2_copyright_1);
SetMainCallback2(CB2_InitCopyrightScreenAfterBootup);
gSaveBlock2Ptr = &gSaveblock2;
gPokemonStoragePtr = &gPokemonStorage;
}

View File

@ -241,7 +241,7 @@ static void CB2_MysteryEventMenu(void)
u16 unkVal = RunMysteryEventScript(gDecompressionBuffer);
CpuFill32(0, gDecompressionBuffer, 0x7D4);
if (!GetEventLoadMessage(gStringVar4, unkVal))
TrySavingData(NORMAL_SAVE);
TrySavingData(SAVE_NORMAL);
gMain.state++;
}
break;

View File

@ -20,8 +20,8 @@ void sub_81700F8(void)
gMain.inBattle = FALSE;
SetSaveBlocksPointers(sub_815355C());
sub_808447C();
ResetSaveCounters();
sub_81534D0(0);
Save_ResetSaveCounters();
Save_LoadGameData(0);
if (gSaveFileStatus == 0 || gSaveFileStatus == 2)
Sav2_ClearSetDefault();
SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound);

View File

@ -3,6 +3,7 @@
#include "save.h"
#include "constants/game_stat.h"
#include "task.h"
#include "decompress.h"
// for the chunk declarations
extern struct SaveBlock2 gSaveblock2;
@ -96,7 +97,7 @@ void ClearSaveData(void)
}
}
void ResetSaveCounters(void)
void Save_ResetSaveCounters(void)
{
gSaveCounter = 0;
gLastWrittenSector = 0;
@ -670,25 +671,25 @@ u8 HandleSavingData(u8 saveType)
UpdateSaveAddresses();
switch (saveType)
{
case HOF_DELETE_SAVE: // deletes HOF before overwriting HOF completely. unused
case SAVE_HALL_OF_FAME_ERASE_BEFORE: // deletes HOF before overwriting HOF completely. unused
for (i = 0xE * 2 + 0; i < 32; i++)
EraseFlashSector(i);
case HOF_SAVE: // hall of fame.
case SAVE_HALL_OF_FAME: // hall of fame.
if (GetGameStat(GAME_STAT_ENTERED_HOF) < 999)
IncrementGameStat(GAME_STAT_ENTERED_HOF);
SaveSerializedGame();
save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
tempAddr = (u8 *)0x201C000; // FIXME: make this a label.
tempAddr = gDecompressionBuffer;
HandleWriteSectorNBytes(0x1C, tempAddr, 0xF80);
HandleWriteSectorNBytes(0x1D, tempAddr + 0xF80, 0xF80);
break;
case NORMAL_SAVE: // normal save. also called by overwriting your own save.
case SAVE_NORMAL: // normal save. also called by overwriting your own save.
default:
SaveSerializedGame();
save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
break;
case LINK_SAVE: // _081532C4
case LINK2_SAVE:
case SAVE_LINK: // _081532C4
case SAVE_LINK2:
SaveSerializedGame();
for(i = 0; i < 5; i++)
ClearSaveData_2(i, gRamSaveSectionLocations);
@ -702,7 +703,7 @@ u8 HandleSavingData(u8 saveType)
save_write_to_flash(0, gRamSaveSectionLocations);
break;
*/
case DIFFERENT_FILE_SAVE:
case SAVE_OVERWRITE_DIFFERENT_FILE:
for (i = (0xE * 2 + 0); i < 32; i++)
EraseFlashSector(i); // erase HOF.
SaveSerializedGame();
@ -799,7 +800,7 @@ bool8 sub_8153474(void)
return retVal;
}
u8 sub_81534D0(u8 a1)
u8 Save_LoadGameData(u8 a1)
{
u8 result;

View File

@ -155,10 +155,10 @@ gUnknown_03006294: @ 3006294
gUnknown_03006298: @ 3006298
.space 0x8
gUnknown_030062A0: @ 30062A0
gIntroFrameCounter: @ 30062A0
.space 0x10
gUnknown_030062B0: @ 30062B0
gMultibootProgramStruct: @ 30062B0
.space 0x2C
gUnknown_030062DC: @ 30062DC