metaforce/DataSpec/SpecBase.cpp

94 lines
2.4 KiB
C++
Raw Normal View History

2015-07-01 23:50:39 +00:00
#include "SpecBase.hpp"
namespace Retro
{
2015-07-06 01:33:06 +00:00
LogVisor::LogModule LogModule("RetroDataSpec");
2015-07-10 05:28:08 +00:00
bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps)
2015-07-01 23:50:39 +00:00
{
2015-07-02 20:41:40 +00:00
bool isWii;
std::unique_ptr<NOD::DiscBase> disc = NOD::OpenDiscFromImage(info.srcpath.c_str(), isWii);
2015-07-02 20:41:40 +00:00
if (!disc)
{
LogModule.report(LogVisor::Error, _S("'%s' not a valid Nintendo disc image"), info.srcpath.c_str());
2015-07-02 20:41:40 +00:00
return false;
}
const char* gameID = disc->getHeader().gameID;
2015-07-10 05:28:08 +00:00
bool valid = false;
2015-07-12 18:07:58 +00:00
bool standalone = true;
2015-07-02 20:41:40 +00:00
if (isWii)
{
2015-07-10 05:28:08 +00:00
if (!memcmp(gameID, "R3M", 3))
2015-07-12 18:07:58 +00:00
{
2015-07-10 05:28:08 +00:00
valid = true;
2015-07-12 18:07:58 +00:00
standalone = false;
}
2015-07-10 05:28:08 +00:00
else if (!memcmp(gameID, "R3IJ01", 6))
valid = true;
2015-07-02 20:41:40 +00:00
}
else
{
2015-07-10 05:28:08 +00:00
if (!memcmp(gameID, "GM8", 3))
valid = true;
2015-07-02 20:41:40 +00:00
}
2015-07-01 23:50:39 +00:00
2015-07-10 05:28:08 +00:00
if (!valid)
{
LogModule.report(LogVisor::Error, "%.6s (%s) is not supported", gameID, disc->getHeader().gameTitle);
return false;
}
2015-07-12 18:07:58 +00:00
char region = disc->getHeader().gameID[3];
static const HECL::SystemString regNONE = _S("");
static const HECL::SystemString regE = _S("NTSC");
static const HECL::SystemString regJ = _S("NTSC-J");
static const HECL::SystemString regP = _S("PAL");
const HECL::SystemString* regstr = &regNONE;
2015-07-12 18:07:58 +00:00
switch (region)
{
case 'E':
regstr = &regE;
break;
case 'J':
regstr = &regJ;
break;
case 'P':
regstr = &regP;
break;
}
if (standalone)
return checkFromStandaloneDisc(*disc.get(), *regstr, info.extractArgs, reps);
2015-07-10 05:28:08 +00:00
else
2015-07-12 18:07:58 +00:00
return checkFromTrilogyDisc(*disc.get(), *regstr, info.extractArgs, reps);
2015-07-01 23:50:39 +00:00
}
void SpecBase::doExtract(const HECL::Database::Project& project, const ExtractPassInfo& info)
{
}
2015-07-06 01:33:06 +00:00
bool SpecBase::canCook(const HECL::Database::Project& project, const CookTaskInfo& info)
2015-07-01 23:50:39 +00:00
{
}
void SpecBase::doCook(const HECL::Database::Project& project, const CookTaskInfo& info)
{
}
2015-07-06 01:33:06 +00:00
bool SpecBase::canPackage(const HECL::Database::Project& project, const PackagePassInfo& info)
2015-07-01 23:50:39 +00:00
{
}
void SpecBase::gatherDependencies(const HECL::Database::Project& project, const PackagePassInfo& info,
std::unordered_set<HECL::ProjectPath>& implicitsOut)
{
}
void SpecBase::doPackage(const HECL::Database::Project& project, const PackagePassInfo& info)
{
}
}