fixed standalone game detection

This commit is contained in:
Jack Andersen 2015-07-13 15:07:15 -10:00
parent 31f77497fd
commit 91f5236109
5 changed files with 29 additions and 21 deletions

View File

@ -10,35 +10,18 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
bool isWii;
std::unique_ptr<NOD::DiscBase> disc = NOD::OpenDiscFromImage(info.srcpath.c_str(), isWii);
if (!disc)
{
LogModule.report(LogVisor::Error, _S("'%s' not a valid Nintendo disc image"), info.srcpath.c_str());
return false;
}
const char* gameID = disc->getHeader().gameID;
bool valid = false;
bool standalone = true;
if (isWii)
{
if (!memcmp(gameID, "R3M", 3))
{
valid = true;
standalone = false;
}
else if (!memcmp(gameID, "R3IJ01", 6))
valid = true;
}
else
{
if (!memcmp(gameID, "GM8", 3))
valid = true;
}
if (!valid)
{
LogModule.report(LogVisor::Error, "%.6s (%s) is not supported", gameID, disc->getHeader().gameTitle);
if (standalone && !checkStandaloneID(gameID))
return false;
}
char region = disc->getHeader().gameID[3];
static const HECL::SystemString regNONE = _S("");

View File

@ -24,6 +24,7 @@ struct SpecBase : HECL::Database::IDataSpec
std::unordered_set<HECL::ProjectPath>& implicitsOut);
void doPackage(const HECL::Database::Project& project, const PackagePassInfo& info);
virtual bool checkStandaloneID(const char* id) const=0;
virtual bool checkFromStandaloneDisc(NOD::DiscBase& disc,
const HECL::SystemString& regstr,
const std::vector<HECL::SystemString>& args,

View File

@ -11,6 +11,13 @@ namespace Retro
struct SpecMP1 : SpecBase
{
bool checkStandaloneID(const char* id) const
{
if (!memcmp(id, "GM8", 3))
return true;
return false;
}
struct DiscPAK
{
const NOD::DiscBase::IPartition::Node& node;
@ -133,7 +140,8 @@ struct SpecMP1 : SpecBase
rep.desc = _S("Metroid Prime ") + regstr;
if (buildInfo)
{
HECL::SystemStringView buildView(buildInfo);
std::string buildStr(buildInfo);
HECL::SystemStringView buildView(buildStr);
rep.desc += _S(" (") + buildView.sys_str() + _S(")");
}

View File

@ -11,6 +11,13 @@ namespace Retro
struct SpecMP2 : SpecBase
{
bool checkStandaloneID(const char* id) const
{
if (!memcmp(id, "G2M", 3))
return true;
return false;
}
struct DiscPAK
{
const NOD::DiscBase::IPartition::Node& node;
@ -133,7 +140,8 @@ struct SpecMP2 : SpecBase
rep.desc = _S("Metroid Prime 2 ") + regstr;
if (buildInfo)
{
HECL::SystemStringView buildView(buildInfo);
std::string buildStr(buildInfo);
HECL::SystemStringView buildView(buildStr);
rep.desc += _S(" (") + buildView.sys_str() + _S(")");
}

View File

@ -12,6 +12,13 @@ namespace Retro
struct SpecMP3 : SpecBase
{
bool checkStandaloneID(const char* id) const
{
if (!memcmp(id, "RM3", 3))
return true;
return false;
}
struct DiscPAK
{
const NOD::DiscBase::IPartition::Node& node;
@ -147,7 +154,8 @@ struct SpecMP3 : SpecBase
rep.desc = _S("Metroid Prime 3 ") + regstr;
if (buildInfo)
{
HECL::SystemStringView buildView(buildInfo);
std::string buildStr(buildInfo);
HECL::SystemStringView buildView(buildStr);
rep.desc += _S(" (") + buildView.sys_str() + _S(")");
}