mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-10 03:47:40 +00:00
@@ -6,6 +6,9 @@
|
||||
class IFactory;
|
||||
class CSimplePool;
|
||||
|
||||
class CGuiSys;
|
||||
extern CGuiSys* gGuiSystem;
|
||||
|
||||
class CGuiSys {
|
||||
public:
|
||||
enum EUsageMode {
|
||||
@@ -15,9 +18,17 @@ public:
|
||||
};
|
||||
|
||||
CGuiSys(IFactory*, CSimplePool*, EUsageMode);
|
||||
~CGuiSys();
|
||||
|
||||
static void SetGlobalGuiSys(CGuiSys* ptr) {
|
||||
gGuiSystem = ptr;
|
||||
spGuiSys = ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
u8 pad[0x14];
|
||||
|
||||
static CGuiSys* spGuiSys;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef __CGAMEALLOCATOR_HPP__
|
||||
#define __CGAMEALLOCATOR_HPP__
|
||||
|
||||
#include <types.h>
|
||||
#include <Kyoto/Alloc/IAllocator.hpp>
|
||||
#include <Kyoto/Alloc/CMediumAllocPool.hpp>
|
||||
#include <Kyoto/Alloc/IAllocator.hpp>
|
||||
#include <types.h>
|
||||
|
||||
class CSmallAllocPool;
|
||||
class CMediumAllocPool;
|
||||
@@ -12,8 +12,10 @@ class CGameAllocator : public IAllocator {
|
||||
public:
|
||||
class SGameMemInfo {
|
||||
friend class CGameAllocator;
|
||||
|
||||
public:
|
||||
SGameMemInfo(SGameMemInfo* prev, SGameMemInfo* next, SGameMemInfo* nextFree, uint len, const char* fileAndLine, const char* type)
|
||||
SGameMemInfo(SGameMemInfo* prev, SGameMemInfo* next, SGameMemInfo* nextFree, uint len,
|
||||
const char* fileAndLine, const char* type)
|
||||
: x0_priorGuard(0xefefefef)
|
||||
, x4_len(len)
|
||||
, x8_fileAndLine(fileAndLine)
|
||||
@@ -25,15 +27,15 @@ public:
|
||||
|
||||
SGameMemInfo* GetPrev() { return (SGameMemInfo*)((size_t)x10_prev & ~31); }
|
||||
void SetPrev(SGameMemInfo* prev) {
|
||||
void* ptr = x10_prev;
|
||||
x10_prev = prev;
|
||||
x10_prev = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x10_prev & ~31));
|
||||
void* ptr = x10_prev;
|
||||
x10_prev = prev;
|
||||
x10_prev = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x10_prev & ~31));
|
||||
}
|
||||
SGameMemInfo* GetNext() const { return (SGameMemInfo*)((size_t)x14_next & ~31); }
|
||||
void SetNext(SGameMemInfo* next) {
|
||||
void* ptr = x14_next;
|
||||
x14_next = next;
|
||||
x14_next = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x14_next & ~31));
|
||||
void* ptr = x14_next;
|
||||
x14_next = next;
|
||||
x14_next = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x14_next & ~31));
|
||||
}
|
||||
u32 GetPrevMaskedFlags();
|
||||
u32 GetNextMaskedFlags();
|
||||
@@ -41,9 +43,9 @@ public:
|
||||
size_t GetLength() const { return x4_len; }
|
||||
SGameMemInfo* GetNextFree() const { return (SGameMemInfo*)((size_t)x18_nextFree & ~31); }
|
||||
void SetNextFree(SGameMemInfo* info) {
|
||||
void* ptr = x18_nextFree;
|
||||
x18_nextFree = info;
|
||||
x18_nextFree = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x18_nextFree & ~31));
|
||||
void* ptr = x18_nextFree;
|
||||
x18_nextFree = info;
|
||||
x18_nextFree = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x18_nextFree & ~31));
|
||||
}
|
||||
|
||||
bool IsAllocated() const { return ((size_t)x10_prev) & 1; }
|
||||
@@ -68,7 +70,7 @@ public:
|
||||
|
||||
bool Initialize(COsContext& ctx);
|
||||
void Shutdown();
|
||||
void* Alloc(size_t, EHint, EScope, EType, const CCallStack&) override;
|
||||
void* Alloc(size_t size, EHint hint, EScope scope, EType type, const CCallStack& cs) override;
|
||||
SGameMemInfo* FindFreeBlock(uint);
|
||||
SGameMemInfo* FindFreeBlockFromTopOfHeap(uint);
|
||||
uint FixupAllocPtrs(SGameMemInfo*, uint, uint, EHint, const CCallStack&);
|
||||
@@ -76,7 +78,8 @@ public:
|
||||
bool Free(const void* ptr) override;
|
||||
bool FreeNormalAllocation(const void* ptr);
|
||||
void ReleaseAll() override;
|
||||
void* AllocSecondary(size_t, IAllocator::EHint, IAllocator::EScope, IAllocator::EType, const CCallStack&) override;
|
||||
void* AllocSecondary(size_t size, EHint hint, EScope scope, EType type,
|
||||
const CCallStack& cs) override;
|
||||
bool FreeSecondary(const void* ptr) override;
|
||||
void ReleaseAllSecondary() override;
|
||||
void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* target) override;
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
#include "types.h"
|
||||
|
||||
namespace CMemory {
|
||||
void* Alloc(unsigned long sz);
|
||||
void* Alloc(size_t sz);
|
||||
void Free(const void* ptr);
|
||||
} // namespace CMemory
|
||||
|
||||
void* operator new(unsigned long sz, const char*, const char*);
|
||||
void* operator new[](unsigned long sz, const char*, const char*);
|
||||
inline void* operator new(unsigned long sz) { return operator new(sz, "??(??)", nullptr); }
|
||||
inline void* operator new[](unsigned long sz) { return operator new[](sz, "??(??)", nullptr); }
|
||||
void* operator new(size_t sz, const char*, const char*);
|
||||
void* operator new[](size_t sz, const char*, const char*);
|
||||
inline void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); }
|
||||
inline void* operator new[](size_t sz) { return operator new[](sz, "??(??)", nullptr); }
|
||||
// placement new
|
||||
inline void* operator new(unsigned long n, void* ptr) { return ptr; };
|
||||
inline void* operator new(size_t n, void* ptr) { return ptr; };
|
||||
|
||||
inline void operator delete(void* ptr) { CMemory::Free(ptr); }
|
||||
inline void operator delete[](void* ptr) { CMemory::Free(ptr); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -81,11 +81,10 @@ public:
|
||||
|
||||
virtual bool Initialize(COsContext& ctx) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual void* Alloc(unsigned long size, EHint hint, EScope scope, EType type,
|
||||
const CCallStack& cs) = 0;
|
||||
virtual void* Alloc(size_t size, EHint hint, EScope scope, EType type, const CCallStack& cs) = 0;
|
||||
virtual bool Free(const void* ptr) = 0;
|
||||
virtual void ReleaseAll() = 0;
|
||||
virtual void* AllocSecondary(unsigned long size, EHint hint, EScope scope, EType type,
|
||||
virtual void* AllocSecondary(size_t size, EHint hint, EScope scope, EType type,
|
||||
const CCallStack& cs) = 0;
|
||||
virtual bool FreeSecondary(const void* ptr) = 0;
|
||||
virtual void ReleaseAllSecondary() = 0;
|
||||
|
||||
@@ -16,6 +16,7 @@ enum ETRKRepeatMode {
|
||||
class CAudioSys {
|
||||
public:
|
||||
CAudioSys(u8, u8, u8, u8, uint);
|
||||
~CAudioSys();
|
||||
|
||||
static void SysSetVolume(u8, uint, u8);
|
||||
static void SetDefaultVolumeScale(s16);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
class CDSPStreamManager {
|
||||
public:
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@ class CSfxManager {
|
||||
public:
|
||||
static void Update(f32 dt);
|
||||
static void RemoveEmitter(CSfxHandle handle);
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,8 @@ public:
|
||||
COsContext(bool, bool);
|
||||
~COsContext();
|
||||
|
||||
void OpenWindow(const char* title, int x, int y, int w, int h, bool fullscreen);
|
||||
|
||||
uint GetBaseFreeRam() const {
|
||||
size_t hiAddr = reinterpret_cast< size_t >(x1c_arenaHi);
|
||||
size_t loAddr = reinterpret_cast< size_t >(x20_arenaLo2);
|
||||
|
||||
@@ -23,7 +23,14 @@ public:
|
||||
class CResFactory : public IFactory {
|
||||
public:
|
||||
CResFactory();
|
||||
virtual ~CResFactory() {}
|
||||
|
||||
~CResFactory() override {}
|
||||
CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference*) override;
|
||||
void BuildAsync(const SObjectTag&, const CVParamTransfer&, rstl::auto_ptr< IObj >*,
|
||||
CObjectReference*) override;
|
||||
void CancelBuild(const SObjectTag&) override;
|
||||
bool CanBuild(const SObjectTag&) override;
|
||||
const SObjectTag* GetResourceIdByName(const char* name) const override;
|
||||
|
||||
void AsyncIdle(uint time);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ class IFactory;
|
||||
class CSimplePool : public IObjectStore {
|
||||
public:
|
||||
CSimplePool(IFactory& factory);
|
||||
~CSimplePool();
|
||||
|
||||
virtual CToken GetObj(const SObjectTag& tag, CVParamTransfer xfer);
|
||||
virtual CToken GetObj(const SObjectTag& tag);
|
||||
|
||||
@@ -39,6 +39,8 @@ enum ERglPrimitive {
|
||||
kP_Points = 0xB8,
|
||||
};
|
||||
|
||||
class CTimeProvider;
|
||||
|
||||
class CGraphics {
|
||||
public:
|
||||
static void SetIsBeginSceneClearFb(bool);
|
||||
|
||||
@@ -14,15 +14,12 @@ class TToken : public CToken {
|
||||
public:
|
||||
TToken() {}
|
||||
TToken(const CToken& token) : CToken(token) {}
|
||||
TToken(T* obj) : CToken(GetIObjObjectFor(obj).release()) {}
|
||||
TToken(T* obj) : CToken(TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj).release()) {}
|
||||
TToken(const rstl::auto_ptr< T >& obj) : CToken(GetIObjObjectFor(obj).release()) {}
|
||||
|
||||
T* GetT() { return reinterpret_cast< T* >(CToken::GetObj()->GetContents()); }
|
||||
T* operator*() { return GetT(); }
|
||||
|
||||
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(T* obj) {
|
||||
return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj);
|
||||
}
|
||||
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > >
|
||||
GetIObjObjectFor(const rstl::auto_ptr< T >& obj) {
|
||||
return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj);
|
||||
|
||||
38
include/MetroidPrime/CArchitectureMessage.hpp
Normal file
38
include/MetroidPrime/CArchitectureMessage.hpp
Normal 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
|
||||
21
include/MetroidPrime/CArchitectureQueue.hpp
Normal file
21
include/MetroidPrime/CArchitectureQueue.hpp
Normal 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
|
||||
16
include/MetroidPrime/CAudioStateWin.hpp
Normal file
16
include/MetroidPrime/CAudioStateWin.hpp
Normal 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
|
||||
17
include/MetroidPrime/CConsoleOutputWindow.hpp
Normal file
17
include/MetroidPrime/CConsoleOutputWindow.hpp
Normal 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
|
||||
18
include/MetroidPrime/CErrorOutputWindow.hpp
Normal file
18
include/MetroidPrime/CErrorOutputWindow.hpp
Normal 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
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -122,6 +122,7 @@ private:
|
||||
bool x161_24_gameFrameDrawn : 1;
|
||||
CGameArchitectureSupport* x164_;
|
||||
};
|
||||
CHECK_SIZEOF(CMain, 0x168)
|
||||
|
||||
extern CMain* gpMain;
|
||||
|
||||
|
||||
18
include/MetroidPrime/CMainFlow.hpp
Normal file
18
include/MetroidPrime/CMainFlow.hpp
Normal 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
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "types.h"
|
||||
|
||||
class CMemoryCard {
|
||||
public:
|
||||
~CMemoryCard();
|
||||
// TODO
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,6 +22,9 @@ struct OSAlarm {
|
||||
};
|
||||
|
||||
void OSSetAlarm(OSAlarm* alarm, OSTime tick, OSAlarmHandler handler);
|
||||
void OSSetPeriodicAlarm(OSAlarm* alarm, OSTime start, OSTime period, OSAlarmHandler handler);
|
||||
void OSCancelAlarm(OSAlarm* alarm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef int BOOL;
|
||||
#define NULL 0
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(__cplusplus) || defined(__MWERKS__)
|
||||
#if !defined(__cplusplus) || __cplusplus < 201103L
|
||||
#ifndef nullptr
|
||||
#define nullptr NULL
|
||||
#endif
|
||||
|
||||
@@ -9,12 +9,13 @@ namespace rstl {
|
||||
template < typename T, typename Alloc = rmemory_allocator >
|
||||
class list {
|
||||
public:
|
||||
list() : x4_start(&xc_empty), x8_end(&xc_empty), xc_empty(x8_end, nullptr) {}
|
||||
list() : x4_start(&xc_empty), x8_end(&xc_empty), xc_empty(&xc_empty, &xc_empty) {}
|
||||
~list() {
|
||||
node* cur = x4_start;
|
||||
while (cur != nullptr) {
|
||||
delete cur->x8_item;
|
||||
cur = cur->x4_next;
|
||||
while (cur != x8_end) {
|
||||
cur->get_value()->~T();
|
||||
Alloc::deallocate(cur->get_value());
|
||||
cur = cur->get_next();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +29,12 @@ private:
|
||||
};
|
||||
|
||||
node(node* prev, node* next) : x0_prev(prev), x4_next(next), x8_count(0) {}
|
||||
|
||||
node* get_prev() const { return x0_prev; }
|
||||
node* get_next() const { return x4_next; }
|
||||
T* get_value() { return x8_item; }
|
||||
|
||||
// todo set_next / set_prev
|
||||
};
|
||||
|
||||
Alloc x0_allocator;
|
||||
|
||||
@@ -3,23 +3,36 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace rstl {
|
||||
class CRefData {
|
||||
public:
|
||||
CRefData(void* ptr) : x0_ptr(ptr), x4_refCount(1) {}
|
||||
CRefData(void* ptr, int refCount) : x0_ptr(ptr), x4_refCount(refCount) {}
|
||||
CRefData(const void* ptr) : x0_ptr(ptr), x4_refCount(1) {}
|
||||
CRefData(const void* ptr, int refCount) : x0_ptr(ptr), x4_refCount(refCount) {}
|
||||
|
||||
void* x0_ptr;
|
||||
unsigned int x4_refCount;
|
||||
void* GetPtr() const { return const_cast< void* >(x0_ptr); }
|
||||
int GetRefCount() const { return x4_refCount; }
|
||||
int AddRef() { return ++x4_refCount; }
|
||||
int DelRef() { return --x4_refCount; }
|
||||
|
||||
const void* x0_ptr;
|
||||
int x4_refCount;
|
||||
|
||||
static CRefData sNull;
|
||||
};
|
||||
|
||||
namespace rstl {
|
||||
template < typename T >
|
||||
class rc_ptr {
|
||||
public:
|
||||
rc_ptr(T* ptr) : x0_refData(new CRefData(ptr)) {}
|
||||
~rc_ptr();
|
||||
T* GetPtr() const { return reinterpret_cast< T* >(x0_refData->x0_ptr); }
|
||||
// TODO ReleaseData__Q24rstl20rc_ptr
|
||||
rc_ptr(const T* ptr) : x0_refData(new CRefData(ptr)) {}
|
||||
rc_ptr(const rc_ptr& other) : x0_refData(other.x0_refData) { x0_refData->AddRef(); }
|
||||
~rc_ptr() { ReleaseData(); }
|
||||
T* GetPtr() const { return static_cast< T* >(x0_refData->GetPtr()); }
|
||||
void ReleaseData() {
|
||||
if (x0_refData->DelRef() <= 0) {
|
||||
delete GetPtr();
|
||||
delete x0_refData;
|
||||
}
|
||||
}
|
||||
T* operator->() const { return GetPtr(); }
|
||||
T& operator*() const { return *GetPtr(); }
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
void clear() {
|
||||
for (int i = 0; i < x0_count; ++i) {
|
||||
rstl::destroy(&reinterpret_cast< T* >(x4_data)[i]);
|
||||
rstl::destroy(&data()[i]);
|
||||
}
|
||||
x0_count = 0;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ struct rmemory_allocator {
|
||||
}
|
||||
template < typename T >
|
||||
static void deallocate(T* ptr) {
|
||||
if (ptr != nullptr)
|
||||
CMemory::Free(ptr);
|
||||
if (ptr != nullptr) {
|
||||
delete[] reinterpret_cast< u8* >(ptr);
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace rstl
|
||||
|
||||
Reference in New Issue
Block a user