Prep MP1::CMain for testing

This commit is contained in:
Jack Andersen 2016-04-15 10:42:40 -10:00
parent 86c21a77ac
commit abff623cf6
17 changed files with 300 additions and 256 deletions

View File

@ -18,10 +18,6 @@ if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
else()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
message(WARNING "GCC needs -fpermissive for nested type redeclarations; expect lotsa warnings!!")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions")
if(APPLE)

View File

@ -19,7 +19,7 @@ class PAKBridge
PAK m_pak;
public:
bool m_doExtract;
using Level = Level<UniqueID32>;
using Level = DataSpec::Level<UniqueID32>;
std::unordered_map<UniqueID32, Level> m_levelDeps;
hecl::SystemString m_levelString;

View File

@ -19,7 +19,7 @@ class PAKBridge
DNAMP1::PAK m_pak;
public:
bool m_doExtract;
using Level = Level<UniqueID32>;
using Level = DataSpec::Level<UniqueID32>;
std::unordered_map<UniqueID32, Level> m_levelDeps;
hecl::SystemString m_levelString;

View File

@ -19,7 +19,7 @@ class PAKBridge
PAK m_pak;
public:
bool m_doExtract;
using Level = Level<UniqueID64>;
using Level = DataSpec::Level<UniqueID64>;
std::unordered_map<UniqueID64, Level> m_levelDeps;
hecl::SystemString m_levelString;

View File

@ -98,13 +98,18 @@ bool ProjectManager::openProject(const hecl::SystemString& path)
hecl::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
FILE* fp = hecl::Fopen(urdeSpacesPath.getAbsolutePath().c_str(), _S("r"));
bool needsSave = false;
athena::io::YAMLDocReader r;
if (!fp)
{
needsSave = true;
goto makeDefault;
}
yaml_parser_set_input_file(r.getParser(), fp);
if (!r.ValidateClassType("UrdeSpacesState"))
{
needsSave = true;
fclose(fp);
goto makeDefault;
}
@ -114,33 +119,23 @@ bool ProjectManager::openProject(const hecl::SystemString& path)
yaml_parser_set_input_file(r.getParser(), fp);
if (!r.parse())
{
needsSave = true;
fclose(fp);
goto makeDefault;
}
fclose(fp);
m_vm.ProjectChanged(*m_proj);
m_vm.SetupEditorView(r);
m_factoryMP1.IndexMP1Resources(*m_proj);
m_vm.BuildTestPART(m_objStore);
{
hecl::SystemString windowTitle(m_proj->getProjectRootPath().getLastComponent());
windowTitle += _S(" - URDE");
m_vm.m_mainWindow->setTitle(windowTitle.c_str());
}
m_vm.DismissSplash();
m_vm.FadeInEditors();
m_vm.pushRecentProject(m_proj->getProjectRootPath().getAbsolutePath());
return true;
makeDefault:
m_vm.ProjectChanged(*m_proj);
m_vm.SetupEditorView();
saveProject();
m_factoryMP1.IndexMP1Resources(*m_proj);
m_mainMP1.emplace(m_factoryMP1, m_objStore);
m_vm.InitMP1(*m_mainMP1);
m_vm.BuildTestPART(m_objStore);
if (needsSave)
saveProject();
{
hecl::SystemString windowTitle(m_proj->getProjectRootPath().getLastComponent());
@ -149,6 +144,7 @@ makeDefault:
}
m_vm.DismissSplash();
m_vm.FadeInEditors();
m_vm.pushRecentProject(m_proj->getProjectRootPath().getAbsolutePath());
return true;
}

View File

