Skip to content

Commit

Permalink
Merge pull request #23 from SethBarberee/ereader
Browse files Browse the repository at this point in the history
Decomp first half of ereader
  • Loading branch information
WhenGryphonsFly authored Jun 25, 2023
2 parents c53395c + bca8cc3 commit dd96e92
Show file tree
Hide file tree
Showing 15 changed files with 562 additions and 1,421 deletions.
1,285 changes: 2 additions & 1,283 deletions asm/ereader.s

Large diffs are not rendered by default.

70 changes: 0 additions & 70 deletions asm/rom_9BC.s
Original file line number Diff line number Diff line change
Expand Up @@ -2199,73 +2199,3 @@ sub_24DC: @ 0x080024DC
.align 2, 0
_08002504: .4byte 0x04000134
_08002508: .4byte 0x0400012A

thumb_func_start sub_250C
sub_250C: @ 0x0800250C
ldr r2, _08002528 @ =0x04000208
movs r0, #0
strh r0, [r2]
ldr r1, _0800252C @ =0x04000200
ldr r3, _08002530 @ =0x00002001
adds r0, r3, #0
strh r0, [r1]
ldr r1, _08002534 @ =0x04000004
movs r0, #8
strh r0, [r1]
movs r0, #1
strh r0, [r2]
bx lr
.align 2, 0
_08002528: .4byte 0x04000208
_0800252C: .4byte 0x04000200
_08002530: .4byte 0x00002001
_08002534: .4byte 0x04000004

thumb_func_start sub_2538
sub_2538: @ 0x08002538
ldr r0, _08002554 @ =gUnknown_0202ADD0
movs r1, #0
str r1, [r0]
ldr r0, _08002558 @ =gUnknown_0201A444
movs r2, #0
strh r1, [r0]
ldr r0, _0800255C @ =gUnknown_0202BDF0
str r1, [r0]
ldr r0, _08002560 @ =gUnknown_0201C1AC
strb r2, [r0]
ldr r0, _08002564 @ =gUnknown_0202ADDC
strb r2, [r0]
bx lr
.align 2, 0
_08002554: .4byte gUnknown_0202ADD0
_08002558: .4byte gUnknown_0201A444
_0800255C: .4byte gUnknown_0202BDF0
_08002560: .4byte gUnknown_0201C1AC
_08002564: .4byte gUnknown_0202ADDC

thumb_func_start sub_2568
sub_2568: @ 0x08002568
push {r4, lr}
bl sub_24DC
ldr r4, _08002594 @ =0x04000208
movs r0, #0
strh r0, [r4]
bl ResetMainCallback
bl ResetVBlankIntrFunc
ldr r1, _08002598 @ =0x04000200
ldr r2, _0800259C @ =0x00002005
adds r0, r2, #0
strh r0, [r1]
ldr r1, _080025A0 @ =0x04000004
movs r0, #0x28
strh r0, [r1]
movs r0, #1
strh r0, [r4]
pop {r4}
pop {r0}
bx r0
.align 2, 0
_08002594: .4byte 0x04000208
_08002598: .4byte 0x04000200
_0800259C: .4byte 0x00002005
_080025A0: .4byte 0x04000004
15 changes: 15 additions & 0 deletions include/constants/bg_music.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef GUARD_CONSTANTS_BG_MUSIC_H
#define GUARD_CONSTANTS_BG_MUSIC_H

#define MUS_TITLE 1
#define MUS_TABLE_SELECT 3
#define MUS_UNKNOWN_SONG_1 5
#define MUS_UNKNOWN_SONG_5 6
#define MUS_OPENING 8
#define MUS_SHOP 11
#define MUS_END_OF_BALL 13
#define MUS_MOVE_MODE_START 16
#define MUS_EVOLUTION 26
#define MUS_POKEDEX 46

#endif // GUARD_CONSTANTS_BG_MUSIC_H
15 changes: 15 additions & 0 deletions include/constants/ereader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef GUARD_CONSTANTS_EREADER_H
#define GUARD_CONSTANTS_EREADER_H


enum eReaderBonuses
{
EREADER_SPECIAL_GUESTS_CARD = 0, // Card ID: 09-A002
EREADER_ENCOUNTER_RATE_UP_CARD = 1, // Card ID: 09-A005
EREADER_DX_MODE_CARD = 2, // Card ID: 09-A004
EREADER_RUIN_AREA_CARD = 3, // Card ID: 09-A003
EREADER_BONUS_STAGE_CARD = 4, // Card ID: 09-A001
NUM_EREADER_CARDS
};

#endif // GUARD_CONSTANTS_EREADER_H
2 changes: 2 additions & 0 deletions include/constants/species.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,7 @@
#define SPECIES_NONE 0xCD

#define BONUS_SPECIES_START SPECIES_CHIKORITA
#define NUM_BONUS_SPECIES (SPECIES_NONE - SPECIES_CHIKORITA)
#define NUM_SPECIES SPECIES_NONE

#endif // GUARD_CONSTANTS_SPECIES_H
89 changes: 45 additions & 44 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,47 +77,48 @@ void ClearSprites(void);
void sub_0678(u8 *arg0, s16 arg1, s16 arg2);
void SetMatrixScale(s16 xScale, s16 yScale, s16 matrixNum);

// asm/bonus_field_select.s

//extern ? BonusFieldSelectMain();
//extern ? sub_25C4();
//extern ? sub_2710();
//extern ? sub_2768();
//extern ? sub_2990();
//extern ? sub_29C8();
// src/bonus_field_select.s

extern void BonusFieldSelectMain(void);
extern void sub_25C4(void);
extern void sub_2710(void);
extern void sub_2768(void);
extern void sub_2990(void);
extern void sub_29C8(void);

