metaforce/DataSpec/SpecMP1.cpp

97 lines
2.5 KiB
C++
Raw Normal View History

2015-07-07 03:22:44 +00:00
#include <utility>
#define NOD_ATHENA 1
2015-07-01 23:50:39 +00:00
#include "SpecBase.hpp"
2015-07-07 03:22:44 +00:00
#include "DNAMP1/PAK.hpp"
2015-07-01 23:50:39 +00:00
namespace Retro
{
2015-07-07 03:22:44 +00:00
struct SpecMP1 : SpecBase
2015-07-01 23:50:39 +00:00
{
2015-07-07 03:22:44 +00:00
std::map<std::string, std::pair<std::string, DNAMP1::PAK>> m_worldPaks;
bool checkFromGCNDisc(NOD::DiscGCN& disc, ExtractOption& opts)
2015-07-01 23:50:39 +00:00
{
2015-07-07 03:22:44 +00:00
if (memcmp(disc.getHeader().gameID, "GM8", 3))
return false;
/* Iterate PAKs and build level options */
m_worldPaks.clear();
NOD::DiscBase::IPartition::Node& root = disc.getDataPartition()->getFSTRoot();
for (const NOD::DiscBase::IPartition::Node& child : root)
{
std::string name = child.getName();
std::transform(name.begin(), name.end(), name.begin(), tolower);
if (!name.compare(0, 7, "metroid") && !name.compare(8, 4, ".pak"))
{
/* This is a world pak */
std::pair<std::map<std::string, std::pair<std::string, DNAMP1::PAK>>::iterator,bool> res =
m_worldPaks.emplace(std::make_pair(name, std::make_pair(child.getName(), DNAMP1::PAK())));
if (res.second)
{
NOD::AthenaPartReadStream rs(child.beginReadStream());
res.first->second.second.read(rs);
}
}
}
return true;
2015-07-01 23:50:39 +00:00
}
2015-07-07 03:22:44 +00:00
bool readFromGCNDisc(NOD::DiscGCN& disc)
2015-07-01 23:50:39 +00:00
{
2015-07-07 03:22:44 +00:00
2015-07-01 23:50:39 +00:00
}
2015-07-07 03:22:44 +00:00
bool checkFromWiiDisc(NOD::DiscWii& disc, ExtractOption& opts)
2015-07-01 23:50:39 +00:00
{
2015-07-07 03:22:44 +00:00
if (memcmp(disc.getHeader().gameID, "R3M", 3))
return false;
return true;
2015-07-01 23:50:39 +00:00
}
2015-07-07 03:22:44 +00:00
bool readFromWiiDisc(NOD::DiscWii& disc)
2015-07-01 23:50:39 +00:00
{
}
2015-07-07 03:22:44 +00:00
bool checkFromProject(HECL::Database::Project& proj)
2015-07-01 23:50:39 +00:00
{
}
2015-07-07 03:22:44 +00:00
bool readFromProject(HECL::Database::Project& proj)
2015-07-01 23:50:39 +00:00
{
}
bool visitGameObjects(std::function<bool(const HECL::Database::ObjectBase&)>)
{
}
struct LevelSpec : public ILevelSpec
{
bool visitLevelObjects(std::function<bool(const HECL::Database::ObjectBase&)>)
{
}
struct AreaSpec : public IAreaSpec
{
bool visitAreaObjects(std::function<bool(const HECL::Database::ObjectBase&)>)
{
}
};
bool visitAreas(std::function<bool(const IAreaSpec&)>)
{
}
};
bool visitLevels(std::function<bool(const ILevelSpec&)>)
{
}
};
2015-07-06 01:33:06 +00:00
HECL::Database::DataSpecEntry SpecMP1 =
{
2015-07-01 23:50:39 +00:00
_S("MP1"),
_S("Data specification for original Metroid Prime engine"),
[](HECL::Database::DataSpecTool) -> HECL::Database::IDataSpec* {return new struct SpecMP1;}
2015-07-06 01:33:06 +00:00
};
2015-07-01 23:50:39 +00:00
}