mirror of https://github.com/AxioDL/metaforce.git
DataSpec link structure refactor; UniqueIDBridge cache fix
This commit is contained in:
parent
9b6ab93ae5
commit
2503e04b9f
|
@ -58,14 +58,7 @@ set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/extern/boo/include)
|
||||||
set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/include
|
set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hecl/blender)
|
${CMAKE_CURRENT_SOURCE_DIR}/hecl/blender)
|
||||||
|
|
||||||
set(DATA_SPEC_LIBS
|
set(DATA_SPEC_LIBS RetroDataSpec amuse)
|
||||||
RetroDataSpec
|
|
||||||
DNAMP3
|
|
||||||
DNAMP2
|
|
||||||
DNAMP1
|
|
||||||
ScriptObjectsMP1
|
|
||||||
DNACommon
|
|
||||||
amuse)
|
|
||||||
set(HECL_DATASPEC_DECLS
|
set(HECL_DATASPEC_DECLS
|
||||||
"/* RetroCommon specs */
|
"/* RetroCommon specs */
|
||||||
namespace DataSpec
|
namespace DataSpec
|
||||||
|
|
|
@ -16,6 +16,19 @@ macro(make_dnalist outlist)
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# Assembles source files together for the main DataSpecCommon library
|
||||||
|
macro(dataspec_add_list rel_path a_list)
|
||||||
|
unset(tmp_list)
|
||||||
|
foreach(path IN LISTS ${a_list})
|
||||||
|
if (IS_ABSOLUTE ${path})
|
||||||
|
list(APPEND tmp_list "${path}")
|
||||||
|
else()
|
||||||
|
list(APPEND tmp_list "${rel_path}/${path}")
|
||||||
|
endif()
|
||||||
|
endforeach(path)
|
||||||
|
set(${a_list} "${tmp_list}" PARENT_SCOPE)
|
||||||
|
endmacro(dataspec_add_list)
|
||||||
|
|
||||||
include_directories(${ZLIB_INCLUDE_DIR} ${LZO_INCLUDE_DIR})
|
include_directories(${ZLIB_INCLUDE_DIR} ${LZO_INCLUDE_DIR})
|
||||||
|
|
||||||
# Each game's DNA library
|
# Each game's DNA library
|
||||||
|
@ -30,9 +43,13 @@ bintoc(RetroMasterShader.c Blender/RetroMasterShader.py RETRO_MASTER_SHADER)
|
||||||
# Each game's DataSpec implementation
|
# Each game's DataSpec implementation
|
||||||
add_library(RetroDataSpec
|
add_library(RetroDataSpec
|
||||||
SpecBase.cpp
|
SpecBase.cpp
|
||||||
|
${DNACOMMON_SOURCES}
|
||||||
SpecMP1.cpp
|
SpecMP1.cpp
|
||||||
|
${DNAMP1_SOURCES}
|
||||||
SpecMP2.cpp
|
SpecMP2.cpp
|
||||||
|
${DNAMP2_SOURCES}
|
||||||
SpecMP3.cpp
|
SpecMP3.cpp
|
||||||
|
${DNAMP3_SOURCES}
|
||||||
Blender/BlenderSupport.hpp
|
Blender/BlenderSupport.hpp
|
||||||
Blender/BlenderSupport.cpp
|
Blender/BlenderSupport.cpp
|
||||||
Blender/RetroMasterShader.py
|
Blender/RetroMasterShader.py
|
||||||
|
|
|
@ -5,7 +5,7 @@ make_dnalist(liblist
|
||||||
SAVWCommon
|
SAVWCommon
|
||||||
ParticleCommon)
|
ParticleCommon)
|
||||||
|
|
||||||
add_library(DNACommon
|
set(DNACOMMON_SOURCES
|
||||||
DNACommon.hpp DNACommon.cpp
|
DNACommon.hpp DNACommon.cpp
|
||||||
${liblist}
|
${liblist}
|
||||||
PAK.hpp PAK.cpp
|
PAK.hpp PAK.cpp
|
||||||
|
@ -42,3 +42,5 @@ add_library(DNACommon
|
||||||
Tweaks/ITweakPlayerRes.hpp
|
Tweaks/ITweakPlayerRes.hpp
|
||||||
Tweaks/ITweakGui.hpp
|
Tweaks/ITweakGui.hpp
|
||||||
Tweaks/ITweakSlideShow.hpp)
|
Tweaks/ITweakSlideShow.hpp)
|
||||||
|
|
||||||
|
dataspec_add_list(DNACommon DNACOMMON_SOURCES)
|
||||||
|
|
|
@ -11,4 +11,241 @@ ThreadLocalPtr<PAKRouterBase> g_PakRouter;
|
||||||
ThreadLocalPtr<hecl::Database::Project> UniqueIDBridge::s_Project;
|
ThreadLocalPtr<hecl::Database::Project> UniqueIDBridge::s_Project;
|
||||||
UniqueID32 UniqueID32::kInvalidId;
|
UniqueID32 UniqueID32::kInvalidId;
|
||||||
|
|
||||||
|
template <class IDType>
|
||||||
|
hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const IDType& id, bool silenceWarnings)
|
||||||
|
{
|
||||||
|
/* Try PAKRouter first (only available at extract) */
|
||||||
|
PAKRouterBase* pakRouter = g_PakRouter.get();
|
||||||
|
if (pakRouter)
|
||||||
|
{
|
||||||
|
hecl::ProjectPath path = pakRouter->getWorking(id, silenceWarnings);
|
||||||
|
if (path)
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try project cache second (populated with paths read from YAML resources) */
|
||||||
|
hecl::Database::Project* project = s_Project.get();
|
||||||
|
if (!project)
|
||||||
|
{
|
||||||
|
if (pakRouter)
|
||||||
|
{
|
||||||
|
if (!silenceWarnings)
|
||||||
|
LogDNACommon.report(logvisor::Warning,
|
||||||
|
"unable to translate %s to path", id.toString().c_str());
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
LogDNACommon.report(logvisor::Fatal,
|
||||||
|
"g_PakRouter or s_Project must be set to non-null before "
|
||||||
|
"calling UniqueIDBridge::TranslatePakIdToPath");
|
||||||
|
}
|
||||||
|
|
||||||
|
const hecl::ProjectPath* search = project->lookupBridgePath(id.toUint64());
|
||||||
|
if (!search)
|
||||||
|
{
|
||||||
|
if (!silenceWarnings)
|
||||||
|
LogDNACommon.report(logvisor::Warning,
|
||||||
|
"unable to translate %s to path", id.toString().c_str());
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return *search;
|
||||||
|
}
|
||||||
|
template
|
||||||
|
hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const UniqueID32& id, bool silenceWarnings);
|
||||||
|
template
|
||||||
|
hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const UniqueID64& id, bool silenceWarnings);
|
||||||
|
|
||||||
|
template <class IDType>
|
||||||
|
hecl::ProjectPath UniqueIDBridge::MakePathFromString(const std::string& str)
|
||||||
|
{
|
||||||
|
hecl::Database::Project* project = s_Project.get();
|
||||||
|
if (!project)
|
||||||
|
LogDNACommon.report(logvisor::Fatal,
|
||||||
|
"UniqueIDBridge::setGlobalProject must be called before MakePathFromString");
|
||||||
|
hecl::ProjectPath path = hecl::ProjectPath(*project, str);
|
||||||
|
project->addBridgePathToCache(IDType(path), path);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
template
|
||||||
|
hecl::ProjectPath UniqueIDBridge::MakePathFromString<UniqueID32>(const std::string& str);
|
||||||
|
template
|
||||||
|
hecl::ProjectPath UniqueIDBridge::MakePathFromString<UniqueID64>(const std::string& str);
|
||||||
|
|
||||||
|
template <class IDType>
|
||||||
|
void UniqueIDBridge::TransformOldHashToNewHash(IDType& id)
|
||||||
|
{
|
||||||
|
id = TranslatePakIdToPath(id);
|
||||||
|
}
|
||||||
|
template
|
||||||
|
void UniqueIDBridge::TransformOldHashToNewHash(UniqueID32& id);
|
||||||
|
template
|
||||||
|
void UniqueIDBridge::TransformOldHashToNewHash(UniqueID64& id);
|
||||||
|
|
||||||
|
void UniqueIDBridge::setThreadProject(hecl::Database::Project& project)
|
||||||
|
{
|
||||||
|
s_Project.reset(&project);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PAK 32-bit Unique ID */
|
||||||
|
void UniqueID32::read(athena::io::IStreamReader& reader)
|
||||||
|
{m_id = reader.readUint32Big();}
|
||||||
|
void UniqueID32::write(athena::io::IStreamWriter& writer) const
|
||||||
|
{writer.writeUint32Big(m_id);}
|
||||||
|
void UniqueID32::read(athena::io::YAMLDocReader& reader)
|
||||||
|
{
|
||||||
|
*this = UniqueIDBridge::MakePathFromString<UniqueID32>(reader.readString(nullptr));
|
||||||
|
}
|
||||||
|
void UniqueID32::write(athena::io::YAMLDocWriter& writer) const
|
||||||
|
{
|
||||||
|
if (!operator bool())
|
||||||
|
return;
|
||||||
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
writer.writeString(nullptr, path.getRelativePathUTF8());
|
||||||
|
}
|
||||||
|
size_t UniqueID32::binarySize(size_t __isz) const
|
||||||
|
{return __isz + 4;}
|
||||||
|
|
||||||
|
std::string UniqueID32::toString() const
|
||||||
|
{
|
||||||
|
char buf[9];
|
||||||
|
snprintf(buf, 9, "%08X", m_id);
|
||||||
|
return std::string(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuxiliaryID32& AuxiliaryID32::operator=(const hecl::ProjectPath& path)
|
||||||
|
{
|
||||||
|
m_id = path.ensureAuxInfo(m_auxStr).hash().val32();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
AuxiliaryID32& AuxiliaryID32::operator=(const UniqueID32& id)
|
||||||
|
{
|
||||||
|
m_baseId = id;
|
||||||
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id);
|
||||||
|
if (path)
|
||||||
|
{
|
||||||
|
if (m_addExtension)
|
||||||
|
path = path.getWithExtension(m_addExtension);
|
||||||
|
*this = path;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuxiliaryID32::read(athena::io::IStreamReader& reader)
|
||||||
|
{
|
||||||
|
m_id = reader.readUint32Big();
|
||||||
|
m_baseId = *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuxiliaryID32::write(athena::io::IStreamWriter& writer) const
|
||||||
|
{
|
||||||
|
writer.writeUint32Big(m_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuxiliaryID32::read(athena::io::YAMLDocReader& reader)
|
||||||
|
{
|
||||||
|
hecl::ProjectPath readPath = UniqueIDBridge::MakePathFromString<UniqueID32>(reader.readString(nullptr));
|
||||||
|
*this = readPath.ensureAuxInfo(m_auxStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuxiliaryID32::write(athena::io::YAMLDocWriter& writer) const
|
||||||
|
{
|
||||||
|
if (!operator bool())
|
||||||
|
return;
|
||||||
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this, true);
|
||||||
|
if (!path)
|
||||||
|
path = UniqueIDBridge::TranslatePakIdToPath(m_baseId);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
if (m_addExtension)
|
||||||
|
path = path.getWithExtension(m_addExtension);
|
||||||
|
hecl::SystemUTF8View ufx8AuxStr(m_auxStr);
|
||||||
|
writer.writeString(nullptr, path.getRelativePathUTF8() + '|' + ufx8AuxStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** PAK 64-bit Unique ID */
|
||||||
|
void UniqueID64::read(athena::io::IStreamReader& reader)
|
||||||
|
{m_id = reader.readUint64Big();}
|
||||||
|
void UniqueID64::write(athena::io::IStreamWriter& writer) const
|
||||||
|
{writer.writeUint64Big(m_id);}
|
||||||
|
void UniqueID64::read(athena::io::YAMLDocReader& reader)
|
||||||
|
{
|
||||||
|
*this = UniqueIDBridge::MakePathFromString<UniqueID64>(reader.readString(nullptr));
|
||||||
|
}
|
||||||
|
void UniqueID64::write(athena::io::YAMLDocWriter& writer) const
|
||||||
|
{
|
||||||
|
if (!operator bool())
|
||||||
|
return;
|
||||||
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
writer.writeString(nullptr, path.getRelativePathUTF8());
|
||||||
|
}
|
||||||
|
size_t UniqueID64::binarySize(size_t __isz) const
|
||||||
|
{return __isz + 8;}
|
||||||
|
|
||||||
|
std::string UniqueID64::toString() const
|
||||||
|
{
|
||||||
|
char buf[17];
|
||||||
|
snprintf(buf, 17, "%016" PRIX64, m_id);
|
||||||
|
return std::string(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PAK 128-bit Unique ID */
|
||||||
|
void UniqueID128::read(athena::io::IStreamReader& reader)
|
||||||
|
{
|
||||||
|
m_id[0] = reader.readUint64Big();
|
||||||
|
m_id[1] = reader.readUint64Big();
|
||||||
|
}
|
||||||
|
void UniqueID128::write(athena::io::IStreamWriter& writer) const
|
||||||
|
{
|
||||||
|
writer.writeUint64Big(m_id[0]);
|
||||||
|
writer.writeUint64Big(m_id[1]);
|
||||||
|
}
|
||||||
|
void UniqueID128::read(athena::io::YAMLDocReader& reader)
|
||||||
|
{
|
||||||
|
*this = UniqueIDBridge::MakePathFromString<UniqueID128>(reader.readString(nullptr));
|
||||||
|
}
|
||||||
|
void UniqueID128::write(athena::io::YAMLDocWriter& writer) const
|
||||||
|
{
|
||||||
|
if (!operator bool())
|
||||||
|
return;
|
||||||
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
writer.writeString(nullptr, path.getRelativePathUTF8());
|
||||||
|
}
|
||||||
|
size_t UniqueID128::binarySize(size_t __isz) const
|
||||||
|
{return __isz + 16;}
|
||||||
|
|
||||||
|
std::string UniqueID128::toString() const
|
||||||
|
{
|
||||||
|
char buf[33];
|
||||||
|
snprintf(buf, 33, "%016" PRIX64 "%016" PRIX64, m_id[0], m_id[1]);
|
||||||
|
return std::string(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Word Bitmap reader/writer */
|
||||||
|
void WordBitmap::read(athena::io::IStreamReader& reader, size_t bitCount)
|
||||||
|
{
|
||||||
|
m_bitCount = bitCount;
|
||||||
|
size_t wordCount = (bitCount + 31) / 32;
|
||||||
|
m_words.clear();
|
||||||
|
m_words.reserve(wordCount);
|
||||||
|
for (size_t w=0 ; w<wordCount ; ++w)
|
||||||
|
m_words.push_back(reader.readUint32Big());
|
||||||
|
}
|
||||||
|
void WordBitmap::write(athena::io::IStreamWriter& writer) const
|
||||||
|
{
|
||||||
|
for (atUint32 word : m_words)
|
||||||
|
writer.writeUint32Big(word);
|
||||||
|
}
|
||||||
|
size_t WordBitmap::binarySize(size_t __isz) const
|
||||||
|
{
|
||||||
|
return __isz + m_words.size() * 4;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,55 +125,13 @@ class UniqueIDBridge
|
||||||
static ThreadLocalPtr<hecl::Database::Project> s_Project;
|
static ThreadLocalPtr<hecl::Database::Project> s_Project;
|
||||||
public:
|
public:
|
||||||
template <class IDType>
|
template <class IDType>
|
||||||
static hecl::ProjectPath TranslatePakIdToPath(const IDType& id, bool silenceWarnings=false)
|
static hecl::ProjectPath TranslatePakIdToPath(const IDType& id, bool silenceWarnings=false);
|
||||||
{
|
|
||||||
/* Try PAKRouter first (only available at extract) */
|
|
||||||
PAKRouterBase* pakRouter = g_PakRouter.get();
|
|
||||||
if (pakRouter)
|
|
||||||
{
|
|
||||||
hecl::ProjectPath path = pakRouter->getWorking(id, silenceWarnings);
|
|
||||||
if (path)
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try project cache second (populated with paths read from YAML resources) */
|
|
||||||
hecl::Database::Project* project = s_Project.get();
|
|
||||||
if (!project)
|
|
||||||
LogDNACommon.report(logvisor::Fatal,
|
|
||||||
"g_PakRouter or s_Project must be set to non-null before "
|
|
||||||
"calling UniqueIDBridge::TranslatePakIdToPath");
|
|
||||||
|
|
||||||
const hecl::ProjectPath* search = project->lookupBridgePath(id.toUint64());
|
|
||||||
if (!search)
|
|
||||||
{
|
|
||||||
if (!silenceWarnings)
|
|
||||||
LogDNACommon.report(logvisor::Warning,
|
|
||||||
"unable to translate %s to path", id.toString().c_str());
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
return *search;
|
|
||||||
}
|
|
||||||
template <class IDType>
|
template <class IDType>
|
||||||
static hecl::ProjectPath MakePathFromString(const std::string& str)
|
static hecl::ProjectPath MakePathFromString(const std::string& str);
|
||||||
{
|
|
||||||
hecl::Database::Project* project = s_Project.get();
|
|
||||||
if (!project)
|
|
||||||
LogDNACommon.report(logvisor::Fatal,
|
|
||||||
"UniqueIDBridge::setGlobalProject must be called before MakePathFromString");
|
|
||||||
hecl::ProjectPath path = hecl::ProjectPath(*project, str);
|
|
||||||
project->addBridgePathToCache(IDType(path), path);
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
template <class IDType>
|
template <class IDType>
|
||||||
static void TransformOldHashToNewHash(IDType& id)
|
static void TransformOldHashToNewHash(IDType& id);
|
||||||
{
|
|
||||||
id = TranslatePakIdToPath(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setThreadProject(hecl::Database::Project& project)
|
static void setThreadProject(hecl::Database::Project& project);
|
||||||
{
|
|
||||||
s_Project.reset(&project);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** PAK 32-bit Unique ID */
|
/** PAK 32-bit Unique ID */
|
||||||
|
@ -185,25 +143,11 @@ public:
|
||||||
static UniqueID32 kInvalidId;
|
static UniqueID32 kInvalidId;
|
||||||
Delete expl;
|
Delete expl;
|
||||||
operator bool() const {return m_id != 0xffffffff && m_id != 0;}
|
operator bool() const {return m_id != 0xffffffff && m_id != 0;}
|
||||||
void read(athena::io::IStreamReader& reader)
|
void read(athena::io::IStreamReader& reader);
|
||||||
{m_id = reader.readUint32Big();}
|
void write(athena::io::IStreamWriter& writer) const;
|
||||||
void write(athena::io::IStreamWriter& writer) const
|
void read(athena::io::YAMLDocReader& reader);
|
||||||
{writer.writeUint32Big(m_id);}
|
void write(athena::io::YAMLDocWriter& writer) const;
|
||||||
void read(athena::io::YAMLDocReader& reader)
|
size_t binarySize(size_t __isz) const;
|
||||||
{
|
|
||||||
*this = UniqueIDBridge::MakePathFromString<UniqueID32>(reader.readString(nullptr));
|
|
||||||
}
|
|
||||||
void write(athena::io::YAMLDocWriter& writer) const
|
|
||||||
{
|
|
||||||
if (!operator bool())
|
|
||||||
return;
|
|
||||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
|
||||||
if (!path)
|
|
||||||
return;
|
|
||||||
writer.writeString(nullptr, path.getRelativePathUTF8());
|
|
||||||
}
|
|
||||||
size_t binarySize(size_t __isz) const
|
|
||||||
{return __isz + 4;}
|
|
||||||
|
|
||||||
UniqueID32& operator=(const hecl::ProjectPath& path)
|
UniqueID32& operator=(const hecl::ProjectPath& path)
|
||||||
{m_id = path.hash().val32(); return *this;}
|
{m_id = path.hash().val32(); return *this;}
|
||||||
|
@ -212,12 +156,7 @@ public:
|
||||||
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;}
|
uint32_t toUint32() const {return m_id;}
|
||||||
uint64_t toUint64() const {return m_id;}
|
uint64_t toUint64() const {return m_id;}
|
||||||
std::string toString() const
|
std::string toString() const;
|
||||||
{
|
|
||||||
char buf[9];
|
|
||||||
snprintf(buf, 9, "%08X", m_id);
|
|
||||||
return std::string(buf);
|
|
||||||
}
|
|
||||||
void clear() {m_id = 0xffffffff;}
|
void clear() {m_id = 0xffffffff;}
|
||||||
|
|
||||||
UniqueID32() = default;
|
UniqueID32() = default;
|
||||||
|
@ -252,57 +191,12 @@ public:
|
||||||
const hecl::SystemChar* addExtension=nullptr)
|
const hecl::SystemChar* addExtension=nullptr)
|
||||||
: m_auxStr(auxStr), m_addExtension(addExtension) {}
|
: m_auxStr(auxStr), m_addExtension(addExtension) {}
|
||||||
|
|
||||||
AuxiliaryID32& operator=(const hecl::ProjectPath& path)
|
AuxiliaryID32& operator=(const hecl::ProjectPath& path);
|
||||||
{
|
AuxiliaryID32& operator=(const UniqueID32& id);
|
||||||
m_id = path.ensureAuxInfo(m_auxStr).hash().val32();
|
void read(athena::io::IStreamReader& reader);
|
||||||
return *this;
|
void write(athena::io::IStreamWriter& writer) const;
|
||||||
}
|
void read(athena::io::YAMLDocReader& reader);
|
||||||
|
void write(athena::io::YAMLDocWriter& writer) const;
|
||||||
AuxiliaryID32& operator=(const UniqueID32& id)
|
|
||||||
{
|
|
||||||
m_baseId = id;
|
|
||||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id);
|
|
||||||
if (path)
|
|
||||||
{
|
|
||||||
if (m_addExtension)
|
|
||||||
path = path.getWithExtension(m_addExtension);
|
|
||||||
*this = path;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void read(athena::io::IStreamReader& reader)
|
|
||||||
{
|
|
||||||
m_id = reader.readUint32Big();
|
|
||||||
m_baseId = *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void write(athena::io::IStreamWriter& writer) const
|
|
||||||
{
|
|
||||||
writer.writeUint32Big(m_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void read(athena::io::YAMLDocReader& reader)
|
|
||||||
{
|
|
||||||
hecl::ProjectPath readPath = UniqueIDBridge::MakePathFromString<UniqueID32>(reader.readString(nullptr));
|
|
||||||
*this = readPath.ensureAuxInfo(m_auxStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void write(athena::io::YAMLDocWriter& writer) const
|
|
||||||
{
|
|
||||||
if (!operator bool())
|
|
||||||
return;
|
|
||||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this, true);
|
|
||||||
if (!path)
|
|
||||||
path = UniqueIDBridge::TranslatePakIdToPath(m_baseId);
|
|
||||||
if (!path)
|
|
||||||
return;
|
|
||||||
if (m_addExtension)
|
|
||||||
path = path.getWithExtension(m_addExtension);
|
|
||||||
hecl::SystemUTF8View ufx8AuxStr(m_auxStr);
|
|
||||||
writer.writeString(nullptr, path.getRelativePathUTF8() + '|' + ufx8AuxStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
const UniqueID32& getBaseId() const {return m_baseId;}
|
const UniqueID32& getBaseId() const {return m_baseId;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -313,25 +207,11 @@ class UniqueID64 : public BigYAML
|
||||||
public:
|
public:
|
||||||
Delete expl;
|
Delete expl;
|
||||||
operator bool() const {return m_id != 0xffffffffffffffff && m_id != 0;}
|
operator bool() const {return m_id != 0xffffffffffffffff && m_id != 0;}
|
||||||
void read(athena::io::IStreamReader& reader)
|
void read(athena::io::IStreamReader& reader);
|
||||||
{m_id = reader.readUint64Big();}
|
void write(athena::io::IStreamWriter& writer) const;
|
||||||
void write(athena::io::IStreamWriter& writer) const
|
void read(athena::io::YAMLDocReader& reader);
|
||||||
{writer.writeUint64Big(m_id);}
|
void write(athena::io::YAMLDocWriter& writer) const;
|
||||||
void read(athena::io::YAMLDocReader& reader)
|
size_t binarySize(size_t __isz) const;
|
||||||
{
|
|
||||||
*this = UniqueIDBridge::MakePathFromString<UniqueID64>(reader.readString(nullptr));
|
|
||||||
}
|
|
||||||
void write(athena::io::YAMLDocWriter& writer) const
|
|
||||||
{
|
|
||||||
if (!operator bool())
|
|
||||||
return;
|
|
||||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
|
||||||
if (!path)
|
|
||||||
return;
|
|
||||||
writer.writeString(nullptr, path.getRelativePathUTF8());
|
|
||||||
}
|
|
||||||
size_t binarySize(size_t __isz) const
|
|
||||||
{return __isz + 8;}
|
|
||||||
|
|
||||||
UniqueID64& operator=(const hecl::ProjectPath& path)
|
UniqueID64& operator=(const hecl::ProjectPath& path)
|
||||||
{m_id = path.hash().val64(); return *this;}
|
{m_id = path.hash().val64(); return *this;}
|
||||||
|
@ -339,12 +219,7 @@ public:
|
||||||
bool operator!=(const UniqueID64& other) const {return m_id != other.m_id;}
|
bool operator!=(const UniqueID64& other) const {return m_id != other.m_id;}
|
||||||
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;}
|
uint64_t toUint64() const {return m_id;}
|
||||||
std::string toString() const
|
std::string toString() const;
|
||||||
{
|
|
||||||
char buf[17];
|
|
||||||
snprintf(buf, 17, "%016" PRIX64, m_id);
|
|
||||||
return std::string(buf);
|
|
||||||
}
|
|
||||||
void clear() {m_id = 0xffffffffffffffff;}
|
void clear() {m_id = 0xffffffffffffffff;}
|
||||||
|
|
||||||
UniqueID64() = default;
|
UniqueID64() = default;
|
||||||
|
@ -392,31 +267,11 @@ public:
|
||||||
UniqueID128() {m_id[0]=0xffffffffffffffff; m_id[1]=0xffffffffffffffff;}
|
UniqueID128() {m_id[0]=0xffffffffffffffff; m_id[1]=0xffffffffffffffff;}
|
||||||
operator bool() const
|
operator bool() const
|
||||||
{return m_id[0] != 0xffffffffffffffff && m_id[0] != 0 && m_id[1] != 0xffffffffffffffff && m_id[1] != 0;}
|
{return m_id[0] != 0xffffffffffffffff && m_id[0] != 0 && m_id[1] != 0xffffffffffffffff && m_id[1] != 0;}
|
||||||
void read(athena::io::IStreamReader& reader)
|
void read(athena::io::IStreamReader& reader);
|
||||||
{
|
void write(athena::io::IStreamWriter& writer) const;
|
||||||
m_id[0] = reader.readUint64Big();
|
void read(athena::io::YAMLDocReader& reader);
|
||||||
m_id[1] = reader.readUint64Big();
|
void write(athena::io::YAMLDocWriter& writer) const;
|
||||||
}
|
size_t binarySize(size_t __isz) const;
|
||||||
void write(athena::io::IStreamWriter& writer) const
|
|
||||||
{
|
|
||||||
writer.writeUint64Big(m_id[0]);
|
|
||||||
writer.writeUint64Big(m_id[1]);
|
|
||||||
}
|
|
||||||
void read(athena::io::YAMLDocReader& reader)
|
|
||||||
{
|
|
||||||
*this = UniqueIDBridge::MakePathFromString<UniqueID128>(reader.readString(nullptr));
|
|
||||||
}
|
|
||||||
void write(athena::io::YAMLDocWriter& writer) const
|
|
||||||
{
|
|
||||||
if (!operator bool())
|
|
||||||
return;
|
|
||||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
|
||||||
if (!path)
|
|
||||||
return;
|
|
||||||
writer.writeString(nullptr, path.getRelativePathUTF8());
|
|
||||||
}
|
|
||||||
size_t binarySize(size_t __isz) const
|
|
||||||
{return __isz + 16;}
|
|
||||||
|
|
||||||
UniqueID128& operator=(const hecl::ProjectPath& path)
|
UniqueID128& operator=(const hecl::ProjectPath& path)
|
||||||
{
|
{
|
||||||
|
@ -450,12 +305,7 @@ public:
|
||||||
uint64_t toUint64() const {return m_id[0];}
|
uint64_t toUint64() const {return m_id[0];}
|
||||||
uint64_t toHighUint64() const {return m_id[0];}
|
uint64_t toHighUint64() const {return m_id[0];}
|
||||||
uint64_t toLowUint64() const {return m_id[1];}
|
uint64_t toLowUint64() const {return m_id[1];}
|
||||||
std::string toString() const
|
std::string toString() const;
|
||||||
{
|
|
||||||
char buf[33];
|
|
||||||
snprintf(buf, 33, "%016" PRIX64 "%016" PRIX64, m_id[0], m_id[1]);
|
|
||||||
return std::string(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr size_t BinarySize() {return 16;}
|
static constexpr size_t BinarySize() {return 16;}
|
||||||
};
|
};
|
||||||
|
@ -466,24 +316,9 @@ class WordBitmap
|
||||||
std::vector<atUint32> m_words;
|
std::vector<atUint32> m_words;
|
||||||
size_t m_bitCount = 0;
|
size_t m_bitCount = 0;
|
||||||
public:
|
public:
|
||||||
void read(athena::io::IStreamReader& reader, size_t bitCount)
|
void read(athena::io::IStreamReader& reader, size_t bitCount);
|
||||||
{
|
void write(athena::io::IStreamWriter& writer) const;
|
||||||
m_bitCount = bitCount;
|
size_t binarySize(size_t __isz) const;
|
||||||
size_t wordCount = (bitCount + 31) / 32;
|
|
||||||
m_words.clear();
|
|
||||||
m_words.reserve(wordCount);
|
|
||||||
for (size_t w=0 ; w<wordCount ; ++w)
|
|
||||||
m_words.push_back(reader.readUint32Big());
|
|
||||||
}
|
|
||||||
void write(athena::io::IStreamWriter& writer) const
|
|
||||||
{
|
|
||||||
for (atUint32 word : m_words)
|
|
||||||
writer.writeUint32Big(word);
|
|
||||||
}
|
|
||||||
size_t binarySize(size_t __isz) const
|
|
||||||
{
|
|
||||||
return __isz + m_words.size() * 4;
|
|
||||||
}
|
|
||||||
size_t getBitCount() const {return m_bitCount;}
|
size_t getBitCount() const {return m_bitCount;}
|
||||||
bool getBit(size_t idx) const
|
bool getBit(size_t idx) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ make_dnalist(liblist
|
||||||
Tweaks/CTweakSlideShow
|
Tweaks/CTweakSlideShow
|
||||||
Tweaks/CTweakCameraBob)
|
Tweaks/CTweakCameraBob)
|
||||||
|
|
||||||
add_library(DNAMP1
|
set(DNAMP1_SOURCES
|
||||||
DNAMP1.hpp DNAMP1.cpp
|
DNAMP1.hpp DNAMP1.cpp
|
||||||
${liblist}
|
${liblist}
|
||||||
PAK.cpp
|
PAK.cpp
|
||||||
|
@ -49,4 +49,7 @@ add_library(DNAMP1
|
||||||
SCLY.hpp SCLY.cpp
|
SCLY.hpp SCLY.cpp
|
||||||
FRME.cpp
|
FRME.cpp
|
||||||
DeafBabe.cpp
|
DeafBabe.cpp
|
||||||
Tweaks/CTweakPlayer.cpp)
|
Tweaks/CTweakPlayer.cpp
|
||||||
|
${ScriptObjectsMP1_SOURCES})
|
||||||
|
|
||||||
|
dataspec_add_list(DNAMP1 DNAMP1_SOURCES)
|
||||||
|
|
|
@ -128,8 +128,10 @@ make_dnalist(liblist
|
||||||
WorldLightFader
|
WorldLightFader
|
||||||
WorldTeleporter)
|
WorldTeleporter)
|
||||||
|
|
||||||
add_library(ScriptObjectsMP1
|
set(ScriptObjectsMP1_SOURCES
|
||||||
${liblist}
|
${liblist}
|
||||||
ScriptTypes.hpp
|
ScriptTypes.hpp
|
||||||
IScriptObject.cpp
|
IScriptObject.cpp
|
||||||
Parameters.cpp)
|
Parameters.cpp)
|
||||||
|
|
||||||
|
dataspec_add_list(ScriptObjects ScriptObjectsMP1_SOURCES)
|
||||||
|
|
|
@ -10,7 +10,7 @@ make_dnalist(liblist
|
||||||
PTLA
|
PTLA
|
||||||
SAVW
|
SAVW
|
||||||
DeafBabe)
|
DeafBabe)
|
||||||
add_library(DNAMP2
|
set(DNAMP2_SOURCES
|
||||||
DNAMP2.hpp DNAMP2.cpp
|
DNAMP2.hpp DNAMP2.cpp
|
||||||
${liblist}
|
${liblist}
|
||||||
ANIM.cpp
|
ANIM.cpp
|
||||||
|
@ -22,3 +22,5 @@ add_library(DNAMP2
|
||||||
MAPA.hpp
|
MAPA.hpp
|
||||||
AFSM.hpp
|
AFSM.hpp
|
||||||
STRG.hpp STRG.cpp)
|
STRG.hpp STRG.cpp)
|
||||||
|
|
||||||
|
dataspec_add_list(DNAMP2 DNAMP2_SOURCES)
|
||||||
|
|
|
@ -10,7 +10,7 @@ make_dnalist(liblist
|
||||||
SAVW
|
SAVW
|
||||||
CAUD
|
CAUD
|
||||||
HINT)
|
HINT)
|
||||||
add_library(DNAMP3
|
set(DNAMP3_SOURCES
|
||||||
DNAMP3.hpp DNAMP3.cpp
|
DNAMP3.hpp DNAMP3.cpp
|
||||||
${liblist}
|
${liblist}
|
||||||
PAK.cpp
|
PAK.cpp
|
||||||
|
@ -22,3 +22,5 @@ add_library(DNAMP3
|
||||||
STRG.hpp STRG.cpp
|
STRG.hpp STRG.cpp
|
||||||
MAPA.hpp
|
MAPA.hpp
|
||||||
MREA.cpp)
|
MREA.cpp)
|
||||||
|
|
||||||
|
dataspec_add_list(DNAMP3 DNAMP3_SOURCES)
|
||||||
|
|
|
@ -39,8 +39,7 @@ target_link_libraries(urde
|
||||||
UrdeIcons
|
UrdeIcons
|
||||||
UrdeBadging
|
UrdeBadging
|
||||||
RuntimeCommon
|
RuntimeCommon
|
||||||
DNAMP3 DNAMP2 DNAMP1
|
specter specter-fonts freetype ${DATA_SPEC_LIBS}
|
||||||
DNACommon specter specter-fonts freetype ${DATA_SPEC_LIBS}
|
|
||||||
hecl-common hecl-blender-addon
|
hecl-common hecl-blender-addon
|
||||||
athena-core nod logvisor athena-libyaml amuse boo ${PNG_LIB} libjpeg-turbo squish xxhash zeus
|
athena-core nod logvisor athena-libyaml amuse boo ${PNG_LIB} libjpeg-turbo squish xxhash zeus
|
||||||
kabufuda ${ZLIB_LIBRARIES} ${LZO_LIB}
|
kabufuda ${ZLIB_LIBRARIES} ${LZO_LIB}
|
||||||
|
|
Loading…
Reference in New Issue