2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-16 04:17:03 +00:00

added extract tool

This commit is contained in:
Jack Andersen
2015-06-11 23:08:49 -10:00
parent 8de863fcba
commit 4b13e9da9d
10 changed files with 123 additions and 22 deletions

View File

@@ -0,0 +1,50 @@
#ifndef CTOOL_EXTRACT
#define CTOOL_EXTRACT
#include "ToolBase.hpp"
#include <stdio.h>
class ToolExtract final : public ToolBase
{
public:
ToolExtract(const ToolPassInfo& info)
: ToolBase(info)
{
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.beginWrap();
help.wrap(_S("hecl-extract - Extract objects from supported package/image formats\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl extract <packagefile>[/<subnode>...]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command recursively extracts all or part of a dataspec-supported "
"package format.\n\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<packagefile>[/<subnode>...]"), _S("input file"));
help.beginWrap();
help.wrap(_S("Specifies the package file or disc image to source data from. "
"An optional subnode specifies a named hierarchical-node specific "
"to the game architecture (levels/areas)."));
help.endWrap();
}
HECL::SystemString toolName() const {return _S("extract");}
int run()
{
return 0;
}
};
#endif // CTOOL_EXTRACT

View File

@@ -60,6 +60,8 @@ public:
helpFunc = ToolInit::Help;
else if (toolName == _S("spec"))
helpFunc = ToolSpec::Help;
else if (toolName == _S("extract"))
helpFunc = ToolExtract::Help;
else if (toolName == _S("add"))
helpFunc = ToolAdd::Help;
else if (toolName == _S("remove") || toolName == _S("rm"))

View File

@@ -45,7 +45,8 @@ public:
return -1;
try
{
HECL::Database::Project(HECL::ProjectRootPath(*m_dir));
HECL::Database::Project proj((HECL::ProjectRootPath(*m_dir)));
proj.enableDataSpecs({_S("hecl-little")});
}
catch (HECL::Exception& e)
{

View File

@@ -23,6 +23,7 @@ SOURCES += \
HEADERS += \
ToolBase.hpp \
ToolPackage.hpp \
ToolExtract.hpp \
ToolInit.hpp \
ToolHelp.hpp \
ToolGroup.hpp \

View File

@@ -10,6 +10,7 @@
#include "ToolBase.hpp"
#include "ToolInit.hpp"
#include "ToolSpec.hpp"
#include "ToolExtract.hpp"
#include "ToolAdd.hpp"
#include "ToolRemove.hpp"
#include "ToolGroup.hpp"
@@ -180,6 +181,8 @@ int main(int argc, const char** argv)
tool.reset(new ToolInit(info));
else if (toolName == _S("spec"))
tool.reset(new ToolSpec(info));
else if (toolName == _S("extract"))
tool.reset(new ToolExtract(info));
else if (toolName == _S("add"))
tool.reset(new ToolAdd(info));
else if (toolName == _S("remove") || toolName == _S("rm"))