Refactored directory layout for cleaner runtime organization

This commit is contained in:
Jack Andersen 2015-08-17 12:05:00 -10:00
parent 9eb41231ea
commit 520eec7aa2
74 changed files with 449 additions and 47 deletions

6
.gitmodules vendored
View File

@ -1,3 +1,9 @@
[submodule "NODLib"]
path = NODLib
url = https://github.com/RetroView/NODLib.git
[submodule "hecl"]
path = hecl
url = https://github.com/RetroView/hecl.git
[submodule "MathLib"]
path = MathLib
url = https://github.com/RetroView/MathLib.git

View File

@ -1,9 +1,19 @@
cmake_minimum_required(VERSION 3.0)
project(RetroCommon)
if (NOT TARGET NOD)
add_subdirectory(NODLib)
cmake_minimum_required(VERSION 3.0)
project(hecl)
if(MSVC)
# Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D_CRT_SECURE_NO_WARNINGS=1 /wd4267 /wd4244)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-multichar -fno-exceptions")
endif()
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${ANGELSCRIPT_INCLUDE_DIR}
set(HECL_SUBPROJECT TRUE)
add_subdirectory(hecl)
add_subdirectory(NODLib)
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
set(NOD_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include)
add_subdirectory(DataSpec)

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP3_CSKR_HPP_
#define _DNAMP3_CSKR_HPP_
#include "BlenderConnection.hpp"
#include "hecl/blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "CINF.hpp"

1
MathLib Submodule

@ -0,0 +1 @@
Subproject commit 9d657895cb143fd37ab66658d2af8b5d3198257d

View File

View File

@ -1,32 +1,5 @@
add_subdirectory(Graphics)
add_subdirectory(Audio)
add_subdirectory(Character)
add_subdirectory(GuiSys)
add_subdirectory(Script)
add_subdirectory(MP3)
add_subdirectory(MP2)
add_subdirectory(MP1)
add_subdirectory(Common)
add_executable(RuntimeCheck
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
CResFactory.hpp CResFactory.cpp
CSimplePool.hpp CSimplePool.cpp
CAssetFactory.hpp CAssetFactory.cpp
CAi.hpp CAi.cpp
CGameOptions.hpp CGameOptions.cpp
CStaticInterference.hpp CStaticInterference.cpp
CCRC32.hpp CCRC32.cpp
RetroTemplates.hpp
GCNTypes.hpp)

View File

@ -1 +0,0 @@
#include "CStateManager.hpp"

9
Runtime/Common/CAi.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "CAi.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,4 +1,12 @@
#ifndef __RETRO_CAI_HPP__
#define __RETRO_CAI_HPP__
namespace Retro
{
namespace Common
{
}
}
#endif // __RETRO_CAI_HPP__

View File

@ -0,0 +1,9 @@
#include "CAssetFactory.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,4 +1,12 @@
#ifndef __RETRO_CASSETFACTORY_HPP__
#define __RETRO_CASSETFACTORY_HPP__
namespace Retro
{
namespace Common
{
}
}
#endif // __RETRO_CASSETFACTORY_HPP__

View File

@ -8,6 +8,13 @@
#include <Athena/IStreamReader.hpp>
#include <Athena/IStreamWriter.hpp>
namespace Retro
{
namespace Common
{
using CInputStream = Athena::io::IStreamReader;
using COutputStream = Athena::io::IStreamWriter;
@ -18,4 +25,7 @@ public:
static const char* Stringize(const char* fmt, ...);
};
}
}
#endif // __RETRO_CBASICS_HPP__

View File

@ -3,6 +3,11 @@
#include "CBasics.hpp"
namespace Retro
{
namespace Common
{
void CBasics::Init()
{
}
@ -17,3 +22,6 @@ const char* CBasics::Stringize(const char* fmt, ...)
va_end(ap);
return STRINGIZE_STR;
}
}
}

View File

@ -1,5 +1,10 @@
#include "CCRC32.hpp"
namespace Retro
{
namespace Common
{
const uint32_t CCRC32::crc32Table[256] =
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
@ -58,3 +63,6 @@ uint32_t CCRC32::Calculate(const void* data, uint32_t length)
return checksum;
}
}
}

View File

