[Scummvm-git-logs] scummvm master -> 30d9976a1c52382a8c500e33ebf6562a58becaec

phcoder noreply at scummvm.org
Thu Jan 12 07:27:32 UTC 2023


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

Summary:
b9aa479bba GRAPHICS: Support Floyd dithering for RGB332
3701325b0e OPENDINGUX: Don't add posix files twice
2149d3814b CONFIGURE: Allow OpenDingux to use dynamic modules
96cbe69d1e VKEYBD: Support RGB332 backing surface
0557535324 GRAPHICS: Support RGB332 in VectorRendererSpec.
0fe52aed23 GUI: Support RGB332 for Theme Engine
16cd6d7512 OPENDINGUX: Create combined opk for rs90 and rg99
4bc23ead4a CONFIGURE: Disable aspect ratio correction and scaling on rs90
c86975e7e7 OPENDINGUX: Switch to using modules
462be38081 SDL: Support rendering to 8-bit graphics
47ab3fe4fc SDL: Support double-buffering on SDL1.
b91d873df6 SDL: Support auto-detection of GUI resolution.
3f6691dc6d RS90: Workaround for unusual SDL_PixelFormat
70b174bca5 SDL: Disable fullscreen on RS90
30d9976a1c SDL: Use hardware palette on RS90 and scale 1


Commit: b9aa479bba4bfebc59f45d6cbfc2829403d9d296
    https://github.com/scummvm/scummvm/commit/b9aa479bba4bfebc59f45d6cbfc2829403d9d296
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
GRAPHICS: Support Floyd dithering for RGB332

RGB332 is a special case of CLUT8 but RGB332 support allows to skip passing
palette explicitly and speeds up the dithering

Changed paths:
    graphics/surface.cpp
    graphics/surface.h


diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 1ceee0447b6..7fcf5e51fc9 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -558,7 +558,8 @@ Graphics::Surface *Surface::convertTo(const PixelFormat &dstFormat, const byte *
 
 	// We are here when we are converting from a higher bpp or palettes are different
 	if (dstFormat.bytesPerPixel == 1) {
-		ditherFloyd(srcPalette, srcPaletteCount, surface, dstPalette, dstPaletteCount, method);
+		ditherFloyd(srcPalette, srcPaletteCount, surface, dstPalette, dstPaletteCount, method,
+			    dstFormat);
 		return surface;
 	}
 
@@ -732,13 +733,8 @@ static void updatePixel(byte *surf, int x, int y, int w, int h, int qr, int qg,
 	ptr[2] = CLIP(ptr[2] + qb * qq / qdiv, 0, 255);
 }
 
-void Surface::ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *dstSurf, const byte *dstPalette, int dstPaletteCount, DitherMethod method) const {
-	assert(dstPalette);
-
-	PaletteLookup _paletteLookup;
-
-	_paletteLookup.setPalette(dstPalette, dstPaletteCount);
-
+void Surface::ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *dstSurf, const byte *dstPalette, int dstPaletteCount,
+			  DitherMethod method, const PixelFormat &dstFormat) const {
 	byte *tmpSurf = (byte *)malloc(w * h * 3);
 
 	int bpp = format.bytesPerPixel;
@@ -903,29 +899,60 @@ void Surface::ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *
 		{ nullptr, nullptr, 0 }
 	};
 
-	for (int y = 0; y < h; y++) {
-		const byte *src = &tmpSurf[y * w * 3];
-		byte *dst = (byte *)dstSurf->getBasePtr(0, y);
+	if (dstPalette) {
+		PaletteLookup _paletteLookup;
 
-		for (int x = 0; x < w; x++) {
-			byte r = src[0], g = src[1], b = src[2];
-			byte col = _paletteLookup.findBestColor(r, g, b);
+		_paletteLookup.setPalette(dstPalette, dstPaletteCount);
 
-			*dst = col;
+		for (int y = 0; y < h; y++) {
+			const byte *src = &tmpSurf[y * w * 3];
+			byte *dst = (byte *)dstSurf->getBasePtr(0, y);
 
-			int qr = r - dstPalette[col * 3 + 0];
-			int qg = g - dstPalette[col * 3 + 1];
-			int qb = b - dstPalette[col * 3 + 2];
+			for (int x = 0; x < w; x++) {
+				byte r = src[0], g = src[1], b = src[2];
+				byte col = _paletteLookup.findBestColor(r, g, b);
+
+				*dst = col;
+
+				int qr = r - dstPalette[col * 3 + 0];
+				int qg = g - dstPalette[col * 3 + 1];
+				int qb = b - dstPalette[col * 3 + 2];
 
-			const DitherParams *params = algos[method].params;
+				const DitherParams *params = algos[method].params;
 
-			for (int i = 0; params[i].dx != 0 || params[i].dy != 0; i++)
-				updatePixel(tmpSurf, x + params[i].dx, y + params[i].dy, w, h, qr, qg, qb, params[i].qq, algos[method].qdiv);
+				for (int i = 0; params[i].dx != 0 || params[i].dy != 0; i++)
+					updatePixel(tmpSurf, x + params[i].dx, y + params[i].dy, w, h, qr, qg, qb, params[i].qq, algos[method].qdiv);
 
-			src += 3;
-			dst++;
+				src += 3;
+				dst++;
+			}
 		}
-	}
+	} else if (dstFormat == PixelFormat(1, 3, 3, 2, 0, 5, 2, 0, 0)) {
+		for (int y = 0; y < h; y++) {
+			const byte *src = &tmpSurf[y * w * 3];
+			byte *dst = (byte *)dstSurf->getBasePtr(0, y);
+
+			for (int x = 0; x < w; x++) {
+				byte r = src[0], g = src[1], b = src[2];
+				byte col = (r & 0xe0) | ((g >> 3) & 0x1c) | ((b >> 6) & 3);
+
+				*dst = col;
+
+				int qr = r & 0x1f;
+				int qg = g & 0x1f;
+				int qb = b & 0x3f;
+
+				const DitherParams *params = algos[method].params;
+
+				for (int i = 0; params[i].dx != 0 || params[i].dy != 0; i++)
+					updatePixel(tmpSurf, x + params[i].dx, y + params[i].dy, w, h, qr, qg, qb, params[i].qq, algos[method].qdiv);
+
+				src += 3;
+				dst++;
+			}
+		}
+	} else
+		error("Unsupported dithering target format or missing palette");
 
 	::free(tmpSurf);
 }
