[Scummvm-git-logs] scummvm master -> 1bc4fe527990514cf9a0e2711646e7ec985ce44f
phcoder
noreply at scummvm.org
Tue Jan 17 10:48:55 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
81fdd308cf SURFACESDL: Extract initing of graphics surface into a separate method.
5bdabeed7e SURFACESDL: Make getDefaultResolution overideable by custom backends
1bc4fe5279 SDL: Move RS90-specific code to opendingux directory
Commit: 81fdd308cf6254733b95a19cc48f1e52afb6da1c
https://github.com/scummvm/scummvm/commit/81fdd308cf6254733b95a19cc48f1e52afb6da1c
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-17T13:48:50+03:00
Commit Message:
SURFACESDL: Extract initing of graphics surface into a separate method.
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 2ec53097cfa..88366d0edd8 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -909,6 +909,25 @@ void SurfaceSdlGraphicsManager::setupHardwareSize() {
}
}
+void SurfaceSdlGraphicsManager::initGraphicsSurface() {
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ Uint32 flags = SDL_SWSURFACE;
+#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)
+ _isDoubleBuf = false;
+#else
+ _isDoubleBuf = flags & SDL_DOUBLEBUF;
+#endif
+}
+
bool SurfaceSdlGraphicsManager::loadGFXMode() {
_forceRedraw = true;
@@ -965,22 +984,7 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
}
#endif
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- Uint32 flags = SDL_SWSURFACE;
-#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)
- _isDoubleBuf = false;
-#else
- _isDoubleBuf = flags & SDL_DOUBLEBUF;
-#endif
+ initGraphicsSurface();
}
#ifdef USE_RGB_COLOR
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index e9ce346945b..83c18e7ec4a 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -100,6 +100,7 @@ protected:
// PaletteManager API
void setPalette(const byte *colors, uint start, uint num) override;
void grabPalette(byte *colors, uint start, uint num) const override;
+ virtual void initGraphicsSurface();
/**
* Convert from the SDL pixel format to Graphics::PixelFormat
Commit: 5bdabeed7e488333aeb8508378c77e8ecddb5f79
https://github.com/scummvm/scummvm/commit/5bdabeed7e488333aeb8508378c77e8ecddb5f79
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-17T13:48:50+03:00
Commit Message:
SURFACESDL: Make getDefaultResolution overideable by custom backends
Changed paths:
backends/graphics/surfacesdl/surfacesdl-graphics.h
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 83c18e7ec4a..280a12b0611 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -433,7 +433,7 @@ protected:
bool saveScreenshot(const Common::String &filename) const override;
virtual void setGraphicsModeIntern();
- void getDefaultResolution(uint &w, uint &h);
+ virtual void getDefaultResolution(uint &w, uint &h);
private:
void setFullscreenMode(bool enable);
Commit: 1bc4fe527990514cf9a0e2711646e7ec985ce44f
https://github.com/scummvm/scummvm/commit/1bc4fe527990514cf9a0e2711646e7ec985ce44f
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-17T13:48:50+03:00
Commit Message:
SDL: Move RS90-specific code to opendingux directory
Changed paths:
A backends/graphics/opendingux/opendingux-graphics.cpp
A backends/graphics/opendingux/opendingux-graphics.h
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
backends/module.mk
backends/platform/sdl/opendingux/opendingux.cpp
diff --git a/backends/graphics/opendingux/opendingux-graphics.cpp b/backends/graphics/opendingux/opendingux-graphics.cpp
new file mode 100644
index 00000000000..2f2a084b612
--- /dev/null
+++ b/backends/graphics/opendingux/opendingux-graphics.cpp
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "backends/graphics/opendingux/opendingux-graphics.h"
+
+void OpenDinguxGraphicsManager::initGraphicsSurface() {
+ Uint32 flags = _videoMode.isHwPalette ? (SDL_HWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF) : SDL_SWSURFACE;
+#ifndef RS90
+ flags |= SDL_FULLSCREEN;
+#endif
+ _hwScreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, _videoMode.isHwPalette ? 8 : 16,
+ flags);
+ _isDoubleBuf = flags & SDL_DOUBLEBUF;
+}
+
+void OpenDinguxGraphicsManager::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;
+ if (h > w) h /= 2; // RG99 has a 320x480 screen, gui should render at 320x240 to look correct
+#else
+ w = 320;
+ h = 200;
+#endif
+}
+
+void OpenDinguxGraphicsManager::setupHardwareSize() {
+#ifdef RS90
+ _videoMode.isHwPalette = true;
+ _videoMode.scaleFactor = 1;
+#else
+ _videoMode.isHwPalette = false;
+#endif
+ SurfaceSdlGraphicsManager::setupHardwareSize();
+}
diff --git a/backends/graphics/opendingux/opendingux-graphics.h b/backends/graphics/opendingux/opendingux-graphics.h
new file mode 100644
index 00000000000..80c4452934e
--- /dev/null
+++ b/backends/graphics/opendingux/opendingux-graphics.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef BACKENDS_GRAPHICS_OPENDINGUX_H
+#define BACKENDS_GRAPHICS_OPENDINGUX_H
+
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
+
+class OpenDinguxGraphicsManager : public SurfaceSdlGraphicsManager {
+public:
+ OpenDinguxGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window) : SurfaceSdlGraphicsManager(sdlEventSource, window) {}
+
+ void initGraphicsSurface() override;
+ void getDefaultResolution(uint &w, uint &h) override;
+ void setupHardwareSize() override;
+};
+
+#endif /* BACKENDS_GRAPHICS_OPENDINGUX_H */
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 88366d0edd8..121ec16c477 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -174,11 +174,7 @@ 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;
@@ -733,30 +729,8 @@ 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;
- if (h > w) h /= 2; // RG99 has a 320x480 screen, gui should render at 320x240 to look correct
-#else
w = 320;
h = 200;
-#endif
}
void SurfaceSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
@@ -887,13 +861,6 @@ 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;
@@ -915,10 +882,8 @@ void SurfaceSdlGraphicsManager::initGraphicsSurface() {
#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)
@@ -931,6 +896,8 @@ void SurfaceSdlGraphicsManager::initGraphicsSurface() {
bool SurfaceSdlGraphicsManager::loadGFXMode() {
_forceRedraw = true;
+ // Init isHwPalette. Allow setupHardwareSize to override it.
+ _videoMode.isHwPalette = false;
setupHardwareSize();
//
diff --git a/backends/module.mk b/backends/module.mk
index 64f81db60d2..a0b326fb001 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -350,6 +350,11 @@ MODULE_OBJS += \
mixer/null/null-mixer.o
endif
+ifdef OPENDINGUX
+MODULE_OBJS += \
+ graphics/opendingux/opendingux-graphics.o
+endif
+
ifeq ($(BACKEND),openpandora)
MODULE_OBJS += \
events/openpandora/op-events.o \
diff --git a/backends/platform/sdl/opendingux/opendingux.cpp b/backends/platform/sdl/opendingux/opendingux.cpp
index 459133c1fe0..ecac34d97a5 100644
--- a/backends/platform/sdl/opendingux/opendingux.cpp
+++ b/backends/platform/sdl/opendingux/opendingux.cpp
@@ -25,6 +25,7 @@
#include "common/config-manager.h"
#include "common/translation.h"
+#include "backends/graphics/opendingux/opendingux-graphics.h"
#include "backends/platform/sdl/opendingux/opendingux.h"
#include "backends/fs/posix/posix-fs-factory.h"
@@ -103,7 +104,11 @@ void OSystem_SDL_Opendingux::init() {
}
void OSystem_SDL_Opendingux::initBackend() {
+#ifdef RS90
+ ConfMan.registerDefault("fullscreen", false);
+#else
ConfMan.registerDefault("fullscreen", true);
+#endif
ConfMan.registerDefault("aspect_ratio", true);
ConfMan.registerDefault("themepath", "./themes");
ConfMan.registerDefault("extrapath", "./engine-data");
@@ -151,6 +156,11 @@ void OSystem_SDL_Opendingux::initBackend() {
_savefileManager = new DefaultSaveFileManager(SAVE_PATH);
}
+ if (!_eventSource)
+ _eventSource = new SdlEventSource();
+ if (!_graphicsManager)
+ _graphicsManager = new OpenDinguxGraphicsManager(_eventSource, _window);
+
OSystem_SDL::initBackend();
}
More information about the Scummvm-git-logs
mailing list