Symbol fixes, headers & main progress

Former-commit-id: 6944a14e89
This commit is contained in:
2022-10-01 02:19:09 -04:00
parent f1e383728e
commit adb54a9892
48 changed files with 458 additions and 200 deletions

View File

@@ -0,0 +1,38 @@
#ifndef _CARCHITECTUREMESSAGE_HPP
#define _CARCHITECTUREMESSAGE_HPP
#include "types.h"
#include "rstl/rc_ptr.hpp"
enum EArchMsgTarget {
kAMT_IOWinManager,
kAMT_Game,
};
enum EArchMsgType {
kAM_RemoveIOWin = 0,
kAM_CreateIOWin = 1,
kAM_ChangeIOWinPriority = 2,
kAM_RemoveAllIOWins = 3,
kAM_TimerTick = 4,
kAM_UserInput = 5,
kAM_SetGameState = 6,
kAM_ControllerStatus = 7,
kAM_QuitGameplay = 8,
kAM_FrameBegin = 10,
kAM_FrameEnd = 11,
};
struct IArchitectureMessageParm {
virtual ~IArchitectureMessageParm() = 0;
};
class CArchitectureMessage {
private:
EArchMsgTarget x0_target;
EArchMsgType x4_type;
rstl::rc_ptr< IArchitectureMessageParm > x8_parm;
};
#endif

View File

@@ -0,0 +1,21 @@
#ifndef _CARCHITECTUREQUEUE_HPP
#define _CARCHITECTUREQUEUE_HPP
#include "types.h"
#include "MetroidPrime/CArchitectureMessage.hpp"
#include "rstl/list.hpp"
class CArchitectureQueue {
public:
void Push(const CArchitectureMessage&); // TODO
void Pop(); // TODO
void Clear(); // TODO
bool IsEmpty() const; // TODO
private:
rstl::list< CArchitectureMessage > x0_queue;
};
#endif

View File

@@ -0,0 +1,16 @@
#ifndef _CAUDIOSTATEWIN_HPP
#define _CAUDIOSTATEWIN_HPP
#include "types.h"
#include "MetroidPrime/CIOWin.hpp"
class CAudioStateWin : public CIOWin {
public:
CAudioStateWin();
~CAudioStateWin() override;
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override;
};
#endif

View File

@@ -0,0 +1,17 @@
#ifndef _CCONSOLEOUTPUTWINDOW_HPP
#define _CCONSOLEOUTPUTWINDOW_HPP
#include "types.h"
#include "MetroidPrime/CIOWin.hpp"
class CConsoleOutputWindow : public CIOWin {
public:
CConsoleOutputWindow(int, f32, f32);
~CConsoleOutputWindow() override;
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override;
void Draw() override;
};
#endif

View File

@@ -0,0 +1,18 @@
#ifndef _CERROROUTPUTWINDOW_HPP
#define _CERROROUTPUTWINDOW_HPP
#include "types.h"
#include "MetroidPrime/CIOWin.hpp"
class CErrorOutputWindow : public CIOWin {
public:
CErrorOutputWindow(bool);
~CErrorOutputWindow() override;
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override;
bool GetIsContinueDraw() const override;
void Draw() override;
};
#endif

View File