diff --git a/graphics/surface.h b/graphics/surface.h
index 1d35474bbc0..c68aa197745 100644
--- a/graphics/surface.h
+++ b/graphics/surface.h
@@ -361,7 +361,7 @@ public:
 	Graphics::Surface *convertTo(const PixelFormat &dstFormat, const byte *srcPalette = 0, int srcPaletteCount = 0, const byte *dstPalette = 0, int dstPaletteCount = 0, DitherMethod method = kDitherFloyd) const;
 
 private:
-	void ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *dstSurf, const byte *dstPalette, int dstPaletteCount, DitherMethod method) const;
+	void ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *dstSurf, const byte *dstPalette, int dstPaletteCount, DitherMethod method, const PixelFormat &dstFormat) const;
 
 public:
 


Commit: 3701325b0eb7ac35a603a29696ed9b822725ce90
    https://github.com/scummvm/scummvm/commit/3701325b0eb7ac35a603a29696ed9b822725ce90
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
OPENDINGUX: Don't add posix files twice

They are already added by POSIX conditional as OpenDingux is POSIX compliant
(Linux-based). Adding it twice confuses some linkers.

Changed paths:
    backends/module.mk


diff --git a/backends/module.mk b/backends/module.mk
index e6f8e75ff43..64f81db60d2 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -350,15 +350,6 @@ MODULE_OBJS += \
 	mixer/null/null-mixer.o
 endif
 
-ifeq ($(BACKEND),opendingux)
-MODULE_OBJS += \
-	fs/posix/posix-fs.o \
-	fs/posix/posix-fs-factory.o \
-	fs/posix/posix-iostream.o \
-	fs/posix-drives/posix-drives-fs.o \
-	fs/posix-drives/posix-drives-fs-factory.o
-endif
-
 ifeq ($(BACKEND),openpandora)
 MODULE_OBJS += \
 	events/openpandora/op-events.o \


Commit: 2149d3814b5471a35bbed4717c0271668b4a07c9
    https://github.com/scummvm/scummvm/commit/2149d3814b5471a35bbed4717c0271668b4a07c9
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
CONFIGURE: Allow OpenDingux to use dynamic modules

-mno-shared prevents modules from being usable. Don't add it if modules
are allowed.

Changed paths:
    configure


diff --git a/configure b/configure
index 492ee88aded..3c967c36aa2 100755
--- a/configure
+++ b/configure
@@ -3550,10 +3550,14 @@ if test -n "$_host"; then
 		opendingux-*)
 			_sysroot=`$CXX --print-sysroot`
 			_sdlpath=$_sysroot/usr/bin
-			append_var DEFINES  "-DDINGUX -DOPENDINGUX -DREDUCE_MEMORY_USAGE"
-			append_var CXXFLAGS "-ffast-math -fdata-sections -ffunction-sections -mplt -mno-shared"
-			append_var LDFLAGS  "-ffast-math -fdata-sections -ffunction-sections -mplt -mno-shared"
+			append_var DEFINES  "-DDINGUX -DOPENDINGUX -DREDUCE_MEMORY_USAGE -DUNCACHED_PLUGINS"
+			append_var CXXFLAGS "-ffast-math -fdata-sections -ffunction-sections -mplt"
+			append_var LDFLAGS  "-ffast-math -fdata-sections -ffunction-sections -mplt"
 			append_var LDFLAGS  "-O3 -Wl,--as-needed,--gc-sections"
+			if [ x"$_dynamic_modules" != xyes ]; then
+				append_var CXXFLAGS "-mno-shared"
+				append_var LDFLAGS  "-mno-shared"
+			fi
 			_vkeybd=yes
 			_alsa=no
 			_vorbis=no


Commit: 96cbe69d1e13163a71a386bfb1cfc2fcfa0c0a85
    https://github.com/scummvm/scummvm/commit/96cbe69d1e13163a71a386bfb1cfc2fcfa0c0a85
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
VKEYBD: Support RGB332 backing surface

This is efficient on rs90

Changed paths:
    backends/vkeybd/virtual-keyboard-gui.cpp


diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp
index 781fcc5418c..caf620b1761 100644
--- a/backends/vkeybd/virtual-keyboard-gui.cpp
+++ b/backends/vkeybd/virtual-keyboard-gui.cpp
@@ -74,7 +74,9 @@ static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16
 	if (surf_dst->format.bytesPerPixel != surf_src->format.bytesPerPixel)
 		return;
 
-	if (surf_dst->format.bytesPerPixel == 2)
+	if (surf_dst->format.bytesPerPixel == 1)
+		blitImplementation<uint8>(surf_dst, surf_src, x, y, transparent);
+	else if (surf_dst->format.bytesPerPixel == 2)
 		blitImplementation<uint16>(surf_dst, surf_src, x, y, transparent);
 	else if (surf_dst->format.bytesPerPixel == 4)
 		blitImplementation<uint32>(surf_dst, surf_src, x, y, transparent);


Commit: 0557535324bb86fee39a5e98074ee33f0d30ee5f
    https://github.com/scummvm/scummvm/commit/0557535324bb86fee39a5e98074ee33f0d30ee5f
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
GRAPHICS: Support RGB332 in VectorRendererSpec.