@ -6,6 +6,7 @@
#include "ProjectResourceFactoryMP1.hpp"
#include "Runtime/CSimplePool.hpp"
#include "hecl/Runtime.hpp"
#include "MP1/MP1.hpp"
namespace urde
{
@ -32,6 +33,7 @@ class ProjectManager
hecl::ClientProcess m_clientProc;
ProjectResourceFactoryMP1 m_factoryMP1;
ProjectResourcePool m_objStore;
std::experimental::optional<MP1::CMain> m_mainMP1;
public:
static ProjectManager* g_SharedManager;
@ -47,9 +49,21 @@ public:
bool extractGame(const hecl::SystemString& path);
bool saveProject();
void asyncIdle() {m_factoryMP1.AsyncIdle();}
void mainUpdate()
{
if (m_mainMP1)
m_mainMP1->Proc();
}
void asyncIdle()
{
m_factoryMP1.AsyncIdle();
}
void shutdown()
{
if (m_mainMP1)
m_mainMP1->Shutdown();
m_clientProc.shutdown();
m_factoryMP1.Shutdown();
}

View File

@ -55,6 +55,11 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
m_rootView->updateSize();
}
void ViewManager::InitMP1(MP1::CMain& main)
{
main.Init(m_mainBooFactory, m_mainCommandQueue, m_renderTex, m_fileStoreManager, m_voiceEngine.get());
}
void ViewManager::ParticleView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
{
specter::View::resized(root, sub);
@ -272,23 +277,25 @@ void ViewManager::init(boo::IApplication* app)
float pixelFactor = 1.0;
boo::IGraphicsDataFactory* gf = m_mainWindow->getMainContextDataFactory();
m_viewResources.init(gf, &m_fontCache, &m_themeData, pixelFactor);
m_mainBooFactory = m_mainWindow->getMainContextDataFactory();
m_mainCommandQueue = m_mainWindow->getCommandQueue();
m_viewResources.init(m_mainBooFactory, &m_fontCache, &m_themeData, pixelFactor);
m_iconsToken = InitializeIcons(m_viewResources);
m_viewResources.prepFontCacheAsync(m_mainWindow.get());
specter::RootView* root = SetupRootView();
m_showSplash = true;
root->accessContentViews().push_back(SetupSplashView());
root->updateSize();
m_renderTex = root->renderTex();
m_mainWindow->setWaitCursor(false);
m_voiceEngine = boo::NewAudioVoiceEngine();
/*
CGraphics::InitializeBoo(gf, m_mainWindow->getCommandQueue(), root->renderTex());
CModelShaders::Initialize(m_fileStoreManager, gf);
CElementGen::Initialize();
CMoviePlayer::Initialize();
CLineRenderer::Initialize();
*/
}
bool ViewManager::proc()
@ -330,6 +337,8 @@ bool ViewManager::proc()
if (m_rootSpaceView && m_editorFrames <= 30)
m_rootSpaceView->setMultiplyColor(zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, m_editorFrames / 30.0));
m_projManager.mainUpdate();
m_rootView->draw(gfxQ);
CGraphics::EndScene();
gfxQ->execute();

View File

@ -33,7 +33,9 @@ class ViewManager : public specter::IViewManager
boo::GraphicsDataToken m_iconsToken;
specter::Translator m_translator;
std::unique_ptr<boo::IWindow> m_mainWindow;
CCharacterFactoryBuilder m_test;
boo::IGraphicsDataFactory* m_mainBooFactory = nullptr;
boo::IGraphicsCommandQueue* m_mainCommandQueue = nullptr;
boo::ITextureR* m_renderTex = nullptr;
std::unique_ptr<specter::RootView> m_rootView;
std::unique_ptr<SplashScreen> m_splash;
@ -96,6 +98,7 @@ class ViewManager : public specter::IViewManager
void FadeInEditors() {m_editorFrames = 0;}
void BuildTestPART(urde::IObjectStore& objStore);
void InitMP1(MP1::CMain& main);
Space* m_deferSplit = nullptr;
specter::SplitView::Axis m_deferSplitAxis;

View File

@ -17,7 +17,7 @@ else()
endif()
add_library(RuntimeCommon
CMemory.hpp CMemory.cpp
#CMemory.hpp CMemory.cpp
CMemoryCardSys.hpp
IAllocator.hpp IAllocator.cpp
CGameAllocator.hpp CGameAllocator.cpp

View File

@ -1,3 +1,5 @@
#if 0
#include "CMemory.hpp"
#include "CGameAllocator.hpp"
#include "CCallStack.hpp"
@ -71,7 +73,6 @@ IAllocator& CMemorySys::GetGameAllocator() {return g_gameAllocator;}
}
#if 0
void* operator new(std::size_t sz)
{
if (!urde::g_memoryAllocatorReady)

View File

@ -1,6 +1,8 @@
#ifndef __URDE_CMEMORY_HPP__
#define __URDE_CMEMORY_HPP__
#if 0
#include "IAllocator.hpp"
namespace urde
@ -30,7 +32,9 @@ public:
}
/* Custom new funcs */
//void* operator new(std::size_t sz, const char* funcName, const char* typeName);
//void* operator new[](std::size_t sz, const char* funcName, const char* typeName);
void* operator new(std::size_t sz, const char* funcName, const char* typeName);
void* operator new[](std::size_t sz, const char* funcName, const char* typeName);
#endif
#endif // __URDE_CMEMORY_HPP__

