RISCOS: Use double buffering in full screen mode when V-sync is enabled

This commit is contained in:
Cameron Cawley 2023-02-19 15:09:06 +00:00
parent 971148c9bd
commit 8adcc29df9
4 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,51 @@
/* 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 "common/scummsys.h"
#if defined(RISCOS) && defined(SDL_BACKEND)
#include "backends/graphics/riscossdl/riscossdl-graphics.h"
bool RISCOSSdlGraphicsManager::hasFeature(OSystem::Feature f) const {
if (f == OSystem::kFeatureVSync)
return true;
return SurfaceSdlGraphicsManager::hasFeature(f);
}
void RISCOSSdlGraphicsManager::initGraphicsSurface() {
Uint32 flags = 0;
if (_videoMode.fullscreen)
flags |= SDL_FULLSCREEN;
if (_videoMode.vsync && _videoMode.fullscreen) {
flags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
} else {
/* Hardware surfaces and double buffering aren't supported in windowed mode on RISC OS. */
flags |= SDL_SWSURFACE;
}
_hwScreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, flags);
_isDoubleBuf = flags & SDL_DOUBLEBUF;
}
#endif

View file

@ -0,0 +1,35 @@
/* 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_RISCOSSDL_H
#define BACKENDS_GRAPHICS_RISCOSSDL_H
#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
class RISCOSSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
RISCOSSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window) : SurfaceSdlGraphicsManager(sdlEventSource, window) {}
bool hasFeature(OSystem::Feature f) const override;
void initGraphicsSurface() override;
};
#endif /* BACKENDS_GRAPHICS_RISCOSSDL_H */

View file

@ -290,6 +290,7 @@ endif
ifdef RISCOS
MODULE_OBJS += \
events/riscossdl/riscossdl-events.o \
graphics/riscossdl/riscossdl-graphics.o \
fs/riscos/riscos-fs.o \
fs/riscos/riscos-fs-factory.o \
midi/riscos.o \

View file

@ -26,6 +26,7 @@
#include "backends/platform/sdl/riscos/riscos.h"
#include "backends/saves/default/default-saves.h"
#include "backends/events/riscossdl/riscossdl-events.h"
#include "backends/graphics/riscossdl/riscossdl-graphics.h"
#include "backends/fs/riscos/riscos-fs-factory.h"
#include "backends/fs/riscos/riscos-fs.h"
@ -57,6 +58,10 @@ void OSystem_RISCOS::initBackend() {
if (_eventSource == 0)
_eventSource = new RISCOSSdlEventSource();
// Create the graphics manager
if (!_graphicsManager)
_graphicsManager = new RISCOSSdlGraphicsManager(_eventSource, _window);
// Create the savefile manager
if (_savefileManager == 0) {
Common::String savePath = "/<Choices$Write>/ScummVM/Saves";