metaforce/DataSpec/SpecBase.hpp

79 lines
3.1 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, bool fast, FCookProgress progress);
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;
2015-10-07 01:17:17 +00:00
using Mesh = BlendStream::Mesh;
2015-10-23 00:45:26 +00:00
using Actor = BlendStream::Actor;
2015-10-04 05:08:56 +00:00
virtual void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
virtual void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
virtual void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
virtual void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin, FCookProgress progress) const=0;
2015-10-04 05:08:56 +00:00
2015-09-30 06:23:40 +00:00
const HECL::ProjectPath& getMasterShaderPath() const {return m_masterShader;}
2015-08-05 21:46:07 +00:00
2015-11-10 02:07:15 +00:00
/* Support functions for resolving paths from IDs */
virtual HECL::ProjectPath getWorking(class UniqueID32&) {return HECL::ProjectPath();}
virtual HECL::ProjectPath getWorking(class UniqueID64&) {return HECL::ProjectPath();}
/* Project accessor */
HECL::Database::Project& getProject() {return m_project;}
SpecBase(HECL::Database::Project& project);
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