summaryrefslogtreecommitdiff
path: root/src/credits.c
diff options
context:
space:
mode:
authorSeth Barberee <seth.barberee@gmail.com>2021-02-27 10:16:45 -0800
committerGitHub <noreply@github.com>2021-02-27 12:16:45 -0600
commitd72e17b5f5d795bebda2f6dc78dccb5e80c432b5 (patch)
tree776df17a36e2b30d2b362649db4408d701d55f9d /src/credits.c
parent7fa4f1a92bdc4cefb094f9e3f1144ad3e3a588d9 (diff)
Miscellaneous decomp/labeling/splitting (#29)
* lots of wonder mail work, credits and label some stuff * nonmatch one intr func, match another, and label unused intr func * seperate credits out * split out debug menu and other stuff that isn't main menu * label another func * label some more funcs
Diffstat (limited to 'src/credits.c')
-rw-r--r--src/credits.c107
1 files changed, 91 insertions, 16 deletions
diff --git a/src/credits.c b/src/credits.c
index 2f499fb..2329bd4 100644
--- a/src/credits.c
+++ b/src/credits.c
@@ -1,33 +1,108 @@
#include "global.h"
+#include "input.h"
-extern s32 sub_80144A4(s32 *);
-extern void sub_80338C4(u32);
-extern void sub_80338C4(u32);
+extern struct Inputs gRealInputs;
-void sub_8035404(u32 param_1)
+struct unkStruct_203B344
{
- s32 iVar1;
+ u32 unk0; // state variable
+ u32 unk4; // timer??
+};
- if(sub_80144A4(&iVar1) == 0){
- sub_80338C4(param_1);
- }
-}
+struct unkStruct_203B340
+{
+ // size: 0x84
+ u32 unk0;
+};
+
+extern void MemoryFree(void *);
+extern void* MemoryAlloc(u32, u32);
+extern void sub_80015C0(u32, u32);
-void sub_8035424(void)
+extern u16 gUnknown_80E5990[];
+extern struct unkStruct_203B344 *gUnknown_203B344;
+extern struct unkStruct_203B340 *gUnknown_203B340;
+extern s32 sub_8001658(u32, u32);
+
+void sub_803565C(void)
{
- sub_80338C4(6);
+ if(gUnknown_203B340 != NULL)
+ {
+ MemoryFree(gUnknown_203B340);
+ gUnknown_203B340 = NULL;
+ }
}
-void sub_8035430(void)
+
+u32 sub_8035678(void)
{
- sub_80338C4(0x4F);
+ gUnknown_203B344 = MemoryAlloc(sizeof(struct unkStruct_203B344), 8);
+ gUnknown_203B344->unk0 = 0;
+ gUnknown_203B344->unk4 = 0;
+ sub_80015C0(0, 0x39);
+ return 1;
}
-void nullsub_50(void)
+u32 sub_80356A0(void)
{
+ u16 uVar1;
+ u16 held_input;
+
+ held_input = gRealInputs.held;
+ uVar1 = gUnknown_80E5990[gUnknown_203B344->unk4];
+
+ switch(gUnknown_203B344->unk0) {
+ case 0:
+ gUnknown_203B344->unk0 = 3;
+ break;
+ case 1:
+ if (uVar1 == 0)
+ gUnknown_203B344->unk0 = 4;
+ else {
+ if (held_input == uVar1)
+ gUnknown_203B344->unk0 = 2;
+ else {
+ // NOTE: couldn't match with OR'd condition so split up to match
+ if ((uVar1 & held_input) != held_input)
+ gUnknown_203B344->unk0 = 3;
+ else
+ {
+ if (gUnknown_203B344->unk4 == 0)
+ gUnknown_203B344->unk0 = 3;
+ }
+ }
+ }
+ break;
+ case 2:
+ if (held_input == 0) {
+ gUnknown_203B344->unk0 = 1;
+ gUnknown_203B344->unk4++;
+ }
+ else {
+ if ((uVar1 & held_input) != held_input)
+ gUnknown_203B344->unk0 = 3;
+ }
+ break;
+ case 3:
+ return 2;
+ case 4:
+ return 3; // sub_809C478 clears the flash data when this is returned
+ }
+
+ if (sub_8001658(0,0x39) != 0) {
+ gUnknown_203B344->unk0 = 3;
+ return 2;
+ }
+ else {
+ return 0;
+ }
}
-void nullsub_51(void)
+void sub_8035758(void)
{
+ if(gUnknown_203B344 != NULL)
+ {
+ MemoryFree(gUnknown_203B344);
+ gUnknown_203B344 = NULL;
+ }
}
-