[Scummvm-git-logs] scummvm master -> dcf4a6f260cd8e11d6e09e32ccc1593199ad54c1

bluegr noreply at scummvm.org
Thu Jun 5 07:01:53 UTC 2025


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

Summary:
4e3ef8f97f DS: Support returning errors when switching to unsupported resolutions
9199586c1c DREAMWEB: Remove compile time resolution check
dcf4a6f260 HYPNO: Use 320x200 for the quit scene


Commit: 4e3ef8f97fe01bc9406e8d587296c3a852480746
    https://github.com/scummvm/scummvm/commit/4e3ef8f97fe01bc9406e8d587296c3a852480746
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-06-05T10:01:49+03:00

Commit Message:
DS: Support returning errors when switching to unsupported resolutions

Changed paths:
    backends/platform/ds/ds-graphics.cpp
    backends/platform/ds/osystem_ds.cpp
    backends/platform/ds/osystem_ds.h


diff --git a/backends/platform/ds/ds-graphics.cpp b/backends/platform/ds/ds-graphics.cpp
index c3202654e83..8d6ecc2cf38 100644
--- a/backends/platform/ds/ds-graphics.cpp
+++ b/backends/platform/ds/ds-graphics.cpp
@@ -293,11 +293,13 @@ int OSystem_DS::getDefaultGraphicsMode() const {
 }
 
 bool OSystem_DS::setGraphicsMode(int mode, uint flags) {
+	assert(_transactionMode != kTransactionNone);
+
 	switch (mode) {
 	case GFX_NOSCALE:
 	case GFX_HWSCALE:
 	case GFX_SWSCALE:
-		_graphicsMode = mode;
+		_currentState.graphicsMode = mode;
 		return true;
 	default:
 		return false;
@@ -305,7 +307,7 @@ bool OSystem_DS::setGraphicsMode(int mode, uint flags) {
 }
 
 int OSystem_DS::getGraphicsMode() const {
-	return _graphicsMode;
+	return _currentState.graphicsMode;
 }
 
 static const OSystem::GraphicsMode stretchModes[] = {
@@ -324,17 +326,18 @@ int OSystem_DS::getDefaultStretchMode() const {
 }
 
 bool OSystem_DS::setStretchMode(int mode) {
-	_stretchMode = mode;
-	DS::setTopScreenZoom(mode);
+	assert(_transactionMode != kTransactionNone);
+
+	_currentState.stretchMode = mode;
 	return true;
 }
 
 int OSystem_DS::getStretchMode() const {
-	return _stretchMode;
+	return _currentState.stretchMode;
 }
 
 Graphics::PixelFormat OSystem_DS::getScreenFormat() const {
-	return _framebuffer.format;
+	return _currentState.format;
 }
 
 Common::List<Graphics::PixelFormat> OSystem_DS::getSupportedFormats() const {
@@ -345,59 +348,127 @@ Common::List<Graphics::PixelFormat> OSystem_DS::getSupportedFormats() const {
 	return res;
 }
 
+void OSystem_DS::beginGFXTransaction() {
+	assert(_transactionMode == kTransactionNone);
+
+	// Start a transaction.
+	_oldState = _currentState;
+	_transactionMode = kTransactionActive;
+}
+
 void OSystem_DS::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
-	Graphics::PixelFormat actualFormat = format ? *format : _pfCLUT8;
-	_framebuffer.create(width, height, actualFormat);
+	_currentState.width = width;
+	_currentState.height = height;
+	_currentState.format = format ? *format : _pfCLUT8;
+}
 
-	bool isRGB = (actualFormat != _pfCLUT8), swScale = ((_graphicsMode == GFX_SWSCALE) && (width == 320));
+OSystem::TransactionError OSystem_DS::endGFXTransaction() {
+	assert(_transactionMode == kTransactionActive);
 
-	if (_screen)
-		_screen->reset();
-	delete _screen;
-	_screen = nullptr;
+	uint transactionError = OSystem::kTransactionSuccess;
 
 	// For Lost in Time, the title screen is displayed in 640x400.
 	// In order to support this game, the screen mode is set, but
 	// all draw calls are ignored until the game switches to 320x200.
-	if (DS::Background::getRequiredVRAM(width, height, isRGB, swScale) <= 0x40000) {
-		_screen = new DS::Background(&_framebuffer, 3, false, 8, swScale);
+	if ((_currentState.width > 512 || _currentState.height > 512) & !_hiresHack) {
+		_currentState.width  = _oldState.width;
+		_currentState.height = _oldState.height;
+		transactionError |= OSystem::kTransactionSizeChangeFailed;
 	}
 
-#ifdef DISABLE_TEXT_CONSOLE
-	if (_subScreen && _subScreenActive)
-		_subScreen->reset();
+	if (_currentState.format != _pfCLUT8) {
+		if (_currentState.width > 256 && _currentState.height > 256) {
+			_currentState.format = _pfCLUT8;
+			transactionError |= OSystem::kTransactionFormatNotSupported;
+		} else if (_currentState.format != _pfABGR1555) {
+			_currentState.format = _pfABGR1555;
+			transactionError |= OSystem::kTransactionFormatNotSupported;
+		}
+	}
 
-	delete _subScreen;
-	_subScreen = nullptr;
+	const bool isRGB = (_currentState.format != _pfCLUT8);
+
+	bool setupNewGameScreen = false;
+	if (_oldState.graphicsMode != _currentState.graphicsMode
+	    || _oldState.width     != _currentState.width
+	    || _oldState.height    != _currentState.height
+	    || _oldState.format    != _currentState.format) {
+		setupNewGameScreen = true;
+	}
+
+	bool bannerChanged = false;
+	if (  (!_engineRunning && (_banner == NULL))
+	    || (_engineRunning && (_banner != NULL))) {
+		bannerChanged = true;
+	}
 
-	if (_engineRunning) {
-		if (_banner) {
-			_banner->reset();
-			_banner->hide();
+	if (setupNewGameScreen) {
+		bool swScale = ((_currentState.graphicsMode == GFX_SWSCALE) && (_currentState.width == 320));
+
+		_framebuffer.create(_currentState.width, _currentState.height, _currentState.format);
+
+		if (_screen)
+			_screen->reset();
+		delete _screen;
+		_screen = nullptr;
+
+		if (DS::Background::getRequiredVRAM(_currentState.width, _currentState.height, isRGB, swScale) <= 0x40000) {
+			_screen = new DS::Background(&_framebuffer, 3, false, 8, swScale);
 		}
 
-		delete _banner;
-		_banner = nullptr;
+		// Something changed, so update the screen change ID.
+		++_screenChangeID;
+	} else if (bannerChanged) {
+		if (_screen)
+			_screen->reset();
+	}
+
+#ifdef DISABLE_TEXT_CONSOLE
+	if (setupNewGameScreen || bannerChanged) {
+		if (_subScreen && _subScreenActive)
+			_subScreen->reset();
+		delete _subScreen;
+		_subScreen = nullptr;
+
+		if (_engineRunning) {
+			if (_banner) {
+				_banner->reset();
+				_banner->hide();
+			}
+
+			delete _banner;
+			_banner = nullptr;
 
-		if (DS::Background::getRequiredVRAM(width, height, isRGB, false) <= 0x20000) {
-			_subScreen = new DS::Background(&_framebuffer, 3, true, 0, false);
+			if (DS::Background::getRequiredVRAM(_currentState.width, _currentState.height, isRGB, false) <= 0x20000) {
+				_subScreen = new DS::Background(&_framebuffer, 3, true, 0, false);
+			}
+		} else {
+			if (!_banner)
+				_banner = new DS::TiledBackground(bannerTiles, bannerTilesLen, bannerMap, bannerMapLen, 1, true, 30, 0);
+			_banner->update();
 		}
-	} else {
-		if (!_banner)
-			_banner = new DS::TiledBackground(bannerTiles, bannerTilesLen, bannerMap, bannerMapLen, 1, true, 30, 0);
-		_banner->update();
 	}
 #endif
 
-	DS::setGameSize(width, height);
+	DS::setGameSize(_currentState.width, _currentState.height);
+
+	DS::setTopScreenZoom(_currentState.stretchMode);
+
+	_transactionMode = kTransactionNone;
+
+	return (OSystem::TransactionError)transactionError;
+}
+
+int OSystem_DS::getScreenChangeID() const {
+	return _screenChangeID;
 }
 
 int16 OSystem_DS::getHeight() {
-	return _framebuffer.h;
+	return _currentState.height;
 }
 
 int16 OSystem_DS::getWidth() {
-	return _framebuffer.w;
+	return _currentState.width;
 }
 
 void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
diff --git a/backends/platform/ds/osystem_ds.cpp b/backends/platform/ds/osystem_ds.cpp
index 2292569c40f..e491a5b0db8 100644
--- a/backends/platform/ds/osystem_ds.cpp
+++ b/backends/platform/ds/osystem_ds.cpp
@@ -45,7 +45,8 @@ OSystem_DS *OSystem_DS::_instance = NULL;
 
 OSystem_DS::OSystem_DS()
 	: _eventSource(NULL), _engineRunning(false), _disableCursorPalette(true),
-	_graphicsMode(GFX_HWSCALE), _stretchMode(100),
+	_currentState(), _oldState(), _hiresHack(false), _screenChangeID(0),
+	_transactionMode(kTransactionNone),
 	_paletteDirty(false), _cursorDirty(false), _overlayInGUI(false),
 	_pfCLUT8(Graphics::PixelFormat::createFormatCLUT8()),
 	_pfABGR1555(Graphics::PixelFormat(2, 5, 5, 5, 1, 0, 5, 10, 15)),
@@ -219,8 +220,23 @@ Common::String OSystem_DS::getSystemLanguage() const {
 
 void OSystem_DS::engineInit() {
 	_engineRunning = true;
+
+	const Common::ConfigManager::Domain *activeDomain = ConfMan.getActiveDomain();
+	assert(activeDomain);
+
+	const Common::String engineId = activeDomain->getValOrDefault("engineid");
+	const Common::String gameId = activeDomain->getValOrDefault("gameid");
+
+	if ((engineId == "cine" && gameId == "fw")  ||
+	    (engineId == "gob"  && gameId == "lit") ||
+	     engineId == "supernova") {
+		_hiresHack = true;
+	} else {
+		_hiresHack = false;
+	}
 }
 
 void OSystem_DS::engineDone() {
 	_engineRunning = false;
+	_hiresHack = false;
 }
diff --git a/backends/platform/ds/osystem_ds.h b/backends/platform/ds/osystem_ds.h
index 093ee713b3a..9a411fd2354 100644
--- a/backends/platform/ds/osystem_ds.h
+++ b/backends/platform/ds/osystem_ds.h
@@ -39,6 +39,46 @@ enum {
 
 class OSystem_DS : public ModularMixerBackend, public PaletteManager {
 protected:
+	enum TransactionMode {
+		kTransactionNone = 0,
+		kTransactionActive = 1,
+		kTransactionRollback = 2
+	};
+
+	/**
+	 * The current transaction mode.
+	 */
+	TransactionMode _transactionMode;
+
+	//
+	// Transaction support
+	//
+	struct VideoState {
+		constexpr VideoState() : width(0), height(0), format(),
+		    graphicsMode(GFX_HWSCALE), stretchMode(100) {
+		}
+
+		uint width, height;
+		Graphics::PixelFormat format;
+		int graphicsMode;
+		int stretchMode;
+	};
+
+	/**
+	 * The currently set up video state.
+	 */
+	VideoState _currentState;
+
+	/**
+	 * The old video state used when doing a transaction rollback.
+	 */
+	VideoState _oldState;
+
+	/**
+	 * The current screen change ID.
+	 */
+	int _screenChangeID;
+
 	Graphics::Surface _framebuffer, _overlay;
 	DS::Background *_screen, *_overlayScreen;
 #ifdef DISABLE_TEXT_CONSOLE
@@ -47,7 +87,7 @@ protected:
 #endif
 	bool _subScreenActive;
 	Graphics::Surface _cursor;
-	int _graphicsMode, _stretchMode;
+	bool _hiresHack;
 	bool _paletteDirty, _cursorDirty;
 
 	static OSystem_DS *_instance;
@@ -97,6 +137,11 @@ public:
 	virtual Graphics::PixelFormat getScreenFormat() const;
 	virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
 
+	virtual void beginGFXTransaction();
+	virtual OSystem::TransactionError endGFXTransaction();
+
+	virtual int getScreenChangeID() const;
+
 	virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
 	virtual int16 getHeight();
 	virtual int16 getWidth();


Commit: 9199586c1cba260048b0f73ed76a3b0919c7195c
    https://github.com/scummvm/scummvm/commit/9199586c1cba260048b0f73ed76a3b0919c7195c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-06-05T10:01:49+03:00

Commit Message:
DREAMWEB: Remove compile time resolution check

Changed paths:
    engines/dreamweb/titles.cpp


diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp
index 5f7c53eacfe..4d76a07bbaa 100644
--- a/engines/dreamweb/titles.cpp
+++ b/engines/dreamweb/titles.cpp
@@ -30,10 +30,8 @@ namespace DreamWeb {
 namespace {
 void initTitlesGfx() {
 	Graphics::ModeWithFormatList modes = {
-#ifdef USE_HIGHRES
 		// First try for a 640x480 mode
 		Graphics::ModeWithFormat(640, 480, Graphics::PixelFormat::createFormatCLUT8()),
-#endif
 		// System doesn't support it, so fall back on 320x240 mode
 		Graphics::ModeWithFormat(320, 240, Graphics::PixelFormat::createFormatCLUT8()),
 	};


Commit: dcf4a6f260cd8e11d6e09e32ccc1593199ad54c1
    https://github.com/scummvm/scummvm/commit/dcf4a6f260cd8e11d6e09e32ccc1593199ad54c1
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-06-05T10:01:49+03:00

Commit Message:
HYPNO: Use 320x200 for the quit scene

Changed paths:
    engines/hypno/hypno.cpp


diff --git a/engines/hypno/hypno.cpp b/engines/hypno/hypno.cpp
index d408d8c7ee2..b9c6d21f16f 100644
--- a/engines/hypno/hypno.cpp
+++ b/engines/hypno/hypno.cpp
@@ -95,6 +95,7 @@ HypnoEngine::HypnoEngine(OSystem *syst, const ADGameDescription *gd)
 	Hotspots hs;
 	hs.push_back(q);
 	quit->hots = hs;
+	quit->resolution = "320x200";
 	_levels["<quit>"] = quit;
 	resetStatistics();
 }




More information about the Scummvm-git-logs mailing list