2015-07-01 23:50:39 +00:00
|
|
|
#include "SpecBase.hpp"
|
|
|
|
|
|
|
|
namespace Retro
|
|
|
|
{
|
|
|
|
|
2015-07-17 00:01:05 +00:00
|
|
|
bool SpecBase::canExtract(HECL::Database::Project& project,
|
|
|
|
const ExtractPassInfo& info, std::vector<ExtractReport>& reps)
|
2015-07-01 23:50:39 +00:00
|
|
|
{
|
2015-07-18 04:33:38 +00:00
|
|
|
m_disc = NOD::OpenDiscFromImage(info.srcpath.c_str(), m_isWii);
|
2015-07-16 01:57:34 +00:00
|
|
|
if (!m_disc)
|
2015-07-02 20:41:40 +00:00
|
|
|
return false;
|
2015-07-16 01:57:34 +00:00
|
|
|
const char* gameID = m_disc->getHeader().gameID;
|
2015-07-02 20:41:40 +00:00
|
|
|
|
2015-07-18 04:33:38 +00:00
|
|
|
m_standalone = true;
|
|
|
|
if (m_isWii && !memcmp(gameID, "R3M", 3))
|
|
|
|
m_standalone = false;
|
2015-07-01 23:50:39 +00:00
|
|
|
|
2015-07-18 04:33:38 +00:00
|
|
|
if (m_standalone && !checkStandaloneID(gameID))
|
2015-07-10 05:28:08 +00:00
|
|
|
return false;
|
|
|
|
|
2015-07-16 01:57:34 +00:00
|
|
|
char region = m_disc->getHeader().gameID[3];
|
2015-07-13 06:29:12 +00:00
|
|
|
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 = ®NONE;
|
2015-07-12 18:07:58 +00:00
|
|
|
switch (region)
|
|
|
|
{
|
|
|
|
case 'E':
|
|
|
|
regstr = ®E;
|
|
|
|
break;
|
|
|
|
case 'J':
|
|
|
|
regstr = ®J;
|
|
|
|
break;
|
|
|
|
case 'P':
|
|
|
|
regstr = ®P;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-07-18 04:33:38 +00:00
|
|
|
if (m_standalone)
|
2015-07-17 00:01:05 +00:00
|
|
|
return checkFromStandaloneDisc(project, *m_disc.get(), *regstr, info.extractArgs, reps);
|
2015-07-10 05:28:08 +00:00
|
|
|
else
|
2015-07-17 00:01:05 +00:00
|
|
|
return checkFromTrilogyDisc(project, *m_disc.get(), *regstr, info.extractArgs, reps);
|
2015-07-01 23:50:39 +00:00
|
|
|
}
|
|
|
|
|
2015-07-20 23:25:16 +00:00
|
|
|
void SpecBase::doExtract(HECL::Database::Project& project, const ExtractPassInfo& info,
|
|
|
|
FExtractProgress progress)
|
2015-07-01 23:50:39 +00:00
|
|
|
{
|
2015-07-18 04:33:38 +00:00
|
|
|
if (m_isWii)
|
|
|
|
{
|
|
|
|
/* Extract update partition for repacking later */
|
|
|
|
const HECL::SystemString& target = project.getProjectRootPath().getAbsolutePath();
|
|
|
|
NOD::DiscBase::IPartition* update = m_disc->getUpdatePartition();
|
|
|
|
if (update)
|
2015-07-20 23:25:16 +00:00
|
|
|
{
|
|
|
|
progress(_S("Update Partition"), 0, 0.0);
|
2015-07-18 04:33:38 +00:00
|
|
|
update->getFSTRoot().extractToDirectory(target, info.force);
|
2015-07-20 23:25:16 +00:00
|
|
|
progress(_S("Update Partition"), 0, 1.0);
|
|
|
|
}
|
2015-07-18 04:33:38 +00:00
|
|
|
|
|
|
|
if (!m_standalone)
|
|
|
|
{
|
2015-07-20 23:25:16 +00:00
|
|
|
progress(_S("Trilogy Files"), 1, 0.0);
|
2015-07-18 04:33:38 +00:00
|
|
|
NOD::DiscBase::IPartition* data = m_disc->getDataPartition();
|
|
|
|
const NOD::DiscBase::IPartition::Node& root = data->getFSTRoot();
|
|
|
|
for (const NOD::DiscBase::IPartition::Node& child : root)
|
|
|
|
if (child.getKind() == NOD::DiscBase::IPartition::Node::NODE_FILE)
|
|
|
|
child.extractToDirectory(target, info.force);
|
2015-07-20 23:25:16 +00:00
|
|
|
progress(_S("Trilogy Files"), 1, 1.0);
|
2015-07-18 04:33:38 +00:00
|
|
|
}
|
|
|
|
}
|
2015-07-20 23:25:16 +00:00
|
|
|
extractFromDisc(project, *m_disc.get(), info.force, progress);
|
2015-07-01 23:50:39 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2015-07-22 19:05:18 +00:00
|
|
|
return false;
|
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
|
|
|
{
|
2015-07-22 19:05:18 +00:00
|
|
|
return false;
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|