mirror of https://github.com/AxioDL/metaforce.git
Additional runtime stubs
This commit is contained in:
parent
387332ed70
commit
281b908574
|
@ -0,0 +1,4 @@
|
|||
#ifndef __RETRO_CAI_HPP__
|
||||
#define __RETRO_CAI_HPP__
|
||||
|
||||
#endif // __RETRO_CAI_HPP__
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef __RETRO_CASSETFACTORY_HPP__
|
||||
#define __RETRO_CASSETFACTORY_HPP__
|
||||
|
||||
#endif // __RETRO_CASSETFACTORY_HPP__
|
|
@ -4,25 +4,13 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "RetroTemplates.hpp"
|
||||
|
||||
#include <Athena/IStreamReader.hpp>
|
||||
#include <Athena/IStreamWriter.hpp>
|
||||
using CInputStream = Athena::io::IStreamReader;
|
||||
using COutputStream = Athena::io::IStreamWriter;
|
||||
|
||||
template<class T>
|
||||
class TOneStatic
|
||||
{
|
||||
static T m_allocspace;
|
||||
static uint32_t m_refCount;
|
||||
public:
|
||||
static T* GetAllocSpace() {return &m_allocspace;}
|
||||
static uint32_t& ReferenceCount() {return m_refCount;}
|
||||
void* operator new(size_t) {++ReferenceCount(); return GetAllocSpace();}
|
||||
void operator delete(void*) {--ReferenceCount();}
|
||||
};
|
||||
template<class T> T TOneStatic<T>::m_allocspace;
|
||||
template<class T> uint32_t TOneStatic<T>::m_refCount;
|
||||
|
||||
class CBasics
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CGAMEOPTIONS_HPP__
|
||||
#define __RETRO_CGAMEOPTIONS_HPP__
|
||||
|
||||
class CGameOptions
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CGAMEOPTIONS_HPP__
|
|
@ -1,8 +1,19 @@
|
|||
#ifndef __RETRO_CGAMESTATE_HPP__
|
||||
#define __RETRO_CGAMESTATE_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include "CPlayerState.hpp"
|
||||
#include "CGameOptions.hpp"
|
||||
|
||||
class CGameState
|
||||
{
|
||||
std::unique_ptr<CPlayerState> m_playerState;
|
||||
CGameOptions m_gameOpts;
|
||||
public:
|
||||
CGameState()
|
||||
{
|
||||
m_playerState.reset(new CPlayerState);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __RETRO_CGAMESTATE_HPP__
|
||||
|
|
|
@ -5,7 +5,7 @@ add_subdirectory(GuiSys)
|
|||
add_subdirectory(Script)
|
||||
|
||||
add_executable(RuntimeCheck
|
||||
main.hpp main.cpp
|
||||
main.cpp
|
||||
COsContext.hpp COsContextBoo.cpp
|
||||
CMemory.hpp CMemory.cpp
|
||||
CMemoryCardSys.hpp CMemoryCardSysPC.cpp
|
||||
|
@ -20,4 +20,12 @@ add_executable(RuntimeCheck
|
|||
CMapWorldInfo.hpp CMapWorldInfo.cpp
|
||||
CPlayerState.hpp CPlayerState.cpp
|
||||
CWorldTransManager.hpp CWorldTransManager.cpp
|
||||
CRandom16.hpp CRandom16.cpp)
|
||||
CRandom16.hpp CRandom16.cpp
|
||||
CResFactory.hpp CResFactory.cpp
|
||||
CSimplePool.hpp CSimplePool.cpp
|
||||
CAssetFactory.hpp CAssetFactory.cpp
|
||||
CAi.hpp CAi.cpp
|
||||
CGameOptions.hpp CGameOptions.cpp
|
||||
CStaticInterference.hpp CStaticInterference.cpp
|
||||
RetroTemplates.hpp
|
||||
GCNTypes.hpp)
|
||||
|
|
|
@ -36,5 +36,5 @@ CMemorySys::~CMemorySys()
|
|||
CMemory::Shutdown();
|
||||
}
|
||||
|
||||
IAllocator* CMemorySys::GetGameAllocator() {return &GAME_ALLOCATOR;}
|
||||
IAllocator& CMemorySys::GetGameAllocator() {return GAME_ALLOCATOR;}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class CMemorySys
|
|||
public:
|
||||
CMemorySys(COsContext&, IAllocator&);
|
||||
~CMemorySys();
|
||||
static IAllocator* GetGameAllocator();
|
||||
static IAllocator& GetGameAllocator();
|
||||
};
|
||||
|
||||
#endif // __RETRO_CMEMORY_HPP__
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
#ifndef __RETRO_CPLAYERSTATE_HPP__
|
||||
#define __RETRO_CPLAYERSTATE_HPP__
|
||||
|
||||
class CPlayerState
|
||||
#include "RetroTemplates.hpp"
|
||||
#include "CStaticInterference.hpp"
|
||||
|
||||
class CPlayerState : TOneStatic<CPlayerState>
|
||||
{
|
||||
CStaticInterference m_staticIntf;
|
||||
class CPowerUp
|
||||
{
|
||||
int m_a;
|
||||
int m_b;
|
||||
public:
|
||||
CPowerUp(int a, int b) : m_a(a), m_b(b) {}
|
||||
};
|
||||
CPowerUp m_powerups[29];
|
||||
};
|
||||
|
||||
#endif // __RETRO_CPLAYERSTATE_HPP__
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CRESFACTORY_HPP__
|
||||
#define __RETRO_CRESFACTORY_HPP__
|
||||
|
||||
class CResFactory
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CRESFACTORY_HPP__
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CSIMPLEPOOL_HPP__
|
||||
#define __RETRO_CSIMPLEPOOL_HPP__
|
||||
|
||||
class CSimplePool
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CSIMPLEPOOL_HPP__
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CSTATICINTERFERENCE_HPP__
|
||||
#define __RETRO_CSTATICINTERFERENCE_HPP__
|
||||
|
||||
class CStaticInterference
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CSTATICINTERFERENCE_HPP__
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __RETRO_GCTYPES_HPP__
|
||||
#define __RETRO_GCTYPES_HPP__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
using s8 = int8_t;
|
||||
using u8 = uint8_t;
|
||||
using s16 = int16_t;
|
||||
using u16 = uint16_t;
|
||||
using s32 = int32_t;
|
||||
using u32 = uint32_t;
|
||||
using s64 = int64_t;
|
||||
using u64 = uint64_t;
|
||||
|
||||
#endif // __RETRO_GCTYPES_HPP__
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef __RETRO_TEMPLATES_HPP__
|
||||
#define __RETRO_TEMPLATES_HPP__
|
||||
|
||||
#include "GCNTypes.hpp"
|
||||
|
||||
/**
|
||||
* @brief Inheritable singleton static-allocator
|
||||
*/
|
||||
template<class T>
|
||||
class TOneStatic
|
||||
{
|
||||
static T m_allocspace;
|
||||
static uint32_t m_refCount;
|
||||
public:
|
||||
static T* GetAllocSpace() {return &m_allocspace;}
|
||||
static u32& ReferenceCount() {return m_refCount;}
|
||||
void* operator new(size_t) {++ReferenceCount(); return GetAllocSpace();}
|
||||
void operator delete(void*) {--ReferenceCount();}
|
||||
};
|
||||
template<class T> T TOneStatic<T>::m_allocspace;
|
||||
template<class T> u32 TOneStatic<T>::m_refCount;
|
||||
|
||||
#endif // __RETRO_TEMPLATES_HPP__
|
|
@ -2,21 +2,30 @@
|
|||
#include "COsContext.hpp"
|
||||
#include "CBasics.hpp"
|
||||
#include "CTweaks.hpp"
|
||||
#include "CMemory.hpp"
|
||||
#include "CMemoryCardSys.hpp"
|
||||
#include "CResFactory.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
|
||||
class CGameGlobalObjects : public TOneStatic<CGameGlobalObjects>
|
||||
{
|
||||
CMemoryCardSys m_memoryCardSys;
|
||||
CResFactory m_resFactory;
|
||||
CSimplePool m_simplePool;
|
||||
public:
|
||||
|
||||
void PostInitialize(COsContext& osctx, CMemorySys& memSys)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class CMain : public COsContext
|
||||
{
|
||||
std::unique_ptr<CGameGlobalObjects> m_gameGlobalObjects;
|
||||
CMemorySys m_memSys;
|
||||
CTweaks m_tweaks;
|
||||
bool m_run = true;
|
||||
public:
|
||||
CMain()
|
||||
: m_memSys(*this, CMemorySys::GetGameAllocator())
|
||||
{
|
||||
OpenWindow("", 0, 0, 640, 480);
|
||||
}
|
||||
|
@ -25,7 +34,13 @@ public:
|
|||
}
|
||||
int RsMain(int argc, const char* argv[])
|
||||
{
|
||||
m_gameGlobalObjects.reset(new CGameGlobalObjects);
|
||||
CGameGlobalObjects* globalObjs = new CGameGlobalObjects;
|
||||
InitializeSubsystems();
|
||||
globalObjs->PostInitialize(*this, m_memSys);
|
||||
while (m_run)
|
||||
{
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef __RETRO_CMAIN_HPP__
|
||||
#define __RETRO_CMAIN_HPP__
|
||||
|
||||
#include "COsContext.hpp"
|
||||
#include "CTweaks.hpp"
|
||||
|
||||
|
||||
|
||||
#endif // __RETRO_CMAIN_HPP__
|
Loading…
Reference in New Issue