integrated dataspec into RetroCommon

This commit is contained in:
Jack Andersen 2015-07-01 13:50:39 -10:00
parent af64e55395
commit 1e7f39e4c5
17 changed files with 214 additions and 18 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "PakLib"]
path = PakLib
url = https://github.com/RetroView/PakLib.git
[submodule "NODLib"]
path = NODLib
url = https://github.com/RetroView/NODLib.git

View File

@ -1,5 +0,0 @@
include(DNACommon/DNACommon.pri)
include(DNAMP1/DNAMP1.pri)
include(DNAMP2/DNAMP2.pri)
include(DNAMP3/DNAMP3.pri)

View File

@ -5,6 +5,9 @@
#include <CFourCC.hpp>
#include <CUniqueID.hpp>
namespace Retro
{
/* This comes up a great deal */
typedef Athena::io::DNA<Athena::BigEndian> BigDNA;
@ -52,4 +55,6 @@ public:
{_write(writer);}
};
}
#endif // __DNA_COMMON_HPP__

View File

@ -1,5 +1,7 @@
#include "../DNACommon/DNACommon.hpp"
namespace Retro
{
namespace DNAMP1
{
@ -101,3 +103,4 @@ struct MLVL : public BigDNA
};
}
}

26
DataSpec/DataSpec.pro Normal file
View File

@ -0,0 +1,26 @@
TEMPLATE = lib
CONFIG += staticlib c++11
TARGET = RetroDataSpec
CONFIG -= Qt
QT =
# Get hecl's headers (when built as submodule in hecl's extern)
INCLUDEPATH += ../../../include \
../../Athena/include \
../NODLib/include
include(../PakLib/PakLib.pri)
include(DNACommon/DNACommon.pri)
include(DNAMP1/DNAMP1.pri)
include(DNAMP2/DNAMP2.pri)
include(DNAMP3/DNAMP3.pri)
HEADERS += \
SpecBase.hpp
SOURCES += \
SpecMP1.cpp \
SpecMP2.cpp \
SpecMP3.cpp \
SpecBase.cpp

39
DataSpec/SpecBase.cpp Normal file
View File

@ -0,0 +1,39 @@
#include "SpecBase.hpp"
namespace Retro
{
bool SpecBase::canExtract(const HECL::Database::Project& project, const ExtractPassInfo& info,
HECL::SystemString& reasonNo)
{
}
void SpecBase::doExtract(const HECL::Database::Project& project, const ExtractPassInfo& info)
{
}
bool SpecBase::canCook(const HECL::Database::Project& project, const CookTaskInfo& info,
HECL::SystemString& reasonNo)
{
}
void SpecBase::doCook(const HECL::Database::Project& project, const CookTaskInfo& info)
{
}
bool SpecBase::canPackage(const HECL::Database::Project& project, const PackagePassInfo& info,
HECL::SystemString& reasonNo)
{
}
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)
{
}
}

53
DataSpec/SpecBase.hpp Normal file
View File

@ -0,0 +1,53 @@
#ifndef SPECBASE_HPP
#define SPECBASE_HPP
#include <functional>
#include <NODLib.hpp>
#include <HECLDatabase.hpp>
namespace Retro
{
struct SpecBase : public HECL::Database::IDataSpec
{
bool canExtract(const HECL::Database::Project& project, const ExtractPassInfo& info,
HECL::SystemString& reasonNo);
void doExtract(const HECL::Database::Project& project, const ExtractPassInfo& info);
bool canCook(const HECL::Database::Project& project, const CookTaskInfo& info,
HECL::SystemString& reasonNo);
void doCook(const HECL::Database::Project& project, const CookTaskInfo& info);
bool canPackage(const HECL::Database::Project& project, const PackagePassInfo& info,
HECL::SystemString& reasonNo);
void gatherDependencies(const HECL::Database::Project& project, const PackagePassInfo& info,
std::unordered_set<HECL::ProjectPath>& implicitsOut);
void doPackage(const HECL::Database::Project& project, const PackagePassInfo& info);
virtual bool checkFromGCNDisc(const NOD::DiscGCN& disc)=0;
virtual bool readFromGCNDisc(const NOD::DiscGCN& disc)=0;
virtual bool checkFromWiiDisc(const NOD::DiscWii& disc)=0;
virtual bool readFromWiiDisc(const NOD::DiscWii& disc)=0;
virtual bool checkFromProject(const HECL::Database::Project& proj)=0;
virtual bool readFromProject(const HECL::Database::Project& proj)=0;
virtual bool visitGameObjects(std::function<bool(const HECL::Database::ObjectBase&)>)=0;
struct ILevelSpec
{
virtual bool visitLevelObjects(std::function<bool(const HECL::Database::ObjectBase&)>)=0;
struct IAreaSpec
{
virtual bool visitAreaObjects(std::function<bool(const HECL::Database::ObjectBase&)>)=0;
};
virtual bool visitAreas(std::function<bool(const IAreaSpec&)>)=0;
};
virtual bool visitLevels(std::function<bool(const ILevelSpec&)>)=0;
};
}
#endif // SPECBASE_HPP

61
DataSpec/SpecMP1.cpp Normal file
View File

@ -0,0 +1,61 @@
#include "SpecBase.hpp"
namespace Retro
{
struct SpecMP1 : public SpecBase
{
bool checkFromGCNDisc(const NOD::DiscGCN& disc)
{
}
bool readFromGCNDisc(const NOD::DiscGCN& disc)
{
}
bool checkFromWiiDisc(const NOD::DiscWii& disc)
{
}
bool readFromWiiDisc(const NOD::DiscWii& disc)
{
}
bool checkFromProject(const HECL::Database::Project& proj)
{
}
bool readFromProject(const HECL::Database::Project& proj)
{
}
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&)>)
{
}
};
static HECL::Database::DataSpecEntry SpecMP1
(
_S("MP1"),
_S("Data specification for original Metroid Prime engine"),
[](HECL::Database::DataSpecTool) -> HECL::Database::IDataSpec* {return new struct SpecMP1;}
);
}

8
DataSpec/SpecMP2.cpp Normal file
View File

@ -0,0 +1,8 @@
#include "SpecBase.hpp"
static HECL::Database::DataSpecEntry SpecMP2
(
_S("MP2"),
_S("Data specification for original Metroid Prime 2 engine"),
[](HECL::Database::DataSpecTool tool) -> HECL::Database::IDataSpec* {}
);

9
DataSpec/SpecMP3.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "SpecBase.hpp"
static HECL::Database::DataSpecEntry SpecMP3
(
_S("MP3"),
_S("Data specification for original Metroid Prime 3 engine"),
[](HECL::Database::DataSpecTool tool) -> HECL::Database::IDataSpec* {}
);

1
NODLib Submodule

@ -0,0 +1 @@
Subproject commit a1b2a262bf4a4847eda00790da77a1a5289ddba1

View File

@ -1,13 +0,0 @@
INCLUDEPATH += $$PWD/DNA $$PWD/include
include(../libSquish/libSquish.pri)
include(PakLib/PakLib.pri)
HEADERS += \
$$PWD/include/RetroCommon.hpp
SOURCES += \
$$PWD/src/RetroCommon.cpp \
$$PWD/src/MREADecompress.cpp
include(DNA/DNA.pri)

6
RetroCommon.pro Normal file
View File

@ -0,0 +1,6 @@
TEMPLATE = subdirs
CONFIG -= Qt
QT =
SUBDIRS += DataSpec NODLib/lib