Merge pull request #305 from bgsamm/d_main

Matches for d_main, d_sys, & mpls
This commit is contained in:
robojumper
2026-04-09 08:14:45 +02:00
committed by GitHub
34 changed files with 1218 additions and 95 deletions
+11
View File
@@ -9,8 +9,19 @@ public:
return m_gameFrame;
}
static void IncrementGameFrame() {
m_gameFrame++;
}
static void IncrementUnkCounter() {
m_unkCounter++;
}
static void clear();
private:
static s32 m_gameFrame;
static s32 m_unkCounter;
};
#endif
+1 -1
View File
@@ -12,7 +12,7 @@ public:
typedef void (*MenuInitCallback)();
static void CreateInstance();
static void CreateInstance(EGG::Heap *);
static Manage_c *GetInstance();
Manage_c(EGG::Heap *);
+14
View File
@@ -0,0 +1,14 @@
#ifndef D_MAIN_H
#define D_MAIN_H
#include "rvl/OS.h"
namespace dMain {
void Create();
void Execute();
void *main01(void *arg);
}; // namespace dMain
#endif // D_MAIN_H
+4
View File
@@ -19,6 +19,10 @@ public:
static dBase_c *staticExecute();
static void setRootActor(fProfile::PROFILE_NAME_e rootActor, u32 params, s32 fadeInType, s32 fadeOutType);
static dFader_c *getFader() {
return &sFader;
}
protected:
static dFader_c sFader;
};
+13
View File
@@ -0,0 +1,13 @@
#ifndef D_STATE_H
#define D_STATE_H
namespace dState {
void fn_80062E40();
void fn_80062E50();
void fn_80062EB0();
bool fn_80062EC0();
}
#endif // D_STATE_H
+35
View File
@@ -3,18 +3,53 @@
#include "common.h"
#include "egg/core/eggHeap.h"
#include "egg/core/eggProcessMeter.h"
#include "egg/core/eggSystem.h"
#include "nw4r/ut/ut_Color.h"
#define ROUND_UP_4KB(x) (((u32)(x) + 4096 - 1) & ~(4096 - 1))
typedef EGG::TSystem<
EGG::Video, EGG::AsyncDisplay, EGG::XfbManager, EGG::SimpleAudioMgr, EGG::SceneManager, EGG::ProcessMeter>
System;
class dSndMgr_c;
class dSys_c {
public:
static dSndMgr_c *initAudioMgr(EGG::Heap *heap);
static void beginRender();
static void endRender();
static void beginFrame();
static void endFrame();
static bool setBlack(bool);
/* Frame rate values: 1 - 60fps, 2 - 30fps */
static void setFrameRate(u8);
static u8 getFrameRate();
static void setClearColor(nw4r::ut::Color clr);
static nw4r::ut::Color getClearColor();
static void create();
static void execute();
public:
static System *ms_configuration_p;
static EGG::Heap *ms_RootHeapMem1;
static EGG::Heap *ms_RootHeapMem2;
};
namespace dSystem {
extern void *s_OrgMEM1ArenaLo;
extern void *s_NewMEM1ArenaLo;
extern void *s_OrgMEM1ArenaHi;
extern void *s_NewMEM1ArenaHi;
void fixHeaps();
}; // namespace dSystem
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef D_SYS_INIT_H
#define D_SYS_INIT_H
#include "s/s_Phase.hpp"
namespace dSystem {
extern sPhase_c myDylinkInitPhase;
}
#endif // D_SYS_INIT_H
+2
View File
@@ -80,6 +80,8 @@ public:
s32 getField_0xDE0() const;
bool getField_0xDFC() const;
void fn_80152E20();
void fn_80152EF0();
void fn_80152F10();
bool fn_80152F50() const;
bool fn_80152F60() const;
+4
View File
@@ -346,6 +346,10 @@ public:
sConnectCallback = cb;
}
static void setWPADWorkSize(u32 size) {
sWPADWorkSize = size;
}
private:
CoreControllerMgr();
+4
View File
@@ -58,6 +58,10 @@ public:
mClearColor = color;
}
u32 getClearZ() {
return mClearZ;
}
public:
static u32 sTickPeriod;
};
+1 -1
View File
@@ -39,7 +39,7 @@ public:
/* vt 0x24 */ virtual bool open(const char *path, void *);
public:
void initialize();
static void initialize();
DvdFile();
void initiate();
s32 sync();
+14
View File
@@ -0,0 +1,14 @@
#ifndef EGG_PROCESS_METER_H
#define EGG_PROCESS_METER_H
#include "egg/core/eggThread.h"
namespace EGG {
class PerformanceView {};
class ProcessMeter : public Thread, public PerformanceView {};
};
#endif // EGG_PROCESS_METER_H
+68 -9
View File
@@ -2,30 +2,37 @@
#define EGG_SYSTEM_H
#include "common.h"
#include "egg/core/eggHeap.h"
#include "egg/core/eggVideo.h"
namespace EGG {
class Display;
class XfbManager;
class Heap;
class PerformanceView;
class SceneManager;
class SimpleAudioMgr;
class Thread;
class Video;
class XfbManager;
class ConfigurationData {
public:
inline ConfigurationData() : mSystemHeapSize(0x89000) {}
// vtable at 0x0
/* vt 0x08 */ virtual Video *getVideo() = 0;
/* vt 0x0C */ virtual Heap *getSystemHeap() = 0;
/* vt 0x10 */ virtual Display *getDisplay() = 0;
/* vt 0x14 */ virtual XfbManager *getXfbMgr() = 0;
/* vt 0x18 */ virtual void getPerfView() = 0;
/* vt 0x1C */ virtual void getScnMgr() = 0;
/* vt 0x20 */ virtual void getAudioMgr() = 0;
/* vt 0x18 */ virtual PerformanceView *getPerfView() = 0;
/* vt 0x1C */ virtual SceneManager *getSceneMgr() = 0;
/* vt 0x20 */ virtual SimpleAudioMgr *getAudioMgr() = 0;
/* vt 0x24 */ virtual void onBeginFrame();
/* vt 0x28 */ virtual void onEndFrame();
/* vt 0x2C */ virtual void initRenderMode();
/* vt 0x30 */ virtual void initMemory();
/* vt 0x34 */ virtual void run();
/* vt 0x38 */ virtual void initialize() = 0;
public:
/* 0x04 */ u32 mRoot1HeapStart;
@@ -41,12 +48,11 @@ public:
/* 0x2C */ u32 field_0x2C;
/* 0x30 */ u32 mSystemHeapStart;
/* 0x34 */ u32 mSystemHeapSize;
/* 0x38 */ u32 mGraphicsFifoSize;
/* 0x3C */ u32 field_0x3C;
};
class BaseSystem {
public:
static ConfigurationData *mConfigData;
static XfbManager *getXfbMgr() {
return mConfigData->getXfbMgr();
}
@@ -59,7 +65,60 @@ public:
};
template <class TVideo, class TDisplay, class TXfbManager, class TAudioManager, class TSceneManager, class TPerfView>
class TSystem : ConfigurationData {};
class TSystem : public ConfigurationData {
public:
inline TSystem() : mGraphicsFifoSize(0x80000), mRenderMode() {}
void onBeginFrame() override {}
void onEndFrame() override {}
void initRenderMode() override {}
void initialize() override {}
Video *getVideo() override {
return static_cast<Video *>(mVideo);
}
Heap *getSystemHeap() override {
return static_cast<Heap *>(mSystemHeap);
}
Display *getDisplay() override {
return static_cast<Display *>(mDisplay);
}
XfbManager *getXfbMgr() override {
return static_cast<XfbManager *>(mXfbMgr);
}
PerformanceView *getPerfView() override {
return static_cast<PerformanceView *>(mPerfView);
}
SceneManager *getSceneMgr() override {
return static_cast<SceneManager *>(mSceneMgr);
}
SimpleAudioMgr *getAudioMgr() override {
return static_cast<SimpleAudioMgr *>(mAudioMgr);
}
// Trick to fix weak function order in d_sys.cpp
// https://github.com/zeldaret/ss/pull/305#issuecomment-4201728492
void doInitialize() {
initialize();
}
public:
/* 0x38 */ u32 mGraphicsFifoSize;
/* 0x3C */ GXRenderModeObj *mRenderMode;
/* 0x40 */ TAudioManager *mAudioMgr;
/* 0x44 */ TVideo *mVideo;
/* 0x48 */ TXfbManager *mXfbMgr;
/* 0x4c */ TDisplay *mDisplay;
/* 0x50 */ TPerfView *mPerfView;
/* 0x54 */ TSceneManager *mSceneMgr;
};
} // namespace EGG
+3 -1
View File
@@ -20,7 +20,9 @@ public:
/* 0x08 */ u32 mConfiguredTime;
public:
Video() : pRenderMode(0), mFlag(), mConfiguredTime(){};
Video() : pRenderMode(0), mFlag(0), mConfiguredTime() {};
Video(const RenderModeObjSet *set) : pRenderMode(0), mFlag(0), mConfiguredTime() { initialize(nullptr, set); };
void initialize(GXRenderModeObj *, const RenderModeObjSet *);
GXRenderModeObj *configure(GXRenderModeObj *, const RenderModeObjSet *);
static u32 getTickPerVRetrace(u32 tvFormat);
+1
View File
@@ -15,6 +15,7 @@ public:
/* 0xC */ u8 mNumXfbs; // Total number of Xfbs ever attached
/* 0xD */ u8 mNumXfbs_Copy; // Unsure of purpose yet, but showing wont proceed until its under 3
public:
XfbManager() : mNextXfb(), mToCopyXfb(), mToShowXfb(), mNumXfbs(), mNumXfbs_Copy() {}
bool isRegisterd(Xfb &xfb) const; // yes. this is correct spelling
bool attach(Xfb *xfb);
void copyEFB(bool);
+9
View File
@@ -35,6 +35,7 @@ public:
PROC_FLAG_DELETE = GET_PROC_FLAG(DELETE),
PROC_FLAG_DRAW = GET_PROC_FLAG(DRAW)
};
fManager_c(fBase_c *owner) : connect_node(owner), execute_node(owner), draw_node(owner), search_node(owner) {}
~fManager_c() {}
int getSearchTableNum();
@@ -43,6 +44,14 @@ public:
static fBase_c *searchBaseByGroupType(u8 groupType, const fBase_c *parent = nullptr);
static void mainLoop();
static void setStopProcFlags(u32 flags) {
m_StopProcInf |= flags;
}
static void maskStopProcFlags(u32 flags) {
m_StopProcInf &= flags;
}
private:
fTrNdBa_c connect_node; ///< The node in ::m_connectManage.
fLiNdPrio_c execute_node; ///< The node in ::m_executeManage.
+3 -2
View File
@@ -9,10 +9,11 @@
// Note: names are taken from NSMBW where available but a lot are made up
void unk_initDecompressors();
namespace mDvd {
void unk_initDecompressors();
void setAutoStreamDecomp(bool arg);
extern void *somePtr;
class UncompressInfo_c {
+2
View File
@@ -19,6 +19,8 @@ extern BOOL __OSInReboot;
void __OSGetExecParams(OSExecParams *out);
void __OSLaunchMenu(void);
void OSExecl(const char* dolfile, const char* arg0, ...);
#ifdef __cplusplus
}
#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);
+1
View File
@@ -74,6 +74,7 @@ u32 SCGetCounterBias(void);
void SCGetBtDeviceInfoArray(SCBtDeviceInfoArray *info);
void SCSetBtDeviceInfoArray(const SCBtDeviceInfoArray *info);
u32 SCGetBtDpdSensibility(void);
BOOL SCGetMplsMoviePlay(void);
u8 SCGetWpadMotorMode(void);
void SCSetWpadMotorMode(u8 mode);
u8 SCGetWpadSensorBarPosition(void);
+1
View File
@@ -571,6 +571,7 @@ BOOL WPADStopSimpleSync(void);
BOOL WPADCancelSyncDevice(void);
WPADSimpleSyncCallback *WPADSetSimpleSyncCallback(WPADSimpleSyncCallback *cb);
void WPADRegisterAllocator(WPADAllocFunc *alloc, WPADFreeFunc *free);
u32 WPADGetWorkMemorySize(void);
WPADLibStatus WPADGetStatus(void);
u8 WPADGetRadioSensitivity(WPADChannel chan);
void WPADGetAddress(WPADChannel chan, BD_ADDR_PTR addr);
@@ -0,0 +1,8 @@
#ifndef ARC_CALLBACK_HANDLER_H
#define ARC_CALLBACK_HANDLER_H
#include "common.h"
void *ArcCallbackHandlerCreate(u32);
#endif // ARC_CALLBACK_HANDLER_H
+4
View File
@@ -25,6 +25,10 @@ bool isOnScreen(const mVec3_c &worldPos);
void screenToWorld(mVec3_c &result, const mVec3_c &screenPos);
void createLightTextures();
void fn_80016860();
void clearList();
void fn_80017500();
class AnmMdlWrapper : public m3d::mdlAnmChr {
public:
AnmMdlWrapper();
+20
View File
@@ -0,0 +1,20 @@
#ifndef D_LIB_H
#define D_LIB_H
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif
extern u32 lbl_80574FA0;
extern u32 lbl_80574FA4;
void unknownStub();
bool strequals(const char *lhs, const char *rhs);
#ifdef __cplusplus
}
#endif
#endif // D_LIB_H
+12
View File
@@ -0,0 +1,12 @@
#ifndef MPLS_H
#define MPLS_H
namespace Mpls {
void initialize(int argc, char **argv);
void tryLaunchMovie();
void forceLaunchMovie();
}; // namespace Mpls
#endif // MPLS_H
+3
View File
@@ -2,6 +2,7 @@
#define UNK_SAVE_TIME_H
#include "common.h"
#include "egg/core/eggHeap.h"
class SaveTimeRelated {
public:
@@ -17,6 +18,8 @@ public:
return field_0x30;
}
static void fn_80190780(EGG::Heap *heap);
void fn_801907C0();
s64 fn_801907D0();
void fn_801907F0();
void fn_801909A0();