summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMor <mordbz@gmail.com>2020-04-18 17:32:11 +0300
committerMor <mordbz@gmail.com>2020-04-18 17:32:11 +0300
commit239b0b1d4343f987936019c76abb2bc7ff815fee (patch)
tree1dec14de8aa18440e7ad3f5d48742078e067331e /src
parentd458432e79744c8671b1e3ae31decad9366360cf (diff)
rudimentary matching decompilation of NitroMain
Diffstat (limited to 'src')
-rw-r--r--src/main.c151
1 files changed, 151 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 00000000..844d069d
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,151 @@
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed long s32;
+
+struct Unk2106FA0
+{
+ s32 unk0;
+ s32 unk4;
+ s32 unk8;
+ s32 unkC;
+ s32 unk10;
+ s32 unk14;
+ s32 unk18;
+ s32 unk1C;
+ s32 unk20;
+};
+
+struct Unk21C48B8
+{
+ void (*unk0)(s32);
+ s32 unk4;
+ s32 unk8;
+ s32 unkC;
+ s32 unk10;
+ s32 unk14;
+ s32 unk18;
+ s32 unk1C;
+ s32 unk20;
+ s32 unk24;
+ s32 unk28;
+ s32 unk2C;
+ s32 unk30;
+ s32 unk34;
+ s32 unk38;
+ u8 filler3C[0xC];
+ s32 unk48;
+ u8 filler4C[0x20];
+ s32 unk6C;
+};
+
+extern struct Unk2106FA0 gUnknown2106FA0;
+extern struct Unk2106FA0 gUnknown2106FA0_2; // same as the first one, it's referenced twice in the constant pool...
+extern struct Unk2106FA0 gUnknown2106FB8;
+extern struct Unk21C48B8 gUnknown21C48B8;
+
+extern s32 gUnk027FFC20;
+extern struct {
+ s32 unk0;
+ s32 unk4;
+ u8 unk8;
+} gUnk021C4918;
+
+extern void FUN_020D50D8();
+extern void FUN_020C9C0C();
+extern void FUN_02016438(s32);
+
+extern const s32 CONST_3F; // 0x0000003F
+extern const s32 CONST_34; // 0x00000034
+
+extern struct Unk21DBE18 gUnk021DBE18;
+extern struct Unk21DBE18 gUnk021D76C8;
+
+
+void NitroMain(void)
+{
+ FUN_02016014();
+ FUN_02016148();
+ FUN_020163BC();
+ FUN_02016438(0);
+
+ FUN_020D50D8(&gUnknown2106FA0_2, 0); // should be blx please
+
+ FUN_02022294();
+ FUN_0201259C();
+ FUN_02000DF4();
+ FUN_02002C14();
+ FUN_02002C50(0, 3);
+ FUN_02002C50(1, 3);
+ FUN_02002C50(3, 3);
+ gUnknown2106FA0.unk18 = -1;
+ gUnknown2106FA0.unk20 = FUN_0202254C();
+ FUN_02003B98(FUN_02029EF8(gUnknown2106FA0.unk20), FUN_02023900(gUnknown2106FA0.unk20));
+ FUN_02020AFC();
+ if (FUN_020337E8(3) == 3)
+ FUN_02034188(3, 0);
+ if (FUN_020227FC(gUnknown2106FA0.unk20) == 0)
+ {
+ FUN_02089D90(0);
+ }
+ else
+ {
+ switch (gUnk027FFC20)
+ {
+ case 0:
+ gUnknown2106FA0.unk1C = 0;
+ FUN_02000E7C(&CONST_3F, &gUnk021DBE18);
+ break;
+ case 1:
+ gUnknown2106FA0.unk1C = 1;
+ FUN_02000E7C(&CONST_34, &gUnk021D76C8);
+ break;
+ default:
+ FUN_02020C2C();
+ break;
+ }
+ }
+ gUnknown21C48B8.unk6C = 1;
+ gUnknown21C48B8.unk30 = 0;
+ FUN_02000FA4();
+ FUN_0200A2AC();
+ FUN_02015E30();
+ gUnknown2106FA0.unk4 = 0;
+ for (;;)
+ {
+ FUN_02000EE8();
+ FUN_02000FE8();
+ FUN_02016464();
+ if ((gUnknown21C48B8.unk38 & 0x30C) == 0x30C && !gUnk021C4918.unk8) // soft reset?
+ {
+ FUN_02000F18(0); // soft reset?
+ }
+ if (FUN_0202FB80())
+ {
+ FUN_02000E0C();
+ FUN_0201B5CC(gUnknown21C48B8.unk18);
+ FUN_0201B5CC(gUnknown21C48B8.unk24);
+ if (!gUnknown21C48B8.unk30)
+ {
+ FUN_020C9C0C(1, 1);
+ gUnknown21C48B8.unk2C++;
+ }
+ }
+ FUN_020125D4();
+ FUN_02015E60();
+ FUN_020222C4();
+ FUN_0201B5CC(gUnknown21C48B8.unk24);
+ FUN_020C9C0C(1, 1);
+ gUnknown21C48B8.unk2C++;
+ gUnknown21C48B8.unk30 = 0;
+ FUN_0200A318();
+ FUN_0200E2D8();
+ if (gUnknown21C48B8.unk0)
+ gUnknown21C48B8.unk0(gUnknown21C48B8.unk4);
+ FUN_02003C10();
+ FUN_0201B5CC(gUnknown21C48B8.unk20);
+ }
+} \ No newline at end of file