Ticket #8167: cmi-smushsync2.diff

File cmi-smushsync2.diff, 2.4 KB (added by eriktorbjorn, 21 years ago)

Patch against a January 24 CVS snapshot

  • scummvm/scumm/smush/scumm_renderer.cpp

    diff -ur ScummVM-cvs20030124/scummvm/scumm/smush/scumm_renderer.cpp ScummVM-cvs20030124+hack/scummvm/scumm/smush/scumm_renderer.cpp
    old new  
    199199ScummRenderer::ScummRenderer(Scumm * scumm, uint32 speed) :
    200200        _scumm(scumm),
    201201        _smixer(0),
    202         _insaneSpeed(speed) {
     202        _insaneSpeed(speed),
     203        _pending_updates(0) {
    203204}
    204205
    205206static ScummRenderer * s_renderer;
     
    239240}
    240241
    241242bool ScummRenderer::wait(int32 ms) {
    242         while(_wait) {
     243        // Because waitForTimer() also is the function that checks for user
     244        // input we always want to call it at least once between frames, or
     245        // the user may become unable to interrupt the movie.
     246        do {
    243247                _scumm->waitForTimer(1);
    244         }
     248        } while(_pending_updates <= 0);
    245249        return true;
    246250}
    247251
     
    275279void ScummRenderer::save(int32 frame) {
    276280        int width = MIN(getWidth(), _scumm->_realWidth);
    277281        int height = MIN(getHeight(), _scumm->_realHeight);
    278        
    279         _scumm->_system->copy_rect((const byte *)data(), getWidth(), 0, 0, width, height);
    280         _scumm->_system->update_screen();
     282
     283        // In theory, this will always be true. In reality, there may be
     284        // several pending updates because the computer wasn't fast enough to
     285        // process them all. In that case, skip the frame to catch up.
     286        if (--_pending_updates <= 0) {
     287                _scumm->_system->copy_rect((const byte *)data(), getWidth(), 0, 0, width, height);
     288                _scumm->_system->update_screen();
     289        } else
     290                warning("ScummRenderer: Skipping frame %d to catch up", getFrame());
    281291        _scumm->processKbd();
    282         _wait = true;
    283292}
    284293
    285294bool ScummRenderer::prematureClose() {
     
    289298}
    290299
    291300bool ScummRenderer::update() {
    292         _wait = false;
     301        _pending_updates++;
    293302        return true;
    294303}
    295304
  • scummvm/scumm/smush/scumm_renderer.h

    diff -ur ScummVM-cvs20030124/scummvm/scumm/smush/scumm_renderer.h ScummVM-cvs20030124+hack/scummvm/scumm/smush/scumm_renderer.h
    old new  
    4545        Scumm * _scumm;
    4646        ScummMixer * _smixer;
    4747        uint32 _insaneSpeed;
    48         volatile bool _wait;
     48        volatile int _pending_updates;
    4949public:
    5050        ScummRenderer(Scumm * scumm, uint32 speed);
    5151        virtual ~ScummRenderer();