mirror of https://github.com/AxioDL/metaforce.git
several core runtime stubs added
This commit is contained in:
parent
53256dea15
commit
387332ed70
|
@ -3,7 +3,8 @@ project(RetroCommon)
|
|||
if (NOT TARGET NOD)
|
||||
add_subdirectory(NODLib)
|
||||
endif()
|
||||
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${ANGELSCRIPT_INCLUDE_DIR})
|
||||
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${ANGELSCRIPT_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(NOD_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include)
|
||||
add_subdirectory(DataSpec)
|
||||
add_subdirectory(Runtime)
|
||||
|
|
|
@ -7,7 +7,8 @@ make_dnalist(liblist
|
|||
CSKR
|
||||
EVNT
|
||||
MAPA
|
||||
CMDLMaterials)
|
||||
CMDLMaterials
|
||||
MREA)
|
||||
add_library(DNAMP1
|
||||
DNAMP1.hpp DNAMP1.cpp
|
||||
${liblist}
|
||||
|
@ -17,4 +18,5 @@ add_library(DNAMP1
|
|||
ANIM.cpp
|
||||
EVNT.cpp
|
||||
CMDL.hpp
|
||||
CMDLMaterials.cpp)
|
||||
CMDLMaterials.cpp
|
||||
MREA.cpp)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef __DNAMP1_MREA_HPP__
|
||||
#define __DNAMP1_MREA_HPP__
|
||||
|
||||
#include "../DNACommon/DNACommon.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
namespace DNAMP1
|
||||
{
|
||||
|
||||
struct MREA : BigDNA
|
||||
{
|
||||
DECL_DNA
|
||||
Value<atUint32> magic;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef __RETRO_CBASICS_HPP__
|
||||
#define __RETRO_CBASICS_HPP__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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:
|
||||
static void Init();
|
||||
static const char* Stringize(const char* fmt, ...);
|
||||
};
|
||||
|
||||
#endif // __RETRO_CBASICS_HPP__
|
|
@ -0,0 +1,19 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "CBasics.hpp"
|
||||
|
||||
void CBasics::Init()
|
||||
{
|
||||
}
|
||||
|
||||
char STRINGIZE_STR[2048];
|
||||
|
||||
const char* CBasics::Stringize(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(STRINGIZE_STR, 2048, fmt, ap);
|
||||
va_end(ap);
|
||||
return STRINGIZE_STR;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#include "CGameAllocator.hpp"
|
||||
|
||||
bool CGameAllocator::Initialize(COsContext&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGameAllocator::Shutdown()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef __RETRO_CGAMEALLOCATOR_HPP__
|
||||
#define __RETRO_CGAMEALLOCATOR_HPP__
|
||||
|
||||
#include "IAllocator.hpp"
|
||||
|
||||
class CGameAllocator : public IAllocator
|
||||
{
|
||||
public:
|
||||
bool Initialize(COsContext&);
|
||||
void Shutdown();
|
||||
};
|
||||
|
||||
#endif // __RETRO_CGAMEALLOCATOR_HPP__
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CGAMESTATE_HPP__
|
||||
#define __RETRO_CGAMESTATE_HPP__
|
||||
|
||||
class CGameState
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CGAMESTATE_HPP__
|
|
@ -1,7 +1,23 @@
|
|||
add_subdirectory(Core)
|
||||
add_subdirectory(Graphics)
|
||||
add_subdirectory(Audio)
|
||||
add_subdirectory(Character)
|
||||
add_subdirectory(GuiSys)
|
||||
add_subdirectory(Script)
|
||||
|
||||
add_executable(RuntimeCheck
|
||||
main.hpp main.cpp
|
||||
COsContext.hpp COsContextBoo.cpp
|
||||
CMemory.hpp CMemory.cpp
|
||||
CMemoryCardSys.hpp CMemoryCardSysPC.cpp
|
||||
IAllocator.hpp IAllocator.cpp
|
||||
CGameAllocator.hpp CGameAllocator.cpp
|
||||
CBasics.hpp CBasicsPC.cpp
|
||||
CTweaks.hpp CTweaks.cpp
|
||||
CTweakParticle.hpp CTweakParticle.cpp
|
||||
CStateManager.hpp CStateManager.cpp
|
||||
CGameState.hpp CGameState.cpp
|
||||
CScriptMailbox.hpp CScriptMailbox.cpp
|
||||
CMapWorldInfo.hpp CMapWorldInfo.cpp
|
||||
CPlayerState.hpp CPlayerState.cpp
|
||||
CWorldTransManager.hpp CWorldTransManager.cpp
|
||||
CRandom16.hpp CRandom16.cpp)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CMAPWORLDINFO_HPP__
|
||||
#define __RETRO_CMAPWORLDINFO_HPP__
|
||||
|
||||
class CMapWorldInfo
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CMAPWORLDINFO_HPP__
|
|
@ -0,0 +1,40 @@
|
|||
#include "CMemory.hpp"
|
||||
#include "CGameAllocator.hpp"
|
||||
|
||||
static CGameAllocator GAME_ALLOCATOR;
|
||||
static IAllocator* MEMORY_ALLOCATOR = &GAME_ALLOCATOR;
|
||||
static bool MEMORY_ALLOCATOR_READY = false;
|
||||
|
||||
void CMemory::Startup(COsContext& cos)
|
||||
{
|
||||
MEMORY_ALLOCATOR_READY = MEMORY_ALLOCATOR->Initialize(cos);
|
||||
}
|
||||
|
||||
void CMemory::Shutdown()
|
||||
{
|
||||
MEMORY_ALLOCATOR->Shutdown();
|
||||
MEMORY_ALLOCATOR_READY = false;
|
||||
}
|
||||
|
||||
void CMemory::SetAllocator(COsContext& cos, IAllocator& alloc)
|
||||
{
|
||||
if (&alloc != MEMORY_ALLOCATOR)
|
||||
{
|
||||
MEMORY_ALLOCATOR = &alloc;
|
||||
MEMORY_ALLOCATOR->Initialize(cos);
|
||||
}
|
||||
}
|
||||
|
||||
CMemorySys::CMemorySys(COsContext& cos, IAllocator& alloc)
|
||||
{
|
||||
CMemory::Startup(cos);
|
||||
CMemory::SetAllocator(cos, alloc);
|
||||
}
|
||||
|
||||
CMemorySys::~CMemorySys()
|
||||
{
|
||||
CMemory::Shutdown();
|
||||
}
|
||||
|
||||
IAllocator* CMemorySys::GetGameAllocator() {return &GAME_ALLOCATOR;}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef __RETRO_CMEMORY_HPP__
|
||||
#define __RETRO_CMEMORY_HPP__
|
||||
|
||||
#include "IAllocator.hpp"
|
||||
#include "COsContext.hpp"
|
||||
|
||||
class CMemory
|
||||
{
|
||||
public:
|
||||
static void Startup(COsContext&);
|
||||
static void Shutdown();
|
||||
static void SetAllocator(COsContext&, IAllocator&);
|
||||
};
|
||||
|
||||
class CMemorySys
|
||||
{
|
||||
public:
|
||||
CMemorySys(COsContext&, IAllocator&);
|
||||
~CMemorySys();
|
||||
static IAllocator* GetGameAllocator();
|
||||
};
|
||||
|
||||
#endif // __RETRO_CMEMORY_HPP__
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CMEMORYCARDSYS_HPP__
|
||||
#define __RETRO_CMEMORYCARDSYS_HPP__
|
||||
|
||||
class CMemoryCardSys
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CMEMORYCARDSYS_HPP__
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef __RETRO_COSCONTEXT_HPP__
|
||||
#define __RETRO_COSCONTEXT_HPP__
|
||||
|
||||
class COsContext
|
||||
{
|
||||
public:
|
||||
COsContext();
|
||||
int OpenWindow(const char* name, int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
#endif // __RETRO_COSCONTEXT_HPP__
|
|
@ -0,0 +1,10 @@
|
|||
#include "COsContext.hpp"
|
||||
|
||||
COsContext::COsContext()
|
||||
{
|
||||
}
|
||||
|
||||
int COsContext::OpenWindow(const char* name, int x, int y, int w, int h)
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CPLAYERSTATE_HPP__
|
||||
#define __RETRO_CPLAYERSTATE_HPP__
|
||||
|
||||
class CPlayerState
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CPLAYERSTATE_HPP__
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CSCRIPTMAILBOX_HPP__
|
||||
#define __RETRO_CSCRIPTMAILBOX_HPP__
|
||||
|
||||
class CScriptMailbox
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CSCRIPTMAILBOX_HPP__
|
|
@ -0,0 +1 @@
|
|||
#include "CStateManager.hpp"
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef __RETRO_CSTATEMANAGER_HPP__
|
||||
#define __RETRO_CSTATEMANAGER_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include "CBasics.hpp"
|
||||
#include "CScriptMailbox.hpp"
|
||||
#include "CMapWorldInfo.hpp"
|
||||
#include "CPlayerState.hpp"
|
||||
#include "CWorldTransManager.hpp"
|
||||
|
||||
class CStateManager : public TOneStatic<CStateManager>
|
||||
{
|
||||
public:
|
||||
CStateManager(const std::weak_ptr<CScriptMailbox>&,
|
||||
const std::weak_ptr<CMapWorldInfo>&,
|
||||
const std::weak_ptr<CPlayerState>&,
|
||||
const std::weak_ptr<CWorldTransManager>&);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,6 @@
|
|||
#include "CTweakParticle.hpp"
|
||||
|
||||
CTweakParticle::CTweakParticle(CInputStream&)
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __RETRO_CTWEAKPARTICLE_HPP__
|
||||
#define __RETRO_CTWEAKPARTICLE_HPP__
|
||||
|
||||
#include "CBasics.hpp"
|
||||
|
||||
class CTweakParticle : TOneStatic<CTweakParticle>
|
||||
{
|
||||
public:
|
||||
CTweakParticle(CInputStream&);
|
||||
};
|
||||
|
||||
#endif // __RETRO_CTWEAKPARTICLE_HPP__
|
|
@ -0,0 +1,9 @@
|
|||
#include "CTweaks.hpp"
|
||||
|
||||
void CTweaks::RegisterTweaks()
|
||||
{
|
||||
}
|
||||
|
||||
void CTweaks::RegisterResourceTweaks()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __RETRO_CTWEAKS_HPP__
|
||||
#define __RETRO_CTWEAKS_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include "CTweakParticle.hpp"
|
||||
|
||||
class CTweaks
|
||||
{
|
||||
TOneStatic<CTweakParticle> m_particle;
|
||||
public:
|
||||
void RegisterTweaks();
|
||||
void RegisterResourceTweaks();
|
||||
};
|
||||
|
||||
#endif // __RETRO_CTWEAKS_HPP__
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __RETRO_CWORLDTRANSMANAGER_HPP__
|
||||
#define __RETRO_CWORLDTRANSMANAGER_HPP__
|
||||
|
||||
class CWorldTransManager
|
||||
{
|
||||
};
|
||||
|
||||
#endif // __RETRO_CWORLDTRANSMANAGER_HPP__
|
|
@ -1,2 +0,0 @@
|
|||
add_library(RetroCore
|
||||
CRandom16.hpp CRandom16.cpp)
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef __RETRO_IALLOCATOR_HPP__
|
||||
#define __RETRO_IALLOCATOR_HPP__
|
||||
|
||||
#include "COsContext.hpp"
|
||||
|
||||
class IAllocator
|
||||
{
|
||||
public:
|
||||
virtual bool Initialize(COsContext&)=0;
|
||||
virtual void Shutdown()=0;
|
||||
};
|
||||
|
||||
#endif // __RETRO_IALLOCATOR_HPP__
|
|
@ -0,0 +1,37 @@
|
|||
#include <memory>
|
||||
#include "COsContext.hpp"
|
||||
#include "CBasics.hpp"
|
||||
#include "CTweaks.hpp"
|
||||
#include "CMemoryCardSys.hpp"
|
||||
|
||||
class CGameGlobalObjects : public TOneStatic<CGameGlobalObjects>
|
||||
{
|
||||
CMemoryCardSys m_memoryCardSys;
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
class CMain : public COsContext
|
||||
{
|
||||
std::unique_ptr<CGameGlobalObjects> m_gameGlobalObjects;
|
||||
CTweaks m_tweaks;
|
||||
public:
|
||||
CMain()
|
||||
{
|
||||
OpenWindow("", 0, 0, 640, 480);
|
||||
}
|
||||
void InitializeSubsystems()
|
||||
{
|
||||
}
|
||||
int RsMain(int argc, const char* argv[])
|
||||
{
|
||||
m_gameGlobalObjects.reset(new CGameGlobalObjects);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
CMain main;
|
||||
return main.RsMain(argc, argv);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef __RETRO_CMAIN_HPP__
|
||||
#define __RETRO_CMAIN_HPP__
|
||||
|
||||
#include "COsContext.hpp"
|
||||
#include "CTweaks.hpp"
|
||||
|
||||
|
||||
|
||||
#endif // __RETRO_CMAIN_HPP__
|
Loading…
Reference in New Issue