metaforce/DataSpec/SpecBase.hpp

72 lines
2.7 KiB
C++
Raw Normal View History

2015-07-01 23:50:39 +00:00
#ifndef SPECBASE_HPP
#define SPECBASE_HPP
#include <functional>
2015-07-04 06:03:07 +00:00
#include <HECL/Database.hpp>
#include <NOD/NOD.hpp>
2015-10-04 05:08:56 +00:00
#include "BlenderConnection.hpp"
2015-07-01 23:50:39 +00:00
namespace Retro
{
2015-07-07 03:22:44 +00:00
struct SpecBase : HECL::Database::IDataSpec
2015-07-01 23:50:39 +00:00
{
2015-10-04 05:08:56 +00:00
/* HECL Adaptors */
bool canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps);
2015-09-30 06:23:40 +00:00
void doExtract(const ExtractPassInfo& info, FProgress progress);
2015-07-01 23:50:39 +00:00
2015-09-30 06:23:40 +00:00
bool canCook(const HECL::ProjectPath& path);
void doCook(const HECL::ProjectPath& path, const HECL::ProjectPath& cookedPath);
2015-07-01 23:50:39 +00:00
2015-08-05 21:46:07 +00:00
bool canPackage(const PackagePassInfo& info);
void gatherDependencies(const PackagePassInfo& info,
2015-07-01 23:50:39 +00:00
std::unordered_set<HECL::ProjectPath>& implicitsOut);
2015-08-05 21:46:07 +00:00
void doPackage(const PackagePassInfo& info);
2015-07-01 23:50:39 +00:00
2015-10-04 05:08:56 +00:00
/* Extract handlers */
2015-07-14 01:07:15 +00:00
virtual bool checkStandaloneID(const char* id) const=0;
2015-08-05 21:46:07 +00:00
virtual bool checkFromStandaloneDisc(NOD::DiscBase& disc,
const HECL::SystemString& regstr,
2015-10-04 05:08:56 +00:00
const std::vector<HECL::SystemString>& args,
std::vector<ExtractReport>& reps)=0;
2015-08-05 21:46:07 +00:00
virtual bool checkFromTrilogyDisc(NOD::DiscBase& disc,
const HECL::SystemString& regstr,
2015-10-04 05:08:56 +00:00
const std::vector<HECL::SystemString>& args,
std::vector<ExtractReport>& reps)=0;
2015-08-05 21:46:07 +00:00
virtual bool extractFromDisc(NOD::DiscBase& disc, bool force,
2015-09-30 06:23:40 +00:00
FProgress progress)=0;
2015-07-01 23:50:39 +00:00
2015-10-04 05:08:56 +00:00
/* Basic path check (game directory matching) */
virtual bool checkPathPrefix(const HECL::ProjectPath& path)=0;
/* Pre-cook handlers */
2015-10-01 00:40:21 +00:00
virtual bool validateYAMLDNAType(FILE* fp) const=0;
2015-07-01 23:50:39 +00:00
2015-10-04 05:08:56 +00:00
/* Cook handlers */
using BlendStream = HECL::BlenderConnection::DataStream;
virtual void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0;
virtual void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0;
virtual void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0;
virtual void cookYAML(FILE* in, const HECL::ProjectPath& out) const=0;
2015-09-30 06:23:40 +00:00
const HECL::ProjectPath& getMasterShaderPath() const {return m_masterShader;}
2015-08-05 21:46:07 +00:00
SpecBase(HECL::Database::Project& project)
: m_project(project),
2015-10-01 00:40:21 +00:00
m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {}
2015-08-05 21:46:07 +00:00
protected:
HECL::Database::Project& m_project;
HECL::ProjectPath m_masterShader;
2015-07-16 01:57:34 +00:00
private:
std::unique_ptr<NOD::DiscBase> m_disc;
bool m_isWii;
bool m_standalone;
2015-07-01 23:50:39 +00:00
};
}
#endif // SPECBASE_HPP