NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_main.cpp
1#include <types.h>
2#include <game/bases/d_main.hpp>
3#include <game/bases/d_system.hpp>
4
5extern "C" {
6void DVDDiskCheck(); ///< @unofficial
7}
8
11
13 dSys_c::create();
14 dSys_c::setBlack(false);
15}
16
18 while (true) {
19 dSys_c::execute();
20 }
21}
22
23void *dMain::main01(void *arg) {
24 Create();
25 Execute();
26 return nullptr;
27}
28
29extern "C" {
30
31#define STACK_SIZE 0xf000
32
33void main(int argc, char *argv[]) {
34 u8 stack[STACK_SIZE] ALIGNED(32);
35 DVDDiskCheck();
36 dMain::g_InitialTime = OSGetTime();
37 dSystem::fixArena();
38 OSThread *thread = OSGetCurrentThread();
39 int priority = OSGetThreadPriority();
40 OSCreateThread(&dMain::mainThread, dMain::main01, nullptr, stack + STACK_SIZE, STACK_SIZE, priority, 0);
41 OSResumeThread(&dMain::mainThread);
42 OSSetThreadPriority(thread, 0x1f);
43 OSSuspendThread(thread);
44}
45
46} // extern "C"
static void * main01(void *)
The main function to be run on the main thread.
Definition d_main.cpp:23
static void Create()
The function that initializes the main game loop.
Definition d_main.cpp:12
static OSThread mainThread
The main thread for the game.
Definition d_main.hpp:14
static s64 g_InitialTime
The startup time of the game.
Definition d_main.hpp:15
static void Execute()
The function that runs the main game loop.
Definition d_main.cpp:17