2015-07-01 23:50:39 +00:00
|
|
|
#ifndef SPECBASE_HPP
|
|
|
|
#define SPECBASE_HPP
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
2016-03-04 23:04:53 +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
|
|
|
|
2016-02-13 09:02:47 +00:00
|
|
|
namespace DataSpec
|
2015-07-01 23:50:39 +00:00
|
|
|
{
|
|
|
|
|
2016-03-04 23:04:53 +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 */
|
2016-07-07 04:23:36 +00:00
|
|
|
void setThreadProject();
|
2015-10-04 05:08:56 +00:00
|
|
|
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
|
|
|
|
2016-03-28 22:39:56 +00:00
|
|
|
bool canCook(const hecl::ProjectPath& path, hecl::BlenderToken& btok);
|
2016-03-27 20:43:04 +00:00
|
|
|
const hecl::Database::DataSpecEntry* overrideDataSpec(const hecl::ProjectPath& path,
|
2016-03-28 22:39:56 +00:00
|
|
|
const hecl::Database::DataSpecEntry* oldEntry,
|
|
|
|
hecl::BlenderToken& btok);
|
2016-03-27 20:43:04 +00:00
|
|
|
void doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath,
|
2016-03-28 22:39:56 +00:00
|
|
|
bool fast, hecl::BlenderToken& btok, 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,
|
2016-03-04 23:04:53 +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;
|
2016-03-04 23:04:53 +00:00
|
|
|
virtual bool checkFromStandaloneDisc(nod::DiscBase& disc,
|
|
|
|
const hecl::SystemString& regstr,
|
|
|
|
const std::vector<hecl::SystemString>& args,
|
2015-10-04 05:08:56 +00:00
|
|
|
std::vector<ExtractReport>& reps)=0;
|
2016-03-04 23:04:53 +00:00
|
|
|
virtual bool checkFromTrilogyDisc(nod::DiscBase& disc,
|
|
|
|
const hecl::SystemString& regstr,
|
|
|
|
const std::vector<hecl::SystemString>& args,
|
2015-10-04 05:08:56 +00:00
|
|
|
std::vector<ExtractReport>& reps)=0;
|
2016-03-04 23:04:53 +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
|
|
|
|
2016-03-27 20:43:04 +00:00
|
|
|
/* Even if PC spec is being cooked, this will return the vanilla GCN spec */
|
|
|
|
virtual const hecl::Database::DataSpecEntry* getOriginalSpec() const=0;
|
|
|
|
|
2015-10-04 05:08:56 +00:00
|
|
|
/* Basic path check (game directory matching) */
|
2016-03-04 23:04:53 +00:00
|
|
|
virtual bool checkPathPrefix(const hecl::ProjectPath& path)=0;
|
2015-10-04 05:08:56 +00:00
|
|
|
|
|
|
|
/* 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 */
|
2016-03-04 23:04:53 +00:00
|
|
|
using BlendStream = hecl::BlenderConnection::DataStream;
|
2015-10-07 01:17:17 +00:00
|
|
|
using Mesh = BlendStream::Mesh;
|
2016-08-10 21:54:53 +00:00
|
|
|
using ColMesh = BlendStream::ColMesh;
|
2016-08-11 19:52:22 +00:00
|
|
|
using Light = BlendStream::Light;
|
2015-10-23 00:45:26 +00:00
|
|
|
using Actor = BlendStream::Actor;
|
2015-10-04 05:08:56 +00:00
|
|
|
|
2016-03-27 20:43:04 +00:00
|
|
|
virtual void cookMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
2016-04-10 04:49:02 +00:00
|
|
|
BlendStream& ds, bool fast, hecl::BlenderToken& btok,
|
|
|
|
FCookProgress progress)=0;
|
2016-03-27 20:43:04 +00:00
|
|
|
virtual void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
2016-04-10 04:49:02 +00:00
|
|
|
BlendStream& ds, bool fast, hecl::BlenderToken& btok,
|
|
|
|
FCookProgress progress)=0;
|
2016-03-27 20:43:04 +00:00
|
|
|
virtual void cookArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
2016-04-10 04:49:02 +00:00
|
|
|
BlendStream& ds, bool fast, hecl::BlenderToken& btok,
|
|
|
|
FCookProgress progress)=0;
|
2016-03-27 20:43:04 +00:00
|
|
|
virtual void cookYAML(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
2016-04-10 04:49:02 +00:00
|
|
|
FILE* fin, FCookProgress progress)=0;
|
2015-10-04 05:08:56 +00:00
|
|
|
|
2016-03-04 23:04:53 +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 */
|
2016-03-04 23:04:53 +00:00
|
|
|
virtual hecl::ProjectPath getWorking(class UniqueID32&) {return hecl::ProjectPath();}
|
|
|
|
virtual hecl::ProjectPath getWorking(class UniqueID64&) {return hecl::ProjectPath();}
|
2015-11-10 02:07:15 +00:00
|
|
|
|
|
|
|
/* Project accessor */
|
2016-03-05 00:03:41 +00:00
|
|
|
hecl::Database::Project& getProject() const {return m_project;}
|
2015-11-10 02:07:15 +00:00
|
|
|
|
2016-03-28 22:39:56 +00:00
|
|
|
SpecBase(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc);
|
2015-08-05 21:46:07 +00:00
|
|
|
protected:
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::Database::Project& m_project;
|
2016-03-27 20:43:04 +00:00
|
|
|
bool m_pc;
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::ProjectPath m_masterShader;
|
2015-07-16 01:57:34 +00:00
|
|
|
private:
|
2016-03-04 23:04:53 +00:00
|
|
|
std::unique_ptr<nod::DiscBase> m_disc;
|
2015-07-18 04:33:38 +00:00
|
|
|
bool m_isWii;
|
|
|
|
bool m_standalone;
|
2015-07-01 23:50:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SPECBASE_HPP
|
|
|
|
|