aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/resource.cpp
diff options
context:
space:
mode:
authorAdrian Frühwirth2018-05-17 12:17:09 +0200
committerEugene Sandulenko2018-06-03 19:38:52 +0100
commitd433aedf37672709b8cf3691de1d02498d3077ef (patch)
tree87138d1848b58bf0c3009ebbeaf222b21c6a6e1a /engines/scumm/resource.cpp
parent8405c5d5f00da1f64906211ceb2d762617fdd8ec (diff)
downloadscummvm-rg350-d433aedf37672709b8cf3691de1d02498d3077ef.tar.gz
scummvm-rg350-d433aedf37672709b8cf3691de1d02498d3077ef.tar.bz2
scummvm-rg350-d433aedf37672709b8cf3691de1d02498d3077ef.zip
SCUMM: Improve 'imuse play' debugger command error handling
This commit introduces the following (seemingly non-invasive) changes to make the 'imuse play' debugger command more useful (i.e. don't crash when trying to load the wrong kind of (sound) resource. * ScummEngine::readSoundResource() Instead of fatally error()'ing upon hitting a non-sound resource type, e.g. a room header (0x524d4844 aka RMHD), we now only issue a warning(). This enables the already existing dead code which properly returns 0 (aka no resource loaded). * ResourceManager::validateResource() Instead of fatally error()'ing upon hitting an illegal glob type we now only issue a warning() and return false (also existing dead code). All methods calling validateResource() check its return value so this seems like the right thing to do anyway. * ScummDebugger::Cmd_IMuse() Instead of directly calling ensureResourceLoaded() we now call getResourceAddress() instead (which in turn calls ensureResourceLoaded() and handles other edge cases) and only attempt to play a sound if the returned pointer actually is valid. Fixes Trac#10527.
Diffstat (limited to 'engines/scumm/resource.cpp')
-rw-r--r--engines/scumm/resource.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 5456ae4f8f..e13bb8f3df 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -887,7 +887,7 @@ void ResourceManager::setHeapThreshold(int min, int max) {
bool ResourceManager::validateResource(const char *str, ResType type, ResId idx) const {
if (type < rtFirst || type > rtLast || (uint)idx >= (uint)_types[type].size()) {
- error("%s Illegal Glob type %s (%d) num %d", str, nameOfResType(type), type, idx);
+ warning("%s Illegal Glob type %s (%d) num %d", str, nameOfResType(type), type, idx);
return false;
}
return true;