From 4e27844fef5c631bc92fbd9e0e61da7d1d2bfe86 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Sep 2010 14:07:32 +0000 Subject: 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 svn-id: r52667 --- engines/sci/console.cpp | 11 ++++++----- engines/sci/console.h | 2 +- engines/sci/resource.cpp | 9 +++++++-- engines/sci/resource.h | 2 ++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 4a572cca18..94e53ed742 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -98,7 +98,7 @@ Console::Console(SciEngine *engine) : GUI::Debugger(), 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 @@ bool Console::cmdHelp(int argc, const char **argv) { 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 @@ bool Console::cmdDiskDump(int argc, const char **argv) { 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 @@ bool Console::cmdRoomNumber(int argc, const char **argv) { 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 \n", argv[0]); return true; } @@ -740,6 +740,7 @@ bool Console::cmdResourceSize(int argc, const char **argv) { 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); } diff --git a/engines/sci/console.h b/engines/sci/console.h index 444443154c..8bc2da439c 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -70,7 +70,7 @@ private: 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); diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 46fb0fbf99..2f380d3bba 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -490,8 +490,9 @@ void ResourceSource::loadResource(ResourceManager *resMan, Resource *res) { 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 @@ Common::String ResourceManager::findSierraGameId() { return sierraId; } +const Common::String &Resource::getResourceLocation() const { + return _source->getLocationName(); +} + } // End of namespace Sci diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 53c00f6ec0..f5d6517398 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -219,6 +219,8 @@ public: */ 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. -- cgit v1.2.3