mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:44:56 +00:00
Add version info to extracted data, clean up MP1.*
This commit is contained in:
@@ -75,18 +75,20 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
|
||||
if (m_standalone && !checkStandaloneID(gameID))
|
||||
return false;
|
||||
|
||||
char region = m_disc->getHeader().m_gameID[3];
|
||||
m_region = ERegion(m_disc->getHeader().m_gameID[3]);
|
||||
const hecl::SystemString* regstr = ®NONE;
|
||||
switch (region) {
|
||||
case 'E':
|
||||
switch (m_region) {
|
||||
case ERegion::NTSC_U:
|
||||
regstr = ®E;
|
||||
break;
|
||||
case 'J':
|
||||
case ERegion::PAL:
|
||||
regstr = ®J;
|
||||
break;
|
||||
case 'P':
|
||||
case ERegion::NTSC_J:
|
||||
regstr = ®P;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_standalone)
|
||||
@@ -1206,4 +1208,15 @@ void SpecBase::waitForIndexComplete() const {
|
||||
}
|
||||
}
|
||||
|
||||
void SpecBase::WriteVersionInfo(hecl::Database::Project &project, const hecl::ProjectPath &pakPath) {
|
||||
hecl::ProjectPath versionPath(pakPath, _SYS_STR("version.yaml"));
|
||||
versionPath.makeDirChain(false);
|
||||
|
||||
athena::io::YAMLDocWriter yamlW("URDEVersionData");
|
||||
yamlW.writeString("version", m_version);
|
||||
yamlW.writeByte("region", atUint8(m_region));
|
||||
yamlW.writeBool("is_trilogy", !m_standalone);
|
||||
athena::io::FileWriter fileW(versionPath.getAbsolutePath());
|
||||
yamlW.finish(&fileW);
|
||||
}
|
||||
} // namespace DataSpec
|
||||
|
||||
@@ -23,6 +23,12 @@ class YAMLDocWriter;
|
||||
} // namespace athena::io
|
||||
|
||||
namespace DataSpec {
|
||||
enum class ERegion {
|
||||
Invalid = 0,
|
||||
NTSC_U = 'E',
|
||||
PAL = 'P',
|
||||
NTSC_J = 'J'
|
||||
};
|
||||
|
||||
struct SpecBase : hecl::Database::IDataSpec {
|
||||
/* HECL Adaptors */
|
||||
@@ -199,6 +205,10 @@ protected:
|
||||
std::unique_ptr<nod::DiscBase> m_disc;
|
||||
bool m_isWii;
|
||||
bool m_standalone;
|
||||
ERegion m_region = ERegion::Invalid;
|
||||
std::string m_version;
|
||||
|
||||
void WriteVersionInfo(hecl::Database::Project& project, const hecl::ProjectPath& pakPath);
|
||||
};
|
||||
|
||||
bool IsPathAudioGroup(const hecl::ProjectPath& path);
|
||||
|
||||
@@ -63,7 +63,8 @@ extern hecl::Database::DataSpecEntry SpecEntMP1PC;
|
||||
extern hecl::Database::DataSpecEntry SpecEntMP1ORIG;
|
||||
|
||||
struct TextureCache {
|
||||
static void Generate(PAKRouter<DNAMP1::PAKBridge>& pakRouter, hecl::Database::Project& project, const hecl::ProjectPath& pakPath) {
|
||||
static void Generate(PAKRouter<DNAMP1::PAKBridge>& pakRouter, hecl::Database::Project& project,
|
||||
const hecl::ProjectPath& pakPath) {
|
||||
hecl::ProjectPath texturePath(pakPath, _SYS_STR("texture_cache.yaml"));
|
||||
hecl::ProjectPath catalogPath(pakPath, _SYS_STR("!catalog.yaml"));
|
||||
texturePath.makeDirChain(false);
|
||||
@@ -112,9 +113,8 @@ struct TextureCache {
|
||||
metaPairs.emplace_back(projectPath.parsedHash32(), meta);
|
||||
}
|
||||
|
||||
std::sort(metaPairs.begin(), metaPairs.end(), [](const auto& a, const auto& b) -> bool {
|
||||
return a.first < b.first;
|
||||
});
|
||||
std::sort(metaPairs.begin(), metaPairs.end(),
|
||||
[](const auto& a, const auto& b) -> bool { return a.first < b.first; });
|
||||
|
||||
athena::io::FileWriter w(outPath.getAbsolutePath());
|
||||
w.writeUint32Big(metaPairs.size());
|
||||
@@ -223,13 +223,13 @@ struct SpecMP1 : SpecBase {
|
||||
if (!buildInfo)
|
||||
return false;
|
||||
|
||||
m_version = std::string(buildInfo);
|
||||
/* Root Report */
|
||||
ExtractReport& rep = reps.emplace_back();
|
||||
rep.name = _SYS_STR("MP1");
|
||||
rep.desc = _SYS_STR("Metroid Prime ") + regstr;
|
||||
if (buildInfo) {
|
||||
std::string buildStr(buildInfo);
|
||||
hecl::SystemStringConv buildView(buildStr);
|
||||
hecl::SystemStringConv buildView(m_version);
|
||||
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
|
||||
}
|
||||
|
||||
@@ -378,6 +378,14 @@ struct SpecMP1 : SpecBase {
|
||||
/* Generate Texture Cache containing meta data for every texture file */
|
||||
TextureCache::Generate(m_pakRouter, m_project, noAramPath);
|
||||
|
||||
/* Write version data */
|
||||
hecl::ProjectPath versionPath;
|
||||
if (m_standalone) {
|
||||
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files"));
|
||||
} else {
|
||||
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files/MP1"));
|
||||
}
|
||||
WriteVersionInfo(m_project, versionPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -740,7 +748,8 @@ struct SpecMP1 : SpecBase {
|
||||
}
|
||||
|
||||
if (!colMesh)
|
||||
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find mesh named 'CMESH' in {}")), in.getAbsolutePath());
|
||||
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find mesh named 'CMESH' in {}")),
|
||||
in.getAbsolutePath());
|
||||
|
||||
std::vector<Light> lights = ds.compileLights();
|
||||
|
||||
@@ -1131,7 +1140,8 @@ struct SpecMP1 : SpecBase {
|
||||
}
|
||||
|
||||
void buildPakList(hecl::blender::Token& btok, athena::io::FileWriter& w, const std::vector<urde::SObjectTag>& list,
|
||||
const std::vector<std::pair<urde::SObjectTag, std::string>>& nameList, atUint64& resTableOffset) override {
|
||||
const std::vector<std::pair<urde::SObjectTag, std::string>>& nameList,
|
||||
atUint64& resTableOffset) override {
|
||||
w.writeUint32Big(m_pc ? 0x80030005 : 0x00030005);
|
||||
w.writeUint32Big(0);
|
||||
|
||||
|
||||
@@ -187,12 +187,12 @@ struct SpecMP2 : SpecBase {
|
||||
if (!buildInfo)
|
||||
return false;
|
||||
|
||||
m_version = std::string(buildInfo);
|
||||
/* Root Report */
|
||||
ExtractReport& rep = reps.emplace_back();
|
||||
rep.name = _SYS_STR("MP2");
|
||||
rep.desc = _SYS_STR("Metroid Prime 2 ") + regstr;
|
||||
std::string buildStr(buildInfo);
|
||||
hecl::SystemStringConv buildView(buildStr);
|
||||
hecl::SystemStringConv buildView(m_version);
|
||||
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
|
||||
|
||||
/* Iterate PAKs and build level options */
|
||||
@@ -317,6 +317,14 @@ struct SpecMP2 : SpecBase {
|
||||
hecl::ProjectPath noAramPath(m_project.getProjectWorkingPath(), _SYS_STR("MP2/URDE"));
|
||||
TextureCache::Generate(m_pakRouter, m_project, noAramPath);
|
||||
|
||||
/* Write version data */
|
||||
hecl::ProjectPath versionPath;
|
||||
if (m_standalone) {
|
||||
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files"));
|
||||
} else {
|
||||
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files/MP2"));
|
||||
}
|
||||
WriteVersionInfo(m_project, versionPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -231,12 +231,12 @@ struct SpecMP3 : SpecBase {
|
||||
if (!strcmp(buildInfo, "Build v3.068 3/2/2006 14:55:13"))
|
||||
return false;
|
||||
|
||||
m_version = std::string(buildInfo);
|
||||
/* Root Report */
|
||||
ExtractReport& rep = reps.emplace_back();
|
||||
rep.name = _SYS_STR("MP3");
|
||||
rep.desc = _SYS_STR("Metroid Prime 3 ") + regstr;
|
||||
std::string buildStr(buildInfo);
|
||||
hecl::SystemStringConv buildView(buildStr);
|
||||
hecl::SystemStringConv buildView(m_version);
|
||||
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
|
||||
|
||||
/* Iterate PAKs and build level options */
|
||||
@@ -473,12 +473,20 @@ struct SpecMP3 : SpecBase {
|
||||
}
|
||||
|
||||
process.waitUntilComplete();
|
||||
|
||||
/* Extract part of .dol for RandomStatic entropy */
|
||||
hecl::ProjectPath noAramPath(m_project.getProjectWorkingPath(), _SYS_STR("MP3/URDE"));
|
||||
/* Generate Texture Cache containing meta data for every texture file */
|
||||
TextureCache::Generate(m_pakRouter, m_project, noAramPath);
|
||||
}
|
||||
|
||||
/* Extract part of .dol for RandomStatic entropy */
|
||||
hecl::ProjectPath noAramPath(m_project.getProjectWorkingPath(), _SYS_STR("MP3/URDE"));
|
||||
/* Generate Texture Cache containing meta data for every texture file */
|
||||
TextureCache::Generate(m_pakRouter, m_project, noAramPath);
|
||||
/* Write version data */
|
||||
hecl::ProjectPath versionPath;
|
||||
if (m_standalone) {
|
||||
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files"));
|
||||
} else {
|
||||
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files/MP3"));
|
||||
}
|
||||
WriteVersionInfo(m_project, versionPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user