This is efficient on RS90

Changed paths:
    graphics/VectorRendererSpec.cpp


diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 8281eaa998d..ca01ddb01c1 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -561,6 +561,8 @@ VectorRenderer *createRenderer(int mode) {
 			return new VectorRendererSpec<uint32>(format);
 		else if (g_system->getOverlayFormat().bytesPerPixel == 2)
 			return new VectorRendererSpec<uint16>(format);
+		else if (g_system->getOverlayFormat().bytesPerPixel == 1)
+			return new VectorRendererSpec<uint8>(format);
 		break;
 #ifndef DISABLE_FANCY_THEMES
 	case GUI::ThemeEngine::kGfxAntialias:
@@ -568,6 +570,9 @@ VectorRenderer *createRenderer(int mode) {
 			return new VectorRendererAA<uint32>(format);
 		else if (g_system->getOverlayFormat().bytesPerPixel == 2)
 			return new VectorRendererAA<uint16>(format);
+		// No AA with 8-bit
+		else if (g_system->getOverlayFormat().bytesPerPixel == 1)
+			return new VectorRendererSpec<uint8>(format);
 		break;
 #endif
 	default:
@@ -902,6 +907,9 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) {
 			(_alphaMask & ((idst & _alphaMask) +
 			((int)(((int)(_alphaMask) -
 			(int)(idst & _alphaMask)) * alpha) >> 8))));
+	} else if (sizeof(PixelType) == 1) {
+		if (alpha & 0x80)
+			*ptr = color;
 	} else {
 		error("Unsupported BPP format: %u", (uint)sizeof(PixelType));
 	}


Commit: 0fe52aed23e2552da2991caa92b1a74fdee704c6
    https://github.com/scummvm/scummvm/commit/0fe52aed23e2552da2991caa92b1a74fdee704c6
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
GUI: Support RGB332 for Theme Engine

Changed paths:
    gui/ThemeEngine.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index eb7998ba2a8..9a71249e16f 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -443,6 +443,9 @@ void ThemeEngine::setGraphicsMode(GraphicsMode mode) {
 		} else if (g_system->getOverlayFormat().bytesPerPixel == 2) {
 			_bytesPerPixel = sizeof(uint16);
 			break;
+		} else if (g_system->getOverlayFormat().bytesPerPixel == 1) {
+			_bytesPerPixel = sizeof(uint8);
+			break;
 		}
 		// fall through
 	default:


Commit: 16cd6d75125c60c21d9d226fb034083dc02e116c
    https://github.com/scummvm/scummvm/commit/16cd6d75125c60c21d9d226fb034083dc02e116c
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
OPENDINGUX: Create combined opk for rs90 and rg99

Changed paths:
  A dists/opendingux/startGame.rs90.desktop
  A dists/opendingux/startUI.rs90.desktop
    backends/platform/sdl/opendingux/build_odbeta.sh
    backends/platform/sdl/opendingux/opendingux.mk
    configure


diff --git a/backends/platform/sdl/opendingux/build_odbeta.sh b/backends/platform/sdl/opendingux/build_odbeta.sh
index 5b026508302..659340dce4a 100755
--- a/backends/platform/sdl/opendingux/build_odbeta.sh
+++ b/backends/platform/sdl/opendingux/build_odbeta.sh
@@ -21,13 +21,14 @@ case $target in
 	libc=musl
         ;;
 
-        rg99)
+        rg99 | rs90)
 	target2=rs90
+        target=rg99
 	libc=musl
         ;;
-        
+
         *)
-        echo "please provide a valid target for the build: gcw0, lepus or rg99"
+        echo "please provide a valid target for the build: gcw0, lepus, rg99 or rs90"
         exit 1
         ;;
 esac
diff --git a/backends/platform/sdl/opendingux/opendingux.mk b/backends/platform/sdl/opendingux/opendingux.mk
index 4d50b3e0cf2..47c6350342e 100644
--- a/backends/platform/sdl/opendingux/opendingux.mk
+++ b/backends/platform/sdl/opendingux/opendingux.mk
@@ -1,5 +1,10 @@
 OD_EXE_STRIPPED := scummvm_stripped$(EXEEXT)
 bundle = od-opk
+ifeq ($(OPENDINGUX_TARGET), rg99)
+OPKNAME = rg99_rs90
+else
+OPKNAME = $(OPENDINGUX_TARGET)
+endif
 
 all: $(OD_EXE_STRIPPED)
 
@@ -40,6 +45,13 @@ ifdef dualopk
 	$(CP) $(srcdir)/dists/opendingux/startGame.$(OPENDINGUX_TARGET).desktop $(bundle)/
 	$(CP) $(srcdir)/dists/opendingux/scummvm.sh $(bundle)/
 endif
+ifeq ($(OPENDINGUX_TARGET), rg99)
+	$(CP) $(srcdir)/dists/opendingux/startUI.rs90.desktop $(bundle)/
+ifdef dualopk
+	$(CP) $(srcdir)/dists/opendingux/startGame.rs90.desktop $(bundle)/
+endif
+endif
+
 	$(CP) $(srcdir)/backends/platform/sdl/opendingux/README.OPENDINGUX $(bundle)/README.man.txt
 	echo >> $(bundle)/README.man.txt
 	echo '[General README]' >> $(bundle)/README.man.txt
@@ -50,7 +62,7 @@ od-make-opk: $(bundle)
 	$(STRIP) $(bundle)/scummvm
 
 ifdef dualopk
-	$(srcdir)/dists/opendingux/make-opk.sh -d $(bundle) -o scummvm_$(OPENDINGUX_TARGET)_dual
+	$(srcdir)/dists/opendingux/make-opk.sh -d $(bundle) -o scummvm_$(OPKNAME)_dual
 else
