[Scummvm-git-logs] scummvm master -> d433aedf37672709b8cf3691de1d02498d3077ef
sev-
sev at scummvm.org
Sun Jun 3 20:38:56 CEST 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d433aedf37 SCUMM: Improve 'imuse play' debugger command error handling
Commit: d433aedf37672709b8cf3691de1d02498d3077ef
https://github.com/scummvm/scummvm/commit/d433aedf37672709b8cf3691de1d02498d3077ef
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-06-03T19:38:52+01:00
Commit Message:
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.
Changed paths:
engines/scumm/debugger.cpp
engines/scumm/resource.cpp
engines/scumm/sound.cpp
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index 617c2ab..4dff43c 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -145,8 +145,8 @@ bool ScummDebugger::Cmd_IMuse(int argc, const char **argv) {
debugPrintf("Selecting from %d songs...\n", _vm->_numSounds);
sound = _vm->_rnd.getRandomNumber(_vm->_numSounds);
}
- _vm->ensureResourceLoaded(rtSound, sound);
- _vm->_musicEngine->startSound(sound);
+ if (_vm->getResourceAddress(rtSound, sound))
+ _vm->_musicEngine->startSound(sound);
debugPrintf("Attempted to start music %d.\n", sound);
} else {
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 5456ae4..e13bb8f 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;
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 8099dd2..b9b7e28 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -1321,8 +1321,9 @@ int ScummEngine::readSoundResource(ResId idx) {
//dumpResource("sound-", idx, ptr);
return 1;
}
- error("Unrecognized base tag 0x%08x in sound %d", basetag, idx);
}
+
+ warning("Unrecognized base tag 0x%08x in sound %d", basetag, idx);
_res->_types[rtSound][idx]._roomoffs = RES_INVALID_OFFSET;
return 0;
}
More information about the Scummvm-git-logs
mailing list