metaforce/DataSpec/SpecBase.hpp

134 lines
6.1 KiB
C++
Raw Normal View History

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>
2016-09-18 23:47:48 +00:00
#include "hecl/Blender/BlenderConnection.hpp"
2015-07-01 23:50:39 +00:00
2016-10-02 22:41:36 +00:00
namespace urde
{
struct SObjectTag;
}
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 */
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
bool canCook(const hecl::ProjectPath& path, hecl::BlenderToken& btok);
const hecl::Database::DataSpecEntry* overrideDataSpec(const hecl::ProjectPath& path,
const hecl::Database::DataSpecEntry* oldEntry,
2016-10-01 23:20:20 +00:00
hecl::BlenderToken& btok) const;
void doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath,
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 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-10-02 22:41:36 +00:00
/* Convert path to object tag */
virtual urde::SObjectTag BuildTagFromPath(const hecl::ProjectPath& path,
hecl::BlenderToken& btok) const=0;
/* Even if PC spec is being cooked, this will return the vanilla GCN spec */
virtual const hecl::Database::DataSpecEntry& getOriginalSpec() const=0;
/* This will return a pseudo-spec for unmodified resources */
virtual const hecl::Database::DataSpecEntry& getUnmodifiedSpec() const=0;
2015-10-04 05:08:56 +00:00
/* Basic path check (game directory matching) */
2016-10-01 23:20:20 +00:00
virtual bool checkPathPrefix(const hecl::ProjectPath& path) const=0;
2015-10-04 05:08:56 +00:00
/* Pre-cook handlers */
2016-08-22 03:47:48 +00:00
virtual bool validateYAMLDNAType(athena::io::IStreamReader& 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;
using ColMesh = BlendStream::ColMesh;
using Light = BlendStream::Light;
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,
2016-04-10 04:49:02 +00:00
BlendStream& ds, bool fast, hecl::BlenderToken& btok,
FCookProgress progress)=0;
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;
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;
virtual void cookWorld(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
BlendStream& ds, bool fast, hecl::BlenderToken& btok,
FCookProgress progress)=0;
virtual void cookGuiFrame(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
BlendStream& ds, hecl::BlenderToken& btok,
FCookProgress progress)=0;
virtual void cookYAML(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
2016-08-22 03:47:48 +00:00
athena::io::IStreamReader& fin, FCookProgress progress)=0;
2016-09-18 23:47:48 +00:00
virtual void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)=0;
virtual void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)=0;
2017-03-20 05:09:53 +00:00
virtual void cookMapArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
BlendStream& ds, hecl::BlenderToken& btok,
FCookProgress progress)=0;
virtual void cookMapUniverse(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
BlendStream& ds, hecl::BlenderToken& btok,
FCookProgress progress)=0;
2015-10-04 05:08:56 +00:00
2016-10-02 22:41:36 +00:00
/* Dependency flatteners */
void flattenDependencies(const hecl::ProjectPath& in,
std::vector<hecl::ProjectPath>& pathsOut,
hecl::BlenderToken& btok);
void flattenDependencies(const class UniqueID32& id, std::vector<hecl::ProjectPath>& pathsOut);
void flattenDependencies(const class UniqueID64& id, std::vector<hecl::ProjectPath>& pathsOut);
virtual void flattenDependenciesYAML(athena::io::IStreamReader& fin, std::vector<hecl::ProjectPath>& pathsOut)=0;
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
2017-06-01 05:34:24 +00:00
/* Extract RandomStatic entropy */
void ExtractRandomStaticEntropy(const uint8_t* buf, const hecl::ProjectPath& noAramPath);
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;
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;
bool m_isWii;
bool m_standalone;
2015-07-01 23:50:39 +00:00
};
}
#endif // SPECBASE_HPP