-	$(srcdir)/dists/opendingux/make-opk.sh -d $(bundle) -o scummvm_$(OPENDINGUX_TARGET)
+	$(srcdir)/dists/opendingux/make-opk.sh -d $(bundle) -o scummvm_$(OPKNAME)
 endif
diff --git a/configure b/configure
index 3c967c36aa2..37595cc5058 100755
--- a/configure
+++ b/configure
@@ -839,7 +839,8 @@ Special configuration feature:
                                            n64 for Nintendo 64
                                            opendingux-gcw0 for GCW0 with Opendingux Beta
                                            opendingux-lepus for Lepus with Opendingux Beta
-                                           opendingux-rg99 for RG99 with Opendingux Beta
+                                           opendingux-rg99 for RG99 and RS90 with Opendingux Beta
+                                           opendingux-rs90 for RG99 and RS90 with Opendingux Beta
                                            openpandora for OpenPandora
                                            ouya for OUYA
                                            ps3 for PlayStation 3
@@ -3581,11 +3582,12 @@ if test -n "$_host"; then
 					_highres=no
 					_build_hq_scalers=no
 					;;
-				opendingux-rg99)
+				opendingux-rg99 | opendingux-rs90)
 					append_var DEFINES "-DRS90 -DDISABLE_FANCY_THEMES"
 					_16bit=no
 					_highres=no
 					_build_hq_scalers=no
+					_host=opendingux-rg99
 					;;
 				*)
 					echo "WARNING: Unknown OpenDingux target"
diff --git a/dists/opendingux/startGame.rs90.desktop b/dists/opendingux/startGame.rs90.desktop
new file mode 100644
index 00000000000..90568e298a7
--- /dev/null
+++ b/dists/opendingux/startGame.rs90.desktop
@@ -0,0 +1,16 @@
+[Desktop Entry]
+Name=ScummVM
+Comment=Interpreter for several adventure games
+Comment[pl]=Interpreter graficznych gier przygodowych
+Comment[sv]=Tolk för flera äventyrsspel
+Comment[he]=פרשן למספר משחקי הרפתקאות
+Comment[de]=Interpreter für diverse Abenteuerspiele
+Comment[es]=Intérprete para varias aventuras gráficas
+Comment[ca]=Intèrpret per diverses aventures gràfiques
+Exec=env SDL_VIDEO_KMSDRM_SCALING_MODE=1 ./scummvm.sh %f
+Icon=scummvm
+Terminal=false
+Type=Application
+Categories=games;
+StartupNotify=false
+X-OD-Manual=README.man.txt
diff --git a/dists/opendingux/startUI.rs90.desktop b/dists/opendingux/startUI.rs90.desktop
new file mode 100644
index 00000000000..9525a55f2e4
--- /dev/null
+++ b/dists/opendingux/startUI.rs90.desktop
@@ -0,0 +1,16 @@
+[Desktop Entry]
+Name=ScummVM UI
+Comment=Interpreter for several adventure games
+Comment[pl]=Interpreter graficznych gier przygodowych
+Comment[sv]=Tolk för flera äventyrsspel
+Comment[he]=פרשן למספר משחקי הרפתקאות
+Comment[de]=Interpreter für diverse Abenteuerspiele
+Comment[es]=Intérprete para varias aventuras gráficas
+Comment[ca]=Intèrpret per diverses aventures gràfiques
+Exec=env SDL_VIDEO_KMSDRM_SCALING_MODE=1 ./scummvm
+Icon=scummvm
+Terminal=false
+Type=Application
+Categories=games;
+StartupNotify=false
+X-OD-Manual=README.man.txt


Commit: 4bc23ead4a5d3d2011cff1a6f1ca102a54613045
    https://github.com/scummvm/scummvm/commit/4bc23ead4a5d3d2011cff1a6f1ca102a54613045
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
CONFIGURE: Disable aspect ratio correction and scaling on rs90

IPU already does stretching. So no need to spend resources on it

Changed paths:
    configure


diff --git a/configure b/configure
index 37595cc5058..6e579548ca1 100755
--- a/configure
+++ b/configure
@@ -3586,7 +3586,9 @@ if test -n "$_host"; then
 					append_var DEFINES "-DRS90 -DDISABLE_FANCY_THEMES"
 					_16bit=no
 					_highres=no
-					_build_hq_scalers=no
+					# Scaling is handled by IPU
+					_build_aspect=no
+					_build_scalers=no
 					_host=opendingux-rg99
 					;;
 				*)


Commit: c86975e7e71af3297a31477e75ca904be48aae7c
    https://github.com/scummvm/scummvm/commit/c86975e7e71af3297a31477e75ca904be48aae7c
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
OPENDINGUX: Switch to using modules

Those devices are low on memory. Modules allow not to load extra egines.

Changed paths:
    backends/platform/sdl/opendingux/build_odbeta.sh


diff --git a/backends/platform/sdl/opendingux/build_odbeta.sh b/backends/platform/sdl/opendingux/build_odbeta.sh
index 659340dce4a..f68524c1aee 100755
--- a/backends/platform/sdl/opendingux/build_odbeta.sh
+++ b/backends/platform/sdl/opendingux/build_odbeta.sh
@@ -40,7 +40,7 @@ export PATH=$TOOLCHAIN/usr/bin:$SYSROOT/usr/include:$TOOLCHAIN/bin:$PATH
 export CXX=mipsel-linux-g++
 export CXXFLAGS="-funsigned-char" # workaround for a scummvm tolower() bug when adding games
 
-./configure --host=opendingux-$target --enable-release --disable-detection-full
+./configure --host=opendingux-$target --enable-release --disable-detection-full --default-dynamic --enable-plugins
 
 make -j12 od-make-opk $dualopk
 


