aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2015-12-15 23:20:22 +0100
committerJohannes Schickel2015-12-15 23:20:22 +0100
commitaf08ceef4a761bbce84086b7023d1ce372d2d1a3 (patch)
tree1556dec9a9d0d2c43909c018c277defb0292a466
parentd80c39bb29638bed4bff6453502878eaa5afbbf9 (diff)
parentf37fb24caa87f5cde418ac8376e7fab1a1207dae (diff)
downloadscummvm-rg350-af08ceef4a761bbce84086b7023d1ce372d2d1a3.tar.gz
scummvm-rg350-af08ceef4a761bbce84086b7023d1ce372d2d1a3.tar.bz2
scummvm-rg350-af08ceef4a761bbce84086b7023d1ce372d2d1a3.zip
Merge pull request #637 from bgK/ps3-toolchain-update
PS3: Update to SDL2
-rw-r--r--backends/audiocd/sdl/sdl-audiocd.cpp4
-rw-r--r--backends/audiocd/sdl/sdl-audiocd.h4
-rw-r--r--backends/events/ps3sdl/ps3sdl-events.cpp8
-rw-r--r--backends/events/sdl/sdl-events.cpp2
-rw-r--r--backends/mixer/sdl/sdl-mixer.cpp59
-rw-r--r--backends/mixer/sdl13/sdl13-mixer.cpp108
-rw-r--r--backends/mixer/sdl13/sdl13-mixer.h67
-rw-r--r--backends/module.mk7
-rw-r--r--backends/platform/sdl/ps3/ps3.cpp9
-rw-r--r--backends/platform/sdl/sdl.cpp8
-rwxr-xr-xconfigure4
-rw-r--r--dists/ps3/readme-ps3.md4
12 files changed, 56 insertions, 228 deletions
diff --git a/backends/audiocd/sdl/sdl-audiocd.cpp b/backends/audiocd/sdl/sdl-audiocd.cpp
index c7b089af09..ff50c56af3 100644
--- a/backends/audiocd/sdl/sdl-audiocd.cpp
+++ b/backends/audiocd/sdl/sdl-audiocd.cpp
@@ -26,7 +26,7 @@
#include "backends/audiocd/sdl/sdl-audiocd.h"
-#if !SDL_VERSION_ATLEAST(1, 3, 0)
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
#include "common/textconsole.h"
@@ -136,6 +136,6 @@ void SdlAudioCDManager::updateCD() {
}
}
-#endif // !SDL_VERSION_ATLEAST(1, 3, 0)
+#endif // !SDL_VERSION_ATLEAST(2, 0, 0)
#endif
diff --git a/backends/audiocd/sdl/sdl-audiocd.h b/backends/audiocd/sdl/sdl-audiocd.h
index 783d4fe0f0..bfad7b6805 100644
--- a/backends/audiocd/sdl/sdl-audiocd.h
+++ b/backends/audiocd/sdl/sdl-audiocd.h
@@ -27,7 +27,7 @@
#include "backends/platform/sdl/sdl-sys.h"
-#if !SDL_VERSION_ATLEAST(1, 3, 0)
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
/**
* The SDL audio cd manager. Implements real audio cd playback.
@@ -49,6 +49,6 @@ protected:
uint32 _cdEndTime, _cdStopTime;
};
-#endif // !SDL_VERSION_ATLEAST(1, 3, 0)
+#endif // !SDL_VERSION_ATLEAST(2, 0, 0)
#endif
diff --git a/backends/events/ps3sdl/ps3sdl-events.cpp b/backends/events/ps3sdl/ps3sdl-events.cpp
index 0f6e01857b..1fc10559c2 100644
--- a/backends/events/ps3sdl/ps3sdl-events.cpp
+++ b/backends/events/ps3sdl/ps3sdl-events.cpp
@@ -126,8 +126,8 @@ bool PS3SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
* This pauses execution and keeps redrawing the screen until the XMB is closed.
*/
void PS3SdlEventSource::preprocessEvents(SDL_Event *event) {
- if (event->type == SDL_ACTIVEEVENT) {
- if (event->active.state == SDL_APPMOUSEFOCUS && !event->active.gain) {
+ if (event->type == SDL_WINDOWEVENT) {
+ if (event->window.event == SDL_WINDOWEVENT_LEAVE) {
// XMB opened
if (g_engine)
g_engine->pauseEngine(true);
@@ -145,9 +145,9 @@ void PS3SdlEventSource::preprocessEvents(SDL_Event *event) {
}
if (event->type == SDL_QUIT)
return;
- if (event->type != SDL_ACTIVEEVENT)
+ if (event->type != SDL_WINDOWEVENT)
continue;
- if (event->active.state == SDL_APPMOUSEFOCUS && event->active.gain) {
+ if (event->window.event == SDL_WINDOWEVENT_ENTER) {
// XMB closed
if (g_engine)
g_engine->pauseEngine(false);
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 038f61664f..745f398be6 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -314,7 +314,7 @@ Common::KeyCode SdlEventSource::SDLToOSystemKeycode(const SDLKey key) {
case SDLK_y: return Common::KEYCODE_y;
case SDLK_z: return Common::KEYCODE_z;
case SDLK_DELETE: return Common::KEYCODE_DELETE;
-#if SDL_VERSION_ATLEAST(1, 3, 0)
+#if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_GRAVE): return Common::KEYCODE_TILDE;
#else
case SDLK_WORLD_16: return Common::KEYCODE_TILDE;
diff --git a/backends/mixer/sdl/sdl-mixer.cpp b/backends/mixer/sdl/sdl-mixer.cpp
index dc0c853808..0ca3231892 100644
--- a/backends/mixer/sdl/sdl-mixer.cpp
+++ b/backends/mixer/sdl/sdl-mixer.cpp
@@ -30,8 +30,10 @@
#include "common/config-manager.h"
#include "common/textconsole.h"
-#ifdef GP2X
+#if defined(GP2X)
#define SAMPLES_PER_SEC 11025
+#elif defined(PLAYSTATION3)
+#define SAMPLES_PER_SEC 48000
#else
#define SAMPLES_PER_SEC 44100
#endif
@@ -78,34 +80,49 @@ void SdlMixerManager::init() {
if (SDL_OpenAudio(&fmt, &_obtained) != 0) {
warning("Could not open audio device: %s", SDL_GetError());
+ // The mixer is not marked as ready
_mixer = new Audio::MixerImpl(g_system, desired.freq);
- assert(_mixer);
- _mixer->setReady(false);
- } else {
- debug(1, "Output sample rate: %d Hz", _obtained.freq);
- if (_obtained.freq != desired.freq)
- warning("SDL mixer output sample rate: %d differs from desired: %d", _obtained.freq, desired.freq);
+ return;
+ }
+
+ // The obtained sample format is not supported by the mixer, call
+ // SDL_OpenAudio again with NULL as the second argument to force
+ // SDL to do resampling to the desired audio spec.
+ if (_obtained.format != desired.format) {
+ debug(1, "SDL mixer sound format: %d differs from desired: %d", _obtained.format, desired.format);
+ SDL_CloseAudio();
+
+ if (SDL_OpenAudio(&fmt, NULL) != 0) {
+ warning("Could not open audio device: %s", SDL_GetError());
+
+ // The mixer is not marked as ready
+ _mixer = new Audio::MixerImpl(g_system, desired.freq);
+ return;
+ }
- debug(1, "Output buffer size: %d samples", _obtained.samples);
- if (_obtained.samples != desired.samples)
- warning("SDL mixer output buffer size: %d differs from desired: %d", _obtained.samples, desired.samples);
+ _obtained = desired;
+ }
+
+ debug(1, "Output sample rate: %d Hz", _obtained.freq);
+ if (_obtained.freq != desired.freq)
+ warning("SDL mixer output sample rate: %d differs from desired: %d", _obtained.freq, desired.freq);
- if (_obtained.format != desired.format)
- warning("SDL mixer sound format: %d differs from desired: %d", _obtained.format, desired.format);
+ debug(1, "Output buffer size: %d samples", _obtained.samples);
+ if (_obtained.samples != desired.samples)
+ warning("SDL mixer output buffer size: %d differs from desired: %d", _obtained.samples, desired.samples);
#ifndef __SYMBIAN32__
- // The SymbianSdlMixerManager does stereo->mono downmixing,
- // but otherwise we require stereo output.
- if (_obtained.channels != 2)
- error("SDL mixer output requires stereo output device");
+ // The SymbianSdlMixerManager does stereo->mono downmixing,
+ // but otherwise we require stereo output.
+ if (_obtained.channels != 2)
+ error("SDL mixer output requires stereo output device");
#endif
- _mixer = new Audio::MixerImpl(g_system, _obtained.freq);
- assert(_mixer);
- _mixer->setReady(true);
+ _mixer = new Audio::MixerImpl(g_system, _obtained.freq);
+ assert(_mixer);
+ _mixer->setReady(true);
- startAudio();
- }
+ startAudio();
}
SDL_AudioSpec SdlMixerManager::getAudioSpec(uint32 outputRate) {
diff --git a/backends/mixer/sdl13/sdl13-mixer.cpp b/backends/mixer/sdl13/sdl13-mixer.cpp
deleted file mode 100644
index dc38242bde..0000000000
--- a/backends/mixer/sdl13/sdl13-mixer.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/scummsys.h"
-
-#if defined(SDL_BACKEND)
-
-#include "backends/mixer/sdl13/sdl13-mixer.h"
-#include "common/debug.h"
-#include "common/system.h"
-#include "common/config-manager.h"
-#include "common/textconsole.h"
-
-#ifdef GP2X
-#define SAMPLES_PER_SEC 11025
-#else
-#define SAMPLES_PER_SEC 44100
-#endif
-
-Sdl13MixerManager::Sdl13MixerManager()
- :
- SdlMixerManager(),
- _device(0) {
-
-}
-
-Sdl13MixerManager::~Sdl13MixerManager() {
- _mixer->setReady(false);
-
- SDL_CloseAudioDevice(_device);
-
- delete _mixer;
-}
-
-void Sdl13MixerManager::init() {
- // Start SDL Audio subsystem
- if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1) {
- error("Could not initialize SDL: %s", SDL_GetError());
- }
-
- // Get the desired audio specs
- SDL_AudioSpec desired = getAudioSpec(SAMPLES_PER_SEC);
-
- // Start SDL audio with the desired specs
- _device = SDL_OpenAudioDevice(NULL, 0, &desired, &_obtained,
- SDL_AUDIO_ALLOW_FREQUENCY_CHANGE);
-
- if (_device <= 0) {
- warning("Could not open audio device: %s", SDL_GetError());
-
- _mixer = new Audio::MixerImpl(g_system, desired.freq);
- assert(_mixer);
- _mixer->setReady(false);
- } else {
- debug(1, "Output sample rate: %d Hz", _obtained.freq);
-
- _mixer = new Audio::MixerImpl(g_system, _obtained.freq);
- assert(_mixer);
- _mixer->setReady(true);
-
- startAudio();
- }
-}
-
-void Sdl13MixerManager::startAudio() {
- // Start the sound system
- SDL_PauseAudioDevice(_device, 0);
-}
-
-void Sdl13MixerManager::suspendAudio() {
- SDL_CloseAudioDevice(_device);
- _audioSuspended = true;
-}
-
-int Sdl13MixerManager::resumeAudio() {
- if (!_audioSuspended)
- return -2;
-
- _device = SDL_OpenAudioDevice(NULL, 0, &_obtained, NULL, 0);
- if (_device <= 0) {
- return -1;
- }
-
- SDL_PauseAudioDevice(_device, 0);
- _audioSuspended = false;
- return 0;
-}
-
-#endif
diff --git a/backends/mixer/sdl13/sdl13-mixer.h b/backends/mixer/sdl13/sdl13-mixer.h
deleted file mode 100644
index ff2bb43084..0000000000
--- a/backends/mixer/sdl13/sdl13-mixer.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef BACKENDS_MIXER_SDL13_H
-#define BACKENDS_MIXER_SDL13_H
-
-#include "backends/mixer/sdl/sdl-mixer.h"
-
-/**
- * SDL mixer manager. It wraps the actual implementation
- * of the Audio:Mixer used by the engine, and setups
- * the SDL audio subsystem and the callback for the
- * audio mixer implementation.
- */
-class Sdl13MixerManager : public SdlMixerManager {
-public:
- Sdl13MixerManager();
- virtual ~Sdl13MixerManager();
-
- /**
- * Initialize and setups the mixer
- */
- virtual void init();
-
- /**
- * Pauses the audio system
- */
- virtual void suspendAudio();
-
- /**
- * Resumes the audio system
- */
- virtual int resumeAudio();
-
-protected:
-
- /**
- * The opened SDL audio device
- */
- SDL_AudioDeviceID _device;
-
- /**
- * Starts SDL audio
- */
- virtual void startAudio();
-};
-
-#endif
diff --git a/backends/module.mk b/backends/module.mk
index e5e2905781..3d7dea1f26 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -72,13 +72,11 @@ MODULE_OBJS += \
plugins/sdl/sdl-provider.o \
timer/sdl/sdl-timer.o
-# SDL 1.3 removed audio CD support
-ifndef USE_SDL13
+# SDL 2 removed audio CD support
ifndef USE_SDL2
MODULE_OBJS += \
audiocd/sdl/sdl-audiocd.o
endif
-endif
ifdef USE_OPENGL
MODULE_OBJS += \
@@ -125,8 +123,7 @@ MODULE_OBJS += \
fs/posix/posix-fs.o \
fs/posix/posix-fs-factory.o \
fs/ps3/ps3-fs-factory.o \
- events/ps3sdl/ps3sdl-events.o \
- mixer/sdl13/sdl13-mixer.o
+ events/ps3sdl/ps3sdl-events.o
endif
ifeq ($(BACKEND),tizen)
diff --git a/backends/platform/sdl/ps3/ps3.cpp b/backends/platform/sdl/ps3/ps3.cpp
index f111379794..0bb8300014 100644
--- a/backends/platform/sdl/ps3/ps3.cpp
+++ b/backends/platform/sdl/ps3/ps3.cpp
@@ -31,7 +31,6 @@
#include "backends/saves/default/default-saves.h"
#include "backends/fs/ps3/ps3-fs-factory.h"
#include "backends/events/ps3sdl/ps3sdl-events.h"
-#include "backends/mixer/sdl13/sdl13-mixer.h"
#include <dirent.h>
#include <sys/stat.h>
@@ -68,14 +67,6 @@ void OSystem_PS3::initBackend() {
if (_savefileManager == 0)
_savefileManager = new DefaultSaveFileManager(PREFIX "/saves");
- // Create the mixer manager
- if (_mixer == 0) {
- _mixerManager = new Sdl13MixerManager();
-
- // Setup and start mixer
- _mixerManager->init();
- }
-
// Event source
if (_eventSource == 0)
_eventSource = new PS3SdlEventSource();
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 6d4dede212..fffb9d56d9 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -36,8 +36,8 @@
#include "backends/saves/default/default-saves.h"
-// Audio CD support was removed with SDL 1.3
-#if SDL_VERSION_ATLEAST(1, 3, 0)
+// Audio CD support was removed with SDL 2.0
+#if SDL_VERSION_ATLEAST(2, 0, 0)
#include "backends/audiocd/default/default-audiocd.h"
#else
#include "backends/audiocd/sdl/sdl-audiocd.h"
@@ -246,8 +246,8 @@ void OSystem_SDL::initBackend() {
#endif
if (_audiocdManager == 0) {
- // Audio CD support was removed with SDL 1.3
-#if SDL_VERSION_ATLEAST(1, 3, 0)
+ // Audio CD support was removed with SDL 2.0
+#if SDL_VERSION_ATLEAST(2, 0, 0)
_audiocdManager = new DefaultAudioCDManager();
#else
_audiocdManager = new SdlAudioCDManager();
diff --git a/configure b/configure
index 87070f5663..90aabc0259 100755
--- a/configure
+++ b/configure
@@ -2414,6 +2414,7 @@ case $_host_os in
;;
ps3)
# Force use of SDL and freetype from the ps3 toolchain
+ _sdlconfig=sdl2-config
_sdlpath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin"
_freetypepath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin"
@@ -3108,9 +3109,6 @@ case $_backend in
_sdlversion=`$_sdlconfig --version`
case $_sdlversion in
- 1.3.*)
- add_line_to_config_mk "USE_SDL13 = 1"
- ;;
2.0.*)
add_line_to_config_mk "USE_SDL2 = 1"
;;
diff --git a/dists/ps3/readme-ps3.md b/dists/ps3/readme-ps3.md
index 2fb393b4fb..8290f87066 100644
--- a/dists/ps3/readme-ps3.md
+++ b/dists/ps3/readme-ps3.md
@@ -36,12 +36,12 @@ Unauthorized distribution of an installable package with non freeware games incl
Building from source
====================
-This port of ScummVM to the PS3 is based on SDL. It uses the open source SDK PSL1GHT.
+This port of ScummVM to the PS3 is based on SDL2. It uses the open source SDK PSL1GHT.
The dependencies needed to build it are :
- The toolchain from https://github.com/ps3dev/ps3toolchain
-- SDL from https://github.com/zeldin/SDL_PSL1GHT
+- SDL from https://bitbucket.org/bgK/sdl_psl1ght
- ScummVM from https://github.com/scummvm/scummvm
Once all the dependencies are correctly setup, an installable package can be obtained from source by issuing the following command :