diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/console.cpp | 26 | ||||
-rw-r--r-- | engines/gob/console.h | 2 | ||||
-rw-r--r-- | engines/gob/dataio.cpp | 13 | ||||
-rw-r--r-- | engines/gob/dataio.h | 8 |
4 files changed, 44 insertions, 5 deletions
diff --git a/engines/gob/console.cpp b/engines/gob/console.cpp index 247911402f..b6b481f611 100644 --- a/engines/gob/console.cpp +++ b/engines/gob/console.cpp @@ -26,15 +26,17 @@ #include "gob/console.h" #include "gob/gob.h" #include "gob/inter.h" +#include "gob/dataio.h" namespace Gob { GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm) { - DCmd_Register("varSize", WRAP_METHOD(GobConsole, cmd_varSize)); - DCmd_Register("var8", WRAP_METHOD(GobConsole, cmd_var8)); - DCmd_Register("var16", WRAP_METHOD(GobConsole, cmd_var16)); - DCmd_Register("var32", WRAP_METHOD(GobConsole, cmd_var32)); - DCmd_Register("varString", WRAP_METHOD(GobConsole, cmd_varString)); + DCmd_Register("varSize", WRAP_METHOD(GobConsole, cmd_varSize)); + DCmd_Register("var8", WRAP_METHOD(GobConsole, cmd_var8)); + DCmd_Register("var16", WRAP_METHOD(GobConsole, cmd_var16)); + DCmd_Register("var32", WRAP_METHOD(GobConsole, cmd_var32)); + DCmd_Register("varString", WRAP_METHOD(GobConsole, cmd_varString)); + DCmd_Register("listArchives", WRAP_METHOD(GobConsole, cmd_listArchives)); } GobConsole::~GobConsole() { @@ -144,4 +146,18 @@ bool GobConsole::cmd_varString(int argc, const char **argv) { return true; } +bool GobConsole::cmd_listArchives(int argc, const char **argv) { + Common::Array<ArchiveInfo> info; + + _vm->_dataIO->getArchiveInfo(info); + + DebugPrintf(" Archive | Base | FileCount\n"); + DebugPrintf("--------------------------------\n"); + for (Common::Array<ArchiveInfo>::const_iterator it = info.begin(); it != info.end(); ++it) + if (!it->name.empty()) + DebugPrintf("%13s | %d | %d\n", it->name.c_str(), it->base, it->fileCount); + + return true; +} + } // End of namespace Gob diff --git a/engines/gob/console.h b/engines/gob/console.h index 5dc6096062..f51d74be86 100644 --- a/engines/gob/console.h +++ b/engines/gob/console.h @@ -49,6 +49,8 @@ private: bool cmd_var16(int argc, const char **argv); bool cmd_var32(int argc, const char **argv); bool cmd_varString(int argc, const char **argv); + + bool cmd_listArchives(int argc, const char **argv); }; } // End of namespace Mohawk diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp index e53d40754f..e409025fc3 100644 --- a/engines/gob/dataio.cpp +++ b/engines/gob/dataio.cpp @@ -60,6 +60,19 @@ DataIO::~DataIO() { } } +void DataIO::getArchiveInfo(Common::Array<ArchiveInfo> &info) const { + info.resize(_archives.size()); + + for (uint i = 0; i < _archives.size(); i++) { + if (!_archives[i]) + continue; + + info[i].name = _archives[i]->name; + info[i].base = _archives[i]->base; + info[i].fileCount = _archives[i]->files.size(); + } +} + byte *DataIO::unpack(const byte *src, uint32 srcSize, int32 &size) { size = READ_LE_UINT32(src); diff --git a/engines/gob/dataio.h b/engines/gob/dataio.h index e18ab16803..6e12d15af8 100644 --- a/engines/gob/dataio.h +++ b/engines/gob/dataio.h @@ -38,11 +38,19 @@ namespace Common { namespace Gob { +struct ArchiveInfo { + Common::String name; + bool base; + uint32 fileCount; +}; + class DataIO { public: DataIO(); ~DataIO(); + void getArchiveInfo(Common::Array<ArchiveInfo> &info) const; + bool openArchive(Common::String name, bool base); bool closeArchive(bool base); |