@@ -4,19 +4,19 @@
#include "types.h"
#include "GuiSys/CGuiSys.hpp"
#include "Kyoto/Audio/CAudioSys.hpp"
#include "Kyoto/Basics/COsContext.hpp"
#include "Kyoto/Basics/CStopwatch.hpp"
#include "Kyoto/TOneStatic.hpp"
#include "MetroidPrime/CArchitectureQueue.hpp"
#include "MetroidPrime/CIOWinManager.hpp"
#include "MetroidPrime/CInputGenerator.hpp"
class CSavableState;
#include "rstl/vector.hpp"
class Unknown {
private:
u8 pad[0x2c];
};
class CToken;
class CGameArchitectureSupport : public TOneStatic< CGameArchitectureSupport > {
public:
@@ -26,33 +26,29 @@ public:
void PreloadAudio();
bool UpdateTicks();
void Update();
void UnloadAudio();
inline CStopwatch& GetStopwatch1() { return x20_stopwatch1; }
inline CStopwatch& GetStopwatch2() { return x28_stopwatch2; }
// TODO
inline CIOWinManager& GetIOWinManager() { return *(CIOWinManager*)(((u8*)this) + 0x58); }
inline int& GetFramesDrawn() const { return *(int*)(((u8*)this) + 0x78); }
inline CIOWinManager& GetIOWinManager() { return x58_ioWinMgr; }
inline int& GetFramesDrawn() { return x78_gameFrameCount; }
private:
CAudioSys x0_audioSys;
rstl::list< CSavableState > x8_;
u32 pad;
CArchitectureQueue x4_archQueue;
CStopwatch x20_stopwatch1;
CStopwatch x28_stopwatch2;
CInputGenerator x30_inputGenerator;
CGuiSys x44_guiSys;
CIOWinManager x58_ioWinMgr;
uint x78_gameFrameCount;
int x78_gameFrameCount;
f32 x7c_;
f32 x80_;
f32 x84_;
uint x88_;
uint x8c_; // unused?
uint x90_;
uint x94_;
uint x98_;
rstl::optional_object< Unknown > x9c_;
u8 pad2[0x4];
rstl::vector< CToken > x90_;
OSAlarm xa0_infiniteLoopAlarm;
bool xc8_infiniteLoopAlarmSet;
};
CHECK_SIZEOF(CGameArchitectureSupport, 0xd0)

View File

@@ -16,6 +16,7 @@
#include "Kyoto/TOneStatic.hpp"
#include "Kyoto/Text/CRasterFont.hpp"
#include "MetroidPrime/CInGameTweakManager.hpp"
#include "MetroidPrime/CMemoryCard.hpp"
#include "MetroidPrime/Enemies/CAiFuncMap.hpp"
#include "MetroidPrime/Factories/CCharacterFactoryBuilder.hpp"
#include "MetroidPrime/Player/CGameState.hpp"
@@ -43,7 +44,7 @@ private:
CAiFuncMap x110_aiFuncMap;
CGraphicsSys x130_graphicsSys;
rstl::single_ptr< CGameState > x134_gameState;
uint x138_;
rstl::single_ptr< CMemoryCard > x138_;
rstl::optional_object< TLockedToken< CStringTable > > x13c_stringTable;
rstl::single_ptr< IRenderer > x14c_renderer;
rstl::single_ptr< CInGameTweakManager > x150_inGameTweakManager;
@@ -52,7 +53,6 @@ private:
CHECK_SIZEOF(CGameGlobalObjects, 0x15c)
// TODO move to related headers
extern unkptr gGuiSystem;
extern unkptr gpController;
extern unkptr gpDefaultFont;

View File

@@ -7,20 +7,24 @@
#include "rstl/rc_ptr.hpp"
class CIOWin;
// TODO
class IOWinPQNode;
class CIOWinManager {
public:
CIOWinManager();
~CIOWinManager();
void Draw() const;
void AddIOWin(rstl::ncrc_ptr< CIOWin >, int, int);
void RemoveAllIOWins();
inline bool IsEmpty() const { return x4_ == 0 && x0_ == 0; }
inline bool IsEmpty() const { return x4_pumpRoot == nullptr && x0_drawRoot == nullptr; }
private:
uint x0_;
uint x4_;
rstl::list< unkptr > x8_;
IOWinPQNode* x0_drawRoot;
IOWinPQNode* x4_pumpRoot;
CArchitectureQueue x8_localGatherQueue;
};
CHECK_SIZEOF(CIOWinManager, 0x20)

View File

