Ticket #2438: soundkludge-kludge.diff

File soundkludge-kludge.diff, 1.9 KB (added by eriktorbjorn, 16 years ago)

Possible (but ugly) workaround

  • scumm/script.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
    retrieving revision 1.240
    diff -u -r1.240 script.cpp
     
    356356        if (_currentScript == 0xFF)
    357357                return;
    358358
     359        _hangCounter = 0;       // See o6_soundKludge()
     360
    359361        vm.slot[_currentScript].offs = _scriptPointer - _scriptOrgPointer;
    360362}
    361363
  • scumm/script_v6.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
    retrieving revision 1.460
    diff -u -r1.460 script_v6.cpp
     
    22502250}
    22512251
    22522252void ScummEngine_v6::o6_soundKludge() {
     2253        // WORKAROUND: At least one of the CMI scripts will busy-wait while
     2254        // piling up calls to soundKludge(). At best, this will cause
     2255        // animations to freeze momentarily. On some platforms, it will cuse
     2256        // ScummVM itself to freeze indefinitely. See bug #1398195.
     2257
     2258        if (_gameId == GID_CMI && _hangCounter++ > 20) {
     2259                warning("Detected possible hang in script %d", vm.slot[_currentScript].number);
     2260                _scriptPointer--;
     2261                o6_breakHere();
     2262                return;
     2263        }
     2264
    22532265        int list[16];
    22542266        int num = getStackList(list, ARRAYSIZE(list));
    22552267
  • scumm/scumm.h

    RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
    retrieving revision 1.671
    diff -u -r1.671 scumm.h
     
    614614        uint32 _localScriptOffsets[1024];
    615615        const byte *_scriptPointer, *_scriptOrgPointer;
    616616        byte _opcode, _currentScript;
     617        uint32 _hangCounter;
    617618        const byte * const *_lastCodePtr;
    618619        int _resultVarNumber, _scummStackPos;
    619620        int _vmStack[150];