[Scummvm-cvs-logs] SF.net SVN: scummvm:[52667] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Sep 10 16:07:32 CEST 2010


Revision: 52667
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52667&view=rev
Author:   thebluegr
Date:     2010-09-10 14:07:32 +0000 (Fri, 10 Sep 2010)

Log Message:
-----------
SCI: Some changes regarding resources

- Renamed the debug command "resource_size" to "resource_info", as it now provides
the location of where a specified resource is found (i.e. the resource.xxx file, or
the file name itself, if the resource is a patch)
- "duskdump" shows the original location of dumped resources
- loadResource() now shows the location of files that couldn't be loaded

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/console.h
    scummvm/trunk/engines/sci/resource.cpp
    scummvm/trunk/engines/sci/resource.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-09-09 23:01:51 UTC (rev 52666)
+++ scummvm/trunk/engines/sci/console.cpp	2010-09-10 14:07:32 UTC (rev 52667)
@@ -98,7 +98,7 @@
 	DCmd_Register("diskdump",			WRAP_METHOD(Console, cmdDiskDump));
 	DCmd_Register("hexdump",			WRAP_METHOD(Console, cmdHexDump));
 	DCmd_Register("resource_id",		WRAP_METHOD(Console, cmdResourceId));
-	DCmd_Register("resource_size",		WRAP_METHOD(Console, cmdResourceSize));
+	DCmd_Register("resource_info",		WRAP_METHOD(Console, cmdResourceInfo));
 	DCmd_Register("resource_types",		WRAP_METHOD(Console, cmdResourceTypes));
 	DCmd_Register("list",				WRAP_METHOD(Console, cmdList));
 	DCmd_Register("hexgrep",			WRAP_METHOD(Console, cmdHexgrep));
@@ -327,7 +327,7 @@
 	DebugPrintf(" diskdump - Dumps the specified resource to disk as a patch file\n");
 	DebugPrintf(" hexdump - Dumps the specified resource to standard output\n");
 	DebugPrintf(" resource_id - Identifies a resource number by splitting it up in resource type and resource number\n");
-	DebugPrintf(" resource_size - Shows the size of a resource\n");
+	DebugPrintf(" resource_info - Shows info about a resource\n");
 	DebugPrintf(" resource_types - Shows the valid resource types\n");
 	DebugPrintf(" list - Lists all the resources of a given type\n");
 	DebugPrintf(" hexgrep - Searches some resources for a particular sequence of bytes, represented as hexadecimal numbers\n");
@@ -647,7 +647,7 @@
 			outFile->finalize();
 			outFile->close();
 			delete outFile;
-			DebugPrintf("Resource %s.%03d has been dumped to disk\n", argv[1], resNum);
+			DebugPrintf("Resource %s.%03d (located in %s) has been dumped to disk\n", argv[1], resNum, resource->getResourceLocation().c_str());
 		} else {
 			DebugPrintf("Resource %s.%03d not found\n", argv[1], resNum);
 		}
@@ -724,9 +724,9 @@
 	return true;
 }
 
-bool Console::cmdResourceSize(int argc, const char **argv) {
+bool Console::cmdResourceInfo(int argc, const char **argv) {
 	if (argc != 3) {
-		DebugPrintf("Shows the size of a resource\n");
+		DebugPrintf("Shows information about a resource\n");
 		DebugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]);
 		return true;
 	}
@@ -740,6 +740,7 @@
 		Resource *resource = _engine->getResMan()->findResource(ResourceId(res, resNum), 0);
 		if (resource) {
 			DebugPrintf("Resource size: %d\n", resource->size);
+			DebugPrintf("Resource location: %s\n", resource->getResourceLocation().c_str());
 		} else {
 			DebugPrintf("Resource %s.%03d not found\n", argv[1], resNum);
 		}

Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h	2010-09-09 23:01:51 UTC (rev 52666)
+++ scummvm/trunk/engines/sci/console.h	2010-09-10 14:07:32 UTC (rev 52667)
@@ -70,7 +70,7 @@
 	bool cmdDiskDump(int argc, const char **argv);
 	bool cmdHexDump(int argc, const char **argv);
 	bool cmdResourceId(int argc, const char **argv);
-	bool cmdResourceSize(int argc, const char **argv);
+	bool cmdResourceInfo(int argc, const char **argv);
 	bool cmdResourceTypes(int argc, const char **argv);
 	bool cmdList(int argc, const char **argv);
 	bool cmdHexgrep(int argc, const char **argv);

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2010-09-09 23:01:51 UTC (rev 52666)
+++ scummvm/trunk/engines/sci/resource.cpp	2010-09-10 14:07:32 UTC (rev 52667)
@@ -490,8 +490,9 @@
 
 	int error = res->decompress(resMan->getVolVersion(), fileStream);
 	if (error) {
-		warning("Error %d occurred while reading %s from resource file: %s",
-				error, res->_id.toString().c_str(), sci_error_types[error]);
+		warning("Error %d occurred while reading %s from resource file %s: %s",
+				error, res->_id.toString().c_str(), res->getResourceLocation().c_str(),
+				sci_error_types[error]);
 		res->unalloc();
 	}
 
@@ -2353,4 +2354,8 @@
 	return sierraId;
 }
 
+const Common::String &Resource::getResourceLocation() const {
+	return _source->getLocationName();
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2010-09-09 23:01:51 UTC (rev 52666)
+++ scummvm/trunk/engines/sci/resource.h	2010-09-10 14:07:32 UTC (rev 52667)
@@ -219,6 +219,8 @@
 	 */
 	void writeToStream(Common::WriteStream *stream) const;
 
+	const Common::String &getResourceLocation() const;
+
 	// FIXME: This audio specific method is a hack. After all, why should a
 	// Resource have audio specific methods? But for now we keep this, as it
 	// eases transition.


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