// src/ereader.c

extern void EReaderMain(void);
extern void LoadEReaderGraphics(void);
extern void sub_2DF0(void);
extern void sub_2E40(void);
extern void sub_2FC0(void);
extern void sub_304C(void);
extern void sub_3208(void);
extern void sub_33A0(void);
extern void sub_343C(void);

// asm/ereader.s

//extern ? EReaderMain();
//extern ? sub_2C78();
//extern ? sub_2DF0();
//extern ? sub_2E40();
//extern ? sub_2FC0();
//extern ? sub_304C();
//extern ? sub_3208();
//extern ? sub_33A0();
//extern ? sub_343C();
//extern ? sub_35C8();
//extern ? sub_374C();
//extern ? sub_377C();
//extern ? sub_37B4();
//extern ? sub_3828();
//extern ? sub_38A0();
//extern ? sub_38F0();
//extern ? sub_394C();
//extern ? sub_3AB4();
//extern ? sub_3C1C();
//extern ? sub_3C78();
//extern ? sub_3CD8();

// asm/field_select.s

//extern ? FieldSelectMain();
//extern ? LoadFieldSelectGraphics();
//extern ? sub_8C38();
//extern ? sub_8C7C();
//extern ? sub_8F64();
//extern ? sub_8F94();
extern void sub_35C8(void);
extern void sub_374C(void);
extern void sub_377C(void);
extern void sub_37B4(s32);
extern void sub_3828(s32, s32);
extern void sub_38A0(u32, u32);
extern s16 GetEReaderCardIndex(void);
extern void sub_394C(void);
extern void sub_3AB4(void);
extern void sub_3C1C(void);
extern void sub_3C78(void);
extern s16 sub_3CD8(void);

// src/field_select.s

extern void FieldSelectMain(void);
extern void LoadFieldSelectGraphics(void);
extern void sub_8C7C(void);
extern void sub_8F64(void);

// asm/high_scores.s

Expand Down Expand Up @@ -790,11 +791,11 @@ extern void sub_13FC(void);
//extern ? sub_17D8();
extern void sub_1828(void);
//extern ? sub_1884();
//extern ? sub_19B4();
extern void sub_19B4(void);
//extern ? sub_19CC();
//extern ? sub_1A78();
//extern ? nullsub_15();
//extern ? sub_1AA4();
extern void sub_1AA4(void);
//extern ? sub_1B04();
//extern ? sub_1C5C();
//extern ? sub_1C84();
Expand All @@ -813,10 +814,10 @@ extern void sub_1F5C(void);
//extern ? sub_23B4();
//extern ? sub_2414();
//extern ? nullsub_16();
//extern ? sub_24DC();
//extern ? sub_250C();
//extern ? sub_2538();
//extern ? sub_2568();
extern void sub_24DC(void);
extern void sub_250C(void);
extern void sub_2538(void);
extern void sub_2568(void);

// asm/start.s

Expand Down
11 changes: 5 additions & 6 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
#define GUARD_MAIN_H

#include "global.h"
#include "constants/ereader.h"
#include "constants/species.h"

// This is probably permanently saved data like pokedex and high scores.
struct SaveData
{
/*0x74*/ u8 pokedexFlags[204];
/*0x140*/ u8 filler140[1];
/*0x74*/ u8 pokedexFlags[NUM_SPECIES];
/*0x141*/ u8 unk141;
/*0x142*/ u8 ballSpeed;
/*0x143*/ u8 unk143;
Expand All @@ -22,12 +23,10 @@ struct Main
/*0x00*/ u8 filler0[0x2];
/*0x02*/ u8 mainState;
/*0x03*/ u8 subState;
/*0x04*/ u8 unk4;
/*0x04*/ u8 selectedField;
/*0x05*/ u8 unk5;
/*0x06*/ u8 unk6;
/*0x07*/ s8 unk7;
/*0x08*/ s8 unk8;
/*0x09*/ u8 filler9[0x3];
/*0x07*/ s8 eReaderBonus[NUM_EREADER_CARDS];
/*0x0C*/ u8 unkC;
/*0x0D*/ u8 unkD;
/*0x0E*/ u8 fillerE[0x1];
Expand Down
2 changes: 2 additions & 0 deletions ld_script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ SECTIONS
src/main.o(.text);
src/gbplayer.o(.text);
asm/rom_9BC.o(.text);
src/rom_9BC.o(.text);
src/bonus_field_select.o(.text);
src/ereader.o(.text);
asm/ereader.o(.text);
asm/pokedex.o(.text);
src/field_select.o(.text);
Expand Down
5 changes: 3 additions & 2 deletions src/bonus_field_select.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "global.h"
#include "constants/bg_music.h"
#include "m4a.h"
#include "main.h"
#include "functions.h"
Expand Down Expand Up @@ -61,7 +62,7 @@ void sub_25C4(void)
sub_0CBC();
sub_2710();
sub_FD5C(sub_29C8);
m4aSongNumStart(0x3);
m4aSongNumStart(MUS_TABLE_SELECT);

gMain.subState++;
}
Expand Down Expand Up @@ -169,7 +170,7 @@ void sub_2768(void)
if (gUnknown_0202BE1C > 5)
{
gMain.unkD = 0;
gMain.unk5 = gMain.unk4 = gUnknown_086A4CF0[gUnknown_0201A4F8];
gMain.unk5 = gMain.selectedField = gUnknown_086A4CF0[gUnknown_0201A4F8];
gMain.unk6 = 1;
gUnknown_0202BEE4 = 2;
gMain.subState++;
Expand Down
Loading

0 comments on commit dd96e92

Please sign in to comment.