[Scummvm-git-logs] scummvm master -> 2ad54870615d8eda5cf24d25ae2065a854321975

athrxx noreply at scummvm.org
Thu Jul 11 15:01:02 UTC 2024


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

Summary:
2ad5487061 SCI: fix number of colors reported by the EGA driver


Commit: 2ad54870615d8eda5cf24d25ae2065a854321975
    https://github.com/scummvm/scummvm/commit/2ad54870615d8eda5cf24d25ae2065a854321975
Author: athrxx (athrxx at scummvm.org)
Date: 2024-07-11T16:46:44+02:00

Commit Message:
SCI: fix number of colors reported by the EGA driver

This is inconsistent between the drivers, e. g. PQ VGA uses 256,
most of the others seem to have 16. So we just read it from the
driver.

For the games which have a Sierra logo with a palette cycle you
can see the difference right at start, since the EGA mode is
supposed to suppress the palette cycle.

(this commit also has some consistency fixes to initScreen(),
which are irrelevant to the actual performance)

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


diff --git a/engines/sci/graphics/gfxdrivers.cpp b/engines/sci/graphics/gfxdrivers.cpp
index 429b97088af..f5ca40adbc2 100644
--- a/engines/sci/graphics/gfxdrivers.cpp
+++ b/engines/sci/graphics/gfxdrivers.cpp
@@ -320,6 +320,11 @@ void SCI0_DOSPreVGADriver::initScreen(const Graphics::PixelFormat*) {
 	if (_requestRGBMode && _pixelSize == 1)
 		warning("SCI0_DOSPreVGADriver::initScreen(): RGB rendering not available in this ScummVM build");
 
+	delete[] _compositeBuffer;
+	delete[] _internalPalette;
+	_internalPalette = nullptr;
+	_compositeBuffer = nullptr;
+
 	assert(_colors);
 	if (_pixelSize == 1) {
 		g_system->getPaletteManager()->setPalette(_colors, 0, _numColors);
@@ -869,8 +874,16 @@ SCI1_EGADriver::SCI1_EGADriver(bool rgbRendering) : GfxDriver(320, 200, 256, 1),
 	if (!eprcOffs || drv.readUint32LE() != 0x87654321 || !drv.skip(1) || !drv.seek(drv.readByte(), SEEK_CUR) || !drv.seek(drv.readByte(), SEEK_CUR) || drv.readUint32LE() != 0xFEDCBA98 || !drv.skip(4))
 		error("SCI1_EGADriver: Driver file '%s' unknown version", _driverFile);
 
-	drv.skip(drv.readByte() == 0x90 ? 20 : 19);
+	uint32 pos = (drv.pos() + 1) & ~1;
 
+	drv.seek(pos);
+	drv.seek(drv.readUint16LE());
+	uint32 colResponse = drv.readUint32LE();
+	_numColors = (colResponse >> 8) & 0xffff;
+	if (_numColors < 16 || _numColors > 256 || (colResponse & 0xff0000ff) != 0xC30000B8)
+		error("SCI1_EGADriver: Failed to retrieve color info from '%s'", _driverFile);
+	
+	drv.seek(pos + 20);
 	drv.seek(drv.readUint16LE());
 	byte *buff = new byte[128];
 	drv.read(buff, 128);
@@ -950,6 +963,14 @@ void SCI1_EGADriver::initScreen(const Graphics::PixelFormat*) {
 		0xFF, 0x55, 0x55, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0x55, 0xFF, 0xFF, 0xFF
 	};
 
+	delete[] _egaColorPatterns;
+	delete[] _compositeBuffer;
+	delete[] _currentBitmap;
+	delete[] _currentPalette;
+	delete[] _internalPalette;
+	_internalPalette = nullptr;
+	_egaColorPatterns = _compositeBuffer = _currentBitmap = _currentPalette = nullptr;
+
 	if (_pixelSize == 1) {
 		g_system->getPaletteManager()->setPalette(egaColors, 0, ARRAYSIZE(egaColors) / 3);
 	} else {




More information about the Scummvm-git-logs mailing list