Commit: 462be38081de2d3a9c63d40c20dc6b7cba3b4b37
    https://github.com/scummvm/scummvm/commit/462be38081de2d3a9c63d40c20dc6b7cba3b4b37
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
SDL: Support rendering to 8-bit graphics

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 93cbecd3d59..5f8f93c85f5 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -136,12 +136,23 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
 #endif
 	_transactionMode(kTransactionNone),
 	_scalerPlugins(ScalerMan.getPlugins()), _scalerPlugin(nullptr), _scaler(nullptr),
-	_needRestoreAfterOverlay(false) {
+	_needRestoreAfterOverlay(false), _isInOverlayPalette(false) {
 
 	// allocate palette storage
 	_currentPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
+	_overlayPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
 	_cursorPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
 
+	// Generate RGB332 palette for overlay
+	for (uint i = 0; i < 256; i++) {
+		_overlayPalette[i].r = ((i >> 5) & 7) << 5;
+		_overlayPalette[i].g = ((i >> 2) & 7) << 5;
+		_overlayPalette[i].b = (i & 3) << 6;
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+		_overlayPalette[i].a = 0xff;
+#endif
+	}
+
 	_mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
 
 #ifdef USE_SDL_DEBUG_FOCUSRECT
@@ -149,6 +160,8 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
 		_enableFocusRectDebugCode = ConfMan.getBool("use_sdl_debug_focusrect");
 #endif
 
+	_videoMode.isHwPalette = false;
+
 #if defined(USE_ASPECT)
 	_videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
 	_videoMode.desiredAspectRatio = getDesiredAspectRatio();
@@ -182,6 +195,7 @@ SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() {
 		SDL_FreeSurface(_mouseSurface);
 	}
 	free(_currentPalette);
+	free(_overlayPalette);
 	free(_cursorPalette);
 }
 
@@ -489,40 +503,6 @@ void SurfaceSdlGraphicsManager::detectSupportedFormats() {
 	}
 #endif
 
-	// Some tables with standard formats that we always list
-	// as "supported". If frontend code tries to use one of
-	// these, we will perform the necessary format
-	// conversion in the background. Of course this incurs a
-	// performance hit, but on desktop ports this should not
-	// matter. We still push the currently active format to
-	// the front, so if frontend code just uses the first
-	// available format, it will get one that is "cheap" to
-	// use.
-	const Graphics::PixelFormat RGBList[] = {
-		// RGBA8888, ARGB8888, RGB888
-		Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0),
-		Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24),
-		Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0),
-		// RGB565, XRGB1555, RGB555, RGBA4444, ARGB4444
-		Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0),
-		Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15),
-		Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0),
-		Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0),
-		Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12)
-	};
-	const Graphics::PixelFormat BGRList[] = {
-		// ABGR8888, BGRA8888, BGR888
-		Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24),
-		Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0),
-		Graphics::PixelFormat(3, 8, 8, 8, 0, 0, 8, 16, 0),
-		// BGR565, XBGR1555, BGR555, ABGR4444, BGRA4444
-		Graphics::PixelFormat(2, 5, 6, 5, 0, 0, 5, 11, 0),
-		Graphics::PixelFormat(2, 5, 5, 5, 1, 0, 5, 10, 15),
-		Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0),
-		Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12),
-		Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0)
-	};
-
 	if (_hwScreen) {
 		// Get our currently set hardware format
 		Graphics::PixelFormat hwFormat = convertSDLPixelFormat(_hwScreen->format);
@@ -534,23 +514,59 @@ void SurfaceSdlGraphicsManager::detectSupportedFormats() {
 #endif
 	}
 
-	// TODO: prioritize matching alpha masks
-	int i;
-
-	// Push some RGB formats
-	for (i = 0; i < ARRAYSIZE(RGBList); i++) {
-		if (_hwScreen && (RGBList[i].bytesPerPixel > format.bytesPerPixel))
-			continue;
-		if (RGBList[i] != format)
-			_supportedFormats.push_back(RGBList[i]);
-	}
+	if (!_videoMode.isHwPalette) {
+		// Some tables with standard formats that we always list
+		// as "supported". If frontend code tries to use one of
+		// these, we will perform the necessary format
+		// conversion in the background. Of course this incurs a
+		// performance hit, but on desktop ports this should not
+		// matter. We still push the currently active format to
+		// the front, so if frontend code just uses the first
+		// available format, it will get one that is "cheap" to
+		// use.
+		const Graphics::PixelFormat RGBList[] = {
+			// RGBA8888, ARGB8888, RGB888
+			Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0),
+			Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24),
+			Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0),
+			// RGB565, XRGB1555, RGB555, RGBA4444, ARGB4444
+			Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0),
+			Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15),
+			Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0),
+			Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0),
+			Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12)
+		};
+		const Graphics::PixelFormat BGRList[] = {
+			// ABGR8888, BGRA8888, BGR888
+			Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24),
+			Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0),
+			Graphics::PixelFormat(3, 8, 8, 8, 0, 0, 8, 16, 0),
+			// BGR565, XBGR1555, BGR555, ABGR4444, BGRA4444
+			Graphics::PixelFormat(2, 5, 6, 5, 0, 0, 5, 11, 0),
+			Graphics::PixelFormat(2, 5, 5, 5, 1, 0, 5, 10, 15),
+			Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0),
+			Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12),
+			Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0)
+		};
+
+		// TODO: prioritize matching alpha masks
+		int i;
+
+		// Push some RGB formats
+		for (i = 0; i < ARRAYSIZE(RGBList); i++) {
+			if (_hwScreen && (RGBList[i].bytesPerPixel > format.bytesPerPixel))
+				continue;
+			if (RGBList[i] != format)
+				_supportedFormats.push_back(RGBList[i]);
+		}
 
