mirror of https://github.com/AxioDL/metaforce.git
Submodule updates
This commit is contained in:
parent
9cb8b10fda
commit
b94e14cd55
|
@ -7,6 +7,3 @@
|
|||
[submodule "MathLib"]
|
||||
path = MathLib
|
||||
url = https://github.com/AxioDL/MathLib.git
|
||||
[submodule "libBoo"]
|
||||
path = libBoo
|
||||
url = https://github.com/AxioDL/libBoo.git
|
||||
|
|
|
@ -11,11 +11,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|||
include_directories(/usr/local/include)
|
||||
endif()
|
||||
|
||||
#disable libBoo for FreeBSD for the time being
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
add_subdirectory(libBoo)
|
||||
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libBoo/include)
|
||||
endif()
|
||||
set(BOO_INCLUDE_DIR hecl/extern/libBoo/include)
|
||||
|
||||
set(HECL_DATASPEC_DECLS
|
||||
"/* RetroCommon specs */
|
||||
|
@ -37,7 +33,7 @@ add_definitions(-DZE_ATHENA_TYPES=1)
|
|||
add_subdirectory(MathLib)
|
||||
set(MATHLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MathLib/include)
|
||||
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR}
|
||||
${NODLIB_INCLUDE_DIR} ${MATHLIB_INCLUDE_DIR}
|
||||
${NODLIB_INCLUDE_DIR} ${MATHLIB_INCLUDE_DIR} ${BOO_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_subdirectory(DataSpec)
|
||||
#disable Runtime on FreeBSD for now
|
||||
|
|
|
@ -4,5 +4,6 @@ namespace Retro
|
|||
{
|
||||
|
||||
LogVisor::LogModule LogDNACommon("Retro::DNACommon");
|
||||
SpecBase* g_curSpec = nullptr;
|
||||
|
||||
}
|
||||
|
|
|
@ -12,12 +12,13 @@ namespace Retro
|
|||
{
|
||||
|
||||
extern LogVisor::LogModule LogDNACommon;
|
||||
extern SpecBase* g_curSpec;
|
||||
|
||||
/* This comes up a great deal */
|
||||
typedef Athena::io::DNA<Athena::BigEndian> BigDNA;
|
||||
typedef Athena::io::DNAYaml<Athena::BigEndian> BigYAML;
|
||||
|
||||
/* FourCC with DNA read/write */
|
||||
/** FourCC with DNA read/write */
|
||||
class DNAFourCC final : public BigYAML, public HECL::FourCC
|
||||
{
|
||||
public:
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
using FourCC = HECL::FourCC;
|
||||
|
||||
/* PAK 32-bit Unique ID */
|
||||
/** PAK 32-bit Unique ID */
|
||||
class UniqueID32 : public BigYAML
|
||||
{
|
||||
uint32_t m_id = 0xffffffff;
|
||||
|
@ -62,6 +63,9 @@ public:
|
|||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + 4;}
|
||||
|
||||
UniqueID32& operator=(const HECL::ProjectPath& path)
|
||||
{m_id = path.hash().val32(); return *this;}
|
||||
|
||||
bool operator!=(const UniqueID32& other) const {return m_id != other.m_id;}
|
||||
bool operator==(const UniqueID32& other) const {return m_id == other.m_id;}
|
||||
uint32_t toUint32() const {return m_id;}
|
||||
|
@ -71,9 +75,11 @@ public:
|
|||
snprintf(buf, 9, "%08X", m_id);
|
||||
return std::string(buf);
|
||||
}
|
||||
void clear() {m_id = 0xffffffff;}
|
||||
|
||||
UniqueID32() = default;
|
||||
UniqueID32(Athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID32(const HECL::ProjectPath& path) {*this = path;}
|
||||
UniqueID32(const char* hexStr)
|
||||
{
|
||||
char copy[9];
|
||||
|
@ -81,9 +87,11 @@ public:
|
|||
copy[8] = '\0';
|
||||
m_id = strtoul(copy, nullptr, 16);
|
||||
}
|
||||
|
||||
static constexpr size_t BinarySize() {return 4;}
|
||||
};
|
||||
|
||||
/* PAK 64-bit Unique ID */
|
||||
/** PAK 64-bit Unique ID */
|
||||
class UniqueID64 : public BigYAML
|
||||
{
|
||||
uint64_t m_id = 0xffffffffffffffff;
|
||||
|
@ -101,6 +109,9 @@ public:
|
|||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + 8;}
|
||||
|
||||
UniqueID64& operator=(const HECL::ProjectPath& path)
|
||||
{m_id = path.hash().val64(); return *this;}
|
||||
|
||||
bool operator!=(const UniqueID64& other) const {return m_id != other.m_id;}
|
||||
bool operator==(const UniqueID64& other) const {return m_id == other.m_id;}
|
||||
uint64_t toUint64() const {return m_id;}
|
||||
|
@ -110,9 +121,11 @@ public:
|
|||
snprintf(buf, 17, "%016" PRIX64, m_id);
|
||||
return std::string(buf);
|
||||
}
|
||||
void clear() {m_id = 0xffffffffffffffff;}
|
||||
|
||||
UniqueID64() = default;
|
||||
UniqueID64(Athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID64(const HECL::ProjectPath& path) {*this = path;}
|
||||
UniqueID64(const char* hexStr)
|
||||
{
|
||||
char copy[17];
|
||||
|
@ -120,9 +133,11 @@ public:
|
|||
copy[16] = '\0';
|
||||
m_id = strtouq(copy, nullptr, 16);
|
||||
}
|
||||
|
||||
static constexpr size_t BinarySize() {return 8;}
|
||||
};
|
||||
|
||||
/* PAK 128-bit Unique ID */
|
||||
/** PAK 128-bit Unique ID */
|
||||
class UniqueID128 : public BigYAML
|
||||
{
|
||||
union
|
||||
|
@ -184,6 +199,7 @@ public:
|
|||
return (m_id[0] == other.m_id[0]) && (m_id[1] == other.m_id[1]);
|
||||
#endif
|
||||
}
|
||||
void clear() {m_id[0] = 0xffffffffffffffff; m_id[1] = 0xffffffffffffffff;}
|
||||
uint64_t toHighUint64() const {return m_id[0];}
|
||||
uint64_t toLowUint64() const {return m_id[1];}
|
||||
std::string toString() const
|
||||
|
@ -192,9 +208,11 @@ public:
|
|||
snprintf(buf, 33, "%016" PRIX64 "%016" PRIX64, m_id[0], m_id[1]);
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
static constexpr size_t BinarySize() {return 16;}
|
||||
};
|
||||
|
||||
/* Case-insensitive comparator for std::map sorting */
|
||||
/** Case-insensitive comparator for std::map sorting */
|
||||
struct CaseInsensitiveCompare
|
||||
{
|
||||
bool operator()(const std::string& lhs, const std::string& rhs) const
|
||||
|
@ -218,7 +236,62 @@ struct CaseInsensitiveCompare
|
|||
#endif
|
||||
};
|
||||
|
||||
/* Word Bitmap reader/writer */
|
||||
/** Class that automatically converts between hash and path for DNA usage */
|
||||
template <class IDTYPE>
|
||||
class PAKPath : public BigYAML
|
||||
{
|
||||
HECL::ProjectPath m_path;
|
||||
IDTYPE m_id;
|
||||
public:
|
||||
HECL::ProjectPath getPath() const
|
||||
{
|
||||
if (m_path)
|
||||
return m_path;
|
||||
if (!g_curSpec)
|
||||
LogDNACommon.report(LogVisor::FatalError, "current DataSpec not set for PAKPath");
|
||||
if (m_id)
|
||||
return g_curSpec->getWorking(m_id);
|
||||
return HECL::ProjectPath();
|
||||
}
|
||||
operator HECL::ProjectPath() const {return getPath();}
|
||||
operator const IDTYPE&() const {return m_id;}
|
||||
|
||||
Delete _d;
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
{m_id.read(reader);}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
{m_id.write(writer);}
|
||||
void fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
if (!g_curSpec)
|
||||
LogDNACommon.report(LogVisor::FatalError, "current DataSpec not set for PAKPath");
|
||||
std::string path = reader.readString(nullptr);
|
||||
if (path.empty())
|
||||
{
|
||||
m_path.clear();
|
||||
m_id.clear();
|
||||
return;
|
||||
}
|
||||
m_path.assign(g_curSpec->getProject(), path);
|
||||
m_id = m_path;
|
||||
}
|
||||
void toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
if (m_path)
|
||||
{
|
||||
writer.writeString(nullptr, m_path.getRelativePathUTF8());
|
||||
return;
|
||||
}
|
||||
writer.writeString(nullptr, getPath().getRelativePathUTF8());
|
||||
}
|
||||
|
||||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + IDTYPE::BinarySize();}
|
||||
};
|
||||
using PAKPath32 = PAKPath<UniqueID32>;
|
||||
using PAKPath64 = PAKPath<UniqueID64>;
|
||||
|
||||
/** Word Bitmap reader/writer */
|
||||
class WordBitmap
|
||||
{
|
||||
std::vector<atUint32> m_words;
|
||||
|
@ -267,10 +340,7 @@ public:
|
|||
size_t wordCur = idx % 32;
|
||||
m_words[wordIdx] &= ~(1 << wordCur);
|
||||
}
|
||||
void clear()
|
||||
{
|
||||
m_words.clear();
|
||||
}
|
||||
void clear() {m_words.clear();}
|
||||
|
||||
class Iterator : public std::iterator<std::forward_iterator_tag, bool>
|
||||
{
|
||||
|
@ -287,7 +357,7 @@ public:
|
|||
Iterator end() const {return Iterator(*this, m_bitCount);}
|
||||
};
|
||||
|
||||
/* Resource cooker function */
|
||||
/** Resource cooker function */
|
||||
typedef std::function<bool(const HECL::ProjectPath&, const HECL::ProjectPath&)> ResCooker;
|
||||
|
||||
}
|
||||
|
|
|
@ -258,6 +258,7 @@ public:
|
|||
: m_dataSpec(dataSpec),
|
||||
m_gameWorking(working), m_gameCooked(cooked),
|
||||
m_sharedWorking(working, "Shared"), m_sharedCooked(cooked, "Shared") {}
|
||||
|
||||
void build(std::vector<BRIDGETYPE>& bridges, std::function<void(float)> progress)
|
||||
{
|
||||
m_bridges = &bridges;
|
||||
|
|
|
@ -36,7 +36,7 @@ struct PAK : BigDNA
|
|||
Value<atUint32> size;
|
||||
Value<atUint32> offset;
|
||||
UniqueResult unique;
|
||||
std::string name;
|
||||
std::string name; /* backreferencing name for RE purposes */
|
||||
|
||||
std::unique_ptr<atUint8[]> getBuffer(const NOD::Node& pak, atUint64& szOut) const;
|
||||
inline PAKEntryReadStream beginReadStream(const NOD::Node& pak, atUint64 off=0) const
|
||||
|
|
|
@ -131,4 +131,5 @@ make_dnalist(liblist
|
|||
add_library(ScriptObjectsMP1
|
||||
${liblist}
|
||||
ScriptTypes.hpp
|
||||
IScriptObject.cpp)
|
||||
IScriptObject.cpp
|
||||
Parameters.cpp)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#include "Parameters.hpp"
|
||||
#include "../ANCS.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
namespace DNAMP1
|
||||
{
|
||||
|
||||
UniqueID32 AnimationParameters::getCINF(PAKRouter<PAKBridge>& pakRouter) const
|
||||
{
|
||||
if (!animationCharacterSet)
|
||||
return UniqueID32();
|
||||
const NOD::Node* node;
|
||||
const PAK::Entry* ancsEnt = pakRouter.lookupEntry(animationCharacterSet, &node);
|
||||
ANCS ancs;
|
||||
{
|
||||
PAKEntryReadStream rs = ancsEnt->beginReadStream(*node);
|
||||
ancs.read(rs);
|
||||
}
|
||||
return ancs.characterSet.characters.at(character).cinf;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define _DNAMP1_PARAMETERS_HPP_
|
||||
|
||||
#include "../../DNACommon/DNACommon.hpp"
|
||||
#include "../ANCS.hpp"
|
||||
#include "../DNAMP1.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
@ -94,19 +94,7 @@ struct AnimationParameters : BigYAML
|
|||
Value<atUint32> character;
|
||||
Value<atUint32> defaultAnimation;
|
||||
|
||||
UniqueID32 getCINF(PAKRouter<PAKBridge>& pakRouter) const
|
||||
{
|
||||
if (!animationCharacterSet)
|
||||
return UniqueID32();
|
||||
const NOD::Node* node;
|
||||
const PAK::Entry* ancsEnt = pakRouter.lookupEntry(animationCharacterSet, &node);
|
||||
ANCS ancs;
|
||||
{
|
||||
PAKEntryReadStream rs = ancsEnt->beginReadStream(*node);
|
||||
ancs.read(rs);
|
||||
}
|
||||
return ancs.characterSet.characters.at(character).cinf;
|
||||
}
|
||||
UniqueID32 getCINF(PAKRouter<PAKBridge>& pakRouter) const;
|
||||
|
||||
void nameANCS(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const
|
||||
{
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
#include "SpecBase.hpp"
|
||||
#include "Blender/BlenderSupport.hpp"
|
||||
#include "BlenderConnection.hpp"
|
||||
#include "DNACommon/DNACommon.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
static LogVisor::LogModule Log("Retro::SpecBase");
|
||||
|
||||
SpecBase::SpecBase(HECL::Database::Project& project)
|
||||
: m_project(project),
|
||||
m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {}
|
||||
|
||||
bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps)
|
||||
{
|
||||
m_disc = NOD::OpenDiscFromImage(info.srcpath.c_str(), m_isWii);
|
||||
|
@ -48,6 +53,7 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
|
|||
|
||||
void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
|
||||
{
|
||||
Retro::g_curSpec = this;
|
||||
if (!Blender::BuildMasterShader(m_masterShader))
|
||||
Log.report(LogVisor::FatalError, "Unable to build master shader blend");
|
||||
if (m_isWii)
|
||||
|
@ -115,6 +121,7 @@ bool SpecBase::canCook(const HECL::ProjectPath& path)
|
|||
void SpecBase::doCook(const HECL::ProjectPath& path, const HECL::ProjectPath& cookedPath,
|
||||
bool fast, FCookProgress progress)
|
||||
{
|
||||
Retro::g_curSpec = this;
|
||||
if (HECL::IsPathBlend(path))
|
||||
{
|
||||
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
||||
|
|
|
@ -55,9 +55,14 @@ struct SpecBase : HECL::Database::IDataSpec
|
|||
|
||||
const HECL::ProjectPath& getMasterShaderPath() const {return m_masterShader;}
|
||||
|
||||
SpecBase(HECL::Database::Project& project)
|
||||
: m_project(project),
|
||||
m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {}
|
||||
/* 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);
|
||||
protected:
|
||||
HECL::Database::Project& m_project;
|
||||
HECL::ProjectPath m_masterShader;
|
||||
|
|
|
@ -267,6 +267,11 @@ struct SpecMP1 : SpecBase
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual HECL::ProjectPath getWorking(class UniqueID32& id)
|
||||
{
|
||||
return m_pakRouter.getWorking(id);
|
||||
}
|
||||
|
||||
bool checkPathPrefix(const HECL::ProjectPath& path)
|
||||
{
|
||||
return path.getRelativePath().compare(0, 4, _S("MP1/")) == 0;
|
||||
|
|
|
@ -257,6 +257,11 @@ struct SpecMP2 : SpecBase
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual HECL::ProjectPath getWorking(class UniqueID32& id)
|
||||
{
|
||||
return m_pakRouter.getWorking(id);
|
||||
}
|
||||
|
||||
bool checkPathPrefix(const HECL::ProjectPath& path)
|
||||
{
|
||||
return path.getRelativePath().compare(0, 4, _S("MP2/")) == 0;
|
||||
|
|
|
@ -437,6 +437,11 @@ struct SpecMP3 : SpecBase
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual HECL::ProjectPath getWorking(class UniqueID64& id)
|
||||
{
|
||||
return m_pakRouter.getWorking(id);
|
||||
}
|
||||
|
||||
bool checkPathPrefix(const HECL::ProjectPath& path)
|
||||
{
|
||||
return path.getRelativePath().compare(0, 4, _S("MP3/")) == 0;
|
||||
|
|
2
NODLib
2
NODLib
|
@ -1 +1 @@
|
|||
Subproject commit c81ced7392c81bdb3f1ea0e29c37d1879aca88bb
|
||||
Subproject commit 53d27fe564008af61cb00fed7c8deb837eec3cb2
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit b2d58faae7bd32488c641474db476bb9a29411db
|
||||
Subproject commit e42eecf2370a0e7dcd002ce7799f2e1f32c95573
|
1
libBoo
1
libBoo
|
@ -1 +0,0 @@
|
|||
Subproject commit 2be32d6ca42a59d254874578248b7d4e91a1ee99
|
Loading…
Reference in New Issue