summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/librfu_intr.s26
-rw-r--r--common_syms/librfu_s32id.txt1
-rw-r--r--common_syms/librfu_sio32id.txt1
-rw-r--r--include/intro.h1
-rw-r--r--include/librfu.h4
-rw-r--r--include/link.h2
-rw-r--r--include/link_rfu.h2
-rw-r--r--include/load_save.h2
-rw-r--r--include/m4a.h1
-rw-r--r--include/overworld.h2
-rw-r--r--include/save_failed_screen.h2
-rw-r--r--include/text.h1
-rw-r--r--ld_script.txt4
-rw-r--r--src/librfu_sio32id.c (renamed from src/librfu_s32id.c)68
-rw-r--r--src/main.c57
-rw-r--r--sym_common.txt2
16 files changed, 82 insertions, 94 deletions
diff --git a/asm/librfu_intr.s b/asm/librfu_intr.s
index 10ee02e7b..2cc761554 100644
--- a/asm/librfu_intr.s
+++ b/asm/librfu_intr.s
@@ -19,7 +19,7 @@ IntrSIO32: @ 81DFC50
cmp r0, 0
ldmdbeq r11, {r11,sp,lr}
bxeq lr
- bl sub_81E05AC
+ bl Callback_Dummy_ID
ldmdb r11, {r11,sp,lr}
bx lr
_081DFC8C:
@@ -205,7 +205,7 @@ _081DFEFC:
beq _081DFF3C
ldrh r1, [r0, 0x12]
ldrb r0, [r0, 0x6]
- bl sub_81E05A4
+ bl Callback_Dummy_M
b _081DFF3C
.align 2, 0
_081DFF28: .4byte gSTWIStatus
@@ -424,7 +424,7 @@ _081E01D0:
beq _081E0348
mov r0, 0x1EC
add r0, r0, 0x2
- bl sub_81E05A8
+ bl Callback_Dummy_S
b _081E0348
_081E0244:
mov r3, 0x120
@@ -446,7 +446,7 @@ _081E0244:
ldrb r0, [r0, 0x6]
mov r1, r2
orr r0, r0, r3, lsl 8
- bl sub_81E05A8
+ bl Callback_Dummy_S
b _081E0348
_081E0298:
mov r3, 0x208
@@ -681,17 +681,17 @@ STWI_init_slave: @ 81E0518
_081E05A0: .4byte gSTWIStatus
arm_func_end STWI_init_slave
- arm_func_start sub_81E05A4
-sub_81E05A4: @ 81E05A4
+ arm_func_start Callback_Dummy_M
+Callback_Dummy_M: @ 81E05A4
bx r2
- arm_func_end sub_81E05A4
+ arm_func_end Callback_Dummy_M
- arm_func_start sub_81E05A8
-sub_81E05A8: @ 81E05A8
+ arm_func_start Callback_Dummy_S
+Callback_Dummy_S: @ 81E05A8
bx r1
- arm_func_end sub_81E05A8
+ arm_func_end Callback_Dummy_S
- arm_func_start sub_81E05AC
-sub_81E05AC: @ 81E05AC
+ arm_func_start Callback_Dummy_ID
+Callback_Dummy_ID: @ 81E05AC
bx r0
- arm_func_end sub_81E05AC
+ arm_func_end Callback_Dummy_ID
diff --git a/common_syms/librfu_s32id.txt b/common_syms/librfu_s32id.txt
deleted file mode 100644
index 6c24cc4a4..000000000
--- a/common_syms/librfu_s32id.txt
+++ /dev/null
@@ -1 +0,0 @@
-gRfuS32Id
diff --git a/common_syms/librfu_sio32id.txt b/common_syms/librfu_sio32id.txt
new file mode 100644
index 000000000..97395e84b
--- /dev/null
+++ b/common_syms/librfu_sio32id.txt
@@ -0,0 +1 @@
+gRfuSIO32Id
diff --git a/include/intro.h b/include/intro.h
index f01c81a9e..19cdcd032 100644
--- a/include/intro.h
+++ b/include/intro.h
@@ -2,5 +2,6 @@
#define GUARD_INTRO_H
void sub_80EC864(void);
+void c2_copyright_1(void);
#endif //GUARD_INTRO_H
diff --git a/include/librfu.h b/include/librfu.h
index f5a7b4d96..cf409ca69 100644
--- a/include/librfu.h
+++ b/include/librfu.h
@@ -490,7 +490,7 @@ struct RfuStatic
u32 totalPacketSize;
};
-struct RfuS32Id
+struct RfuSIO32Id
{
u8 unk0;
u8 unk1;
@@ -517,7 +517,7 @@ extern struct RfuStatic *gRfuStatic;
extern struct RfuFixed *gRfuFixed;
extern struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX];
extern struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX];
-extern struct RfuS32Id gRfuS32Id;
+extern struct RfuSIO32Id gRfuSIO32Id;
// librfu_s32id
s32 AgbRFU_checkID(u8);
diff --git a/include/link.h b/include/link.h
index 9465f0404..d61152d8a 100644
--- a/include/link.h
+++ b/include/link.h
@@ -259,5 +259,7 @@ void sub_80FA42C(void);
void sub_800B284(struct LinkPlayer * linkPlayer);
bool8 IsWirelessAdapterConnected(void);
bool8 sub_800A474(u8 a0);
+void LinkVSync(void);
+bool8 HandleLinkConnection(void);
#endif // GUARD_LINK_H
diff --git a/include/link_rfu.h b/include/link_rfu.h
index d1bc2b2bc..033f4c8d4 100644
--- a/include/link_rfu.h
+++ b/include/link_rfu.h
@@ -46,6 +46,8 @@ void sub_80FBB20(void);
bool8 sub_80FA484(bool32 a0);
void var_800D_set_xB(void);
struct UnkLinkRfuStruct_02022B14 *sub_80F9800(void);
+void sub_80FCF34(void);
+void InitRFU(void);
#include "mevent_server.h"
extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[];
diff --git a/include/load_save.h b/include/load_save.h
index 10d1083a8..20df691e5 100644
--- a/include/load_save.h
+++ b/include/load_save.h
@@ -4,6 +4,8 @@
#include "global.h"
extern bool32 gFlashMemoryPresent;
+extern struct SaveBlock1 gSaveBlock1;
+extern struct SaveBlock2 gSaveBlock2;
void ClearSav2(void);
void ClearSav1(void);
diff --git a/include/m4a.h b/include/m4a.h
index 2bb7f2124..ee23d917a 100644
--- a/include/m4a.h
+++ b/include/m4a.h
@@ -9,6 +9,7 @@ extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_SE3;
+extern struct SoundInfo gSoundInfo;
void m4aSoundVSync(void);
void m4aSoundVSyncOn(void);
diff --git a/include/overworld.h b/include/overworld.h
index 324150779..69c1e964f 100644
--- a/include/overworld.h
+++ b/include/overworld.h
@@ -150,5 +150,7 @@ void sub_8055738(u8 loc);
void sub_8056078(void *, void *);
void sub_805546C(u8 a0);
+bool32 sub_80582E0(void);
+bool32 sub_8058274(void);
#endif //GUARD_OVERWORLD_H
diff --git a/include/save_failed_screen.h b/include/save_failed_screen.h
index feffa2014..5950430d2 100644
--- a/include/save_failed_screen.h
+++ b/include/save_failed_screen.h
@@ -2,5 +2,7 @@
#define GUARD_SAVE_FAILED_SCREEN_H
extern void DoSaveFailedScreen(u8 saveType); // save_failed_screen
+void sub_80F50F4(void);
+bool32 sub_80F5118(void);
#endif //GUARD_SAVE_FAILED_SCREEN_H
diff --git a/include/text.h b/include/text.h
index 578a0d735..a15b42c92 100644
--- a/include/text.h
+++ b/include/text.h
@@ -255,7 +255,6 @@ u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y);
u8 GetKeypadIconTileOffset(u8 keypadIconId);
u8 GetKeypadIconWidth(u8 keypadIconId);
u8 GetKeypadIconHeight(u8 keypadIconId);
-void SetDefaultFontsPointer(void);
u8 GetFontAttribute(u8 fontId, u8 attributeId);
u8 GetMenuCursorDimensionByFont(u8 fontId, u8 whichDimension);
void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese);
diff --git a/ld_script.txt b/ld_script.txt
index 614bc4c93..c060394f6 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -320,7 +320,7 @@ SECTIONS {
src/librfu_stwi.o(.text);
asm/librfu_intr.o(.text);
src/librfu_rfu.o(.text);
- src/librfu_s32id.o(.text);
+ src/librfu_sio32id.o(.text);
src/isagbprn.o(.text);
asm/libagbsyscall.o(.text);
*libgcc.a:_call_via_rX.o(.text);
@@ -941,7 +941,7 @@ SECTIONS {
src/agb_flash_mx.o(.rodata);
src/agb_flash_le.o(.rodata);
src/librfu_rfu.o(.rodata);
- src/librfu_s32id.o(.rodata);
+ src/librfu_sio32id.o(.rodata);
src/isagbprn.o(.rodata);
*libgcc.a:_divdi3.o(.rodata);
*libgcc.a:_udivdi3.o(.rodata);
diff --git a/src/librfu_s32id.c b/src/librfu_sio32id.c
index ed51dcd12..fc5701986 100644
--- a/src/librfu_s32id.c
+++ b/src/librfu_sio32id.c
@@ -4,7 +4,7 @@ static void Sio32IDIntr(void);
static void Sio32IDInit(void);
static s32 Sio32IDMain(void);
-struct RfuS32Id gRfuS32Id;
+struct RfuSIO32Id gRfuSIO32Id;
static const u16 Sio32ConnectionData[] = { 0x494e, 0x544e, 0x4e45, 0x4f44 }; // NINTENDO
static const char Sio32IDLib_Var[] = "Sio32ID_030820";
@@ -52,7 +52,7 @@ static void Sio32IDInit(void)
REG_RCNT = 0;
REG_SIOCNT = SIO_32BIT_MODE;
REG_SIOCNT |= SIO_INTR_ENABLE | SIO_ENABLE;
- CpuFill32(0, &gRfuS32Id, sizeof(struct RfuS32Id));
+ CpuFill32(0, &gRfuSIO32Id, sizeof(struct RfuSIO32Id));
REG_IF = INTR_FLAG_SERIAL;
}
@@ -60,39 +60,39 @@ static s32 Sio32IDMain(void)
{
u8 r12;
- switch (r12 = gRfuS32Id.unk1)
+ switch (r12 = gRfuSIO32Id.unk1)
{
case 0:
- gRfuS32Id.unk0 = 1;
+ gRfuSIO32Id.unk0 = 1;
REG_SIOCNT |= SIO_38400_BPS;
REG_IME = r12;
REG_IE |= INTR_FLAG_SERIAL;
REG_IME = 1;
- gRfuS32Id.unk1 = 1;
+ gRfuSIO32Id.unk1 = 1;
*(vu8 *)&REG_SIOCNT |= SIO_ENABLE;
break;
case 1:
- if (gRfuS32Id.unkA == 0)
+ if (gRfuSIO32Id.unkA == 0)
{
- if (gRfuS32Id.unk0 == 1)
+ if (gRfuSIO32Id.unk0 == 1)
{
- if (gRfuS32Id.unk2 == 0)
+ if (gRfuSIO32Id.unk2 == 0)
{
- REG_IME = gRfuS32Id.unk2;
+ REG_IME = gRfuSIO32Id.unk2;
REG_SIOCNT |= SIO_ENABLE;
REG_IME = r12;
}
}
- else if (gRfuS32Id.unk4 != 0x8001 && !gRfuS32Id.unk2)
+ else if (gRfuSIO32Id.unk4 != 0x8001 && !gRfuSIO32Id.unk2)
{
- REG_IME = gRfuS32Id.unk2;
+ REG_IME = gRfuSIO32Id.unk2;
REG_IE &= ~INTR_FLAG_SERIAL;
REG_IME = r12;
- REG_SIOCNT = gRfuS32Id.unk2;
+ REG_SIOCNT = gRfuSIO32Id.unk2;
REG_SIOCNT = SIO_32BIT_MODE;
REG_IF = INTR_FLAG_SERIAL;
REG_SIOCNT |= SIO_INTR_ENABLE | SIO_ENABLE;
- REG_IME = gRfuS32Id.unk2;
+ REG_IME = gRfuSIO32Id.unk2;
REG_IE |= INTR_FLAG_SERIAL;
REG_IME = r12;
}
@@ -100,11 +100,11 @@ static s32 Sio32IDMain(void)
}
else
{
- gRfuS32Id.unk1 = 2;
+ gRfuSIO32Id.unk1 = 2;
// fallthrough
}
default:
- return gRfuS32Id.unkA;
+ return gRfuSIO32Id.unkA;
}
return 0;
}
@@ -122,43 +122,43 @@ static void Sio32IDIntr(void)
#endif
r5 = REG_SIODATA32;
- if (gRfuS32Id.unk0 != 1)
+ if (gRfuSIO32Id.unk0 != 1)
REG_SIOCNT |= SIO_ENABLE;
- r1 = 16 * gRfuS32Id.unk0; // to handle side effect of inline asm
+ r1 = 16 * gRfuSIO32Id.unk0; // to handle side effect of inline asm
r1 = (r5 << r1) >> 16;
- r5 = (r5 << 16 * (1 - gRfuS32Id.unk0)) >> 16;
- if (gRfuS32Id.unkA == 0)
+ r5 = (r5 << 16 * (1 - gRfuSIO32Id.unk0)) >> 16;
+ if (gRfuSIO32Id.unkA == 0)
{
- if (r1 == gRfuS32Id.unk6)
+ if (r1 == gRfuSIO32Id.unk6)
{
- if (gRfuS32Id.unk2 > 3)
+ if (gRfuSIO32Id.unk2 > 3)
{
- gRfuS32Id.unkA = r5;
+ gRfuSIO32Id.unkA = r5;
}
- else if (r1 == (u16)~gRfuS32Id.unk4)
+ else if (r1 == (u16)~gRfuSIO32Id.unk4)
{
- r0_ = ~gRfuS32Id.unk6;
+ r0_ = ~gRfuSIO32Id.unk6;
if (r5 == r0_)
- ++gRfuS32Id.unk2;
+ ++gRfuSIO32Id.unk2;
}
}
else
{
- gRfuS32Id.unk2 = gRfuS32Id.unkA;
+ gRfuSIO32Id.unk2 = gRfuSIO32Id.unkA;
}
}
- if (gRfuS32Id.unk2 < 4)
- gRfuS32Id.unk4 = *(gRfuS32Id.unk2 + Sio32ConnectionData);
+ if (gRfuSIO32Id.unk2 < 4)
+ gRfuSIO32Id.unk4 = *(gRfuSIO32Id.unk2 + Sio32ConnectionData);
else
- gRfuS32Id.unk4 = 0x8001;
- gRfuS32Id.unk6 = ~r5;
- REG_SIODATA32 = (gRfuS32Id.unk4 << 16 * (1 - gRfuS32Id.unk0))
- + (gRfuS32Id.unk6 << 16 * gRfuS32Id.unk0);
- if (gRfuS32Id.unk0 == 1 && (gRfuS32Id.unk2 || r5 == 0x494E))
+ gRfuSIO32Id.unk4 = 0x8001;
+ gRfuSIO32Id.unk6 = ~r5;
+ REG_SIODATA32 = (gRfuSIO32Id.unk4 << 16 * (1 - gRfuSIO32Id.unk0))
+ + (gRfuSIO32Id.unk6 << 16 * gRfuSIO32Id.unk0);
+ if (gRfuSIO32Id.unk0 == 1 && (gRfuSIO32Id.unk2 || r5 == 0x494E))
{
for (r0 = 0; r0 < 600; ++r0)
;
- if (gRfuS32Id.unkA == 0)
+ if (gRfuSIO32Id.unkA == 0)
REG_SIOCNT |= SIO_ENABLE;
}
}
diff --git a/src/main.c b/src/main.c
index 60f762a62..5d2db95be 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,4 +1,9 @@
#include "global.h"
+#include "bg.h"
+#include "gpu_regs.h"
+#include "link.h"
+#include "link_rfu.h"
+#include "load_save.h"
#include "main.h"
#include "m4a.h"
#include "random.h"
@@ -6,48 +11,20 @@
#include "gba/flash_internal.h"
#include "battle.h"
#include "help_system.h"
+#include "sound.h"
+#include "new_menu_helpers.h"
+#include "malloc.h"
+#include "overworld.h"
+#include "sprite.h"
+#include "play_time.h"
+#include "pokemon.h"
+#include "intro.h"
+#include "battle_controllers.h"
+#include "scanline_effect.h"
+#include "save_failed_screen.h"
+#include "battle.h"
-extern u16 GetGpuReg(u8);
-extern void SetGpuReg(u8, u16);
-extern void RFUVSync(void);
-extern void LinkVSync(void);
-extern void sub_80FCF34(void);
-extern void LinkVSync(void);
-extern void InitGpuRegManager(void);
-extern void InitRFU(void);
-extern void CheckForFlashMemory(void);
-extern void InitMapMusic(void);
-extern void ResetBgs(void);
-extern void SetDefaultFontsPointer(void);
-extern void InitHeap(void *heapStart, u32 heapSize); // malloc.h
-extern void rfu_REQ_stopMode(void);
-extern void rfu_waitREQComplete(void);
-extern bool32 sub_80582E0(void);
-extern bool32 sub_8058274(void);
-extern void ClearSpriteCopyRequests(void);
-extern void PlayTimeCounter_Update(void);
-extern void MapMusicMain(void);
-extern void EnableInterrupts(u16);
-extern void sub_800DD28(void);
-extern u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void));
-extern void ScanlineEffect_Stop(void);
-extern void sub_80F50F4(void);
-extern bool32 sub_80F5118(void);
-
-extern struct SoundInfo gSoundInfo;
-extern u32 gFlashMemoryPresent;
extern u32 intr_main[];
-extern u8 gHeap[];
-extern struct SaveBlock1 gSaveBlock1;
-extern struct SaveBlock2 gSaveBlock2;
-extern struct PokemonStorage gPokemonStorage;
-extern u32 gBattleTypeFlags;
-extern u8 gUnknown_03002748;
-extern u32 *gUnknown_0203CF5C;
-
-void Timer3Intr(void);
-bool8 HandleLinkConnection(void);
-void c2_copyright_1(void);
static void VBlankIntr(void);
static void HBlankIntr(void);
diff --git a/sym_common.txt b/sym_common.txt
index c50f09540..753ce9ebd 100644
--- a/sym_common.txt
+++ b/sym_common.txt
@@ -164,4 +164,4 @@ gUnknown_3005E94: @ 3005E94
.align 4
.include "librfu_rfu.o"
.align 4
- .include "librfu_s32id.o"
+ .include "librfu_sio32id.o"