@ -2,6 +2,11 @@
#define RETRO_CRC32_HPP
#include <cstdint>
namespace Retro
{
namespace Common
{
class CCRC32
{
static const uint32_t crc32Table[256];
@ -12,4 +17,7 @@ public:
static uint32_t Calculate(const void* data, uint32_t length);
};
}
}
#endif

View File

@ -1,5 +1,10 @@
#include "CGameAllocator.hpp"
namespace Retro
{
namespace Common
{
bool CGameAllocator::Initialize(COsContext&)
{
return true;
@ -8,3 +13,6 @@ bool CGameAllocator::Initialize(COsContext&)
void CGameAllocator::Shutdown()
{
}
}
}

View File

@ -3,6 +3,11 @@
#include "IAllocator.hpp"
namespace Retro
{
namespace Common
{
class CGameAllocator : public IAllocator
{
public:
@ -10,4 +15,7 @@ public:
void Shutdown();
};
}
}
#endif // __RETRO_CGAMEALLOCATOR_HPP__

View File

@ -0,0 +1,9 @@
#include "CGameOptions.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,8 +1,16 @@
#ifndef __RETRO_CGAMEOPTIONS_HPP__
#define __RETRO_CGAMEOPTIONS_HPP__
namespace Retro
{
namespace Common
{
class CGameOptions
{
};
}
}
#endif // __RETRO_CGAMEOPTIONS_HPP__

View File

@ -0,0 +1,9 @@
#include "CGameState.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -5,6 +5,11 @@
#include "CPlayerState.hpp"
#include "CGameOptions.hpp"
namespace Retro
{
namespace Common
{
class CGameState
{
std::unique_ptr<CPlayerState> m_playerState;
@ -16,4 +21,7 @@ public:
}
};
}
}
#endif // __RETRO_CGAMESTATE_HPP__

View File

@ -0,0 +1,30 @@
add_subdirectory(Graphics)
add_subdirectory(Audio)
add_subdirectory(Character)
add_subdirectory(GuiSys)
add_library(RuntimeCommon
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
CResFactory.hpp CResFactory.cpp
CSimplePool.hpp CSimplePool.cpp
CAssetFactory.hpp CAssetFactory.cpp
CAi.hpp CAi.cpp
CGameOptions.hpp CGameOptions.cpp
CStaticInterference.hpp CStaticInterference.cpp
CCRC32.hpp CCRC32.cpp
RetroTemplates.hpp
GCNTypes.hpp)

View File

@ -0,0 +1,9 @@
#include "CMapWorldInfo.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,8 +1,16 @@
#ifndef __RETRO_CMAPWORLDINFO_HPP__
#define __RETRO_CMAPWORLDINFO_HPP__
namespace Retro
{
namespace Common
{
class CMapWorldInfo
{
};
}
}
#endif // __RETRO_CMAPWORLDINFO_HPP__

View File

@ -1,6 +1,11 @@
#include "CMemory.hpp"
#include "CGameAllocator.hpp"
namespace Retro
{
namespace Common
{
static CGameAllocator GAME_ALLOCATOR;
static IAllocator* MEMORY_ALLOCATOR = &GAME_ALLOCATOR;
static bool MEMORY_ALLOCATOR_READY = false;
@ -38,3 +43,5 @@ CMemorySys::~CMemorySys()
IAllocator& CMemorySys::GetGameAllocator() {return GAME_ALLOCATOR;}
}
}

View File

@ -4,6 +4,11 @@
#include "IAllocator.hpp"
#include "COsContext.hpp"
namespace Retro
{
namespace Common
{
class CMemory
{
public:
@ -20,4 +25,7 @@ public:
static IAllocator& GetGameAllocator();
};
}
}
#endif // __RETRO_CMEMORY_HPP__

View File

@ -1,8 +1,16 @@
#ifndef __RETRO_CMEMORYCARDSYS_HPP__
#define __RETRO_CMEMORYCARDSYS_HPP__
namespace Retro
{
namespace Common
{
class CMemoryCardSys
{
};
}
}
#endif // __RETRO_CMEMORYCARDSYS_HPP__

View File