-	// Push some BGR formats
-	for (i = 0; i < ARRAYSIZE(BGRList); i++) {
-		if (_hwScreen && (BGRList[i].bytesPerPixel > format.bytesPerPixel))
-			continue;
-		if (BGRList[i] != format)
-			_supportedFormats.push_back(BGRList[i]);
+		// Push some BGR formats
+		for (i = 0; i < ARRAYSIZE(BGRList); i++) {
+			if (_hwScreen && (BGRList[i].bytesPerPixel > format.bytesPerPixel))
+				continue;
+			if (BGRList[i] != format)
+				_supportedFormats.push_back(BGRList[i]);
+		}
 	}
 
 	// Finally, we always supposed 8 bit palette graphics
@@ -886,9 +902,15 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
 		}
 #endif
 
-		_hwScreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
-			_videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
-			);
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+		Uint32 flags = SDL_SWSURFACE;
+#else
+		Uint32 flags = _videoMode.isHwPalette ? (SDL_HWSURFACE | SDL_HWPALETTE) : SDL_SWSURFACE;
+#endif
+		if (_videoMode.fullscreen)
+			flags |= SDL_FULLSCREEN;
+		_hwScreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, _videoMode.isHwPalette ? 8 : 16,
+					       flags);
 	}
 
 #ifdef USE_RGB_COLOR
@@ -944,6 +966,9 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
 		error("allocating _overlayscreen failed");
 
 	_overlayFormat = convertSDLPixelFormat(_overlayscreen->format);
+	// Overlay uses RGB332 palette
+	if (_overlayFormat.bytesPerPixel == 1 && _overlayFormat.rBits() == 0)
+		_overlayFormat = Graphics::PixelFormat(1, 3, 3, 2, 0, 5, 2, 0, 0);
 
 	_tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth + _maxExtraPixels * 2,
 						_videoMode.overlayHeight + _maxExtraPixels * 2,
@@ -956,6 +981,11 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
 	if (_tmpscreen2 == nullptr)
 		error("allocating _tmpscreen2 failed");
 
+	if (_videoMode.isHwPalette) {
+		SDL_SetColors(_tmpscreen2, _overlayPalette, 0, 256);
+		SDL_SetColors(_overlayscreen, _overlayPalette, 0, 256);
+	}
+
 	return true;
 }
 
@@ -1121,6 +1151,14 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
 		SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart,
 			_paletteDirtyStart,
 			_paletteDirtyEnd - _paletteDirtyStart);
+		if (_videoMode.isHwPalette)
+			SDL_SetColors(_tmpscreen, _currentPalette + _paletteDirtyStart,
+				      _paletteDirtyStart,
+				      _paletteDirtyEnd - _paletteDirtyStart);
+		if (_videoMode.isHwPalette && !_isInOverlayPalette)
+			SDL_SetColors(_hwScreen, _currentPalette + _paletteDirtyStart,
+				       _paletteDirtyStart,
+				       _paletteDirtyEnd - _paletteDirtyStart);
 
 		_paletteDirtyEnd = 0;
 
@@ -1167,6 +1205,12 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
 	updateOSD();
 #endif
 
