mirror of https://github.com/AxioDL/metaforce.git
Add binary config option to CMake
This commit is contained in:
parent
769a20d9dc
commit
0cd46f7b0a
|
@ -5,6 +5,16 @@ atdna(atdna_Space.cpp Space.hpp)
|
||||||
atdna(atdna_ResourceOutliner.cpp ResourceOutliner.hpp)
|
atdna(atdna_ResourceOutliner.cpp ResourceOutliner.hpp)
|
||||||
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||||
|
option(RUDE_BINARY_CONFIGS
|
||||||
|
"Use binary Athena formats for serializing save data structures, rather than YAML"
|
||||||
|
YES)
|
||||||
|
else()
|
||||||
|
option(RUDE_BINARY_CONFIGS
|
||||||
|
"Use binary Athena formats for serializing save data structures, rather than YAML"
|
||||||
|
NO)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(RUDE_BINARY_CONFIGS)
|
||||||
add_definitions("-DRUDE_BINARY_CONFIGS=1")
|
add_definitions("-DRUDE_BINARY_CONFIGS=1")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -122,12 +122,15 @@ bool ProjectManager::saveProject()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef RUDE_BINARY_CONFIGS
|
#ifdef RUDE_BINARY_CONFIGS
|
||||||
HECL::ProjectPath rudeSpacesPath(*m_proj, _S(".hecl/rude_spaces.bin"));
|
HECL::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~rude_spaces.bin"));
|
||||||
Athena::io::FileReader r(rudeSpacesPath.getAbsolutePath(), 32 * 1024, false);
|
Athena::io::FileWriter w(oldSpacesPath.getAbsolutePath(), true, false);
|
||||||
if (r.hasError())
|
if (w.hasError())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_vm.SetupEditorView(r);
|
m_vm.SaveEditorView(w);
|
||||||
|
w.close();
|
||||||
|
|
||||||
|
HECL::ProjectPath newSpacesPath(*m_proj, _S(".hecl/rude_spaces.bin"));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
HECL::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~rude_spaces.yaml"));
|
HECL::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~rude_spaces.yaml"));
|
||||||
|
@ -155,12 +158,12 @@ bool ProjectManager::saveProject()
|
||||||
|
|
||||||
HECL::ProjectPath newSpacesPath(*m_proj, _S(".hecl/rude_spaces.yaml"));
|
HECL::ProjectPath newSpacesPath(*m_proj, _S(".hecl/rude_spaces.yaml"));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
HECL::Unlink(newSpacesPath.getAbsolutePath().c_str());
|
HECL::Unlink(newSpacesPath.getAbsolutePath().c_str());
|
||||||
HECL::Rename(oldSpacesPath.getAbsolutePath().c_str(),
|
HECL::Rename(oldSpacesPath.getAbsolutePath().c_str(),
|
||||||
newSpacesPath.getAbsolutePath().c_str());
|
newSpacesPath.getAbsolutePath().c_str());
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue