Initial work on d_main

This commit is contained in:
Sean Miller
2026-03-15 16:45:12 +00:00
parent f637091a32
commit 51bfda0e1b
8 changed files with 96 additions and 4 deletions
+1
View File
@@ -256,6 +256,7 @@ d/d_lang.cpp:
d/d_main.cpp:
.text start:0x80054F90 end:0x80055170 align:16
.sbss start:0x805751D0 end:0x805751E0
.bss start:0x80597758 end:0x80597A70
d/d_pad.cpp:
.text start:0x80055170 end:0x8005961C align:16
+4 -4
View File
@@ -2239,9 +2239,9 @@ getCurrentLanguage__Fv = .text:0x80054F50; // type:function size:0x38
fn_80054F90 = .text:0x80054F90; // type:function size:0x18
fn_80054FB0 = .text:0x80054FB0; // type:function size:0x24
fn_80054FE0 = .text:0x80054FE0; // type:function size:0x20
dMain__Create = .text:0x80055000; // type:function size:0x28
dMain__Execute = .text:0x80055030; // type:function size:0x14
dMain__main01 = .text:0x80055050; // type:function size:0x28
Create__5dMainFv = .text:0x80055000; // type:function size:0x28
Execute__5dMainFv = .text:0x80055030; // type:function size:0x14
main01__5dMainFPv = .text:0x80055050; // type:function size:0x28
main = .text:0x80055080; // type:function size:0xE4 scope:global
control_mpls_callback__4dPadFll = .text:0x80055170; // type:function size:0x38
isDeviceTypeMpls__4dPadFUl = .text:0x800551B0; // type:function size:0x24
@@ -42180,7 +42180,7 @@ layoutResHeap__5dHeap = .sbss:0x805751C0; // type:object size:0x4 data:4byte
fontHeap__5dHeap = .sbss:0x805751C4; // type:object size:0x4 data:4byte
HBMHeap__5dHeap = .sbss:0x805751C8; // type:object size:0x4 data:4byte
lbl_805751D0 = .sbss:0x805751D0; // type:object size:0x8 data:4byte
dMain__g_InitialTime = .sbss:0x805751D8; // type:object size:0x8 data:4byte
g_InitialTime__5dMain = .sbss:0x805751D8; // type:object size:0x8 data:4byte
m_connected__Q24dPad4ex_c = .sbss:0x805751E0; // type:object size:0x4
sInstance__13dPadManager_c = .sbss:0x805751E8; // type:object size:0x8 data:4byte
LINK_ROT = .sbss:0x805751F0; // type:object size:0x2 data:2byte
+13
View File
@@ -0,0 +1,13 @@
#ifndef D_MAIN_H
#define D_MAIN_H
#include "rvl/OS.h"
namespace dMain {
void Create();
void Execute();
void *main01(void *arg);
OSTime g_InitialTime;
};
#endif // D_MAIN_H
+8
View File
@@ -7,14 +7,22 @@
class dSys_c {
public:
static void setBlack(bool);
/* Frame rate values: 1 - 60fps, 2 - 30fps */
static void setFrameRate(u8);
static u8 getFrameRate();
static void setClearColor(nw4r::ut::Color clr);
static void create();
static void execute();
static EGG::Heap *ms_RootHeapMem1;
static EGG::Heap *ms_RootHeapMem2;
};
namespace dSystem {
void fixHeaps();
};
#endif
+3
View File
@@ -12,6 +12,8 @@ extern "C" {
#define OS_THREAD_STACK_MAGIC 0xDEADBABE
typedef s32 OSPriority;
typedef enum {
OS_THREAD_STATE_EXITED = 0,
OS_THREAD_STATE_READY = 1,
@@ -97,6 +99,7 @@ s32 OSSuspendThread(OSThread *thread);
void OSSleepThread(OSThreadQueue *queue);
void OSWakeupThread(OSThreadQueue *queue);
BOOL OSSetThreadPriority(OSThread *thread, s32 prio);
OSPriority OSGetThreadPriority(OSThread *thread);
void OSClearStack(u8 val);
void OSSleepTicks(s64 ticks);
+6
View File
@@ -0,0 +1,6 @@
#ifndef D_LIB_H
#define D_LIB_H
void fn_80006C20();
#endif // D_LIB_H
+7
View File
@@ -0,0 +1,7 @@
#ifndef MPLS_H
#define MPLS_H
void fn_80006CE0(int, char **);
void fn_80006D60();
#endif // MPLS_H
+54
View File
@@ -0,0 +1,54 @@
#include "d/d_main.h"
#include "d/d_sys.h"
#include "rvl/OS.h"
#include "toBeSorted/d_lib.h"
#include "toBeSorted/mpls.h"
OSThread MAIN_THREAD;
#define STACK_SIZE 0xF000
void dMain::Create() {
dSys_c::create();
dSys_c::setBlack(false);
}
void dMain::Execute() {
while (true) {
dSys_c::execute();
}
}
void *dMain::main01(void *arg) {
Create();
Execute();
return nullptr;
}
void main(int argc, char **argv) {
u8 pStackBase[STACK_SIZE] __attribute__((aligned(32)));
fn_80006C20();
dMain::g_InitialTime = OSGetTime();
dSystem::fixHeaps();
fn_80006CE0(argc, argv);
fn_80006D60();
OSThread *curThread = OSGetCurrentThread();
OSPriority curPrio = OSGetThreadPriority(curThread);
OSCreateThread(
&MAIN_THREAD,
dMain::main01,
nullptr,
&pStackBase[STACK_SIZE],
STACK_SIZE,
curPrio,
0
);
OSResumeThread(&MAIN_THREAD);
OSSetThreadPriority(curThread, 31);
OSSuspendThread(curThread);
}