@ -0,0 +1,9 @@
#include "CMemoryCardSys.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,6 +1,11 @@
#ifndef __RETRO_COSCONTEXT_HPP__
#define __RETRO_COSCONTEXT_HPP__
namespace Retro
{
namespace Common
{
class COsContext
{
public:
@ -8,4 +13,7 @@ public:
int OpenWindow(const char* name, int x, int y, int w, int h);
};
}
}
#endif // __RETRO_COSCONTEXT_HPP__

View File

@ -1,5 +1,10 @@
#include "COsContext.hpp"
namespace Retro
{
namespace Common
{
COsContext::COsContext()
{
}
@ -8,3 +13,6 @@ int COsContext::OpenWindow(const char* name, int x, int y, int w, int h)
{
return 0;
}
}
}

View File

@ -0,0 +1,9 @@
#include "CPlayerState.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -4,7 +4,12 @@
#include "RetroTemplates.hpp"
#include "CStaticInterference.hpp"
class CPlayerState : TOneStatic<CPlayerState>
namespace Retro
{
namespace Common
{
class CPlayerState : public TOneStatic<CPlayerState>
{
CStaticInterference m_staticIntf;
class CPowerUp
@ -12,9 +17,13 @@ class CPlayerState : TOneStatic<CPlayerState>
int m_a;
int m_b;
public:
CPowerUp() : m_a(-1), m_b(-1) {}
CPowerUp(int a, int b) : m_a(a), m_b(b) {}
};
CPowerUp m_powerups[29];
};
}
}
#endif // __RETRO_CPLAYERSTATE_HPP__

View File

@ -2,6 +2,11 @@
namespace Retro
{
namespace Common
{
CRandom16* GLOBAL_RANDOM = nullptr;
CGlobalRandom* GLOBAL_RANDOM_TOKEN = nullptr;
}
}

View File

@ -5,6 +5,8 @@
namespace Retro
{
namespace Common
{
extern class CRandom16* GLOBAL_RANDOM;
extern class CGlobalRandom* GLOBAL_RANDOM_TOKEN;
@ -75,6 +77,7 @@ public:
}
};
}
}
#endif // RETRO_CRANDOM16_HPP

View File

@ -0,0 +1,9 @@
#include "CResFactory.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,8 +1,16 @@
#ifndef __RETRO_CRESFACTORY_HPP__
#define __RETRO_CRESFACTORY_HPP__
namespace Retro
{
namespace Common
{
class CResFactory
{
};
}
}
#endif // __RETRO_CRESFACTORY_HPP__

View File

@ -0,0 +1,9 @@
#include "CScriptMailbox.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,8 +1,16 @@
#ifndef __RETRO_CSCRIPTMAILBOX_HPP__
#define __RETRO_CSCRIPTMAILBOX_HPP__
namespace Retro
{
namespace Common
{
class CScriptMailbox
{
};
}
}
#endif // __RETRO_CSCRIPTMAILBOX_HPP__

View File

@ -0,0 +1,9 @@
#include "CSimplePool.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,8 +1,16 @@
#ifndef __RETRO_CSIMPLEPOOL_HPP__
#define __RETRO_CSIMPLEPOOL_HPP__
namespace Retro
{
namespace Common
{
class CSimplePool
{
};
}
}
#endif // __RETRO_CSIMPLEPOOL_HPP__

View File

@ -0,0 +1,9 @@
#include "CStateManager.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -8,6 +8,11 @@
#include "CPlayerState.hpp"
#include "CWorldTransManager.hpp"
namespace Retro
{
namespace Common
{
class CStateManager : public TOneStatic<CStateManager>
{
public:
@ -17,4 +22,7 @@ public:
const std::weak_ptr<CWorldTransManager>&);
};
}
}
#endif

View File

@ -0,0 +1,9 @@
#include "CStaticInterference.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,8 +1,16 @@
#ifndef __RETRO_CSTATICINTERFERENCE_HPP__
#define __RETRO_CSTATICINTERFERENCE_HPP__
namespace Retro
{
namespace Common
{
class CStaticInterference
{
};
}
}
#endif // __RETRO_CSTATICINTERFERENCE_HPP__

View File

@ -1,6 +1,14 @@
#include "CTweakParticle.hpp"
namespace Retro
{
namespace Common
{
CTweakParticle::CTweakParticle(CInputStream&)
{
}
}
}

View File

