mirror of https://github.com/AxioDL/metaforce.git
Better progress logging
This commit is contained in:
parent
5fb8287d50
commit
416f085448
|
@ -323,7 +323,8 @@ public:
|
||||||
return m_pak->bestEntryName(*e);
|
return m_pak->bestEntryName(*e);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool extractResources(const BRIDGETYPE& pakBridge, bool force, std::function<void(float)> progress)
|
bool extractResources(const BRIDGETYPE& pakBridge, bool force,
|
||||||
|
std::function<void(const HECL::SystemChar*, float)> progress)
|
||||||
{
|
{
|
||||||
enterPAKBridge(pakBridge);
|
enterPAKBridge(pakBridge);
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
@ -337,6 +338,9 @@ public:
|
||||||
if (extractor.weight != w)
|
if (extractor.weight != w)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
HECL::SystemStringView bestName(getBestEntryName(*item.second));
|
||||||
|
progress(bestName.sys_str().c_str(), ++count / fsz);
|
||||||
|
|
||||||
HECL::ProjectPath cooked = getCooked(item.second);
|
HECL::ProjectPath cooked = getCooked(item.second);
|
||||||
if (force || cooked.getPathType() == HECL::ProjectPath::PT_NONE)
|
if (force || cooked.getPathType() == HECL::ProjectPath::PT_NONE)
|
||||||
{
|
{
|
||||||
|
@ -363,8 +367,6 @@ public:
|
||||||
extractor.func_b(m_dataSpec, s, working, *this, *item.second, force);
|
extractor.func_b(m_dataSpec, s, working, *this, *item.second, force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
progress(++count / fsz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,20 +56,20 @@ void SpecBase::doExtract(const ExtractPassInfo& info, FExtractProgress progress)
|
||||||
NOD::DiscBase::IPartition* update = m_disc->getUpdatePartition();
|
NOD::DiscBase::IPartition* update = m_disc->getUpdatePartition();
|
||||||
if (update)
|
if (update)
|
||||||
{
|
{
|
||||||
progress(_S("Update Partition"), 0, 0.0);
|
progress(_S("Update Partition"), _S(""), 0, 0.0);
|
||||||
update->getFSTRoot().extractToDirectory(target, info.force);
|
update->getFSTRoot().extractToDirectory(target, info.force);
|
||||||
progress(_S("Update Partition"), 0, 1.0);
|
progress(_S("Update Partition"), _S(""), 0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_standalone)
|
if (!m_standalone)
|
||||||
{
|
{
|
||||||
progress(_S("Trilogy Files"), 1, 0.0);
|
progress(_S("Trilogy Files"), _S(""), 1, 0.0);
|
||||||
NOD::DiscBase::IPartition* data = m_disc->getDataPartition();
|
NOD::DiscBase::IPartition* data = m_disc->getDataPartition();
|
||||||
const NOD::DiscBase::IPartition::Node& root = data->getFSTRoot();
|
const NOD::DiscBase::IPartition::Node& root = data->getFSTRoot();
|
||||||
for (const NOD::DiscBase::IPartition::Node& child : root)
|
for (const NOD::DiscBase::IPartition::Node& child : root)
|
||||||
if (child.getKind() == NOD::DiscBase::IPartition::Node::NODE_FILE)
|
if (child.getKind() == NOD::DiscBase::IPartition::Node::NODE_FILE)
|
||||||
child.extractToDirectory(target, info.force);
|
child.extractToDirectory(target, info.force);
|
||||||
progress(_S("Trilogy Files"), 1, 1.0);
|
progress(_S("Trilogy Files"), _S(""), 1, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extractFromDisc(*m_disc, info.force, progress);
|
extractFromDisc(*m_disc, info.force, progress);
|
||||||
|
|
|
@ -206,22 +206,23 @@ struct SpecMP1 : SpecBase
|
||||||
|
|
||||||
bool extractFromDisc(NOD::DiscBase&, bool force, FExtractProgress progress)
|
bool extractFromDisc(NOD::DiscBase&, bool force, FExtractProgress progress)
|
||||||
{
|
{
|
||||||
progress(_S("Indexing PAKs"), 2, 0.0);
|
progress(_S("Indexing PAKs"), _S(""), 2, 0.0);
|
||||||
m_pakRouter.build(m_paks, [&progress](float factor)
|
m_pakRouter.build(m_paks, [&progress](float factor)
|
||||||
{
|
{
|
||||||
progress(_S("Indexing PAKs"), 2, factor);
|
progress(_S("Indexing PAKs"), _S(""), 2, factor);
|
||||||
});
|
});
|
||||||
progress(_S("Indexing PAKs"), 2, 1.0);
|
progress(_S("Indexing PAKs"), _S(""), 2, 1.0);
|
||||||
|
|
||||||
m_workPath.makeDir();
|
m_workPath.makeDir();
|
||||||
progress(_S("MP1 Root"), 3, 0.0);
|
progress(_S("MP1 Root"), _S(""), 3, 0.0);
|
||||||
int prog = 0;
|
int prog = 0;
|
||||||
for (const NOD::DiscBase::IPartition::Node* node : m_nonPaks)
|
for (const NOD::DiscBase::IPartition::Node* node : m_nonPaks)
|
||||||
{
|
{
|
||||||
node->extractToDirectory(m_workPath.getAbsolutePath(), force);
|
node->extractToDirectory(m_workPath.getAbsolutePath(), force);
|
||||||
progress(_S("MP1 Root"), 3, prog++ / (float)m_nonPaks.size());
|
HECL::SystemStringView nameView(node->getName());
|
||||||
|
progress(_S("MP1 Root"), nameView.sys_str().c_str(), 3, prog++ / (float)m_nonPaks.size());
|
||||||
}
|
}
|
||||||
progress(_S("MP1 Root"), 3, 1.0);
|
progress(_S("MP1 Root"), _S(""), 3, 1.0);
|
||||||
|
|
||||||
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP1);
|
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP1);
|
||||||
cookPath.makeDir();
|
cookPath.makeDir();
|
||||||
|
@ -235,13 +236,13 @@ struct SpecMP1 : SpecBase
|
||||||
const std::string& name = pak.getName();
|
const std::string& name = pak.getName();
|
||||||
HECL::SystemStringView sysName(name);
|
HECL::SystemStringView sysName(name);
|
||||||
|
|
||||||
progress(sysName.sys_str().c_str(), compIdx, 0.0);
|
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||||
m_pakRouter.extractResources(pak, force,
|
m_pakRouter.extractResources(pak, force,
|
||||||
[&progress, &sysName, &compIdx](float factor)
|
[&progress, &sysName, &compIdx](const HECL::SystemChar* substr, float factor)
|
||||||
{
|
{
|
||||||
progress(sysName.sys_str().c_str(), compIdx, factor);
|
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||||
});
|
});
|
||||||
progress(sysName.sys_str().c_str(), compIdx++, 1.0);
|
progress(sysName.sys_str().c_str(), _S(""), compIdx++, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -203,22 +203,23 @@ struct SpecMP2 : SpecBase
|
||||||
|
|
||||||
bool extractFromDisc(NOD::DiscBase&, bool force, FExtractProgress progress)
|
bool extractFromDisc(NOD::DiscBase&, bool force, FExtractProgress progress)
|
||||||
{
|
{
|
||||||
progress(_S("Indexing PAKs"), 2, 0.0);
|
progress(_S("Indexing PAKs"), _S(""), 2, 0.0);
|
||||||
m_pakRouter.build(m_paks, [&progress](float factor)
|
m_pakRouter.build(m_paks, [&progress](float factor)
|
||||||
{
|
{
|
||||||
progress(_S("Indexing PAKs"), 2, factor);
|
progress(_S("Indexing PAKs"), _S(""), 2, factor);
|
||||||
});
|
});
|
||||||
progress(_S("Indexing PAKs"), 2, 1.0);
|
progress(_S("Indexing PAKs"), _S(""), 2, 1.0);
|
||||||
|
|
||||||
m_workPath.makeDir();
|
m_workPath.makeDir();
|
||||||
progress(_S("MP2 Root"), 3, 0.0);
|
progress(_S("MP2 Root"), _S(""), 3, 0.0);
|
||||||
int prog = 0;
|
int prog = 0;
|
||||||
for (const NOD::DiscBase::IPartition::Node* node : m_nonPaks)
|
for (const NOD::DiscBase::IPartition::Node* node : m_nonPaks)
|
||||||
{
|
{
|
||||||
node->extractToDirectory(m_workPath.getAbsolutePath(), force);
|
node->extractToDirectory(m_workPath.getAbsolutePath(), force);
|
||||||
progress(_S("MP2 Root"), 3, prog++ / (float)m_nonPaks.size());
|
HECL::SystemStringView nameView(node->getName());
|
||||||
|
progress(_S("MP2 Root"), nameView.sys_str().c_str(), 3, prog++ / (float)m_nonPaks.size());
|
||||||
}
|
}
|
||||||
progress(_S("MP2 Root"), 3, 1.0);
|
progress(_S("MP2 Root"), _S(""), 3, 1.0);
|
||||||
|
|
||||||
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP2);
|
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP2);
|
||||||
cookPath.makeDir();
|
cookPath.makeDir();
|
||||||
|
@ -232,13 +233,13 @@ struct SpecMP2 : SpecBase
|
||||||
const std::string& name = pak.getName();
|
const std::string& name = pak.getName();
|
||||||
HECL::SystemStringView sysName(name);
|
HECL::SystemStringView sysName(name);
|
||||||
|
|
||||||
progress(sysName.sys_str().c_str(), compIdx, 0.0);
|
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||||
m_pakRouter.extractResources(pak, force,
|
m_pakRouter.extractResources(pak, force,
|
||||||
[&progress, &sysName, &compIdx](float factor)
|
[&progress, &sysName, &compIdx](const HECL::SystemChar* substr, float factor)
|
||||||
{
|
{
|
||||||
progress(sysName.sys_str().c_str(), compIdx, factor);
|
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||||
});
|
});
|
||||||
progress(sysName.sys_str().c_str(), compIdx++, 1.0);
|
progress(sysName.sys_str().c_str(), _S(""), compIdx++, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -311,23 +311,24 @@ struct SpecMP3 : SpecBase
|
||||||
int prog;
|
int prog;
|
||||||
if (doMP3)
|
if (doMP3)
|
||||||
{
|
{
|
||||||
progress(_S("Indexing PAKs"), compIdx, 0.0);
|
progress(_S("Indexing PAKs"), _S(""), compIdx, 0.0);
|
||||||
m_pakRouter.build(m_paks, [&progress, &compIdx](float factor)
|
m_pakRouter.build(m_paks, [&progress, &compIdx](float factor)
|
||||||
{
|
{
|
||||||
progress(_S("Indexing PAKs"), compIdx, factor);
|
progress(_S("Indexing PAKs"), _S(""), compIdx, factor);
|
||||||
});
|
});
|
||||||
progress(_S("Indexing PAKs"), compIdx++, 1.0);
|
progress(_S("Indexing PAKs"), _S(""), compIdx++, 1.0);
|
||||||
|
|
||||||
HECL::ProjectPath mp3WorkPath(m_project.getProjectRootPath(), "MP3");
|
HECL::ProjectPath mp3WorkPath(m_project.getProjectRootPath(), "MP3");
|
||||||
mp3WorkPath.makeDir();
|
mp3WorkPath.makeDir();
|
||||||
progress(_S("MP3 Root"), compIdx, 0.0);
|
progress(_S("MP3 Root"), _S(""), compIdx, 0.0);
|
||||||
prog = 0;
|
prog = 0;
|
||||||
for (const NOD::DiscBase::IPartition::Node* node : m_nonPaks)
|
for (const NOD::DiscBase::IPartition::Node* node : m_nonPaks)
|
||||||
{
|
{
|
||||||
node->extractToDirectory(mp3WorkPath.getAbsolutePath(), force);
|
node->extractToDirectory(mp3WorkPath.getAbsolutePath(), force);
|
||||||
progress(_S("MP3 Root"), compIdx, prog++ / (float)m_nonPaks.size());
|
HECL::SystemStringView nameView(node->getName());
|
||||||
|
progress(_S("MP3 Root"), nameView.sys_str().c_str(), compIdx, prog++ / (float)m_nonPaks.size());
|
||||||
}
|
}
|
||||||
progress(_S("MP3 Root"), compIdx++, 1.0);
|
progress(_S("MP3 Root"), _S(""), compIdx++, 1.0);
|
||||||
|
|
||||||
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP3);
|
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP3);
|
||||||
cookPath.makeDir();
|
cookPath.makeDir();
|
||||||
|
@ -343,34 +344,35 @@ struct SpecMP3 : SpecBase
|
||||||
const std::string& name = pak.getName();
|
const std::string& name = pak.getName();
|
||||||
HECL::SystemStringView sysName(name);
|
HECL::SystemStringView sysName(name);
|
||||||
|
|
||||||
progress(sysName.sys_str().c_str(), compIdx, 0.0);
|
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||||
m_pakRouter.extractResources(pak, force,
|
m_pakRouter.extractResources(pak, force,
|
||||||
[&progress, &sysName, &compIdx](float factor)
|
[&progress, &sysName, &compIdx](const HECL::SystemChar* substr, float factor)
|
||||||
{
|
{
|
||||||
progress(sysName.sys_str().c_str(), compIdx, factor);
|
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||||
});
|
});
|
||||||
progress(sysName.sys_str().c_str(), compIdx++, 1.0);
|
progress(sysName.sys_str().c_str(), _S(""), compIdx++, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doMPTFE)
|
if (doMPTFE)
|
||||||
{
|
{
|
||||||
progress(_S("Indexing PAKs"), compIdx, 0.0);
|
progress(_S("Indexing PAKs"), _S(""), compIdx, 0.0);
|
||||||
m_fePakRouter.build(m_fePaks, [&progress, &compIdx](float factor)
|
m_fePakRouter.build(m_fePaks, [&progress, &compIdx](float factor)
|
||||||
{
|
{
|
||||||
progress(_S("Indexing PAKs"), compIdx, factor);
|
progress(_S("Indexing PAKs"), _S(""), compIdx, factor);
|
||||||
});
|
});
|
||||||
progress(_S("Indexing PAKs"), compIdx++, 1.0);
|
progress(_S("Indexing PAKs"), _S(""), compIdx++, 1.0);
|
||||||
|
|
||||||
m_feWorkPath.makeDir();
|
m_feWorkPath.makeDir();
|
||||||
progress(_S("fe Root"), compIdx, 0.0);
|
progress(_S("fe Root"), _S(""), compIdx, 0.0);
|
||||||
int prog = 0;
|
int prog = 0;
|
||||||
for (const NOD::DiscBase::IPartition::Node* node : m_feNonPaks)
|
for (const NOD::DiscBase::IPartition::Node* node : m_feNonPaks)
|
||||||
{
|
{
|
||||||
node->extractToDirectory(m_feWorkPath.getAbsolutePath(), force);
|
node->extractToDirectory(m_feWorkPath.getAbsolutePath(), force);
|
||||||
progress(_S("fe Root"), compIdx, prog++ / (float)m_feNonPaks.size());
|
HECL::SystemStringView nameView(node->getName());
|
||||||
|
progress(_S("fe Root"), nameView.sys_str().c_str(), compIdx, prog++ / (float)m_feNonPaks.size());
|
||||||
}
|
}
|
||||||
progress(_S("fe Root"), compIdx++, 1.0);
|
progress(_S("fe Root"), _S(""), compIdx++, 1.0);
|
||||||
|
|
||||||
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP3);
|
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP3);
|
||||||
cookPath.makeDir();
|
cookPath.makeDir();
|
||||||
|
@ -383,13 +385,13 @@ struct SpecMP3 : SpecBase
|
||||||
const std::string& name = pak.getName();
|
const std::string& name = pak.getName();
|
||||||
HECL::SystemStringView sysName(name);
|
HECL::SystemStringView sysName(name);
|
||||||
|
|
||||||
progress(sysName.sys_str().c_str(), compIdx, 0.0);
|
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||||
m_fePakRouter.extractResources(pak, force,
|
m_fePakRouter.extractResources(pak, force,
|
||||||
[&progress, &sysName, &compIdx](float factor)
|
[&progress, &sysName, &compIdx](const HECL::SystemChar* substr, float factor)
|
||||||
{
|
{
|
||||||
progress(sysName.sys_str().c_str(), compIdx, factor);
|
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||||
});
|
});
|
||||||
progress(sysName.sys_str().c_str(), compIdx++, 1.0);
|
progress(sysName.sys_str().c_str(), _S(""), compIdx++, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit c903c3cb44479c4189195057a5dc6dc5fe4037e5
|
Subproject commit c35b8b9998c23778e43a4a386d05aed59097439a
|
Loading…
Reference in New Issue