SpecMP3: Fix MP1 Wii fe extraction

This commit is contained in:
Luke Street 2020-09-17 19:08:45 -04:00
parent 25dabe8bc3
commit b2573db3a3
1 changed files with 22 additions and 16 deletions

View File

@ -99,6 +99,7 @@ struct SpecMP3 : SpecBase {
hecl::ProjectPath m_workPath; hecl::ProjectPath m_workPath;
hecl::ProjectPath m_cookPath; hecl::ProjectPath m_cookPath;
hecl::ProjectPath m_outPath;
PAKRouter<DNAMP3::PAKBridge> m_pakRouter; PAKRouter<DNAMP3::PAKBridge> m_pakRouter;
/* These are populated when extracting MPT's frontend (uses MP3's DataSpec) */ /* These are populated when extracting MPT's frontend (uses MP3's DataSpec) */
@ -109,6 +110,7 @@ struct SpecMP3 : SpecBase {
hecl::ProjectPath m_feWorkPath; hecl::ProjectPath m_feWorkPath;
hecl::ProjectPath m_feCookPath; hecl::ProjectPath m_feCookPath;
hecl::ProjectPath m_feOutPath;
PAKRouter<DNAMP3::PAKBridge> m_fePakRouter; PAKRouter<DNAMP3::PAKBridge> m_fePakRouter;
SpecMP3(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc) SpecMP3(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
@ -386,8 +388,8 @@ struct SpecMP3 : SpecBase {
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out")); hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outPath.makeDir(); outPath.makeDir();
disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx); disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx);
hecl::ProjectPath mp3OutPath(outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/MP3")); m_outPath = {outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/MP3")};
mp3OutPath.makeDirChain(true); m_outPath.makeDirChain(true);
currentTarget = _SYS_STR("MP3 Root"); currentTarget = _SYS_STR("MP3 Root");
progress.print(currentTarget.c_str(), _SYS_STR(""), 0.0); progress.print(currentTarget.c_str(), _SYS_STR(""), 0.0);
@ -396,7 +398,7 @@ struct SpecMP3 : SpecBase {
nodeCount = m_nonPaks.size(); nodeCount = m_nonPaks.size();
// TODO: Make this more granular // TODO: Make this more granular
for (const nod::Node* node : m_nonPaks) { for (const nod::Node* node : m_nonPaks) {
node->extractToDirectory(mp3OutPath.getAbsolutePath(), ctx); node->extractToDirectory(m_outPath.getAbsolutePath(), ctx);
prog++; prog++;
} }
ctx.progressCB = nullptr; ctx.progressCB = nullptr;
@ -438,8 +440,8 @@ struct SpecMP3 : SpecBase {
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out")); hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outPath.makeDir(); outPath.makeDir();
disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx); disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx);
hecl::ProjectPath feOutPath(outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/fe")); m_feOutPath = {outPath, _SYS_STR("files/fe")};
feOutPath.makeDirChain(true); m_feOutPath.makeDirChain(true);
currentTarget = _SYS_STR("fe Root"); currentTarget = _SYS_STR("fe Root");
progress.print(currentTarget.c_str(), _SYS_STR(""), 0.0); progress.print(currentTarget.c_str(), _SYS_STR(""), 0.0);
@ -448,7 +450,7 @@ struct SpecMP3 : SpecBase {
// TODO: Make this more granular // TODO: Make this more granular
for (const nod::Node* node : m_feNonPaks) { for (const nod::Node* node : m_feNonPaks) {
node->extractToDirectory(feOutPath.getAbsolutePath(), ctx); node->extractToDirectory(m_feOutPath.getAbsolutePath(), ctx);
prog++; prog++;
} }
progress.print(currentTarget.c_str(), _SYS_STR(""), 1.0); progress.print(currentTarget.c_str(), _SYS_STR(""), 1.0);
@ -475,18 +477,22 @@ struct SpecMP3 : SpecBase {
process.waitUntilComplete(); 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 */ /* Generate Texture Cache containing meta data for every texture file */
TextureCache::Generate(m_pakRouter, m_project, noAramPath); if (doMP3) {
/* Write version data */ hecl::ProjectPath noAramPath(m_workPath, _SYS_STR("URDE"));
hecl::ProjectPath versionPath; TextureCache::Generate(m_pakRouter, m_project, noAramPath);
if (m_standalone) { }
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files")); if (doMPTFE) {
} else { hecl::ProjectPath noAramPath(m_feWorkPath, _SYS_STR("URDE"));
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files/MP3")); TextureCache::Generate(m_fePakRouter, m_project, noAramPath);
}
/* Write version data */
if (doMP3) {
WriteVersionInfo(m_project, m_outPath);
}
if (doMPTFE) {
WriteVersionInfo(m_project, m_feOutPath);
} }
WriteVersionInfo(m_project, versionPath);
return true; return true;
} }