mirror of https://github.com/AxioDL/metaforce.git
Thread-safe extraction
This commit is contained in:
parent
9fcce94a7a
commit
8fc0d57500
|
@ -211,7 +211,8 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
|
|||
}
|
||||
|
||||
/* Write catalog */
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
intptr_t curBridgeIdx = reinterpret_cast<intptr_t>(m_curBridgeIdx.get());
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[curBridgeIdx].first;
|
||||
hecl::SystemString catalogPath = hecl::ProjectPath(pakPath, "catalog.yaml").getAbsolutePath();
|
||||
FILE* catalog = hecl::Fopen(catalogPath.c_str(), _S("w"));
|
||||
yaml_emitter_set_output_file(catalogWriter.getEmitter(), catalog);
|
||||
|
@ -232,9 +233,9 @@ void PAKRouter<BRIDGETYPE>::enterPAKBridge(const BRIDGETYPE& pakBridge)
|
|||
{
|
||||
pit->first.makeDir();
|
||||
pit->second.makeDir();
|
||||
m_pak = &pakBridge.getPAK();
|
||||
m_node = &pakBridge.getNode();
|
||||
m_curBridgeIdx = bridgeIdx;
|
||||
m_pak.reset(&pakBridge.getPAK());
|
||||
m_node.reset(&pakBridge.getNode());
|
||||
m_curBridgeIdx.reset(reinterpret_cast<void*>(bridgeIdx));
|
||||
return;
|
||||
}
|
||||
++pit;
|
||||
|
@ -250,15 +251,17 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
|
|||
{
|
||||
if (!entry)
|
||||
return hecl::ProjectPath();
|
||||
if (!m_pak)
|
||||
const PAKType* pak = m_pak.get();
|
||||
intptr_t curBridgeIdx = reinterpret_cast<intptr_t>(m_curBridgeIdx.get());
|
||||
if (!pak)
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getWorkingPath()");
|
||||
if (m_pak->m_noShare)
|
||||
if (pak->m_noShare)
|
||||
{
|
||||
const EntryType* singleSearch = m_pak->lookupEntry(entry->id);
|
||||
const EntryType* singleSearch = pak->lookupEntry(entry->id);
|
||||
if (singleSearch)
|
||||
{
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[curBridgeIdx].first;
|
||||
pakPath.makeDir();
|
||||
#if HECL_UCS2
|
||||
hecl::SystemString entName = hecl::UTF8ToWide(getBestEntryName(*entry));
|
||||
|
@ -334,15 +337,17 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const EntryType* entry) const
|
|||
{
|
||||
if (!entry)
|
||||
return hecl::ProjectPath();
|
||||
if (!m_pak)
|
||||
const PAKType* pak = m_pak.get();
|
||||
intptr_t curBridgeIdx = reinterpret_cast<intptr_t>(m_curBridgeIdx.get());
|
||||
if (!pak)
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getCookedPath()");
|
||||
if (m_pak->m_noShare)
|
||||
if (pak->m_noShare)
|
||||
{
|
||||
const EntryType* singleSearch = m_pak->lookupEntry(entry->id);
|
||||
const EntryType* singleSearch = pak->lookupEntry(entry->id);
|
||||
if (singleSearch)
|
||||
{
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].second;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[curBridgeIdx].second;
|
||||
pakPath.makeDir();
|
||||
return hecl::ProjectPath(pakPath, getBestEntryName(*entry));
|
||||
}
|
||||
|
@ -382,7 +387,8 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const IDType& id) const
|
|||
template <class BRIDGETYPE>
|
||||
hecl::SystemString PAKRouter<BRIDGETYPE>::getResourceRelativePath(const EntryType& a, const IDType& b) const
|
||||
{
|
||||
if (!m_pak)
|
||||
const PAKType* pak = m_pak.get();
|
||||
if (!pak)
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()");
|
||||
const typename BRIDGETYPE::PAKType::Entry* be = lookupEntry(b);
|
||||
|
@ -431,7 +437,8 @@ std::string PAKRouter<BRIDGETYPE>::getBestEntryName(const IDType& entry) const
|
|||
}
|
||||
|
||||
template <class BRIDGETYPE>
|
||||
bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool force,
|
||||
bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool force, bool precedenceSharesOnly,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*, float)> progress)
|
||||
{
|
||||
enterPAKBridge(pakBridge);
|
||||
|
@ -446,16 +453,28 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
|
|||
if (extractor.weight != w)
|
||||
continue;
|
||||
|
||||
if (precedenceSharesOnly)
|
||||
{
|
||||
auto sharedSearch = m_sharedEntries.find(item->id);
|
||||
if (sharedSearch != m_sharedEntries.cend())
|
||||
{
|
||||
if (sharedSearch->second.first != reinterpret_cast<intptr_t>(m_curBridgeIdx.get()))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
std::string bestName = getBestEntryName(*item);
|
||||
hecl::SystemStringView bestNameView(bestName);
|
||||
float thisFac = ++count / fsz;
|
||||
progress(bestNameView.sys_str().c_str(), thisFac);
|
||||
|
||||
const nod::Node* node = m_node.get();
|
||||
|
||||
/* Extract first, so they start out invalid */
|
||||
hecl::ProjectPath cooked = getCooked(item);
|
||||
if (force || cooked.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
PAKEntryReadStream s = item->beginReadStream(*node);
|
||||
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().c_str(), _S("wb"));
|
||||
fwrite(s.data(), 1, s.length(), fout);
|
||||
fclose(fout);
|
||||
|
@ -466,7 +485,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
|
|||
{
|
||||
if (force || working.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
PAKEntryReadStream s = item->beginReadStream(*node);
|
||||
extractor.func_a(s, working);
|
||||
}
|
||||
}
|
||||
|
@ -474,8 +493,8 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
|
|||
{
|
||||
if (force || working.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
extractor.func_b(m_dataSpec, s, working, *this, *item, force,
|
||||
PAKEntryReadStream s = item->beginReadStream(*node);
|
||||
extractor.func_b(m_dataSpec, s, working, *this, *item, force, btok,
|
||||
[&progress, thisFac](const hecl::SystemChar* update)
|
||||
{
|
||||
progress(update, thisFac);
|
||||
|
@ -501,13 +520,15 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
|
|||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::build() must be called before PAKRouter::lookupEntry()");
|
||||
|
||||
if (m_pak)
|
||||
const PAKType* pak = m_pak.get();
|
||||
const nod::Node* node = m_node.get();
|
||||
if (pak)
|
||||
{
|
||||
const EntryType* ent = m_pak->lookupEntry(entry);
|
||||
const EntryType* ent = pak->lookupEntry(entry);
|
||||
if (ent)
|
||||
{
|
||||
if (nodeOut)
|
||||
*nodeOut = m_node;
|
||||
*nodeOut = node;
|
||||
return ent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __DNACOMMON_PAK_HPP__
|
||||
|
||||
#include "DNACommon.hpp"
|
||||
#include "boo/ThreadLocalPtr.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
@ -81,7 +82,7 @@ struct ResExtractor
|
|||
{
|
||||
std::function<bool(PAKEntryReadStream&, const hecl::ProjectPath&)> func_a;
|
||||
std::function<bool(const SpecBase&, PAKEntryReadStream&, const hecl::ProjectPath&, PAKRouter<PAKBRIDGE>&,
|
||||
const typename PAKBRIDGE::PAKType::Entry&, bool,
|
||||
const typename PAKBRIDGE::PAKType::Entry&, bool, hecl::BlenderToken&,
|
||||
std::function<void(const hecl::SystemChar*)>)> func_b;
|
||||
const hecl::SystemChar* fileExts[4];
|
||||
unsigned weight;
|
||||
|
@ -121,13 +122,13 @@ public:
|
|||
private:
|
||||
const std::vector<BRIDGETYPE>* m_bridges = nullptr;
|
||||
std::vector<std::pair<hecl::ProjectPath,hecl::ProjectPath>> m_bridgePaths;
|
||||
size_t m_curBridgeIdx = 0;
|
||||
ThreadLocalPtr<void> m_curBridgeIdx;
|
||||
const hecl::ProjectPath& m_gameWorking;
|
||||
const hecl::ProjectPath& m_gameCooked;
|
||||
hecl::ProjectPath m_sharedWorking;
|
||||
hecl::ProjectPath m_sharedCooked;
|
||||
const PAKType* m_pak = nullptr;
|
||||
const nod::Node* m_node = nullptr;
|
||||
ThreadLocalPtr<const PAKType> m_pak;
|
||||
ThreadLocalPtr<const nod::Node> m_node;
|
||||
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_uniqueEntries;
|
||||
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_sharedEntries;
|
||||
std::unordered_map<IDType, RigPair> m_cmdlRigs;
|
||||
|
@ -147,14 +148,19 @@ public:
|
|||
hecl::ProjectPath getWorking(const IDType& id) const;
|
||||
hecl::ProjectPath getCooked(const EntryType* entry) const;
|
||||
hecl::ProjectPath getCooked(const IDType& id) const;
|
||||
bool isShared() { return m_pak ? !m_pak->m_noShare : false; }
|
||||
bool isShared()
|
||||
{
|
||||
const PAKType* pak = m_pak.get();
|
||||
return pak ? !pak->m_noShare : false;
|
||||
}
|
||||
|
||||
hecl::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const;
|
||||
|
||||
std::string getBestEntryName(const EntryType& entry) const;
|
||||
std::string getBestEntryName(const IDType& entry) const;
|
||||
|
||||
bool extractResources(const BRIDGETYPE& pakBridge, bool force,
|
||||
bool extractResources(const BRIDGETYPE& pakBridge, bool force, bool precedenceSharesOnly,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*, float)> progress);
|
||||
|
||||
const typename BRIDGETYPE::PAKType::Entry* lookupEntry(const IDType& entry,
|
||||
|
|
|
@ -394,6 +394,7 @@ struct ANCS : BigYAML
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
|
||||
|
@ -417,7 +418,7 @@ struct ANCS : BigYAML
|
|||
|
||||
if (force || blendType == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1, 2>
|
||||
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ struct CMDL
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
/* Check for RigPair */
|
||||
|
@ -39,7 +40,7 @@ struct CMDL
|
|||
}
|
||||
|
||||
/* Do extract */
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Mesh))
|
||||
return false;
|
||||
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1, 2>
|
||||
|
|
|
@ -311,12 +311,19 @@ size_t FRME::Widget::TXPNInfo::binarySize(size_t __isz) const
|
|||
return __isz + (version == 1 ? 78 : 66);
|
||||
}
|
||||
|
||||
bool FRME::Extract(const SpecBase &dataSpec, PAKEntryReadStream &rs, const hecl::ProjectPath &outPath, PAKRouter<PAKBridge> &pakRouter, const PAK::Entry &entry, bool force, std::function<void (const hecl::SystemChar *)> fileChanged)
|
||||
bool FRME::Extract(const SpecBase &dataSpec,
|
||||
PAKEntryReadStream &rs,
|
||||
const hecl::ProjectPath &outPath,
|
||||
PAKRouter<PAKBridge> &pakRouter,
|
||||
const PAK::Entry &entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void (const hecl::SystemChar *)> fileChanged)
|
||||
{
|
||||
FRME frme;
|
||||
frme.read(rs);
|
||||
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
|
||||
#if 0
|
||||
if (!force && outPath.getPathType() == hecl::ProjectPath::Type::File)
|
||||
|
|
|
@ -262,6 +262,7 @@ struct FRME : BigDNA
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged);
|
||||
};
|
||||
|
||||
|
|
|
@ -20,11 +20,12 @@ struct MAPA : DNAMAPA::MAPA
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
MAPA mapa;
|
||||
mapa.read(rs);
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -112,6 +112,7 @@ struct MLVL : BigYAML
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
MLVL mlvl;
|
||||
|
@ -119,7 +120,7 @@ struct MLVL : BigYAML
|
|||
FILE* fp = hecl::Fopen(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath().c_str(), _S("w"));
|
||||
mlvl.toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
|
||||
entry, force, fileChanged);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)>)
|
||||
{
|
||||
using RigPair = std::pair<CSKR*, CINF*>;
|
||||
|
@ -78,7 +79,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
|||
head.read(rs);
|
||||
rs.seekAlign32();
|
||||
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
if (!conn.createBlend(mreaPath, hecl::BlenderConnection::BlendType::Area))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ struct MREA
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)>);
|
||||
|
||||
static void Name(const SpecBase& dataSpec,
|
||||
|
|
|
@ -217,6 +217,7 @@ struct ANCS : BigYAML
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const DNAMP1::PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
|
||||
|
@ -240,7 +241,7 @@ struct ANCS : BigYAML
|
|||
|
||||
if (force || blendType == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_2, 4>
|
||||
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ struct CMDL
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const DNAMP1::PAK::Entry& entry,
|
||||
bool,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)>)
|
||||
{
|
||||
/* Check for RigPair */
|
||||
|
@ -37,7 +38,7 @@ struct CMDL
|
|||
}
|
||||
|
||||
/* Do extract */
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Mesh))
|
||||
return false;
|
||||
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_2, 4>
|
||||
|
|
|
@ -17,11 +17,12 @@ struct MAPA : DNAMAPA::MAPA
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const DNAMP1::PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
MAPA mapa;
|
||||
mapa.read(rs);
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -100,6 +100,7 @@ struct MLVL : BigYAML
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const DNAMP1::PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
MLVL mlvl;
|
||||
|
@ -107,7 +108,7 @@ struct MLVL : BigYAML
|
|||
FILE* fp = hecl::Fopen(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath().c_str(), _S("wb"));
|
||||
mlvl.toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
|
||||
entry, force, fileChanged);
|
||||
}
|
||||
|
|
|
@ -163,6 +163,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const DNAMP1::PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)>)
|
||||
{
|
||||
using RigPair = std::pair<CSKR*, CINF*>;
|
||||
|
@ -197,7 +198,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
|||
drs.seek(0, athena::Begin);
|
||||
|
||||
/* Start up blender connection */
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
if (!conn.createBlend(mreaPath, hecl::BlenderConnection::BlendType::Area))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ struct MREA
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const DNAMP1::PAK::Entry& entry,
|
||||
bool,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)>);
|
||||
};
|
||||
|
||||
|
|
|
@ -312,6 +312,7 @@ struct CHAR : BigYAML
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
|
||||
|
@ -335,7 +336,7 @@ struct CHAR : BigYAML
|
|||
|
||||
if (force || blendType == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, CHAR, MaterialSet, DNACMDL::SurfaceHeader_3, 4>
|
||||
(conn, aChar, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ struct CMDL
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)>)
|
||||
{
|
||||
/* Check for RigPair */
|
||||
|
@ -37,7 +38,7 @@ struct CMDL
|
|||
}
|
||||
|
||||
/* Do extract */
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Mesh))
|
||||
return false;
|
||||
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_3, 5>
|
||||
|
|
|
@ -17,11 +17,12 @@ struct MAPA : DNAMAPA::MAPA
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
MAPA mapa;
|
||||
mapa.read(rs);
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -89,6 +89,7 @@ struct MLVL : BigYAML
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
MLVL mlvl;
|
||||
|
@ -96,7 +97,7 @@ struct MLVL : BigYAML
|
|||
FILE* fp = hecl::Fopen(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath().c_str(), _S("wb"));
|
||||
mlvl.toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
|
||||
entry, force, fileChanged);
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)>)
|
||||
{
|
||||
using RigPair = std::pair<CSKR*, CINF*>;
|
||||
|
@ -109,7 +110,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
|||
|
||||
|
||||
/* Start up blender connection */
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||
if (!conn.createBlend(mreaPath, hecl::BlenderConnection::BlendType::Area))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ struct MREA
|
|||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool,
|
||||
hecl::BlenderToken& btok,
|
||||
std::function<void(const hecl::SystemChar*)>);
|
||||
|
||||
static bool ExtractLayerDeps(PAKEntryReadStream& rs, PAKBridge::Level::Area& areaOut);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "DNACommon/CRSC.hpp"
|
||||
#include "DNACommon/DPSC.hpp"
|
||||
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
|
@ -252,6 +254,8 @@ struct SpecMP1 : SpecBase
|
|||
}
|
||||
progress(_S("MP1 Root"), _S(""), 3, 1.0);
|
||||
|
||||
std::mutex msgLock;
|
||||
hecl::ClientProcess process;
|
||||
int compIdx = 4;
|
||||
prog = 0;
|
||||
for (std::pair<std::string, DNAMP1::PAKBridge*> pair : m_orderedPaks)
|
||||
|
@ -263,13 +267,20 @@ struct SpecMP1 : SpecBase
|
|||
const std::string& name = pak.getName();
|
||||
hecl::SystemStringView sysName(name);
|
||||
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
m_pakRouter.extractResources(pak, force,
|
||||
[&progress, &sysName, &compIdx](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
}
|
||||
hecl::SystemString pakName = sysName.sys_str();
|
||||
process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok)
|
||||
{
|
||||
m_pakRouter.extractResources(pak, force, true, btok,
|
||||
[&](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(pakName.c_str(), substr, compIdx, factor);
|
||||
});
|
||||
});
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx++, 1.0);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "DNAMP2/MLVL.hpp"
|
||||
#include "DNAMP2/STRG.hpp"
|
||||
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
|
@ -234,6 +236,8 @@ struct SpecMP2 : SpecBase
|
|||
}
|
||||
progress(_S("MP2 Root"), _S(""), 3, 1.0);
|
||||
|
||||
std::mutex msgLock;
|
||||
hecl::ClientProcess process;
|
||||
int compIdx = 4;
|
||||
prog = 0;
|
||||
for (std::pair<std::string, DNAMP2::PAKBridge*> pair : m_orderedPaks)
|
||||
|
@ -245,13 +249,20 @@ struct SpecMP2 : SpecBase
|
|||
const std::string& name = pak.getName();
|
||||
hecl::SystemStringView sysName(name);
|
||||
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
m_pakRouter.extractResources(pak, force,
|
||||
[&progress, &sysName, &compIdx](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
}
|
||||
hecl::SystemString pakName = sysName.sys_str();
|
||||
process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok)
|
||||
{
|
||||
m_pakRouter.extractResources(pak, force, true, btok,
|
||||
[&](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(pakName.c_str(), substr, compIdx, factor);
|
||||
});
|
||||
});
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx++, 1.0);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "DNAMP3/STRG.hpp"
|
||||
#include "DNAMP2/STRG.hpp"
|
||||
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
|
@ -366,6 +368,8 @@ struct SpecMP3 : SpecBase
|
|||
|
||||
progress(currentTarget.c_str(), _S(""), compIdx++, 1.0);
|
||||
|
||||
std::mutex msgLock;
|
||||
hecl::ClientProcess process;
|
||||
prog = 0;
|
||||
for (std::pair<std::string, DNAMP3::PAKBridge*> pair : m_orderedPaks)
|
||||
{
|
||||
|
@ -376,13 +380,20 @@ struct SpecMP3 : SpecBase
|
|||
const std::string& name = pak.getName();
|
||||
hecl::SystemStringView sysName(name);
|
||||
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
m_pakRouter.extractResources(pak, force,
|
||||
[&progress, &sysName, &compIdx](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
}
|
||||
hecl::SystemString pakName = sysName.sys_str();
|
||||
process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok)
|
||||
{
|
||||
m_pakRouter.extractResources(pak, force, true, btok,
|
||||
[&](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(pakName.c_str(), substr, compIdx, factor);
|
||||
});
|
||||
});
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx++, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,6 +428,8 @@ struct SpecMP3 : SpecBase
|
|||
}
|
||||
progress(currentTarget.c_str(), _S(""), compIdx++, 1.0);
|
||||
|
||||
std::mutex msgLock;
|
||||
hecl::ClientProcess process;
|
||||
prog = 0;
|
||||
for (std::pair<std::string, DNAMP3::PAKBridge*> pair : m_feOrderedPaks)
|
||||
{
|
||||
|
@ -427,13 +440,20 @@ struct SpecMP3 : SpecBase
|
|||
const std::string& name = pak.getName();
|
||||
hecl::SystemStringView sysName(name);
|
||||
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
m_fePakRouter.extractResources(pak, force,
|
||||
[&progress, &sysName, &compIdx](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
}
|
||||
hecl::SystemString pakName = sysName.sys_str();
|
||||
process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok)
|
||||
{
|
||||
m_fePakRouter.extractResources(pak, force, true, btok,
|
||||
[&](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(msgLock);
|
||||
progress(pakName.c_str(), substr, compIdx, factor);
|
||||
});
|
||||
});
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx++, 1.0);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -308,10 +308,8 @@ class TLockedToken : public TCachedToken<T>
|
|||
{
|
||||
public:
|
||||
TLockedToken() = default;
|
||||
TLockedToken(const CToken& other) : TCachedToken<T>(other)
|
||||
{TCachedToken<T>::m_obj = TToken<T>::GetObj();}
|
||||
TLockedToken(CToken&& other) : TCachedToken<T>(std::move(other))
|
||||
{TCachedToken<T>::m_obj = TToken<T>::GetObj();}
|
||||
TLockedToken(const CToken& other) : TCachedToken<T>(other) {CToken::Lock();}
|
||||
TLockedToken(CToken&& other) : TCachedToken<T>(std::move(other)) {CToken::Lock();}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(const UVAnimation& anim)
|
|||
{
|
||||
case UVAnimation::Mode::MvInvNoTranslation:
|
||||
{
|
||||
|
||||
matrixOut = CGraphics::g_ViewMatrix.inverse().multiplyIgnoreTranslation(
|
||||
CGraphics::g_GXModelMatrix).toMatrix4f();
|
||||
matrixOut.vec[3].zeroOut();
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 51349be32ab052618e02a82a8e21b495b5b00432
|
||||
Subproject commit 26f586dbc2a7a614abe0fb5b86bb2bc32c43b5f9
|
Loading…
Reference in New Issue