diff --git a/CMakeLists.txt b/CMakeLists.txt index b1f70dce6..e54172e96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,8 +26,9 @@ set(HECL_DATASPEC_PUSHES HECL::Database::DATA_SPEC_REGISTRY.push_back(&Retro::SpecEntMP3);") add_subdirectory(hecl) add_subdirectory(NODLib) +set(NODLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include) include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR} + ${NODLIB_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -set(NOD_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include) add_subdirectory(DataSpec) add_subdirectory(Runtime) diff --git a/DataSpec/CMakeLists.txt b/DataSpec/CMakeLists.txt index c8cb5d56f..0336cca61 100644 --- a/DataSpec/CMakeLists.txt +++ b/DataSpec/CMakeLists.txt @@ -1,5 +1,4 @@ -include_directories(${HECL_INCLUDE_DIR} ${NOD_LIB_INCLUDE_DIR} ${LIBPNG_INCLUDE_DIR} - ${SQUISH_INCLUDE_DIR}) +include_directories(${LIBPNG_INCLUDE_DIR} ${SQUISH_INCLUDE_DIR}) # Magic ingredient find_package(atdna REQUIRED) diff --git a/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp b/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp index e69de29bb..a385e3800 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp @@ -0,0 +1,19 @@ +#ifndef _DNAMP1_CTWEAKPARTICLE_HPP_ +#define _DNAMP1_CTWEAKPARTICLE_HPP_ + +#include "../../DNACommon/DNACommon.hpp" + +namespace Retro +{ +namespace DNAMP1 +{ + +class CTweakParticle : BigYAML +{ + DECL_YAML +}; + +} +} + +#endif // _DNAMP1_CTWEAKPARTICLE_HPP_ diff --git a/Runtime/Common/CElementGen.cpp b/Runtime/Common/Audio/CAudioStateWin.cpp similarity index 100% rename from Runtime/Common/CElementGen.cpp rename to Runtime/Common/Audio/CAudioStateWin.cpp diff --git a/Runtime/Common/Audio/CAudioStateWin.hpp b/Runtime/Common/Audio/CAudioStateWin.hpp new file mode 100644 index 000000000..ab960024d --- /dev/null +++ b/Runtime/Common/Audio/CAudioStateWin.hpp @@ -0,0 +1,18 @@ +#ifndef __RETRO_CAUDIOSTATEWIN_HPP__ +#define __RETRO_CAUDIOSTATEWIN_HPP__ + +#include "../CIOWin.hpp" + +namespace Retro +{ +namespace Common +{ + +class CAudioStateWin : public CIOWin +{ +}; + +} +} + +#endif // __RETRO_CAUDIOSTATEWIN_HPP__ diff --git a/Runtime/Common/CInGameTweakManager.cpp b/Runtime/Common/Audio/CAudioSys.cpp similarity index 100% rename from Runtime/Common/CInGameTweakManager.cpp rename to Runtime/Common/Audio/CAudioSys.cpp diff --git a/Runtime/Common/Audio/CAudioSys.hpp b/Runtime/Common/Audio/CAudioSys.hpp new file mode 100644 index 000000000..70b83c91d --- /dev/null +++ b/Runtime/Common/Audio/CAudioSys.hpp @@ -0,0 +1,22 @@ +#ifndef __RETRO_CAUDIOSYS_HPP__ +#define __RETRO_CAUDIOSYS_HPP__ + +#include "../GCNTypes.hpp" + +namespace Retro +{ +namespace Common +{ + +class CAudioSys +{ +public: + CAudioSys(u8,u8,u8,u8,u32) + { + } +}; + +} +} + +#endif // __RETRO_CAUDIOSYS_HPP__ diff --git a/Runtime/Common/Audio/CMakeLists.txt b/Runtime/Common/Audio/CMakeLists.txt index e69de29bb..4574ee960 100644 --- a/Runtime/Common/Audio/CMakeLists.txt +++ b/Runtime/Common/Audio/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(RuntimeCommonAudio + CAudioSys.hpp CAudioSys.cpp + CAudioStateWin.hpp CAudioStateWin.cpp) diff --git a/Runtime/Common/CFactoryStore.cpp b/Runtime/Common/CFactoryStore.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/CFactoryStore.hpp b/Runtime/Common/CFactoryStore.hpp new file mode 100644 index 000000000..0e899d727 --- /dev/null +++ b/Runtime/Common/CFactoryStore.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CFACTORYSTORE_HPP__ +#define __RETRO_CFACTORYSTORE_HPP__ + +namespace Retro +{ +namespace Common +{ + +class IObjectStore +{ +}; + +} +} + +#endif // __RETRO_CFACTORYSTORE_HPP__ diff --git a/Runtime/Common/CGameState.hpp b/Runtime/Common/CGameState.hpp index 75b89a245..0322eec5b 100644 --- a/Runtime/Common/CGameState.hpp +++ b/Runtime/Common/CGameState.hpp @@ -12,12 +12,11 @@ namespace Common class CGameState { - std::unique_ptr m_playerState; + TOneStatic m_playerState; CGameOptions m_gameOpts; public: CGameState() { - m_playerState.reset(new CPlayerState); } }; diff --git a/Runtime/Common/CIOWin.cpp b/Runtime/Common/CIOWin.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/CIOWin.hpp b/Runtime/Common/CIOWin.hpp new file mode 100644 index 000000000..d2e7b294b --- /dev/null +++ b/Runtime/Common/CIOWin.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CIOWIN_HPP__ +#define __RETRO_CIOWIN_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CIOWin +{ +}; + +} +} + +#endif // __RETRO_CIOWIN_HPP__ diff --git a/Runtime/Common/CIOWinManager.cpp b/Runtime/Common/CIOWinManager.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/CIOWinManager.hpp b/Runtime/Common/CIOWinManager.hpp new file mode 100644 index 000000000..76ee84cf3 --- /dev/null +++ b/Runtime/Common/CIOWinManager.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CIOWINMANAGER_HPP__ +#define __RETRO_CIOWINMANAGER_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CIOWinManager +{ +}; + +} +} + +#endif // __RETRO_CIOWINMANAGER_HPP__ diff --git a/Runtime/Common/CMainFlow.cpp b/Runtime/Common/CMainFlow.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/CMainFlow.hpp b/Runtime/Common/CMainFlow.hpp new file mode 100644 index 000000000..8a71ae695 --- /dev/null +++ b/Runtime/Common/CMainFlow.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CMAINFLOW_HPP__ +#define __RETRO_CMAINFLOW_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CMainFlow +{ +}; + +} +} + +#endif // __RETRO_CMAINFLOW_HPP__ diff --git a/Runtime/Common/CMakeLists.txt b/Runtime/Common/CMakeLists.txt index fa6d6fed0..a36b08f1d 100644 --- a/Runtime/Common/CMakeLists.txt +++ b/Runtime/Common/CMakeLists.txt @@ -1,18 +1,20 @@ -add_subdirectory(Graphics) add_subdirectory(Audio) add_subdirectory(Character) +add_subdirectory(Graphics) add_subdirectory(GuiSys) +add_subdirectory(Input) +add_subdirectory(Particle) add_library(RuntimeCommon COsContext.hpp COsContextBoo.cpp + CMainFlow.hpp CMainFlow.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 - CInGameTweakManager.hpp CInGameTweakManager.cpp - CTweakParticle.hpp CTweakParticle.cpp + CIOWin.hpp CIOWin.cpp + CIOWinManager.hpp CIOWinManager.cpp CStateManager.hpp CStateManager.cpp CGameState.hpp CGameState.cpp CScriptMailbox.hpp CScriptMailbox.cpp @@ -21,11 +23,13 @@ add_library(RuntimeCommon CWorldTransManager.hpp CWorldTransManager.cpp CRandom16.hpp CRandom16.cpp CResFactory.hpp CResFactory.cpp + CFactoryStore.hpp CFactoryStore.cpp CSimplePool.hpp CSimplePool.cpp CAi.hpp CAi.cpp CGameOptions.hpp CGameOptions.cpp CStaticInterference.hpp CStaticInterference.cpp - CElementGen.hpp CElementGen.cpp CCRC32.hpp CCRC32.cpp + IFactory.hpp + GameGlobalObjects.hpp RetroTemplates.hpp GCNTypes.hpp) diff --git a/Runtime/Common/CPlayerState.hpp b/Runtime/Common/CPlayerState.hpp index 3bc326790..7b9d20a57 100644 --- a/Runtime/Common/CPlayerState.hpp +++ b/Runtime/Common/CPlayerState.hpp @@ -9,7 +9,7 @@ namespace Retro namespace Common { -class CPlayerState : public TOneStatic +class CPlayerState { CStaticInterference m_staticIntf; class CPowerUp diff --git a/Runtime/Common/CResFactory.hpp b/Runtime/Common/CResFactory.hpp index 8cf56cf15..16c27b3d8 100644 --- a/Runtime/Common/CResFactory.hpp +++ b/Runtime/Common/CResFactory.hpp @@ -1,12 +1,14 @@ #ifndef __RETRO_CRESFACTORY_HPP__ #define __RETRO_CRESFACTORY_HPP__ +#include "IFactory.hpp" + namespace Retro { namespace Common { -class CResFactory +class CResFactory : public IFactory { }; diff --git a/Runtime/Common/CSimplePool.hpp b/Runtime/Common/CSimplePool.hpp index e5b07580e..d1f4977f4 100644 --- a/Runtime/Common/CSimplePool.hpp +++ b/Runtime/Common/CSimplePool.hpp @@ -1,13 +1,20 @@ #ifndef __RETRO_CSIMPLEPOOL_HPP__ #define __RETRO_CSIMPLEPOOL_HPP__ +#include "IFactory.hpp" +#include "CFactoryStore.hpp" + namespace Retro { namespace Common { -class CSimplePool +class CSimplePool : public IObjectStore { +public: + CSimplePool(IFactory&) + { + } }; } diff --git a/Runtime/Common/CStateManager.hpp b/Runtime/Common/CStateManager.hpp index e4e6d68ee..d15a22f36 100644 --- a/Runtime/Common/CStateManager.hpp +++ b/Runtime/Common/CStateManager.hpp @@ -13,7 +13,7 @@ namespace Retro namespace Common { -class CStateManager : public TOneStatic +class CStateManager { public: CStateManager(const std::weak_ptr&, diff --git a/Runtime/Common/Character/CAnimData.hpp b/Runtime/Common/Character/CAnimData.hpp index e69de29bb..2c35ba06d 100644 --- a/Runtime/Common/Character/CAnimData.hpp +++ b/Runtime/Common/Character/CAnimData.hpp @@ -0,0 +1,20 @@ +#ifndef __RETRO_CANIMDATA_HPP__ +#define __RETRO_CANIMDATA_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CAnimData +{ +public: + static void InitializeCache() + { + } +}; + +} +} + +#endif // __RETRO_CANIMDATA_HPP__ diff --git a/Runtime/Common/Character/CAssetFactory.hpp b/Runtime/Common/Character/CAssetFactory.hpp index f12641e91..1a947d9f3 100644 --- a/Runtime/Common/Character/CAssetFactory.hpp +++ b/Runtime/Common/Character/CAssetFactory.hpp @@ -1,13 +1,19 @@ #ifndef __RETRO_CASSETFACTORY_HPP__ #define __RETRO_CASSETFACTORY_HPP__ +#include "../IFactory.hpp" + namespace Retro { namespace Common { -class CCharacterFactoryBuilder +class CCharacterFactoryBuilder : public IFactory { +public: + class CDummyFactory : public IFactory + { + }; }; } diff --git a/Runtime/Common/Character/CCharAnimTime.cpp b/Runtime/Common/Character/CCharAnimTime.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/Character/CCharAnimTime.hpp b/Runtime/Common/Character/CCharAnimTime.hpp new file mode 100644 index 000000000..4a505a416 --- /dev/null +++ b/Runtime/Common/Character/CCharAnimTime.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CCHARANIMTIME_HPP__ +#define __RETRO_CCHARANIMTIME_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CCharAnimTime +{ +}; + +} +} + +#endif // __RETRO_CCHARANIMTIME_HPP__ diff --git a/Runtime/Common/Character/CCharacterFactory.hpp b/Runtime/Common/Character/CCharacterFactory.hpp index 9c89fac65..d493691c0 100644 --- a/Runtime/Common/Character/CCharacterFactory.hpp +++ b/Runtime/Common/Character/CCharacterFactory.hpp @@ -1,8 +1,22 @@ #ifndef __RETRO_CCHARACTERFACTORY_HPP__ #define __RETRO_CCHARACTERFACTORY_HPP__ -class CCharacterFactory +#include "../IFactory.hpp" + +namespace Retro { +namespace Common +{ + +class CCharacterFactory : public IFactory +{ +public: + class CDummyFactory : public IFactory + { + }; }; +} +} + #endif // __RETRO_CCHARACTERFACTORY_HPP__ diff --git a/Runtime/Common/Character/CMakeLists.txt b/Runtime/Common/Character/CMakeLists.txt index 009f83a1d..a9a1cd5e2 100644 --- a/Runtime/Common/Character/CMakeLists.txt +++ b/Runtime/Common/Character/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(RuntimeCommonCharacter CAssetFactory.hpp CAssetFactory.cpp CCharacterFactory.hpp CCharacterFactory.cpp - CAnimData.hpp CAnimData.cpp) + CAnimData.hpp CAnimData.cpp + CCharAnimTime.hpp CCharAnimTime.cpp) diff --git a/Runtime/Common/GameGlobalObjects.hpp b/Runtime/Common/GameGlobalObjects.hpp new file mode 100644 index 000000000..7596ef374 --- /dev/null +++ b/Runtime/Common/GameGlobalObjects.hpp @@ -0,0 +1,21 @@ +#ifndef __RETRO_GAMEGLOBALOBJECTS_HPP__ +#define __RETRO_GAMEGLOBALOBJECTS_HPP__ + +namespace Retro +{ +namespace Common +{ + +extern class CMemoryCardSys* g_MemoryCardSys; +extern class CResFactory* g_ResFactory; +extern class CSimplePool* g_SimplePool; +extern class CCharacterFactoryBuilder* g_CharFactoryBuilder; +extern class CAiFuncMap* g_AiFuncMap; +extern class CGameState* g_GameState; +extern class CInGameTweakManager* g_TweakManager; +extern class CBooRenderer* g_Renderer; + +} +} + +#endif // __RETRO_GAMEGLOBALOBJECTS_HPP__ diff --git a/Runtime/Common/Graphics/CBooRenderer.cpp b/Runtime/Common/Graphics/CBooRenderer.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/Graphics/CBooRenderer.hpp b/Runtime/Common/Graphics/CBooRenderer.hpp new file mode 100644 index 000000000..958875c2c --- /dev/null +++ b/Runtime/Common/Graphics/CBooRenderer.hpp @@ -0,0 +1,25 @@ +#ifndef __RETRO_CBOORENDERER_HPP__ +#define __RETRO_CBOORENDERER_HPP__ + +#include "../CFactoryStore.hpp" +#include "../COsContext.hpp" +#include "../CMemory.hpp" +#include "../CResFactory.hpp" + +namespace Retro +{ +namespace Common +{ + +class CBooRenderer +{ +public: + CBooRenderer(IObjectStore&, COsContext&, CMemorySys&, CResFactory&) + { + } +}; + +} +} + +#endif // __RETRO_CBOORENDERER_HPP__ diff --git a/Runtime/Common/Graphics/CMakeLists.txt b/Runtime/Common/Graphics/CMakeLists.txt index e69de29bb..8fdbc83e1 100644 --- a/Runtime/Common/Graphics/CMakeLists.txt +++ b/Runtime/Common/Graphics/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(RuntimeCommonGraphics + CBooRenderer.hpp CBooRenderer.cpp) diff --git a/Runtime/Common/GuiSys/CConsoleOutputWindow.cpp b/Runtime/Common/GuiSys/CConsoleOutputWindow.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/GuiSys/CConsoleOutputWindow.hpp b/Runtime/Common/GuiSys/CConsoleOutputWindow.hpp new file mode 100644 index 000000000..4b4064b17 --- /dev/null +++ b/Runtime/Common/GuiSys/CConsoleOutputWindow.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CCONSOLEOUTPUTWINDOW_HPP__ +#define __RETRO_CCONSOLEOUTPUTWINDOW_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CConsoleOutputWindow +{ +}; + +} +} + +#endif // __RETRO_CCONSOLEOUTPUTWINDOW_HPP__ diff --git a/Runtime/Common/GuiSys/CGuiSys.cpp b/Runtime/Common/GuiSys/CGuiSys.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/GuiSys/CGuiSys.hpp b/Runtime/Common/GuiSys/CGuiSys.hpp new file mode 100644 index 000000000..fea690dca --- /dev/null +++ b/Runtime/Common/GuiSys/CGuiSys.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CGUISYS_HPP__ +#define __RETRO_CGUISYS_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CGuiSys +{ +}; + +} +} + +#endif // __RETRO_CGUISYS_HPP__ diff --git a/Runtime/Common/GuiSys/CMakeLists.txt b/Runtime/Common/GuiSys/CMakeLists.txt index e69de29bb..3be17c89e 100644 --- a/Runtime/Common/GuiSys/CMakeLists.txt +++ b/Runtime/Common/GuiSys/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(RuntimeCommonGuiSys + CGuiSys.hpp CGuiSys.cpp + CSplashScreen.hpp CSplashScreen.cpp + CConsoleOutputWindow.hpp CConsoleOutputWindow.cpp) diff --git a/Runtime/Common/GuiSys/CSplashScreen.cpp b/Runtime/Common/GuiSys/CSplashScreen.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/GuiSys/CSplashScreen.hpp b/Runtime/Common/GuiSys/CSplashScreen.hpp new file mode 100644 index 000000000..1e2abd69a --- /dev/null +++ b/Runtime/Common/GuiSys/CSplashScreen.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CSPLASHSCREEN_HPP__ +#define __RETRO_CSPLASHSCREEN_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CSplashScreen +{ +}; + +} +} + +#endif // __RETRO_CSPLASHSCREEN_HPP__ diff --git a/Runtime/Common/IFactory.hpp b/Runtime/Common/IFactory.hpp new file mode 100644 index 000000000..1175122a7 --- /dev/null +++ b/Runtime/Common/IFactory.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_IFACTORY_HPP__ +#define __RETRO_IFACTORY_HPP__ + +namespace Retro +{ +namespace Common +{ + +class IFactory +{ +}; + +} +} + +#endif // __RETRO_IFACTORY_HPP__ diff --git a/Runtime/Common/Input/CInputGenerator.cpp b/Runtime/Common/Input/CInputGenerator.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/Input/CInputGenerator.hpp b/Runtime/Common/Input/CInputGenerator.hpp new file mode 100644 index 000000000..aad9facb4 --- /dev/null +++ b/Runtime/Common/Input/CInputGenerator.hpp @@ -0,0 +1,16 @@ +#ifndef __RETRO_CINPUTGENERATOR_HPP__ +#define __RETRO_CINPUTGENERATOR_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CInputGenerator +{ +}; + +} +} + +#endif // __RETRO_CINPUTGENERATOR_HPP__ diff --git a/Runtime/Common/Input/CMakeLists.txt b/Runtime/Common/Input/CMakeLists.txt new file mode 100644 index 000000000..e5bdf0281 --- /dev/null +++ b/Runtime/Common/Input/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(RuntimeCommonInput + CInputGenerator.hpp CInputGenerator.cpp) diff --git a/Runtime/Common/Particle/CDecalManager.cpp b/Runtime/Common/Particle/CDecalManager.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/Particle/CDecalManager.hpp b/Runtime/Common/Particle/CDecalManager.hpp new file mode 100644 index 000000000..275860988 --- /dev/null +++ b/Runtime/Common/Particle/CDecalManager.hpp @@ -0,0 +1,20 @@ +#ifndef __RETRO_CDECALMANAGER_HPP__ +#define __RETRO_CDECALMANAGER_HPP__ + +namespace Retro +{ +namespace Common +{ + +class CDecalManager +{ +public: + static void Initialize() + { + } +}; + +} +} + +#endif // __RETRO_CDECALMANAGER_HPP__ diff --git a/Runtime/Common/Particle/CElementGen.cpp b/Runtime/Common/Particle/CElementGen.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/CElementGen.hpp b/Runtime/Common/Particle/CElementGen.hpp similarity index 77% rename from Runtime/Common/CElementGen.hpp rename to Runtime/Common/Particle/CElementGen.hpp index 0af51067b..f7400bb89 100644 --- a/Runtime/Common/CElementGen.hpp +++ b/Runtime/Common/Particle/CElementGen.hpp @@ -8,6 +8,10 @@ namespace Common class CElementGen { +public: + static void Initialize() + { + } }; } diff --git a/Runtime/Common/Particle/CMakeLists.txt b/Runtime/Common/Particle/CMakeLists.txt new file mode 100644 index 000000000..a36b7f77b --- /dev/null +++ b/Runtime/Common/Particle/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(RuntimeCommonParticle + CElementGen.hpp CElementGen.cpp + CDecalManager.hpp CDecalManager.cpp) diff --git a/Runtime/Common/RetroTemplates.hpp b/Runtime/Common/RetroTemplates.hpp index 07acf388c..2cd2396b7 100644 --- a/Runtime/Common/RetroTemplates.hpp +++ b/Runtime/Common/RetroTemplates.hpp @@ -1,6 +1,7 @@ #ifndef __RETRO_TEMPLATES_HPP__ #define __RETRO_TEMPLATES_HPP__ +#include #include "GCNTypes.hpp" namespace Retro @@ -14,15 +15,32 @@ namespace Common template class TOneStatic { - static T m_allocspace; + static u8 m_allocspace[sizeof(T)]; static uint32_t m_refCount; public: - static T* GetAllocSpace() {return &m_allocspace;} + static T* GetAllocSpace() {return (T*)m_allocspace;} static u32& ReferenceCount() {return m_refCount;} - void* operator new(size_t) {++ReferenceCount(); return GetAllocSpace();} - void operator delete(void*) {--ReferenceCount();} + T* operator->() const {return (T*)m_allocspace;} + + void* operator new(size_t) = delete; + void operator delete(void*) = delete; + + template + TOneStatic(typename std::enable_if::value>::type* = 0) + {++ReferenceCount();} + template + TOneStatic(typename std::enable_if::value>::type* = 0) + {++ReferenceCount(); new (GetAllocSpace()) T();} + + template TOneStatic(Args&&... args) + {++ReferenceCount(); new (GetAllocSpace()) T(std::forward(args)...);} + + ~TOneStatic() {--ReferenceCount();} + + template void reset(Args&&... args) + {new (GetAllocSpace()) T(std::forward(args)...);} }; -template T TOneStatic::m_allocspace; +template u8 TOneStatic::m_allocspace[sizeof(T)]; template u32 TOneStatic::m_refCount; } diff --git a/Runtime/MP1/CInGameTweakManager.cpp b/Runtime/MP1/CInGameTweakManager.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Common/CInGameTweakManager.hpp b/Runtime/MP1/CInGameTweakManager.hpp similarity index 64% rename from Runtime/Common/CInGameTweakManager.hpp rename to Runtime/MP1/CInGameTweakManager.hpp index de9b8cbe7..ecd0b5871 100644 --- a/Runtime/Common/CInGameTweakManager.hpp +++ b/Runtime/MP1/CInGameTweakManager.hpp @@ -1,6 +1,8 @@ #ifndef __RETRO_CINGAMETWEAKMANAGER_HPP__ #define __RETRO_CINGAMETWEAKMANAGER_HPP__ +#include + namespace Retro { namespace Common @@ -8,6 +10,11 @@ namespace Common class CInGameTweakManager { +public: + bool ReadFromMemoryCard(const std::string& name) + { + return true; + } }; } diff --git a/Runtime/MP1/CMakeLists.txt b/Runtime/MP1/CMakeLists.txt index cb4a0afd8..103e8c2d6 100644 --- a/Runtime/MP1/CMakeLists.txt +++ b/Runtime/MP1/CMakeLists.txt @@ -1,6 +1,11 @@ include_directories(. ../Common) add_executable(mp1 + CTweaks.hpp CTweaks.cpp + CInGameTweakManager.hpp CInGameTweakManager.cpp + CTweakParticle.hpp CTweakParticle.cpp main.cpp) target_link_libraries(mp1 RuntimeCommonCharacter - RuntimeCommon) + RuntimeCommon + DNAMP1 + DNACommon) diff --git a/Runtime/Common/CTweakParticle.cpp b/Runtime/MP1/CTweakParticle.cpp similarity index 100% rename from Runtime/Common/CTweakParticle.cpp rename to Runtime/MP1/CTweakParticle.cpp diff --git a/Runtime/Common/CTweakParticle.hpp b/Runtime/MP1/CTweakParticle.hpp similarity index 69% rename from Runtime/Common/CTweakParticle.hpp rename to Runtime/MP1/CTweakParticle.hpp index a15bb1bb3..a646f1608 100644 --- a/Runtime/Common/CTweakParticle.hpp +++ b/Runtime/MP1/CTweakParticle.hpp @@ -2,13 +2,14 @@ #define __RETRO_CTWEAKPARTICLE_HPP__ #include "CBasics.hpp" +#include "DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp" namespace Retro { namespace Common { -class CTweakParticle : TOneStatic +class CTweakParticle : DNAMP1::CTweakParticle { public: CTweakParticle(CInputStream&); diff --git a/Runtime/Common/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp similarity index 100% rename from Runtime/Common/CTweaks.cpp rename to Runtime/MP1/CTweaks.cpp diff --git a/Runtime/Common/CTweaks.hpp b/Runtime/MP1/CTweaks.hpp similarity index 94% rename from Runtime/Common/CTweaks.hpp rename to Runtime/MP1/CTweaks.hpp index e4bd0aada..e7c307424 100644 --- a/Runtime/Common/CTweaks.hpp +++ b/Runtime/MP1/CTweaks.hpp @@ -1,7 +1,6 @@ #ifndef __RETRO_CTWEAKS_HPP__ #define __RETRO_CTWEAKS_HPP__ -#include #include "CTweakParticle.hpp" namespace Retro diff --git a/Runtime/MP1/main.cpp b/Runtime/MP1/main.cpp index 6da1c3f9c..42744e6af 100644 --- a/Runtime/MP1/main.cpp +++ b/Runtime/MP1/main.cpp @@ -10,13 +10,38 @@ #include "CAi.hpp" #include "CGameState.hpp" #include "CInGameTweakManager.hpp" +#include "Particle/CElementGen.hpp" +#include "Character/CAnimData.hpp" +#include "Particle/CDecalManager.hpp" +#include "Graphics/CBooRenderer.hpp" +#include "Audio/CAudioSys.hpp" +#include "Input/CInputGenerator.hpp" +#include "GuiSys/CGuiSys.hpp" +#include "CIOWinManager.hpp" +#include "GuiSys/CSplashScreen.hpp" +#include "CMainFlow.hpp" +#include "GuiSys/CConsoleOutputWindow.hpp" +#include "Audio/CAudioStateWin.hpp" +#include "GameGlobalObjects.hpp" namespace Retro { +namespace Common +{ +CMemoryCardSys* g_MemoryCardSys = nullptr; +CResFactory* g_ResFactory = nullptr; +CSimplePool* g_SimplePool = nullptr; +CCharacterFactoryBuilder* g_CharFactoryBuilder = nullptr; +CAiFuncMap* g_AiFuncMap = nullptr; +CGameState* g_GameState = nullptr; +CInGameTweakManager* g_TweakManager = nullptr; +CBooRenderer* g_Renderer = nullptr; +} + namespace MP1 { -class CGameGlobalObjects : public Common::TOneStatic +class CGameGlobalObjects { Common::CMemoryCardSys m_memoryCardSys; Common::CResFactory m_resFactory; @@ -25,9 +50,56 @@ class CGameGlobalObjects : public Common::TOneStatic Common::CAiFuncMap m_aiFuncMap; Common::CGameState m_gameState; Common::CInGameTweakManager m_tweakManager; + std::unique_ptr m_renderer; + + void AddPaksAndFactories() + { + } + void LoadStringTable() + { + } + static Common::CBooRenderer* + AllocateRenderer(Common::IObjectStore& store, Common::COsContext& osctx, + Common::CMemorySys& memSys, Common::CResFactory& resFactory) + { + Common::g_Renderer = new Common::CBooRenderer(store, osctx, memSys, resFactory); + return Common::g_Renderer; + } public: + CGameGlobalObjects() + : m_simplePool(m_resFactory) + { + Common::g_MemoryCardSys = &m_memoryCardSys; + Common::g_ResFactory = &m_resFactory; + Common::g_SimplePool = &m_simplePool; + Common::g_CharFactoryBuilder = &m_charFactoryBuilder; + Common::g_AiFuncMap = &m_aiFuncMap; + Common::g_GameState = &m_gameState; + Common::g_TweakManager = &m_tweakManager; + } + void PostInitialize(Common::COsContext& osctx, Common::CMemorySys& memSys) + { + AddPaksAndFactories(); + LoadStringTable(); + m_renderer.reset(AllocateRenderer(m_simplePool, osctx, memSys, m_resFactory)); + } +}; + +class CGameArchitectureSupport +{ + Common::CAudioSys m_audioSys; + Common::CInputGenerator m_inputGenerator; + Common::CGuiSys m_guiSys; + Common::CIOWinManager m_ioWinManager; + Common::CSplashScreen m_splashScreen; + Common::CMainFlow m_mainFlow; + Common::CConsoleOutputWindow m_consoleWindow; + Common::CAudioStateWin m_audioStateWin; +public: + CGameArchitectureSupport(Common::COsContext& osctx) + : m_audioSys(0,0,0,0,0) { } }; @@ -44,13 +116,27 @@ public: OpenWindow("", 0, 0, 640, 480); } void InitializeSubsystems() + { + Common::CElementGen::Initialize(); + Common::CAnimData::InitializeCache(); + Common::CDecalManager::Initialize(); + } + void AddWorldPaks() + { + } + void FillInAssetIDs() { } int RsMain(int argc, const char* argv[]) { - CGameGlobalObjects* globalObjs = new CGameGlobalObjects; + Common::TOneStatic globalObjs; InitializeSubsystems(); globalObjs->PostInitialize(*this, m_memSys); + m_tweaks.RegisterTweaks(); + AddWorldPaks(); + Common::g_TweakManager->ReadFromMemoryCard("AudioTweaks"); + FillInAssetIDs(); + Common::TOneStatic archSupport(*this); while (m_run) {