mirror of https://github.com/AxioDL/metaforce.git
Added pak isolation feature for trilogy paks
This commit is contained in:
parent
9f05f40994
commit
bd3cf2b847
|
@ -36,7 +36,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
|||
for (const auto& info : chResInfo)
|
||||
{
|
||||
const NOD::DiscBase::IPartition::Node* node;
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, &node);
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, &node, true);
|
||||
if (cmdlE)
|
||||
{
|
||||
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
|
@ -111,7 +111,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
|||
os << "actor_subtype.linked_armature = arm_obj.name\n";
|
||||
|
||||
/* Link CMDL */
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl);
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, nullptr, true);
|
||||
if (cmdlE)
|
||||
{
|
||||
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
|
@ -132,7 +132,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
|||
for (const auto& id : animResInfo)
|
||||
{
|
||||
typename ANCSDNA::ANIMType anim;
|
||||
if (pakRouter.lookupAndReadDNA(id.second.second, anim))
|
||||
if (pakRouter.lookupAndReadDNA(id.second.second, anim, true))
|
||||
{
|
||||
os.format("act = bpy.data.actions.new('%s')\n"
|
||||
"act.use_fake_user = True\n", id.second.first.c_str());
|
||||
|
|
|
@ -153,7 +153,7 @@ public:
|
|||
/* Index this PAK */
|
||||
bridge.build();
|
||||
|
||||
/* Add to global enntry lookup */
|
||||
/* Add to global entry lookup */
|
||||
const typename BRIDGETYPE::PAKType& pak = bridge.getPAK();
|
||||
for (const auto& entry : pak.m_idMap)
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
if (sSearch != m_sharedEntries.end())
|
||||
continue;
|
||||
auto uSearch = m_uniqueEntries.find(entry.first);
|
||||
if (uSearch != m_uniqueEntries.end())
|
||||
if (!pak.m_noShare && uSearch != m_uniqueEntries.end())
|
||||
{
|
||||
m_uniqueEntries.erase(uSearch);
|
||||
m_sharedEntries[entry.first] = std::make_pair(bridgeIdx, entry.second);
|
||||
|
@ -390,7 +390,8 @@ public:
|
|||
}
|
||||
|
||||
const typename BRIDGETYPE::PAKType::Entry* lookupEntry(const IDType& entry,
|
||||
const NOD::DiscBase::IPartition::Node** nodeOut=nullptr) const
|
||||
const NOD::DiscBase::IPartition::Node** nodeOut=nullptr,
|
||||
bool silenceWarnings=false) const
|
||||
{
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
|
@ -416,17 +417,18 @@ public:
|
|||
return ent;
|
||||
}
|
||||
}
|
||||
LogDNACommon.report(LogVisor::Warning, "unable to find PAK entry %s", entry.toString().c_str());
|
||||
if (!silenceWarnings)
|
||||
LogDNACommon.report(LogVisor::Warning, "unable to find PAK entry %s", entry.toString().c_str());
|
||||
if (nodeOut)
|
||||
*nodeOut = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename DNA>
|
||||
bool lookupAndReadDNA(const IDType& id, DNA& out)
|
||||
bool lookupAndReadDNA(const IDType& id, DNA& out, bool silenceWarnings=false)
|
||||
{
|
||||
const NOD::DiscBase::IPartition::Node* node;
|
||||
const EntryType* entry = lookupEntry(id, &node);
|
||||
const EntryType* entry = lookupEntry(id, &node, silenceWarnings);
|
||||
if (!entry)
|
||||
return false;
|
||||
PAKEntryReadStream rs = entry->beginReadStream(*node);
|
||||
|
|
|
@ -15,8 +15,17 @@ namespace DNAMP1
|
|||
{
|
||||
LogVisor::LogModule Log("Retro::DNAMP1");
|
||||
|
||||
static bool GetNoShare(const std::string& name)
|
||||
{
|
||||
if (!name.compare("RS5.pak"))
|
||||
return true;
|
||||
else if (!name.compare("Strings.pak"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPartition::Node& node)
|
||||
: m_project(project), m_node(node), m_pak(false)
|
||||
: m_project(project), m_node(node), m_pak(false, GetNoShare(node.getName()))
|
||||
{
|
||||
NOD::AthenaPartReadStream rs(node.beginReadStream());
|
||||
m_pak.read(rs);
|
||||
|
|
|
@ -14,7 +14,8 @@ namespace DNAMP1
|
|||
struct PAK : BigDNA
|
||||
{
|
||||
bool m_useLzo;
|
||||
PAK(bool useLzo) : m_useLzo(useLzo) {}
|
||||
bool m_noShare;
|
||||
PAK(bool useLzo, bool noShare) : m_useLzo(useLzo), m_noShare(noShare) {}
|
||||
DECL_EXPLICIT_DNA
|
||||
|
||||
struct NameEntry : BigDNA
|
||||
|
|
|
@ -11,11 +11,19 @@ namespace Retro
|
|||
{
|
||||
namespace DNAMP2
|
||||
{
|
||||
|
||||
LogVisor::LogModule Log("Retro::DNAMP2");
|
||||
|
||||
static bool GetNoShare(const std::string& name)
|
||||
{
|
||||
if (!name.compare("RS5.PAK"))
|
||||
return true;
|
||||
else if (!name.compare("Strings.pak"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPartition::Node& node)
|
||||
: m_project(project), m_node(node), m_pak(true)
|
||||
: m_project(project), m_node(node), m_pak(true, GetNoShare(node.getName()))
|
||||
{
|
||||
NOD::AthenaPartReadStream rs(node.beginReadStream());
|
||||
m_pak.read(rs);
|
||||
|
|
|
@ -12,11 +12,17 @@ namespace Retro
|
|||
{
|
||||
namespace DNAMP3
|
||||
{
|
||||
|
||||
LogVisor::LogModule Log("Retro::DNAMP3");
|
||||
|
||||
static bool GetNoShare(const std::string& name)
|
||||
{
|
||||
if (!name.compare("RS5.PAK"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPartition::Node& node)
|
||||
: m_project(project), m_node(node)
|
||||
: m_project(project), m_node(node), m_pak(GetNoShare(node.getName()))
|
||||
{
|
||||
NOD::AthenaPartReadStream rs(node.beginReadStream());
|
||||
m_pak.read(rs);
|
||||
|
|
|
@ -16,6 +16,9 @@ extern const HECL::FourCC CMPD;
|
|||
|
||||
struct PAK : BigDNA
|
||||
{
|
||||
bool m_noShare;
|
||||
PAK(bool noShare) : m_noShare(noShare) {}
|
||||
|
||||
struct Header : BigDNA
|
||||
{
|
||||
DECL_DNA
|
||||
|
|
Loading…
Reference in New Issue