mirror of https://github.com/AxioDL/metaforce.git
mp1 dataspec adjustments
This commit is contained in:
parent
6aa69f2775
commit
abb9d4c000
|
@ -1,5 +1,5 @@
|
||||||
include_directories(${HECL_INCLUDE_DIR} ${NOD_LIB_INCLUDE_DIR})
|
include_directories(${HECL_INCLUDE_DIR} ${NOD_LIB_INCLUDE_DIR})
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=1")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
|
||||||
# Magic ingredient
|
# Magic ingredient
|
||||||
find_package(atdna REQUIRED)
|
find_package(atdna REQUIRED)
|
||||||
|
|
|
@ -17,10 +17,14 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
|
||||||
const char* gameID = disc->getHeader().gameID;
|
const char* gameID = disc->getHeader().gameID;
|
||||||
|
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
bool standalone = true;
|
||||||
if (isWii)
|
if (isWii)
|
||||||
{
|
{
|
||||||
if (!memcmp(gameID, "R3M", 3))
|
if (!memcmp(gameID, "R3M", 3))
|
||||||
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
|
standalone = false;
|
||||||
|
}
|
||||||
else if (!memcmp(gameID, "R3IJ01", 6))
|
else if (!memcmp(gameID, "R3IJ01", 6))
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
|
@ -36,10 +40,29 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWii)
|
char region = disc->getHeader().gameID[3];
|
||||||
return checkFromWiiDisc(*(NOD::DiscWii*)disc.get(), info.extractArgs, reps);
|
static const std::string regNONE = "";
|
||||||
|
static const std::string regE = "NTSC";
|
||||||
|
static const std::string regJ = "NTSC-J";
|
||||||
|
static const std::string regP = "PAL";
|
||||||
|
const std::string* regstr = ®NONE;
|
||||||
|
switch (region)
|
||||||
|
{
|
||||||
|
case 'E':
|
||||||
|
regstr = ®E;
|
||||||
|
break;
|
||||||
|
case 'J':
|
||||||
|
regstr = ®J;
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
regstr = ®P;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (standalone)
|
||||||
|
return checkFromStandaloneDisc(*disc.get(), *regstr, info.extractArgs, reps);
|
||||||
else
|
else
|
||||||
return checkFromGCNDisc(*(NOD::DiscGCN*)disc.get(), info.extractArgs, reps);
|
return checkFromTrilogyDisc(*disc.get(), *regstr, info.extractArgs, reps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecBase::doExtract(const HECL::Database::Project& project, const ExtractPassInfo& info)
|
void SpecBase::doExtract(const HECL::Database::Project& project, const ExtractPassInfo& info)
|
||||||
|
|
|
@ -24,13 +24,15 @@ struct SpecBase : HECL::Database::IDataSpec
|
||||||
std::unordered_set<HECL::ProjectPath>& implicitsOut);
|
std::unordered_set<HECL::ProjectPath>& implicitsOut);
|
||||||
void doPackage(const HECL::Database::Project& project, const PackagePassInfo& info);
|
void doPackage(const HECL::Database::Project& project, const PackagePassInfo& info);
|
||||||
|
|
||||||
virtual bool checkFromGCNDisc(NOD::DiscGCN& disc, const std::vector<const HECL::SystemString*>& args,
|
virtual bool checkFromStandaloneDisc(NOD::DiscBase& disc,
|
||||||
std::vector<ExtractReport>& reps)=0;
|
const std::string& regstr,
|
||||||
virtual bool readFromGCNDisc(NOD::DiscGCN& disc, const std::vector<const HECL::SystemString*>& args)=0;
|
const std::vector<const HECL::SystemString*>& args,
|
||||||
|
std::vector<ExtractReport>& reps)=0;
|
||||||
virtual bool checkFromWiiDisc(NOD::DiscWii& disc, const std::vector<const HECL::SystemString*>& args,
|
virtual bool checkFromTrilogyDisc(NOD::DiscBase& disc,
|
||||||
std::vector<ExtractReport>& reps)=0;
|
const std::string& regstr,
|
||||||
virtual bool readFromWiiDisc(NOD::DiscWii& disc, const std::vector<const HECL::SystemString*>& args)=0;
|
const std::vector<const HECL::SystemString*>& args,
|
||||||
|
std::vector<ExtractReport>& reps)=0;
|
||||||
|
virtual bool extractFromDisc()=0;
|
||||||
|
|
||||||
virtual bool checkFromProject(HECL::Database::Project& proj)=0;
|
virtual bool checkFromProject(HECL::Database::Project& proj)=0;
|
||||||
virtual bool readFromProject(HECL::Database::Project& proj)=0;
|
virtual bool readFromProject(HECL::Database::Project& proj)=0;
|
||||||
|
|
|
@ -18,45 +18,13 @@ struct SpecMP1 : SpecBase
|
||||||
DiscPAK(const NOD::DiscBase::IPartition::Node& n) : node(n) {}
|
DiscPAK(const NOD::DiscBase::IPartition::Node& n) : node(n) {}
|
||||||
};
|
};
|
||||||
std::vector<DiscPAK> m_paks;
|
std::vector<DiscPAK> m_paks;
|
||||||
|
std::map<std::string, DiscPAK*, CaseInsensitiveCompare> m_orderedPaks;
|
||||||
|
|
||||||
bool checkFromGCNDisc(NOD::DiscGCN& disc,
|
void buildPaks(NOD::DiscBase::IPartition::Node& root,
|
||||||
const std::vector<const HECL::SystemString*>& args,
|
const std::vector<const HECL::SystemString*>& args,
|
||||||
std::vector<ExtractReport>& reps)
|
ExtractReport& rep)
|
||||||
{
|
{
|
||||||
if (memcmp(disc.getHeader().gameID, "GM8", 3))
|
m_paks.clear();
|
||||||
return false;
|
|
||||||
char region = disc.getHeader().gameID[3];
|
|
||||||
static const std::string regNONE = "";
|
|
||||||
static const std::string regE = "NTSC";
|
|
||||||
static const std::string regJ = "NTSC-J";
|
|
||||||
static const std::string regP = "PAL";
|
|
||||||
const std::string* regstr = ®NONE;
|
|
||||||
switch (region)
|
|
||||||
{
|
|
||||||
case 'E':
|
|
||||||
regstr = ®E;
|
|
||||||
break;
|
|
||||||
case 'J':
|
|
||||||
regstr = ®J;
|
|
||||||
break;
|
|
||||||
case 'P':
|
|
||||||
regstr = ®P;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
NOD::DiscGCN::IPartition* partition = disc.getDataPartition();
|
|
||||||
std::unique_ptr<uint8_t[]> dolBuf = partition->getDOLBuf();
|
|
||||||
const char* buildInfo = (char*)memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16) + 19;
|
|
||||||
|
|
||||||
reps.emplace_back();
|
|
||||||
ExtractReport& rep = reps.back();
|
|
||||||
rep.name = "MP1";
|
|
||||||
rep.desc = "Metroid Prime " + *regstr;
|
|
||||||
if (buildInfo)
|
|
||||||
rep.desc += " (" + std::string(buildInfo) + ")";
|
|
||||||
|
|
||||||
/* Iterate PAKs and build level options */
|
|
||||||
NOD::DiscBase::IPartition::Node& root = disc.getDataPartition()->getFSTRoot();
|
|
||||||
for (const NOD::DiscBase::IPartition::Node& child : root)
|
for (const NOD::DiscBase::IPartition::Node& child : root)
|
||||||
{
|
{
|
||||||
const std::string& name = child.getName();
|
const std::string& name = child.getName();
|
||||||
|
@ -85,6 +53,8 @@ struct SpecMP1 : SpecBase
|
||||||
good = true;
|
good = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
good = true;
|
||||||
|
|
||||||
if (!good)
|
if (!good)
|
||||||
{
|
{
|
||||||
|
@ -113,11 +83,12 @@ struct SpecMP1 : SpecBase
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sort PAKs alphabetically */
|
/* Sort PAKs alphabetically */
|
||||||
std::map<std::string, DiscPAK*, CaseInsensitiveCompare> orderedPaks;
|
m_orderedPaks.clear();
|
||||||
for (DiscPAK& dpak : m_paks)
|
for (DiscPAK& dpak : m_paks)
|
||||||
orderedPaks[dpak.node.getName()] = &dpak;
|
m_orderedPaks[dpak.node.getName()] = &dpak;
|
||||||
|
|
||||||
for (std::pair<std::string, DiscPAK*> item : orderedPaks)
|
/* Assemble extract report */
|
||||||
|
for (std::pair<std::string, DiscPAK*> item : m_orderedPaks)
|
||||||
{
|
{
|
||||||
rep.childOpts.emplace_back();
|
rep.childOpts.emplace_back();
|
||||||
ExtractReport& childRep = rep.childOpts.back();
|
ExtractReport& childRep = rep.childOpts.back();
|
||||||
|
@ -149,25 +120,39 @@ struct SpecMP1 : SpecBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkFromStandaloneDisc(NOD::DiscBase& disc,
|
||||||
|
const std::string& regstr,
|
||||||
|
const std::vector<const HECL::SystemString*>& args,
|
||||||
|
std::vector<ExtractReport>& reps)
|
||||||
|
{
|
||||||
|
NOD::DiscGCN::IPartition* partition = disc.getDataPartition();
|
||||||
|
std::unique_ptr<uint8_t[]> dolBuf = partition->getDOLBuf();
|
||||||
|
const char* buildInfo = (char*)memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16) + 19;
|
||||||
|
|
||||||
|
reps.emplace_back();
|
||||||
|
ExtractReport& rep = reps.back();
|
||||||
|
rep.name = "MP1";
|
||||||
|
rep.desc = "Metroid Prime " + regstr;
|
||||||
|
if (buildInfo)
|
||||||
|
rep.desc += " (" + std::string(buildInfo) + ")";
|
||||||
|
|
||||||
|
/* Iterate PAKs and build level options */
|
||||||
|
NOD::DiscBase::IPartition::Node& root = disc.getDataPartition()->getFSTRoot();
|
||||||
|
buildPaks(root, args, rep);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool readFromGCNDisc(NOD::DiscGCN& disc,
|
|
||||||
const std::vector<const HECL::SystemString*>& args)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
bool checkFromTrilogyDisc(NOD::DiscBase& disc,
|
||||||
|
const std::string& regstr,
|
||||||
bool checkFromWiiDisc(NOD::DiscWii& disc,
|
const std::vector<const HECL::SystemString*>& args,
|
||||||
const std::vector<const HECL::SystemString*>& args,
|
std::vector<ExtractReport>& reps)
|
||||||
std::vector<ExtractReport>& reps)
|
|
||||||
{
|
{
|
||||||
if (memcmp(disc.getHeader().gameID, "R3M", 3))
|
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool readFromWiiDisc(NOD::DiscWii& disc,
|
bool extractFromDisc()
|
||||||
const std::vector<const HECL::SystemString*>& args)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
NODLib
2
NODLib
|
@ -1 +1 @@
|
||||||
Subproject commit 1c2ade8d5225aa9f6e9526d1adf377776b009a32
|
Subproject commit f30a9302b6bad6811efd8125b424c70069514658
|
Loading…
Reference in New Issue