+	if (_videoMode.isHwPalette && _isInOverlayPalette != _overlayVisible) {
+		SDL_SetColors(_hwScreen, _overlayVisible ? _overlayPalette : _currentPalette, 0, 256);
+		_forceRedraw = true;
+		_isInOverlayPalette = _overlayVisible;
+	}
+
 	// Force a full redraw if requested.
 	// If _useOldSrc, the scaler will do its own partial updates.
 	if (_forceRedraw) {
@@ -1798,7 +1842,10 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h,
 	if (format) {
 #ifndef USE_RGB_COLOR
 		assert(format->bytesPerPixel == 1);
+#else
+		assert(format->bytesPerPixel == 1 || !_videoMode.isHwPalette);
 #endif
+
 		if (format->bytesPerPixel != _cursorFormat.bytesPerPixel) {
 			formatChanged = true;
 		}
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 8c1a6910f9f..2ce4b3204d1 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -258,6 +258,7 @@ protected:
 		bool aspectRatioCorrection;
 		AspectRatio desiredAspectRatio;
 		bool filtering;
+		bool isHwPalette;
 
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 		int stretchMode;
@@ -370,6 +371,7 @@ protected:
 #else
 	byte _mouseKeyColor;
 #endif
+	byte _mappedMouseKeyColor;
 	bool _cursorDontScale;
 	bool _cursorPaletteDisabled;
 	SDL_Surface *_mouseOrigSurface;
@@ -384,6 +386,9 @@ protected:
 	SDL_Color *_currentPalette;
 	uint _paletteDirtyStart, _paletteDirtyEnd;
 
+	SDL_Color *_overlayPalette;
+	bool _isInOverlayPalette;
+
 	// Cursor palette data
 	SDL_Color *_cursorPalette;
 


Commit: 47ab3fe4fc5a2623088081097ebc866eb65e3807
    https://github.com/scummvm/scummvm/commit/47ab3fe4fc5a2623088081097ebc866eb65e3807
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
SDL: Support double-buffering on SDL1.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 5f8f93c85f5..f8e5e2c7535 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -136,7 +136,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
 #endif
 	_transactionMode(kTransactionNone),
 	_scalerPlugins(ScalerMan.getPlugins()), _scalerPlugin(nullptr), _scaler(nullptr),
-	_needRestoreAfterOverlay(false), _isInOverlayPalette(false) {
+	_needRestoreAfterOverlay(false), _isInOverlayPalette(false), _isDoubleBuf(false), _prevForceRedraw(false), _numPrevDirtyRects(0) {
 
 	// allocate palette storage
 	_currentPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
@@ -905,12 +905,17 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 		Uint32 flags = SDL_SWSURFACE;
 #else
-		Uint32 flags = _videoMode.isHwPalette ? (SDL_HWSURFACE | SDL_HWPALETTE) : SDL_SWSURFACE;
+		Uint32 flags = _videoMode.isHwPalette ? (SDL_HWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF) : SDL_SWSURFACE;
 #endif
 		if (_videoMode.fullscreen)
 			flags |= SDL_FULLSCREEN;
 		_hwScreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, _videoMode.isHwPalette ? 8 : 16,
 					       flags);
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+		_isDoubleBuf = false;
+#else
+		_isDoubleBuf = flags & SDL_DOUBLEBUF;
+#endif
 	}
 
 #ifdef USE_RGB_COLOR
@@ -1113,6 +1118,12 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
 	if (debugger)
 		debugger->onFrame();
 
+	bool curCursorNeedsRedraw = _cursorNeedsRedraw;
+	if (_prevCursorNeedsRedraw && _isDoubleBuf) {
+		_cursorNeedsRedraw = true;
+	}
+	_prevCursorNeedsRedraw = curCursorNeedsRedraw;
+
 #if !SDL_VERSION_ATLEAST(2, 0, 0)
 	// If the shake position changed, fill the dirty area with blackness
 	// When building with SDL2, the shake offset is added to the active rect instead,
@@ -1211,22 +1222,40 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
 		_isInOverlayPalette = _overlayVisible;
 	}
 
+	// In case of double buferring partially good version may be on another page,
+	// so we need to fully redraw
+	if (_isDoubleBuf && _numDirtyRects)
+		_forceRedraw = true;
+
+	bool doRedraw = _forceRedraw || (_prevForceRedraw && _isDoubleBuf);
+	int actualDirtyRects = _numDirtyRects;
+	if (_isDoubleBuf && _numPrevDirtyRects > 0) {
+		memcpy(_dirtyRectList + _numDirtyRects, _prevDirtyRectList, _numPrevDirtyRects * sizeof(_dirtyRectList[0]));
+		actualDirtyRects += _numPrevDirtyRects;
+	}
+
 	// Force a full redraw if requested.
 	// If _useOldSrc, the scaler will do its own partial updates.
-	if (_forceRedraw) {
-		_numDirtyRects = 1;
+	if (doRedraw) {
+		actualDirtyRects = 1;
 		_dirtyRectList[0].x = 0;
 		_dirtyRectList[0].y = 0;
 		_dirtyRectList[0].w = width;
 		_dirtyRectList[0].h = height;
 	}
 
+	_prevForceRedraw = _forceRedraw;
+	if (!_prevForceRedraw && _numDirtyRects && _isDoubleBuf) {
+		memcpy(_prevDirtyRectList, _dirtyRectList, _numDirtyRects * sizeof(_dirtyRectList[0]));
+		_numPrevDirtyRects = _numDirtyRects;
+	}
+
 	// Only draw anything if necessary
-	if (_numDirtyRects > 0 || _cursorNeedsRedraw) {
+	if (actualDirtyRects > 0 || _cursorNeedsRedraw) {
 		SDL_Rect *r;
 		SDL_Rect dst;
 		uint32 bpp, srcPitch, dstPitch;
-		SDL_Rect *lastRect = _dirtyRectList + _numDirtyRects;
+		SDL_Rect *lastRect = _dirtyRectList + actualDirtyRects;
 
 		for (r = _dirtyRectList; r != lastRect; ++r) {
 			dst = *r;
@@ -1382,7 +1411,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
 
 		// Finally, blit all our changes to the screen
 		if (!_displayDisabled) {
-			SDL_UpdateRects(_hwScreen, _numDirtyRects, _dirtyRectList);
+			SDL_UpdateRects(_hwScreen, actualDirtyRects, _dirtyRectList);
 		}
 	}
 
@@ -1392,6 +1421,10 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
 	_numDirtyRects = 0;
 	_forceRedraw = false;
 	_cursorNeedsRedraw = false;
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
+	if (_isDoubleBuf)
+		SDL_Flip(_hwScreen);
+#endif
 }
 
 bool SurfaceSdlGraphicsManager::saveScreenshot(const Common::String &filename) const {
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 2ce4b3204d1..3b039898358 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -216,6 +216,7 @@ protected:
 	SDL_Surface *_overlayscreen;
 	bool _useOldSrc;
 	Graphics::PixelFormat _overlayFormat;
+	bool _isDoubleBuf;
 
 	enum {
 		kTransactionNone = 0,
@@ -340,9 +341,15 @@ protected:
 	};
 
 	// Dirty rect management
-	SDL_Rect _dirtyRectList[NUM_DIRTY_RECT];
+	// When double-buffering we need to redraw both updates from
+	// current frame and previous frame. For convenience we copy
+	// them here before traversing the list.
+	SDL_Rect _dirtyRectList[2 * NUM_DIRTY_RECT];
 	int _numDirtyRects;
 
+	SDL_Rect _prevDirtyRectList[NUM_DIRTY_RECT];
+	int _numPrevDirtyRects;
+
 	struct MousePos {
 		// The size and hotspot of the original cursor image.
 		int16 w, h;
@@ -459,6 +466,8 @@ private:
 	 * can be triggered.
 	 */
 	bool _needRestoreAfterOverlay;
+	bool _prevForceRedraw;
+	bool _prevCursorNeedsRedraw;
 };
 
 #endif


Commit: b91d873df6f1df95b5e978eb769e35c8d6e29b3f
    https://github.com/scummvm/scummvm/commit/b91d873df6f1df95b5e978eb769e35c8d6e29b3f
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
SDL: Support auto-detection of GUI resolution.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    base/main.cpp


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index f8e5e2c7535..2c49108c6b8 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -707,12 +707,42 @@ int SurfaceSdlGraphicsManager::getStretchMode() const {
 }
 #endif
 
+void SurfaceSdlGraphicsManager::getDefaultResolution(uint &w, uint &h) {
+#ifdef RS90
+	SDL_PixelFormat p;
+	p.BitsPerPixel = 16;
+	p.BytesPerPixel = 2;
+	p.Rloss = 3;
+	p.Gloss = 2;
+	p.Bloss = 3;
+	p.Rshift = 11;
+	p.Gshift = 5;
+	p.Bshift = 0;
+	p.Rmask = 0xf800;
+	p.Gmask = 0x07e0;
+	p.Bmask = 0x001f;
+	p.colorkey = 0;
+	p.alpha = 0;
+	// Only native screen resolution is supported in RGB565 fullscreen hwsurface.
+	SDL_Rect const* const*availableModes = SDL_ListModes(&p, SDL_FULLSCREEN|SDL_HWSURFACE);
+	w = availableModes[0]->w;
+	h = availableModes[0]->h;
+#else
+	w = 320;
+	h = 200;
+#endif
+}
+
 void SurfaceSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
 	assert(_transactionMode == kTransactionActive);
 
 	_gameScreenShakeXOffset = 0;
 	_gameScreenShakeYOffset = 0;
 
+	if (w == 0) {
+		getDefaultResolution(w, h);
+	}
+
 #ifdef USE_RGB_COLOR
 	//avoid redundant format changes
 	Graphics::PixelFormat newFormat;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 3b039898358..b09d709836c 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -428,6 +428,7 @@ protected:
 
 	bool saveScreenshot(const Common::String &filename) const override;
 	virtual void setGraphicsModeIntern();
+	void getDefaultResolution(uint &w, uint &h);
 
 private:
 	void setFullscreenMode(bool enable);
diff --git a/base/main.cpp b/base/main.cpp
index 19534c84530..e5fc9315541 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -351,7 +351,14 @@ static void setupGraphics(OSystem &system) {
 		system.setScaler(ConfMan.get("scaler").c_str(), ConfMan.getInt("scale_factor"));
 		system.setShader(ConfMan.get("shader"));
 
+#ifdef OPENDINGUX
+		// 0, 0 means "autodetect" but currently only SDL supports
+		// it and really useful only on Opendingux. When more platforms
+		// support it we will switch to it.
+		system.initSize(0, 0);
+#else
 		system.initSize(320, 200);
+#endif
 
 		// Parse graphics configuration, implicit fallback to defaults set with RegisterDefaults()
 		system.setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio"));


Commit: 3f6691dc6de9f8f2da3434cd7cc97f90b5187aca
    https://github.com/scummvm/scummvm/commit/3f6691dc6de9f8f2da3434cd7cc97f90b5187aca
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
RS90: Workaround for unusual SDL_PixelFormat

SDL_PixelFormat returns 0xff/0xff/0xff as pixel format for paletted HWSURFACE.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 2c49108c6b8..afd7c824179 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -436,6 +436,11 @@ OSystem::TransactionError SurfaceSdlGraphicsManager::endGFXTransaction() {
 }
 
 Graphics::PixelFormat SurfaceSdlGraphicsManager::convertSDLPixelFormat(SDL_PixelFormat *in) const {
+	if (in->BytesPerPixel == 1 && (
+		    (in->Rmask == 0xff && in->Gmask == 0xff && in->Bmask == 0xff) ||
+		    (in->Rmask == 0 && in->Gmask == 0 && in->Bmask == 0)
+		    ))
+		return Graphics::PixelFormat::createFormatCLUT8();
 	Graphics::PixelFormat out(in->BytesPerPixel,
 		8 - in->Rloss, 8 - in->Gloss,
 		8 - in->Bloss, 8 - in->Aloss,


Commit: 70b174bca552abf3c1138cf64a70b9c75717fdf7
    https://github.com/scummvm/scummvm/commit/70b174bca552abf3c1138cf64a70b9c75717fdf7
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
SDL: Disable fullscreen on RS90

Fullscreen flag causes an error in SetVideoMode.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index afd7c824179..90d52f0092b 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -172,7 +172,11 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
 	_scaler = nullptr;
 	_maxExtraPixels = ScalerMan.getMaxExtraPixels();
 
+#ifdef RS90
+	_videoMode.fullscreen = false;
+#else
 	_videoMode.fullscreen = ConfMan.getBool("fullscreen");
+#endif
 	_videoMode.filtering = ConfMan.getBool("filtering");
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	_videoMode.stretchMode = STRETCH_FIT;
@@ -942,8 +946,10 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
 #else
 		Uint32 flags = _videoMode.isHwPalette ? (SDL_HWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF) : SDL_SWSURFACE;
 #endif
+#ifndef RS90
 		if (_videoMode.fullscreen)
 			flags |= SDL_FULLSCREEN;
+#endif
 		_hwScreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, _videoMode.isHwPalette ? 8 : 16,
 					       flags);
 #if SDL_VERSION_ATLEAST(2, 0, 0)


Commit: 30d9976a1c52382a8c500e33ebf6562a58becaec
    https://github.com/scummvm/scummvm/commit/30d9976a1c52382a8c500e33ebf6562a58becaec
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-12T10:27:20+03:00

Commit Message:
SDL: Use hardware palette on RS90 and scale 1

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 90d52f0092b..ad7b6c41d65 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -588,7 +588,7 @@ uint SurfaceSdlGraphicsManager::getDefaultScaler() const {
 }
 
 uint SurfaceSdlGraphicsManager::getDefaultScaleFactor() const {
-#ifdef USE_SCALERS
+#if defined (USE_SCALERS)
 	return 2;
 #else
 	return 1;
@@ -870,6 +870,13 @@ void SurfaceSdlGraphicsManager::fixupResolutionForAspectRatio(AspectRatio desire
 }
 
 void SurfaceSdlGraphicsManager::setupHardwareSize() {
+#ifdef RS90
+	_videoMode.isHwPalette = true;
+	_videoMode.scaleFactor = 1;
+#else
+	_videoMode.isHwPalette = false;
+#endif
+
 	_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
 	_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
 




More information about the Scummvm-git-logs mailing list