mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:44:56 +00:00
Various windows fixes and additions
This commit is contained in:
@@ -1223,6 +1223,11 @@ void EESimpleEmitterTR::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
||||
velocity.write(w);
|
||||
}
|
||||
|
||||
template <>
|
||||
const char* UVEConstant<UniqueID32>::DNAType() { return "UVEConstant<UniqueID32>"; }
|
||||
template <>
|
||||
const char* UVEConstant<UniqueID64>::DNAType() { return "UVEConstant<UniqueID64>"; }
|
||||
|
||||
template <class IDType>
|
||||
void UVEConstant<IDType>::_read(typename ReadYaml::StreamT& r)
|
||||
{
|
||||
@@ -1264,6 +1269,11 @@ AT_SUBSPECIALIZE_DNA_YAML(UVEConstant<UniqueID64>)
|
||||
template struct UVEConstant<UniqueID32>;
|
||||
template struct UVEConstant<UniqueID64>;
|
||||
|
||||
template <>
|
||||
const char* UVEAnimTexture<UniqueID32>::DNAType() { return "UVEAnimTexture<UniqueID32>"; }
|
||||
template <>
|
||||
const char* UVEAnimTexture<UniqueID64>::DNAType() { return "UVEAnimTexture<UniqueID64>"; }
|
||||
|
||||
template <class IDType>
|
||||
void UVEAnimTexture<IDType>::_read(typename ReadYaml::StreamT& r)
|
||||
{
|
||||
@@ -1348,6 +1358,11 @@ AT_SUBSPECIALIZE_DNA_YAML(UVEAnimTexture<UniqueID64>)
|
||||
template struct UVEAnimTexture<UniqueID32>;
|
||||
template struct UVEAnimTexture<UniqueID64>;
|
||||
|
||||
template <>
|
||||
const char* UVElementFactory<UniqueID32>::DNAType() { return "UVElementFactory<UniqueID32>"; }
|
||||
template <>
|
||||
const char* UVElementFactory<UniqueID64>::DNAType() { return "UVElementFactory<UniqueID64>"; }
|
||||
|
||||
template <class IDType>
|
||||
void UVElementFactory<IDType>::_read(typename Read::StreamT& r)
|
||||
{
|
||||
@@ -1415,6 +1430,13 @@ AT_SUBSPECIALIZE_DNA_YAML(UVElementFactory<UniqueID64>)
|
||||
template struct UVElementFactory<UniqueID32>;
|
||||
template struct UVElementFactory<UniqueID64>;
|
||||
|
||||
template <>
|
||||
const char* SpawnSystemKeyframeData<UniqueID32>::SpawnSystemKeyframeInfo::DNAType()
|
||||
{ return "SpawnSystemKeyframeData<UniqueID32>::SpawnSystemKeyframeInfo"; }
|
||||
template <>
|
||||
const char* SpawnSystemKeyframeData<UniqueID64>::SpawnSystemKeyframeInfo::DNAType()
|
||||
{ return "SpawnSystemKeyframeData<UniqueID64>::SpawnSystemKeyframeInfo"; }
|
||||
|
||||
template <class IDType>
|
||||
template <class Op>
|
||||
void SpawnSystemKeyframeData<IDType>::SpawnSystemKeyframeInfo::Enumerate(typename Op::StreamT& s)
|
||||
@@ -1425,6 +1447,11 @@ void SpawnSystemKeyframeData<IDType>::SpawnSystemKeyframeInfo::Enumerate(typenam
|
||||
Do<Op>({"c"}, c, s);
|
||||
}
|
||||
|
||||
template <>
|
||||
const char* SpawnSystemKeyframeData<UniqueID32>::DNAType() { return "SpawnSystemKeyframeData<UniqueID32>"; }
|
||||
template <>
|
||||
const char* SpawnSystemKeyframeData<UniqueID64>::DNAType() { return "SpawnSystemKeyframeData<UniqueID64>"; }
|
||||
|
||||
template <class IDType>
|
||||
void SpawnSystemKeyframeData<IDType>::_read(typename ReadYaml::StreamT& r)
|
||||
{
|
||||
@@ -1559,6 +1586,11 @@ AT_SUBSPECIALIZE_DNA_YAML(SpawnSystemKeyframeData<UniqueID64>)
|
||||
template struct SpawnSystemKeyframeData<UniqueID32>;
|
||||
template struct SpawnSystemKeyframeData<UniqueID64>;
|
||||
|
||||
template <>
|
||||
const char* ChildResourceFactory<UniqueID32>::DNAType() { return "ChildResourceFactory<UniqueID32>"; }
|
||||
template <>
|
||||
const char* ChildResourceFactory<UniqueID64>::DNAType() { return "ChildResourceFactory<UniqueID64>"; }
|
||||
|
||||
template <class IDType>
|
||||
void ChildResourceFactory<IDType>::_read(typename ReadYaml::StreamT& r)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
#include "nod/nod.hpp"
|
||||
#include "hecl/Blender/Connection.hpp"
|
||||
#include "hecl/MultiProgressPrinter.hpp"
|
||||
|
||||
#include <png.h>
|
||||
|
||||
@@ -103,7 +104,7 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
|
||||
return checkFromTrilogyDisc(*m_disc, *regstr, info.extractArgs, reps);
|
||||
}
|
||||
|
||||
void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
|
||||
void SpecBase::doExtract(const ExtractPassInfo& info, const hecl::MultiProgressPrinter& progress)
|
||||
{
|
||||
DataSpec::g_curSpec.reset(this);
|
||||
if (!Blender::BuildMasterShader(m_masterShader))
|
||||
@@ -117,13 +118,13 @@ void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
|
||||
|
||||
if (!m_standalone)
|
||||
{
|
||||
progress(_S("Trilogy Files"), _S(""), 1, 0.0);
|
||||
progress.print(_S("Trilogy Files"), _S(""), 0.0);
|
||||
nod::IPartition* data = m_disc->getDataPartition();
|
||||
const nod::Node& root = data->getFSTRoot();
|
||||
for (const nod::Node& child : root)
|
||||
if (child.getKind() == nod::Node::Kind::File)
|
||||
child.extractToDirectory(outDir.getAbsolutePath(), ctx);
|
||||
progress(_S("Trilogy Files"), _S(""), 1, 1.0);
|
||||
progress.print(_S("Trilogy Files"), _S(""), 1.0);
|
||||
}
|
||||
}
|
||||
extractFromDisc(*m_disc, info.force, progress);
|
||||
@@ -492,15 +493,16 @@ void SpecBase::recursiveBuildResourceList(std::vector<urde::SObjectTag>& listOut
|
||||
void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>& fileIndex,
|
||||
const std::vector<urde::SObjectTag>& buildList,
|
||||
const hecl::Database::DataSpecEntry* entry,
|
||||
bool fast, FProgress progress, athena::io::FileWriter& pakOut)
|
||||
bool fast, const hecl::MultiProgressPrinter& progress,
|
||||
athena::io::FileWriter& pakOut)
|
||||
{
|
||||
fileIndex.reserve(buildList.size());
|
||||
size_t loadIdx = 0;
|
||||
int loadIdx = 0;
|
||||
for (const auto& tag : buildList)
|
||||
{
|
||||
fprintf(stderr, "\r %" PRISize " / %" PRISize " %.4s %08X", ++loadIdx, buildList.size(),
|
||||
tag.type.getChars(), (unsigned int)tag.id.Value());
|
||||
fflush(stderr);
|
||||
hecl::SystemString str = hecl::SysFormat(_S("Copying %.4") FMT_CSTR_SYS " %08X",
|
||||
tag.type.getChars(), (unsigned int)tag.id.Value());
|
||||
progress.print(str.c_str(), nullptr, ++loadIdx / float(buildList.size()));
|
||||
|
||||
fileIndex.emplace_back();
|
||||
auto& thisIdx = fileIndex.back();
|
||||
@@ -532,11 +534,12 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
|
||||
pakOut.writeUByte(0xff);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
progress.startNewLine();
|
||||
}
|
||||
|
||||
void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::DataSpecEntry* entry,
|
||||
bool fast, hecl::blender::Token& btok, FProgress progress, hecl::ClientProcess* cp)
|
||||
bool fast, hecl::blender::Token& btok, const hecl::MultiProgressPrinter& progress,
|
||||
hecl::ClientProcess* cp)
|
||||
{
|
||||
/* Prepare complete resource index */
|
||||
if (!m_backgroundRunning && m_tagToPath.empty())
|
||||
@@ -560,7 +563,10 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
|
||||
!hecl::StrCmp(path.getLastComponent().data(), _S("!world.blend"))) /* World PAK */
|
||||
{
|
||||
/* Force-cook MLVL and write resource list structure */
|
||||
m_project.cookPath(path, progress, false, true, fast);
|
||||
m_project.cookPath(path, progress, false, true, fast, entry, cp);
|
||||
if (cp)
|
||||
cp->waitUntilComplete();
|
||||
progress.startNewLine();
|
||||
hecl::ProjectPath cooked = getCookedPath(path, true);
|
||||
buildWorldPakList(path, cooked, btok, pakOut, buildList, resTableOffset);
|
||||
if (int64_t rem = pakOut.position() % 32)
|
||||
@@ -628,12 +634,9 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
|
||||
addedTags.reserve(buildList.size());
|
||||
|
||||
Log.report(logvisor::Info, _S("Validating resources"));
|
||||
size_t loadIdx = 0;
|
||||
progress.setMainIndeterminate(true);
|
||||
for (auto& tag : buildList)
|
||||
{
|
||||
fprintf(stderr, "\r %" PRISize " / %" PRISize " %.4s %08X", ++loadIdx, buildList.size(),
|
||||
tag.type.getChars(), (unsigned int)tag.id.Value());
|
||||
fflush(stderr);
|
||||
if (addedTags.find(tag) != addedTags.end())
|
||||
continue;
|
||||
addedTags.insert(tag);
|
||||
@@ -641,15 +644,14 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
|
||||
hecl::ProjectPath depPath = pathFromTag(tag);
|
||||
if (!depPath)
|
||||
{
|
||||
fprintf(stderr, "\n");
|
||||
Log.report(logvisor::Fatal, _S("Unable to resolve %.4s %08X"),
|
||||
tag.type.getChars(), tag.id.Value());
|
||||
}
|
||||
m_project.cookPath(depPath, progress, false, false, fast, cp);
|
||||
m_project.cookPath(depPath, progress, false, false, fast, entry, cp);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
Log.report(logvisor::Info, _S("Waiting for remaining cook transactions"));
|
||||
progress.setMainIndeterminate(false);
|
||||
cp->waitUntilComplete();
|
||||
progress.startNewLine();
|
||||
}
|
||||
|
||||
/* Write resource data and build file index */
|
||||
@@ -1205,9 +1207,12 @@ void SpecBase::backgroundIndexProc()
|
||||
m_pathToTag[path.hash()] = pathTag;
|
||||
WriteTag(cacheWriter, pathTag, path);
|
||||
}
|
||||
fprintf(stderr, "\r %" PRISize " / %" PRISize, ++loadIdx, tagCount);
|
||||
|
||||
++loadIdx;
|
||||
if (!(loadIdx % 100))
|
||||
fprintf(stderr, "\r %" PRISize " / %" PRISize, loadIdx, tagCount);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "\r %" PRISize " / %" PRISize "\n", loadIdx, tagCount);
|
||||
}
|
||||
Log.report(logvisor::Info, _S("Cache index of '%s' loaded; %d tags"),
|
||||
getOriginalSpec().m_name.data(), m_tagToPath.size());
|
||||
|
||||
@@ -28,7 +28,7 @@ struct SpecBase : hecl::Database::IDataSpec
|
||||
/* HECL Adaptors */
|
||||
void setThreadProject();
|
||||
bool canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps);
|
||||
void doExtract(const ExtractPassInfo& info, FProgress progress);
|
||||
void doExtract(const ExtractPassInfo& info, const hecl::MultiProgressPrinter& progress);
|
||||
|
||||
bool canCook(const hecl::ProjectPath& path, hecl::blender::Token& btok);
|
||||
const hecl::Database::DataSpecEntry* overrideDataSpec(const hecl::ProjectPath& path,
|
||||
@@ -39,7 +39,8 @@ struct SpecBase : hecl::Database::IDataSpec
|
||||
|
||||
bool canPackage(const hecl::ProjectPath& path);
|
||||
void doPackage(const hecl::ProjectPath& path, const hecl::Database::DataSpecEntry* entry,
|
||||
bool fast, hecl::blender::Token& btok, FProgress progress, hecl::ClientProcess* cp);
|
||||
bool fast, hecl::blender::Token& btok, const hecl::MultiProgressPrinter& progress,
|
||||
hecl::ClientProcess* cp);
|
||||
|
||||
/* Extract handlers */
|
||||
virtual bool checkStandaloneID(const char* id) const=0;
|
||||
@@ -52,7 +53,7 @@ struct SpecBase : hecl::Database::IDataSpec
|
||||
const std::vector<hecl::SystemString>& args,
|
||||
std::vector<ExtractReport>& reps)=0;
|
||||
virtual bool extractFromDisc(nod::DiscBase& disc, bool force,
|
||||
FProgress progress)=0;
|
||||
const hecl::MultiProgressPrinter& progress)=0;
|
||||
|
||||
/* Convert path to object tag */
|
||||
virtual urde::SObjectTag buildTagFromPath(const hecl::ProjectPath& path,
|
||||
@@ -207,7 +208,8 @@ protected:
|
||||
void copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>& fileIndex,
|
||||
const std::vector<urde::SObjectTag>& buildList,
|
||||
const hecl::Database::DataSpecEntry* entry,
|
||||
bool fast, FProgress progress, athena::io::FileWriter& pakOut);
|
||||
bool fast, const hecl::MultiProgressPrinter& progress,
|
||||
athena::io::FileWriter& pakOut);
|
||||
|
||||
private:
|
||||
std::unique_ptr<nod::DiscBase> m_disc;
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "DNAMP1/SnowForces.hpp"
|
||||
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
#include "hecl/MultiProgressPrinter.hpp"
|
||||
#include "hecl/Blender/Connection.hpp"
|
||||
#include "nod/nod.hpp"
|
||||
|
||||
@@ -356,7 +357,7 @@ struct SpecMP1 : SpecBase
|
||||
return true;
|
||||
}
|
||||
|
||||
bool extractFromDisc(nod::DiscBase& disc, bool force, FProgress progress)
|
||||
bool extractFromDisc(nod::DiscBase& disc, bool force, const hecl::MultiProgressPrinter& progress)
|
||||
{
|
||||
m_project.enableDataSpecs({_S("MP1-PC")});
|
||||
|
||||
@@ -364,9 +365,10 @@ struct SpecMP1 : SpecBase
|
||||
|
||||
m_workPath.makeDir();
|
||||
|
||||
progress(_S("Indexing PAKs"), _S(""), 2, 0.0);
|
||||
m_pakRouter.build(m_paks, [&progress](float factor) { progress(_S("Indexing PAKs"), _S(""), 2, factor); });
|
||||
progress(_S("Indexing PAKs"), _S(""), 2, 1.0);
|
||||
progress.startNewLine();
|
||||
progress.print(_S("Indexing PAKs"), _S(""), 0.0);
|
||||
m_pakRouter.build(m_paks, [&progress](float factor) { progress.print(_S("Indexing PAKs"), _S(""), factor); });
|
||||
progress.print(_S("Indexing PAKs"), _S(""), 1.0);
|
||||
|
||||
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _S("out"));
|
||||
outPath.makeDir();
|
||||
@@ -374,24 +376,23 @@ struct SpecMP1 : SpecBase
|
||||
mp1OutPath.makeDir();
|
||||
|
||||
/* Extract non-pak files */
|
||||
progress(_S("MP1 Root"), _S(""), 3, 0.0);
|
||||
progress.startNewLine();
|
||||
progress.print(_S("MP1 Root"), _S(""), 0.0);
|
||||
int prog = 0;
|
||||
ctx.progressCB = [&](std::string_view name, float) {
|
||||
hecl::SystemStringConv nameView(name);
|
||||
progress(_S("MP1 Root"), nameView.c_str(), 3, prog / (float)m_nonPaks.size());
|
||||
progress.print(_S("MP1 Root"), nameView.c_str(), prog / (float)m_nonPaks.size());
|
||||
};
|
||||
for (const nod::Node* node : m_nonPaks)
|
||||
{
|
||||
node->extractToDirectory(mp1OutPath.getAbsolutePath(), ctx);
|
||||
prog++;
|
||||
}
|
||||
progress(_S("MP1 Root"), _S(""), 3, 1.0);
|
||||
progress.print(_S("MP1 Root"), _S(""), 1.0);
|
||||
|
||||
/* Extract unique resources */
|
||||
std::mutex msgLock;
|
||||
hecl::ClientProcess process;
|
||||
int compIdx = 4;
|
||||
prog = 0;
|
||||
progress.startNewLine();
|
||||
for (std::pair<const std::string, DNAMP1::PAKBridge*>& pair : m_orderedPaks)
|
||||
{
|
||||
#if 0
|
||||
@@ -414,16 +415,12 @@ struct SpecMP1 : SpecBase
|
||||
auto name = pak.getName();
|
||||
hecl::SystemStringConv sysName(name);
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(sysName.c_str(), _S(""), compIdx, 0.0);
|
||||
}
|
||||
|
||||
auto pakName = hecl::SystemString(sysName.sys_str());
|
||||
process.addLambdaTransaction([&, pakName](hecl::blender::Token& btok) {
|
||||
m_pakRouter.extractResources(pak, force, btok, [&](const hecl::SystemChar* substr, float factor) {
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(pakName.c_str(), substr, compIdx, factor);
|
||||
process.addLambdaTransaction([this, &progress, &pak, pakName, force](hecl::blender::Token& btok) {
|
||||
int threadIdx = hecl::ClientProcess::GetThreadWorkerIdx();
|
||||
m_pakRouter.extractResources(pak, force, btok,
|
||||
[&progress, &pakName, threadIdx](const hecl::SystemChar* substr, float factor) {
|
||||
progress.print(pakName.c_str(), substr, factor, threadIdx);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
#include "hecl/Blender/Connection.hpp"
|
||||
#include "hecl/MultiProgressPrinter.hpp"
|
||||
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "nod/nod.hpp"
|
||||
@@ -222,40 +223,40 @@ struct SpecMP2 : SpecBase
|
||||
return true;
|
||||
}
|
||||
|
||||
bool extractFromDisc(nod::DiscBase&, bool force, FProgress progress)
|
||||
bool extractFromDisc(nod::DiscBase&, bool force, const hecl::MultiProgressPrinter& progress)
|
||||
{
|
||||
nod::ExtractionContext ctx = {force, nullptr};
|
||||
|
||||
m_workPath.makeDir();
|
||||
|
||||
progress(_S("Indexing PAKs"), _S(""), 2, 0.0);
|
||||
progress.startNewLine();
|
||||
progress.print(_S("Indexing PAKs"), _S(""), 0.0);
|
||||
m_pakRouter.build(m_paks, [&progress](float factor)
|
||||
{
|
||||
progress(_S("Indexing PAKs"), _S(""), 2, factor);
|
||||
progress.print(_S("Indexing PAKs"), _S(""), factor);
|
||||
});
|
||||
progress(_S("Indexing PAKs"), _S(""), 2, 1.0);
|
||||
progress.print(_S("Indexing PAKs"), _S(""), 1.0);
|
||||
|
||||
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _S("out"));
|
||||
outPath.makeDir();
|
||||
hecl::ProjectPath mp2OutPath(outPath, _S("MP2"));
|
||||
mp2OutPath.makeDir();
|
||||
progress(_S("MP2 Root"), _S(""), 3, 0.0);
|
||||
progress.startNewLine();
|
||||
progress.print(_S("MP2 Root"), _S(""), 0.0);
|
||||
int prog = 0;
|
||||
ctx.progressCB = [&](std::string_view name, float) {
|
||||
ctx.progressCB = [&prog, &progress](std::string_view name, float) {
|
||||
hecl::SystemStringConv nameView(name);
|
||||
progress(_S("MP2 Root"), nameView.c_str(), 3, prog);
|
||||
progress.print(_S("MP2 Root"), nameView.c_str(), prog);
|
||||
};
|
||||
for (const nod::Node* node : m_nonPaks)
|
||||
{
|
||||
node->extractToDirectory(mp2OutPath.getAbsolutePath(), ctx);
|
||||
prog++;
|
||||
}
|
||||
progress(_S("MP2 Root"), _S(""), 3, 1.0);
|
||||
progress.print(_S("MP2 Root"), _S(""), 1.0);
|
||||
|
||||
std::mutex msgLock;
|
||||
hecl::ClientProcess process;
|
||||
int compIdx = 4;
|
||||
prog = 0;
|
||||
progress.startNewLine();
|
||||
for (std::pair<const std::string, DNAMP2::PAKBridge*>& pair : m_orderedPaks)
|
||||
{
|
||||
DNAMP2::PAKBridge& pak = *pair.second;
|
||||
@@ -265,18 +266,14 @@ struct SpecMP2 : SpecBase
|
||||
auto name = pak.getName();
|
||||
hecl::SystemStringConv sysName(name);
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(sysName.c_str(), _S(""), compIdx, 0.0);
|
||||
}
|
||||
auto pakName = hecl::SystemString(sysName.sys_str());
|
||||
process.addLambdaTransaction([&, pakName](hecl::blender::Token& btok)
|
||||
process.addLambdaTransaction([this, &progress, &pak, pakName, force](hecl::blender::Token& btok)
|
||||
{
|
||||
int threadIdx = hecl::ClientProcess::GetThreadWorkerIdx();
|
||||
m_pakRouter.extractResources(pak, force, btok,
|
||||
[&](const hecl::SystemChar* substr, float factor)
|
||||
[&progress, &pakName, threadIdx](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(pakName.c_str(), substr, compIdx, factor);
|
||||
progress.print(pakName.c_str(), substr, factor, threadIdx);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
#include "hecl/Blender/Connection.hpp"
|
||||
#include "hecl/MultiProgressPrinter.hpp"
|
||||
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "nod/nod.hpp"
|
||||
@@ -351,9 +352,8 @@ struct SpecMP3 : SpecBase
|
||||
return doMP3 || doMPTFE;
|
||||
}
|
||||
|
||||
bool extractFromDisc(nod::DiscBase&, bool force, FProgress progress)
|
||||
bool extractFromDisc(nod::DiscBase&, bool force, const hecl::MultiProgressPrinter& progress)
|
||||
{
|
||||
int compIdx = 2;
|
||||
hecl::SystemString currentTarget = _S("");
|
||||
size_t nodeCount = 0;
|
||||
int prog = 0;
|
||||
@@ -361,25 +361,27 @@ struct SpecMP3 : SpecBase
|
||||
[&](std::string_view name, float)
|
||||
{
|
||||
hecl::SystemStringConv nameView(name);
|
||||
progress(currentTarget.c_str(), nameView.c_str(), compIdx, prog / (float)nodeCount);
|
||||
progress.print(currentTarget.c_str(), nameView.c_str(), prog / (float)nodeCount);
|
||||
}};
|
||||
if (doMP3)
|
||||
{
|
||||
m_workPath.makeDir();
|
||||
|
||||
progress(_S("Indexing PAKs"), _S(""), compIdx, 0.0);
|
||||
m_pakRouter.build(m_paks, [&progress, &compIdx](float factor)
|
||||
progress.startNewLine();
|
||||
progress.print(_S("Indexing PAKs"), _S(""), 0.0);
|
||||
m_pakRouter.build(m_paks, [&progress](float factor)
|
||||
{
|
||||
progress(_S("Indexing PAKs"), _S(""), compIdx, factor);
|
||||
progress.print(_S("Indexing PAKs"), _S(""), factor);
|
||||
});
|
||||
progress(_S("Indexing PAKs"), _S(""), compIdx++, 1.0);
|
||||
progress.print(_S("Indexing PAKs"), _S(""), 1.0);
|
||||
progress.startNewLine();
|
||||
|
||||
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _S("out"));
|
||||
outPath.makeDir();
|
||||
hecl::ProjectPath mp3OutPath(outPath, _S("MP3"));
|
||||
mp3OutPath.makeDir();
|
||||
currentTarget = _S("MP3 Root");
|
||||
progress(currentTarget.c_str(), _S(""), compIdx, 0.0);
|
||||
progress.print(currentTarget.c_str(), _S(""), 0.0);
|
||||
prog = 0;
|
||||
|
||||
nodeCount = m_nonPaks.size();
|
||||
@@ -391,11 +393,10 @@ struct SpecMP3 : SpecBase
|
||||
}
|
||||
ctx.progressCB = nullptr;
|
||||
|
||||
progress(currentTarget.c_str(), _S(""), compIdx++, 1.0);
|
||||
progress.print(currentTarget.c_str(), _S(""), 1.0);
|
||||
progress.startNewLine();
|
||||
|
||||
std::mutex msgLock;
|
||||
hecl::ClientProcess process;
|
||||
prog = 0;
|
||||
for (std::pair<const std::string, DNAMP3::PAKBridge*>& pair : m_orderedPaks)
|
||||
{
|
||||
DNAMP3::PAKBridge& pak = *pair.second;
|
||||
@@ -405,18 +406,14 @@ struct SpecMP3 : SpecBase
|
||||
auto name = pak.getName();
|
||||
hecl::SystemStringConv sysName(name);
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(sysName.c_str(), _S(""), compIdx, 0.0);
|
||||
}
|
||||
auto pakName = hecl::SystemString(sysName.sys_str());
|
||||
process.addLambdaTransaction([&, pakName](hecl::blender::Token& btok)
|
||||
process.addLambdaTransaction([this, &progress, &pak, pakName, force](hecl::blender::Token& btok)
|
||||
{
|
||||
int threadIdx = hecl::ClientProcess::GetThreadWorkerIdx();
|
||||
m_pakRouter.extractResources(pak, force, btok,
|
||||
[&](const hecl::SystemChar* substr, float factor)
|
||||
[&progress, &pakName, threadIdx](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(pakName.c_str(), substr, compIdx, factor);
|
||||
progress.print(pakName.c_str(), substr, factor);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -428,19 +425,21 @@ struct SpecMP3 : SpecBase
|
||||
{
|
||||
m_feWorkPath.makeDir();
|
||||
|
||||
progress(_S("Indexing PAKs"), _S(""), compIdx, 0.0);
|
||||
m_fePakRouter.build(m_fePaks, [&progress, &compIdx](float factor)
|
||||
progress.startNewLine();
|
||||
progress.print(_S("Indexing PAKs"), _S(""), 0.0);
|
||||
m_fePakRouter.build(m_fePaks, [&progress](float factor)
|
||||
{
|
||||
progress(_S("Indexing PAKs"), _S(""), compIdx, factor);
|
||||
progress.print(_S("Indexing PAKs"), _S(""), factor);
|
||||
});
|
||||
progress(_S("Indexing PAKs"), _S(""), compIdx++, 1.0);
|
||||
progress.print(_S("Indexing PAKs"), _S(""), 1.0);
|
||||
progress.startNewLine();
|
||||
|
||||
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _S("out"));
|
||||
outPath.makeDir();
|
||||
hecl::ProjectPath feOutPath(outPath, _S("fe"));
|
||||
feOutPath.makeDir();
|
||||
currentTarget = _S("fe Root");
|
||||
progress(currentTarget.c_str(), _S(""), compIdx, 0.0);
|
||||
progress.print(currentTarget.c_str(), _S(""), 0.0);
|
||||
prog = 0;
|
||||
nodeCount = m_feNonPaks.size();
|
||||
|
||||
@@ -450,11 +449,10 @@ struct SpecMP3 : SpecBase
|
||||
node->extractToDirectory(feOutPath.getAbsolutePath(), ctx);
|
||||
prog++;
|
||||
}
|
||||
progress(currentTarget.c_str(), _S(""), compIdx++, 1.0);
|
||||
progress.print(currentTarget.c_str(), _S(""), 1.0);
|
||||
progress.startNewLine();
|
||||
|
||||
std::mutex msgLock;
|
||||
hecl::ClientProcess process;
|
||||
prog = 0;
|
||||
for (std::pair<std::string, DNAMP3::PAKBridge*> pair : m_feOrderedPaks)
|
||||
{
|
||||
DNAMP3::PAKBridge& pak = *pair.second;
|
||||
@@ -464,18 +462,14 @@ struct SpecMP3 : SpecBase
|
||||
auto name = pak.getName();
|
||||
hecl::SystemStringConv sysName(name);
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(sysName.c_str(), _S(""), compIdx, 0.0);
|
||||
}
|
||||
hecl::SystemString pakName(sysName.sys_str());
|
||||
process.addLambdaTransaction([&, pakName](hecl::blender::Token& btok)
|
||||
process.addLambdaTransaction([this, &progress, &pak, pakName, force](hecl::blender::Token& btok)
|
||||
{
|
||||
int threadIdx = hecl::ClientProcess::GetThreadWorkerIdx();
|
||||
m_fePakRouter.extractResources(pak, force, btok,
|
||||
[&](const hecl::SystemChar* substr, float factor)
|
||||
[&progress, &pakName, threadIdx](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(pakName.c_str(), substr, compIdx, factor);
|
||||
progress.print(pakName.c_str(), substr, factor);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user