summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-10-15 19:57:26 -0500
committerMarcus Huderle <huderlem@gmail.com>2018-10-15 19:57:26 -0500
commitc028df7ce77d8a2e4ba528012ef24e65a17aa5ca (patch)
tree61fa13a25f0dd1bd3f2d2f47931f99a4e6e8d4bf /src
parent5a87582cc10fe330b89733a58eef50c27b0a6877 (diff)
Decompile a couple functions in titlescreen, and label gMain
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main.c16
-rwxr-xr-xsrc/titlescreen.c80
2 files changed, 84 insertions, 12 deletions
diff --git a/src/main.c b/src/main.c
index 5855e35..1d02a13 100755
--- a/src/main.c
+++ b/src/main.c
@@ -1,16 +1,8 @@
#include "global.h"
+#include "main.h"
-struct UnkStruct_200B0C0
+void sub_23C(u8 mainState)
{
- u8 filler0[0x2];
- u8 unk2;
- u8 unk3;
-};
-
-extern struct UnkStruct_200B0C0 gUnknown_0200B0C0;
-
-void sub_23C(u8 arg0)
-{
- gUnknown_0200B0C0.unk2 = arg0;
- gUnknown_0200B0C0.unk3 = 0;
+ gMain.mainState = mainState;
+ gMain.subState = 0;
}
diff --git a/src/titlescreen.c b/src/titlescreen.c
new file mode 100755
index 0000000..9de231d
--- /dev/null
+++ b/src/titlescreen.c
@@ -0,0 +1,80 @@
+#include "global.h"
+#include "titlescreen.h"
+#include "m4a.h"
+#include "main.h"
+
+extern StateFunc gTitlescreenStateFuncs[];
+extern const u8 gTitlescreenBg_Gfx[];
+extern const u16 gTitlescreenBg_Pals[];
+extern const u8 gTitlescreenBgTilemap[];
+extern const u16 gTitlescreenSprites_Pals[];
+extern const u8 gTitlescreenSpritesSavedGame_Gfx[];
+extern const u8 gTitlescreenSpritesNoSavedGame_Gfx[];
+extern const u8 gGBAButtonIcons_Pals[];
+extern const u8 gOptionsSprites_Gfx[];
+
+extern void sub_438(void);
+extern void sub_CBC(void);
+extern void sub_FD5C(void (*func)(void));
+extern void sub_11640(void);
+extern void sub_52C44(void);
+
+extern void sub_10AC0(void);
+
+
+void TitlescreenMain(void)
+{
+ gTitlescreenStateFuncs[gMain.subState]();
+}
+
+void LoadTitlescreenGraphics(void)
+{
+ int autoDisplayMenu;
+
+ sub_438();
+ REG_DISPCNT = DISPCNT_OBJ_ON| DISPCNT_FORCED_BLANK;
+ REG_BG1CNT = BGCNT_256COLOR | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(0);
+ REG_DISPCNT |= DISPCNT_BG1_ON;
+ gMain.unk16 = REG_DISPCNT;
+
+ DmaCopy16(3, gTitlescreenBg_Gfx, (void *)BG_CHAR_ADDR(1), 0xA000);
+ DmaCopy16(3, gTitlescreenBg_Pals, (void *)BG_PLTT, BG_PLTT_SIZE);
+ DmaCopy16(3, gTitlescreenBgTilemap, (void *)BG_SCREEN_ADDR(0), BG_SCREEN_SIZE);
+
+ sub_52C44();
+ if (gMain.unk40 == 1)
+ {
+ DmaCopy16(3, gTitlescreenSprites_Pals, (void *)OBJ_PLTT, 0xA0);
+ DmaCopy16(3, gTitlescreenSpritesSavedGame_Gfx, (void *)BG_CHAR_ADDR(4), 0x7000);
+ DmaCopy16(3, gGBAButtonIcons_Pals, (void *)(OBJ_PLTT + 0xA0), 0x40);
+ DmaCopy16(3, gOptionsSprites_Gfx, (void *)OBJ_VRAM0 + 0x7000, 0x400);
+ }
+ else
+ {
+ DmaCopy16(3, gTitlescreenSprites_Pals, (void *)OBJ_PLTT, 0xA0);
+ DmaCopy16(3, gTitlescreenSpritesNoSavedGame_Gfx, (void *)BG_CHAR_ADDR(4), 0x7000);
+ DmaCopy16(3, gGBAButtonIcons_Pals, (void *)(OBJ_PLTT + 0xA0), 0x40);
+ DmaCopy16(3, gOptionsSprites_Gfx, (void *)OBJ_VRAM0 + 0x7000, 0x400);
+ }
+
+ sub_10AC0();
+
+ autoDisplayMenu = gAutoDisplayTitlescreenMenu;
+ if (autoDisplayMenu == 1)
+ {
+ gUnknown_202BE24 = 0;
+ gUnknown_2002888.unk9 = 0;
+ gUnknown_2002888.unkB = autoDisplayMenu;
+ gMain.subState = 3;
+ sub_CBC();
+ sub_FD5C(NULL);
+ }
+ else
+ {
+ gMain.subState = 1;
+ sub_CBC();
+ sub_FD5C(sub_11640);
+ }
+
+ m4aSongNumStart(1);
+}