2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 01:07:43 +00:00

Add output callbacks to NODLib contexts

This commit is contained in:
2015-09-28 22:17:54 -07:00
parent 34e0361bc1
commit 6d6deff2a2
4 changed files with 47 additions and 19 deletions

View File

@@ -203,7 +203,7 @@ struct SpecMP2 : SpecBase
bool extractFromDisc(NOD::DiscBase&, bool force, FExtractProgress progress)
{
NOD::ExtractionContext ctx = {false, force, nullptr};
NOD::ExtractionContext ctx = {true, force, nullptr};
progress(_S("Indexing PAKs"), _S(""), 2, 0.0);
m_pakRouter.build(m_paks, [&progress](float factor)
{
@@ -214,11 +214,14 @@ struct SpecMP2 : SpecBase
m_workPath.makeDir();
progress(_S("MP2 Root"), _S(""), 3, 0.0);
int prog = 0;
ctx.progressCB = [&](const std::string& name) {
HECL::SystemStringView nameView(name);
progress(_S("MP2 Root"), nameView.sys_str().c_str(), 3, prog / (float)m_nonPaks.size());
};
for (const NOD::DiscBase::IPartition::Node* node : m_nonPaks)
{
node->extractToDirectory(m_workPath.getAbsolutePath(), ctx);
HECL::SystemStringView nameView(node->getName());
progress(_S("MP2 Root"), nameView.sys_str().c_str(), 3, prog++ / (float)m_nonPaks.size());
prog++;
}
progress(_S("MP2 Root"), _S(""), 3, 1.0);