[Scummvm-cvs-logs] SF.net SVN: scummvm:[53985] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Oct 31 21:51:35 CET 2010


Revision: 53985
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53985&view=rev
Author:   drmccoy
Date:     2010-10-31 20:51:35 +0000 (Sun, 31 Oct 2010)

Log Message:
-----------
GOB: Add listArchives debug console command

Modified Paths:
--------------
    scummvm/trunk/engines/gob/console.cpp
    scummvm/trunk/engines/gob/console.h
    scummvm/trunk/engines/gob/dataio.cpp
    scummvm/trunk/engines/gob/dataio.h

Modified: scummvm/trunk/engines/gob/console.cpp
===================================================================
--- scummvm/trunk/engines/gob/console.cpp	2010-10-31 20:07:14 UTC (rev 53984)
+++ scummvm/trunk/engines/gob/console.cpp	2010-10-31 20:51:35 UTC (rev 53985)
@@ -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 @@
 	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

Modified: scummvm/trunk/engines/gob/console.h
===================================================================
--- scummvm/trunk/engines/gob/console.h	2010-10-31 20:07:14 UTC (rev 53984)
+++ scummvm/trunk/engines/gob/console.h	2010-10-31 20:51:35 UTC (rev 53985)
@@ -49,6 +49,8 @@
 	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

Modified: scummvm/trunk/engines/gob/dataio.cpp
===================================================================
--- scummvm/trunk/engines/gob/dataio.cpp	2010-10-31 20:07:14 UTC (rev 53984)
+++ scummvm/trunk/engines/gob/dataio.cpp	2010-10-31 20:51:35 UTC (rev 53985)
@@ -60,6 +60,19 @@
 	}
 }
 
+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);
 

Modified: scummvm/trunk/engines/gob/dataio.h
===================================================================
--- scummvm/trunk/engines/gob/dataio.h	2010-10-31 20:07:14 UTC (rev 53984)
+++ scummvm/trunk/engines/gob/dataio.h	2010-10-31 20:51:35 UTC (rev 53985)
@@ -38,11 +38,19 @@
 
 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);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list