2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 21:07:42 +00:00

Merge branch 'master' into urde-tags

This commit is contained in:
Jack Andersen
2016-03-04 14:03:41 -10:00
337 changed files with 2998 additions and 3016 deletions

View File

@@ -2,14 +2,14 @@
#include "ViewManager.hpp"
#include "../DataSpecRegistry.hpp"
namespace URDE
namespace urde
{
static LogVisor::LogModule Log("URDE::ProjectManager");
static logvisor::Module Log("URDE::ProjectManager");
void ProjectManager::IndexMP1Resources()
{
const std::vector<HECL::Database::Project::ProjectDataSpec>& specs = m_proj->getDataSpecs();
for (const HECL::Database::Project::ProjectDataSpec& spec : m_proj->getDataSpecs())
const std::vector<hecl::Database::Project::ProjectDataSpec>& specs = m_proj->getDataSpecs();
for (const hecl::Database::Project::ProjectDataSpec& spec : m_proj->getDataSpecs())
{
if (&spec.spec == &DataSpec::SpecEntMP1)
{
@@ -30,17 +30,17 @@ ProjectManager::ProjectManager(ViewManager &vm)
}
}
bool ProjectManager::newProject(const HECL::SystemString& path)
bool ProjectManager::newProject(const hecl::SystemString& path)
{
HECL::ProjectRootPath projPath = HECL::SearchForProject(path);
hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
if (projPath)
{
Log.report(LogVisor::Warning, _S("project already exists at '%s'"), path.c_str());
Log.report(logvisor::Warning, _S("project already exists at '%s'"), path.c_str());
return false;
}
HECL::MakeDir(path.c_str());
m_proj.reset(new HECL::Database::Project(path));
hecl::MakeDir(path.c_str());
m_proj.reset(new hecl::Database::Project(path));
if (!*m_proj)
{
m_proj.reset();
@@ -56,16 +56,16 @@ bool ProjectManager::newProject(const HECL::SystemString& path)
return true;
}
bool ProjectManager::openProject(const HECL::SystemString& path)
bool ProjectManager::openProject(const hecl::SystemString& path)
{
HECL::ProjectRootPath projPath = HECL::SearchForProject(path);
hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
if (!projPath)
{
Log.report(LogVisor::Warning, _S("project doesn't exist at '%s'"), path.c_str());
Log.report(logvisor::Warning, _S("project doesn't exist at '%s'"), path.c_str());
return false;
}
m_proj.reset(new HECL::Database::Project(projPath));
m_proj.reset(new hecl::Database::Project(projPath));
if (!*m_proj)
{
m_proj.reset();
@@ -73,18 +73,18 @@ bool ProjectManager::openProject(const HECL::SystemString& path)
}
#ifdef URDE_BINARY_CONFIGS
HECL::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.bin"));
Athena::io::FileReader r(urdeSpacesPath.getAbsolutePath(), 32 * 1024, false);
hecl::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.bin"));
athena::io::FileReader r(urdeSpacesPath.getAbsolutePath(), 32 * 1024, false);
if (r.hasError())
goto makeDefault;
m_vm.SetupEditorView(r);
#else
HECL::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
FILE* fp = HECL::Fopen(urdeSpacesPath.getAbsolutePath().c_str(), _S("r"));
hecl::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
FILE* fp = hecl::Fopen(urdeSpacesPath.getAbsolutePath().c_str(), _S("r"));
Athena::io::YAMLDocReader r;
athena::io::YAMLDocReader r;
if (!fp)
goto makeDefault;
@@ -123,7 +123,7 @@ makeDefault:
m_vm.SetupEditorView();
saveProject();
HECL::SystemString windowTitle(m_proj->getProjectRootPath().getLastComponent());
hecl::SystemString windowTitle(m_proj->getProjectRootPath().getLastComponent());
windowTitle += _S(" - URDE");
m_vm.m_mainWindow->setTitle(windowTitle.c_str());
m_vm.DismissSplash();
@@ -131,7 +131,7 @@ makeDefault:
return true;
}
bool ProjectManager::extractGame(const HECL::SystemString& path)
bool ProjectManager::extractGame(const hecl::SystemString& path)
{
return false;
}
@@ -142,23 +142,23 @@ bool ProjectManager::saveProject()
return false;
#ifdef URDE_BINARY_CONFIGS
HECL::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.bin"));
Athena::io::FileWriter w(oldSpacesPath.getAbsolutePath(), true, false);
hecl::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.bin"));
athena::io::FileWriter w(oldSpacesPath.getAbsolutePath(), true, false);
if (w.hasError())
return false;
m_vm.SaveEditorView(w);
w.close();
HECL::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.bin"));
hecl::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.bin"));
#else
HECL::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.yaml"));
FILE* fp = HECL::Fopen(oldSpacesPath.getAbsolutePath().c_str(), _S("w"));
hecl::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.yaml"));
FILE* fp = hecl::Fopen(oldSpacesPath.getAbsolutePath().c_str(), _S("w"));
if (!fp)
return false;
Athena::io::YAMLDocWriter w("UrdeSpacesState");
athena::io::YAMLDocWriter w("UrdeSpacesState");
yaml_emitter_set_output_file(w.getEmitter(), fp);
m_vm.SaveEditorView(w);
if (!w.finish())
@@ -168,12 +168,12 @@ bool ProjectManager::saveProject()
}
fclose(fp);
HECL::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
hecl::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
#endif
HECL::Unlink(newSpacesPath.getAbsolutePath().c_str());
HECL::Rename(oldSpacesPath.getAbsolutePath().c_str(),
hecl::Unlink(newSpacesPath.getAbsolutePath().c_str());
hecl::Rename(oldSpacesPath.getAbsolutePath().c_str(),
newSpacesPath.getAbsolutePath().c_str());
m_vm.pushRecentProject(m_proj->getProjectRootPath().getAbsolutePath());