[Scummvm-git-logs] scummvm master -> 85105294f2534ca286cfcaa8f1cbbd68fba765d1

csnover csnover at users.noreply.github.com
Sat May 6 17:40:19 CEST 2017


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b73e275b42 SCI32: Micro-optimize speedRoom comparison
575ed98da1 SCI32: Centralize handling of pixel format switches
91df45c6c5 SCI32: Fix missing/incorrect game features detection
8b49313af3 SCI32: Fix terrible rendering performance when vsync is enabled
8a590e600f SCI32: Disable VMD kPlayFlagBlackPalette flag
85105294f2 SCI32: Add some missing onFrame hooks for the debugger


Commit: b73e275b42955d95b8728f8c636e42d3373bf8e8
    https://github.com/scummvm/scummvm/commit/b73e275b42955d95b8728f8c636e42d3373bf8e8
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-05-06T10:38:58-05:00

Commit Message:
SCI32: Micro-optimize speedRoom comparison

Changed paths:
    engines/sci/engine/guest_additions.cpp


diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index f52bffd..e2b7354 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -525,7 +525,7 @@ bool GuestAdditions::restoreFromLauncher() const {
 		// exist. In other games, restoring early either breaks benchmarking,
 		// or, when trying to load an invalid save game, makes the dialog
 		// telling the user that the game is invalid impossible to read
-		if (Common::String(_segMan->getObjectName(_state->variables[VAR_GLOBAL][kGlobalVarCurrentRoom])) == "speedRoom") {
+		if (strcmp(_segMan->getObjectName(_state->variables[VAR_GLOBAL][kGlobalVarCurrentRoom]), "speedRoom") == 0) {
 			return false;
 		}
 


Commit: 575ed98da1035c0d08338f01b6db6de5e5987214
    https://github.com/scummvm/scummvm/commit/575ed98da1035c0d08338f01b6db6de5e5987214
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-05-06T10:38:58-05:00

Commit Message:
SCI32: Centralize handling of pixel format switches

Changed paths:
    engines/sci/graphics/frameout.h
    engines/sci/graphics/video32.cpp


diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 650c2c7..e706f14 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -23,6 +23,7 @@
 #ifndef SCI_GRAPHICS_FRAMEOUT_H
 #define SCI_GRAPHICS_FRAMEOUT_H
 
+#include "engines/util.h"                // for initGraphics
 #include "sci/graphics/plane32.h"
 #include "sci/graphics/screen_item32.h"
 
@@ -284,6 +285,10 @@ private:
 	}
 
 public:
+	void setPixelFormat(const Graphics::PixelFormat &format) const {
+		initGraphics(_currentBuffer.screenWidth, _currentBuffer.screenHeight, _isHiRes, &format);
+	}
+
 	/**
 	 * Whether palMorphFrameOut should be used instead of
 	 * frameOut for rendering. Used by kMorphOn to
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 0a7cd7e..35a92c3 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -26,7 +26,6 @@
 #include "common/util.h"                 // for ARRAYSIZE
 #include "common/system.h"               // for g_system
 #include "engine.h"                      // for Engine, g_engine
-#include "engines/util.h"                // for initGraphics
 #include "sci/console.h"                 // for Console
 #include "sci/engine/features.h"         // for GameFeatures
 #include "sci/engine/state.h"            // for EngineState
@@ -286,9 +285,8 @@ void AVIPlayer::init() {
 		// have a 24bpp mode but just directed VFW to display videos instead)
 		g_sci->_gfxCursor32->hide();
 
-		const Buffer &currentBuffer = g_sci->_gfxFrameout->getCurrentBuffer();
 		const Graphics::PixelFormat format = _decoder->getPixelFormat();
-		initGraphics(currentBuffer.screenWidth, currentBuffer.screenHeight, g_sci->_gfxFrameout->_isHiRes, &format);
+		g_sci->_gfxFrameout->setPixelFormat(format);
 
 		if (_pixelDouble) {
 			const int16 width = _drawRect.width();
@@ -338,10 +336,8 @@ AVIPlayer::IOStatus AVIPlayer::close() {
 	_scaleBuffer = nullptr;
 
 	if (_decoder->getPixelFormat().bytesPerPixel != 1) {
-		const bool isHiRes = g_sci->_gfxFrameout->_isHiRes;
-		const Buffer &currentBuffer = g_sci->_gfxFrameout->getCurrentBuffer();
 		const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
-		initGraphics(currentBuffer.screenWidth, currentBuffer.screenHeight, isHiRes, &format);
+		g_sci->_gfxFrameout->setPixelFormat(format);
 		g_sci->_gfxCursor32->unhide();
 	}
 
@@ -986,7 +982,6 @@ void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, con
 		g_sci->_gfxFrameout->frameOut(true);
 	}
 
-	const Buffer &currentBuffer = g_sci->_gfxFrameout->getCurrentBuffer();
 	const Graphics::PixelFormat format = _decoder->getPixelFormat();
 
 	if (_pixelDouble) {
@@ -994,7 +989,7 @@ void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, con
 		_scaleBuffer = new byte[_drawRect.width() * _drawRect.height() * format.bytesPerPixel];
 	}
 
-	initGraphics(currentBuffer.screenWidth, currentBuffer.screenHeight, true, &format);
+	g_sci->_gfxFrameout->setPixelFormat(format);
 
 	_status = kDuckOpen;
 }
@@ -1049,9 +1044,8 @@ void DuckPlayer::close() {
 
 	_decoder->close();
 
-	const Buffer &currentBuffer = g_sci->_gfxFrameout->getCurrentBuffer();
 	const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
-	initGraphics(currentBuffer.screenWidth, currentBuffer.screenHeight, true, &format);
+	g_sci->_gfxFrameout->setPixelFormat(format);
 
 	g_sci->_gfxCursor32->unhide();
 


Commit: 91df45c6c5f11d6426a7c390e50932dd3016504e
    https://github.com/scummvm/scummvm/commit/91df45c6c5f11d6426a7c390e50932dd3016504e
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-05-06T10:38:58-05:00

Commit Message:
SCI32: Fix missing/incorrect game features detection

Changed paths:
    engines/sci/engine/features.cpp
    engines/sci/graphics/frameout.cpp


diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 1085fec..1e8cc6d 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -586,11 +586,14 @@ MessageTypeSyncStrategy GameFeatures::getMessageTypeSyncStrategy() const {
 	switch (g_sci->getGameId()) {
 	// TODO: Hoyle5, SCI3
 	case GID_GK1:
+	case GID_PQ4:
+	case GID_QFG4:
+		return g_sci->isCD() ? kMessageTypeSyncStrategyDefault : kMessageTypeSyncStrategyNone;
+
 	case GID_KQ7:
 	case GID_MOTHERGOOSEHIRES:
 	case GID_PHANTASMAGORIA:
-	case GID_PQ4:
-	case GID_QFG4:
+	case GID_SQ6:
 	case GID_TORIN:
 		return kMessageTypeSyncStrategyDefault;
 
@@ -600,6 +603,8 @@ MessageTypeSyncStrategy GameFeatures::getMessageTypeSyncStrategy() const {
 	case GID_SHIVERS:
 		return kMessageTypeSyncStrategyShivers;
 
+	case GID_GK2:
+	case GID_PQSWAT:
 	default:
 		break;
 	}
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index d5a7e33..e0506e6 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -136,6 +136,11 @@ bool GfxFrameout::gameIsHiRes() const {
 		return false;
 	}
 
+	// PQ4 DOS floppy is low resolution only
+	if (g_sci->getGameId() == GID_PQ4 && !g_sci->isCD()) {
+		return false;
+	}
+
 	// GK1 DOS floppy is low resolution only, but GK1 Mac floppy is high
 	// resolution only
 	if (g_sci->getGameId() == GID_GK1 &&


Commit: 8b49313af30a283b7b9517b69c10a148e099cf01
    https://github.com/scummvm/scummvm/commit/8b49313af30a283b7b9517b69c10a148e099cf01
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-05-06T10:38:58-05:00

Commit Message:
SCI32: Fix terrible rendering performance when vsync is enabled

More than one call to OSystem::updateScreen per frame on systems
with vsync ruins performance because the call is blocked until
the next vsync interval.

This also fixes bad rendering performance with the OpenGL backend.

Changed paths:
    engines/sci/graphics/cursor32.cpp
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/palette32.cpp
    engines/sci/graphics/palette32.h
    engines/sci/sci.cpp


diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index 2f74873..6247146 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -122,7 +122,6 @@ void GfxCursor32::drawToHardware(const DrawRegion &source) {
 	byte *sourcePixel = source.data + (sourceYOffset * source.rect.width()) + sourceXOffset;
 
 	g_system->copyRectToScreen(sourcePixel, source.rect.width(), drawRect.left, drawRect.top, drawRect.width(), drawRect.height());
-	g_system->updateScreen();
 }
 
 void GfxCursor32::unhide() {
@@ -381,6 +380,10 @@ void GfxCursor32::deviceMoved(Common::Point &position) {
 		position.y = _restrictedArea.bottom - 1;
 	}
 
+	if (_position == position) {
+		return;
+	}
+
 	_position = position;
 
 	g_system->warpMouse(position.x, position.y);
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index e0506e6..b4c842d 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -439,7 +439,7 @@ void GfxFrameout::frameOut(const bool shouldShowBits, const Common::Rect &eraseR
 		robotPlayer.frameAlmostVisible();
 	}
 
-	_palette->updateHardware(!shouldShowBits);
+	_palette->updateHardware();
 
 	if (shouldShowBits) {
 		showBits();
@@ -547,7 +547,7 @@ void GfxFrameout::palMorphFrameOut(const int8 *styleRanges, PlaneShowStyle *show
 
 	_palette->submit(nextPalette);
 	_palette->updateFFrame();
-	_palette->updateHardware(false);
+	_palette->updateHardware();
 	showBits();
 }
 
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index d13ae2c..de85b71 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -455,7 +455,7 @@ void GfxPalette32::updateFFrame() {
 	g_sci->_gfxRemap32->remapAllTables(_nextPalette != _currentPalette);
 }
 
-void GfxPalette32::updateHardware(const bool updateScreen) {
+void GfxPalette32::updateHardware() {
 	if (_currentPalette == _nextPalette && !_gammaChanged) {
 		return;
 	}
@@ -494,10 +494,6 @@ void GfxPalette32::updateHardware(const bool updateScreen) {
 	}
 
 	g_system->getPaletteManager()->setPalette(bpal, 0, 256);
-	if (updateScreen) {
-		g_system->updateScreen();
-	}
-
 	_gammaChanged = false;
 }
 
diff --git a/engines/sci/graphics/palette32.h b/engines/sci/graphics/palette32.h
index 267ec39..0fcd7e0 100644
--- a/engines/sci/graphics/palette32.h
+++ b/engines/sci/graphics/palette32.h
@@ -240,11 +240,8 @@ public:
 	/**
 	 * Copies all entries from `nextPalette` to `currentPalette` and updates the
 	 * backend's raw palette.
-	 *
-	 * @param updateScreen If true, this call will also tell the backend to draw
-	 * to the screen.
 	 */
-	void updateHardware(const bool updateScreen = true);
+	void updateHardware();
 
 private:
 	ResourceManager *_resMan;
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 026c423..9d6e4e0 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -816,6 +816,14 @@ void SciEngine::sleep(uint32 msecs) {
 	for (;;) {
 		// let backend process events and update the screen
 		_eventMan->getSciEvent(SCI_EVENT_PEEK);
+#ifdef ENABLE_SCI32
+		// If a game is in a wait loop, kFrameOut is not called, but mouse
+		// movement is still occurring and the screen needs to be updated to
+		// reflect it
+		if (getSciVersion() >= SCI_VERSION_2) {
+			g_system->updateScreen();
+		}
+#endif
 		time = g_system->getMillis();
 		if (time + 10 < wakeUpTime) {
 			g_system->delayMillis(10);


Commit: 8a590e600f06a1a7635b399f649a1b7d7d3d6e54
    https://github.com/scummvm/scummvm/commit/8a590e600f06a1a7635b399f649a1b7d7d3d6e54
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-05-06T10:38:58-05:00

Commit Message:
SCI32: Disable VMD kPlayFlagBlackPalette flag

Videos in GK2 use this flag (e.g. the chapter 6 intro).

Now that GfxPalette32::updateHardware no longer calls
OSystem::updateScreen (only GfxFrameout::frameOut does this now),
every time a palette swap occurs during playback, there is a frame
of blackness that should not exist. This is because the order of
operation is:

1. Send black palette
2. Call frameOut (which updates the screen)
3. Send new, correct palette
4. No frameOut (so the screen is not updated with the correct
   palette)

OSystem::updateScreen cannot be called multiple times for the same
frame due to vsync, but also, there does not appear to be any
reason to send a black palette, since it seems to be intended to
avoid temporarily rendering video frames with the wrong palette on
a hardware device that cannot guarantee simultaneous application
of a new palette and new pixel data. ScummVM does not have such
a problem, so this feature appears to be unnecessary for us.

For the moment, this 'feature' remains hidden behind an ifdef,
instead of being removed entirely, to avoid potential confusion
when comparing VMD code from SSCI.

Changed paths:
    engines/sci/graphics/video32.cpp
    engines/sci/graphics/video32.h


diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 35a92c3..2dc2347 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -531,8 +531,9 @@ VMDPlayer::VMDPlayer(SegManager *segMan, EventManager *eventMan) :
 
 	_startColor(0),
 	_endColor(255),
+#ifdef SCI_VMD_BLACK_PALETTE
 	_blackPalette(false),
-
+#endif
 	_boostPercent(100),
 	_boostStartColor(0),
 	_boostEndColor(255),
@@ -594,7 +595,9 @@ void VMDPlayer::init(const int16 x, const int16 y, const PlayFlags flags, const
 	_boostEndColor = CLIP<int16>(boostEndColor, 0, 255);
 	_leaveScreenBlack = flags & kPlayFlagLeaveScreenBlack;
 	_leaveLastFrame = flags & kPlayFlagLeaveLastFrame;
+#ifdef SCI_VMD_BLACK_PALETTE
 	_blackPalette = flags & kPlayFlagBlackPalette;
+#endif
 	_stretchVertical = flags & kPlayFlagStretchVertical;
 }
 
@@ -869,25 +872,28 @@ void VMDPlayer::renderFrame() const {
 		for (uint16 i = _endColor; i < 256; ++i) {
 			palette.colors[i].used = false;
 		}
+#if SCI_VMD_BLACK_PALETTE
 		if (_blackPalette) {
 			for (uint16 i = _startColor; i <= _endColor; ++i) {
 				palette.colors[i].r = palette.colors[i].g = palette.colors[i].b = 0;
 				palette.colors[i].used = true;
 			}
-		} else {
+		} else
+#endif
 			fillPalette(palette);
-		}
 
 		g_sci->_gfxPalette32->submit(palette);
 		g_sci->_gfxFrameout->updateScreenItem(*_screenItem);
 		g_sci->_gfxFrameout->frameOut(true);
 
+#if SCI_VMD_BLACK_PALETTE
 		if (_blackPalette) {
 			fillPalette(palette);
 			g_sci->_gfxPalette32->submit(palette);
 			g_sci->_gfxPalette32->updateForFrame();
 			g_sci->_gfxPalette32->updateHardware();
 		}
+#endif
 	} else {
 		g_sci->_gfxFrameout->updateScreenItem(*_screenItem);
 		g_sci->_gfxFrameout->frameOut(true);
diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h
index 3200105..7b71b37 100644
--- a/engines/sci/graphics/video32.h
+++ b/engines/sci/graphics/video32.h
@@ -498,8 +498,18 @@ private:
 	 * palette is submitted to the palette manager,
 	 * which is then restored after the video pixels
 	 * have already been rendered.
-	 */
+	 *
+	 * This functionality is currently disabled because it seems like
+	 * it was designed for a different graphics architecture where
+	 * pixel data could be rendered before the video card's palette
+	 * had been updated. This is not possible in ScummVM because the
+	 * palette & pixel data are rendered simultaneously when
+	 * OSystem::updateScreen is called, rather than immediately
+	 * after they are sent to the backend.
+	 */
+#ifdef SCI_VMD_BLACK_PALETTE
 	bool _blackPalette;
+#endif
 
 #pragma mark -
 #pragma mark VMDPlayer - Brightness boost


Commit: 85105294f2534ca286cfcaa8f1cbbd68fba765d1
    https://github.com/scummvm/scummvm/commit/85105294f2534ca286cfcaa8f1cbbd68fba765d1
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-05-06T10:38:59-05:00

Commit Message:
SCI32: Add some missing onFrame hooks for the debugger

Changed paths:
    engines/sci/graphics/video32.cpp


diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 2dc2347..da2a199 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -456,6 +456,7 @@ void AVIPlayer::renderFrame() const {
 		}
 
 		g_system->updateScreen();
+		g_sci->getSciDebugger()->onFrame();
 	}
 }
 
@@ -885,6 +886,7 @@ void VMDPlayer::renderFrame() const {
 		g_sci->_gfxPalette32->submit(palette);
 		g_sci->_gfxFrameout->updateScreenItem(*_screenItem);
 		g_sci->_gfxFrameout->frameOut(true);
+		g_sci->getSciDebugger()->onFrame();
 
 #if SCI_VMD_BLACK_PALETTE
 		if (_blackPalette) {





More information about the Scummvm-git-logs mailing list