View File

@ -37,14 +37,7 @@ CInputStream* CResLoader::LoadNewResourcePartSync(const SObjectTag& tag, int off
void* buf = extBuf;
CPakFile* file = FindResourceForLoad(tag);
if (!buf)
{
CCallStack cs(AT_PRETTY_FUNCTION, "UnknownType");
buf = CMemory::Alloc(length,
IAllocator::EHint::Large,
IAllocator::EScope::Default,
IAllocator::EType::Primitive,
cs);
}
buf = new u8[length];
file->SyncSeekRead(buf, length, ESeekOrigin::Begin, x50_cachedResInfo->x4_offset + offset);
return new CMemoryInStream((atUint8*)buf, length, !extBuf);
}
@ -52,12 +45,7 @@ CInputStream* CResLoader::LoadNewResourcePartSync(const SObjectTag& tag, int off
void CResLoader::LoadMemResourceSync(const SObjectTag& tag, void** bufOut, int* sizeOut)
{
CPakFile* file = FindResourceForLoad(tag);
CCallStack cs(AT_PRETTY_FUNCTION, "UnknownType");
void* buf = CMemory::Alloc(x50_cachedResInfo->x8_size,
IAllocator::EHint::Large,
IAllocator::EScope::Default,
IAllocator::EType::Primitive,
cs);
void* buf = new u8[x50_cachedResInfo->x8_size];
file->SyncSeekRead(buf, x50_cachedResInfo->x8_size, ESeekOrigin::Begin,
x50_cachedResInfo->x4_offset);
*bufOut = buf;
@ -82,14 +70,7 @@ CInputStream* CResLoader::LoadNewResourceSync(const SObjectTag& tag, void* extBu
CPakFile* file = FindResourceForLoad(tag);
size_t resSz = ROUND_UP_32(x50_cachedResInfo->x8_size);
if (!buf)
{
CCallStack cs(AT_PRETTY_FUNCTION, "UnknownType");
buf = CMemory::Alloc(resSz,
IAllocator::EHint::Large,
IAllocator::EScope::Default,
IAllocator::EType::Primitive,
cs);
}
buf = new u8[resSz];
file->SyncSeekRead(buf, resSz, ESeekOrigin::Begin, x50_cachedResInfo->x4_offset);
CInputStream* newStrm = new CMemoryInStream((atUint8*)buf, resSz, !extBuf);
if (x50_cachedResInfo->xb_compressed)

View File

@ -5,12 +5,12 @@ namespace urde
{
class IObjectStore;
class CMemorySys;
class CResFactory;
class IFactory;
class CBooRenderer
{
public:
CBooRenderer(IObjectStore&, CMemorySys&, CResFactory&)
CBooRenderer(IObjectStore&, IFactory&)
{
}
};

View File

@ -1,44 +1,5 @@
#if _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <objbase.h>
#endif
#include <clocale>
#include <memory>
#include <boo/boo.hpp>
#include <boo/graphicsdev/GL.hpp>
#include "CBasics.hpp"
#include "CMemoryCardSys.hpp"
#include "CResFactory.hpp"
#include "CSimplePool.hpp"
#include "Character/CAssetFactory.hpp"
#include "CAi.hpp"
#include "CGameState.hpp"
#include "CInGameTweakManager.hpp"
#include "Particle/CElementGen.hpp"
#include "Character/CAnimData.hpp"
#include "Particle/CDecalManager.hpp"
#include "Particle/CGenDescription.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 "GuiSys/CTextParser.hpp"
#include "Audio/CAudioStateWin.hpp"
#include "GameGlobalObjects.hpp"
#include "CArchitectureQueue.hpp"
#include "MP1.hpp"
#include "CTimeProvider.hpp"
#include "GuiSys/CTextExecuteBuffer.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp"
#include "Graphics/CModelShaders.hpp"
namespace urde
{
@ -47,143 +8,13 @@ namespace MP1
{
class CMain* g_main = nullptr;
class CGameGlobalObjects
{
CMemoryCardSys x0_memoryCardSys;
CResFactory x20_resFactory;
CSimplePool x114_simplePool;
CCharacterFactoryBuilder x14c_charFactoryBuilder;
CAiFuncMap x188_aiFuncMap;
CGameState x1a8_gameState;
CInGameTweakManager x1c0_tweakManager;
std::unique_ptr<CBooRenderer> m_renderer;
void AddPaksAndFactories()
{
}
void LoadStringTable()
{
}
static CBooRenderer*
AllocateRenderer(IObjectStore& store,
CMemorySys& memSys, CResFactory& resFactory)
{
g_Renderer = new CBooRenderer(store, memSys, resFactory);
return g_Renderer;
}
public:
CGameGlobalObjects()
: x114_simplePool(x20_resFactory)
{
g_MemoryCardSys = &x0_memoryCardSys;
g_ResFactory = &x20_resFactory;
g_SimplePool = &x114_simplePool;
g_CharFactoryBuilder = &x14c_charFactoryBuilder;
g_AiFuncMap = &x188_aiFuncMap;
g_GameState = &x1a8_gameState;
g_TweakManager = &x1c0_tweakManager;
}
void PostInitialize(CMemorySys& memSys)
{
AddPaksAndFactories();
LoadStringTable();
m_renderer.reset(AllocateRenderer(x114_simplePool, memSys, x20_resFactory));
}
};
class CGameArchitectureSupport : public boo::IWindowCallback
{
CArchitectureQueue m_archQueue;
CAudioSys m_audioSys;
CInputGenerator m_inputGenerator;
CGuiSys m_guiSys;
CIOWinManager m_ioWinManager;
CSplashScreen m_splashScreen;
CMainFlow m_mainFlow;
CConsoleOutputWindow m_consoleWindow;
CAudioStateWin m_audioStateWin;
boo::SWindowRect m_windowRect;
bool m_rectIsDirty;
void mouseDown(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
{ m_inputGenerator.mouseDown(coord, button, mods); }
void mouseUp(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
{ m_inputGenerator.mouseUp(coord, button, mods); }
void mouseMove(const boo::SWindowCoord &coord)
{ m_inputGenerator.mouseMove(coord); }
void scroll(const boo::SWindowCoord &coord, const boo::SScrollDelta &scroll)
{ m_inputGenerator.scroll(coord, scroll); }
void charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat)
{ m_inputGenerator.charKeyDown(charCode, mods, isRepeat); }
void charKeyUp(unsigned long charCode, boo::EModifierKey mods)
{ m_inputGenerator.charKeyUp(charCode, mods); }
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat)
{ m_inputGenerator.specialKeyDown(key, mods, isRepeat); }
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods)
{ m_inputGenerator.specialKeyUp(key, mods); }
void modKeyDown(boo::EModifierKey mod, bool isRepeat)
{ m_inputGenerator.modKeyDown(mod, isRepeat);}
void modKeyUp(boo::EModifierKey mod)
{ m_inputGenerator.modKeyUp(mod); }
void destroyed() { m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport))); }
void resized(const boo::SWindowRect &rect)
{
m_windowRect = rect;
m_rectIsDirty = true;
}
public:
CGameArchitectureSupport()
: m_audioSys(0,0,0,0,0),
m_inputGenerator(0.0f /*g_tweakPlayer->GetLeftLogicalThreshold()*/,
0.0f /*g_tweakPlayer->GetRightLogicalThreshold()*/),
m_guiSys(*g_ResFactory, *g_SimplePool, CGuiSys::EUsageMode::Zero)
{
g_GuiSys = &m_guiSys;
m_inputGenerator.startScanning();
}
bool Update()
{
bool finished = false;
m_inputGenerator.Update(1.0 / 60.0, m_archQueue);
while(m_archQueue)
{
CArchitectureMessage msg = m_archQueue.Pop();
if (msg.GetTarget() == EArchMsgTarget::ArchitectureSupport)
{
if (msg.GetType() == EArchMsgType::ApplicationExit)
finished = true;
}
if (msg.GetTarget() == EArchMsgTarget::Game && msg.GetType() == EArchMsgType::UserInput)
{
const CArchMsgParmUserInput* input = msg.GetParm<CArchMsgParmUserInput>();
if (input->x4_parm.DStart())
m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport)));
}
}
return finished;
}
bool isRectDirty() { return m_rectIsDirty; }
const boo::SWindowRect& getWindowRect()
{
m_rectIsDirty = false;
return m_windowRect;
}
};
CMain::CMain()
: x6c_memSys(CMemorySys::GetGameAllocator())
CMain::CMain(IFactory& resFactory, CSimplePool& resStore)
: m_globalObjects(resFactory, resStore)
{
g_main = this;
xe4_gameplayResult = EGameplayResult::Playing;
}
void CMain::RegisterResourceTweaks()
{
}
@ -191,25 +22,20 @@ void CMain::ResetGameState()
{
}
void CMain::InitializeSubsystems()
void CMain::InitializeSubsystems(boo::IGraphicsDataFactory* factory,
boo::IGraphicsCommandQueue* cc,
boo::ITextureR* renderTex,
const hecl::Runtime::FileStoreManager& storeMgr,
boo::IAudioVoiceEngine* voiceEngine)
{
CGraphics::InitializeBoo(factory, cc, renderTex);
CModelShaders::Initialize(storeMgr, factory);
CMoviePlayer::Initialize();
CLineRenderer::Initialize();
CElementGen::Initialize();
CAnimData::InitializeCache();
CDecalManager::Initialize();
}
void CMain::AddWorldPaks()
{
#if 0
u32 i = 0;
while (i <= 255)
{
std::string pakName = CBasics::Stringize("%s%i.pak", g_tweakGame->GetWorldPrefix().c_str(), i);
if (CDvdFile::FileExists(pakName.c_str()))
g_ResFactory->GetLoader().AddPakFile(pakName, false);
i++;
}
#endif
}
void CMain::FillInAssetIDs()
{
@ -218,6 +44,31 @@ void CMain::LoadAudio()
{
}
void CMain::Init(boo::IGraphicsDataFactory* factory,
boo::IGraphicsCommandQueue* cc,
boo::ITextureR* renderTex,
const hecl::Runtime::FileStoreManager& storeMgr,
boo::IAudioVoiceEngine* voiceEngine)
{
InitializeSubsystems(factory, cc, renderTex, storeMgr, voiceEngine);
m_globalObjects.PostInitialize();
x70_tweaks.RegisterTweaks();
//g_TweakManager->ReadFromMemoryCard("AudioTweaks");
FillInAssetIDs();
}
bool CMain::Proc()
{
xe8_b24_finished = m_archSupport.Update();
return xe8_b24_finished;
}
void CMain::Shutdown()
{
}
#if MP1_USE_BOO
int CMain::appMain(boo::IApplication* app)
{
zeus::detectCPU();
@ -225,7 +76,7 @@ int CMain::appMain(boo::IApplication* app)
mainWindow->showWindow();
TOneStatic<CGameGlobalObjects> globalObjs;
InitializeSubsystems();
globalObjs->PostInitialize(x6c_memSys);
globalObjs->PostInitialize();
x70_tweaks.RegisterTweaks();
AddWorldPaks();
g_TweakManager->ReadFromMemoryCard("AudioTweaks");
@ -266,5 +117,7 @@ int CMain::appMain(boo::IApplication* app)
return 0;
}
#endif
}
}