@ -3,10 +3,18 @@
#include "CBasics.hpp"
namespace Retro
{
namespace Common
{
class CTweakParticle : TOneStatic<CTweakParticle>
{
public:
CTweakParticle(CInputStream&);
};
}
}
#endif // __RETRO_CTWEAKPARTICLE_HPP__

View File

@ -1,5 +1,10 @@
#include "CTweaks.hpp"
namespace Retro
{
namespace Common
{
void CTweaks::RegisterTweaks()
{
}
@ -7,3 +12,6 @@ void CTweaks::RegisterTweaks()
void CTweaks::RegisterResourceTweaks()
{
}
}
}

View File

@ -4,6 +4,11 @@
#include <memory>
#include "CTweakParticle.hpp"
namespace Retro
{
namespace Common
{
class CTweaks
{
TOneStatic<CTweakParticle> m_particle;
@ -12,4 +17,7 @@ public:
void RegisterResourceTweaks();
};
}
}
#endif // __RETRO_CTWEAKS_HPP__

View File

@ -0,0 +1,9 @@
#include "CWorldTransManager.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -1,8 +1,16 @@
#ifndef __RETRO_CWORLDTRANSMANAGER_HPP__
#define __RETRO_CWORLDTRANSMANAGER_HPP__
namespace Retro
{
namespace Common
{
class CWorldTransManager
{
};
}
}
#endif // __RETRO_CWORLDTRANSMANAGER_HPP__

View File

@ -2,6 +2,7 @@
#define __RETRO_GCTYPES_HPP__
#include <stdint.h>
#include <stdlib.h>
using s8 = int8_t;
using u8 = uint8_t;

View File

@ -0,0 +1,9 @@
#include "IAllocator.hpp"
namespace Retro
{
namespace Common
{
}
}

View File

@ -3,6 +3,11 @@
#include "COsContext.hpp"
namespace Retro
{
namespace Common
{
class IAllocator
{
public:
@ -10,4 +15,7 @@ public:
virtual void Shutdown()=0;
};
}
}
#endif // __RETRO_IALLOCATOR_HPP__

View File

@ -3,6 +3,11 @@
#include "GCNTypes.hpp"
namespace Retro
{
namespace Common
{
/**
* @brief Inheritable singleton static-allocator
*/
@ -20,4 +25,7 @@ public:
template<class T> T TOneStatic<T>::m_allocspace;
template<class T> u32 TOneStatic<T>::m_refCount;
}
}
#endif // __RETRO_TEMPLATES_HPP__

View File

View File

@ -0,0 +1,5 @@
include_directories(. ../Common)
add_executable(mp1
main.cpp)
target_link_libraries(mp1
RuntimeCommon)

View File

@ -7,25 +7,30 @@
#include "CResFactory.hpp"
#include "CSimplePool.hpp"
class CGameGlobalObjects : public TOneStatic<CGameGlobalObjects>
namespace Retro
{
CMemoryCardSys m_memoryCardSys;
CResFactory m_resFactory;
CSimplePool m_simplePool;
namespace MP1
{
class CGameGlobalObjects : public Common::TOneStatic<CGameGlobalObjects>
{
Common::CMemoryCardSys m_memoryCardSys;
Common::CResFactory m_resFactory;
Common::CSimplePool m_simplePool;
public:
void PostInitialize(COsContext& osctx, CMemorySys& memSys)
void PostInitialize(Common::COsContext& osctx, Common::CMemorySys& memSys)
{
}
};
class CMain : public COsContext
class CMain : public Common::COsContext
{
CMemorySys m_memSys;
CTweaks m_tweaks;
Common::CMemorySys m_memSys;
Common::CTweaks m_tweaks;
bool m_run = true;
public:
CMain()
: m_memSys(*this, CMemorySys::GetGameAllocator())
: m_memSys(*this, Common::CMemorySys::GetGameAllocator())
{
OpenWindow("", 0, 0, 640, 480);
}
@ -45,8 +50,11 @@ public:
}
};
}
}
int main(int argc, const char* argv[])
{
CMain main;
Retro::MP1::CMain main;
return main.RsMain(argc, argv);
}

1
hecl Submodule

@ -0,0 +1 @@
Subproject commit f6b681030a7a5328683c18ea37f56b752551986b