aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/events/ps3sdl/ps3sdl-events.cpp163
-rw-r--r--backends/events/ps3sdl/ps3sdl-events.h38
-rw-r--r--backends/events/sdl/sdl-events.cpp21
-rw-r--r--backends/fs/posix/posix-fs-factory.cpp2
-rw-r--r--backends/fs/posix/posix-fs-factory.h1
-rw-r--r--backends/fs/posix/posix-fs.cpp2
-rw-r--r--backends/fs/ps3/ps3-fs-factory.cpp26
-rw-r--r--backends/fs/ps3/ps3-fs-factory.h36
-rw-r--r--backends/mixer/sdl13/sdl13-mixer.cpp109
-rw-r--r--backends/mixer/sdl13/sdl13-mixer.h67
-rw-r--r--backends/module.mk16
-rw-r--r--backends/platform/sdl/main.cpp1
-rw-r--r--backends/platform/sdl/module.mk6
-rw-r--r--backends/platform/sdl/posix/posix-main.cpp2
-rw-r--r--backends/platform/sdl/ps3/ps3-main.cpp49
-rw-r--r--backends/platform/sdl/ps3/ps3.cpp94
-rw-r--r--backends/platform/sdl/ps3/ps3.h47
-rw-r--r--backends/platform/sdl/sdl-sys.h23
-rw-r--r--backends/platform/sdl/sdl.cpp16
19 files changed, 702 insertions, 17 deletions
diff --git a/backends/events/ps3sdl/ps3sdl-events.cpp b/backends/events/ps3sdl/ps3sdl-events.cpp
new file mode 100644
index 0000000000..eefc641844
--- /dev/null
+++ b/backends/events/ps3sdl/ps3sdl-events.cpp
@@ -0,0 +1,163 @@
+/* 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(PLAYSTATION3)
+
+#include "backends/events/ps3sdl/ps3sdl-events.h"
+#include "backends/platform/sdl/sdl.h"
+#include "engines/engine.h"
+
+#include "common/util.h"
+#include "common/events.h"
+
+enum {
+ BTN_LEFT = 0,
+ BTN_DOWN = 1,
+ BTN_RIGHT = 2,
+ BTN_UP = 3,
+
+ BTN_START = 4,
+ BTN_R3 = 5,
+ BTN_L3 = 6,
+ BTN_SELECT = 7,
+
+ BTN_SQUARE = 8,
+ BTN_CROSS = 9,
+ BTN_CIRCLE = 10,
+ BTN_TRIANGLE = 11,
+
+ BTN_R1 = 12,
+ BTN_L1 = 13,
+ BTN_R2 = 14,
+ BTN_L2 = 15
+};
+
+bool PS3SdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
+
+ event.kbd.flags = 0;
+
+ switch (ev.jbutton.button) {
+ case BTN_CROSS: // Left mouse button
+ event.type = Common::EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BTN_CIRCLE: // Right mouse button
+ event.type = Common::EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BTN_TRIANGLE: // Game menu
+ event.type = Common::EVENT_KEYDOWN;
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, (SDLMod) ev.key.keysym.mod, 0);
+ break;
+ case BTN_SELECT: // Virtual keyboard
+ event.type = Common::EVENT_KEYDOWN;
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, (SDLMod) ev.key.keysym.mod, 0);
+ break;
+ case BTN_SQUARE: // Escape
+ event.type = Common::EVENT_KEYDOWN;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, (SDLMod) ev.key.keysym.mod, 0);
+ break;
+ case BTN_L1: // Predictive input dialog
+ event.type = Common::EVENT_PREDICTIVE_DIALOG;
+ break;
+ case BTN_START: // ScummVM in game menu
+ event.type = Common::EVENT_MAINMENU;
+ break;
+ }
+ return true;
+}
+
+bool PS3SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
+
+ event.kbd.flags = 0;
+
+ switch (ev.jbutton.button) {
+ case BTN_CROSS: // Left mouse button
+ event.type = Common::EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BTN_CIRCLE: // Right mouse button
+ event.type = Common::EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ break;
+ case BTN_TRIANGLE: // Game menu
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, (SDLMod) ev.key.keysym.mod, 0);
+ break;
+ case BTN_SELECT: // Virtual keyboard
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_F7;
+ event.kbd.ascii = mapKey(SDLK_F7, (SDLMod) ev.key.keysym.mod, 0);
+ break;
+ case BTN_SQUARE: // Escape
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, (SDLMod) ev.key.keysym.mod, 0);
+ break;
+ }
+ return true;
+}
+
+/**
+ * The XMB (PS3 in game menu) needs the screen buffers to be constantly flip while open.
+ * 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) {
+ // XMB opened
+ if (g_engine)
+ g_engine->pauseEngine(true);
+
+ for (;;) {
+ if (!SDL_PollEvent(event)) {
+ // Locking the screen forces a full redraw
+ Graphics::Surface* screen = g_system->lockScreen();
+ if (screen) {
+ g_system->unlockScreen();
+ g_system->updateScreen();
+ }
+ SDL_Delay(10);
+ continue;
+ }
+ if (event->type == SDL_QUIT)
+ return;
+ if (event->type != SDL_ACTIVEEVENT)
+ continue;
+ if (event->active.state == SDL_APPMOUSEFOCUS && event->active.gain) {
+ // XMB closed
+ if (g_engine)
+ g_engine->pauseEngine(false);
+ return;
+ }
+ }
+ }
+ }
+}
+
+#endif
diff --git a/backends/events/ps3sdl/ps3sdl-events.h b/backends/events/ps3sdl/ps3sdl-events.h
new file mode 100644
index 0000000000..8cf2f43426
--- /dev/null
+++ b/backends/events/ps3sdl/ps3sdl-events.h
@@ -0,0 +1,38 @@
+/* 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.
+ *
+ */
+
+#if !defined(BACKEND_EVENTS_PS3_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER)
+#define BACKEND_EVENTS_PS3_H
+
+#include "backends/events/sdl/sdl-events.h"
+
+/**
+ * SDL Events manager for the PS3.
+ */
+class PS3SdlEventSource : public SdlEventSource {
+protected:
+ void preprocessEvents(SDL_Event *event);
+ bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
+ bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
+};
+
+#endif /* BACKEND_EVENTS_PS3_H */
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 835d98e718..4489a2e580 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -206,7 +206,6 @@ bool SdlEventSource::pollEvent(Common::Event &event) {
}
SDL_Event ev;
- ev.type = SDL_NOEVENT;
while (SDL_PollEvent(&ev)) {
preprocessEvents(&ev);
if (dispatchSDLEvent(ev, event))
@@ -304,7 +303,7 @@ bool SdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_KEYDOWN;
event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
- event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+ event.kbd.ascii = mapKey(ev.key.keysym.sym, (SDLMod)ev.key.keysym.mod, (Uint16)ev.key.keysym.unicode);
return true;
}
@@ -348,7 +347,7 @@ bool SdlEventSource::handleKeyUp(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_KEYUP;
event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
- event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+ event.kbd.ascii = mapKey(ev.key.keysym.sym, (SDLMod)ev.key.keysym.mod, (Uint16)ev.key.keysym.unicode);
// Ctrl-Alt-<key> will change the GFX mode
SDLModToOSystemKeyFlags(mod, event);
@@ -418,19 +417,19 @@ bool SdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
switch (ev.jbutton.button) {
case JOY_BUT_ESCAPE:
event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, (SDLMod)ev.key.keysym.mod, 0);
break;
case JOY_BUT_PERIOD:
event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ event.kbd.ascii = mapKey(SDLK_PERIOD, (SDLMod)ev.key.keysym.mod, 0);
break;
case JOY_BUT_SPACE:
event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ event.kbd.ascii = mapKey(SDLK_SPACE, (SDLMod)ev.key.keysym.mod, 0);
break;
case JOY_BUT_F5:
event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ event.kbd.ascii = mapKey(SDLK_F5, (SDLMod)ev.key.keysym.mod, 0);
break;
}
}
@@ -449,19 +448,19 @@ bool SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
switch (ev.jbutton.button) {
case JOY_BUT_ESCAPE:
event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, (SDLMod)ev.key.keysym.mod, 0);
break;
case JOY_BUT_PERIOD:
event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ event.kbd.ascii = mapKey(SDLK_PERIOD, (SDLMod)ev.key.keysym.mod, 0);
break;
case JOY_BUT_SPACE:
event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ event.kbd.ascii = mapKey(SDLK_SPACE, (SDLMod)ev.key.keysym.mod, 0);
break;
case JOY_BUT_F5:
event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ event.kbd.ascii = mapKey(SDLK_F5, (SDLMod)ev.key.keysym.mod, 0);
break;
}
}
diff --git a/backends/fs/posix/posix-fs-factory.cpp b/backends/fs/posix/posix-fs-factory.cpp
index 829355be84..776ea86155 100644
--- a/backends/fs/posix/posix-fs-factory.cpp
+++ b/backends/fs/posix/posix-fs-factory.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#if defined(POSIX)
+#if defined(POSIX) || defined(PLAYSTATION3)
// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
// Also with clock() in sys/time.h in some Mac OS X SDKs.
diff --git a/backends/fs/posix/posix-fs-factory.h b/backends/fs/posix/posix-fs-factory.h
index a7075db94c..c7cec6fab5 100644
--- a/backends/fs/posix/posix-fs-factory.h
+++ b/backends/fs/posix/posix-fs-factory.h
@@ -30,6 +30,7 @@
* Parts of this class are documented in the base interface class, FilesystemFactory.
*/
class POSIXFilesystemFactory : public FilesystemFactory {
+protected:
virtual AbstractFSNode *makeRootFileNode() const;
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index 0b94c37b16..320c5a6f39 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#if defined(POSIX)
+#if defined(POSIX) || defined(PLAYSTATION3)
// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
// Also with clock() in sys/time.h in some Mac OS X SDKs.
diff --git a/backends/fs/ps3/ps3-fs-factory.cpp b/backends/fs/ps3/ps3-fs-factory.cpp
new file mode 100644
index 0000000000..3257246c50
--- /dev/null
+++ b/backends/fs/ps3/ps3-fs-factory.cpp
@@ -0,0 +1,26 @@
+/* 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 "backends/fs/ps3/ps3-fs-factory.h"
+
+AbstractFSNode *PS3FilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return makeRootFileNode();
+}
diff --git a/backends/fs/ps3/ps3-fs-factory.h b/backends/fs/ps3/ps3-fs-factory.h
new file mode 100644
index 0000000000..6c1988b1c9
--- /dev/null
+++ b/backends/fs/ps3/ps3-fs-factory.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 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 PS3_FILESYSTEM_FACTORY_H
+#define PS3_FILESYSTEM_FACTORY_H
+
+#include "backends/fs/posix/posix-fs-factory.h"
+
+/**
+ * Creates PS3FilesystemFactory objects.
+ *
+ * Parts of this class are documented in the base interface class, FilesystemFactory.
+ */
+class PS3FilesystemFactory : public POSIXFilesystemFactory {
+ virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
+};
+
+#endif /*PS3_FILESYSTEM_FACTORY_H*/
diff --git a/backends/mixer/sdl13/sdl13-mixer.cpp b/backends/mixer/sdl13/sdl13-mixer.cpp
new file mode 100644
index 0000000000..84777c8bab
--- /dev/null
+++ b/backends/mixer/sdl13/sdl13-mixer.cpp
@@ -0,0 +1,109 @@
+/* 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 22050
+#endif
+//#define SAMPLES_PER_SEC 44100
+
+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
new file mode 100644
index 0000000000..9e07ea8673
--- /dev/null
+++ b/backends/mixer/sdl13/sdl13-mixer.h
@@ -0,0 +1,67 @@
+/* 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 e568002d40..63774cc4d0 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -60,7 +60,6 @@ endif
# derive from the SDL backend, and they all need the following files.
ifdef SDL_BACKEND
MODULE_OBJS += \
- audiocd/sdl/sdl-audiocd.o \
events/sdl/sdl-events.o \
graphics/surfacesdl/surfacesdl-graphics.o \
mixer/doublebuffersdl/doublebuffersdl-mixer.o \
@@ -68,6 +67,12 @@ MODULE_OBJS += \
mutex/sdl/sdl-mutex.o \
plugins/sdl/sdl-provider.o \
timer/sdl/sdl-timer.o
+
+# SDL 1.3 removed audio CD support
+ifndef USE_SDL13
+MODULE_OBJS += \
+ audiocd/sdl/sdl-audiocd.o
+endif
endif
ifdef POSIX
@@ -101,6 +106,15 @@ MODULE_OBJS += \
midi/camd.o
endif
+ifdef PLAYSTATION3
+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
+endif
+
ifeq ($(BACKEND),ds)
MODULE_OBJS += \
fs/ds/ds-fs.o \
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp
index 1992bdd3f2..3947d010c4 100644
--- a/backends/platform/sdl/main.cpp
+++ b/backends/platform/sdl/main.cpp
@@ -34,6 +34,7 @@
!defined(CAANOO) && \
!defined(LINUXMOTO) && \
!defined(SAMSUNGTV) && \
+ !defined(PLAYSTATION3) && \
!defined(OPENPANDORA)
#include "backends/platform/sdl/sdl.h"
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index efc5168d5b..e67bf859d6 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -29,6 +29,12 @@ MODULE_OBJS += \
amigaos/amigaos.o
endif
+ifdef PLAYSTATION3
+MODULE_OBJS += \
+ ps3/ps3-main.o \
+ ps3/ps3.o
+endif
+
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
OBJS := $(MODULE_OBJS) $(OBJS)
diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp
index f78e001398..3bf7a5138a 100644
--- a/backends/platform/sdl/posix/posix-main.cpp
+++ b/backends/platform/sdl/posix/posix-main.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA)
+#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3)
#include "backends/platform/sdl/posix/posix.h"
#include "backends/plugins/sdl/sdl-provider.h"
diff --git a/backends/platform/sdl/ps3/ps3-main.cpp b/backends/platform/sdl/ps3/ps3-main.cpp
new file mode 100644
index 0000000000..ba548a3749
--- /dev/null
+++ b/backends/platform/sdl/ps3/ps3-main.cpp
@@ -0,0 +1,49 @@
+/* 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"
+
+#include "backends/platform/sdl/ps3/ps3.h"
+#include "backends/plugins/sdl/sdl-provider.h"
+#include "base/main.h"
+
+int main(int argc, char *argv[]) {
+
+ // Create our OSystem instance
+ g_system = new OSystem_PS3();
+ assert(g_system);
+
+ // Pre initialize the backend
+ ((OSystem_PS3 *)g_system)->init();
+
+#ifdef DYNAMIC_MODULES
+ PluginManager::instance().addPluginProvider(new SDLPluginProvider());
+#endif
+
+ // Invoke the actual ScummVM main entry point:
+ int res = scummvm_main(argc, argv);
+
+ // Free OSystem
+ delete (OSystem_PS3 *)g_system;
+
+ return res;
+}
diff --git a/backends/platform/sdl/ps3/ps3.cpp b/backends/platform/sdl/ps3/ps3.cpp
new file mode 100644
index 0000000000..16722ccdb7
--- /dev/null
+++ b/backends/platform/sdl/ps3/ps3.cpp
@@ -0,0 +1,94 @@
+/* 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.
+ *
+ */
+
+#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h //On IRIX, sys/stat.h includes sys/time.h
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "backends/platform/sdl/ps3/ps3.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
+#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>
+
+int access(const char *pathname, int mode) {
+ struct stat sb;
+
+ if (stat(pathname, &sb) == -1) {
+ return -1;
+ }
+
+ return 0;
+}
+
+OSystem_PS3::OSystem_PS3(Common::String baseConfigName)
+ : _baseConfigName(baseConfigName) {
+}
+
+void OSystem_PS3::init() {
+ // Initialze File System Factory
+ _fsFactory = new PS3FilesystemFactory();
+
+ // Invoke parent implementation of this method
+ OSystem_SDL::init();
+}
+
+void OSystem_PS3::initBackend() {
+ ConfMan.set("joystick_num", 0);
+ ConfMan.set("vkeybdpath", PREFIX "/data");
+ ConfMan.registerDefault("fullscreen", true);
+ ConfMan.registerDefault("aspect_ratio", true);
+
+ // Create the savefile manager
+ 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();
+
+ // Invoke parent implementation of this method
+ OSystem_SDL::initBackend();
+}
+
+Common::String OSystem_PS3::getDefaultConfigFileName() {
+ return PREFIX "/" + _baseConfigName;
+}
+
+Common::WriteStream *OSystem_PS3::createLogFile() {
+ Common::FSNode file(PREFIX "/scummvm.log");
+ return file.createWriteStream();
+}
diff --git a/backends/platform/sdl/ps3/ps3.h b/backends/platform/sdl/ps3/ps3.h
new file mode 100644
index 0000000000..daed7599a9
--- /dev/null
+++ b/backends/platform/sdl/ps3/ps3.h
@@ -0,0 +1,47 @@
+/* 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 PLATFORM_SDL_PS3_H
+#define PLATFORM_SDL_PS3_H
+
+#include "backends/platform/sdl/sdl.h"
+
+class OSystem_PS3 : public OSystem_SDL {
+public:
+ // Let the subclasses be able to change _baseConfigName in the constructor
+ OSystem_PS3(Common::String baseConfigName = "scummvm.ini");
+ virtual ~OSystem_PS3() {}
+
+ virtual void init();
+ virtual void initBackend();
+
+protected:
+ // Base string for creating the default path and filename
+ // for the configuration file
+ Common::String _baseConfigName;
+
+ virtual Common::String getDefaultConfigFileName();
+
+ virtual Common::WriteStream *createLogFile();
+};
+
+#endif
diff --git a/backends/platform/sdl/sdl-sys.h b/backends/platform/sdl/sdl-sys.h
index 63bfc58617..ca3c586e03 100644
--- a/backends/platform/sdl/sdl-sys.h
+++ b/backends/platform/sdl/sdl-sys.h
@@ -27,7 +27,7 @@
// fashion, even on the Symbian port.
// Moreover, it contains a workaround for the fact that SDL_rwops.h uses
// a FILE pointer in one place, which conflicts with common/forbidden.h.
-
+// The SDL 1.3 headers also include strings.h
#include "common/scummsys.h"
@@ -39,6 +39,16 @@ typedef struct { int FAKE; } FAKE_FILE;
#define FILE FAKE_FILE
#endif
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp)
+#undef strcasecmp
+#define strcasecmp FAKE_strcasecmp
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp)
+#undef strncasecmp
+#define strncasecmp FAKE_strncasecmp
+#endif
+
#if defined(__SYMBIAN32__)
#include <esdl\SDL.h>
#else
@@ -51,4 +61,15 @@ typedef struct { int FAKE; } FAKE_FILE;
#define FILE FORBIDDEN_SYMBOL_REPLACEMENT
#endif
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp)
+#undef strcasecmp
+#define strcasecmp FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp)
+#undef strncasecmp
+#define strncasecmp FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+
#endif
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 96d65c5eb2..d05cca4d1f 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -35,7 +35,14 @@
#include "common/textconsole.h"
#include "backends/saves/default/default-saves.h"
+
+// Audio CD support was removed with SDL 1.3
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+#include "backends/audiocd/default/default-audiocd.h"
+#else
#include "backends/audiocd/sdl/sdl-audiocd.h"
+#endif
+
#include "backends/events/sdl/sdl-events.h"
#include "backends/mutex/sdl/sdl-mutex.h"
#include "backends/timer/sdl/sdl-timer.h"
@@ -188,8 +195,15 @@ void OSystem_SDL::initBackend() {
_mixerManager->init();
}
- if (_audiocdManager == 0)
+ if (_audiocdManager == 0) {
+ // Audio CD support was removed with SDL 1.3
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+ _audiocdManager = new DefaultAudioCDManager();
+#else
_audiocdManager = new SdlAudioCDManager();
+#endif
+
+ }
// Setup a custom program icon.
setupIcon();