View File

@ -1,15 +1,51 @@
#ifndef __URDE_MP1_HPP__
#define __URDE_MP1_HPP__
#define MP1_USE_BOO 0
#include <boo/boo.hpp>
#include <boo/graphicsdev/GL.hpp>
#include <boo/audiodev/IAudioVoiceEngine.hpp>
#include "CMemory.hpp"
#include "CTweaks.hpp"
#include "CPlayMovie.hpp"
#include "IOStreams.hpp"
#include "CBasics.hpp"
#include "CMemoryCardSys.hpp"
#include "CResFactory.hpp"
#include "CSimplePool.hpp"
#include "Character/CAssetFactory.hpp"
#include "CAi.hpp"
#include "CGameState.hpp"
#include "CInGameTweakManager.hpp"
#include "Particle/CElementGen.hpp"
#include "Character/CAnimData.hpp"
#include "Particle/CDecalManager.hpp"
#include "Particle/CGenDescription.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 "GuiSys/CTextParser.hpp"
#include "Audio/CAudioStateWin.hpp"
#include "GameGlobalObjects.hpp"
#include "CArchitectureQueue.hpp"
#include "MP1.hpp"
#include "CTimeProvider.hpp"
#include "GuiSys/CTextExecuteBuffer.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp"
namespace urde
{
class CStopwatch;
class IFactory;
class IObjectStore;
namespace MP1
{
@ -22,12 +58,143 @@ enum class EGameplayResult
Playing
};
class WindowCallback : public boo::IWindowCallback
class CGameGlobalObjects
{
CMemoryCardSys x0_memoryCardSys;
IFactory& x20_resFactory;
CSimplePool& x114_simplePool;
CCharacterFactoryBuilder x14c_charFactoryBuilder;
CAiFuncMap x188_aiFuncMap;
CGameState x1a8_gameState;
CInGameTweakManager x1c0_tweakManager;
std::unique_ptr<CBooRenderer> m_renderer;
void LoadStringTable()
{
}
static CBooRenderer*
AllocateRenderer(IObjectStore& store, IFactory& resFactory)
{
g_Renderer = new CBooRenderer(store, resFactory);
return g_Renderer;
}
public:
CGameGlobalObjects(IFactory& resFactory, CSimplePool& objStore)
: x20_resFactory(resFactory), x114_simplePool(objStore)
{
g_MemoryCardSys = &x0_memoryCardSys;
g_ResFactory = &x20_resFactory;
g_SimplePool = &x114_simplePool;
g_CharFactoryBuilder = &x14c_charFactoryBuilder;
g_AiFuncMap = &x188_aiFuncMap;
g_GameState = &x1a8_gameState;
g_TweakManager = &x1c0_tweakManager;
}
void PostInitialize()
{
LoadStringTable();
m_renderer.reset(AllocateRenderer(x114_simplePool, x20_resFactory));
}
};
class CMain : public boo::IApplicationCallback
#if MP1_USE_BOO
class CGameArchitectureSupport : public boo::IWindowCallback
#else
class CGameArchitectureSupport
#endif
{
CArchitectureQueue m_archQueue;
CAudioSys m_audioSys;
CInputGenerator m_inputGenerator;
CGuiSys m_guiSys;
CIOWinManager m_ioWinManager;
CSplashScreen m_splashScreen;
CMainFlow m_mainFlow;
CConsoleOutputWindow m_consoleWindow;
CAudioStateWin m_audioStateWin;
boo::SWindowRect m_windowRect;
bool m_rectIsDirty;
void mouseDown(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
{ m_inputGenerator.mouseDown(coord, button, mods); }
void mouseUp(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
{ m_inputGenerator.mouseUp(coord, button, mods); }
void mouseMove(const boo::SWindowCoord &coord)
{ m_inputGenerator.mouseMove(coord); }
void scroll(const boo::SWindowCoord &coord, const boo::SScrollDelta &scroll)
{ m_inputGenerator.scroll(coord, scroll); }
void charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat)
{ m_inputGenerator.charKeyDown(charCode, mods, isRepeat); }
void charKeyUp(unsigned long charCode, boo::EModifierKey mods)
{ m_inputGenerator.charKeyUp(charCode, mods); }
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat)
{ m_inputGenerator.specialKeyDown(key, mods, isRepeat); }
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods)
{ m_inputGenerator.specialKeyUp(key, mods); }
void modKeyDown(boo::EModifierKey mod, bool isRepeat)
{ m_inputGenerator.modKeyDown(mod, isRepeat);}
void modKeyUp(boo::EModifierKey mod)
{ m_inputGenerator.modKeyUp(mod); }
void destroyed() { m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport))); }
void resized(const boo::SWindowRect &rect)
{
m_windowRect = rect;
m_rectIsDirty = true;
}
public:
CGameArchitectureSupport()
: m_audioSys(0,0,0,0,0),
m_inputGenerator(0.0f /*g_tweakPlayer->GetLeftLogicalThreshold()*/,
0.0f /*g_tweakPlayer->GetRightLogicalThreshold()*/),
m_guiSys(*g_ResFactory, *g_SimplePool, CGuiSys::EUsageMode::Zero)
{
g_GuiSys = &m_guiSys;
m_inputGenerator.startScanning();
}
bool Update()
{
bool finished = false;
m_inputGenerator.Update(1.0 / 60.0, m_archQueue);
while(m_archQueue)
{
CArchitectureMessage msg = m_archQueue.Pop();
if (msg.GetTarget() == EArchMsgTarget::ArchitectureSupport)
{
if (msg.GetType() == EArchMsgType::ApplicationExit)
finished = true;
}
if (msg.GetTarget() == EArchMsgTarget::Game && msg.GetType() == EArchMsgType::UserInput)
{
const CArchMsgParmUserInput* input = msg.GetParm<CArchMsgParmUserInput>();
if (input->x4_parm.DStart())
m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport)));
}
}
return finished;
}
bool isRectDirty() { return m_rectIsDirty; }
const boo::SWindowRect& getWindowRect()
{
m_rectIsDirty = false;
return m_windowRect;
}
};
#if MP1_USE_BOO
class CMain : public boo::IApplicationCallback
#else
class CMain
#endif
{
#if MP1_USE_BOO
boo::IWindow* mainWindow;
int appMain(boo::IApplication* app);
void appQuitting(boo::IApplication*)
@ -39,20 +206,39 @@ class CMain : public boo::IApplicationCallback
fprintf(stderr, "%s ", path.c_str());
fprintf(stderr, "\n");
}
#endif
CMemorySys x6c_memSys;
//CMemorySys x6c_memSys;
CTweaks x70_tweaks;
EGameplayResult xe4_gameplayResult;
bool xe8_b24_finished = false;
/* urde addition: these are simply initialized along with everything else */
CGameGlobalObjects m_globalObjects;
CGameArchitectureSupport m_archSupport;
void InitializeSubsystems(boo::IGraphicsDataFactory* factory,
boo::IGraphicsCommandQueue* cc,
boo::ITextureR* renderTex,
const hecl::Runtime::FileStoreManager& storeMgr,
boo::IAudioVoiceEngine* voiceEngine);
public:
CMain();
CMain(IFactory& resFactory, CSimplePool& resStore);
void RegisterResourceTweaks();
void ResetGameState();
void StreamNewGameState(CInputStream&);
void CheckTweakManagerDebugOptions() {}
void AddWorldPaks();
int RsMain(int argc, const boo::SystemChar* argv[]);
//int RsMain(int argc, const boo::SystemChar* argv[]);
void Init(boo::IGraphicsDataFactory* factory,
boo::IGraphicsCommandQueue* cc,
boo::ITextureR* renderTex,
const hecl::Runtime::FileStoreManager& storeMgr,
boo::IAudioVoiceEngine* voiceEngine);
bool Proc();
void Shutdown();
bool CheckReset();
bool CheckTerminate() {return false;}
void DrawDebugMetrics(double, CStopwatch&) {}
@ -60,7 +246,6 @@ public:
void FillInAssetIDs();
void LoadAudio();
void ShutdownSubsystems();
void InitializeSubsystems();
EGameplayResult GetGameplayResult() const {return xe4_gameplayResult;}
void SetGameplayResult(EGameplayResult wl) {xe4_gameplayResult = wl;}
};

View File

@ -8,6 +8,8 @@ s32 CDecalManager::m_FreeIndex = 63;
float CDecalManager::m_DeltaTimeSinceLastDecalCreation = 0.f;
s32 CDecalManager::m_LastDecalCreatedIndex = -1;
ResId CDecalManager::m_LastDecalCreatedAssetId = -1;
rstl::reserved_vector<CDecalManager::SDecal, 64> CDecalManager::m_DecalPool;
rstl::reserved_vector<s32, 64> CDecalManager::m_ActiveIndexList;
void CDecalManager::Initialize()
{

2
hecl

@ -1 +1 @@
Subproject commit 3a48b3b05afacbf61cb5801fa1aa96567aa42a35
Subproject commit 7393a88a0d2e79586ae9ae097c9c8fb2b68105da