diff options
author | Filippos Karapetis | 2009-11-20 14:17:47 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-11-20 14:17:47 +0000 |
commit | 551ca5f2c0d2806c77a7a6bb69d53c12a12021cc (patch) | |
tree | b84dddf303163f3b857085dd9c587e7b98971bec /engines/sci/engine/state.cpp | |
parent | e7820f972d3c186e241fff34b42ddada3583c443 (diff) | |
download | scummvm-rg350-551ca5f2c0d2806c77a7a6bb69d53c12a12021cc.tar.gz scummvm-rg350-551ca5f2c0d2806c77a7a6bb69d53c12a12021cc.tar.bz2 scummvm-rg350-551ca5f2c0d2806c77a7a6bb69d53c12a12021cc.zip |
Changed the lofs detection to iterate through all the methods of the Game object again, instead of a specific selector - fixes Jones
svn-id: r46006
Diffstat (limited to 'engines/sci/engine/state.cpp')
-rw-r--r-- | engines/sci/engine/state.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index de66aabf12..816aaec774 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -233,7 +233,7 @@ Common::String EngineState::strSplit(const char *str, const char *sep) { return retval; } -bool EngineState::autoDetectFeature(FeatureDetection featureDetection) { +bool EngineState::autoDetectFeature(FeatureDetection featureDetection, int methodNum) { Common::String objName; Selector slc; @@ -257,11 +257,6 @@ bool EngineState::autoDetectFeature(FeatureDetection featureDetection) { break; case kDetectLofsType: objName = "Game"; - slc = _kernel->_selectorCache.play; - break; - case kDetectLofsTypeFallback: - objName = "Game"; - slc = _kernel->_selectorCache.newRoom; break; default: break; @@ -274,9 +269,13 @@ bool EngineState::autoDetectFeature(FeatureDetection featureDetection) { return false; } - if (lookup_selector(_segMan, objAddr, slc, NULL, &addr) != kSelectorMethod) { - warning("autoDetectFeature: target selector is not a method of object %s", objName.c_str()); - return false; + if (featureDetection != kDetectLofsType) { + if (lookup_selector(_segMan, objAddr, slc, NULL, &addr) != kSelectorMethod) { + warning("autoDetectFeature: target selector is not a method of object %s", objName.c_str()); + return false; + } + } else { + addr = _segMan->getObject(objAddr)->getFunction(methodNum); } uint16 offset = addr.offset; @@ -289,7 +288,7 @@ bool EngineState::autoDetectFeature(FeatureDetection featureDetection) { int i = 0; byte argc; - if (featureDetection == kDetectLofsType || featureDetection == kDetectLofsTypeFallback) { + if (featureDetection == kDetectLofsType) { if (opcode == op_lofsa || opcode == op_lofss) { uint16 lofs; @@ -315,7 +314,8 @@ bool EngineState::autoDetectFeature(FeatureDetection featureDetection) { if ((signed)offset + (int16)lofs >= (signed)script->_bufSize) _lofsType = SCI_VERSION_1_MIDDLE; - return true; + if (_lofsType != SCI_VERSION_AUTODETECT) + return true; } } @@ -483,9 +483,19 @@ SciVersion EngineState::detectLofsType() { return _lofsType; } - // Either the init or the newRoom selectors of the Game - // object make calls to lofsa/lofss - if (!autoDetectFeature(kDetectLofsType) && !autoDetectFeature(kDetectLofsTypeFallback)) { + // Find a function of the game object which invokes lofsa/lofss + reg_t gameClass = _segMan->findObjectByName("Game"); + Object *obj = _segMan->getObject(gameClass); + bool found = false; + + for (uint m = 0; m < obj->getMethodCount(); m++) { + found = autoDetectFeature(kDetectLofsType, m); + + if (found) + break; + } + + if (!found) { warning("Lofs detection failed, taking an educated guess"); if (getSciVersion() >= SCI_VERSION_1_MIDDLE) |