forked from zeldaret/st
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameModeStartUp.cpp
More file actions
218 lines (183 loc) · 6.33 KB
/
GameModeStartUp.cpp
File metadata and controls
218 lines (183 loc) · 6.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#include "Game/GameModeStartUp.hpp"
#include "Game/Game.hpp"
#include "System/OverlayManager.hpp"
#include "System/SysFault.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_02049b80.hpp"
#include "Unknown/UnkStruct_0204a110.hpp"
#include "Unknown/UnkStruct_0204e5f8.hpp"
#include "Unknown/UnkStruct_0204e64c.hpp"
#include "Unknown/UnkStruct_ov000_020b4ec4.hpp"
#include "Unknown/UnkStruct_ov000_020b50c0.hpp"
#include "regs.h"
extern "C" {
void OS_SetIrqFunction(unk32 param1, void *param2);
void func_0201245c();
void func_02027a28(void *param1, unk32 param2);
void DC_FlushAll();
void func_02013184();
void func_020131b0();
void OS_EnableIrqMask(unk32 param1);
void GX_VBlankIntr(unk32 param1);
void func_02031e48(void *param1);
void OS_WakeupThreadDirect(void *param1);
unk32 OS_GetArenaLo(unk32 param1);
unk32 OS_GetArenaHi(unk32 param1);
UnkStruct_02011e10_Sub1 *func_020012e0(unk32 param1, unk32 param2, unk32 param3);
unk32 func_0202d624(void *param1, unk32 param2);
void *func_02001fd4(void *param1, size_t param2);
void func_020013ac(void *param1);
UnkStruct_02011e10_Sub1 *func_02001098(unk32 param1, unk32 param2, unk32 param3);
unk32 func_020011f4();
void OS_SetArenaLo(unk32 param1, unk32 param2);
void TP_Init();
unk32 OS_func_0065();
unk32 TP_GetUserInfo(void *param1);
void TP_SetCalibrateParam(void *param1);
void func_0200a7b0(unk32 param1, void *param2, void *param3, void *param4, unk32 param5, unk32 param6, unk32 param7,
unk32 param8);
}
static u8 data_ov018_020c5bc0;
ARM void SysFault::func_ov018_020c4840() {
this->mUnk_05 = 0;
func_02027a28(func_0201245c, 0);
DC_FlushAll();
this->mUnk_00 = 0;
this->mUnk_04 = 0;
}
ARM Game::Game() :
mpCurrentGameMode(NULL),
createCallback(NULL),
mUnk_08(NULL),
mpSaveFile(NULL),
mUnk_14(NULL),
mUnk_18(NULL) {}
ARM void Game::func_ov018_020c48a4() {
OS_SetIrqFunction(1, func_02013184);
OS_EnableIrqMask(1);
GX_VBlankIntr(1);
OS_WakeupThreadDirect(&this->mUnk_1C.mUnk_04);
func_02031e48(func_020131b0);
this->TrySetCreateCallback((GameModeCreateCallback) Game::func_ov018_020c4ba8);
}
ARM void Game::func_ov018_020c48f8() {
if (gOverlayManager.mLoadedOverlays[OverlaySlot_Second] != OverlayIndex_Second) {
data_02049ba0.LoadIfNotLoaded(OverlaySlot_Second, OverlayIndex_Second);
data_0204999c.func_ov018_020c4a5c();
data_ov000_020b50c0.func_ov018_020c5718();
data_02049ba0.func_02014994(1);
}
}
ARM UnkStruct_02049b18::UnkStruct_02049b18() {
this->mUnk_58 = 0;
this->mUnk_5A = 0;
this->func_02013768();
}
ARM void UnkStruct_02011e10::func_ov018_020c4980() {
unk32 arenaLo = OS_GetArenaLo(0);
unk32 arenaHi = OS_GetArenaHi(0);
for (int i = 0; i < HeapIndex_Max; i++) {
this->mUnk_00[i] = NULL;
}
for (int i = 0; i < ARRAY_LEN(this->mUnk_24); i++) {
this->mUnk_24[i] = 0;
}
this->mUnk_00[HeapIndex_Main] = func_020012e0(arenaLo, arenaHi - arenaLo, 2);
unk32 length = func_0202d624(NULL, 0);
void *ptr = ::operator new(length, 0);
func_0202d624(ptr, length);
ptr = ::operator new(0xBE000, 0);
void *uVar3 = func_02001fd4(ptr, 0xBE000);
this->mUnk_24[0] = (unk32) uVar3;
this->mUnk_5C = 0;
this->mUnk_60 = 0xD2F0;
this->mUnk_64 = 0;
this->mUnk_68 = 0;
this->mUnk_6C = 0;
this->mUnk_70 = 0;
this->mUnk_74 = 0;
this->mUnk_78 = 0;
this->mUnk_7C = 0;
}
ARM void UnkStruct_02011e10::func_ov018_020c4a5c() {
UnkStruct_02011e10_Sub1 *temp_r2;
int temp_r5;
int temp_r7;
int temp_r0;
func_020013ac(this->mUnk_00[0]);
temp_r2 = this->mUnk_00[0];
temp_r5 = ((uintptr_t) temp_r2->mUnk_1C - (uintptr_t) temp_r2); //! TODO: fake match?
temp_r7 = OS_GetArenaLo(0);
temp_r7 += temp_r5;
temp_r0 = OS_GetArenaHi(0);
this->mUnk_00[1] = func_02001098(temp_r7, temp_r0 - temp_r7, 2);
this->mUnk_5C = func_020011f4();
OS_SetArenaLo(0, temp_r0);
this->mUnk_74 = 1;
}
ARM UnkStruct_ov000_020b4ec4::UnkStruct_ov000_020b4ec4() {}
ARM UnkStruct_02049b80::UnkStruct_02049b80() {
this->mUnk_08 = this;
for (int i = 0; i < ARRAY_LEN(this->mUnk_0C); i++) {
this->mUnk_0C[i] = 0;
this->mUnk_1C[i] = 0;
}
}
ARM UnkStruct_02049b18_06::UnkStruct_02049b18_06() {
unk8 auStack_18[8];
TP_Init();
if (OS_func_0065() != 0) {
TP_SetCalibrateParam(NULL);
} else if (TP_GetUserInfo(auStack_18) != 0) {
TP_SetCalibrateParam(auStack_18);
}
}
ARM UnkStruct_0204e64c_00::UnkStruct_0204e64c_00() {
this->mUnk_04 = 0;
this->mUnk_06 = 0;
this->mUnk_08 = 0;
this->mUnk_0A = 0;
this->mUnk_0B = 0;
this->mUnk_0C = 0;
}
ARM UnkStruct_0204e64c::UnkStruct_0204e64c() {
this->mUnk_16 = 0;
}
ARM GameModeStartUp *Game::func_ov018_020c4ba8() {
static GameModeStartUp data_ov018_020c5bd4;
return &data_ov018_020c5bd4;
}
ARM GameModeStartUp::GameModeStartUp() {
this->mUnk_28 = 0;
this->mUnk_2A = 0;
data_0204a110.func_02018c78(1);
data_0204a110.func_ov018_020c5300();
if (data_ov018_020c5bc0 == 0) {
UnkStruct2 stack_narc("Screen/Bg/Nlogo.bin", 1);
stack_narc.func_020154ec("NLG");
UnkResult stack_allrights("NLG:AllRights");
UnkResult stack_logo("NLG:Nlogo");
func_0200a7b0(0, stack_allrights.mUnk_00, stack_allrights.mUnk_04, stack_allrights.mUnk_08, 0, 0, 0, 2);
func_0200a7b0(4, stack_logo.mUnk_00, stack_logo.mUnk_04, stack_logo.mUnk_08, 0, 0, 0, 2);
this->mUnk_04.mUnk_14 = 0x00010000;
this->mUnk_04.func_0201bba4(0, 0x14);
} else {
this->mUnk_04.func_0201bba4(0, 0x01);
}
data_0204e5f8.func_0201b9a8(&this->mUnk_04);
}
ARM void GameModeStartUp::vfunc_0C() {
if (this->mUnk_04.mUnk_0D == this->mUnk_04.mUnk_10) {
if (this->mUnk_28 == 0) {
this->mUnk_2C = REG_FRAME_COUNTER;
gGame.func_ov018_020c48f8();
} else if (!this->mUnk_2A && (REG_FRAME_COUNTER - this->mUnk_2C) >= 0x3C) {
this->mUnk_2A = data_0204a060.func_020183d4(false, (GameModeCreateCallback) UnkStruct_0204a060::func_020183b8, 1);
if (data_ov018_020c5bc0 != 0) {
data_0204a060.func_0201bb84(1, 0, 1);
}
}
this->mUnk_28++;
}
}
ARM void GameModeStartUp::vfunc_20() {}