@@ -4,6 +4,55 @@
#include "types.h"
#include "rstl/string.hpp"
#include "rstl/vector.hpp"
class CTweakValue {
public:
struct Audio {
public:
Audio(f32 fadeIn, f32 fadeOut, f32 vol, const rstl::string& fileName, u32 handle)
: x0_fadeIn(fadeIn)
, x4_fadeOut(fadeOut)
, x8_volume(vol)
, xc_fileName(fileName)
, x1c_res(handle) {}
f32 GetFadeIn() const { return x0_fadeIn; }
f32 GetFadeOut() const { return x4_fadeOut; }
f32 GetVolume() const { return x8_volume; }
const rstl::string& GetFileName() const { return xc_fileName; }
CAssetId GetResId() const { return x1c_res; }
// static Audio None() { return Audio(0.f, 0.f, 0.f, "", 0); }
private:
f32 x0_fadeIn;
f32 x4_fadeOut;
f32 x8_volume;
rstl::string xc_fileName;
CAssetId x1c_res;
};
enum EType {};
CTweakValue();
// CTweakValue(const rstl::string&, EType, const Audio&);
// CTweakValue(CTextInputStream&);
// void PutTo(CTextOutStream&);
const rstl::string& GetName() const { return x4_key; }
const rstl::string& GetValueAsString() const;
void SetValueFromString(const rstl::string&);
const Audio& GetAudio() const { return x24_audio; }
EType GetType() const { return x0_type; }
private:
EType x0_type;
rstl::string x4_key;
rstl::string x14_str;
Audio x24_audio;
union {
u32 x44_int;
f32 x44_flt;
};
};
class CInGameTweakManager {
public:
@@ -12,8 +61,9 @@ public:
bool ReadFromMemoryCard(const rstl::string&);
private:
u8 pad[0x10];
rstl::vector< CTweakValue > x0_values;
};
CHECK_SIZEOF(CInGameTweakManager, 0x10)
extern CInGameTweakManager* gpTweakManager;

View File

@@ -3,14 +3,26 @@
#include "types.h"
#include "rstl/single_ptr.hpp"
#include "Kyoto/Input/IController.hpp"
class COsContext;
class IController;
class CInputGenerator {
public:
CInputGenerator(COsContext*, f32, f32);
IController* GetController() const { return x4_controller.get(); }
private:
u8 pad[0x14];
COsContext* x0_context;
rstl::single_ptr< IController > x4_controller;
bool x8_connectedControllers[4];
f32 xc_leftDiv;
f32 x10_rightDiv;
};
CHECK_SIZEOF(CInputGenerator, 0x14)
#endif

View File

@@ -122,6 +122,7 @@ private:
bool x161_24_gameFrameDrawn : 1;
CGameArchitectureSupport* x164_;
};
CHECK_SIZEOF(CMain, 0x168)
extern CMain* gpMain;

View File

@@ -0,0 +1,18 @@
#ifndef _CMAINFLOW_HPP
#define _CMAINFLOW_HPP
#include "types.h"
#include "MetroidPrime/CIOWin.hpp"
class CMainFlow : public CIOWin {
public:
CMainFlow();
~CMainFlow() override;
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override;
bool GetIsContinueDraw() const override;
void Draw() override;
};
#endif

View File

@@ -4,6 +4,8 @@
#include "types.h"
class CMemoryCard {
public:
~CMemoryCard();
// TODO
};

View File

@@ -14,10 +14,10 @@ public:
};
CSplashScreen(ESplashScreen);
~CSplashScreen() override;
virtual EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&);
virtual void Draw();
~CSplashScreen() override;
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override;
void Draw() override;
};
#endif

View File

@@ -14,7 +14,7 @@ public:
CSystemOptions();
void SetHasFusion(bool v);
bool GetHasFusion() const { return xd0_27_fusionBeat; }
bool GetHasFusion() const { return xd0_28_fusionSuitActive; }
private:
rstl::reserved_vector< u8, 98 > x0_nesState;