Enable loading projects from command line

This commit is contained in:
Phillip Stephens 2017-01-21 22:28:55 -08:00
parent 3bb331e989
commit b3fd6d9eea
3 changed files with 43 additions and 14 deletions

View File

@ -28,7 +28,7 @@ namespace urde
void ViewManager::BuildTestPART(urde::IObjectStore& objStore) void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
{ {
m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend"); m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend");
#if 1 #if 0
SObjectTag samusCharSet = m_projManager.TagFromPath(_S("MP1/Shared/ANCS_77289A4A.*")); SObjectTag samusCharSet = m_projManager.TagFromPath(_S("MP1/Shared/ANCS_77289A4A.*"));
SObjectTag platModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_6FA561D0.blend")); SObjectTag platModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_6FA561D0.blend"));
SObjectTag bgModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_BC34D54C.blend")); SObjectTag bgModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_BC34D54C.blend"));
@ -36,11 +36,11 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
g_GameState->GetWorldTransitionManager()->EnableTransition(samusAnimRes, g_GameState->GetWorldTransitionManager()->EnableTransition(samusAnimRes,
platModel.id, zeus::CVector3f::skOne, platModel.id, zeus::CVector3f::skOne,
bgModel.id, zeus::CVector3f::skOne, true); bgModel.id, zeus::CVector3f::skOne, true);
#endif
SObjectTag areaTag = m_projManager.TagFromPath( SObjectTag areaTag = m_projManager.TagFromPath(
_S("MP1/Metroid1/!1IntroLevel1027/00 Exterior Docking Hangar/!area.blend")); _S("MP1/Metroid1/!1IntroLevel1027/00 Exterior Docking Hangar/!area.blend"));
auto areaData = m_projManager.resourceFactoryMP1().LoadResourceSync(areaTag); auto areaData = m_projManager.resourceFactoryMP1().LoadResourceSync(areaTag);
#endif
//m_modelTest = objStore.GetObj("gun_cmdl"); //m_modelTest = objStore.GetObj("gun_cmdl");
@ -73,7 +73,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
//m_newAudioPlayer.emplace(*m_voiceEngine, "Audio/frontend_1.rsf", 416480, 1973664); //m_newAudioPlayer.emplace(*m_voiceEngine, "Audio/frontend_1.rsf", 416480, 1973664);
//m_newAudioPlayer->StartMixing(); //m_newAudioPlayer->StartMixing();
//m_rootView->accessContentViews().clear(); m_rootView->accessContentViews().clear();
m_rootView->accessContentViews().push_back(m_particleView.get()); m_rootView->accessContentViews().push_back(m_particleView.get());
m_rootView->updateSize(); m_rootView->updateSize();
} }
@ -98,7 +98,7 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
if (m_vm.m_modelTest.IsLoaded()) if (m_vm.m_modelTest.IsLoaded())
{ {
#if 1 #if 0
CModelFlags flags; CModelFlags flags;
flags.m_extendedShaderIdx = 0; flags.m_extendedShaderIdx = 0;
@ -354,6 +354,16 @@ void ViewManager::init(boo::IApplication* app)
m_mainWindow->setWaitCursor(false); m_mainWindow->setWaitCursor(false);
m_voiceEngine = boo::NewAudioVoiceEngine(); m_voiceEngine = boo::NewAudioVoiceEngine();
m_amuseAllocWrapper.emplace(*m_voiceEngine); m_amuseAllocWrapper.emplace(*m_voiceEngine);
for (const auto& arg : app->getArgs())
{
if (hecl::SearchForProject(arg))
{
m_deferedProject = arg;
break;
}
}
/* /*
CGraphics::InitializeBoo(gf, m_mainWindow->getCommandQueue(), root->renderTex()); CGraphics::InitializeBoo(gf, m_mainWindow->getCommandQueue(), root->renderTex());
CModelShaders::Initialize(m_fileStoreManager, gf); CModelShaders::Initialize(m_fileStoreManager, gf);
@ -365,6 +375,12 @@ void ViewManager::init(boo::IApplication* app)
bool ViewManager::proc() bool ViewManager::proc()
{ {
if (!m_deferedProject.empty() && m_viewResources.fontCacheReady())
{
m_projManager.openProject(m_deferedProject);
m_deferedProject.clear();
}
boo::IGraphicsCommandQueue* gfxQ = m_mainWindow->getCommandQueue(); boo::IGraphicsCommandQueue* gfxQ = m_mainWindow->getCommandQueue();
if (m_rootView->isDestroyed()) if (m_rootView->isDestroyed())
return false; return false;
@ -412,7 +428,6 @@ bool ViewManager::proc()
m_mainWindow->waitForRetrace(); m_mainWindow->waitForRetrace();
CBooModel::ClearModelUniformCounters(); CBooModel::ClearModelUniformCounters();
CGraphics::TickRenderTimings(); CGraphics::TickRenderTimings();
return true; return true;
} }

View File

@ -124,6 +124,7 @@ class ViewManager : public specter::IViewManager
specter::SplitView::Axis m_deferSplitAxis; specter::SplitView::Axis m_deferSplitAxis;
int m_deferSplitThisSlot; int m_deferSplitThisSlot;
boo::SWindowCoord m_deferSplitCoord; boo::SWindowCoord m_deferSplitCoord;
hecl::SystemString m_deferedProject;
public: public:
ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr); ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr);

View File

@ -56,12 +56,31 @@ struct Application : boo::IApplicationCallback
{ {
m_running = false; m_running = false;
} }
void appFilesOpen(boo::IApplication*, const std::vector<boo::SystemString>&); void appFilesOpen(boo::IApplication*, const std::vector<boo::SystemString>& paths)
{
for (const auto& path : paths)
{
hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
if (projPath)
{
m_viewManager->projectManager().openProject(path);
break;
}
}
}
void initialize(boo::IApplication* /*app*/) void initialize(boo::IApplication* app)
{ {
zeus::detectCPU(); zeus::detectCPU();
hecl::VerbosityLevel = 1; for (const boo::SystemString& arg : app->getArgs())
{
if (arg.find(_S("--verbosity=")) == 0)
{
hecl::SystemUTF8View utf8Arg(arg.substr(arg.find_last_of('=') + 1));
hecl::VerbosityLevel = atoi(utf8Arg.c_str());
hecl::LogModule.report(logvisor::Info, "Set verbosity level to %i", hecl::VerbosityLevel);
}
}
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures(); const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
Log.report(logvisor::Info, "CPU Name: %s", cpuInf.cpuBrand); Log.report(logvisor::Info, "CPU Name: %s", cpuInf.cpuBrand);
@ -102,12 +121,6 @@ struct Application : boo::IApplicationCallback
} }
}; };
/* This is here to prevent a vtable being dumped into every translation unit */
void Application::appFilesOpen(boo::IApplication *, const std::vector<boo::SystemString> &)
{
}
} }
#if _WIN32 #if _WIN32