aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/audiocd/audiocd.h2
-rw-r--r--backends/base-backend.cpp18
-rw-r--r--backends/base-backend.h12
-rw-r--r--backends/events/default/default-events.cpp5
-rw-r--r--backends/events/gp2xsdl/gp2xsdl-events.cpp465
-rw-r--r--backends/events/gph/gph-events.cpp1
-rw-r--r--backends/events/openpandora/op-events.cpp126
-rw-r--r--backends/events/openpandora/op-events.h9
-rw-r--r--backends/events/ps3sdl/ps3sdl-events.cpp163
-rw-r--r--backends/events/ps3sdl/ps3sdl-events.h (renamed from backends/graphics/gp2xsdl/gp2xsdl-graphics.h)30
-rw-r--r--backends/events/sdl/sdl-events.cpp21
-rw-r--r--backends/events/sdl/sdl-events.h10
-rw-r--r--backends/events/webossdl/webossdl-events.cpp2
-rw-r--r--backends/events/wincesdl/wincesdl-events.cpp14
-rw-r--r--backends/events/wincesdl/wincesdl-events.h4
-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.h (renamed from backends/platform/gp2x/gp2x-mem.h)43
-rw-r--r--backends/fs/windows/windows-fs.cpp12
-rw-r--r--backends/fs/windows/windows-fs.h11
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp14
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.h10
-rw-r--r--backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp180
-rw-r--r--backends/graphics/gph/gph-graphics.cpp107
-rw-r--r--backends/graphics/gph/gph-graphics.h12
-rw-r--r--backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp10
-rw-r--r--backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h4
-rw-r--r--backends/graphics/opengl/gltexture.cpp2
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp24
-rw-r--r--backends/graphics/opengl/opengl-graphics.h4
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp66
-rw-r--r--backends/graphics/openpandora/op-graphics.cpp14
-rw-r--r--backends/graphics/openpandora/op-graphics.h46
-rw-r--r--backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp6
-rw-r--r--backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h4
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp (renamed from backends/graphics/sdl/sdl-graphics.cpp)148
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h (renamed from backends/graphics/sdl/sdl-graphics.h)16
-rw-r--r--backends/graphics/symbiansdl/symbiansdl-graphics.cpp6
-rw-r--r--backends/graphics/symbiansdl/symbiansdl-graphics.h4
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.cpp45
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.h26
-rw-r--r--backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp4
-rw-r--r--backends/mixer/sdl/sdl-mixer.cpp32
-rw-r--r--backends/mixer/sdl/sdl-mixer.h4
-rw-r--r--backends/mixer/sdl13/sdl13-mixer.cpp109
-rw-r--r--backends/mixer/sdl13/sdl13-mixer.h67
-rw-r--r--backends/mixer/symbiansdl/symbiansdl-mixer.cpp6
-rw-r--r--backends/modular-backend.cpp27
-rw-r--r--backends/modular-backend.h22
-rw-r--r--backends/module.mk32
-rw-r--r--backends/platform/android/android.cpp34
-rw-r--r--backends/platform/android/android.h8
-rw-r--r--backends/platform/android/jni.cpp3
-rw-r--r--backends/platform/dc/dc.h7
-rw-r--r--backends/platform/dc/dcmain.cpp21
-rw-r--r--backends/platform/dc/input.cpp4
-rw-r--r--backends/platform/dc/plugins.cpp2
-rw-r--r--backends/platform/dc/time.cpp4
-rw-r--r--backends/platform/dingux/dingux.cpp2
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.cpp4
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp27
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h7
-rwxr-xr-xbackends/platform/gp2x/build/clean.sh17
-rw-r--r--backends/platform/gp2x/gp2x-hw.cpp228
-rw-r--r--backends/platform/gp2x/gp2x-hw.h62
-rw-r--r--backends/platform/gp2x/gp2x-mem.cpp84
-rw-r--r--backends/platform/gp2x/gp2x.cpp208
-rw-r--r--backends/platform/gp2x/module.mk15
-rw-r--r--backends/platform/gph/build/gp2x-config.sh5
-rw-r--r--backends/platform/gph/devices/gp2x/scummvm.gpe4
-rw-r--r--backends/platform/gph/gph-backend.cpp20
-rw-r--r--backends/platform/gph/gph-main.cpp4
-rw-r--r--backends/platform/gph/gph-sdl.h4
-rw-r--r--backends/platform/iphone/osys_events.cpp4
-rw-r--r--backends/platform/iphone/osys_main.cpp35
-rw-r--r--backends/platform/iphone/osys_main.h10
-rw-r--r--backends/platform/n64/osys_n64.h13
-rw-r--r--backends/platform/n64/osys_n64_base.cpp37
-rw-r--r--backends/platform/n64/osys_n64_events.cpp2
-rw-r--r--backends/platform/n64/osys_n64_utilities.cpp1
-rw-r--r--backends/platform/null/null.cpp14
-rw-r--r--backends/platform/openpandora/op-backend.cpp55
-rw-r--r--backends/platform/openpandora/op-main.cpp8
-rw-r--r--backends/platform/openpandora/op-sdl.h16
-rw-r--r--backends/platform/ps2/systemps2.cpp19
-rw-r--r--backends/platform/ps2/systemps2.h16
-rw-r--r--backends/platform/psp/cursor.cpp10
-rw-r--r--backends/platform/psp/display_client.cpp32
-rw-r--r--backends/platform/psp/display_client.h10
-rw-r--r--backends/platform/psp/display_manager.cpp8
-rw-r--r--backends/platform/psp/display_manager.h6
-rw-r--r--backends/platform/psp/dummy.cpp12
-rw-r--r--backends/platform/psp/image_viewer.cpp90
-rw-r--r--backends/platform/psp/image_viewer.h28
-rw-r--r--backends/platform/psp/input.cpp32
-rw-r--r--backends/platform/psp/input.h20
-rw-r--r--backends/platform/psp/osys_psp.cpp21
-rw-r--r--backends/platform/psp/osys_psp.h8
-rw-r--r--backends/platform/psp/png_loader.cpp22
-rw-r--r--backends/platform/psp/png_loader.h2
-rw-r--r--backends/platform/psp/trace.cpp36
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp2
-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/posix/posix.cpp11
-rw-r--r--backends/platform/sdl/ps3/ps3-main.cpp (renamed from backends/platform/gp2x/gp2x-main.cpp)13
-rw-r--r--backends/platform/sdl/ps3/ps3.cpp94
-rw-r--r--backends/platform/sdl/ps3/ps3.h (renamed from backends/platform/gp2x/gp2x-common.h)30
-rw-r--r--backends/platform/sdl/sdl-sys.h25
-rw-r--r--backends/platform/sdl/sdl.cpp96
-rw-r--r--backends/platform/sdl/sdl.h10
-rw-r--r--backends/platform/sdl/win32/win32.cpp58
-rw-r--r--backends/platform/sdl/win32/win32.h1
-rw-r--r--backends/platform/symbian/src/SymbianOS.cpp4
-rw-r--r--backends/platform/wii/osystem.cpp48
-rw-r--r--backends/platform/wii/osystem.h10
-rw-r--r--backends/platform/wii/osystem_events.cpp1
-rw-r--r--backends/platform/wii/osystem_gfx.cpp1
-rw-r--r--backends/platform/wince/CEActionsPocket.cpp48
-rw-r--r--backends/platform/wince/CEActionsPocket.h2
-rw-r--r--backends/platform/wince/CEActionsSmartphone.cpp38
-rw-r--r--backends/platform/wince/CEActionsSmartphone.h2
-rw-r--r--backends/platform/wince/CELauncherDialog.cpp6
-rw-r--r--backends/platform/wince/wince-sdl.cpp90
-rw-r--r--backends/platform/wince/wince-sdl.h5
-rw-r--r--backends/plugins/elf/elf-loader.cpp26
-rw-r--r--backends/plugins/elf/elf-provider.cpp8
-rw-r--r--backends/plugins/elf/memory-manager.cpp62
-rw-r--r--backends/plugins/elf/memory-manager.h26
-rw-r--r--backends/plugins/elf/mips-loader.cpp6
-rw-r--r--backends/taskbar/unity/unity-taskbar.cpp114
-rw-r--r--backends/taskbar/unity/unity-taskbar.h (renamed from backends/events/gp2xsdl/gp2xsdl-events.h)50
-rw-r--r--backends/taskbar/win32/mingw-compat.h154
-rw-r--r--backends/taskbar/win32/win32-taskbar.cpp294
-rw-r--r--backends/taskbar/win32/win32-taskbar.h66
-rw-r--r--backends/vkeybd/virtual-keyboard-parser.cpp6
139 files changed, 2427 insertions, 2360 deletions
diff --git a/backends/audiocd/audiocd.h b/backends/audiocd/audiocd.h
index 92b7598cb5..0afc6af991 100644
--- a/backends/audiocd/audiocd.h
+++ b/backends/audiocd/audiocd.h
@@ -113,7 +113,7 @@ public:
* @return true if the CD drive was inited succesfully
*/
virtual bool openCD(int drive) = 0;
-
+
/**
* Poll CD status.
* @return true if CD audio is playing
diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp
index 156871eec5..8d22ab732d 100644
--- a/backends/base-backend.cpp
+++ b/backends/base-backend.cpp
@@ -29,6 +29,11 @@
#include "backends/events/default/default-events.h"
#endif
+#ifndef DISABLE_DEFAULT_AUDIOCD_MANAGER
+#include "backends/audiocd/default/default-audiocd.h"
+#endif
+
+
#include "gui/message.h"
void BaseBackend::displayMessageOnOSD(const char *msg) {
@@ -41,8 +46,16 @@ void BaseBackend::initBackend() {
// Init Event manager
#ifndef DISABLE_DEFAULT_EVENT_MANAGER
if (!_eventManager)
- _eventManager = new DefaultEventManager(this);
+ _eventManager = new DefaultEventManager(getDefaultEventSource());
+#endif
+
+ // Init audio CD manager
+#ifndef DISABLE_DEFAULT_AUDIOCD_MANAGER
+ if (!_audiocdManager)
+ _audiocdManager = new DefaultAudioCDManager();
#endif
+
+ OSystem::initBackend();
}
void BaseBackend::fillScreen(uint32 col) {
@@ -51,6 +64,3 @@ void BaseBackend::fillScreen(uint32 col) {
memset(screen->pixels, col, screen->h * screen->pitch);
unlockScreen();
}
-
-void BaseBackend::resetGraphicsScale() {
-}
diff --git a/backends/base-backend.h b/backends/base-backend.h
index 6b19b7a9cb..c797e831a8 100644
--- a/backends/base-backend.h
+++ b/backends/base-backend.h
@@ -24,16 +24,22 @@
#define BACKENDS_BASE_BACKEND_H
#include "common/system.h"
-#include "backends/events/default/default-events.h"
+#include "common/events.h"
-class BaseBackend : public OSystem, Common::EventSource {
+class BaseBackend : public OSystem {
+protected:
+ virtual Common::EventSource *getDefaultEventSource() = 0;
public:
virtual void initBackend();
virtual void displayMessageOnOSD(const char *msg);
virtual void fillScreen(uint32 col);
+};
- virtual void resetGraphicsScale();
+class EventsBaseBackend : public BaseBackend, Common::EventSource {
+protected:
+ virtual Common::EventSource *getDefaultEventSource() { return this; }
+public:
};
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index bb74933596..78072b0021 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -26,6 +26,7 @@
#include "common/system.h"
#include "common/config-manager.h"
+#include "common/translation.h"
#include "backends/events/default/default-events.h"
#include "backends/keymapper/keymapper.h"
#include "backends/keymapper/remap-dialog.h"
@@ -218,7 +219,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
if (ConfMan.getBool("confirm_exit")) {
if (g_engine)
g_engine->pauseEngine(true);
- GUI::MessageDialog alert("Do you really want to return to the Launcher?", "Launcher", "Cancel");
+ GUI::MessageDialog alert(_("Do you really want to return to the Launcher?"), _("Launcher"), _("Cancel"));
result = _shouldRTL = (alert.runModal() == GUI::kMessageOK);
if (g_engine)
g_engine->pauseEngine(false);
@@ -240,7 +241,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
_confirmExitDialogActive = true;
if (g_engine)
g_engine->pauseEngine(true);
- GUI::MessageDialog alert("Do you really want to quit?", "Quit", "Cancel");
+ GUI::MessageDialog alert(_("Do you really want to quit?"), _("Quit"), _("Cancel"));
result = _shouldQuit = (alert.runModal() == GUI::kMessageOK);
if (g_engine)
g_engine->pauseEngine(false);
diff --git a/backends/events/gp2xsdl/gp2xsdl-events.cpp b/backends/events/gp2xsdl/gp2xsdl-events.cpp
deleted file mode 100644
index 5f5ff66319..0000000000
--- a/backends/events/gp2xsdl/gp2xsdl-events.cpp
+++ /dev/null
@@ -1,465 +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(GP2X_OLD)
-
-#include "backends/events/gp2xsdl/gp2xsdl-events.h"
-#include "backends/platform/gp2x/gp2x-hw.h"
-#include "backends/graphics/gp2xsdl/gp2xsdl-graphics.h"
-
-#include "backends/platform/sdl/sdl.h"
-
-#include "common/translation.h"
-
-// FIXME move joystick defines out and replace with confile file options
-// we should really allow users to map any key to a joystick button using the keymapper.
-#define JOY_DEADZONE 2200
-
-#define JOY_XAXIS 0
-#define JOY_YAXIS 1
-
-/* Quick default button states for modifiers. */
-int BUTTON_STATE_L = false;
-
-enum {
- /* DPAD/Stick */
- BUTTON_UP = 0,
- BUTTON_UPLEFT = 1,
- BUTTON_LEFT = 2,
- BUTTON_DOWNLEFT = 3,
- BUTTON_DOWN = 4,
- BUTTON_DOWNRIGHT = 5,
- BUTTON_RIGHT = 6,
- BUTTON_UPRIGHT = 7,
- /* Joystick Buttons */
- BUTTON_MENU = 8, // Start on F100 GP2X
- BUTTON_SELECT = 9,
- BUTTON_L = 10,
- BUTTON_R = 11,
- BUTTON_A = 12,
- BUTTON_B = 13,
- BUTTON_X = 14,
- BUTTON_Y = 15,
- BUTTON_VOLUP = 16,
- BUTTON_VOLDOWN = 17,
- BUTTON_CLICK = 18
-};
-
-enum {
- /* Unused Joystick Buttons on the GP2X */
- BUTTON_HOME = 51,
- BUTTON_HOLD = 52,
- BUTTON_HELP = 53,
- BUTTON_HELP2 = 54
-};
-
-enum {
- /* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
-};
-
-GP2XSdlEventSource::GP2XSdlEventSource()
- : _buttonStateL(false){
-}
-
-void GP2XSdlEventSource::SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event) {
- event.kbd.flags = 0;
-
- if (mod & KMOD_SHIFT)
- event.kbd.flags |= Common::KBD_SHIFT;
- if (mod & KMOD_ALT)
- event.kbd.flags |= Common::KBD_ALT;
- if (mod & KMOD_CTRL)
- event.kbd.flags |= Common::KBD_CTRL;
-
- // Sticky flags
- if (mod & KMOD_NUM)
- event.kbd.flags |= Common::KBD_NUM;
- if (mod & KMOD_CAPS)
- event.kbd.flags |= Common::KBD_CAPS;
-}
-
-void GP2XSdlEventSource::moveStick() {
- bool stickBtn[32];
-
- memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
-
- if ((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6]))
- stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0;
-
- if ((stickBtn[1])||(stickBtn[2])||(stickBtn[3])) {
- if (_km.x_down_count!=2) {
- _km.x_vel = -1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = -4;
- } else if ((stickBtn[5])||(stickBtn[6])||(stickBtn[7])) {
- if (_km.x_down_count!=2) {
- _km.x_vel = 1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = 4;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
-
- if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])) {
- if (_km.y_down_count!=2) {
- _km.y_vel = -1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = -4;
- } else if ((stickBtn[3])||(stickBtn[4])||(stickBtn[5])) {
- if (_km.y_down_count!=2) {
- _km.y_vel = 1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = 4;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-}
-
-/* GP2X Input mappings.
-Single Button
-
-Movement:
-
-GP2X_BUTTON_UP Cursor Up
-GP2X_BUTTON_DOWN Cursor Down
-GP2X_BUTTON_LEFT Cursor Left
-GP2X_BUTTON_RIGHT Cursor Right
-
-GP2X_BUTTON_UPLEFT Cursor Up Left
-GP2X_BUTTON_UPRIGHT Cursor Up Right
-GP2X_BUTTON_DOWNLEFT Cursor Down Left
-GP2X_BUTTON_DOWNRIGHT Cursor Down Right
-
-Button Emulation:
-
-GP2X_BUTTON_CLICK Left Mouse Click (GP2X only)
-GP2X_BUTTON_A . (Period)
-GP2X_BUTTON_B Left Mouse Click
-GP2X_BUTTON_Y Space Bar
-GP2X_BUTTON_X Right Mouse Click
-GP2X_BUTTON_L Combo Modifier (Left Trigger)
-GP2X_BUTTON_R Return (Right Trigger)
-GP2X_BUTTON_MENU F5 (Game Menu)
-GP2X_BUTTON_SELECT Escape
-GP2X_BUTTON_VOLUP /dev/mixer Global Volume Up
-GP2X_BUTTON_VOLDOWN /dev/mixer Global Volume Down
-
-Combos:
-
-GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) or Virtual Keyboard if enabled
-GP2X_BUTTON_L & GP2X_BUTTON_SELECT Common::EVENT_QUIT (Calls Sync() to make sure SD is flushed)
-GP2X_BUTTON_L & GP2X_BUTTON_MENU Common::EVENT_MAINMENU (ScummVM Global Main Menu)
-GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games)
-GP2X_BUTTON_L & GP2X_BUTTON_Y Toggles setZoomOnMouse() for larger then 320*240 games to scale to the point + raduis. (GP2X only)
-*/
-
-bool GP2XSdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) {
- SDLModToOSystemKeyFlags(SDL_GetModState(), event);
-
- if (remapKey(ev, event))
- return true;
-
- 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);
-
- return true;
-}
-
-bool GP2XSdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
-
- _stickBtn[ev.jbutton.button] = 1;
- event.kbd.flags = 0;
-
- switch (ev.jbutton.button) {
- case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
- case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
- case BUTTON_RIGHT:
- case BUTTON_UPRIGHT:
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_B:
- case BUTTON_CLICK:
- if (BUTTON_STATE_L == true) {
- ((GP2XSdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->toggleZoomOnMouse();
- fillMouseEvent(event, _km.x, _km.y);
- } else {
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- }
- break;
- case BUTTON_X:
- event.type = Common::EVENT_RBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_L:
- BUTTON_STATE_L = true;
- break;
- case BUTTON_R:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
-#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
-#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
-#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_SELECT:
- case BUTTON_HOME:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_QUIT;
- } else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_A:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_PREDICTIVE_DIALOG;
- } else {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_Y:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click"));
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
- }
- } else {
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- GP2X_HW::mixerMoveVolume(2);
- if (GP2X_HW::volumeLevel == 100) {
- g_system->displayMessageOnOSD(_("Maximum Volume"));
- } else {
- g_system->displayMessageOnOSD(_("Increasing Volume"));
- }
- break;
-
- case BUTTON_VOLDOWN:
- GP2X_HW::mixerMoveVolume(1);
- if (GP2X_HW::volumeLevel == 0) {
- g_system->displayMessageOnOSD(_("Minimal Volume"));
- } else {
- g_system->displayMessageOnOSD(_("Decreasing Volume"));
- }
- break;
- case BUTTON_HOLD:
- event.type = Common::EVENT_QUIT;
- break;
- case BUTTON_HELP2:
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click"));
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
- }
- break;
- }
- return true;
-}
-
-bool GP2XSdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 0;
- event.kbd.flags = 0;
-
- switch (ev.jbutton.button) {
- case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
- case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
- case BUTTON_RIGHT:
- case BUTTON_UPRIGHT:
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_B:
- case BUTTON_CLICK:
- if (BUTTON_STATE_L == true) {
- break;
- } else {
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- }
- break;
- case BUTTON_X:
- event.type = Common::EVENT_RBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_L:
- BUTTON_STATE_L = false;
- break;
- case BUTTON_SELECT:
- case BUTTON_HOME:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_A:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- break;
- case BUTTON_Y:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- event.type = Common::EVENT_KEYUP;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_R:
- event.type = Common::EVENT_KEYUP;
- if (BUTTON_STATE_L == true) {
-#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
-#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
-#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- break;
- case BUTTON_VOLDOWN:
- break;
- case BUTTON_HOLD:
- break;
- case BUTTON_HELP2:
- break;
- }
- return true;
-}
-
-bool GP2XSdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
- int axis = ev.jaxis.value;
- if ( axis > JOY_DEADZONE) {
- axis -= JOY_DEADZONE;
- event.type = Common::EVENT_MOUSEMOVE;
- } else if ( axis < -JOY_DEADZONE ) {
- axis += JOY_DEADZONE;
- event.type = Common::EVENT_MOUSEMOVE;
- } else
- axis = 0;
-
- if ( ev.jaxis.axis == JOY_XAXIS) {
-#ifdef JOY_ANALOG
- _km.x_vel = axis/2000;
- _km.x_down_count = 0;
-#else
- if (axis != 0) {
- _km.x_vel = (axis > 0) ? 1:-1;
- _km.x_down_count = 1;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
-#endif
-
- } else if (ev.jaxis.axis == JOY_YAXIS) {
-#ifndef JOY_INVERT_Y
- axis = -axis;
-#endif
-#ifdef JOY_ANALOG
- _km.y_vel = -axis / 2000;
- _km.y_down_count = 0;
-#else
- if (axis != 0) {
- _km.y_vel = (-axis > 0) ? 1: -1;
- _km.y_down_count = 1;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-#endif
- }
-
- fillMouseEvent(event, _km.x, _km.y);
- return true;
-}
-
-bool GP2XSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
- return false;
-}
-
-#endif
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp
index 8bb3a3b183..b461f85fbb 100644
--- a/backends/events/gph/gph-events.cpp
+++ b/backends/events/gph/gph-events.cpp
@@ -187,7 +187,6 @@ GPHEventSource::GPHEventSource()
// }
//}
-
void GPHEventSource::moveStick() {
bool stickBtn[32];
diff --git a/backends/events/openpandora/op-events.cpp b/backends/events/openpandora/op-events.cpp
index 4b67cbf432..72bc56c95d 100644
--- a/backends/events/openpandora/op-events.cpp
+++ b/backends/events/openpandora/op-events.cpp
@@ -24,7 +24,6 @@
/*
* OpenPandora: Device Specific Event Handling.
- *
*/
#if defined(OPENPANDORA)
@@ -35,6 +34,8 @@
#include "backends/platform/openpandora/op-options.h"
#include "common/translation.h"
+#include "common/util.h"
+#include "common/events.h"
/* Quick default button states for modifiers. */
int BUTTON_STATE_L = false;
@@ -50,6 +51,68 @@ OPEventSource::OPEventSource()
: _buttonStateL(false){
}
+/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
+
+bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONDOWN;
+ else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONDOWN;
+#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
+ else if (ev.button.button == SDL_BUTTON_WHEELUP)
+ event.type = Common::EVENT_WHEELUP;
+ else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
+ event.type = Common::EVENT_WHEELDOWN;
+#endif
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONDOWN;
+#endif
+ else
+ return false;
+
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
+bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONUP;
+ else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONUP;
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONUP;
+#endif
+ else
+ return false;
+
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
/* On the OpenPandora by default the ABXY and L/R Trigger buttons are returned by SDL as
(A): SDLK_HOME (B): SDLK_END (X): SDLK_PAGEDOWN (Y): SDLK_PAGEUP (L): SDLK_RSHIFT (R): SDLK_RCTRL
*/
@@ -124,65 +187,4 @@ bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
return false;
}
-/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
-
-bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
- if (ev.button.button == SDL_BUTTON_LEFT){
- if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
- event.type = Common::EVENT_RBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
- event.type = Common::EVENT_LBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
- event.type = Common::EVENT_RBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
- event.type = Common::EVENT_MOUSEMOVE;
- else
- event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
- }
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONDOWN;
-#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
- else if (ev.button.button == SDL_BUTTON_WHEELUP)
- event.type = Common::EVENT_WHEELUP;
- else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
- event.type = Common::EVENT_WHEELDOWN;
-#endif
-#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONDOWN;
-#endif
- else
- return false;
-
- fillMouseEvent(event, ev.button.x, ev.button.y);
-
- return true;
-}
-
-bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
- if (ev.button.button == SDL_BUTTON_LEFT){
- if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
- event.type = Common::EVENT_RBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
- event.type = Common::EVENT_LBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
- event.type = Common::EVENT_RBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
- event.type = Common::EVENT_MOUSEMOVE;
- else
- event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
- }
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONUP;
-#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONUP;
-#endif
- else
- return false;
-
- fillMouseEvent(event, ev.button.x, ev.button.y);
-
- return true;
-}
#endif
diff --git a/backends/events/openpandora/op-events.h b/backends/events/openpandora/op-events.h
index 9aa637992a..25f79e68d7 100644
--- a/backends/events/openpandora/op-events.h
+++ b/backends/events/openpandora/op-events.h
@@ -28,17 +28,22 @@
/**
* Events manager for the OpenPandora.
*/
+
class OPEventSource : public SdlEventSource {
public:
OPEventSource();
protected:
- /** Button state for L button modifier */
+
+ /**
+ * Button state for L button modifier
+ */
bool _buttonStateL;
- bool remapKey(SDL_Event &ev, Common::Event &event);
+
bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
+ bool remapKey(SDL_Event &ev, Common::Event &event);
};
#endif /* BACKEND_EVENTS_OP_H */
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/graphics/gp2xsdl/gp2xsdl-graphics.h b/backends/events/ps3sdl/ps3sdl-events.h
index 341b913acd..8cf2f43426 100644
--- a/backends/graphics/gp2xsdl/gp2xsdl-graphics.h
+++ b/backends/events/ps3sdl/ps3sdl-events.h
@@ -20,27 +20,19 @@
*
*/
-#ifndef BACKENDS_GRAPHICS_SDL_GP2X_H
-#define BACKENDS_GRAPHICS_SDL_GP2X_H
+#if !defined(BACKEND_EVENTS_PS3_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER)
+#define BACKEND_EVENTS_PS3_H
-#include "backends/graphics/sdl/sdl-graphics.h"
-
-class GP2XSdlGraphicsManager : public SdlGraphicsManager {
-public:
- GP2XSdlGraphicsManager(SdlEventSource *sdlEventSource);
-
- virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
- virtual int getDefaultGraphicsMode() const;
- virtual void drawMouse();
-
- virtual bool hasFeature(OSystem::Feature f);
- virtual void setFeatureState(OSystem::Feature f, bool enable);
-
- // Toggles zoom adjust on mouse
- void toggleZoomOnMouse();
+#include "backends/events/sdl/sdl-events.h"
+/**
+ * SDL Events manager for the PS3.
+ */
+class PS3SdlEventSource : public SdlEventSource {
protected:
- bool _adjustZoomOnMouse;
+ void preprocessEvents(SDL_Event *event);
+ bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
+ bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
};
-#endif
+#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/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index 227d6e1607..805b76b108 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -20,19 +20,19 @@
*
*/
-#if !defined(BACKEND_EVENTS_SDL_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER)
+#ifndef BACKEND_EVENTS_SDL_H
#define BACKEND_EVENTS_SDL_H
-#include "backends/events/default/default-events.h"
-
#include "backends/platform/sdl/sdl-sys.h"
+#include "common/events.h"
+
/**
* The SDL event source.
*/
class SdlEventSource : public Common::EventSource {
-public:
+public:
SdlEventSource();
virtual ~SdlEventSource();
@@ -69,7 +69,7 @@ protected:
/** Scroll lock state - since SDL doesn't track it */
bool _scrollLock;
-
+
/** Joystick */
SDL_Joystick *_joystick;
diff --git a/backends/events/webossdl/webossdl-events.cpp b/backends/events/webossdl/webossdl-events.cpp
index 4a17bc2066..102eb5802e 100644
--- a/backends/events/webossdl/webossdl-events.cpp
+++ b/backends/events/webossdl/webossdl-events.cpp
@@ -89,7 +89,7 @@ void WebOSSdlEventSource::SDLModToOSystemKeyFlags(SDLMod mod,
event.kbd.flags |= Common::KBD_SHIFT;
if (mod & KMOD_CTRL)
event.kbd.flags |= Common::KBD_CTRL;
-
+
// Holding down the gesture area emulates the ALT key
if (gestureDown)
event.kbd.flags |= Common::KBD_ALT;
diff --git a/backends/events/wincesdl/wincesdl-events.cpp b/backends/events/wincesdl/wincesdl-events.cpp
index f15a416b76..1116cbbb8d 100644
--- a/backends/events/wincesdl/wincesdl-events.cpp
+++ b/backends/events/wincesdl/wincesdl-events.cpp
@@ -35,7 +35,7 @@
WINCESdlEventSource::WINCESdlEventSource()
: _tapTime(0), _closeClick(false), _rbutton(false),
- _freeLook(false), _graphicsMan(0) {
+ _graphicsMan(0) {
}
void WINCESdlEventSource::init(WINCESdlGraphicsManager *graphicsMan) {
@@ -64,6 +64,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
ev.type = SDL_NOEVENT;
DWORD currentTime;
bool keyEvent = false;
+ bool freeLookActive = _graphicsMan->getFreeLookState();
int deltaX, deltaY;
memset(&event, 0, sizeof(Common::Event));
@@ -182,7 +183,8 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
if (_tapTime) { // second tap
if (_closeClick && (GetTickCount() - _tapTime < 1000)) {
if (event.mouse.y <= 20 &&
- _graphicsMan->_panelInitialized) {
+ _graphicsMan->_panelInitialized &&
+ !_graphicsMan->_noDoubleTapPT) {
// top of screen (show panel)
_graphicsMan->swap_panel_visibility();
} else if (!_graphicsMan->_noDoubleTapRMB) {
@@ -199,7 +201,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
}
}
- if (_freeLook && !_closeClick) {
+ if (freeLookActive && !_closeClick) {
_rbutton = false;
_tapTime = 0;
_tapX = event.mouse.x;
@@ -241,7 +243,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
fillMouseEvent(event, ev.button.x, ev.button.y);
- if (_freeLook && !_closeClick) {
+ if (freeLookActive && !_closeClick) {
_tapX = event.mouse.x;
_tapY = event.mouse.y;
event.type = Common::EVENT_MOUSEMOVE;
@@ -322,8 +324,4 @@ int WINCESdlEventSource::mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode, bool u
return key;
}
-void WINCESdlEventSource::swap_freeLook() {
- _freeLook = !_freeLook;
-}
-
#endif /* _WIN32_WCE */
diff --git a/backends/events/wincesdl/wincesdl-events.h b/backends/events/wincesdl/wincesdl-events.h
index 734cc899c0..deeee6196c 100644
--- a/backends/events/wincesdl/wincesdl-events.h
+++ b/backends/events/wincesdl/wincesdl-events.h
@@ -45,8 +45,6 @@ public:
// Overloaded from SDL backend (mouse and new scaler handling)
void fillMouseEvent(Common::Event &event, int x, int y);
- void swap_freeLook();
-
protected:
private:
@@ -61,8 +59,6 @@ private:
bool _closeClick; // flag when taps are spatially close together
bool _rbutton; // double tap -> right button simulation
- bool _freeLook; // freeLook mode (do not send mouse button events)
-
};
#endif
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/platform/gp2x/gp2x-mem.h b/backends/fs/ps3/ps3-fs-factory.h
index b2cd00a587..6c1988b1c9 100644
--- a/backends/platform/gp2x/gp2x-mem.h
+++ b/backends/fs/ps3/ps3-fs-factory.h
@@ -8,44 +8,29 @@
* 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.
- *
*/
-/*
- * GP2X: Memory Stuff.
- *
- */
+#ifndef PS3_FILESYSTEM_FACTORY_H
+#define PS3_FILESYSTEM_FACTORY_H
-#ifndef GP2X_MEM_H
-#define GP2X_MEM_H
+#include "backends/fs/posix/posix-fs-factory.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Use Squidge's MMU patch rather then myown (his is neater).
-// The effect if not that great but cacheing the upper RAM is no bad thing (tm) ;).
-
-//extern void InitRam (void);
-//extern void CloseRam (void);
-// Set ARM920t clock frequency
-extern void SetClock (unsigned c);
-extern void patchMMU (void);
-extern void unpatchMMU (void);
-
-#define SYS_CLK_FREQ 7372800
-
-#ifdef __cplusplus
- }
-#endif
+/**
+ * Creates PS3FilesystemFactory objects.
+ *
+ * Parts of this class are documented in the base interface class, FilesystemFactory.
+ */
+class PS3FilesystemFactory : public POSIXFilesystemFactory {
+ virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
+};
-#endif //GP2X_MEM_H
+#endif /*PS3_FILESYSTEM_FACTORY_H*/
diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp
index 9e864753c9..c32ad2da94 100644
--- a/backends/fs/windows/windows-fs.cpp
+++ b/backends/fs/windows/windows-fs.cpp
@@ -54,7 +54,7 @@ bool WindowsFilesystemNode::isWritable() const {
return _access(_path.c_str(), W_OK) == 0;
}
-void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data) {
+void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, bool hidden, WIN32_FIND_DATA* find_data) {
WindowsFilesystemNode entry;
char *asciiName = toAscii(find_data->cFileName);
bool isDirectory;
@@ -63,6 +63,10 @@ void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const c
if (!strcmp(asciiName, ".") || !strcmp(asciiName, ".."))
return;
+ // Skip hidden files if asked
+ if ((find_data->dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) && !hidden)
+ return;
+
isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false);
if ((!isDirectory && mode == Common::FSNode::kListDirectoriesOnly) ||
@@ -163,8 +167,6 @@ AbstractFSNode *WindowsFilesystemNode::getChild(const Common::String &n) const {
bool WindowsFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
assert(_isDirectory);
- //TODO: honor the hidden flag
-
if (_isPseudoRoot) {
#ifndef _WIN32_WCE
// Drives enumeration
@@ -200,10 +202,10 @@ bool WindowsFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
if (handle == INVALID_HANDLE_VALUE)
return false;
- addFile(myList, mode, _path.c_str(), &desc);
+ addFile(myList, mode, _path.c_str(), hidden, &desc);
while (FindNextFile(handle, &desc))
- addFile(myList, mode, _path.c_str(), &desc);
+ addFile(myList, mode, _path.c_str(), hidden, &desc);
FindClose(handle);
}
diff --git a/backends/fs/windows/windows-fs.h b/backends/fs/windows/windows-fs.h
index 37d1e9099b..351307bef0 100644
--- a/backends/fs/windows/windows-fs.h
+++ b/backends/fs/windows/windows-fs.h
@@ -93,12 +93,13 @@ private:
* Adds a single WindowsFilesystemNode to a given list.
* This method is used by getChildren() to populate the directory entries list.
*
- * @param list List to put the file entry node in.
- * @param mode Mode to use while adding the file entry to the list.
- * @param base Common::String with the directory being listed.
- * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find.
+ * @param list List to put the file entry node in.
+ * @param mode Mode to use while adding the file entry to the list.
+ * @param base Common::String with the directory being listed.
+ * @param hidden true if hidden files should be added, false otherwise
+ * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find.
*/
- static void addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data);
+ static void addFile(AbstractFSList &list, ListMode mode, const char *base, bool hidden, WIN32_FIND_DATA* find_data);
/**
* Converts a Unicode string to Ascii format.
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 8a141e97a5..8075d0d45b 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -36,7 +36,7 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
};
DINGUXSdlGraphicsManager::DINGUXSdlGraphicsManager(SdlEventSource *boss)
- : SdlGraphicsManager(boss) {
+ : SurfaceSdlGraphicsManager(boss) {
}
const OSystem::GraphicsMode *DINGUXSdlGraphicsManager::getSupportedGraphicsModes() const {
@@ -415,7 +415,7 @@ void DINGUXSdlGraphicsManager::showOverlay() {
_mouseCurState.x = _mouseCurState.x / 2;
_mouseCurState.y = _mouseCurState.y / 2;
}
- SdlGraphicsManager::showOverlay();
+ SurfaceSdlGraphicsManager::showOverlay();
}
void DINGUXSdlGraphicsManager::hideOverlay() {
@@ -423,7 +423,7 @@ void DINGUXSdlGraphicsManager::hideOverlay() {
_mouseCurState.x = _mouseCurState.x * 2;
_mouseCurState.y = _mouseCurState.y * 2;
}
- SdlGraphicsManager::hideOverlay();
+ SurfaceSdlGraphicsManager::hideOverlay();
}
bool DINGUXSdlGraphicsManager::loadGFXMode() {
@@ -462,7 +462,7 @@ bool DINGUXSdlGraphicsManager::loadGFXMode() {
}
- return SdlGraphicsManager::loadGFXMode();
+ return SurfaceSdlGraphicsManager::loadGFXMode();
}
bool DINGUXSdlGraphicsManager::hasFeature(OSystem::Feature f) {
@@ -492,11 +492,11 @@ bool DINGUXSdlGraphicsManager::getFeatureState(OSystem::Feature f) {
}
}
-SdlGraphicsManager::MousePos* DINGUXSdlGraphicsManager::getMouseCurState() {
+SurfaceSdlGraphicsManager::MousePos *DINGUXSdlGraphicsManager::getMouseCurState() {
return &_mouseCurState;
}
-SdlGraphicsManager::VideoState* DINGUXSdlGraphicsManager::getVideoMode() {
+SurfaceSdlGraphicsManager::VideoState *DINGUXSdlGraphicsManager::getVideoMode() {
return &_videoMode;
}
@@ -507,7 +507,7 @@ void DINGUXSdlGraphicsManager::warpMouse(int x, int y) {
y = y / 2;
}
}
- SdlGraphicsManager::warpMouse(x, y);
+ SurfaceSdlGraphicsManager::warpMouse(x, y);
}
void DINGUXSdlGraphicsManager::adjustMouseEvent(const Common::Event &event) {
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.h b/backends/graphics/dinguxsdl/dinguxsdl-graphics.h
index 9fb1170503..84a784b771 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.h
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.h
@@ -23,16 +23,16 @@
#ifndef BACKENDS_GRAPHICS_SDL_DINGUX_H
#define BACKENDS_GRAPHICS_SDL_DINGUX_H
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
-#include "graphics/scaler/aspect.h" // for aspect2Real
+#include "graphics/scaler/aspect.h" // for aspect2Real
#include "graphics/scaler/downscaler.h"
enum {
GFX_HALF = 12
};
-class DINGUXSdlGraphicsManager : public SdlGraphicsManager {
+class DINGUXSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
DINGUXSdlGraphicsManager(SdlEventSource *boss);
@@ -54,8 +54,8 @@ public:
void undrawMouse();
virtual void warpMouse(int x, int y);
- SdlGraphicsManager::MousePos *getMouseCurState();
- SdlGraphicsManager::VideoState *getVideoMode();
+ SurfaceSdlGraphicsManager::MousePos *getMouseCurState();
+ SurfaceSdlGraphicsManager::VideoState *getVideoMode();
virtual void adjustMouseEvent(const Common::Event &event);
};
diff --git a/backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp b/backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp
deleted file mode 100644
index 6e5a35a1b1..0000000000
--- a/backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp
+++ /dev/null
@@ -1,180 +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(GP2X_OLD)
-
-#include "backends/graphics/gp2xsdl/gp2xsdl-graphics.h"
-#include "graphics/scaler/aspect.h"
-#include <SDL_gp2x.h>
-
-static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
- {"Fullscreen", "1x", GFX_NORMAL},
- {0, 0, 0}
-};
-
-GP2XSdlGraphicsManager::GP2XSdlGraphicsManager(SdlEventSource *sdlEventSource)
- : SdlGraphicsManager(sdlEventSource), _adjustZoomOnMouse(false) {
-}
-
-const OSystem::GraphicsMode *GP2XSdlGraphicsManager::getSupportedGraphicsModes() const {
- return s_supportedGraphicsModes;
-}
-
-int GP2XSdlGraphicsManager::getDefaultGraphicsMode() const {
- return GFX_NORMAL;
-}
-
-
-bool GP2XSdlGraphicsManager::hasFeature(OSystem::Feature f) {
- if (f == OSystem::kFeatureIconifyWindow)
- return false;
-
- return SdlGraphicsManager::hasFeature(f);
-}
-
-void GP2XSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
- if (f != OSystem::kFeatureIconifyWindow)
- SdlGraphicsManager::setFeatureState(f, enable);
-}
-
-void GP2XSdlGraphicsManager::drawMouse() {
- if (!_mouseVisible || !_mouseSurface) {
- _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
- return;
- }
-
- SDL_Rect zoomdst;
- SDL_Rect dst;
- int scale;
- int hotX, hotY;
- int tmpScreenWidth, tmpScreenHeight;
-
- // Temp vars to ensure we zoom to the LCD resolution or greater.
- tmpScreenWidth = _videoMode.screenWidth;
- tmpScreenHeight = _videoMode.screenHeight;
-
- if (_videoMode.screenHeight <= 240) {
- tmpScreenHeight = 240;
- }
-
- if (_videoMode.screenWidth <= 320) {
- tmpScreenWidth = 320;
- }
-
- dst.x = _mouseCurState.x;
- dst.y = _mouseCurState.y;
-
- if (!_overlayVisible) {
- scale = _videoMode.scaleFactor;
- dst.w = _mouseCurState.vW;
- dst.h = _mouseCurState.vH;
- hotX = _mouseCurState.vHotX;
- hotY = _mouseCurState.vHotY;
- } else {
- scale = 1;
- dst.w = _mouseCurState.rW;
- dst.h = _mouseCurState.rH;
- hotX = _mouseCurState.rHotX;
- hotY = _mouseCurState.rHotY;
- }
-
- // The mouse is undrawn using virtual coordinates, i.e. they may be
- // scaled and aspect-ratio corrected.
-
- _mouseBackup.x = dst.x - hotX;
- _mouseBackup.y = dst.y - hotY;
- _mouseBackup.w = dst.w;
- _mouseBackup.h = dst.h;
-
- // We draw the pre-scaled cursor image, so now we need to adjust for
- // scaling, shake position and aspect ratio correction manually.
-
- if (!_overlayVisible) {
- dst.y += _currentShakePos;
- }
-
- if (_videoMode.aspectRatioCorrection && !_overlayVisible)
- dst.y = real2Aspect(dst.y);
-
- dst.x = scale * dst.x - _mouseCurState.rHotX;
- dst.y = scale * dst.y - _mouseCurState.rHotY;
- dst.w = _mouseCurState.rW;
- dst.h = _mouseCurState.rH;
-
- // Hacking about with the zoom around mouse pointer stuff.
- if (_adjustZoomOnMouse){
-
- zoomdst.w = (tmpScreenWidth / 2);
- zoomdst.h = (tmpScreenHeight / 2);
-
- // Create a zoomed rect centered on the mouse pointer.
- // Will pan 1/4 of the screen.
-
- if (dst.x > ((tmpScreenWidth / 4) * 3)) {
- zoomdst.x = (tmpScreenWidth / 2);
- } else {
- zoomdst.x = (dst.x - (tmpScreenWidth / 4));
- if (zoomdst.x < 0) {
- zoomdst.x = 0;
- }
- }
-
- if (dst.y > ((tmpScreenHeight / 4) * 3)) {
- zoomdst.y = (tmpScreenHeight / 2);
- } else {
- zoomdst.y = (dst.y - (tmpScreenHeight / 4));
- if (zoomdst.y < 0) {
- zoomdst.y = 0;
- }
- }
- SDL_GP2X_Display(&zoomdst);
- } else {
-
- // Make sure we are looking at the whole screen otherwise.
-
- zoomdst.x = 0;
- zoomdst.y = 0;
- zoomdst.w = (tmpScreenWidth);
- zoomdst.h = (tmpScreenHeight);
-
- SDL_GP2X_Display(&zoomdst);
- };
-
- // Note that SDL_BlitSurface() and addDirtyRect() will both perform any
- // clipping necessary
-
- if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0)
- error("SDL_BlitSurface failed: %s", SDL_GetError());
-
- // The screen will be updated using real surface coordinates, i.e.
- // they will not be scaled or aspect-ratio corrected.
-
- addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);
-}
-
-void GP2XSdlGraphicsManager::toggleZoomOnMouse() {
- _adjustZoomOnMouse = !_adjustZoomOnMouse;
-}
-
-#endif
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index b65028920f..82a32203fb 100644
--- a/backends/graphics/gph/gph-graphics.cpp
+++ b/backends/graphics/gph/gph-graphics.cpp
@@ -35,8 +35,8 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{0, 0, 0}
};
-GPHGraphicsManager::GPHGraphicsManager(SdlEventSource *boss)
- : SdlGraphicsManager(boss) {
+GPHGraphicsManager::GPHGraphicsManager(SdlEventSource *sdlEventSource)
+ : SurfaceSdlGraphicsManager(sdlEventSource) {
}
const OSystem::GraphicsMode *GPHGraphicsManager::getSupportedGraphicsModes() const {
@@ -110,21 +110,43 @@ void GPHGraphicsManager::setGraphicsModeIntern() {
blitCursor();
}
-void GPHGraphicsManager::initSize(uint w, uint h) {
+void GPHGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
assert(_transactionMode == kTransactionActive);
+#ifdef USE_RGB_COLOR
+ // Avoid redundant format changes
+ Graphics::PixelFormat newFormat;
+ if (!format)
+ newFormat = Graphics::PixelFormat::createFormatCLUT8();
+ else
+ newFormat = *format;
+
+ assert(newFormat.bytesPerPixel > 0);
+
+ if (newFormat != _videoMode.format) {
+ _videoMode.format = newFormat;
+ _transactionDetails.formatChanged = true;
+ _screenFormat = newFormat;
+ }
+#endif
+
+
// Avoid redundant res changes
if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
return;
_videoMode.screenWidth = w;
_videoMode.screenHeight = h;
+
if (w > 320 || h > 240){
setGraphicsMode(GFX_HALF);
setGraphicsModeIntern();
_sdlEventSource->toggleMouseGrab();
}
+ _videoMode.overlayWidth = 320;
+ _videoMode.overlayHeight = 240;
+
_transactionDetails.sizeChanged = true;
}
@@ -421,7 +443,7 @@ void GPHGraphicsManager::showOverlay() {
_mouseCurState.x = _mouseCurState.x / 2;
_mouseCurState.y = _mouseCurState.y / 2;
}
- SdlGraphicsManager::showOverlay();
+ SurfaceSdlGraphicsManager::showOverlay();
}
void GPHGraphicsManager::hideOverlay() {
@@ -429,30 +451,69 @@ void GPHGraphicsManager::hideOverlay() {
_mouseCurState.x = _mouseCurState.x * 2;
_mouseCurState.y = _mouseCurState.y * 2;
}
- SdlGraphicsManager::hideOverlay();
+ SurfaceSdlGraphicsManager::hideOverlay();
}
-bool GPHGraphicsManager::loadGFXMode() {
-
- /* Forcefully disable aspect ratio correction for games
- that start with a native 240px height resolution
- This corrects games with non-standard resolutions
- such as MM Nes (256x240).
- */
+//bool GPHGraphicsManager::loadGFXMode() {
+
+
+// _videoMode.overlayWidth = 320;
+// _videoMode.overlayHeight = 240;
+// _videoMode.fullscreen = true;
+//
+// /* Forcefully disable aspect ratio correction for games
+// that start with a native 240px height resolution
+// This corrects games with non-standard resolutions
+// such as MM Nes (256x240).
+// */
+// if(_videoMode.screenHeight == 240) {
+// _videoMode.aspectRatioCorrection = false;
+// }
+
+// debug("Game ScreenMode = %d*%d", _videoMode.screenWidth, _videoMode.screenHeight);
+// if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) {
+// _videoMode.aspectRatioCorrection = false;
+// setGraphicsMode(GFX_HALF);
+// debug("GraphicsMode set to HALF");
+// } else {
+// setGraphicsMode(GFX_NORMAL);
+// debug("GraphicsMode set to NORMAL");
+// }
+
+
+// if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) {
+// //_videoMode.overlayWidth = _videoMode.screenWidth / 2;
+// //_videoMode.overlayHeight = _videoMode.screenHeight / 2;
+// _videoMode.overlayWidth = 320;
+// _videoMode.overlayHeight = 240;
+// _videoMode.fullscreen = true;
+// } else {
+//
+// _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+// _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+//
+// if (_videoMode.aspectRatioCorrection)
+// _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
+//
+// //_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+// //_videoMode.hardwareHeight = effectiveScreenHeight();
+// _videoMode.hardwareWidth = 320;
+// _videoMode.hardwareHeight = 240;
+//
+// }
+
+// return SurfaceSdlGraphicsManager::loadGFXMode();
+//}
- if(_videoMode.screenHeight == 240) {
- _videoMode.aspectRatioCorrection = false;
- }
-
- debug("Game ScreenMode = %d*%d", _videoMode.screenWidth, _videoMode.screenHeight);
+bool GPHGraphicsManager::loadGFXMode() {
if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) {
_videoMode.aspectRatioCorrection = false;
setGraphicsMode(GFX_HALF);
- debug("GraphicsMode set to HALF");
+// printf("GFX_HALF\n");
} else {
setGraphicsMode(GFX_NORMAL);
- debug("GraphicsMode set to NORMAL");
+// printf("GFX_NORMAL\n");
}
if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) {
@@ -470,7 +531,7 @@ bool GPHGraphicsManager::loadGFXMode() {
_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
_videoMode.hardwareHeight = effectiveScreenHeight();
}
- return SdlGraphicsManager::loadGFXMode();
+ return SurfaceSdlGraphicsManager::loadGFXMode();
}
bool GPHGraphicsManager::hasFeature(OSystem::Feature f) {
@@ -500,11 +561,11 @@ bool GPHGraphicsManager::getFeatureState(OSystem::Feature f) {
}
}
-SdlGraphicsManager::MousePos* GPHGraphicsManager::getMouseCurState() {
+SurfaceSdlGraphicsManager::MousePos *GPHGraphicsManager::getMouseCurState() {
return &_mouseCurState;
}
-SdlGraphicsManager::VideoState* GPHGraphicsManager::getVideoMode() {
+SurfaceSdlGraphicsManager::VideoState *GPHGraphicsManager::getVideoMode() {
return &_videoMode;
}
@@ -515,7 +576,7 @@ void GPHGraphicsManager::warpMouse(int x, int y) {
y = y / 2;
}
}
- SdlGraphicsManager::warpMouse(x, y);
+ SurfaceSdlGraphicsManager::warpMouse(x, y);
}
void GPHGraphicsManager::adjustMouseEvent(const Common::Event &event) {
diff --git a/backends/graphics/gph/gph-graphics.h b/backends/graphics/gph/gph-graphics.h
index 6ba2b344a6..45b8618569 100644
--- a/backends/graphics/gph/gph-graphics.h
+++ b/backends/graphics/gph/gph-graphics.h
@@ -23,15 +23,15 @@
#ifndef BACKENDS_GRAPHICS_GPH_H
#define BACKENDS_GRAPHICS_GPH_H
-#include "backends/graphics/sdl/sdl-graphics.h"
-#include "graphics/scaler/aspect.h" // for aspect2Real
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
+#include "graphics/scaler/aspect.h" // for aspect2Real
#include "graphics/scaler/downscaler.h"
enum {
GFX_HALF = 12
};
-class GPHGraphicsManager : public SdlGraphicsManager {
+class GPHGraphicsManager : public SurfaceSdlGraphicsManager {
public:
GPHGraphicsManager(SdlEventSource *boss);
@@ -40,7 +40,7 @@ public:
bool getFeatureState(OSystem::Feature f);
int getDefaultGraphicsMode() const;
- void initSize(uint w, uint h);
+ void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
bool setGraphicsMode(const char *name);
bool setGraphicsMode(int mode);
@@ -53,8 +53,8 @@ public:
void undrawMouse();
virtual void warpMouse(int x, int y);
- SdlGraphicsManager::MousePos *getMouseCurState();
- SdlGraphicsManager::VideoState *getVideoMode();
+ SurfaceSdlGraphicsManager::MousePos *getMouseCurState();
+ SurfaceSdlGraphicsManager::VideoState *getVideoMode();
virtual void adjustMouseEvent(const Common::Event &event);
};
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
index 42db89ee33..732074b7e2 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
@@ -46,7 +46,7 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
};
LinuxmotoSdlGraphicsManager::LinuxmotoSdlGraphicsManager(SdlEventSource *sdlEventSource)
- : SdlGraphicsManager(sdlEventSource) {
+ : SurfaceSdlGraphicsManager(sdlEventSource) {
}
const OSystem::GraphicsMode *LinuxmotoSdlGraphicsManager::getSupportedGraphicsModes() const {
@@ -166,7 +166,7 @@ bool LinuxmotoSdlGraphicsManager::loadGFXMode() {
_videoMode.hardwareHeight = effectiveScreenHeight();
}
- return SdlGraphicsManager::loadGFXMode();
+ return SurfaceSdlGraphicsManager::loadGFXMode();
}
void LinuxmotoSdlGraphicsManager::drawMouse() {
@@ -457,7 +457,7 @@ void LinuxmotoSdlGraphicsManager::showOverlay() {
_mouseCurState.x = _mouseCurState.x / 2;
_mouseCurState.y = _mouseCurState.y / 2;
}
- SdlGraphicsManager::showOverlay();
+ SurfaceSdlGraphicsManager::showOverlay();
}
void LinuxmotoSdlGraphicsManager::hideOverlay() {
@@ -465,7 +465,7 @@ void LinuxmotoSdlGraphicsManager::hideOverlay() {
_mouseCurState.x = _mouseCurState.x * 2;
_mouseCurState.y = _mouseCurState.y * 2;
}
- SdlGraphicsManager::hideOverlay();
+ SurfaceSdlGraphicsManager::hideOverlay();
}
void LinuxmotoSdlGraphicsManager::warpMouse(int x, int y) {
@@ -475,7 +475,7 @@ void LinuxmotoSdlGraphicsManager::warpMouse(int x, int y) {
y = y / 2;
}
}
- SdlGraphicsManager::warpMouse(x, y);
+ SurfaceSdlGraphicsManager::warpMouse(x, y);
}
void LinuxmotoSdlGraphicsManager::adjustMouseEvent(const Common::Event &event) {
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
index c428f00447..938512f323 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
@@ -23,9 +23,9 @@
#ifndef BACKENDS_GRAPHICS_SDL_LINUXMOTO_H
#define BACKENDS_GRAPHICS_SDL_LINUXMOTO_H
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
-class LinuxmotoSdlGraphicsManager : public SdlGraphicsManager {
+class LinuxmotoSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
LinuxmotoSdlGraphicsManager(SdlEventSource *sdlEventSource);
diff --git a/backends/graphics/opengl/gltexture.cpp b/backends/graphics/opengl/gltexture.cpp
index 3d1027b44f..b7f5c90105 100644
--- a/backends/graphics/opengl/gltexture.cpp
+++ b/backends/graphics/opengl/gltexture.cpp
@@ -108,7 +108,7 @@ void GLTexture::refresh() {
void GLTexture::allocBuffer(GLuint w, GLuint h) {
_realWidth = w;
_realHeight = h;
-
+
if (w <= _textureWidth && h <= _textureHeight && !_refresh)
// Already allocated a sufficiently large buffer
return;
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index c0551de386..046be4c669 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -179,7 +179,7 @@ bool OpenGLGraphicsManager::setGraphicsMode(int mode) {
}
int OpenGLGraphicsManager::getGraphicsMode() const {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
return _videoMode.mode;
}
@@ -420,12 +420,12 @@ void OpenGLGraphicsManager::fillScreen(uint32 col) {
}
void OpenGLGraphicsManager::updateScreen() {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
internUpdateScreen();
}
void OpenGLGraphicsManager::setShakePos(int shakeOffset) {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
_shakePos = shakeOffset;
}
@@ -440,7 +440,7 @@ void OpenGLGraphicsManager::clearFocusRectangle() {
//
void OpenGLGraphicsManager::showOverlay() {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
if (_overlayVisible)
return;
@@ -451,7 +451,7 @@ void OpenGLGraphicsManager::showOverlay() {
}
void OpenGLGraphicsManager::hideOverlay() {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
if (!_overlayVisible)
return;
@@ -483,7 +483,7 @@ void OpenGLGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
}
void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
if (_overlayTexture == NULL)
return;
@@ -642,7 +642,7 @@ void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int
void OpenGLGraphicsManager::setCursorPalette(const byte *colors, uint start, uint num) {
assert(colors);
-
+
// Save the cursor palette
memcpy(_cursorPalette + start * 3, colors, num * 3);
@@ -1315,7 +1315,7 @@ bool OpenGLGraphicsManager::notifyEvent(const Common::Event &event) {
bool OpenGLGraphicsManager::saveScreenshot(const char *filename) {
int width = _videoMode.hardwareWidth;
int height = _videoMode.hardwareHeight;
-
+
// A line of a BMP image must have a size divisible by 4.
// We calculate the padding bytes needed here.
// Since we use a 3 byte per pixel mode, we can use width % 4 here, since
@@ -1358,7 +1358,7 @@ bool OpenGLGraphicsManager::saveScreenshot(const char *filename) {
out.writeUint32LE(0);
out.writeUint32LE(0);
out.writeUint32LE(0);
- out.writeUint32LE(0);
+ out.writeUint32LE(0);
// Write pixel data to BMP
out.write(pixels, lineSize * height);
@@ -1413,7 +1413,7 @@ void OpenGLGraphicsManager::updateOSD() {
int dstX = (_osdSurface.w - width) / 2;
int dstY = (_osdSurface.h - height) / 2;
- // Draw a dark gray rect
+ // Draw a dark gray rect (R = 40, G = 40, B = 40)
const uint16 color = 0x294B;
_osdSurface.fillRect(Common::Rect(dstX, dstY, dstX + width, dstY + height), color);
@@ -1423,9 +1423,9 @@ void OpenGLGraphicsManager::updateOSD() {
dstX, dstY + i * lineHeight + vOffset + lineSpacing, width,
0xFFFF, Graphics::kTextAlignCenter);
}
-
+
// Update the texture
- _osdTexture->updateBuffer(_osdSurface.pixels, _osdSurface.pitch, 0, 0,
+ _osdTexture->updateBuffer(_osdSurface.pixels, _osdSurface.pitch, 0, 0,
_osdSurface.w, _osdSurface.h);
}
#endif
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 463715aad8..56f7d92a12 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -185,7 +185,7 @@ protected:
/**
* Set the scale factor.
- *
+ *
* This can only be used in a GFX transaction.
*
* @param newScale New scale factor.
@@ -332,7 +332,7 @@ protected:
GLTexture *_osdTexture;
Graphics::Surface _osdSurface;
uint8 _osdAlpha;
- uint32 _osdFadeStartTime;
+ uint32 _osdFadeStartTime;
bool _requireOSDUpdate;
enum {
kOSDFadeOutDelay = 2 * 1000,
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 87457c3c08..bd7dd32e3b 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -54,6 +54,10 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
SDL_ShowCursor(SDL_DISABLE);
// Get desktop resolution
+ // TODO: In case the OpenGL manager is created *after* a plain SDL manager
+ // has been used, this will return the last setup graphics mode rather
+ // than the desktop resolution. We should really look into a way to
+ // properly retrieve the desktop resolution.
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
if (videoInfo->current_w > 0 && videoInfo->current_h > 0) {
_desktopWidth = videoInfo->current_w;
@@ -110,16 +114,16 @@ void OpenGLSdlGraphicsManager::detectSupportedFormats() {
// use.
const Graphics::PixelFormat RGBList[] = {
#if defined(ENABLE_32BIT)
- Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0), // RGBA8888
+ Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0), // RGBA8888
#ifndef USE_GLES
Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24), // ARGB8888
#endif
- Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0), // RGB888
+ Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0), // RGB888
#endif
- Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), // RGB565
- Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0), // RGB5551
- Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555
- Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0), // RGBA4444
+ Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), // RGB565
+ Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0), // RGB5551
+ Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555
+ Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0), // RGBA4444
#ifndef USE_GLES
Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12) // ARGB4444
#endif
@@ -302,7 +306,7 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
int screenAspectRatio = _videoMode.screenWidth * 10000 / _videoMode.screenHeight;
int desiredAspectRatio = getAspectRatio();
-
+
// Do not downscale dimensions, only enlarge them if needed
if (screenAspectRatio > desiredAspectRatio)
_videoMode.hardwareHeight = (_videoMode.overlayWidth * 10000 + 5000) / desiredAspectRatio;
@@ -385,7 +389,7 @@ void OpenGLSdlGraphicsManager::internUpdateScreen() {
OpenGLGraphicsManager::internUpdateScreen();
// Swap OpenGL buffers
- SDL_GL_SwapBuffers();
+ SDL_GL_SwapBuffers();
}
#ifdef USE_OSD
@@ -394,27 +398,27 @@ void OpenGLSdlGraphicsManager::displayModeChangedMsg() {
if (newModeName) {
const int scaleFactor = getScale();
- char buffer[128];
- sprintf(buffer, "%s: %s\n%d x %d -> %d x %d",
+ Common::String osdMessage = Common::String::format(
+ "%s: %s\n%d x %d -> %d x %d",
_("Current display mode"),
newModeName,
_videoMode.screenWidth * scaleFactor,
_videoMode.screenHeight * scaleFactor,
_hwscreen->w, _hwscreen->h
);
- displayMessageOnOSD(buffer);
+ displayMessageOnOSD(osdMessage.c_str());
}
}
void OpenGLSdlGraphicsManager::displayScaleChangedMsg() {
- char buffer[128];
const int scaleFactor = getScale();
- sprintf(buffer, "%s: x%d\n%d x %d -> %d x %d",
+ Common::String osdMessage = Common::String::format(
+ "%s: x%d\n%d x %d -> %d x %d",
_("Current scale"),
scaleFactor,
_videoMode.screenWidth, _videoMode.screenHeight,
_videoMode.overlayWidth, _videoMode.overlayHeight
);
- displayMessageOnOSD(buffer);
+ displayMessageOnOSD(osdMessage.c_str());
}
#endif
@@ -450,18 +454,18 @@ void OpenGLSdlGraphicsManager::toggleFullScreen(int loop) {
_ignoreResizeFrames = 10;
#ifdef USE_OSD
- char buffer[128];
+ Common::String osdMessage;
if (getFullscreenMode())
- sprintf(buffer, "%s\n%d x %d",
+ osdMessage = Common::String::format("%s\n%d x %d",
_("Fullscreen mode"),
_hwscreen->w, _hwscreen->h
);
else
- sprintf(buffer, "%s\n%d x %d",
+ osdMessage = Common::String::format("%s\n%d x %d",
_("Windowed mode"),
_hwscreen->w, _hwscreen->h
);
- displayMessageOnOSD(buffer);
+ displayMessageOnOSD(osdMessage.c_str());
#endif
}
@@ -478,19 +482,19 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
// Alt-S create a screenshot
if (event.kbd.keycode == 's') {
- char filename[20];
+ Common::String filename;
for (int n = 0;; n++) {
SDL_RWops *file;
- sprintf(filename, "scummvm%05d.bmp", n);
- file = SDL_RWFromFile(filename, "r");
+ filename = Common::String::format("scummvm%05d.bmp", n);
+ file = SDL_RWFromFile(filename.c_str(), "r");
if (!file)
break;
SDL_RWclose(file);
}
- if (saveScreenshot(filename))
- debug("Saved screenshot '%s'", filename);
+ if (saveScreenshot(filename.c_str()))
+ debug("Saved screenshot '%s'", filename.c_str());
else
warning("Could not save screenshot");
return true;
@@ -511,18 +515,18 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
setFeatureState(OSystem::kFeatureAspectRatioCorrection, !getFeatureState(OSystem::kFeatureAspectRatioCorrection));
endGFXTransaction();
#ifdef USE_OSD
- char buffer[128];
+ Common::String osdMessage;
if (getFeatureState(OSystem::kFeatureAspectRatioCorrection))
- sprintf(buffer, "%s\n%d x %d -> %d x %d",
- _("Enabled aspect ratio correction"),
+ osdMessage = Common::String::format("%s\n%d x %d -> %d x %d",
+ _("Enabled aspect ratio correction"),
_videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h);
else
- sprintf(buffer, "%s\n%d x %d -> %d x %d",
- _("Disabled aspect ratio correction"),
+ osdMessage = Common::String::format("%s\n%d x %d -> %d x %d",
+ _("Disabled aspect ratio correction"),
_videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h);
- displayMessageOnOSD(buffer);
+ displayMessageOnOSD(osdMessage.c_str());
#endif
internUpdateScreen();
return true;
@@ -557,7 +561,7 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
// Check if the desktop resolution has been detected
if (_desktopWidth > 0 && _desktopHeight > 0)
// If the new scale factor is too big, do not scale
- if (_videoMode.screenWidth * factor > _desktopWidth ||
+ if (_videoMode.screenWidth * factor > _desktopWidth ||
_videoMode.screenHeight * factor > _desktopHeight)
return false;
@@ -607,7 +611,7 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
break;
case Common::EVENT_KEYUP:
return isHotkey(event);
- // HACK: Handle special SDL event
+ // HACK: Handle special SDL event
// The new screen size is saved on the mouse event as part of HACK,
// there is no common resize event.
case OSystem_SDL::kSdlEventResize:
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index 20ee5dfc36..5f0301a0c8 100644
--- a/backends/graphics/openpandora/op-graphics.cpp
+++ b/backends/graphics/openpandora/op-graphics.cpp
@@ -26,15 +26,13 @@
#include "backends/graphics/openpandora/op-graphics.h"
#include "backends/events/openpandora/op-events.h"
-#include "backends/platform/openpandora/op-sdl.h"
-#include "common/mutex.h"
-#include "common/util.h"
-
+//#include "backends/platform/openpandora/op-sdl.h"
#include "graphics/scaler/aspect.h"
-#include "graphics/surface.h"
+#include "common/mutex.h"
+#include "common/textconsole.h"
-OPGraphicsManager::OPGraphicsManager(SdlEventSource *boss)
- : SdlGraphicsManager(boss) {
+OPGraphicsManager::OPGraphicsManager(SdlEventSource *sdlEventSource)
+ : SurfaceSdlGraphicsManager(sdlEventSource) {
}
bool OPGraphicsManager::loadGFXMode() {
@@ -49,7 +47,7 @@ bool OPGraphicsManager::loadGFXMode() {
if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
_videoMode.aspectRatioCorrection = false;
- return SdlGraphicsManager::loadGFXMode();
+ return SurfaceSdlGraphicsManager::loadGFXMode();
}
#endif
diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h
index b0d4298620..ed26df7475 100644
--- a/backends/graphics/openpandora/op-graphics.h
+++ b/backends/graphics/openpandora/op-graphics.h
@@ -23,7 +23,7 @@
#ifndef BACKENDS_GRAPHICS_OP_H
#define BACKENDS_GRAPHICS_OP_H
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
#include "graphics/scaler/aspect.h" // for aspect2Real
#include "graphics/scaler/downscaler.h"
@@ -31,32 +31,32 @@ enum {
GFX_HALF = 12
};
-class OPGraphicsManager : public SdlGraphicsManager {
+class OPGraphicsManager : public SurfaceSdlGraphicsManager {
public:
- OPGraphicsManager(SdlEventSource *boss);
-
- bool hasFeature(OSystem::Feature f);
- void setFeatureState(OSystem::Feature f, bool enable);
- bool getFeatureState(OSystem::Feature f);
- int getDefaultGraphicsMode() const;
-
- void initSize(uint w, uint h);
- const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
- bool setGraphicsMode(const char *name);
- bool setGraphicsMode(int mode);
- void setGraphicsModeIntern();
- void internUpdateScreen();
- void showOverlay();
- void hideOverlay();
+ OPGraphicsManager(SdlEventSource *sdlEventSource);
+
+// bool hasFeature(OSystem::Feature f);
+// void setFeatureState(OSystem::Feature f, bool enable);
+// bool getFeatureState(OSystem::Feature f);
+// int getDefaultGraphicsMode() const;
+
+// void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
+// const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
+// bool setGraphicsMode(const char *name);
+// bool setGraphicsMode(int mode);
+// void setGraphicsModeIntern();
+// void internUpdateScreen();
+// void showOverlay();
+// void hideOverlay();
bool loadGFXMode();
- void drawMouse();
- void undrawMouse();
- virtual void warpMouse(int x, int y);
+// void drawMouse();
+// void undrawMouse();
+// virtual void warpMouse(int x, int y);
- SdlGraphicsManager::MousePos *getMouseCurState();
- SdlGraphicsManager::VideoState *getVideoMode();
+// SurfaceSdlGraphicsManager::MousePos *getMouseCurState();
+// SurfaceSdlGraphicsManager::VideoState *getVideoMode();
- virtual void adjustMouseEvent(const Common::Event &event);
+// virtual void adjustMouseEvent(const Common::Event &event);
};
#endif /* BACKENDS_GRAPHICS_OP_H */
diff --git a/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp b/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
index f6832978a8..95e0875f55 100644
--- a/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
+++ b/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
@@ -29,7 +29,7 @@
#include "backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h"
SamsungTVSdlGraphicsManager::SamsungTVSdlGraphicsManager(SdlEventSource *sdlEventSource)
- : SdlGraphicsManager(sdlEventSource) {
+ : SurfaceSdlGraphicsManager(sdlEventSource) {
}
bool SamsungTVSdlGraphicsManager::hasFeature(OSystem::Feature f) {
@@ -41,7 +41,7 @@ bool SamsungTVSdlGraphicsManager::hasFeature(OSystem::Feature f) {
void SamsungTVSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
switch (f) {
case OSystem::kFeatureAspectRatioCorrection:
- SdlGraphicsManager::setFeatureState(f, enable);
+ SurfaceSdlGraphicsManager::setFeatureState(f, enable);
break;
default:
break;
@@ -51,7 +51,7 @@ void SamsungTVSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enabl
bool SamsungTVSdlGraphicsManager::getFeatureState(OSystem::Feature f) {
switch (f) {
case OSystem::kFeatureAspectRatioCorrection:
- return SdlGraphicsManager::getFeatureState(f);
+ return SurfaceSdlGraphicsManager::getFeatureState(f);
default:
return false;
}
diff --git a/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h b/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h
index dc65c3a696..2d0ff636f4 100644
--- a/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h
+++ b/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h
@@ -25,9 +25,9 @@
#if defined(SAMSUNGTV)
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
-class SamsungTVSdlGraphicsManager : public SdlGraphicsManager {
+class SamsungTVSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
SamsungTVSdlGraphicsManager(SdlEventSource *sdlEventSource);
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 9063f55744..66207b6808 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -24,7 +24,7 @@
#if defined(SDL_BACKEND)
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
#include "backends/events/sdl/sdl-events.h"
#include "backends/platform/sdl/sdl.h"
#include "common/config-manager.h"
@@ -120,7 +120,7 @@ static AspectRatio getDesiredAspectRatio() {
}
#endif
-SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *sdlEventSource)
+SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource)
:
_sdlEventSource(sdlEventSource),
#ifdef USE_OSD
@@ -195,7 +195,7 @@ SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *sdlEventSource)
#endif
}
-SdlGraphicsManager::~SdlGraphicsManager() {
+SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() {
// Unregister the event observer
if (g_system->getEventManager()->getEventDispatcher() != NULL)
g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
@@ -214,12 +214,12 @@ SdlGraphicsManager::~SdlGraphicsManager() {
free(_mouseData);
}
-void SdlGraphicsManager::initEventObserver() {
+void SurfaceSdlGraphicsManager::initEventObserver() {
// Register the graphics manager as a event observer
g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false);
}
-bool SdlGraphicsManager::hasFeature(OSystem::Feature f) {
+bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureFullscreenMode) ||
(f == OSystem::kFeatureAspectRatioCorrection) ||
@@ -227,7 +227,7 @@ bool SdlGraphicsManager::hasFeature(OSystem::Feature f) {
(f == OSystem::kFeatureIconifyWindow);
}
-void SdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
+void SurfaceSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
switch (f) {
case OSystem::kFeatureFullscreenMode:
setFullscreenMode(enable);
@@ -248,7 +248,7 @@ void SdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
}
}
-bool SdlGraphicsManager::getFeatureState(OSystem::Feature f) {
+bool SurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) {
assert(_transactionMode == kTransactionNone);
switch (f) {
@@ -263,23 +263,23 @@ bool SdlGraphicsManager::getFeatureState(OSystem::Feature f) {
}
}
-const OSystem::GraphicsMode *SdlGraphicsManager::supportedGraphicsModes() {
+const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::supportedGraphicsModes() {
return s_supportedGraphicsModes;
}
-const OSystem::GraphicsMode *SdlGraphicsManager::getSupportedGraphicsModes() const {
+const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::getSupportedGraphicsModes() const {
return s_supportedGraphicsModes;
}
-int SdlGraphicsManager::getDefaultGraphicsMode() const {
+int SurfaceSdlGraphicsManager::getDefaultGraphicsMode() const {
return GFX_DOUBLESIZE;
}
-void SdlGraphicsManager::resetGraphicsScale() {
+void SurfaceSdlGraphicsManager::resetGraphicsScale() {
setGraphicsMode(s_gfxModeSwitchTable[_scalerType][0]);
}
-void SdlGraphicsManager::beginGFXTransaction() {
+void SurfaceSdlGraphicsManager::beginGFXTransaction() {
assert(_transactionMode == kTransactionNone);
_transactionMode = kTransactionActive;
@@ -297,7 +297,7 @@ void SdlGraphicsManager::beginGFXTransaction() {
_oldVideoMode = _videoMode;
}
-OSystem::TransactionError SdlGraphicsManager::endGFXTransaction() {
+OSystem::TransactionError SurfaceSdlGraphicsManager::endGFXTransaction() {
int errors = OSystem::kTransactionSuccess;
assert(_transactionMode != kTransactionNone);
@@ -398,12 +398,12 @@ OSystem::TransactionError SdlGraphicsManager::endGFXTransaction() {
}
#ifdef USE_RGB_COLOR
-Common::List<Graphics::PixelFormat> SdlGraphicsManager::getSupportedFormats() const {
+Common::List<Graphics::PixelFormat> SurfaceSdlGraphicsManager::getSupportedFormats() const {
assert(!_supportedFormats.empty());
return _supportedFormats;
}
-void SdlGraphicsManager::detectSupportedFormats() {
+void SurfaceSdlGraphicsManager::detectSupportedFormats() {
// Clear old list
_supportedFormats.clear();
@@ -487,7 +487,7 @@ void SdlGraphicsManager::detectSupportedFormats() {
}
#endif
-bool SdlGraphicsManager::setGraphicsMode(int mode) {
+bool SurfaceSdlGraphicsManager::setGraphicsMode(int mode) {
Common::StackLock lock(_graphicsMutex);
assert(_transactionMode == kTransactionActive);
@@ -557,7 +557,7 @@ bool SdlGraphicsManager::setGraphicsMode(int mode) {
return true;
}
-void SdlGraphicsManager::setGraphicsModeIntern() {
+void SurfaceSdlGraphicsManager::setGraphicsModeIntern() {
Common::StackLock lock(_graphicsMutex);
ScalerProc *newScalerProc = 0;
@@ -630,12 +630,12 @@ void SdlGraphicsManager::setGraphicsModeIntern() {
blitCursor();
}
-int SdlGraphicsManager::getGraphicsMode() const {
- assert (_transactionMode == kTransactionNone);
+int SurfaceSdlGraphicsManager::getGraphicsMode() const {
+ assert(_transactionMode == kTransactionNone);
return _videoMode.mode;
}
-void SdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
+void SurfaceSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
assert(_transactionMode == kTransactionActive);
#ifdef USE_RGB_COLOR
@@ -665,7 +665,7 @@ void SdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *f
_transactionDetails.sizeChanged = true;
}
-int SdlGraphicsManager::effectiveScreenHeight() const {
+int SurfaceSdlGraphicsManager::effectiveScreenHeight() const {
return _videoMode.scaleFactor *
(_videoMode.aspectRatioCorrection
? real2Aspect(_videoMode.screenHeight)
@@ -713,7 +713,7 @@ static void fixupResolutionForAspectRatio(AspectRatio desiredAspectRatio, int &w
height = bestMode->h;
}
-bool SdlGraphicsManager::loadGFXMode() {
+bool SurfaceSdlGraphicsManager::loadGFXMode() {
_forceFull = true;
#if !defined(__MAEMO__) && !defined(DINGUX) && !defined(GPH_DEVICE) && !defined(LINUXMOTO) && !defined(OPENPANDORA)
@@ -853,7 +853,7 @@ bool SdlGraphicsManager::loadGFXMode() {
return true;
}
-void SdlGraphicsManager::unloadGFXMode() {
+void SurfaceSdlGraphicsManager::unloadGFXMode() {
if (_screen) {
SDL_FreeSurface(_screen);
_screen = NULL;
@@ -888,7 +888,7 @@ void SdlGraphicsManager::unloadGFXMode() {
DestroyScalers();
}
-bool SdlGraphicsManager::hotswapGFXMode() {
+bool SurfaceSdlGraphicsManager::hotswapGFXMode() {
if (!_screen)
return false;
@@ -940,15 +940,15 @@ bool SdlGraphicsManager::hotswapGFXMode() {
return true;
}
-void SdlGraphicsManager::updateScreen() {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::updateScreen() {
+ assert(_transactionMode == kTransactionNone);
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
internUpdateScreen();
}
-void SdlGraphicsManager::internUpdateScreen() {
+void SurfaceSdlGraphicsManager::internUpdateScreen() {
SDL_Surface *srcSurf, *origSurf;
int height, width;
ScalerProc *scalerProc;
@@ -1191,14 +1191,14 @@ void SdlGraphicsManager::internUpdateScreen() {
_mouseNeedsRedraw = false;
}
-bool SdlGraphicsManager::saveScreenshot(const char *filename) {
+bool SurfaceSdlGraphicsManager::saveScreenshot(const char *filename) {
assert(_hwscreen != NULL);
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
return SDL_SaveBMP(_hwscreen, filename) == 0;
}
-void SdlGraphicsManager::setFullscreenMode(bool enable) {
+void SurfaceSdlGraphicsManager::setFullscreenMode(bool enable) {
Common::StackLock lock(_graphicsMutex);
if (_oldVideoMode.setup && _oldVideoMode.fullscreen == enable)
@@ -1210,7 +1210,7 @@ void SdlGraphicsManager::setFullscreenMode(bool enable) {
}
}
-void SdlGraphicsManager::setAspectRatioCorrection(bool enable) {
+void SurfaceSdlGraphicsManager::setAspectRatioCorrection(bool enable) {
Common::StackLock lock(_graphicsMutex);
if (_oldVideoMode.setup && _oldVideoMode.aspectRatioCorrection == enable)
@@ -1222,12 +1222,12 @@ void SdlGraphicsManager::setAspectRatioCorrection(bool enable) {
}
}
-void SdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
+ assert(_transactionMode == kTransactionNone);
assert(src);
if (_screen == NULL) {
- warning("SdlGraphicsManager::copyRectToScreen: _screen == NULL");
+ warning("SurfaceSdlGraphicsManager::copyRectToScreen: _screen == NULL");
return;
}
@@ -1272,8 +1272,8 @@ void SdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int
SDL_UnlockSurface(_screen);
}
-Graphics::Surface *SdlGraphicsManager::lockScreen() {
- assert (_transactionMode == kTransactionNone);
+Graphics::Surface *SurfaceSdlGraphicsManager::lockScreen() {
+ assert(_transactionMode == kTransactionNone);
// Lock the graphics mutex
g_system->lockMutex(_graphicsMutex);
@@ -1299,8 +1299,8 @@ Graphics::Surface *SdlGraphicsManager::lockScreen() {
return &_framebuffer;
}
-void SdlGraphicsManager::unlockScreen() {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::unlockScreen() {
+ assert(_transactionMode == kTransactionNone);
// paranoia check
assert(_screenIsLocked);
@@ -1316,14 +1316,14 @@ void SdlGraphicsManager::unlockScreen() {
g_system->unlockMutex(_graphicsMutex);
}
-void SdlGraphicsManager::fillScreen(uint32 col) {
+void SurfaceSdlGraphicsManager::fillScreen(uint32 col) {
Graphics::Surface *screen = lockScreen();
if (screen && screen->pixels)
memset(screen->pixels, col, screen->h * screen->pitch);
unlockScreen();
}
-void SdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool realCoordinates) {
+void SurfaceSdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool realCoordinates) {
if (_forceFull)
return;
@@ -1391,15 +1391,15 @@ void SdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool realCoord
}
}
-int16 SdlGraphicsManager::getHeight() {
+int16 SurfaceSdlGraphicsManager::getHeight() {
return _videoMode.screenHeight;
}
-int16 SdlGraphicsManager::getWidth() {
+int16 SurfaceSdlGraphicsManager::getWidth() {
return _videoMode.screenWidth;
}
-void SdlGraphicsManager::setPalette(const byte *colors, uint start, uint num) {
+void SurfaceSdlGraphicsManager::setPalette(const byte *colors, uint start, uint num) {
assert(colors);
#ifdef USE_RGB_COLOR
@@ -1411,7 +1411,7 @@ void SdlGraphicsManager::setPalette(const byte *colors, uint start, uint num) {
// But it could indicate a programming error, so let's warn about it.
if (!_screen)
- warning("SdlGraphicsManager::setPalette: _screen == NULL");
+ warning("SurfaceSdlGraphicsManager::setPalette: _screen == NULL");
const byte *b = colors;
uint i;
@@ -1433,7 +1433,7 @@ void SdlGraphicsManager::setPalette(const byte *colors, uint start, uint num) {
blitCursor();
}
-void SdlGraphicsManager::grabPalette(byte *colors, uint start, uint num) {
+void SurfaceSdlGraphicsManager::grabPalette(byte *colors, uint start, uint num) {
assert(colors);
#ifdef USE_RGB_COLOR
@@ -1449,7 +1449,7 @@ void SdlGraphicsManager::grabPalette(byte *colors, uint start, uint num) {
}
}
-void SdlGraphicsManager::setCursorPalette(const byte *colors, uint start, uint num) {
+void SurfaceSdlGraphicsManager::setCursorPalette(const byte *colors, uint start, uint num) {
assert(colors);
const byte *b = colors;
uint i;
@@ -1464,13 +1464,13 @@ void SdlGraphicsManager::setCursorPalette(const byte *colors, uint start, uint n
blitCursor();
}
-void SdlGraphicsManager::setShakePos(int shake_pos) {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::setShakePos(int shake_pos) {
+ assert(_transactionMode == kTransactionNone);
_newShakePos = shake_pos;
}
-void SdlGraphicsManager::setFocusRectangle(const Common::Rect &rect) {
+void SurfaceSdlGraphicsManager::setFocusRectangle(const Common::Rect &rect) {
#ifdef USE_SDL_DEBUG_FOCUSRECT
// Only enable focus rectangle debug code, when the user wants it
if (!_enableFocusRectDebugCode)
@@ -1480,7 +1480,7 @@ void SdlGraphicsManager::setFocusRectangle(const Common::Rect &rect) {
_focusRect = rect;
if (rect.left < 0 || rect.top < 0 || rect.right > _videoMode.screenWidth || rect.bottom > _videoMode.screenHeight)
- warning("SdlGraphicsManager::setFocusRectangle: Got a rect which does not fit inside the screen bounds: %d,%d,%d,%d", rect.left, rect.top, rect.right, rect.bottom);
+ warning("SurfaceSdlGraphicsManager::setFocusRectangle: Got a rect which does not fit inside the screen bounds: %d,%d,%d,%d", rect.left, rect.top, rect.right, rect.bottom);
// It's gross but we actually sometimes get rects, which are not inside the screen bounds,
// thus we need to clip the rect here...
@@ -1492,7 +1492,7 @@ void SdlGraphicsManager::setFocusRectangle(const Common::Rect &rect) {
#endif
}
-void SdlGraphicsManager::clearFocusRectangle() {
+void SurfaceSdlGraphicsManager::clearFocusRectangle() {
#ifdef USE_SDL_DEBUG_FOCUSRECT
// Only enable focus rectangle debug code, when the user wants it
if (!_enableFocusRectDebugCode)
@@ -1510,8 +1510,8 @@ void SdlGraphicsManager::clearFocusRectangle() {
#pragma mark --- Overlays ---
#pragma mark -
-void SdlGraphicsManager::showOverlay() {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::showOverlay() {
+ assert(_transactionMode == kTransactionNone);
int x, y;
@@ -1533,8 +1533,8 @@ void SdlGraphicsManager::showOverlay() {
clearOverlay();
}
-void SdlGraphicsManager::hideOverlay() {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::hideOverlay() {
+ assert(_transactionMode == kTransactionNone);
if (!_overlayVisible)
return;
@@ -1557,8 +1557,8 @@ void SdlGraphicsManager::hideOverlay() {
_forceFull = true;
}
-void SdlGraphicsManager::clearOverlay() {
- //assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::clearOverlay() {
+ //assert(_transactionMode == kTransactionNone);
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
@@ -1590,8 +1590,8 @@ void SdlGraphicsManager::clearOverlay() {
_forceFull = true;
}
-void SdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
+ assert(_transactionMode == kTransactionNone);
if (_overlayscreen == NULL)
return;
@@ -1610,8 +1610,8 @@ void SdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
SDL_UnlockSurface(_overlayscreen);
}
-void SdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+ assert(_transactionMode == kTransactionNone);
if (_overlayscreen == NULL)
return;
@@ -1660,7 +1660,7 @@ void SdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, i
#pragma mark --- Mouse ---
#pragma mark -
-bool SdlGraphicsManager::showMouse(bool visible) {
+bool SurfaceSdlGraphicsManager::showMouse(bool visible) {
if (_mouseVisible == visible)
return visible;
@@ -1671,7 +1671,7 @@ bool SdlGraphicsManager::showMouse(bool visible) {
return last;
}
-void SdlGraphicsManager::setMousePos(int x, int y) {
+void SurfaceSdlGraphicsManager::setMousePos(int x, int y) {
if (x != _mouseCurState.x || y != _mouseCurState.y) {
_mouseNeedsRedraw = true;
_mouseCurState.x = x;
@@ -1679,7 +1679,7 @@ void SdlGraphicsManager::setMousePos(int x, int y) {
}
}
-void SdlGraphicsManager::warpMouse(int x, int y) {
+void SurfaceSdlGraphicsManager::warpMouse(int x, int y) {
int y1 = y;
// Don't change actual mouse position, when mouse is outside of our window (in case of windowed mode)
@@ -1708,7 +1708,7 @@ void SdlGraphicsManager::warpMouse(int x, int y) {
}
}
-void SdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
+void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
#ifdef USE_RGB_COLOR
if (!format)
_cursorFormat = Graphics::PixelFormat::createFormatCLUT8();
@@ -1765,7 +1765,7 @@ void SdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hot
blitCursor();
}
-void SdlGraphicsManager::blitCursor() {
+void SurfaceSdlGraphicsManager::blitCursor() {
byte *dstPtr;
const byte *srcPtr = _mouseData;
#ifdef USE_RGB_COLOR
@@ -1956,7 +1956,7 @@ static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height
}
#endif
-void SdlGraphicsManager::undrawMouse() {
+void SurfaceSdlGraphicsManager::undrawMouse() {
const int x = _mouseBackup.x;
const int y = _mouseBackup.y;
@@ -1969,7 +1969,7 @@ void SdlGraphicsManager::undrawMouse() {
addDirtyRect(x, y - _currentShakePos, _mouseBackup.w, _mouseBackup.h);
}
-void SdlGraphicsManager::drawMouse() {
+void SurfaceSdlGraphicsManager::drawMouse() {
if (!_mouseVisible || !_mouseSurface) {
_mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
return;
@@ -2036,8 +2036,8 @@ void SdlGraphicsManager::drawMouse() {
#pragma mark -
#ifdef USE_OSD
-void SdlGraphicsManager::displayMessageOnOSD(const char *msg) {
- assert (_transactionMode == kTransactionNone);
+void SurfaceSdlGraphicsManager::displayMessageOnOSD(const char *msg) {
+ assert(_transactionMode == kTransactionNone);
assert(msg);
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
@@ -2123,7 +2123,7 @@ void SdlGraphicsManager::displayMessageOnOSD(const char *msg) {
}
#endif
-bool SdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
+bool SurfaceSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
// Ctrl-Alt-a toggles aspect ratio correction
if (key == 'a') {
@@ -2212,7 +2212,7 @@ bool SdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
}
}
-bool SdlGraphicsManager::isScalerHotkey(const Common::Event &event) {
+bool SurfaceSdlGraphicsManager::isScalerHotkey(const Common::Event &event) {
if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
const bool isNormalNumber = (Common::KEYCODE_1 <= event.kbd.keycode && event.kbd.keycode <= Common::KEYCODE_9);
const bool isKeypadNumber = (Common::KEYCODE_KP1 <= event.kbd.keycode && event.kbd.keycode <= Common::KEYCODE_KP9);
@@ -2229,7 +2229,7 @@ bool SdlGraphicsManager::isScalerHotkey(const Common::Event &event) {
return false;
}
-void SdlGraphicsManager::adjustMouseEvent(const Common::Event &event) {
+void SurfaceSdlGraphicsManager::adjustMouseEvent(const Common::Event &event) {
if (!event.synthetic) {
Common::Event newEvent(event);
newEvent.synthetic = true;
@@ -2243,7 +2243,7 @@ void SdlGraphicsManager::adjustMouseEvent(const Common::Event &event) {
}
}
-void SdlGraphicsManager::toggleFullScreen() {
+void SurfaceSdlGraphicsManager::toggleFullScreen() {
beginGFXTransaction();
setFullscreenMode(!_videoMode.fullscreen);
endGFXTransaction();
@@ -2255,7 +2255,7 @@ void SdlGraphicsManager::toggleFullScreen() {
#endif
}
-bool SdlGraphicsManager::notifyEvent(const Common::Event &event) {
+bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) {
switch ((int)event.type) {
case Common::EVENT_KEYDOWN:
// Alt-Return and Alt-Enter toggle full screen mode
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 9627ab23a3..cd8710d443 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef BACKENDS_GRAPHICS_SDL_H
-#define BACKENDS_GRAPHICS_SDL_H
+#ifndef BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H
+#define BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H
#include "backends/graphics/graphics.h"
#include "graphics/pixelformat.h"
@@ -74,10 +74,10 @@ public:
/**
* SDL graphics manager
*/
-class SdlGraphicsManager : public GraphicsManager, public Common::EventObserver {
+class SurfaceSdlGraphicsManager : public GraphicsManager, public Common::EventObserver {
public:
- SdlGraphicsManager(SdlEventSource *sdlEventSource);
- virtual ~SdlGraphicsManager();
+ SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource);
+ virtual ~SurfaceSdlGraphicsManager();
virtual void initEventObserver();
@@ -100,7 +100,7 @@ public:
virtual void beginGFXTransaction();
virtual OSystem::TransactionError endGFXTransaction();
-
+
virtual int16 getHeight();
virtual int16 getWidth();
@@ -132,7 +132,7 @@ public:
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
-
+
#ifdef USE_OSD
virtual void displayMessageOnOSD(const char *msg);
#endif
@@ -149,7 +149,7 @@ protected:
/** Transparency level of the OSD */
uint8 _osdAlpha;
/** When to start the fade out */
- uint32 _osdFadeStartTime;
+ uint32 _osdFadeStartTime;
/** Enum with OSD options */
enum {
kOSDFadeOutDelay = 2 * 1000, /** < Delay before the OSD is faded out (in milliseconds) */
diff --git a/backends/graphics/symbiansdl/symbiansdl-graphics.cpp b/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
index a88c8a8ffe..4a9a219641 100644
--- a/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
+++ b/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
@@ -28,7 +28,7 @@
#include "backends/platform/symbian/src/SymbianActions.h"
SymbianSdlGraphicsManager::SymbianSdlGraphicsManager(SdlEventSource *sdlEventSource)
- : SdlGraphicsManager(sdlEventSource) {
+ : SurfaceSdlGraphicsManager(sdlEventSource) {
}
int SymbianSdlGraphicsManager::getDefaultGraphicsMode() const {
@@ -47,7 +47,7 @@ const OSystem::GraphicsMode *SymbianSdlGraphicsManager::getSupportedGraphicsMode
// make sure we always go to normal, even if the string might be set wrong!
bool SymbianSdlGraphicsManager::setGraphicsMode(int /*name*/) {
// let parent OSystem_SDL handle it
- return SdlGraphicsManager::setGraphicsMode(getDefaultGraphicsMode());
+ return SurfaceSdlGraphicsManager::setGraphicsMode(getDefaultGraphicsMode());
}
bool SymbianSdlGraphicsManager::hasFeature(OSystem::Feature f) {
@@ -72,7 +72,7 @@ void SymbianSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable)
GUI::Actions::Instance()->beginMapping(enable);
break;
default:
- SdlGraphicsManager::setFeatureState(f, enable);
+ SurfaceSdlGraphicsManager::setFeatureState(f, enable);
}
}
diff --git a/backends/graphics/symbiansdl/symbiansdl-graphics.h b/backends/graphics/symbiansdl/symbiansdl-graphics.h
index 1bad32a9b6..404ca87a0a 100644
--- a/backends/graphics/symbiansdl/symbiansdl-graphics.h
+++ b/backends/graphics/symbiansdl/symbiansdl-graphics.h
@@ -23,9 +23,9 @@
#ifndef BACKENDS_GRAPHICS_SYMBIAN_SDL_H
#define BACKENDS_GRAPHICS_SYMBIAN_SDL_H
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
-class SymbianSdlGraphicsManager : public SdlGraphicsManager {
+class SymbianSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
SymbianSdlGraphicsManager(SdlEventSource *sdlEventSource);
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index 80b04ca56d..2ca78cedde 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.cpp
+++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp
@@ -43,14 +43,14 @@
#include "backends/platform/wince/CEgui/ItemAction.h"
WINCESdlGraphicsManager::WINCESdlGraphicsManager(SdlEventSource *sdlEventSource)
- : SdlGraphicsManager(sdlEventSource),
- _panelInitialized(false), _noDoubleTapRMB(false),
+ : SurfaceSdlGraphicsManager(sdlEventSource),
+ _panelInitialized(false), _noDoubleTapRMB(false), _noDoubleTapPT(false),
_toolbarHighDrawn(false), _newOrientation(0), _orientationLandscape(0),
_panelVisible(true), _saveActiveToolbar(NAME_MAIN_PANEL), _panelStateForced(false),
_canBeAspectScaled(false), _scalersChanged(false), _saveToolbarState(false),
_mouseBackupOld(NULL), _mouseBackupDim(0), _mouseBackupToolbar(NULL),
- _usesEmulatedMouse(false), _forceHideMouse(false), _hasfocus(true),
- _zoomUp(false), _zoomDown(false) {
+ _usesEmulatedMouse(false), _forceHideMouse(false), _freeLook(false),
+ _hasfocus(true), _zoomUp(false), _zoomDown(false) {
memset(&_mouseCurState, 0, sizeof(_mouseCurState));
if (_isSmartphone) {
_mouseCurState.x = 20;
@@ -149,7 +149,7 @@ void WINCESdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
return;
default:
- SdlGraphicsManager::setFeatureState(f, enable);
+ SurfaceSdlGraphicsManager::setFeatureState(f, enable);
}
}
@@ -160,7 +160,7 @@ bool WINCESdlGraphicsManager::getFeatureState(OSystem::Feature f) {
case OSystem::kFeatureVirtualKeyboard:
return (_panelStateForced);
default:
- return SdlGraphicsManager::getFeatureState(f);
+ return SurfaceSdlGraphicsManager::getFeatureState(f);
}
}
@@ -204,7 +204,7 @@ void WINCESdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelForm
_videoMode.overlayWidth = w;
_videoMode.overlayHeight = h;
- SdlGraphicsManager::initSize(w, h, format);
+ SurfaceSdlGraphicsManager::initSize(w, h, format);
if (_scalersChanged) {
unloadGFXMode();
@@ -444,7 +444,6 @@ void WINCESdlGraphicsManager::update_game_settings() {
// Skip
panel->add(NAME_ITEM_SKIP, new CEGUI::ItemAction(ITEM_SKIP, POCKET_ACTION_SKIP));
// sound
-//__XXX__ panel->add(NAME_ITEM_SOUND, new CEGUI::ItemSwitch(ITEM_SOUND_OFF, ITEM_SOUND_ON, &_soundMaster));
panel->add(NAME_ITEM_SOUND, new CEGUI::ItemSwitch(ITEM_SOUND_OFF, ITEM_SOUND_ON, &OSystem_WINCE3::_soundMaster));
// bind keys
@@ -479,6 +478,9 @@ void WINCESdlGraphicsManager::update_game_settings() {
if (ConfMan.hasKey("no_doubletap_rightclick"))
_noDoubleTapRMB = ConfMan.getBool("no_doubletap_rightclick");
+
+ if (ConfMan.hasKey("no_doubletap_paneltoggle"))
+ _noDoubleTapPT = ConfMan.getBool("no_doubletap_paneltoggle");
}
void WINCESdlGraphicsManager::internUpdateScreen() {
@@ -1186,7 +1188,7 @@ void WINCESdlGraphicsManager::setMousePos(int x, int y) {
Graphics::Surface *WINCESdlGraphicsManager::lockScreen() {
// Make sure mouse pointer is not painted over the playfield at the time of locking
undrawMouse();
- return SdlGraphicsManager::lockScreen();
+ return SurfaceSdlGraphicsManager::lockScreen();
}
void WINCESdlGraphicsManager::showOverlay() {
@@ -1294,7 +1296,7 @@ void WINCESdlGraphicsManager::warpMouse(int x, int y) {
}
void WINCESdlGraphicsManager::unlockScreen() {
- SdlGraphicsManager::unlockScreen();
+ SurfaceSdlGraphicsManager::unlockScreen();
}
void WINCESdlGraphicsManager::internDrawMouse() {
@@ -1469,7 +1471,7 @@ void WINCESdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool mous
if (_forceFull || _paletteDirtyEnd)
return;
- SdlGraphicsManager::addDirtyRect(x, y, w, h, false);
+ SurfaceSdlGraphicsManager::addDirtyRect(x, y, w, h, false);
}
void WINCESdlGraphicsManager::swap_panel_visibility() {
@@ -1600,6 +1602,19 @@ void WINCESdlGraphicsManager::swap_mouse_visibility() {
undrawMouse();
}
+void WINCESdlGraphicsManager::init_panel() {
+ _panelVisible = true;
+ if (_panelInitialized) {
+ _toolbarHandler.setVisible(true);
+ _toolbarHandler.setActive(NAME_MAIN_PANEL);
+ }
+}
+
+void WINCESdlGraphicsManager::reset_panel() {
+ _panelVisible = false;
+ _toolbarHandler.setVisible(false);
+}
+
// Smartphone actions
void WINCESdlGraphicsManager::initZones() {
int i;
@@ -1627,6 +1642,14 @@ void WINCESdlGraphicsManager::create_toolbar() {
_toolbarHandler.setVisible(false);
}
+void WINCESdlGraphicsManager::swap_freeLook() {
+ _freeLook = !_freeLook;
+}
+
+bool WINCESdlGraphicsManager::getFreeLookState() {
+ return _freeLook;
+}
+
WINCESdlGraphicsManager::zoneDesc WINCESdlGraphicsManager::_zones[TOTAL_ZONES] = {
{ 0, 0, 320, 145 },
{ 0, 145, 150, 55 },
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.h b/backends/graphics/wincesdl/wincesdl-graphics.h
index b3a8d66f51..92894e0dcd 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.h
+++ b/backends/graphics/wincesdl/wincesdl-graphics.h
@@ -23,7 +23,7 @@
#ifndef BACKENDS_GRAPHICS_WINCE_SDL_H
#define BACKENDS_GRAPHICS_WINCE_SDL_H
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
#include "backends/platform/wince/CEgui/CEGUI.h"
// Internal GUI names
@@ -39,7 +39,7 @@
extern bool _hasSmartphoneResolution;
-class WINCESdlGraphicsManager : public SdlGraphicsManager {
+class WINCESdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
WINCESdlGraphicsManager(SdlEventSource *sdlEventSource);
@@ -56,6 +56,8 @@ public:
void unloadGFXMode();
bool hotswapGFXMode();
+ void update_game_settings();
+
// Overloaded from SDL backend (toolbar handling)
void drawMouse();
// Overloaded from SDL backend (new scaler handling)
@@ -88,7 +90,10 @@ public:
void swap_zoom_up();
void swap_zoom_down();
void swap_mouse_visibility();
-
+ void init_panel();
+ void reset_panel();
+ void swap_freeLook();
+ bool getFreeLookState();
//#ifdef WIN32_PLATFORM_WFSP
void move_cursor_up();
@@ -96,7 +101,6 @@ public:
void move_cursor_left();
void move_cursor_right();
- void retrieve_mouse_location(int &x, int &y);
void switch_zone();
void add_right_click(bool pushed);
@@ -106,8 +110,14 @@ public:
void smartphone_rotate_display();
//#endif
+ bool hasPocketPCResolution();
+ bool hasDesktopResolution();
+ bool hasSquareQVGAResolution();
+ bool hasWideResolution() const;
+
bool _panelInitialized; // only initialize the toolbar once
bool _noDoubleTapRMB; // disable double tap -> rmb click
+ bool _noDoubleTapPT; // disable double tap for toolbar toggling
CEGUI::ToolbarHandler _toolbarHandler;
@@ -122,11 +132,6 @@ public:
bool _hasfocus; // scummvm has the top window
- bool hasPocketPCResolution();
- bool hasDesktopResolution();
- bool hasSquareQVGAResolution();
- bool hasWideResolution() const;
-
MousePos _mouseCurState;
bool _zoomUp; // zooming up mode
@@ -158,8 +163,8 @@ protected:
private:
bool update_scalers();
- void update_game_settings();
void drawToolbarMouse(SDL_Surface *surf, bool draw);
+ void retrieve_mouse_location(int &x, int &y);
void create_toolbar();
bool _panelVisible; // panel visibility
@@ -186,6 +191,7 @@ private:
uint16 _mouseBackupDim;
bool _forceHideMouse; // force invisible mouse cursor
+ bool _freeLook; // freeLook mode (do not send mouse button events)
// Smartphone specific variables
void loadDeviceConfigurationElement(Common::String element, int &value, int defaultValue);
diff --git a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp
index 526a01d1bf..3e5b9940e0 100644
--- a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp
+++ b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp
@@ -28,7 +28,7 @@ DoubleBufferSDLMixerManager::DoubleBufferSDLMixerManager()
:
_soundMutex(0), _soundCond(0), _soundThread(0),
_soundThreadIsRunning(false), _soundThreadShouldQuit(false) {
-
+
}
DoubleBufferSDLMixerManager::~DoubleBufferSDLMixerManager() {
@@ -45,7 +45,7 @@ void DoubleBufferSDLMixerManager::startAudio() {
// Create two sound buffers
_activeSoundBuf = 0;
- uint bufSize = _obtainedRate.samples * 4;
+ uint bufSize = _obtained.samples * 4;
_soundBufSize = bufSize;
_soundBuffers[0] = (byte *)calloc(1, bufSize);
_soundBuffers[1] = (byte *)calloc(1, bufSize);
diff --git a/backends/mixer/sdl/sdl-mixer.cpp b/backends/mixer/sdl/sdl-mixer.cpp
index 16e7f22db5..001309a777 100644
--- a/backends/mixer/sdl/sdl-mixer.cpp
+++ b/backends/mixer/sdl/sdl-mixer.cpp
@@ -61,18 +61,38 @@ void SdlMixerManager::init() {
// Get the desired audio specs
SDL_AudioSpec desired = getAudioSpec(SAMPLES_PER_SEC);
+ // Needed as SDL_OpenAudio as of SDL-1.2.14 mutates fields in
+ // "desired" if used directly.
+ SDL_AudioSpec fmt = desired;
+
// Start SDL audio with the desired specs
- if (SDL_OpenAudio(&desired, &_obtainedRate) != 0) {
+ if (SDL_OpenAudio(&fmt, &_obtained) != 0) {
warning("Could not open audio device: %s", SDL_GetError());
_mixer = new Audio::MixerImpl(g_system, desired.freq);
- assert(_mixer);
+ assert(_mixer);
_mixer->setReady(false);
} else {
- debug(1, "Output sample rate: %d Hz", _obtainedRate.freq);
+ 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);
+
+ 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);
+
+ if (_obtained.format != desired.format)
+ warning("SDL mixer sound format: %d differs from desired: %d", _obtained.format, desired.format);
+
+#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");
+#endif
- _mixer = new Audio::MixerImpl(g_system, _obtainedRate.freq);
- assert(_mixer);
+ _mixer = new Audio::MixerImpl(g_system, _obtained.freq);
+ assert(_mixer);
_mixer->setReady(true);
startAudio();
@@ -133,7 +153,7 @@ void SdlMixerManager::suspendAudio() {
int SdlMixerManager::resumeAudio() {
if (!_audioSuspended)
return -2;
- if (SDL_OpenAudio(&_obtainedRate, NULL) < 0){
+ if (SDL_OpenAudio(&_obtained, NULL) < 0){
return -1;
}
SDL_PauseAudio(0);
diff --git a/backends/mixer/sdl/sdl-mixer.h b/backends/mixer/sdl/sdl-mixer.h
index 5590c90ab3..6fee26bd1f 100644
--- a/backends/mixer/sdl/sdl-mixer.h
+++ b/backends/mixer/sdl/sdl-mixer.h
@@ -67,13 +67,13 @@ protected:
* The obtained audio specification after opening the
* audio system.
*/
- SDL_AudioSpec _obtainedRate;
+ SDL_AudioSpec _obtained;
/** State of the audio system */
bool _audioSuspended;
/**
- * Returns the desired audio specification
+ * Returns the desired audio specification
*/
virtual SDL_AudioSpec getAudioSpec(uint32 rate);
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/mixer/symbiansdl/symbiansdl-mixer.cpp b/backends/mixer/symbiansdl/symbiansdl-mixer.cpp
index b2462a1cdf..c911a99b61 100644
--- a/backends/mixer/symbiansdl/symbiansdl-mixer.cpp
+++ b/backends/mixer/symbiansdl/symbiansdl-mixer.cpp
@@ -43,8 +43,8 @@ SymbianSdlMixerManager::~SymbianSdlMixerManager() {
void SymbianSdlMixerManager::startAudio() {
// Need to create mixbuffer for stereo mix to downmix
- if (_obtainedRate.channels != 2) {
- _stereoMixBuffer = new byte [_obtainedRate.size * 2]; // * 2 for stereo values
+ if (_obtained.channels != 2) {
+ _stereoMixBuffer = new byte [_obtained.size * 2]; // * 2 for stereo values
}
SdlMixerManager::startAudio();
@@ -54,7 +54,7 @@ void SymbianSdlMixerManager::callbackHandler(byte *samples, int len) {
assert(_mixer);
#if defined (S60) && !defined(S60V3)
// If not stereo then we need to downmix
- if (_obtainedRate.channels != 2) {
+ if (_obtained.channels != 2) {
_mixer->mixCallback(_stereoMixBuffer, len * 2);
int16 *bitmixDst = (int16 *)samples;
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index bbf6a6c1ed..525170d685 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -24,20 +24,14 @@
#include "backends/modular-backend.h"
-#include "backends/fs/fs-factory.h"
#include "backends/graphics/graphics.h"
#include "backends/mutex/mutex.h"
#include "audio/mixer.h"
-#include "common/events.h"
-#include "gui/message.h"
#include "graphics/pixelformat.h"
ModularBackend::ModularBackend()
:
- _fsFactory(0),
- _savefileManager(0),
- _timerManager(0),
_mutexManager(0),
_graphicsManager(0),
_mixer(0) {
@@ -45,16 +39,10 @@ ModularBackend::ModularBackend()
}
ModularBackend::~ModularBackend() {
- delete _fsFactory;
- _fsFactory = 0;
delete _graphicsManager;
_graphicsManager = 0;
delete _mixer;
_mixer = 0;
- delete _savefileManager;
- _savefileManager = 0;
- delete _timerManager;
- _timerManager = 0;
delete _mutexManager;
_mutexManager = 0;
}
@@ -215,11 +203,6 @@ void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num)
_graphicsManager->setCursorPalette(colors, start, num);
}
-Common::TimerManager *ModularBackend::getTimerManager() {
- assert(_timerManager);
- return _timerManager;
-}
-
OSystem::MutexRef ModularBackend::createMutex() {
assert(_mutexManager);
return _mutexManager->createMutex();
@@ -249,16 +232,6 @@ void ModularBackend::displayMessageOnOSD(const char *msg) {
_graphicsManager->displayMessageOnOSD(msg);
}
-Common::SaveFileManager *ModularBackend::getSavefileManager() {
- assert(_savefileManager);
- return _savefileManager;
-}
-
-FilesystemFactory *ModularBackend::getFilesystemFactory() {
- assert(_fsFactory);
- return _fsFactory;
-}
-
void ModularBackend::quit() {
exit(0);
}
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 42bd0ed73a..b864da0df5 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -23,30 +23,28 @@
#ifndef BACKENDS_MODULAR_BACKEND_H
#define BACKENDS_MODULAR_BACKEND_H
-#include "common/system.h"
-#include "common/timer.h"
-#include "common/savefile.h"
+#include "backends/base-backend.h"
class GraphicsManager;
class MutexManager;
/**
* Base class for modular backends.
- *
+ *
* It wraps most functions to their manager equivalent, but not
* all OSystem functions are implemented here.
- *
+ *
* A backend derivated from this class, will need to implement
* these functions on its own:
* OSystem::pollEvent()
* OSystem::getMillis()
* OSystem::delayMillis()
* OSystem::getTimeAndDate()
- *
+ *
* And, it should also initialize all the managers variables
* declared in this class, or override their related functions.
*/
-class ModularBackend : public OSystem {
+class ModularBackend : public BaseBackend {
public:
ModularBackend();
virtual ~ModularBackend();
@@ -109,12 +107,11 @@ public:
/** @name Events and Time */
//@{
-
- virtual Common::TimerManager *getTimerManager();
+
virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; }
//@}
-
+
/** @name Mutex handling */
//@{
@@ -135,8 +132,6 @@ public:
/** @name Miscellaneous */
//@{
- virtual Common::SaveFileManager *getSavefileManager();
- virtual FilesystemFactory *getFilesystemFactory();
virtual void quit();
virtual void displayMessageOnOSD(const char *msg);
@@ -146,9 +141,6 @@ protected:
/** @name Managers variables */
//@{
- FilesystemFactory *_fsFactory;
- Common::SaveFileManager *_savefileManager;
- Common::TimerManager *_timerManager;
MutexManager *_mutexManager;
GraphicsManager *_graphicsManager;
Audio::Mixer *_mixer;
diff --git a/backends/module.mk b/backends/module.mk
index 27058bef88..63774cc4d0 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -60,14 +60,19 @@ 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/sdl/sdl-graphics.o \
+ graphics/surfacesdl/surfacesdl-graphics.o \
mixer/doublebuffersdl/doublebuffersdl-mixer.o \
mixer/sdl/sdl-mixer.o \
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
@@ -75,7 +80,8 @@ MODULE_OBJS += \
fs/posix/posix-fs.o \
fs/posix/posix-fs-factory.o \
plugins/posix/posix-provider.o \
- saves/posix/posix-saves.o
+ saves/posix/posix-saves.o \
+ taskbar/unity/unity-taskbar.o
endif
ifdef MACOSX
@@ -89,7 +95,8 @@ MODULE_OBJS += \
fs/windows/windows-fs.o \
fs/windows/windows-fs-factory.o \
midi/windows.o \
- plugins/win32/win32-provider.o
+ plugins/win32/win32-provider.o \
+ taskbar/win32/win32-taskbar.o
endif
ifdef AMIGAOS
@@ -99,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 \
@@ -118,14 +134,6 @@ MODULE_OBJS += \
graphics/gph/gph-graphics.o
endif
-# TODO/FIXME: The gp2xsdl files are only compiled if GP2X_OLD is defined,
-# which currently is never the case (unless the user manually requests it).
-# ifeq ($(BACKEND),gp2x)
-# MODULE_OBJS += \
-# events/gp2xsdl/gp2xsdl-events.o \
-# graphics/gp2xsdl/gp2xsdl-graphics.o
-# endif
-
ifeq ($(BACKEND),linuxmoto)
MODULE_OBJS += \
events/linuxmotosdl/linuxmotosdl-events.o \
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index a67ee51b4d..17c7d4f9cb 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -132,10 +132,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_show_mouse(false),
_show_overlay(false),
_enable_zoning(false),
- _savefile(0),
_mixer(0),
- _timer(0),
- _fsFactory(new POSIXFilesystemFactory()),
_shake_offset(0),
_event_queue_lock(createMutex()),
_touch_pt_down(),
@@ -149,6 +146,9 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_dpad_scale(4),
_fingersDown(0),
_trackball_scale(2) {
+
+ _fsFactory = new POSIXFilesystemFactory();
+
Common::String mf = getSystemProperty("ro.product.manufacturer");
LOGI("Running on: [%s] [%s] [%s] [%s] [%s] SDK:%s ABI:%s",
@@ -170,17 +170,17 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
OSystem_Android::~OSystem_Android() {
ENTER();
- delete _savefile;
- delete _timer;
delete _mixer;
+ _mixer = 0;
delete _fsFactory;
+ _fsFactory = 0;
deleteMutex(_event_queue_lock);
}
void *OSystem_Android::timerThreadFunc(void *arg) {
OSystem_Android *system = (OSystem_Android *)arg;
- DefaultTimerManager *timer = (DefaultTimerManager *)(system->_timer);
+ DefaultTimerManager *timer = (DefaultTimerManager *)(system->_timerManager);
// renice this thread to boost the audio thread
if (setpriority(PRIO_PROCESS, 0, 19) < 0)
@@ -359,8 +359,8 @@ void OSystem_Android::initBackend() {
// BUG: "transient" ConfMan settings get nuked by the options
// screen. Passing the savepath in this way makes it stick
// (via ConfMan.registerDefault)
- _savefile = new DefaultSaveFileManager(ConfMan.get("savepath"));
- _timer = new DefaultTimerManager();
+ _savefileManager = new DefaultSaveFileManager(ConfMan.get("savepath"));
+ _timerManager = new DefaultTimerManager();
gettimeofday(&_startTime, 0);
@@ -389,7 +389,7 @@ void OSystem_Android::initBackend() {
JNI::setReadyForEvents(true);
- BaseBackend::initBackend();
+ EventsBaseBackend::initBackend();
}
void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {
@@ -423,7 +423,7 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) {
showVirtualKeyboard(enable);
break;
case kFeatureCursorPalette:
- _use_mouse_palette = !enable;
+ _use_mouse_palette = enable;
if (!enable)
disableCursorPalette();
break;
@@ -535,21 +535,11 @@ void OSystem_Android::showVirtualKeyboard(bool enable) {
JNI::showVirtualKeyboard(enable);
}
-Common::SaveFileManager *OSystem_Android::getSavefileManager() {
- assert(_savefile);
- return _savefile;
-}
-
Audio::Mixer *OSystem_Android::getMixer() {
assert(_mixer);
return _mixer;
}
-Common::TimerManager *OSystem_Android::getTimerManager() {
- assert(_timer);
- return _timer;
-}
-
void OSystem_Android::getTimeAndDate(TimeDate &td) const {
struct tm tm;
const time_t curTime = time(0);
@@ -563,10 +553,6 @@ void OSystem_Android::getTimeAndDate(TimeDate &td) const {
td.tm_year = tm.tm_year;
}
-FilesystemFactory *OSystem_Android::getFilesystemFactory() {
- return _fsFactory;
-}
-
void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,
int priority) {
ENTER("");
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index b70fdb7c30..c2ada2ab77 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -103,7 +103,7 @@ protected:
};
#endif
-class OSystem_Android : public BaseBackend, public PaletteManager {
+class OSystem_Android : public EventsBaseBackend, public PaletteManager {
private:
// passed from the dark side
int _audio_sample_rate;
@@ -152,10 +152,7 @@ private:
bool _enable_zoning;
bool _virtkeybd_on;
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- Common::TimerManager *_timer;
- FilesystemFactory *_fsFactory;
timeval _startTime;
Common::String getSystemProperty(const char *name) const;
@@ -289,11 +286,8 @@ public:
virtual void displayMessageOnOSD(const char *msg);
virtual void showVirtualKeyboard(bool enable);
- virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
virtual void getTimeAndDate(TimeDate &t) const;
- virtual Common::TimerManager *getTimerManager();
- virtual FilesystemFactory *getFilesystemFactory();
virtual void logMessage(LogMessageType::Type type, const char *message);
virtual void addSysArchivesToSearchSet(Common::SearchSet &s,
int priority = 0);
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index c4daf24e16..e3b4ef7401 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -22,8 +22,9 @@
#if defined(__ANDROID__)
-// Allow use of stuff in <time.h>
+// Allow use of stuff in <time.h> and abort()
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#define FORBIDDEN_SYMBOL_EXCEPTION_abort
// Disable printf override in common/forbidden.h to avoid
// clashes with log.h from the Android SDK.
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index c7659e8292..bde50daa2d 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -70,7 +70,7 @@ class DCCDManager : public DefaultAudioCDManager {
void updateCD();
};
-class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory
+class OSystem_Dreamcast : private DCHardware, public EventsBaseBackend, public PaletteManager, public FilesystemFactory
#ifdef DYNAMIC_MODULES
, public FilePluginProvider
#endif
@@ -185,24 +185,19 @@ public:
void setWindowCaption(const char *caption);
// Modulatized backend
- Common::SaveFileManager *getSavefileManager() { return _savefile; }
Audio::Mixer *getMixer() { return _mixer; }
- Common::TimerManager *getTimerManager() { return _timer; }
// Extra SoftKbd support
void mouseToSoftKbd(int x, int y, int &rx, int &ry) const;
// Filesystem
- FilesystemFactory *getFilesystemFactory() { return this; }
AbstractFSNode *makeRootFileNode() const;
AbstractFSNode *makeCurrentDirectoryFileNode() const;
AbstractFSNode *makeFileNodePath(const Common::String &path) const;
private:
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
SoftKeyboard _softkbd;
int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y;
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index 47bfb0c15d..06738a687d 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -41,20 +41,21 @@ const char *gGameName;
OSystem_Dreamcast::OSystem_Dreamcast()
: _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this),
- _ms_buf(NULL), _timer(NULL), _mixer(NULL), _savefile(NULL),
+ _ms_buf(NULL), _mixer(NULL),
_current_shake_pos(0), _aspect_stretch(false), _softkbd_on(false),
_softkbd_motion(0), _enable_cursor_palette(false), _screenFormat(0)
{
memset(screen_tx, 0, sizeof(screen_tx));
memset(mouse_tx, 0, sizeof(mouse_tx));
memset(ovl_tx, 0, sizeof(ovl_tx));
+ _fsFactory = this;
}
void OSystem_Dreamcast::initBackend()
{
ConfMan.setInt("autosave_period", 0);
- _savefile = createSavefileManager();
- _timer = new DefaultTimerManager();
+ _savefileManager = createSavefileManager();
+ _timerManager = new DefaultTimerManager();
uint sampleRate = initSound();
_mixer = new Audio::MixerImpl(this, sampleRate);
@@ -62,7 +63,7 @@ void OSystem_Dreamcast::initBackend()
_audiocdManager = new DCCDManager();
- BaseBackend::initBackend();
+ EventsBaseBackend::initBackend();
}
@@ -233,7 +234,7 @@ void OSystem_Dreamcast::logMessage(LogMessageType::Type type, const char *messag
namespace DC_Flash {
static int syscall_info_flash(int sect, int *info)
{
- return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0);
+ return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0);
}
static int syscall_read_flash(int offs, void *buf, int cnt)
@@ -254,24 +255,24 @@ namespace DC_Flash {
}
return (unsigned short)~n;
}
-
+
static int flash_read_sector(int partition, int sec, unsigned char *dst)
{
int s, r, n, b, bmb, got=0;
int info[2];
char buf[64];
char bm[64];
-
+
if((r = syscall_info_flash(partition, info))<0)
return r;
-
+
if((r = syscall_read_flash(info[0], buf, 64))<0)
return r;
-
+
if(memcmp(buf, "KATANA_FLASH", 12) ||
buf[16] != partition || buf[17] != 0)
return -2;
-
+
n = (info[1]>>6)-1-((info[1] + 0x7fff)>>15);
bmb = n+1;
for(b = 0; b < n; b++) {
diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp
index 7054ad196e..3759eec6df 100644
--- a/backends/platform/dc/input.cpp
+++ b/backends/platform/dc/input.cpp
@@ -192,8 +192,8 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event)
{
unsigned int t = Timer();
- if (_timer != NULL)
- _timer->handler();
+ if (_timerManager != NULL)
+ ((DefaultTimerManager *)_timerManager)->handler();
if (((int)(t-_devpoll))<0)
return false;
diff --git a/backends/platform/dc/plugins.cpp b/backends/platform/dc/plugins.cpp
index fff3c147ec..2942a4f155 100644
--- a/backends/platform/dc/plugins.cpp
+++ b/backends/platform/dc/plugins.cpp
@@ -51,7 +51,7 @@ static void drawPluginProgress(const Common::String &filename)
ta_begin_frame();
draw_solid_quad(80.0, 270.0, 560.0, 300.0,
0xff808080, 0xff808080, 0xff808080, 0xff808080);
- draw_solid_quad(85.0, 275.0, 555.0, 295.0,
+ draw_solid_quad(85.0, 275.0, 555.0, 295.0,
0xff202020, 0xff202020, 0xff202020, 0xff202020);
draw_solid_quad(85.0, 275.0, 85.0+470.0*ffree, 295.0,
fcol, fcol, fcol, fcol);
diff --git a/backends/platform/dc/time.cpp b/backends/platform/dc/time.cpp
index c343852321..8cc3a71e8d 100644
--- a/backends/platform/dc/time.cpp
+++ b/backends/platform/dc/time.cpp
@@ -48,8 +48,8 @@ void OSystem_Dreamcast::delayMillis(uint msecs)
unsigned int t, start = Timer();
int time = (((unsigned int)msecs)*3125U)>>6;
while (((int)((t = Timer())-start))<time) {
- if (_timer != NULL)
- _timer->handler();
+ if (_timerManager != NULL)
+ ((DefaultTimerManager *)_timerManager)->handler();
checkSound();
}
getMillis();
diff --git a/backends/platform/dingux/dingux.cpp b/backends/platform/dingux/dingux.cpp
index 1af53aeae1..674c2ea780 100644
--- a/backends/platform/dingux/dingux.cpp
+++ b/backends/platform/dingux/dingux.cpp
@@ -33,7 +33,7 @@ void OSystem_SDL_Dingux::initBackend() {
// Create the graphics manager
if (_graphicsManager == 0) {
- _graphicsManager = new DINGUXSdlGraphicsManager(_eventSource);
+ _graphicsManager = new DINGUXSdlGraphicsManager(_eventSource);
}
// Call parent implementation of this method
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp
index db9b1c2609..03729c5e6e 100644
--- a/backends/platform/ds/arm9/source/gbampsave.cpp
+++ b/backends/platform/ds/arm9/source/gbampsave.cpp
@@ -52,7 +52,7 @@ Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &f
fileSpec += filename;
// consolePrintf("Opening the file: %s\n", fileSpec.c_str());
-
+
Common::WriteStream *stream = DS::DSFileStream::makeFromPath(fileSpec, true);
// Use a write buffer
stream = Common::wrapBufferedWriteStream(stream, SAVE_BUFFER_SIZE);
@@ -66,7 +66,7 @@ Common::InSaveFile *GBAMPSaveFileManager::openForLoading(const Common::String &f
fileSpec += filename;
// consolePrintf("Opening the file: %s\n", fileSpec.c_str());
-
+
return DS::DSFileStream::makeFromPath(fileSpec, false);
}
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index eab9fd6a33..b157a3a87a 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -42,6 +42,7 @@
#include "backends/fs/ds/ds-fs-factory.h"
#include "backends/audiocd/default/default-audiocd.h"
+#include "backends/timer/default/default-timer.h"
#ifdef ENABLE_AGI
#include "wordcompletion.h"
@@ -81,7 +82,7 @@
OSystem_DS *OSystem_DS::_instance = NULL;
OSystem_DS::OSystem_DS()
- : eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _timer(NULL), _frameBufferExists(false),
+ : eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _frameBufferExists(false),
_disableCursorPalette(true), _graphicsEnable(true), _gammaValue(0)
{
// eventNum = 0;
@@ -89,13 +90,17 @@ OSystem_DS::OSystem_DS()
// queuePos = 0;
_instance = this;
// _mixer = NULL;
- // _timer = NULL;
//_frameBufferExists = false;
}
OSystem_DS::~OSystem_DS() {
delete _mixer;
- delete _timer;
+ _mixer = 0;
+
+ // If _savefileManager is not 0, then it points to the OSystem_DS
+ // member variable mpSaveManager. Hence we set _savefileManager to
+ // 0, to prevent the OSystem destructor from trying to delete it.
+ _savefileManager = 0;
}
int OSystem_DS::timerHandler(int t) {
@@ -108,7 +113,11 @@ void OSystem_DS::initBackend() {
ConfMan.setInt("autosave_period", 0);
ConfMan.setBool("FM_medium_quality", true);
- _timer = new DefaultTimerManager();
+ if (DS::isGBAMPAvailable()) {
+ _savefileManager = &mpSaveManager;
+ }
+
+ _timerManager = new DefaultTimerManager();
DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
if (ConfMan.hasKey("22khzaudio", "ds") && ConfMan.getBool("22khzaudio", "ds")) {
@@ -125,7 +134,7 @@ void OSystem_DS::initBackend() {
_audiocdManager = new DSAudioCDManager();
*/
- BaseBackend::initBackend();
+ EventsBaseBackend::initBackend();
}
bool OSystem_DS::hasFeature(Feature f) {
@@ -747,14 +756,6 @@ void OSystem_DS::quit() {
swiSoftReset();*/
}
-Common::SaveFileManager *OSystem_DS::getSavefileManager() {
- if (DS::isGBAMPAvailable()) {
- return &mpSaveManager;
- }
- return NULL;
-}
-
-
Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 1e032ba2cf..b1222a152d 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -29,13 +29,12 @@
#include "nds.h"
#include "gbampsave.h"
#include "backends/saves/default/default-saves.h"
-#include "backends/timer/default/default-timer.h"
#include "audio/mixer_intern.h"
#include "graphics/surface.h"
#include "graphics/colormasks.h"
#include "graphics/palette.h"
-class OSystem_DS : public BaseBackend, public PaletteManager {
+class OSystem_DS : public EventsBaseBackend, public PaletteManager {
protected:
int eventNum;
@@ -46,7 +45,6 @@ protected:
GBAMPSaveFileManager mpSaveManager;
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
Graphics::Surface _framebuffer;
bool _frameBufferExists;
bool _graphicsEnable;
@@ -140,8 +138,6 @@ public:
virtual void quit();
- virtual Common::SaveFileManager *getSavefileManager();
-
void addEvent(const Common::Event& e);
bool isEventQueueEmpty() const { return queuePos == 0; }
@@ -159,7 +155,6 @@ public:
virtual Audio::Mixer *getMixer() { return _mixer; }
Audio::MixerImpl *getMixerImpl() { return _mixer; }
- virtual Common::TimerManager *getTimerManager() { return _timer; }
static int timerHandler(int t);
diff --git a/backends/platform/gp2x/build/clean.sh b/backends/platform/gp2x/build/clean.sh
deleted file mode 100755
index 0979f6c7d6..0000000000
--- a/backends/platform/gp2x/build/clean.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building all the time less painful.
-
-# Set the paths up here to support the build.
-
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
-export CXX=arm-open2x-linux-g++
-export CC=arm-open2x-linux-gcc
-export CXXFLAGS=-march=armv4t
-export LDFLAGS=-static
-
-cd ../../../..
-
-echo Cleaning ScummVM for GP2X.
-make clean
diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp
deleted file mode 100644
index 074c668b5f..0000000000
--- a/backends/platform/gp2x/gp2x-hw.cpp
+++ /dev/null
@@ -1,228 +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.
- *
- */
-
-/*
- * GP2X: Hardware Stuff.
- * Thanks to Rlyeh, Snaff, Squidge, Hermes, PS2Reality and RobBrown
- * for there help with us all getting to grips with this.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "gp2x-common.h"
-
-#include "gp2x-hw.h"
-#include "gp2x-mem.h"
-
-// Linux includes to let us goof about with the system in a 'standard' way.
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-extern "C" {
-static unsigned long gp2x_dev[8]={0,0,0,0,0,0,0,0};//, gp2x_ticks_per_second;
-}
-
-namespace GP2X_HW {
-
-enum {
- VOLUME_NOCHG = 0,
- VOLUME_DOWN = 1,
- VOLUME_UP = 2,
- VOLUME_CHANGE_RATE = 8,
- VOLUME_MIN = 0,
- VOLUME_INITIAL = 60,
- VOLUME_MAX = 100
-};
-
-int volumeLevel = VOLUME_INITIAL;
-
-/* system registers */
-static struct
-{
- unsigned short SYSCLKENREG,SYSCSETREG,FPLLVSETREG,DUALINT920,DUALINT940,DUALCTRL940;
-}
-system_reg;
-
-static unsigned short dispclockdiv;
-
-static volatile unsigned short *MEM_REG;
-
-#define SYS_CLK_FREQ 7372800
-
-void deviceInit() {
- // Open devices
- if (!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR);
- if (!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY);
- if (!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR);
-}
-
-void deviceDeinit() {
- // Close devices
- {
- int i;
- for (i=0;i<8;i++)
- {
- if (gp2x_dev[i])
- {
- close(gp2x_dev[i]);
- }
- }
- }
-
- MEM_REG[0x91c>>1] = system_reg.SYSCSETREG;
- MEM_REG[0x910>>1] = system_reg.FPLLVSETREG;
- MEM_REG[0x3B40>>1] = system_reg.DUALINT920;
- MEM_REG[0x3B42>>1] = system_reg.DUALINT940;
- MEM_REG[0x3B48>>1] = system_reg.DUALCTRL940;
- MEM_REG[0x904>>1] = system_reg.SYSCLKENREG;
- MEM_REG[0x924>>1] = dispclockdiv;
-
- unpatchMMU();
-}
-
-void mixerMoveVolume(int direction) {
- if (volumeLevel <= 10) {
- if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2;
- if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;
- } else {
- if(direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
- if(direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
- }
-
- if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
- if (volumeLevel > VOLUME_MAX) volumeLevel = VOLUME_MAX;
-
- unsigned long soundDev = open("/dev/mixer", O_RDWR);
-
- if(soundDev) {
- int vol = ((volumeLevel << 8) | volumeLevel);
- ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
- close(soundDev);
- }
-}
-
-void setCpuspeed(unsigned int mhz)
-{
- set_FCLK(mhz);
- set_DCLK_Div(0);
- set_920_Div(0);
-}
-
-int getBattLevel() {
- int devbatt;
- unsigned short currentval=0;
- devbatt = open("/dev/batt", O_RDONLY);
- read (devbatt, &currentval, 2);
- close (devbatt);
- return (currentval);
-}
-
-void set_display_clock_div(unsigned div)
-{
- div=((div & 63) | 64)<<8;
- MEM_REG[0x924>>1]=(MEM_REG[0x924>>1] & ~(255<<8)) | div;
-}
-
-
-void set_FCLK(unsigned MHZ)
-{
- unsigned v;
- unsigned mdiv,pdiv=3,scale=0;
- MHZ*=1000000;
- mdiv=(MHZ*pdiv)/SYS_CLK_FREQ;
- mdiv=((mdiv-8)<<8) & 0xff00;
- pdiv=((pdiv-2)<<2) & 0xfc;
- scale&=3;
- v=mdiv | pdiv | scale;
- MEM_REG[0x910>>1]=v;
-}
-
-
-void set_920_Div(unsigned short div)
-{
- unsigned short v;
- v = MEM_REG[0x91c>>1] & (~0x3);
- MEM_REG[0x91c>>1] = (div & 0x7) | v;
-}
-
-
-void set_DCLK_Div( unsigned short div )
-{
- unsigned short v;
- v = (unsigned short)( MEM_REG[0x91c>>1] & (~(0x7 << 6)) );
- MEM_REG[0x91c>>1] = ((div & 0x7) << 6) | v;
-}
-
-
-void Disable_940(void)
-{
- MEM_REG[0x3B42>>1];
- MEM_REG[0x3B42>>1]=0;
- MEM_REG[0x3B46>>1]=0xffff;
- MEM_REG[0x3B48>>1]|= (1 << 7);
- MEM_REG[0x904>>1]&=0xfffe;
-}
-
-void gp2x_video_wait_vsync(void)
-{
- MEM_REG[0x2846>>1]=(MEM_REG[0x2846>>1] | 0x20) & ~2;
- while (!(MEM_REG[0x2846>>1] & 2));
-}
-
-} /* namespace GP2X_HW */
-
-namespace GPH {
-
-enum {
- /* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
-};
-
-int tapmodeLevel = TAPMODE_LEFT;
-
-void ToggleTapMode() {
- if (tapmodeLevel == TAPMODE_LEFT) {
- tapmodeLevel = TAPMODE_RIGHT;
- } else if (tapmodeLevel == TAPMODE_RIGHT) {
- tapmodeLevel = TAPMODE_HOVER;
- } else if (tapmodeLevel == TAPMODE_HOVER) {
- tapmodeLevel = TAPMODE_LEFT;
- } else {
- tapmodeLevel = TAPMODE_LEFT;
- }
-}
-
-
-} /* namespace GPH */
diff --git a/backends/platform/gp2x/gp2x-hw.h b/backends/platform/gp2x/gp2x-hw.h
deleted file mode 100644
index 3c66400124..0000000000
--- a/backends/platform/gp2x/gp2x-hw.h
+++ /dev/null
@@ -1,62 +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.
- *
- */
-
-/*
- * GP2X: Hardware Stuff.
- *
- */
-
-#ifndef GP2X_HW_H
-#define GP2X_HW_H
-
-namespace GP2X_HW {
-
-#define GP2X_MAXVOL 100 // Highest level permitted by GP2X's mixer
-#define SYS_CLK_FREQ 7372800 // Clock Frequency
-
-extern int volumeLevel;
-
-extern void deviceInit();
-extern void deviceDeinit();
-extern void mixerMoveVolume(int);
-extern void setCpuspeed(unsigned int cpuspeed);
-extern int getBattLevel();
-
-extern void save_system_regs(void); /* save some registers */
-extern void set_display_clock_div(unsigned div);
-extern void set_FCLK(unsigned MHZ); /* adjust the clock frequency (in Mhz units) */
-extern void set_920_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-extern void set_DCLK_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-extern void Disable_940(void); /* 940t down */
-extern void gp2x_video_wait_vsync(void);
-
-} /* namespace GP2X_HW */
-
-namespace GPH {
-
-extern int tapmodeLevel;
-
-extern void ToggleTapMode();
-
-} /* namespace GPH */
-
-#endif //GP2X_HW_H
diff --git a/backends/platform/gp2x/gp2x-mem.cpp b/backends/platform/gp2x/gp2x-mem.cpp
deleted file mode 100644
index 8d22bf8130..0000000000
--- a/backends/platform/gp2x/gp2x-mem.cpp
+++ /dev/null
@@ -1,84 +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.
- *
- */
-
-/*
- * GP2X: Memory tweaking stuff.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include <stdio.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "backends/platform/gp2x/gp2x-mem.h"
-
-extern "C" {
-static volatile unsigned short *gp2x_memregs;
-}
-
-void SetClock (unsigned c) {
- unsigned v;
- unsigned mdiv,pdiv=3,scale=0;
-
- // Set ARM920t clock
- c *= 1000000;
- mdiv = (c*pdiv) / SYS_CLK_FREQ;
- mdiv = ((mdiv-8)<<8) & 0xff00;
- pdiv = ((pdiv-2)<<2) & 0xfc;
- scale &= 3;
- v = mdiv | pdiv | scale;
- gp2x_memregs[0x910>>1] = v;
-}
-
-void patchMMU (void) {
- //volatile unsigned int *secbuf = (unsigned int *)malloc (204800);
-
- printf ("Reconfiguring cached memory regions...\n");
-
- //hackpgtable();
- //printf ("Sucess...\n");
-
- system("/sbin/rmmod mmuhack");
- system("/sbin/insmod -f mmuhack.o");
-
- int mmufd = open("/dev/mmuhack", O_RDWR);
-
- if(mmufd < 0) {
- printf ("Upper memory uncached (attempt failed, access to upper memory will be slower)...\n");
- } else {
- printf ("Upper memory cached...\n");
- close(mmufd);
- }
-}
-
-void unpatchMMU (void) {
- printf ("Restoreing cached memory regions...\n");
- system("/sbin/rmmod mmuhack");
-}
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
deleted file mode 100644
index 0e28a6b738..0000000000
--- a/backends/platform/gp2x/gp2x.cpp
+++ /dev/null
@@ -1,208 +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.
- *
- */
-
-/*
- * GP2X: Main backend.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "backends/platform/sdl/sdl-sys.h"
-#include "backends/platform/gp2x/gp2x-common.h"
-#include "backends/platform/gp2x/gp2x-hw.h"
-#include "backends/platform/gp2x/gp2x-mem.h"
-
-#include "backends/saves/default/default-saves.h"
-
-#include "common/config-manager.h"
-#include "common/debug.h"
-
-// Disable for normal serial logging.
-#define DUMP_STDOUT
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-void OSystem_GP2X::initBackend() {
- // Setup default save path to be workingdir/saves
- char savePath[PATH_MAX + 1];
- char workDirName[PATH_MAX + 1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
- } else {
- printf("Current working directory: %s\n", workDirName);
- }
-
- strcpy(savePath, workDirName);
- strcat(savePath, "/saves");
- printf("Current save directory: %s\n", savePath);
- struct stat sb;
- if (stat(savePath, &sb) == -1)
- if (errno == ENOENT) // Create the dir if it does not exist
- if (mkdir(savePath, 0755) != 0)
- warning("mkdir for '%s' failed", savePath);
-
- ConfMan.registerDefault("savepath", savePath);
-
- #ifdef DUMP_STDOUT
- // The GP2X has a serial console but most users do not use this so we
- // output all our STDOUT and STDERR to files for debug purposes.
- char STDOUT_FILE[PATH_MAX + 1];
- char STDERR_FILE[PATH_MAX + 1];
-
- strcpy(STDOUT_FILE, workDirName);
- strcpy(STDERR_FILE, workDirName);
- strcat(STDOUT_FILE, "/scummvm.stdout.txt");
- strcat(STDERR_FILE, "/scummvm.stderr.txt");
-
- /* Flush the output in case anything is queued */
- fclose(stdout);
- fclose(stderr);
-
- /* Redirect standard input and standard output */
- FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
- if (newfp == NULL) {
- #if !defined(stdout)
- stdout = fopen(STDOUT_FILE, "w");
- #else
- newfp = fopen(STDOUT_FILE, "w");
- if (newfp) {
- *stdout = *newfp;
- }
- #endif
- }
-
- newfp = freopen(STDERR_FILE, "w", stderr);
- if (newfp == NULL) {
- #if !defined(stderr)
- stderr = fopen(STDERR_FILE, "w");
- #else
- newfp = fopen(STDERR_FILE, "w");
- if (newfp) {
- *stderr = *newfp;
- }
- #endif
- }
-
- setbuf(stderr, NULL);
- printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
- #endif /* DUMP_STDOUT */
-
- // Setup other defaults.
- ConfMan.registerDefault("aspect_ratio", true);
-
- /* Up default volume values as we use a seperate system level volume anyway. */
- ConfMan.registerDefault("music_volume", 192);
- ConfMan.registerDefault("sfx_volume", 192);
- ConfMan.registerDefault("speech_volume", 192);
- ConfMan.registerDefault("autosave_period", 3 * 60); // Trigger autosave every 3 minutes - On low batts 4 mins is about your warning time.
-
- ConfMan.setBool("FM_low_quality", true);
-
- /* Initialize any GP2X specific stuff we may want (Batt Status, scaler etc.) */
- GP2X_HW::deviceInit();
-
- /* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */
- GP2X_HW::mixerMoveVolume(0);
-
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new GP2XSdlEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0)
- _graphicsManager = new GP2XSdlGraphicsManager(_eventSource);
-
- /* Pass to POSIX method to do the heavy lifting */
- OSystem_POSIX::initBackend();
-}
-
-void OSystem_GP2X::initSDL() {
- // Check if SDL has not been initialized
- if (!_initedSDL) {
- uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
- if (ConfMan.hasKey("disable_sdl_parachute"))
- sdlFlags |= SDL_INIT_NOPARACHUTE;
-
- // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
- if (SDL_Init(sdlFlags) == -1)
- error("Could not initialize SDL: %s", SDL_GetError());
-
- // Enable unicode support if possible
- SDL_EnableUNICODE(1);
-
- _initedSDL = true;
- }
-}
-
-void OSystem_GP2X::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
- /* Setup default extra data paths for engine data files and plugins */
- char workDirName[PATH_MAX + 1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
- }
-
- Common::FSNode workdirNode(workDirName);
- if (workdirNode.exists() && workdirNode.isDirectory()) {
- s.add("__GP2X_WORKDIR__", new Common::FSDirectory(workDirName), priority);
- }
-
- char enginedataPath[PATH_MAX+1];
-
- strcpy(enginedataPath, workDirName);
- strcat(enginedataPath, "/engine-data");
-
- Common::FSNode engineNode(enginedataPath);
- if (engineNode.exists() && engineNode.isDirectory()) {
- s.add("__GP2X_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
- }
-
- char pluginsPath[PATH_MAX+1];
-
- strcpy(pluginsPath, workDirName);
- strcat(pluginsPath, "/plugins");
-
- Common::FSNode pluginsNode(pluginsPath);
- if (pluginsNode.exists() && pluginsNode.isDirectory()) {
- s.add("__GP2X_PLUGINS__", new Common::FSDirectory(pluginsPath), priority);
- }
-}
-
-void OSystem_GP2X::quit() {
- GP2X_HW::deviceDeinit();
-
- #ifdef DUMP_STDOUT
- printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
- fclose(stdout);
- fclose(stderr);
- #endif /* DUMP_STDOUT */
-
- OSystem_POSIX::quit();
-}
diff --git a/backends/platform/gp2x/module.mk b/backends/platform/gp2x/module.mk
deleted file mode 100644
index 4846f162cb..0000000000
--- a/backends/platform/gp2x/module.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-MODULE := backends/platform/gp2x
-
-MODULE_OBJS := \
- gp2x-hw.o \
- gp2x-main.o \
- gp2x-mem.o \
- gp2x.o
-
-# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
-MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
-OBJS := $(MODULE_OBJS) $(OBJS)
-MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
-
-# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
--include $(srcdir)/backends/platform/sdl/module.mk
diff --git a/backends/platform/gph/build/gp2x-config.sh b/backends/platform/gph/build/gp2x-config.sh
index f474c4d0d4..a9b28b2fd0 100644
--- a/backends/platform/gph/build/gp2x-config.sh
+++ b/backends/platform/gph/build/gp2x-config.sh
@@ -23,8 +23,9 @@ cd ../../../..
--enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
- --enable-vkeybd --enable-plugins --default-dynamic
-# --disable-release --enable-debug
+ --enable-vkeybd
+
# --enable-plugins --default-dynamic
+# --disable-release --enable-debug
echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gph/devices/gp2x/scummvm.gpe b/backends/platform/gph/devices/gp2x/scummvm.gpe
index e8983aa2ce..51a49f7560 100644
--- a/backends/platform/gph/devices/gp2x/scummvm.gpe
+++ b/backends/platform/gph/devices/gp2x/scummvm.gpe
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Remount SD with forced Sync, does this really work?
mount -o sync,remount /dev/mmcsd/disc0/part1 /mnt/sd/
@@ -8,7 +8,7 @@ mount -o sync,remount /dev/mmcsd/disc0/part1 /mnt/sd/
export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM, important this bit.
-./scummvm.gph
+./scummvm.gph --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp
index cb52da441d..ae3466b836 100644
--- a/backends/platform/gph/gph-backend.cpp
+++ b/backends/platform/gph/gph-backend.cpp
@@ -56,8 +56,15 @@
/* Dump console info to files. */
#define DUMP_STDOUT
+OSystem_GPH::OSystem_GPH()
+ :
+ OSystem_POSIX() {
+}
+
void OSystem_GPH::initBackend() {
+ assert(!_inited);
+
// Create the events manager
if (_eventSource == 0)
_eventSource = new GPHEventSource();
@@ -81,7 +88,7 @@ void OSystem_GPH::initBackend() {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
+ error("Could not obtain current working directory.");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -155,7 +162,8 @@ void OSystem_GPH::initBackend() {
/* Trigger autosave every 4 minutes - On low batts 5 mins is about your warning time. */
ConfMan.registerDefault("autosave_period", 4 * 60);
- /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' is ;-). */
+ /* Make sure that aspect ratio correction is enabled on the 1st run to stop
+ users asking me what the 'wasted space' at the bottom is ;-). */
ConfMan.registerDefault("aspect_ratio", true);
/* Make sure SDL knows that we have a joystick we want to use. */
@@ -164,10 +172,10 @@ void OSystem_GPH::initBackend() {
/* Now setup any device specific user options (Left handed mode, that sort of thing). */
// GPH::setOptions();
- printf("%s\n", "Passing to OSystem::SDL initBackend.");
-
/* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
+
+ _inited = true;
}
void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
@@ -176,7 +184,7 @@ void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
+ error("Error: Could not obtain current working directory.");
}
Common::FSNode workdirNode(workDirName);
@@ -215,5 +223,5 @@ void OSystem_GPH::quit() {
fclose(stderr);
#endif /* DUMP_STDOUT */
- OSystem_SDL::quit();
+ OSystem_POSIX::quit();
}
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index f91ec8f478..1a8c6686ca 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -21,7 +21,7 @@
*/
#include "backends/platform/gph/gph-sdl.h"
-#include "backends/plugins/sdl/sdl-provider.h"
+#include "backends/plugins/posix/posix-provider.h"
#include "base/main.h"
#if defined(GPH_DEVICE)
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
((OSystem_GPH *)g_system)->init();
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new SDLPluginProvider());
+ PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
diff --git a/backends/platform/gph/gph-sdl.h b/backends/platform/gph/gph-sdl.h
index 68a641eed7..8b943f98f3 100644
--- a/backends/platform/gph/gph-sdl.h
+++ b/backends/platform/gph/gph-sdl.h
@@ -28,8 +28,8 @@
#include "backends/base-backend.h"
#include "backends/platform/sdl/sdl.h"
#include "backends/platform/sdl/posix/posix.h"
-#include "backends/graphics/gph/gph-graphics.h"
#include "backends/events/gph/gph-events.h"
+#include "backends/graphics/gph/gph-graphics.h"
#define __GP2XWIZ__
@@ -39,6 +39,8 @@
class OSystem_GPH : public OSystem_POSIX {
public:
+ OSystem_GPH();
+
/* Platform Setup Stuff */
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index 6e2a4b7e1e..1ab1db0f27 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -335,9 +335,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x,
const char *dialogMsg;
if (_mouseClickAndDragEnabled) {
_touchpadModeEnabled = false;
- dialogMsg = "Mouse-click-and-drag mode enabled.";
+ dialogMsg = _("Mouse-click-and-drag mode enabled.");
} else
- dialogMsg = "Mouse-click-and-drag mode disabled.";
+ dialogMsg = _("Mouse-click-and-drag mode disabled.");
GUI::TimedMessageDialog dialog(dialogMsg, 1500);
dialog.runModal();
return false;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 9007f006f8..4bc567c39d 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -53,7 +53,7 @@ SoundProc OSystem_IPHONE::s_soundCallback = NULL;
void *OSystem_IPHONE::s_soundParam = NULL;
OSystem_IPHONE::OSystem_IPHONE() :
- _savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL),
+ _mixer(NULL), _offscreen(NULL),
_overlayVisible(false), _fullscreen(NULL),
_mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
_secondaryTapped(false), _lastSecondaryTap(0),
@@ -72,10 +72,7 @@ OSystem_IPHONE::OSystem_IPHONE() :
OSystem_IPHONE::~OSystem_IPHONE() {
AudioQueueDispose(s_AudioQueue.queue, true);
- delete _fsFactory;
- delete _savefile;
delete _mixer;
- delete _timer;
delete _offscreen;
delete _fullscreen;
}
@@ -88,12 +85,12 @@ int OSystem_IPHONE::timerHandler(int t) {
void OSystem_IPHONE::initBackend() {
#ifdef IPHONE_OFFICIAL
- _savefile = new DefaultSaveFileManager(iPhone_getDocumentsDir());
+ _savefileManager = new DefaultSaveFileManager(iPhone_getDocumentsDir());
#else
- _savefile = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH);
+ _savefileManager = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH);
#endif
- _timer = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
gettimeofday(&_startTime, NULL);
@@ -101,7 +98,7 @@ void OSystem_IPHONE::initBackend() {
setTimerCallback(&OSystem_IPHONE::timerHandler, 10);
- BaseBackend::initBackend();
+ EventsBaseBackend::initBackend();
}
bool OSystem_IPHONE::hasFeature(Feature f) {
@@ -210,21 +207,11 @@ void OSystem_IPHONE::getTimeAndDate(TimeDate &td) const {
td.tm_year = t.tm_year;
}
-Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() {
- assert(_savefile);
- return _savefile;
-}
-
Audio::Mixer *OSystem_IPHONE::getMixer() {
assert(_mixer);
return _mixer;
}
-Common::TimerManager *OSystem_IPHONE::getTimerManager() {
- assert(_timer);
- return _timer;
-}
-
OSystem *OSystem_IPHONE_create() {
return new OSystem_IPHONE();
}
@@ -255,6 +242,18 @@ void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
}
}
+void OSystem_IPHONE::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
void iphone_main(int argc, char *argv[]) {
//OSystem_IPHONE::migrateApp();
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 36b4b7356b..37896cceeb 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -49,7 +49,7 @@ typedef struct AQCallbackStruct {
AudioStreamBasicDescription dataFormat;
} AQCallbackStruct;
-class OSystem_IPHONE : public BaseBackend, public PaletteManager {
+class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {
protected:
static const OSystem::GraphicsMode s_supportedGraphicsModes[];
@@ -57,9 +57,7 @@ protected:
static SoundProc s_soundCallback;
static void *s_soundParam;
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- Common::TimerManager *_timer;
Graphics::Surface _framebuffer;
byte *_offscreen;
@@ -110,7 +108,6 @@ protected:
bool _fullScreenIsDirty;
bool _fullScreenOverlayIsDirty;
int _screenChangeCount;
- FilesystemFactory *_fsFactory;
public:
@@ -173,19 +170,18 @@ public:
virtual int getScreenChangeID() const { return _screenChangeCount; }
virtual void quit();
- FilesystemFactory *getFilesystemFactory() { return _fsFactory; }
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
virtual void getTimeAndDate(TimeDate &t) const;
- virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
- virtual Common::TimerManager *getTimerManager();
void startSoundsystem();
void stopSoundsystem();
virtual Common::String getDefaultConfigFileName();
+ virtual void logMessage(LogMessageType::Type type, const char *message);
+
protected:
void internUpdateScreen();
void dirtyFullScreen();
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index f22b221ccc..354f25a1cf 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -27,8 +27,6 @@
#include "common/config-manager.h"
#include "backends/base-backend.h"
-#include "backends/saves/default/default-saves.h"
-#include "backends/timer/default/default-timer.h"
#include "base/main.h"
@@ -73,12 +71,9 @@ enum GraphicModeID {
OVERS_MPAL_340X240
};
-class OSystem_N64 : public BaseBackend, public PaletteManager {
+class OSystem_N64 : public EventsBaseBackend, public PaletteManager {
protected:
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- Common::TimerManager *_timer;
- FilesystemFactory *_fsFactory;
struct display_context * _dc; // Display context for N64 on screen buffer switching
@@ -112,7 +107,7 @@ protected:
// FIXME: This must be left as "int" for now, to fix the sign-comparison problem
// there is a little more work involved than an int->uint change
int _cursorWidth, _cursorHeight;
-
+
int _cursorKeycolor;
uint16 _overlayHeight, _overlayWidth;
@@ -201,12 +196,10 @@ public:
virtual void quit();
- virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
virtual void getTimeAndDate(TimeDate &t) const;
- virtual Common::TimerManager *getTimerManager();
virtual void setTimerCallback(TimerProc callback, int interval);
- FilesystemFactory *getFilesystemFactory();
+ virtual void logMessage(LogMessageType::Type type, const char *message);
void rebuildOffscreenGameBuffer(void);
void rebuildOffscreenMouseBuffer(void);
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 62fe145bcc..4bc3780fe2 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -30,6 +30,8 @@
#include "pakfs_save_manager.h"
#include "framfs_save_manager.h"
#include "backends/fs/n64/n64-fs-factory.h"
+#include "backends/saves/default/default-saves.h"
+#include "backends/timer/default/default-timer.h"
typedef unsigned long long uint64;
@@ -137,9 +139,7 @@ OSystem_N64::OSystem_N64() {
_mouseMaxX = _overlayWidth;
_mouseMaxY = _overlayHeight;
- _savefile = 0;
_mixer = 0;
- _timer = 0;
_dirtyOffscreen = false;
@@ -154,10 +154,7 @@ OSystem_N64::OSystem_N64() {
}
OSystem_N64::~OSystem_N64() {
- delete _savefile;
delete _mixer;
- delete _timer;
- delete _fsFactory;
}
void OSystem_N64::initBackend() {
@@ -170,7 +167,7 @@ void OSystem_N64::initBackend() {
if (FRAM_Detect()) { // Use FlashRAM
initFramFS();
- _savefile = new FRAMSaveManager();
+ _savefileManager = new FRAMSaveManager();
} else { // Use PakFS
// Init Controller Pak
initPakFs();
@@ -185,16 +182,16 @@ void OSystem_N64::initBackend() {
}
}
- _savefile = new PAKSaveManager();
+ _savefileManager = new PAKSaveManager();
}
- _timer = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
setTimerCallback(&timer_handler, 10);
setupMixer();
- BaseBackend::initBackend();
+ EventsBaseBackend::initBackend();
}
bool OSystem_N64::hasFeature(Feature f) {
@@ -851,21 +848,11 @@ void OSystem_N64::quit() {
return;
}
-Common::SaveFileManager *OSystem_N64::getSavefileManager() {
- assert(_savefile);
- return _savefile;
-}
-
Audio::Mixer *OSystem_N64::getMixer() {
assert(_mixer);
return _mixer;
}
-Common::TimerManager *OSystem_N64::getTimerManager() {
- assert(_timer);
- return _timer;
-}
-
void OSystem_N64::getTimeAndDate(TimeDate &t) const {
// No RTC inside the N64, read mips timer to simulate
// passing of time, not a perfect solution, but can't think
@@ -883,8 +870,16 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
return;
}
-FilesystemFactory *OSystem_N64::getFilesystemFactory() {
- return _fsFactory;
+void OSystem_N64::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
}
void OSystem_N64::setTimerCallback(TimerProc callback, int interval) {
diff --git a/backends/platform/n64/osys_n64_events.cpp b/backends/platform/n64/osys_n64_events.cpp
index 2645cfea2a..62f11aef64 100644
--- a/backends/platform/n64/osys_n64_events.cpp
+++ b/backends/platform/n64/osys_n64_events.cpp
@@ -162,7 +162,7 @@ bool OSystem_N64::pollEvent(Common::Event &event) {
uint16 newButtons = 0;
if (_controllerPort >= 0)
newButtons = _ctrlData.c[_controllerPort].buttons; // Read from controller
-
+
uint16 newMouseButtons = 0;
if (_mousePort >= 0)
newMouseButtons = _ctrlData.c[_mousePort].buttons;
diff --git a/backends/platform/n64/osys_n64_utilities.cpp b/backends/platform/n64/osys_n64_utilities.cpp
index 8d9f0471d3..0622e6423d 100644
--- a/backends/platform/n64/osys_n64_utilities.cpp
+++ b/backends/platform/n64/osys_n64_utilities.cpp
@@ -21,6 +21,7 @@
*/
#include "osys_n64.h"
+#include "backends/timer/default/default-timer.h"
void checkTimers(void) {
OSystem_N64 *osys = (OSystem_N64 *)g_system;
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 106cde1699..4690a67c55 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -52,6 +52,8 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &t) const {}
+
+ virtual void logMessage(LogMessageType::Type type, const char *message);
};
OSystem_NULL::OSystem_NULL() {
@@ -97,6 +99,18 @@ uint32 OSystem_NULL::getMillis() {
void OSystem_NULL::delayMillis(uint msecs) {
}
+void OSystem_NULL::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
OSystem *OSystem_NULL_create() {
return new OSystem_NULL();
}
diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp
index 4c29636e40..5231e9790d 100644
--- a/backends/platform/openpandora/op-backend.cpp
+++ b/backends/platform/openpandora/op-backend.cpp
@@ -20,13 +20,16 @@
*
*/
+#if defined(OPENPANDORA)
+
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
-#include "backends/platform/openpandora/op-sdl.h"
-#include "base/main.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h"
+#include "backends/platform/openpandora/op-sdl.h"
+#include "backends/plugins/posix/posix-provider.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
@@ -35,6 +38,7 @@
#include "common/debug.h"
#include "common/events.h"
#include "common/file.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "audio/mixer_intern.h"
@@ -52,15 +56,29 @@
static SDL_Cursor *hiddenCursor;
-static Uint32 timer_handler(Uint32 interval, void *param) {
- ((DefaultTimerManager *)param)->handler();
- return interval;
+OSystem_OP::OSystem_OP()
+ :
+ OSystem_POSIX() {
}
+//static Uint32 timer_handler(Uint32 interval, void *param) {
+// ((DefaultTimerManager *)param)->handler();
+// return interval;
+//}
+
void OSystem_OP::initBackend() {
assert(!_inited);
+ // Create the events manager
+ if (_eventSource == 0)
+ _eventSource = new OPEventSource();
+
+ // Create the graphics manager
+ if (_graphicsManager == 0) {
+ _graphicsManager = new OPGraphicsManager(_eventSource);
+ }
+
// int joystick_num = ConfMan.getInt("joystick_num");
// uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
//
@@ -76,12 +94,12 @@ void OSystem_OP::initBackend() {
//
// Create the mixer manager
- if (_mixer == 0) {
- _mixerManager = new DoubleBufferSDLMixerManager();
+// if (_mixer == 0) {
+// _mixerManager = new DoubleBufferSDLMixerManager();
// Setup and start mixer
- _mixerManager->init();
- }
+// _mixerManager->init();
+// }
/* Setup default save path to be workingdir/saves */
@@ -103,7 +121,7 @@ void OSystem_OP::initBackend() {
if (mkdir(savePath, 0755) != 0)
warning("mkdir for '%s' failed!", savePath);
-// _savefileManager = new DefaultSaveFileManager(savePath);
+ _savefileManager = new DefaultSaveFileManager(savePath);
#ifdef DUMP_STDOUT
// The OpenPandora has a serial console on the EXT connection but most users do not use this so we
@@ -161,24 +179,14 @@ void OSystem_OP::initBackend() {
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new OPEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0)
- _graphicsManager = new OPGraphicsManager(_eventSource);
-
// _graphicsMutex = createMutex();
- // Invoke parent implementation of this method
+ /* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
_inited = true;
}
-
-
// enable joystick
// if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
// printf("Using joystick: %s\n", SDL_JoystickName(0));
@@ -239,13 +247,14 @@ void OSystem_OP::initSDL() {
// _videoMode.fullscreen = true;
_initedSDL = true;
+
+// OSystem_POSIX::initSDL();
}
}
void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
/* Setup default extra data paths for engine data files and plugins */
-
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
@@ -276,3 +285,5 @@ void OSystem_OP::quit() {
OSystem_POSIX::quit();
}
+
+#endif
diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp
index ab777fec8f..bb359e7204 100644
--- a/backends/platform/openpandora/op-main.cpp
+++ b/backends/platform/openpandora/op-main.cpp
@@ -20,10 +20,8 @@
*
*/
-
-#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/openpandora/op-sdl.h"
-#include "backends/plugins/posix/posix-provider.h"
+#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
#if defined(OPENPANDORA)
@@ -35,10 +33,10 @@ int main(int argc, char *argv[]) {
assert(g_system);
// Pre initialize the backend
- //((OSystem_OP *)g_system)->init();
+ ((OSystem_OP *)g_system)->init();
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
+ PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h
index 9d92472b17..d493c3957c 100644
--- a/backends/platform/openpandora/op-sdl.h
+++ b/backends/platform/openpandora/op-sdl.h
@@ -26,12 +26,12 @@
#if defined(OPENPANDORA)
#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/sdl/posix/posix.h"
#include "backends/events/openpandora/op-events.h"
#include "backends/graphics/openpandora/op-graphics.h"
-#define __OPENPANDORA__
+//#define MIXER_DOUBLE_BUFFERING 1
#ifndef PATH_MAX
#define PATH_MAX 255
@@ -39,16 +39,22 @@
class OSystem_OP : public OSystem_POSIX {
public:
- OSystem_OP() {}
+ OSystem_OP();
/* Platform Setup Stuff */
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
- void initSDL();
void quit();
protected:
-
+ bool _inited;
+ bool _initedSDL;
+
+ /**
+ * Initialse the SDL library
+ * with an OpenPandora workaround.
+ */
+ virtual void initSDL();
};
#endif
#endif //OP_SDL_H
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 728a67fbad..d3acd06089 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -60,7 +60,6 @@
#include "backends/fs/ps2/ps2-fs-factory.h"
#include "backends/plugins/ps2/ps2-provider.h"
-#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
#include "audio/mixer_intern.h"
@@ -348,14 +347,14 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
void OSystem_PS2::init(void) {
sioprintf("Timer...\n");
- _scummTimerManager = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
_scummMixer = new Audio::MixerImpl(this, 48000);
_scummMixer->setReady(true);
initTimer();
sioprintf("Starting SavefileManager\n");
- _saveManager = new Ps2SaveFileManager(this, _screen);
+ _savefileManager = new Ps2SaveFileManager(this, _screen);
sioprintf("Initializing ps2Input\n");
_input = new Ps2Input(this, _useMouse, _useKbd);
@@ -430,7 +429,7 @@ void OSystem_PS2::initTimer(void) {
void OSystem_PS2::timerThreadCallback(void) {
while (!_systemQuit) {
WaitSema(g_TimerThreadSema);
- _scummTimerManager->handler();
+ ((DefaultTimerManager *)_timerManager)->handler();
}
ExitThread();
}
@@ -600,18 +599,10 @@ void OSystem_PS2::delayMillis(uint msecs) {
}
}
-Common::TimerManager *OSystem_PS2::getTimerManager() {
- return _scummTimerManager;
-}
-
Audio::Mixer *OSystem_PS2::getMixer() {
return _scummMixer;
}
-Common::SaveFileManager *OSystem_PS2::getSavefileManager(void) {
- return _saveManager;
-}
-
FilesystemFactory *OSystem_PS2::getFilesystemFactory() {
return &Ps2FilesystemFactory::instance();
}
@@ -770,7 +761,7 @@ void OSystem_PS2::msgPrintf(int millis, const char *format, ...) {
void OSystem_PS2::powerOffCallback(void) {
sioprintf("powerOffCallback\n");
- // _saveManager->quit(); // romeo
+ // _savefileManager->quit(); // romeo
if (_useHdd) {
sioprintf("umount\n");
fio.umount("pfs0:");
@@ -810,7 +801,7 @@ void OSystem_PS2::quit(void) {
DisableIntc(INT_TIMER0);
RemoveIntcHandler(INT_TIMER0, _intrId);
- // _saveManager->quit(); // romeo
+ // _savefileManager->quit(); // romeo
_screen->quit();
padEnd(); // stop pad library
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index cc9c489827..35ceaf829e 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -27,12 +27,8 @@
#include "backends/base-backend.h"
#include "graphics/palette.h"
-class DefaultTimerManager;
-class DefaultSaveFileManager;
-
class Gs2dScreen;
class Ps2Input;
-class Ps2SaveFileManager;
// class Ps2FilesystemFactory;
struct IrxReference;
@@ -44,15 +40,11 @@ struct Ps2Mutex {
int count;
};
-namespace Common {
-class TimerManager;
-};
-
namespace Audio {
class MixerImpl;
};
-class OSystem_PS2 : public BaseBackend, public PaletteManager {
+class OSystem_PS2 : public EventsBaseBackend, public PaletteManager {
public:
OSystem_PS2(const char *elfPath);
virtual ~OSystem_PS2(void);
@@ -93,7 +85,6 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
- virtual Common::TimerManager *getTimerManager();
virtual bool pollEvent(Common::Event &event);
virtual Audio::Mixer *getMixer();
@@ -116,7 +107,6 @@ public:
virtual void logMessage(LogMessageType::Type type, const char *message);
virtual Graphics::PixelFormat getOverlayFormat() const;
- virtual Common::SaveFileManager *getSavefileManager();
virtual FilesystemFactory *getFilesystemFactory();
virtual void getTimeAndDate(TimeDate &t) const;
@@ -144,15 +134,11 @@ private:
void initTimer(void);
void readRtcTime(void);
- DefaultTimerManager *_scummTimerManager;
Audio::MixerImpl *_scummMixer;
bool _mouseVisible;
bool _useMouse, _useKbd, _useHdd, _usbMassLoaded, _useNet;
- Ps2SaveFileManager *_saveManager;
- // DefaultSaveFileManager *_saveManager;
-
Gs2dScreen *_screen;
Ps2Input *_input;
uint16 _oldMouseX, _oldMouseY;
diff --git a/backends/platform/psp/cursor.cpp b/backends/platform/psp/cursor.cpp
index 18a61f3df4..b295507de1 100644
--- a/backends/platform/psp/cursor.cpp
+++ b/backends/platform/psp/cursor.cpp
@@ -324,18 +324,18 @@ inline void Cursor::setRendererModePalettized(bool palettized) {
_renderer.setAlphaReverse(false);
_renderer.setColorTest(false);
} else { // 16 bits, no palette
- // Color test is an easy way for the hardware to make our keycolor
+ // Color test is an easy way for the hardware to make our keycolor
// transparent.
- _renderer.setColorTest(true);
-
+ _renderer.setColorTest(true);
+
// Alpha blending is not strictly required, but makes the cursor look
// much better
_renderer.setAlphaBlending(true);
-
+
// Pixel formats without alpha (5650) are considered to have their alpha set.
// Since pixel formats with alpha don't have their alpha bits set, we reverse
// the alpha format for them so that 0 alpha is 1.
- if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650)
+ if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650)
_renderer.setAlphaReverse(true);
else
_renderer.setAlphaReverse(false);
diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp
index 14b96d9cae..bc29166895 100644
--- a/backends/platform/psp/display_client.cpp
+++ b/backends/platform/psp/display_client.cpp
@@ -389,31 +389,31 @@ void Buffer::copyToArray(byte *dst, int pitch) {
void Buffer::setSize(uint32 width, uint32 height, HowToSize textureOrSource/*=kSizeByTextureSize*/) {
DEBUG_ENTER_FUNC();
-
+
// We can size the buffer either by texture size (multiple of 2^n) or source size.
// At higher sizes, increasing the texture size to 2^n is a waste of space. At these sizes kSizeBySourceSize should be used.
-
+
_sourceSize.width = width;
_sourceSize.height = height;
_textureSize.width = scaleUpToPowerOfTwo(width); // can only scale up to 512
_textureSize.height = scaleUpToPowerOfTwo(height);
-
+
if (textureOrSource == kSizeByTextureSize) {
_width = _textureSize.width;
_height = _textureSize.height;
} else { // sizeBySourceSize
_width = _sourceSize.width;
_height = _sourceSize.height;
-
- // adjust allocated width to be divisible by 32.
+
+ // adjust allocated width to be divisible by 32.
// The GU can only handle multiples of 16 bytes. A 4 bit image x 32 will give us 16 bytes
// We don't necessarily know the depth of the pixels here. So just make it divisible by 32.
uint32 checkDiv = _width & 31;
if (checkDiv)
_width += 32 - checkDiv;
}
-
+
PSP_DEBUG_PRINT("width[%u], height[%u], texW[%u], texH[%u], sourceW[%d], sourceH[%d] %s\n", _width, _height, _textureSize.width, _textureSize.height, _sourceSize.width, _sourceSize.height, textureOrSource ? "size by source" : "size by texture");
}
@@ -558,10 +558,10 @@ void GuRenderer::render() {
// Loop over patches of 512x512 pixel textures and draw them
for (uint32 j = 0; j < _buffer->getSourceHeight(); j += 512) {
_textureLoadOffset.y = j;
-
+
for (uint32 i = 0; i < _buffer->getSourceWidth(); i += 512) {
_textureLoadOffset.x = i;
-
+
guLoadTexture();
Vertex *vertices = guGetVertices();
fillVertices(vertices);
@@ -573,8 +573,8 @@ void GuRenderer::render() {
inline void GuRenderer::guProgramDrawBehavior() {
DEBUG_ENTER_FUNC();
- PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n",
- _blending ? "on" : "off", _colorTest ? "on" : "off",
+ PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n",
+ _blending ? "on" : "off", _colorTest ? "on" : "off",
_alphaReverse ? "on" : "off", _keyColor);
if (_blending) {
@@ -591,7 +591,7 @@ inline void GuRenderer::guProgramDrawBehavior() {
if (_colorTest) {
sceGuEnable(GU_COLOR_TEST);
sceGuColorFunc(GU_NOTEQUAL, // show only colors not equal to this color
- _keyColor,
+ _keyColor,
0x00ffffff); // match everything but alpha
} else
sceGuDisable(GU_COLOR_TEST);
@@ -663,10 +663,10 @@ inline void GuRenderer::guLoadTexture() {
byte *startPoint = _buffer->getPixels();
if (_textureLoadOffset.x)
startPoint += _buffer->_pixelFormat.pixelsToBytes(_textureLoadOffset.x);
- if (_textureLoadOffset.y)
+ if (_textureLoadOffset.y)
startPoint += _buffer->getWidthInBytes() * _textureLoadOffset.y;
-
- sceGuTexImage(0,
+
+ sceGuTexImage(0,
_buffer->getTextureWidth(), // texture width (must be power of 2)
_buffer->getTextureHeight(), // texture height (must be power of 2)
_buffer->getWidth(), // width of a line of the image (to get to the next line)
@@ -698,7 +698,7 @@ void GuRenderer::fillVertices(Vertex *vertices) {
// These coordinates describe an area within the texture. ie. we already loaded a square of texture,
// now the coordinates within it are 0 to the edge of the area of the texture we want to draw
float textureStartX = textureFix + _offsetInBuffer.x;
- float textureStartY = textureFix + _offsetInBuffer.y;
+ float textureStartY = textureFix + _offsetInBuffer.y;
int textureLeftX = _drawSize.width - _textureLoadOffset.x;
if (textureLeftX > 512)
@@ -720,7 +720,7 @@ void GuRenderer::fillVertices(Vertex *vertices) {
float imageStartY = gapY + scaledOffsetOnScreenY + (scaleSourceToOutput(false, stretch(false, _textureLoadOffset.y)));
float imageEndX, imageEndY;
-
+
imageEndX = imageStartX + scaleSourceToOutput(true, stretch(true, textureLeftX));
imageEndY = imageStartY + scaleSourceToOutput(false, stretch(false, textureLeftY));
diff --git a/backends/platform/psp/display_client.h b/backends/platform/psp/display_client.h
index f190658a26..e384bfb82b 100644
--- a/backends/platform/psp/display_client.h
+++ b/backends/platform/psp/display_client.h
@@ -171,12 +171,12 @@ protected:
class GuRenderer {
public:
// Constructors
- GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0),
- _blending(false), _alphaReverse(false), _colorTest(false),
+ GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0),
+ _blending(false), _alphaReverse(false), _colorTest(false),
_keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {}
- GuRenderer(Buffer *buffer, Palette *palette) :
- _useGlobalScaler(false), _buffer(buffer), _palette(palette),
- _blending(false), _alphaReverse(false), _colorTest(false),
+ GuRenderer(Buffer *buffer, Palette *palette) :
+ _useGlobalScaler(false), _buffer(buffer), _palette(palette),
+ _blending(false), _alphaReverse(false), _colorTest(false),
_keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {}
static void setDisplayManager(DisplayManager *dm) { _displayManager = dm; } // Called by the Display Manager
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index 899b79727f..e945dca4a8 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -299,7 +299,7 @@ void DisplayManager::init() {
#endif
// Init overlay since we never change the size
- _overlay->deallocate();
+ _overlay->deallocate();
_overlay->setBytesPerPixel(sizeof(OverlayColor));
_overlay->setSize(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
_overlay->allocate();
@@ -432,13 +432,13 @@ bool DisplayManager::renderAll() {
_screen->render();
_screen->setClean(); // clean out dirty bit
-
+
if (_imageViewer->isVisible())
_imageViewer->render();
_imageViewer->setClean();
if (_overlay->isVisible())
- _overlay->render();
+ _overlay->render();
_overlay->setClean();
if (_cursor->isVisible())
@@ -448,7 +448,7 @@ bool DisplayManager::renderAll() {
if (_keyboard->isVisible())
_keyboard->render();
_keyboard->setClean();
-
+
_masterGuRenderer.guPostRender();
return true; // rendered successfully
diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h
index 5176bee3fe..38c43d60a3 100644
--- a/backends/platform/psp/display_manager.h
+++ b/backends/platform/psp/display_manager.h
@@ -72,7 +72,7 @@ private:
*/
class MasterGuRenderer : public PspThreadable {
public:
- MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true),
+ MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true),
_renderSema(1, 1), _callbackId(-1) {}
void guInit();
void guPreRender();
@@ -108,7 +108,7 @@ public:
KEEP_ASPECT_RATIO,
STRETCHED_FULL_SCREEN
};
- DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
+ DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
_imageViewer(0), _lastUpdateTime(0), _graphicsMode(0) {}
~DisplayManager();
@@ -127,7 +127,7 @@ public:
void setOverlay(Overlay *overlay) { _overlay = overlay; }
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
void setImageViewer(ImageViewer *imageViewer) { _imageViewer = imageViewer; }
-
+
void setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format);
// Getters
diff --git a/backends/platform/psp/dummy.cpp b/backends/platform/psp/dummy.cpp
index 86ab30b3e2..748ac8cbf3 100644
--- a/backends/platform/psp/dummy.cpp
+++ b/backends/platform/psp/dummy.cpp
@@ -26,31 +26,31 @@
#include <stdio.h>
#include <png.h>
#include <sys/socket.h>
-
+
//void userWriteFn(png_structp png_ptr, png_bytep data, png_size_t length) {
//}
//void userFlushFn(png_structp png_ptr) {
//}
-
+
// Dummy functions are pulled in so that we don't need to build the plugins with certain libs
-
+
int dummyFunc() {
// For Broken Sword 2.5
volatile int i;
i = clock();
rename("dummyA", "dummyB");
-
+
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_set_write_fn(png_ptr, NULL, NULL, NULL);
png_infop info_ptr;
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
png_destroy_write_struct(&png_ptr, &info_ptr);
-
+
// For lua's usage of libc: very heavy usage so it pulls in sockets?
setsockopt(0, 0, 0, NULL, 0);
getsockopt(0, 0, 0, NULL, NULL);
-
+
return i;
} \ No newline at end of file
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index 97d582b63a..1ed7698bc8 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -34,45 +34,45 @@
#include "backends/platform/psp/input.h"
#include "backends/platform/psp/display_manager.h"
#include "backends/platform/psp/display_client.h"
-#include "backends/platform/psp/image_viewer.h"
-#include "backends/platform/psp/png_loader.h"
+#include "backends/platform/psp/image_viewer.h"
+#include "backends/platform/psp/png_loader.h"
#include "backends/platform/psp/thread.h"
static const char *imageName = "psp_image";
#define PSP_SCREEN_HEIGHT 272
#define PSP_SCREEN_WIDTH 480
-
+
bool ImageViewer::load(int imageNum) {
if (_init)
unload();
-
+
// build string
char number[8];
sprintf(number, "%d", imageNum);
- Common::String imageNameStr(imageName);
+ Common::String imageNameStr(imageName);
Common::String specificImageName = imageNameStr + Common::String(number) + Common::String(".png");
-
+
// search for image file
if (!SearchMan.hasFile(specificImageName)) {
PSP_ERROR("file %s not found\n", specificImageName.c_str());
return false;
}
-
+
Common::ScopedPtr<Common::SeekableReadStream> file(SearchMan.createReadStreamForMember(specificImageName));
-
+
_buffer = new Buffer();
_palette = new Palette();
_renderer = new GuRenderer();
-
+
assert(_buffer);
assert(_palette);
assert(_renderer);
-
+
// Load a PNG into our buffer and palette. Size it by the actual size of the image
PngLoader image(file, *_buffer, *_palette, Buffer::kSizeBySourceSize);
-
+
PngLoader::Status status = image.allocate(); // allocate the buffers for the file
-
+
char error[100];
if (status == PngLoader::BAD_FILE) {
sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
@@ -89,29 +89,29 @@ bool ImageViewer::load(int imageNum) {
if (!image.load()) {
sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
GUI::TimedMessageDialog dialog(error, 4000);
- dialog.runModal();
+ dialog.runModal();
return false;
}
-
+
setConstantRendererOptions();
setFullScreenImageParams(); // prepare renderer for full screen view
-
+
_imageNum = imageNum; // now we can say we displayed this image
_init = true;
-
+
return true;
}
void ImageViewer::setConstantRendererOptions() {
_renderer->setBuffer(_buffer);
_renderer->setPalette(_palette);
-
+
_renderer->setAlphaBlending(false);
_renderer->setColorTest(false);
_renderer->setUseGlobalScaler(false);
_renderer->setStretch(true);
_renderer->setOffsetInBuffer(0, 0);
- _renderer->setDrawWholeBuffer();
+ _renderer->setDrawWholeBuffer();
}
void ImageViewer::unload() {
@@ -130,32 +130,32 @@ void ImageViewer::resetOnEngineDone() {
void ImageViewer::setVisible(bool visible) {
DEBUG_ENTER_FUNC();
-
+
if (_visible == visible)
return;
-
+
// from here on, we're making the loader visible
if (visible && g_engine) { // we can only run the image viewer when there's an engine
g_engine->pauseEngine(true);
-
+
load(_imageNum ? _imageNum : 1); // load the 1st image or the current
}
if (visible && _init) { // we managed to load
_visible = true;
setViewerButtons(true);
-
+
{ // so dialog goes out of scope, destroying all allocations
GUI::TimedMessageDialog dialog("Image Viewer", 1000);
dialog.runModal();
}
-
+
runLoop(); // only listen to viewer events
} else { // we were asked to make invisible or failed to load
_visible = false;
unload();
setViewerButtons(false);
-
+
if (g_engine && g_engine->isPaused())
g_engine->pauseEngine(false);
}
@@ -175,7 +175,7 @@ void ImageViewer::runLoop() {
void ImageViewer::setViewerButtons(bool active) {
_inputHandler->setImageViewerMode(active);
-}
+}
void ImageViewer::loadNextImage() {
if (!load(_imageNum+1)) { // try to load the next image
@@ -190,21 +190,21 @@ void ImageViewer::loadLastImage() {
if (!load(_imageNum-1))
if (!load(_imageNum))
setVisible(false); // we can't even show the old image so hide
- }
+ }
setDirty();
}
void ImageViewer::setFullScreenImageParams() {
// we try to fit the image fullscreen at least in one dimension
uint32 width = _buffer->getSourceWidth();
- uint32 height = _buffer->getSourceHeight();
+ uint32 height = _buffer->getSourceHeight();
_centerX = PSP_SCREEN_WIDTH / 2.0f;
_centerY = PSP_SCREEN_HEIGHT / 2.0f;
-
+
// see if we fit width wise
if (PSP_SCREEN_HEIGHT >= (int)((height * PSP_SCREEN_WIDTH) / (float)width)) {
- setZoom(PSP_SCREEN_WIDTH / (float)width);
+ setZoom(PSP_SCREEN_WIDTH / (float)width);
} else {
setZoom(PSP_SCREEN_HEIGHT / (float)height);
}
@@ -233,32 +233,32 @@ void ImageViewer::render() {
break;
}
_renderer->render();
- }
+ }
}
void ImageViewer::modifyZoom(bool up) {
float factor = _zoomFactor;
- if (up)
+ if (up)
factor += 0.1f;
else // down
factor -= 0.1f;
-
- setZoom(factor);
+
+ setZoom(factor);
}
-void ImageViewer::setZoom(float value) {
+void ImageViewer::setZoom(float value) {
if (value <= 0.0f) // don't want 0 or negative zoom
return;
_zoomFactor = value;
- _renderer->setStretchXY(value, value);
+ _renderer->setStretchXY(value, value);
setOffsetParams();
}
void ImageViewer::moveImageX(float val) {
float newVal = _centerX + val;
-
- if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4)
+
+ if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4)
return;
_centerX = newVal;
setOffsetParams();
@@ -266,22 +266,22 @@ void ImageViewer::moveImageX(float val) {
void ImageViewer::moveImageY(float val) {
float newVal = _centerY + val;
-
- if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4)
+
+ if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4)
return;
_centerY = newVal;
setOffsetParams();
}
-// Set the renderer with the proper offset on the screen
+// Set the renderer with the proper offset on the screen
//
void ImageViewer::setOffsetParams() {
_visibleWidth = _zoomFactor * _buffer->getSourceWidth();
- _visibleHeight = _zoomFactor * _buffer->getSourceHeight();
-
+ _visibleHeight = _zoomFactor * _buffer->getSourceHeight();
+
int offsetX = _centerX - (int)(_visibleWidth * 0.5f);
int offsetY = _centerY - (int)(_visibleHeight * 0.5f);
-
+
_renderer->setOffsetOnScreen(offsetX, offsetY);
setDirty();
}
@@ -290,8 +290,8 @@ void ImageViewer::setOffsetParams() {
//
void ImageViewer::handleEvent(uint32 event) {
DEBUG_ENTER_FUNC();
-
- switch (event) {
+
+ switch (event) {
case EVENT_HIDE:
setVisible(false);
break;
diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h
index 4c3eaf7b4a..ad188536a3 100644
--- a/backends/platform/psp/image_viewer.h
+++ b/backends/platform/psp/image_viewer.h
@@ -54,10 +54,10 @@ private:
float _visibleHeight, _visibleWidth;
float _centerX, _centerY;
Event _movement;
-
+
InputHandler *_inputHandler;
DisplayManager *_displayManager;
-
+
void setFullScreenImageParams();
void loadNextImage();
void loadLastImage();
@@ -66,19 +66,19 @@ private:
void moveImageX(float val);
void moveImageY(float val);
bool load(int imageNum);
- void unload();
+ void unload();
void runLoop(); // to get total pausing we have to do our own loop
-
+
void setZoom(float value);
void setOffsetParams();
void modifyZoom(bool up); // up or down
void setVisible(bool visible);
-
+
public:
- ImageViewer() : _buffer(0), _palette(0), _visible(false),
- _dirty(false), _init(false), _imageNum(0),
- _zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
+ ImageViewer() : _buffer(0), _palette(0), _visible(false),
+ _dirty(false), _init(false), _imageNum(0),
+ _zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
_centerX(0.0f), _centerY(0.0f), _movement(EVENT_MOVE_STOP),
_inputHandler(0), _displayManager(0) {}
~ImageViewer() { unload(); } // deallocate images
@@ -88,15 +88,15 @@ public:
bool isDirty() { return _dirty; }
void setDirty() { _dirty = true; }
void setClean() { if (!_visible) // otherwise we want to keep rendering
- _dirty = false;
- }
+ _dirty = false;
+ }
void resetOnEngineDone();
-
+
void handleEvent(uint32 event);
-
+
// pointer setters
- void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
+ void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
void setDisplayManager(DisplayManager *displayManager) { _displayManager = displayManager; }
};
-#endif /* PSP_IMAGE_VIEWER_H */ \ No newline at end of file
+#endif /* PSP_IMAGE_VIEWER_H */ \ No newline at end of file
diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp
index 17f8954e3b..a9ad441b4d 100644
--- a/backends/platform/psp/input.cpp
+++ b/backends/platform/psp/input.cpp
@@ -198,7 +198,7 @@ bool ButtonPad::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &
uint32 curButtonState = PSP_ALL_BUTTONS & pad.Buttons; // we only care about these
if (_combosEnabled)
- modifyButtonsForCombos(pad); // change buttons for combos
+ modifyButtonsForCombos(pad); // change buttons for combos
return getEventFromButtonState(event, pspEvent, curButtonState);
}
@@ -460,7 +460,7 @@ bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
/*case PSP_EVENT_CHANGE_SPEED:
handleSpeedChange(pspEvent.data);
break;*/
- case PSP_EVENT_IMAGE_VIEWER:
+ case PSP_EVENT_IMAGE_VIEWER:
_imageViewer->handleEvent(pspEvent.data);
break;
case PSP_EVENT_IMAGE_VIEWER_SET_BUTTONS:
@@ -530,7 +530,7 @@ void InputHandler::setImageViewerMode(bool active) {
_nub.init();
_buttonPad.enableCombos(true); // re-enable combos
_buttonPad.initButtons();
- }
+ }
}
void InputHandler::setButtonsForImageViewer() {
@@ -538,32 +538,32 @@ void InputHandler::setButtonsForImageViewer() {
// Dpad
_buttonPad.clearButtons();
- _buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN,
+ _buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT,
+ _buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE,
+ _buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE,
- PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ _buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ _buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ _buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ _buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
PSP_EVENT_NONE, false);
//Nub
_nub.getPad().clearButtons();
- _nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP,
+ _nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP,
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
- _nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN,
+ _nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN,
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
- _nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT,
+ _nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT,
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
- _nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT,
+ _nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT,
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
}
diff --git a/backends/platform/psp/input.h b/backends/platform/psp/input.h
index 8315a3766c..ef2e1b84a4 100644
--- a/backends/platform/psp/input.h
+++ b/backends/platform/psp/input.h
@@ -122,16 +122,16 @@ public:
ButtonPad();
void initButtons(); // set the buttons to the mode that's selected
void clearButtons(); // empty the buttons of all events
-
+
bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad);
bool getEventFromButtonState(Common::Event &event, PspEvent &pspEvent, uint32 buttonState);
-
+
void setShifted(ShiftMode shifted) { _shifted = shifted; }
void setPadMode(PspPadMode mode) { _padMode = mode; }
bool isButtonDown() { return _prevButtonState; }
-
+
void enableCombos(bool value) { _combosEnabled = value; }
- Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; }
+ Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; }
};
class Nub {
@@ -140,17 +140,17 @@ private:
ShiftMode _shifted;
bool _dpadMode;
-
+
ButtonPad _buttonPad; // private buttonpad for dpad mode
-
+
int32 modifyNubAxisMotion(int32 input);
void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data
public:
Nub() : _shifted(UNSHIFTED), _dpadMode(false) { }
- void init() { _buttonPad.initButtons(); }
+ void init() { _buttonPad.initButtons(); }
void setCursor(Cursor *cursor) { _cursor = cursor; }
-
+
// setters
void setDpadMode(bool active) { _dpadMode = active; }
void setShifted(ShiftMode shifted) { _shifted = shifted; }
@@ -163,7 +163,7 @@ public:
class InputHandler {
public:
- InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
+ InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
_lastPadCheckTime(0) {}
// pointer setters
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
@@ -175,7 +175,7 @@ public:
void setImageViewerMode(bool active);
private:
- Nub _nub;
+ Nub _nub;
ButtonPad _buttonPad;
// Pointers to relevant other classes
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 4408cbf481..5fa5110684 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -20,8 +20,7 @@
*
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <pspuser.h>
#include <pspgu.h>
@@ -84,14 +83,14 @@ void OSystem_PSP::initBackend() {
_inputHandler.setKeyboard(&_keyboard);
_inputHandler.setImageViewer(&_imageViewer);
_inputHandler.init();
-
+
// Set pointers for image viewer
_imageViewer.setInputHandler(&_inputHandler);
_imageViewer.setDisplayManager(&_displayManager);
- _savefile = new PSPSaveFileManager;
+ _savefileManager = new PSPSaveFileManager;
- _timer = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
PSP_DEBUG_PRINT("calling keyboard.load()\n");
_keyboard.load(); // Load virtual keyboard files into memory
@@ -100,7 +99,7 @@ void OSystem_PSP::initBackend() {
setupMixer();
- BaseBackend::initBackend();
+ EventsBaseBackend::initBackend();
}
// Let's us know an engine
@@ -422,7 +421,15 @@ void OSystem_PSP::quit() {
}
void OSystem_PSP::logMessage(LogMessageType::Type type, const char *message) {
- BaseBackend::logMessage(type, message);
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
if (type == LogMessageType::kError)
PspDebugTrace(false, "%s", message); // write to file
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 4f1d6f2fa7..e6b445e232 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -42,12 +42,10 @@
#include "backends/timer/psp/timer.h"
#include "backends/platform/psp/thread.h"
-class OSystem_PSP : public BaseBackend, public PaletteManager {
+class OSystem_PSP : public EventsBaseBackend, public PaletteManager {
private:
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- Common::TimerManager *_timer;
bool _pendingUpdate; // save an update we couldn't perform
uint32 _pendingUpdateCounter; // prevent checking for pending update too often, in a cheap way
@@ -63,7 +61,7 @@ private:
ImageViewer _imageViewer;
public:
- OSystem_PSP() : _savefile(0), _mixer(0), _timer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {}
+ OSystem_PSP() : _mixer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {}
~OSystem_PSP();
static OSystem *instance();
@@ -133,7 +131,6 @@ public:
// Timer
typedef int (*TimerProc)(int interval);
void setTimerCallback(TimerProc callback, int interval);
- Common::TimerManager *getTimerManager() { return _timer; }
// Mutex
MutexRef createMutex(void);
@@ -147,7 +144,6 @@ public:
Audio::Mixer *getMixer() { return _mixer; }
// Misc
- Common::SaveFileManager *getSavefileManager() { return _savefile; }
FilesystemFactory *getFilesystemFactory() { return &PSPFilesystemFactory::instance(); }
void getTimeAndDate(TimeDate &t) const;
virtual void engineDone();
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index 2f4857569e..16377539c8 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -36,7 +36,7 @@
PngLoader::Status PngLoader::allocate() {
DEBUG_ENTER_FUNC();
-
+
if (!findImageDimensions()) {
PSP_ERROR("failed to get image dimensions\n");
return BAD_FILE;
@@ -45,7 +45,7 @@ PngLoader::Status PngLoader::allocate() {
_buffer->setSize(_width, _height, _sizeBy);
uint32 bitsPerPixel = _bitDepth * _channels;
-
+
if (_paletteSize) { // 8 or 4-bit image
if (bitsPerPixel == 4) {
_buffer->setPixelFormat(PSPPixelFormat::Type_Palette_4bit);
@@ -130,7 +130,7 @@ bool PngLoader::basicImageLoad() {
png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth,
&_colorType, &interlaceType, int_p_NULL, int_p_NULL);
_channels = png_get_channels(_pngPtr, _infoPtr);
-
+
if (_colorType & PNG_COLOR_MASK_PALETTE)
_paletteSize = _infoPtr->num_palette;
@@ -141,7 +141,7 @@ bool PngLoader::basicImageLoad() {
bool PngLoader::findImageDimensions() {
DEBUG_ENTER_FUNC();
- bool status = basicImageLoad();
+ bool status = basicImageLoad();
PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], channels[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _channels, _infoPtr->rowbytes);
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
@@ -157,7 +157,7 @@ bool PngLoader::loadImageIntoBuffer() {
if (!basicImageLoad()) {
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
return false;
- }
+ }
png_set_strip_16(_pngPtr); // Strip off 16 bit channels in case they occur
if (_paletteSize) {
@@ -178,16 +178,16 @@ bool PngLoader::loadImageIntoBuffer() {
}
uint32 rowBytes = png_get_rowbytes(_pngPtr, _infoPtr);
-
- // there seems to be a bug in libpng where it doesn't increase the rowbytes or the
+
+ // there seems to be a bug in libpng where it doesn't increase the rowbytes or the
// channel even after we add the alpha channel
if (_channels == 3 && (rowBytes / _width) == 3) {
_channels = 4;
- rowBytes = _width * _channels;
- }
-
+ rowBytes = _width * _channels;
+ }
+
PSP_DEBUG_PRINT("rowBytes[%d], channels[%d]\n", rowBytes, _channels);
-
+
unsigned char *line = (unsigned char*) malloc(rowBytes);
if (!line) {
png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
diff --git a/backends/platform/psp/png_loader.h b/backends/platform/psp/png_loader.h
index 616a79405e..0ff9d8a65d 100644
--- a/backends/platform/psp/png_loader.h
+++ b/backends/platform/psp/png_loader.h
@@ -61,7 +61,7 @@ public:
Buffer::HowToSize sizeBy = Buffer::kSizeByTextureSize) :
_file(file), _buffer(&buffer), _palette(&palette),
_width(0), _height(0), _paletteSize(0),
- _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0),
+ _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0),
_infoPtr(0), _colorType(0), _channels(0) {}
PngLoader::Status allocate();
diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp
index 373e00415b..b799b4e870 100644
--- a/backends/platform/psp/trace.cpp
+++ b/backends/platform/psp/trace.cpp
@@ -75,38 +75,38 @@ void PspDebugTrace(bool alsoToScreen, const char *format, ...) {
#define GET_RET(retAddr) \
asm volatile ("move %0,$ra\n\t" \
: "=&r" (retAddr) : )
-
+
#define GET_SP(stackPtr) \
asm volatile ("move %0,$sp\n\t" \
: "=&r" (stackPtr) : )
// Function to retrieve a backtrace for the MIPS processor
-// This is not trivial since the MIPS doesn't use a frame pointer.
+// This is not trivial since the MIPS doesn't use a frame pointer.
// Takes the number of levels wanted above the calling function (included) and an array of void *
-//
+//
void mipsBacktrace(uint32 levels, void **addresses) {
- // get the current return address
+ // get the current return address
register byte *retAddr;
register byte *stackPointer;
- GET_RET(retAddr);
+ GET_RET(retAddr);
GET_SP(stackPointer);
char string[100];
-
+
if (!levels)
return;
-
+
memset(addresses, 0, sizeof(void *) * levels);
-
+
uint32 curLevel = 0;
-
+
const uint32 SP_SUBTRACT = 0x27bd8000; // The instruction to subtract from the SP looks like this
const uint32 SP_SUB_HIGH_MASK = 0xffff8000; // The mask to check for the subtract SP instruction
const uint32 SP_SUB_LOW_MASK = 0x0000ffff; // The mask that gives us how much was subtracted
-
+
// make sure we go out of the stack of this current level
// we already have the return address for this level from the register
if (curLevel < levels) {
- void *thisFunc = (void *)mipsBacktrace;
+ void *thisFunc = (void *)mipsBacktrace;
for (uint32 *seekPtr = (uint32 *)thisFunc; ; seekPtr++) {
if ((*seekPtr & SP_SUB_HIGH_MASK) == SP_SUBTRACT) {
// we found the $sp subtraction at the beginning of the function
@@ -120,10 +120,10 @@ void mipsBacktrace(uint32 levels, void **addresses) {
fputs(string, stderr);
}
break;
- }
- }
+ }
+ }
}
-
+
// keep scanning while more levels are requested
while (curLevel < levels) {
// now scan backwards from the return address to find the size of the stack
@@ -139,13 +139,13 @@ void mipsBacktrace(uint32 levels, void **addresses) {
sprintf(string, "invalid retAddr %p\n", retAddr);
fputs(string, stderr);
return;
- }
+ }
//sprintf(string, "retAddr[%p]\n", retAddr);
//fputs(string, stderr);
addresses[curLevel++] = retAddr;
break;
- }
- }
+ }
+ }
}
-}
+}
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 9b11eb2c09..817f61e864 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -74,7 +74,7 @@ void OSystem_MacOSX::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
}
void OSystem_MacOSX::setupIcon() {
- // Don't set icon on OS X, as we use a nicer external icon there.
+ // Don't set icon on OS X, as we use a nicer external icon there.
}
bool OSystem_MacOSX::hasFeature(Feature f) {
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/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index d757186134..05c779a4e0 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -33,6 +33,7 @@
#include "backends/platform/sdl/posix/posix.h"
#include "backends/saves/posix/posix-saves.h"
#include "backends/fs/posix/posix-fs-factory.h"
+#include "backends/taskbar/unity/unity-taskbar.h"
#include <errno.h>
#include <sys/stat.h>
@@ -49,6 +50,11 @@ void OSystem_POSIX::init() {
// Initialze File System Factory
_fsFactory = new POSIXFilesystemFactory();
+#if defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
+ // Initialize taskbar manager
+ _taskbarManager = new UnityTaskbarManager();
+#endif
+
// Invoke parent implementation of this method
OSystem_SDL::init();
}
@@ -60,6 +66,11 @@ void OSystem_POSIX::initBackend() {
// Invoke parent implementation of this method
OSystem_SDL::initBackend();
+
+#if defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
+ // Register the taskbar manager as an event source (this is necessary for the glib event loop to be run)
+ _eventManager->getEventDispatcher()->registerSource((UnityTaskbarManager *)_taskbarManager, false);
+#endif
}
bool OSystem_POSIX::hasFeature(Feature f) {
diff --git a/backends/platform/gp2x/gp2x-main.cpp b/backends/platform/sdl/ps3/ps3-main.cpp
index f1ee5ed5f3..ba548a3749 100644
--- a/backends/platform/gp2x/gp2x-main.cpp
+++ b/backends/platform/sdl/ps3/ps3-main.cpp
@@ -20,19 +20,20 @@
*
*/
-#include "backends/platform/gp2x/gp2x-common.h"
+#include "common/scummsys.h"
+
+#include "backends/platform/sdl/ps3/ps3.h"
#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
-#if defined(GP2X)
int main(int argc, char *argv[]) {
// Create our OSystem instance
- g_system = new OSystem_GP2X();
+ g_system = new OSystem_PS3();
assert(g_system);
// Pre initialize the backend
- ((OSystem_GP2X *)g_system)->init();
+ ((OSystem_PS3 *)g_system)->init();
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new SDLPluginProvider());
@@ -42,9 +43,7 @@ int main(int argc, char *argv[]) {
int res = scummvm_main(argc, argv);
// Free OSystem
- delete (OSystem_GP2X *)g_system;
+ delete (OSystem_PS3 *)g_system;
return res;
}
-
-#endif
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/gp2x/gp2x-common.h b/backends/platform/sdl/ps3/ps3.h
index 7efdd7164c..daed7599a9 100644
--- a/backends/platform/gp2x/gp2x-common.h
+++ b/backends/platform/sdl/ps3/ps3.h
@@ -20,30 +20,28 @@
*
*/
-#ifndef PLATFORM_SDL_GP2X_H
-#define PLATFORM_SDL_GP2X_H
+#ifndef PLATFORM_SDL_PS3_H
+#define PLATFORM_SDL_PS3_H
-#include "backends/base-backend.h"
#include "backends/platform/sdl/sdl.h"
-#include "backends/platform/sdl/posix/posix.h"
-#include "backends/graphics/gp2xsdl/gp2xsdl-graphics.h"
-#include "backends/events/gp2xsdl/gp2xsdl-events.h"
-#ifndef PATH_MAX
- #define PATH_MAX 255
-#endif
-
-class OSystem_GP2X : public OSystem_POSIX {
+class OSystem_PS3 : public OSystem_SDL {
public:
- OSystem_GP2X() {}
+ // Let the subclasses be able to change _baseConfigName in the constructor
+ OSystem_PS3(Common::String baseConfigName = "scummvm.ini");
+ virtual ~OSystem_PS3() {}
- void initBackend();
- void quit();
- void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- void initSDL();
+ 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 77515ff4e5..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
@@ -47,8 +57,19 @@ typedef struct { int FAKE; } FAKE_FILE;
// Finally forbid FILE again (if it was forbidden to start with)
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_FILE)
-#undef FILE
+#undef 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 afc6c850d9..d05cca4d1f 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -31,14 +31,22 @@
#include "backends/platform/sdl/sdl.h"
#include "common/config-manager.h"
#include "common/EventRecorder.h"
+#include "common/taskbar.h"
#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"
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
#ifdef USE_OPENGL
#include "backends/graphics/openglsdl/openglsdl-graphics.h"
#endif
@@ -125,6 +133,11 @@ void OSystem_SDL::init() {
if (_timerManager == 0)
_timerManager = new SdlTimerManager();
+#if defined(USE_TASKBAR)
+ if (_taskbarManager == 0)
+ _taskbarManager = new Common::TaskbarManager();
+#endif
+
#ifdef USE_OPENGL
// Setup a list with both SDL and OpenGL graphics modes
setupGraphicsModes();
@@ -167,27 +180,11 @@ void OSystem_SDL::initBackend() {
}
#endif
if (_graphicsManager == 0) {
- _graphicsManager = new SdlGraphicsManager(_eventSource);
+ _graphicsManager = new SurfaceSdlGraphicsManager(_eventSource);
graphicsManagerType = 0;
}
}
- // Creates the backend managers, if they don't exist yet (we check
- // for this to allow subclasses to provide their own).
- if (_eventManager == 0)
- _eventManager = new DefaultEventManager(_eventSource);
-
- // We have to initialize the graphics manager before the event manager
- // so the virtual keyboard can be initialized, but we have to add the
- // graphics manager as an event observer after initializing the event
- // manager.
- if (graphicsManagerType == 0)
- ((SdlGraphicsManager *)_graphicsManager)->initEventObserver();
-#ifdef USE_OPENGL
- else if (graphicsManagerType == 1)
- ((OpenGLSdlGraphicsManager *)_graphicsManager)->initEventObserver();
-#endif
-
if (_savefileManager == 0)
_savefileManager = new DefaultSaveFileManager();
@@ -198,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();
@@ -207,7 +211,34 @@ void OSystem_SDL::initBackend() {
_inited = true;
ModularBackend::initBackend();
+
+ // We have to initialize the graphics manager before the event manager
+ // so the virtual keyboard can be initialized, but we have to add the
+ // graphics manager as an event observer after initializing the event
+ // manager.
+ if (graphicsManagerType == 0)
+ ((SurfaceSdlGraphicsManager *)_graphicsManager)->initEventObserver();
+#ifdef USE_OPENGL
+ else if (graphicsManagerType == 1)
+ ((OpenGLSdlGraphicsManager *)_graphicsManager)->initEventObserver();
+#endif
+
+}
+
+#if defined(USE_TASKBAR)
+void OSystem_SDL::engineInit() {
+ // Add the started engine to the list of recent tasks
+ _taskbarManager->addRecent(ConfMan.getActiveDomainName(), ConfMan.get("description"));
+
+ // Set the overlay icon the current running engine
+ _taskbarManager->setOverlayIcon(ConfMan.getActiveDomainName(), ConfMan.get("description"));
+}
+
+void OSystem_SDL::engineDone() {
+ // Remove overlay icon
+ _taskbarManager->setOverlayIcon("", "");
}
+#endif
void OSystem_SDL::initSDL() {
// Check if SDL has not been initialized
@@ -275,10 +306,22 @@ void OSystem_SDL::fatalError() {
void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
- ModularBackend::logMessage(type, message);
+ // First log to stdout/stderr
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+
+ // Then log into file (via the logger)
if (_logger)
_logger->print(message);
+ // Finally, some Windows / WinCE specific logging code.
#if defined( USE_WINDBG )
#if defined( _WIN32_WCE )
TCHAR buf_unicode[1024];
@@ -301,7 +344,7 @@ void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
}
Common::String OSystem_SDL::getSystemLanguage() const {
-#ifdef USE_DETECTLANG
+#if defined(USE_DETECTLANG) && !defined(_WIN32_WCE)
#ifdef WIN32
// We can not use "setlocale" (at least not for MSVC builds), since it
// will return locales like: "English_USA.1252", thus we need a special
@@ -368,7 +411,7 @@ void OSystem_SDL::setupIcon() {
if (sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes) != 4) {
warning("Wrong format of scummvm_icon[0] (%s)", scummvm_icon[0]);
-
+
return;
}
if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) {
@@ -384,6 +427,7 @@ void OSystem_SDL::setupIcon() {
for (i = 0; i < ncols; i++) {
unsigned char code;
char color[32];
+ memset(color, 0, sizeof(color));
unsigned int col;
if (sscanf(scummvm_icon[1 + i], "%c c %s", &code, color) != 2) {
warning("Wrong format of scummvm_icon[%d] (%s)", 1 + i, scummvm_icon[1 + i]);
@@ -472,7 +516,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
// Check if mode is from SDL or OpenGL
if (mode < _sdlModesCount) {
- srcMode = SdlGraphicsManager::supportedGraphicsModes();
+ srcMode = SurfaceSdlGraphicsManager::supportedGraphicsModes();
i = 0;
} else {
srcMode = OpenGLSdlGraphicsManager::supportedGraphicsModes();
@@ -487,8 +531,8 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
if (_graphicsMode >= _sdlModesCount && mode < _sdlModesCount) {
debug(1, "switching to plain SDL graphics");
delete _graphicsManager;
- _graphicsManager = new SdlGraphicsManager(_eventSource);
- ((SdlGraphicsManager *)_graphicsManager)->initEventObserver();
+ _graphicsManager = new SurfaceSdlGraphicsManager(_eventSource);
+ ((SurfaceSdlGraphicsManager *)_graphicsManager)->initEventObserver();
_graphicsManager->beginGFXTransaction();
} else if (_graphicsMode < _sdlModesCount && mode >= _sdlModesCount) {
debug(1, "switching to OpenGL graphics");
@@ -514,7 +558,7 @@ int OSystem_SDL::getGraphicsMode() const {
}
void OSystem_SDL::setupGraphicsModes() {
- const OSystem::GraphicsMode *sdlGraphicsModes = SdlGraphicsManager::supportedGraphicsModes();
+ const OSystem::GraphicsMode *sdlGraphicsModes = SurfaceSdlGraphicsManager::supportedGraphicsModes();
const OSystem::GraphicsMode *openglGraphicsModes = OpenGLSdlGraphicsManager::supportedGraphicsModes();
_sdlModesCount = 0;
_glModesCount = 0;
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 917fac5558..395b2b3aac 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -30,7 +30,7 @@
#include "backends/events/sdl/sdl-events.h"
#include "backends/log/log.h"
-/**
+/**
* Base OSystem class for all SDL ports.
*/
class OSystem_SDL : public ModularBackend {
@@ -38,7 +38,7 @@ public:
OSystem_SDL();
virtual ~OSystem_SDL();
- /**
+ /**
* Pre-initialize backend. It should be called after
* instantiating the backend. Early needed managers are
* created here.
@@ -54,6 +54,10 @@ public:
// Override functions from ModularBackend and OSystem
virtual void initBackend();
+#if defined(USE_TASKBAR)
+ virtual void engineInit();
+ virtual void engineDone();
+#endif
virtual Common::HardwareKeySet *getHardwareKeySet();
virtual void quit();
virtual void fatalError();
@@ -91,6 +95,8 @@ protected:
*/
SdlEventSource *_eventSource;
+ virtual Common::EventSource *getDefaultEventSource() { return _eventSource; }
+
/**
* Initialze the SDL library.
*/
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 5b14be4417..420ed2465b 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -34,8 +34,11 @@
#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
#include <shellapi.h>
+#include <SDL_syswm.h> // For setting the icon
+
#include "backends/platform/sdl/win32/win32.h"
#include "backends/fs/windows/windows-fs-factory.h"
+#include "backends/taskbar/win32/win32-taskbar.h"
#include "common/memstream.h"
@@ -81,9 +84,14 @@ void OSystem_Win32::init() {
}
#endif
- // Initialze File System Factory
+ // Initialize File System Factory
_fsFactory = new WindowsFilesystemFactory();
+#if defined(USE_TASKBAR)
+ // Initialize taskbar manager
+ _taskbarManager = new Win32TaskbarManager();
+#endif
+
// Invoke parent implementation of this method
OSystem_SDL::init();
}
@@ -131,6 +139,28 @@ bool OSystem_Win32::displayLogFile() {
return false;
}
+void OSystem_Win32::setupIcon() {
+ HMODULE handle = GetModuleHandle(NULL);
+ HICON ico = LoadIcon(handle, MAKEINTRESOURCE(1001 /* IDI_ICON */));
+ if (ico) {
+ SDL_SysWMinfo wminfo;
+ SDL_VERSION(&wminfo.version);
+ if (SDL_GetWMInfo(&wminfo)) {
+ // Replace the handle to the icon associated with the window class by our custom icon
+ SetClassLongPtr(wminfo.window, GCLP_HICON, (ULONG_PTR)ico);
+
+ // Since there wasn't any default icon, we can't use the return value from SetClassLong
+ // to check for errors (it would be 0 in both cases: error or no previous value for the
+ // icon handle). Instead we check for the last-error code value.
+ if (GetLastError() == ERROR_SUCCESS)
+ return;
+ }
+ }
+
+ // If no icon has been set, fallback to default path
+ OSystem_SDL::setupIcon();
+}
+
Common::String OSystem_Win32::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
@@ -149,18 +179,31 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
error("Unable to access user profile directory");
strcat(configFile, "\\Application Data");
- CreateDirectory(configFile, NULL);
+
+ // If the directory already exists (as it should in most cases),
+ // we don't want to fail, but we need to stop on other errors (such as ERROR_PATH_NOT_FOUND)
+ if (!CreateDirectory(configFile, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create Application data folder");
+ }
}
strcat(configFile, "\\ScummVM");
- CreateDirectory(configFile, NULL);
+ if (!CreateDirectory(configFile, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create ScummVM application data folder");
+ }
+
strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
FILE *tmp = NULL;
if ((tmp = fopen(configFile, "r")) == NULL) {
// Check windows directory
char oldConfigFile[MAXPATHLEN];
- GetWindowsDirectory(oldConfigFile, MAXPATHLEN);
+ uint ret = GetWindowsDirectory(oldConfigFile, MAXPATHLEN);
+ if (ret == 0 || ret > MAXPATHLEN)
+ error("Cannot retrieve the path of the Windows directory");
+
strcat(oldConfigFile, "\\" DEFAULT_CONFIG_FILE);
if ((tmp = fopen(oldConfigFile, "r"))) {
strcpy(configFile, oldConfigFile);
@@ -172,7 +215,10 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
}
} else {
// Check windows directory
- GetWindowsDirectory(configFile, MAXPATHLEN);
+ uint ret = GetWindowsDirectory(configFile, MAXPATHLEN);
+ if (ret == 0 || ret > MAXPATHLEN)
+ error("Cannot retrieve the path of the Windows directory");
+
strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
}
@@ -300,7 +346,7 @@ Common::SeekableReadStream *Win32ResourceArchive::createReadStreamForMember(cons
} // End of anonymous namespace
void OSystem_Win32::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
- s.add("Win32Res", new Win32ResourceArchive());
+ s.add("Win32Res", new Win32ResourceArchive(), priority);
OSystem_SDL::addSysArchivesToSearchSet(s, priority);
}
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index ef7b6af3f1..cc2fc51d36 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -46,6 +46,7 @@ protected:
*/
Common::String _logFilePath;
+ virtual void setupIcon();
virtual Common::String getDefaultConfigFileName();
virtual Common::WriteStream *createLogFile();
};
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp
index 9cccc81d19..b1bd976f9e 100644
--- a/backends/platform/symbian/src/SymbianOS.cpp
+++ b/backends/platform/symbian/src/SymbianOS.cpp
@@ -57,7 +57,7 @@ char *GetExecutablePath() {
OSystem_SDL_Symbian::OSystem_SDL_Symbian()
:
_RFs(0) {
-
+
}
void OSystem_SDL_Symbian::init() {
@@ -171,7 +171,7 @@ Common::String OSystem_SDL_Symbian::getDefaultConfigFileName() {
}
void OSystem_SDL_Symbian::setupIcon() {
- // Don't for Symbian: it uses the EScummVM.aif file for the icon.
+ // Don't for Symbian: it uses the EScummVM.aif file for the icon.
}
RFs& OSystem_SDL_Symbian::FsSession() {
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index c16578d9b3..258a782cc4 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -19,11 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
-#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <unistd.h>
@@ -34,6 +30,8 @@
#include "common/config-manager.h"
#include "common/textconsole.h"
#include "backends/fs/wii/wii-fs-factory.h"
+#include "backends/saves/default/default-saves.h"
+#include "backends/timer/default/default-timer.h"
#include "osystem.h"
#include "options.h"
@@ -96,20 +94,12 @@ OSystem_Wii::OSystem_Wii() :
_padSensitivity(16),
_padAcceleration(4),
- _savefile(NULL),
- _mixer(NULL),
- _timer(NULL) {
+ _mixer(NULL) {
}
OSystem_Wii::~OSystem_Wii() {
- delete _savefile;
- _savefile = NULL;
-
delete _mixer;
_mixer = NULL;
-
- delete _timer;
- _timer = NULL;
}
void OSystem_Wii::initBackend() {
@@ -143,14 +133,14 @@ void OSystem_Wii::initBackend() {
if (!getcwd(buf, MAXPATHLEN))
strcpy(buf, "/");
- _savefile = new DefaultSaveFileManager(buf);
- _timer = new DefaultTimerManager();
+ _savefileManager = new DefaultSaveFileManager(buf);
+ _timerManager = new DefaultTimerManager();
initGfx();
initSfx();
initEvents();
- BaseBackend::initBackend();
+ EventsBaseBackend::initBackend();
}
void OSystem_Wii::quit() {
@@ -261,21 +251,11 @@ void OSystem_Wii::setWindowCaption(const char *caption) {
printf("window caption: %s\n", caption);
}
-Common::SaveFileManager *OSystem_Wii::getSavefileManager() {
- assert(_savefile);
- return _savefile;
-}
-
Audio::Mixer *OSystem_Wii::getMixer() {
assert(_mixer);
return _mixer;
}
-Common::TimerManager *OSystem_Wii::getTimerManager() {
- assert(_timer);
- return _timer;
-}
-
FilesystemFactory *OSystem_Wii::getFilesystemFactory() {
return &WiiFilesystemFactory::instance();
}
@@ -307,6 +287,18 @@ void OSystem_Wii::showOptionsDialog() {
_padAcceleration = 9 - ConfMan.getInt("wii_pad_acceleration");
}
+void OSystem_Wii::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
#ifndef GAMECUBE
Common::String OSystem_Wii::getSystemLanguage() const {
const char *wiiCountries[] = {
@@ -377,7 +369,7 @@ Common::String OSystem_Wii::getSystemLanguage() const {
} else {
// This will only happen when new languages are added to the API.
warning("WII: Unknown system language: %d", langID);
- return BaseBackend::getSystemLanguage();
+ return EventsBaseBackend::getSystemLanguage();
}
}
#endif // !GAMECUBE
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 981b25f69c..64197f913a 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -32,8 +32,6 @@
#include "common/rect.h"
#include "common/events.h"
#include "backends/base-backend.h"
-#include "backends/saves/default/default-saves.h"
-#include "backends/timer/default/default-timer.h"
#include "graphics/colormasks.h"
#include "graphics/palette.h"
#include "graphics/surface.h"
@@ -54,7 +52,7 @@ extern void wii_memstats(void);
}
#endif
-class OSystem_Wii : public BaseBackend, public PaletteManager {
+class OSystem_Wii : public EventsBaseBackend, public PaletteManager {
private:
s64 _startup_time;
@@ -130,9 +128,7 @@ private:
void showOptionsDialog();
protected:
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
public:
enum {
@@ -211,12 +207,12 @@ public:
virtual void setWindowCaption(const char *caption);
- virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
- virtual Common::TimerManager *getTimerManager();
virtual FilesystemFactory *getFilesystemFactory();
virtual void getTimeAndDate(TimeDate &t) const;
+ virtual void logMessage(LogMessageType::Type type, const char *message);
+
#ifndef GAMECUBE
virtual Common::String getSystemLanguage() const;
#endif // GAMECUBE
diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp
index 8e51bbc673..389d3823e7 100644
--- a/backends/platform/wii/osystem_events.cpp
+++ b/backends/platform/wii/osystem_events.cpp
@@ -35,6 +35,7 @@
#endif
#include "common/config-manager.h"
+#include "backends/timer/default/default-timer.h"
#define TIMER_THREAD_STACKSIZE (1024 * 32)
#define TIMER_THREAD_PRIO 64
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 859e3a1395..443e738a4a 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -20,6 +20,7 @@
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_abort
#include <malloc.h>
diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp
index f2c461fcf9..194f855e98 100644
--- a/backends/platform/wince/CEActionsPocket.cpp
+++ b/backends/platform/wince/CEActionsPocket.cpp
@@ -137,6 +137,7 @@ void CEActionsPocket::initInstanceGame() {
bool is_tinsel = (gameid == "tinsel");
bool is_cruise = (gameid == "cruise");
bool is_made = (gameid == "made");
+ bool is_sci = (gameid == "sci");
GUI_Actions::initInstanceGame();
@@ -219,7 +220,7 @@ void CEActionsPocket::initInstanceGame() {
// Key bind method
_action_enabled[POCKET_ACTION_BINDKEYS] = true;
// Disable double-tap right-click for convenience
- if (is_tinsel || is_cruise)
+ if (is_tinsel || is_cruise || is_sci)
if (!ConfMan.hasKey("no_doubletap_rightclick")) {
ConfMan.setBool("no_doubletap_rightclick", true);
ConfMan.flushToDisk();
@@ -233,15 +234,15 @@ CEActionsPocket::~CEActionsPocket() {
bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
static bool keydialogrunning = false, quitdialog = false;
+ _graphicsMan = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager());
+
if (!pushed) {
switch (action) {
case POCKET_ACTION_RIGHTCLICK:
- //_CESystem->add_right_click(false);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
+ _graphicsMan->add_right_click(false);
return true;
case POCKET_ACTION_LEFTCLICK:
- //_CESystem->add_left_click(false);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
+ _graphicsMan->add_left_click(false);
return true;
case POCKET_ACTION_PAUSE:
case POCKET_ACTION_SAVE:
@@ -249,7 +250,6 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
case POCKET_ACTION_MULTI:
EventsBuffer::simulateKey(&_key_action[action], false);
return true;
-
}
return false;
}
@@ -271,55 +271,43 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
EventsBuffer::simulateKey(&_key_action[action], true);
return true;
case POCKET_ACTION_KEYBOARD:
- //_CESystem->swap_panel();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel();
+ _graphicsMan->swap_panel();
return true;
case POCKET_ACTION_HIDE:
- //_CESystem->swap_panel_visibility();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel_visibility();
+ _graphicsMan->swap_panel_visibility();
return true;
case POCKET_ACTION_SOUND:
_CESystem->swap_sound_master();
return true;
case POCKET_ACTION_RIGHTCLICK:
- //_CESystem->add_right_click(true);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
+ _graphicsMan->add_right_click(true);
return true;
case POCKET_ACTION_CURSOR:
- //_CESystem->swap_mouse_visibility();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_mouse_visibility();
+ _graphicsMan->swap_mouse_visibility();
return true;
case POCKET_ACTION_FREELOOK:
- //_CESystem->swap_freeLook();
- ((WINCESdlEventSource *)((OSystem_SDL *)g_system)->getEventManager())->swap_freeLook();
+ _graphicsMan->swap_freeLook();
return true;
case POCKET_ACTION_ZOOM_UP:
- //_CESystem->swap_zoom_up();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_zoom_up();
+ _graphicsMan->swap_zoom_up();
return true;
case POCKET_ACTION_ZOOM_DOWN:
- //_CESystem->swap_zoom_down();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_zoom_down();
+ _graphicsMan->swap_zoom_down();
return true;
case POCKET_ACTION_LEFTCLICK:
- //_CESystem->add_left_click(true);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
+ _graphicsMan->add_left_click(true);
return true;
case POCKET_ACTION_UP:
- //_CESystem->move_cursor_up();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
+ _graphicsMan->move_cursor_up();
return true;
case POCKET_ACTION_DOWN:
- //_CESystem->move_cursor_down();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
+ _graphicsMan->move_cursor_down();
return true;
case POCKET_ACTION_LEFT:
- //_CESystem->move_cursor_left();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
+ _graphicsMan->move_cursor_left();
return true;
case POCKET_ACTION_RIGHT:
- //_CESystem->move_cursor_right();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
+ _graphicsMan->move_cursor_right();
return true;
case POCKET_ACTION_QUIT:
if (!quitdialog) {
diff --git a/backends/platform/wince/CEActionsPocket.h b/backends/platform/wince/CEActionsPocket.h
index fd97c0b1df..e1f52b6b88 100644
--- a/backends/platform/wince/CEActionsPocket.h
+++ b/backends/platform/wince/CEActionsPocket.h
@@ -28,6 +28,7 @@
#include "common/str.h"
#include "gui/Key.h"
#include "gui/Actions.h"
+#include "backends/graphics/wincesdl/wincesdl-graphics.h"
#define POCKET_ACTION_VERSION 5
@@ -80,6 +81,7 @@ public:
~CEActionsPocket();
private:
CEActionsPocket(const Common::String &gameid);
+ WINCESdlGraphicsManager *_graphicsMan;
bool _right_click_needed;
bool _hide_toolbar_needed;
bool _zoom_needed;
diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp
index fdd52cfc26..c6456d3eb5 100644
--- a/backends/platform/wince/CEActionsSmartphone.cpp
+++ b/backends/platform/wince/CEActionsSmartphone.cpp
@@ -128,6 +128,7 @@ void CEActionsSmartphone::initInstanceGame() {
bool is_tinsel = (gameid == "tinsel");
bool is_cruise = (gameid == "cruise");
bool is_made = (gameid == "made");
+ bool is_sci = (gameid == "sci");
GUI_Actions::initInstanceGame();
@@ -185,7 +186,7 @@ void CEActionsSmartphone::initInstanceGame() {
// Bind keys
_action_enabled[SMARTPHONE_ACTION_BINDKEYS] = true;
// Disable double-tap right-click for convenience
- if (is_tinsel || is_cruise)
+ if (is_tinsel || is_cruise || is_sci)
if (!ConfMan.hasKey("no_doubletap_rightclick")) {
ConfMan.setBool("no_doubletap_rightclick", true);
ConfMan.flushToDisk();
@@ -199,15 +200,15 @@ CEActionsSmartphone::~CEActionsSmartphone() {
bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
static bool keydialogrunning = false, quitdialog = false;
+ _graphicsMan = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager());
+
if (!pushed) {
switch (action) {
case SMARTPHONE_ACTION_RIGHTCLICK:
- //_CESystem->add_right_click(false);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
+ _graphicsMan->add_right_click(false);
return true;
case SMARTPHONE_ACTION_LEFTCLICK:
- //_CESystem->add_left_click(false);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
+ _graphicsMan->add_left_click(false);
return true;
case SMARTPHONE_ACTION_SAVE:
case SMARTPHONE_ACTION_SKIP:
@@ -234,32 +235,25 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
EventsBuffer::simulateKey(&_key_action[action], true);
return true;
case SMARTPHONE_ACTION_RIGHTCLICK:
- //_CESystem->add_right_click(true);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
+ _graphicsMan->add_right_click(true);
return true;
case SMARTPHONE_ACTION_LEFTCLICK:
- //_CESystem->add_left_click(true);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
+ _graphicsMan->add_left_click(true);
return true;
case SMARTPHONE_ACTION_UP:
- //_CESystem->move_cursor_up();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
+ _graphicsMan->move_cursor_up();
return true;
case SMARTPHONE_ACTION_DOWN:
- //_CESystem->move_cursor_down();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
+ _graphicsMan->move_cursor_down();
return true;
case SMARTPHONE_ACTION_LEFT:
- //_CESystem->move_cursor_left();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
+ _graphicsMan->move_cursor_left();
return true;
case SMARTPHONE_ACTION_RIGHT:
- //_CESystem->move_cursor_right();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
+ _graphicsMan->move_cursor_right();
return true;
case SMARTPHONE_ACTION_ZONE:
- //_CESystem->switch_zone();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->switch_zone();
+ _graphicsMan->switch_zone();
return true;
case SMARTPHONE_ACTION_BINDKEYS:
if (!keydialogrunning) {
@@ -271,12 +265,10 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
}
return true;
case SMARTPHONE_ACTION_KEYBOARD:
- //_CESystem->swap_smartphone_keyboard();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_smartphone_keyboard();
+ _graphicsMan->swap_smartphone_keyboard();
return true;
case SMARTPHONE_ACTION_ROTATE:
- //_CESystem->smartphone_rotate_display();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->smartphone_rotate_display();
+ _graphicsMan->smartphone_rotate_display();
return true;
case SMARTPHONE_ACTION_QUIT:
if (!quitdialog) {
diff --git a/backends/platform/wince/CEActionsSmartphone.h b/backends/platform/wince/CEActionsSmartphone.h
index 5535ce1350..3da46d3923 100644
--- a/backends/platform/wince/CEActionsSmartphone.h
+++ b/backends/platform/wince/CEActionsSmartphone.h
@@ -28,6 +28,7 @@
#include "common/str.h"
#include "gui/Key.h"
#include "gui/Actions.h"
+#include "backends/graphics/wincesdl/wincesdl-graphics.h"
#define SMARTPHONE_ACTION_VERSION 5
@@ -68,6 +69,7 @@ public:
~CEActionsSmartphone();
private:
CEActionsSmartphone();
+ WINCESdlGraphicsManager *_graphicsMan;
bool _right_click_needed;
OSystem_WINCE3 *_CESystem;
};
diff --git a/backends/platform/wince/CELauncherDialog.cpp b/backends/platform/wince/CELauncherDialog.cpp
index 9c832dd585..dd6076e0af 100644
--- a/backends/platform/wince/CELauncherDialog.cpp
+++ b/backends/platform/wince/CELauncherDialog.cpp
@@ -24,6 +24,7 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "backends/platform/wince/wince-sdl.h"
+#include "backends/graphics/wincesdl/wincesdl-graphics.h"
#include "CELauncherDialog.h"
@@ -34,6 +35,7 @@
#include "gui/browser.h"
#include "gui/message.h"
#include "gui/ThemeEval.h"
+#include "gui/widgets/list.h"
#include "common/config-manager.h"
@@ -63,9 +65,13 @@ public:
};
CELauncherDialog::CELauncherDialog() : GUI::LauncherDialog() {
+ ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->reset_panel();
}
void CELauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ if ((cmd == 'STRT') || (cmd == kListItemActivatedCmd) || (cmd == kListItemDoubleClickedCmd)) {
+ ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->init_panel();
+ }
LauncherDialog::handleCommand(sender, cmd, data);
if (cmd == 'ABOU') {
CEAboutDialog about;
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index a53bc41667..ec222c6fc1 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -353,9 +353,9 @@ void drawError(char *error) {
}
// ********************************************************************************************
-static DefaultTimerManager *_int_timer = NULL;
static Uint32 timer_handler_wrapper(Uint32 interval) {
- _int_timer->handler();
+ DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager();
+ tm->handler();
return interval;
}
@@ -379,14 +379,15 @@ void OSystem_WINCE3::initBackend() {
((WINCESdlEventSource *)_eventSource)->init((WINCESdlGraphicsManager *)_graphicsManager);
- // Create the timer. CE SDL does not support multiple timers (SDL_AddTimer).
+ // Create the timer (but remove the timer manager from the SDL backend first).
+ // CE SDL does not support multiple timers (SDL_AddTimer).
// We work around this by using the SetTimer function, since we only use
// one timer in scummvm (for the time being)
- _timer = _int_timer = new DefaultTimerManager();
- //_timerID = NULL; // OSystem_SDL will call removetimer with this, it's ok
+ delete _timerManager;
+ _timerManager = new DefaultTimerManager();
SDL_SetTimer(10, &timer_handler_wrapper);
- // Chain init
+ // Call parent implementation of this method
OSystem_SDL::initBackend();
// Initialize global key mapping
@@ -397,9 +398,6 @@ void OSystem_WINCE3::initBackend() {
GUI_Actions::Instance()->saveMapping(); // write defaults
}
- // Call parent implementation of this method
- //OSystem_SDL::initBackend();
-
_inited = true;
}
@@ -443,14 +441,9 @@ OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(),
}
OSystem_WINCE3::~OSystem_WINCE3() {
- delete _fsFactory;
delete _mixer;
}
-FilesystemFactory *OSystem_WINCE3::getFilesystemFactory() {
- return _fsFactory;
-}
-
void OSystem_WINCE3::swap_sound_master() {
_soundMaster = !_soundMaster;
@@ -464,7 +457,7 @@ void OSystem_WINCE3::swap_sound_master() {
void OSystem_WINCE3::engineInit() {
check_mappings(); // called here to initialize virtual keys handling
- //update_game_settings();
+ ((WINCESdlGraphicsManager *)_graphicsManager)->update_game_settings();
// finalize mixer init
_mixerManager->init();
}
@@ -576,6 +569,73 @@ void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const {
t.tm_sec = systime.wSecond;
}
+Common::String OSystem_WINCE3::getSystemLanguage() const {
+#ifdef USE_DETECTLANG
+ // We can not use "setlocale" (at least not for MSVC builds), since it
+ // will return locales like: "English_USA.1252", thus we need a special
+ // way to determine the locale string for Win32.
+ char langName[9];
+ char ctryName[9];
+ TCHAR langNameW[32];
+ TCHAR ctryNameW[32];
+ int i = 0;
+ bool localeFound = false;
+ Common::String localeName;
+
+ // Really not nice, but the only way to map Windows CE language/country codes to posix NLS names,
+ // because Windows CE doesn't support LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME,
+ // according to this: http://msdn.microsoft.com/en-us/library/aa912934.aspx
+ //
+ // See http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx for a translation table
+ // This table has to be updated manually when new translations are added
+ const char *posixMappingTable[][3] = {
+ {"CAT", "ESP", "ca_ES"},
+ {"CSY", "CZE", "cs_CZ"},
+ {"DAN", "DNK", "da_DA"},
+ {"DEU", "DEU", "de_DE"},
+ {"ESN", "ESP", "es_ES"},
+ {"ESP", "ESP", "es_ES"},
+ {"FRA", "FRA", "fr_FR"},
+ {"HUN", "HUN", "hu_HU"},
+ {"ITA", "ITA", "it_IT"},
+ {"NOR", "NOR", "nb_NO"},
+ {"NON", "NOR", "nn_NO"},
+ {"PLK", "POL", "pl_PL"},
+ {"PTB", "BRA", "pt_BR"},
+ {"RUS", "RUS", "ru_RU"},
+ {"SVE", "SWE", "se_SE"},
+ {"UKR", "UKR", "uk_UA"},
+ {NULL, NULL, NULL}
+ };
+
+ if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, langNameW, sizeof(langNameW)) != 0 &&
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, ctryNameW, sizeof(ctryNameW)) != 0) {
+ WideCharToMultiByte(CP_ACP, 0, langNameW, -1, langName, (wcslen(langNameW) + 1), NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, ctryNameW, -1, ctryName, (wcslen(ctryNameW) + 1), NULL, NULL);
+
+ debug(1, "Trying to find posix locale name for %s_%s", langName, ctryName);
+ while (posixMappingTable[i][0] && !localeFound) {
+ if ( (!strcmp(posixMappingTable[i][0], langName) || !strcmp(posixMappingTable[i][0], "*")) &&
+ (!strcmp(posixMappingTable[i][1], ctryName) || !strcmp(posixMappingTable[i][0], "*")) ) {
+ localeFound = true;
+ localeName = posixMappingTable[i][2];
+ }
+ i++;
+ }
+ if (!localeFound) warning("No posix locale name found for %s_%s", langName, ctryName);
+ }
+
+ if (localeFound) {
+ debug(1, "Found posix locale name: %s", localeName.c_str());
+ return localeName;
+ } else {
+ return ModularBackend::getSystemLanguage();
+ }
+#else // USE_DETECTLANG
+ return ModularBackend::getSystemLanguage();
+#endif // USE_DETECTLANG
+}
+
int OSystem_WINCE3::_platformScreenWidth;
int OSystem_WINCE3::_platformScreenHeight;
bool OSystem_WINCE3::_isOzone;
diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h
index a1e46081f9..481956c19a 100644
--- a/backends/platform/wince/wince-sdl.h
+++ b/backends/platform/wince/wince-sdl.h
@@ -53,12 +53,13 @@ public:
// Overloaded from SDL backend
void quit();
+ virtual Common::String getSystemLanguage() const;
+
// Overloaded from OSystem
void engineInit();
void getTimeAndDate(TimeDate &t) const;
virtual Common::String getDefaultConfigFileName();
- virtual FilesystemFactory *getFilesystemFactory();
void swap_sound_master();
@@ -73,8 +74,6 @@ public:
protected:
void initSDL();
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
- FilesystemFactory *_fsFactory;
private:
void check_mappings();
diff --git a/backends/plugins/elf/elf-loader.cpp b/backends/plugins/elf/elf-loader.cpp
index b25bcf835b..4335ea6108 100644
--- a/backends/plugins/elf/elf-loader.cpp
+++ b/backends/plugins/elf/elf-loader.cpp
@@ -169,7 +169,7 @@ bool DLObject::loadSegment(Elf32_Phdr *phdr) {
warning("elfloader: Out of memory.");
return false;
}
-
+
debug(2, "elfloader: Allocated segment @ %p", _segment);
// Get offset to load segment into
@@ -222,7 +222,7 @@ Elf32_Shdr * DLObject::loadSectionHeaders(Elf32_Ehdr *ehdr) {
int DLObject::findSymbolTableSection(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
int SymbolTableSection = -1;
-
+
// Loop over sections, looking for symbol table linked to a string table
for (uint32 i = 0; i < ehdr->e_shnum; i++) {
if (shdr[i].sh_type == SHT_SYMTAB &&
@@ -233,7 +233,7 @@ int DLObject::findSymbolTableSection(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
break;
}
}
-
+
return SymbolTableSection;
}
@@ -315,12 +315,12 @@ void DLObject::relocateSymbols(ptrdiff_t offset) {
}
// Track the size of the plugin through memory manager without loading
-// the plugin into memory.
+// the plugin into memory.
//
void DLObject::trackSize(const char *path) {
-
+
_file = Common::FSNode(path).createReadStream();
-
+
if (!_file) {
warning("elfloader: File %s not found.", path);
return;
@@ -334,11 +334,11 @@ void DLObject::trackSize(const char *path) {
_file = 0;
return;
}
-
+
ELFMemMan.trackPlugin(true); // begin tracking the plugin size
-
+
// Load the segments
- for (uint32 i = 0; i < ehdr.e_phnum; i++) {
+ for (uint32 i = 0; i < ehdr.e_phnum; i++) {
debug(2, "elfloader: Loading segment %d", i);
if (!readProgramHeaders(&ehdr, &phdr, i)) {
@@ -351,7 +351,7 @@ void DLObject::trackSize(const char *path) {
ELFMemMan.trackAlloc(phdr.p_align, phdr.p_memsz);
}
}
-
+
ELFMemMan.trackPlugin(false); // we're done tracking the plugin size
delete _file;
@@ -367,7 +367,7 @@ bool DLObject::load() {
return false;
//Load the segments
- for (uint32 i = 0; i < ehdr.e_phnum; i++) {
+ for (uint32 i = 0; i < ehdr.e_phnum; i++) {
debug(2, "elfloader: Loading segment %d", i);
if (readProgramHeaders(&ehdr, &phdr, i) == false)
@@ -386,12 +386,12 @@ bool DLObject::load() {
free(shdr);
return false;
}
-
+
if (!loadStringTable(shdr)) {
free(shdr);
return false;
}
-
+
// Offset by our segment allocated address
// must use _segmentVMA here for multiple segments (MIPS)
_segmentOffset = ptrdiff_t(_segment) - _segmentVMA;
diff --git a/backends/plugins/elf/elf-provider.cpp b/backends/plugins/elf/elf-provider.cpp
index 480f7068c4..84054f44cb 100644
--- a/backends/plugins/elf/elf-provider.cpp
+++ b/backends/plugins/elf/elf-provider.cpp
@@ -100,7 +100,7 @@ DynamicPlugin::VoidFunc ELFPlugin::findSymbol(const char *symbol) {
void ELFPlugin::trackSize() {
// All we need to do is create our object, track its size, then delete it
DLObject *obj = makeDLObject();
-
+
obj->trackSize(_filename.c_str());
delete obj;
}
@@ -180,7 +180,7 @@ void ELFPlugin::unloadPlugin() {
PluginList ELFPluginProvider::getPlugins() {
PluginList pl = FilePluginProvider::getPlugins();
-#if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER)
+#if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER)
// This static downcast is safe because all of the plugins must
// be ELF plugins
for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
@@ -190,8 +190,8 @@ PluginList ELFPluginProvider::getPlugins() {
// The Memory Manager should now allocate space based on the information
// it collected
ELFMemMan.allocateHeap();
-#endif
-
+#endif
+
return pl;
}
diff --git a/backends/plugins/elf/memory-manager.cpp b/backends/plugins/elf/memory-manager.cpp
index 39f5e9071d..02669b3647 100644
--- a/backends/plugins/elf/memory-manager.cpp
+++ b/backends/plugins/elf/memory-manager.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "common/scummsys.h"
+#include "common/scummsys.h"
#if defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER)
@@ -28,12 +28,12 @@
#include "common/debug.h"
#include "common/util.h"
#include <malloc.h>
-
-DECLARE_SINGLETON(ELFMemoryManager);
-ELFMemoryManager::ELFMemoryManager() :
- _heap(0), _heapSize(0), _heapAlign(0),
- _trackAllocs(false), _measuredSize(0), _measuredAlign(0),
+DECLARE_SINGLETON(ELFMemoryManager);
+
+ELFMemoryManager::ELFMemoryManager() :
+ _heap(0), _heapSize(0), _heapAlign(0),
+ _trackAllocs(false), _measuredSize(0), _measuredAlign(0),
_bytesAllocated(0) {}
ELFMemoryManager::~ELFMemoryManager() {
@@ -46,23 +46,23 @@ void ELFMemoryManager::trackPlugin(bool value) {
if (value == _trackAllocs)
return;
-
+
_trackAllocs = value;
-
+
if (_trackAllocs) { // start measuring
// start tracking allocations
_measuredAlign = 0;
-
+
} else { // we're done measuring
// get the total allocated size
uint32 measuredSize = _allocList.back().end() - _allocList.front().start;
_heapSize = MAX(_heapSize, measuredSize);
_heapAlign = MAX(_heapAlign, _measuredAlign);
-
+
_allocList.clear();
_bytesAllocated = 0; // reset
-
+
debug(2, "measured a plugin of size %d. Max size %d. Max align %d", measuredSize, _heapSize, _heapAlign);
}
}
@@ -70,7 +70,7 @@ void ELFMemoryManager::trackPlugin(bool value) {
void ELFMemoryManager::trackAlloc(uint32 align, uint32 size) {
if (!_measuredAlign)
_measuredAlign = align;
-
+
// use the allocate function to simulate allocation
allocateOnHeap(align, size);
}
@@ -79,20 +79,20 @@ void ELFMemoryManager::allocateHeap() {
// The memory manager should only allocate once
assert (!_heap);
assert (_heapSize);
-
+
// clear the list
_allocList.clear();
_bytesAllocated = 0;
-
+
debug(2, "ELFMemoryManager: allocating %d bytes aligned at %d as the \
plugin heap", _heapSize, _heapAlign);
-
+
// prepare the heap
- if (_heapAlign)
+ if (_heapAlign)
_heap = ::memalign(_heapAlign, _heapSize);
else
_heap = ::malloc(_heapSize);
-
+
assert(_heap);
}
@@ -106,7 +106,7 @@ void *ELFMemoryManager::pluginAllocate(uint32 size) {
void *ELFMemoryManager::pluginAllocate(uint32 align, uint32 size) {
if (_heap) {
return allocateOnHeap(align, size);
- }
+ }
return ::memalign(align, size);
}
@@ -120,16 +120,16 @@ void ELFMemoryManager::pluginDeallocate(void *ptr) {
// Allocate space for the request in our heap
void *ELFMemoryManager::allocateOnHeap(uint32 align, uint32 size) {
byte *lastAddress = (byte *)_heap;
-
+
// We can't allow allocations smaller than sizeof(Allocation). This could
- // only be from non-plugin allocations and would cause infinite recursion
+ // only be from non-plugin allocations and would cause infinite recursion
// when allocating our Allocation in the list.
if (size <= sizeof(Allocation))
return 0;
-
+
Common::List<Allocation>::iterator i;
for (i = _allocList.begin(); i != _allocList.end(); i++) {
- if (i->start - lastAddress > (int)size)
+ if (i->start - lastAddress > (int)size)
break;
lastAddress = i->end();
// align to desired alignment
@@ -137,20 +137,20 @@ void *ELFMemoryManager::allocateOnHeap(uint32 align, uint32 size) {
lastAddress = (byte *)( ((uint32)lastAddress + align - 1) & ~(align - 1) );
}
}
-
+
// Check if we exceeded our heap limit
// We skip this case if we're only tracking allocations
if (!_trackAllocs && ((uint32)lastAddress + size > (uint32)_heap + _heapSize)) {
debug(2, "failed to find space to allocate %d bytes", size);
return 0;
}
-
+
_allocList.insert(i, Allocation(lastAddress, size));
_bytesAllocated += size;
-
- debug(7, "ELFMemoryManager: allocated %d bytes at %p. Total %d bytes",
+
+ debug(7, "ELFMemoryManager: allocated %d bytes at %p. Total %d bytes",
size, lastAddress, _bytesAllocated);
-
+
return lastAddress;
}
@@ -159,14 +159,14 @@ void ELFMemoryManager::deallocateFromHeap(void *ptr) {
for (i = _allocList.begin(); i != _allocList.end(); i++) {
if (i->start == ptr) {
_bytesAllocated -= (*i).size;
-
- debug(7, "ELFMemoryManager: freed %d bytes at %p. Total %d bytes",
+
+ debug(7, "ELFMemoryManager: freed %d bytes at %p. Total %d bytes",
(*i).size, (*i).start, _bytesAllocated);
-
+
_allocList.erase(i);
break;
}
- }
+ }
}
#endif /* defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER) */
diff --git a/backends/plugins/elf/memory-manager.h b/backends/plugins/elf/memory-manager.h
index ac70e5e3bb..032ecb2be5 100644
--- a/backends/plugins/elf/memory-manager.h
+++ b/backends/plugins/elf/memory-manager.h
@@ -30,17 +30,17 @@
#include "common/singleton.h"
#include "common/list.h"
#include "common/mutex.h"
-
+
/**
- * A 'foolproof' way to prevent memory fragmentation. This class is used to
- * serve as a permanent allocation to prevent the process of loading and
+ * A 'foolproof' way to prevent memory fragmentation. This class is used to
+ * serve as a permanent allocation to prevent the process of loading and
* unloading plugins from causing heavy fragmentation.
**/
-
+
#define ELFMemMan ELFMemoryManager::instance()
-
+
class ELFMemoryManager : public Common::Singleton<ELFMemoryManager> {
-public:
+public:
void trackPlugin(bool value);
void trackAlloc(uint32 align, uint32 size);
@@ -49,7 +49,7 @@ public:
void *pluginAllocate(uint32 size);
void *pluginAllocate(uint32 align, uint32 size);
void pluginDeallocate(void *ptr);
-
+
private:
friend class Common::Singleton<ELFMemoryManager>;
@@ -58,7 +58,7 @@ private:
void *allocateOnHeap(uint32 align, uint32 size);
void deallocateFromHeap(void *ptr);
-
+
struct Allocation {
byte *start;
uint32 size;
@@ -70,17 +70,17 @@ private:
void *_heap;
uint32 _heapAlign; // alignment of the heap
uint32 _heapSize; // size of the heap
-
+
// tracking allocations
bool _trackAllocs; // whether we are currently tracking
- uint32 _measuredSize;
- uint32 _measuredAlign;
-
+ uint32 _measuredSize;
+ uint32 _measuredAlign;
+
// real allocations
Common::List<Allocation> _allocList;
uint32 _bytesAllocated;
};
-
+
#endif /* defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER) */
#endif /* ELF_MEMORY_MANAGER_H */
diff --git a/backends/plugins/elf/mips-loader.cpp b/backends/plugins/elf/mips-loader.cpp
index 8ce1a69583..e043c9647f 100644
--- a/backends/plugins/elf/mips-loader.cpp
+++ b/backends/plugins/elf/mips-loader.cpp
@@ -53,7 +53,7 @@ bool MIPSDLObject::relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment)
debug(2, "elfloader: Loaded relocation table. %d entries. base address=%p", cnt, relSegment);
Elf32_Addr adjustedMainSegment = Elf32_Addr(_segment) - _segmentVMA; // adjust for VMA offset
-
+
bool seenHi16 = false; // For treating HI/LO16 commands
int32 firstHi16 = -1; // Mark the point of the first hi16 seen
Elf32_Addr ahl = 0; // Calculated addend
@@ -259,7 +259,7 @@ void MIPSDLObject::relocateSymbols(ptrdiff_t offset) {
if (!ShortsMan.inGeneralSegment((char *)s->st_value)) {
if (s->st_value < _segmentVMA)
s->st_value = _segmentVMA; // deal with symbols referring to sections, which start before the VMA
-
+
s->st_value += offset;
if (s->st_value < Elf32_Addr(_segment) || s->st_value > Elf32_Addr(_segment) + _segmentSize)
@@ -287,7 +287,7 @@ bool MIPSDLObject::loadSegment(Elf32_Phdr *phdr) {
}
debug(2, "elfloader: Allocated segment @ %p", _segment);
-
+
// Get offset to load segment into
baseAddress = _segment;
_segmentSize = phdr->p_memsz;
diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp
new file mode 100644
index 0000000000..da053734d2
--- /dev/null
+++ b/backends/taskbar/unity/unity-taskbar.cpp
@@ -0,0 +1,114 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#include "common/scummsys.h"
+
+#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
+
+#include "backends/taskbar/unity/unity-taskbar.h"
+
+#include "common/textconsole.h"
+
+#include <unity.h>
+
+UnityTaskbarManager::UnityTaskbarManager() {
+ g_type_init();
+
+ _loop = g_main_loop_new(NULL, FALSE);
+
+ _launcher = unity_launcher_entry_get_for_desktop_id("scummvm.desktop");
+}
+
+UnityTaskbarManager::~UnityTaskbarManager() {
+ g_main_loop_unref(_loop);
+ _loop = NULL;
+}
+
+void UnityTaskbarManager::setProgressValue(int completed, int total) {
+ if (_launcher == NULL)
+ return;
+
+ double percentage = (double)completed / (double)total;
+ unity_launcher_entry_set_progress(_launcher, percentage);
+ unity_launcher_entry_set_progress_visible(_launcher, TRUE);
+}
+
+void UnityTaskbarManager::setProgressState(TaskbarProgressState state) {
+ if (_launcher == NULL)
+ return;
+
+ switch (state) {
+ default:
+ warning("[UnityTaskbarManager::setProgressState] Unknown state / Not implemented (%d)", state);
+ // fallback to noprogress state
+
+ case kTaskbarNoProgress:
+ unity_launcher_entry_set_progress_visible(_launcher, FALSE);
+ break;
+
+ // Unity only support two progress states as of 3.0: visible or not visible
+ // We show progress in all of those states
+ case kTaskbarIndeterminate:
+ case kTaskbarNormal:
+ case kTaskbarError:
+ case kTaskbarPaused:
+ unity_launcher_entry_set_progress_visible(_launcher, TRUE);
+ break;
+ }
+}
+
+void UnityTaskbarManager::addRecent(const Common::String &name, const Common::String &description) {
+ warning("[UnityTaskbarManager::addRecent] Not implemented");
+}
+
+void UnityTaskbarManager::setCount(int count) {
+ if (_launcher == NULL)
+ return;
+
+ unity_launcher_entry_set_count(_launcher, count);
+
+ unity_launcher_entry_set_count_visible(_launcher, (count == 0) ? FALSE : TRUE);
+}
+
+// Unity requires the glib event loop to the run to function properly
+// as events are sent asynchronously
+bool UnityTaskbarManager::pollEvent(Common::Event &event) {
+ if (!_loop)
+ return false;
+
+ // Get context
+ GMainContext *context = g_main_loop_get_context(_loop);
+ if (!context)
+ return false;
+
+ // Dispatch events
+ g_main_context_iteration(context, FALSE);
+
+ return false;
+}
+
+#endif
diff --git a/backends/events/gp2xsdl/gp2xsdl-events.h b/backends/taskbar/unity/unity-taskbar.h
index 0d74c1bcac..06ea0ca769 100644
--- a/backends/events/gp2xsdl/gp2xsdl-events.h
+++ b/backends/taskbar/unity/unity-taskbar.h
@@ -18,39 +18,41 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * $URL$
+ * $Id$
+ *
*/
-#if !defined(BACKEND_EVENTS_SDL_GP2X_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER)
-#define BACKEND_EVENTS_SDL_GP2X_H
-
-#include "backends/events/sdl/sdl-events.h"
+#ifndef BACKEND_UNITY_TASKBAR_H
+#define BACKEND_UNITY_TASKBAR_H
-/**
- * SDL events manager for GP2X
- */
-class GP2XSdlEventSource : public SdlEventSource {
-public:
- GP2XSdlEventSource();
+#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
-protected:
- bool _stickBtn[32];
+#include "common/events.h"
+#include "common/str.h"
+#include "common/taskbar.h"
- /** Button state for L button modifier */
- bool _buttonStateL;
+typedef struct _GMainLoop GMainLoop;
+typedef struct _UnityLauncherEntry UnityLauncherEntry;
- /**
- * Handles the stick movement
- */
- void moveStick();
+class UnityTaskbarManager : public Common::TaskbarManager, public Common::EventSource {
+public:
+ UnityTaskbarManager();
+ virtual ~UnityTaskbarManager();
- virtual bool handleKeyDown(SDL_Event &ev, Common::Event &event);
- virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
- virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
- virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
+ virtual void setProgressValue(int completed, int total);
+ virtual void setProgressState(TaskbarProgressState state);
+ virtual void addRecent(const Common::String &name, const Common::String &description);
+ virtual void setCount(int count);
- virtual void SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event);
+ // Implementation of the EventSource interface
+ virtual bool pollEvent(Common::Event &event);
- virtual bool remapKey(SDL_Event &ev, Common::Event &event);
+private:
+ GMainLoop *_loop;
+ UnityLauncherEntry *_launcher;
};
#endif
+
+#endif // BACKEND_UNITY_TASKBAR_H
diff --git a/backends/taskbar/win32/mingw-compat.h b/backends/taskbar/win32/mingw-compat.h
new file mode 100644
index 0000000000..30ce818141
--- /dev/null
+++ b/backends/taskbar/win32/mingw-compat.h
@@ -0,0 +1,154 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+// TODO: Remove header when the latest changes to the Windows SDK have been integrated into MingW
+// For reference, the interface definitions here are imported the SDK headers and from the
+// EcWin7 project (https://code.google.com/p/dukto/)
+
+#ifndef BACKEND_WIN32_TASKBAR_MINGW_H
+#define BACKEND_WIN32_TASKBAR_MINGW_H
+
+#if defined(WIN32)
+#if defined(__GNUC__)
+#ifdef __MINGW32__
+
+#ifdef _WIN32_WINNT
+ #undef _WIN32_WINNT
+#endif
+#define _WIN32_WINNT 0x0501
+#include <windows.h>
+#include <commctrl.h>
+#include <initguid.h>
+#include <shlwapi.h>
+#include <shlguid.h>
+#define CMIC_MASK_ASYNCOK SEE_MASK_ASYNCOK
+
+extern const GUID CLSID_ShellLink;
+
+// Shard enumeration value
+#define SHARD_LINK 0x00000006
+
+// Taskbar GUID definitions
+DEFINE_GUID(CLSID_TaskbarList,0x56fdf344,0xfd6d,0x11d0,0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90);
+DEFINE_GUID(IID_ITaskbarList3,0xea1afb91,0x9e28,0x4b86,0x90,0xE9,0x9e,0x9f,0x8a,0x5e,0xef,0xaf);
+DEFINE_GUID(IID_IPropertyStore,0x886d8eeb,0x8cf2,0x4446,0x8d,0x02,0xcd,0xba,0x1d,0xbd,0xcf,0x99);
+
+// Property key
+typedef struct _tagpropertykey {
+ GUID fmtid;
+ DWORD pid;
+} PROPERTYKEY;
+
+#define REFPROPERTYKEY const PROPERTYKEY &
+
+typedef struct tagPROPVARIANT PROPVARIANT;
+#define REFPROPVARIANT const PROPVARIANT &
+
+// Property store
+DECLARE_INTERFACE_(IPropertyStore, IUnknown) {
+ STDMETHOD (GetCount) (DWORD *cProps) PURE;
+ STDMETHOD (GetAt) (DWORD iProp, PROPERTYKEY *pkey) PURE;
+ STDMETHOD (GetValue) (REFPROPERTYKEY key, PROPVARIANT *pv) PURE;
+ STDMETHOD (SetValue) (REFPROPERTYKEY key, REFPROPVARIANT propvar) PURE;
+ STDMETHOD (Commit) (void) PURE;
+
+private:
+ ~IPropertyStore();
+};
+typedef IPropertyStore *LPIPropertyStore;
+
+// Mingw-specific defines for taskbar integration
+typedef enum THUMBBUTTONMASK {
+ THB_BITMAP = 0x1,
+ THB_ICON = 0x2,
+ THB_TOOLTIP = 0x4,
+ THB_FLAGS = 0x8
+} THUMBBUTTONMASK;
+
+typedef enum THUMBBUTTONFLAGS {
+ THBF_ENABLED = 0,
+ THBF_DISABLED = 0x1,
+ THBF_DISMISSONCLICK = 0x2,
+ THBF_NOBACKGROUND = 0x4,
+ THBF_HIDDEN = 0x8,
+ THBF_NONINTERACTIVE = 0x10
+} THUMBBUTTONFLAGS;
+
+typedef struct THUMBBUTTON {
+ THUMBBUTTONMASK dwMask;
+ UINT iId;
+ UINT iBitmap;
+ HICON hIcon;
+ WCHAR szTip[260];
+ THUMBBUTTONFLAGS dwFlags;
+} THUMBBUTTON;
+typedef struct THUMBBUTTON *LPTHUMBBUTTON;
+
+typedef enum TBPFLAG {
+ TBPF_NOPROGRESS = 0,
+ TBPF_INDETERMINATE = 0x1,
+ TBPF_NORMAL = 0x2,
+ TBPF_ERROR = 0x4,
+ TBPF_PAUSED = 0x8
+} TBPFLAG;
+
+// Taskbar interface
+DECLARE_INTERFACE_(ITaskbarList3, IUnknown) {
+ // IUnknown
+ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
+ STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG,Release) (THIS) PURE;
+ // ITaskbarList
+ STDMETHOD(HrInit) (THIS) PURE;
+ STDMETHOD(AddTab) (THIS_ HWND hwnd) PURE;
+ STDMETHOD(DeleteTab) (THIS_ HWND hwnd) PURE;
+ STDMETHOD(ActivateTab) (THIS_ HWND hwnd) PURE;
+ STDMETHOD(SetActiveAlt) (THIS_ HWND hwnd) PURE;
+ STDMETHOD (MarkFullscreenWindow) (THIS_ HWND hwnd, int fFullscreen) PURE;
+ // ITaskbarList3
+ STDMETHOD (SetProgressValue) (THIS_ HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) PURE;
+ STDMETHOD (SetProgressState) (THIS_ HWND hwnd, TBPFLAG tbpFlags) PURE;
+ STDMETHOD (RegisterTab) (THIS_ HWND hwndTab, HWND hwndMDI) PURE;
+ STDMETHOD (UnregisterTab) (THIS_ HWND hwndTab) PURE;
+ STDMETHOD (SetTabOrder) (THIS_ HWND hwndTab, HWND hwndInsertBefore) PURE;
+ STDMETHOD (SetTabActive) (THIS_ HWND hwndTab, HWND hwndMDI, DWORD dwReserved) PURE;
+ STDMETHOD (ThumbBarAddButtons) (THIS_ HWND hwnd, UINT cButtons, LPTHUMBBUTTON pButton) PURE;
+ STDMETHOD (ThumbBarUpdateButtons) (THIS_ HWND hwnd, UINT cButtons, LPTHUMBBUTTON pButton) PURE;
+ STDMETHOD (ThumbBarSetImageList) (THIS_ HWND hwnd, HIMAGELIST himl) PURE;
+ STDMETHOD (SetOverlayIcon) (THIS_ HWND hwnd, HICON hIcon, LPCWSTR pszDescription) PURE;
+ STDMETHOD (SetThumbnailTooltip) (THIS_ HWND hwnd, LPCWSTR pszTip) PURE;
+ STDMETHOD (SetThumbnailClip) (THIS_ HWND hwnd, RECT *prcClip) PURE;
+
+private:
+ ~ITaskbarList3();
+};
+
+typedef ITaskbarList3 *LPITaskbarList3;
+
+#endif // __MINGW32__
+#endif // __GNUC__
+#endif // WIN32
+
+#endif // BACKEND_WIN32_TASKBAR_MINGW_H
diff --git a/backends/taskbar/win32/win32-taskbar.cpp b/backends/taskbar/win32/win32-taskbar.cpp
new file mode 100644
index 0000000000..18d99d6eca
--- /dev/null
+++ b/backends/taskbar/win32/win32-taskbar.cpp
@@ -0,0 +1,294 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+// We cannot use common/scummsys.h directly as it will include
+// windows.h and we need to do it by hand to allow excluded functions
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#if defined(WIN32) && defined(USE_TASKBAR)
+
+// Needed for taskbar functions
+#if defined(__GNUC__)
+#ifdef __MINGW32__
+ #include "backends/taskbar/win32/mingw-compat.h"
+#else
+ #error Only compilation with MingW is supported
+#endif
+#else
+ // We need certain functions that are excluded by default
+ #undef NONLS
+ #undef NOICONS
+ #include <windows.h>
+ #if defined(ARRAYSIZE)
+ #undef ARRAYSIZE
+ #endif
+
+ // Default MSVC headers for ITaskbarList3 and IShellLink
+ #include <SDKDDKVer.h>
+#endif
+#include <shlobj.h>
+
+// For HWND
+#include <SDL_syswm.h>
+
+#include "common/scummsys.h"
+
+#include "backends/taskbar/win32/win32-taskbar.h"
+
+#include "common/config-manager.h"
+#include "common/textconsole.h"
+#include "common/file.h"
+
+// System.Title property key, values taken from http://msdn.microsoft.com/en-us/library/bb787584.aspx
+const PROPERTYKEY PKEY_Title = { /* fmtid = */ { 0xF29F85E0, 0x4FF9, 0x1068, { 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9 } }, /* propID = */ 2 };
+
+Win32TaskbarManager::Win32TaskbarManager() : _taskbar(NULL) {
+ // Do nothing if not running on Windows 7 or later
+ if (!isWin7OrLater())
+ return;
+
+ CoInitialize(NULL);
+
+ // Try creating instance (on fail, _taskbar will contain NULL)
+ HRESULT hr = CoCreateInstance(CLSID_TaskbarList,
+ 0,
+ CLSCTX_INPROC_SERVER,
+ IID_ITaskbarList3,
+ reinterpret_cast<void**> (&(_taskbar)));
+
+ if (SUCCEEDED(hr)) {
+ // Initialize taskbar object
+ if (FAILED(_taskbar->HrInit())) {
+ _taskbar->Release();
+ _taskbar = NULL;
+ }
+ } else {
+ warning("[Win32TaskbarManager::init] Cannot create taskbar instance");
+ }
+}
+
+Win32TaskbarManager::~Win32TaskbarManager() {
+ if (_taskbar)
+ _taskbar->Release();
+ _taskbar = NULL;
+
+ CoUninitialize();
+}
+
+void Win32TaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) {
+ //warning("[Win32TaskbarManager::setOverlayIcon] Setting overlay icon to: %s (%s)", name.c_str(), description.c_str());
+
+ if (_taskbar == NULL)
+ return;
+
+ if (name.empty()) {
+ _taskbar->SetOverlayIcon(getHwnd(), NULL, L"");
+ return;
+ }
+
+ // Compute full icon path
+ Common::String path = getIconPath(name);
+ if (path.empty())
+ return;
+
+ HICON pIcon = (HICON)::LoadImage(NULL, path.c_str(), IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
+ if (!pIcon) {
+ warning("[Win32TaskbarManager::setOverlayIcon] Cannot load icon!");
+ return;
+ }
+
+ // Sets the overlay icon
+ LPWSTR desc = ansiToUnicode(description.c_str());
+ _taskbar->SetOverlayIcon(getHwnd(), pIcon, desc);
+
+ DestroyIcon(pIcon);
+
+ delete[] desc;
+}
+
+void Win32TaskbarManager::setProgressValue(int completed, int total) {
+ if (_taskbar == NULL)
+ return;
+
+ _taskbar->SetProgressValue(getHwnd(), completed, total);
+}
+
+void Win32TaskbarManager::setProgressState(TaskbarProgressState state) {
+ if (_taskbar == NULL)
+ return;
+
+ _taskbar->SetProgressState(getHwnd(), (TBPFLAG)state);
+}
+
+void Win32TaskbarManager::addRecent(const Common::String &name, const Common::String &description) {
+ //warning("[Win32TaskbarManager::addRecent] Adding recent list entry: %s (%s)", name.c_str(), description.c_str());
+
+ if (_taskbar == NULL)
+ return;
+
+ // ANSI version doesn't seem to work correctly with Win7 jump lists, so explicitly use Unicode interface.
+ IShellLinkW *link;
+
+ // Get the ScummVM executable path.
+ WCHAR path[MAX_PATH];
+ GetModuleFileNameW(NULL, path, MAX_PATH);
+
+ // Create a shell link.
+ if (SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC, IID_IShellLinkW, reinterpret_cast<void**> (&link)))) {
+ // Convert game name and description to Unicode.
+ LPWSTR game = ansiToUnicode(name.c_str());
+ LPWSTR desc = ansiToUnicode(description.c_str());
+
+ // Set link properties.
+ link->SetPath(path);
+ link->SetArguments(game);
+
+ Common::String iconPath = getIconPath(name);
+ if (iconPath.empty()) {
+ link->SetIconLocation(path, 0); // No game-specific icon available
+ } else {
+ LPWSTR icon = ansiToUnicode(iconPath.c_str());
+
+ link->SetIconLocation(icon, 0);
+
+ delete[] icon;
+ }
+
+ // The link's display name must be set via property store.
+ IPropertyStore* propStore;
+ HRESULT hr = link->QueryInterface(IID_IPropertyStore, reinterpret_cast<void**> (&(propStore)));
+ if (SUCCEEDED(hr)) {
+ PROPVARIANT pv;
+ pv.vt = VT_LPWSTR;
+ pv.pwszVal = desc;
+
+ hr = propStore->SetValue(PKEY_Title, pv);
+
+ propStore->Commit();
+ propStore->Release();
+ }
+
+ // SHAddToRecentDocs will cause the games to be added to the Recent list, allowing the user to pin them.
+ SHAddToRecentDocs(SHARD_LINK, link);
+ link->Release();
+ delete[] game;
+ delete[] desc;
+ }
+}
+
+Common::String Win32TaskbarManager::getIconPath(Common::String target) {
+ // We first try to look for a iconspath configuration variable then
+ // fallback to the extra path
+ //
+ // Icons can be either in a subfolder named "icons" or directly in the path
+
+ Common::String iconsPath = ConfMan.get("iconspath");
+ Common::String extraPath = ConfMan.get("extrapath");
+
+#define TRY_ICON_PATH(path) { \
+ Common::FSNode node((path)); \
+ if (node.exists()) \
+ return (path); \
+}
+
+ if (!iconsPath.empty()) {
+ TRY_ICON_PATH(iconsPath + "/" + target + ".ico");
+ TRY_ICON_PATH(iconsPath + "/" + ConfMan.get("gameid") + ".ico");
+ TRY_ICON_PATH(iconsPath + "/icons/" + target + ".ico");
+ TRY_ICON_PATH(iconsPath + "/icons/" + ConfMan.get("gameid") + ".ico");
+ }
+
+ if (!extraPath.empty()) {
+ TRY_ICON_PATH(extraPath + "/" + target + ".ico");
+ TRY_ICON_PATH(extraPath + "/" + ConfMan.get("gameid") + ".ico");
+ TRY_ICON_PATH(extraPath + "/icons/" + target + ".ico");
+ TRY_ICON_PATH(extraPath + "/icons/" + ConfMan.get("gameid") + ".ico");
+ }
+
+ return "";
+}
+
+// VerSetConditionMask and VerifyVersionInfo didn't appear until Windows 2000,
+// so we need to check for them at runtime
+LONGLONG VerSetConditionMaskFunc(ULONGLONG dwlConditionMask, DWORD dwTypeMask, BYTE dwConditionMask) {
+ typedef BOOL (WINAPI *VerSetConditionMaskFunction)(ULONGLONG conditionMask, DWORD typeMask, BYTE conditionOperator);
+
+ VerSetConditionMaskFunction verSetConditionMask = (VerSetConditionMaskFunction)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "VerSetConditionMask");
+ if (verSetConditionMask == NULL)
+ return 0;
+
+ return verSetConditionMask(dwlConditionMask, dwTypeMask, dwConditionMask);
+}
+
+BOOL VerifyVersionInfoFunc(LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask) {
+ typedef BOOL (WINAPI *VerifyVersionInfoFunction)(LPOSVERSIONINFOEXA versionInformation, DWORD typeMask, DWORDLONG conditionMask);
+
+ VerifyVersionInfoFunction verifyVersionInfo = (VerifyVersionInfoFunction)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "VerifyVersionInfoA");
+ if (verifyVersionInfo == NULL)
+ return FALSE;
+
+ return verifyVersionInfo(lpVersionInformation, dwTypeMask, dwlConditionMask);
+}
+
+bool Win32TaskbarManager::isWin7OrLater() {
+ OSVERSIONINFOEX versionInfo;
+ DWORDLONG conditionMask = 0;
+
+ ZeroMemory(&versionInfo, sizeof(OSVERSIONINFOEX));
+ versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ versionInfo.dwMajorVersion = 6;
+ versionInfo.dwMinorVersion = 1;
+
+ conditionMask = VerSetConditionMaskFunc(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
+ conditionMask = VerSetConditionMaskFunc(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
+
+ return VerifyVersionInfoFunc(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask);
+}
+
+LPWSTR Win32TaskbarManager::ansiToUnicode(const char *s) {
+ DWORD size = MultiByteToWideChar(0, 0, s, -1, NULL, 0);
+
+ if (size > 0) {
+ LPWSTR result = new WCHAR[size];
+ if (MultiByteToWideChar(0, 0, s, -1, result, size) != 0)
+ return result;
+ }
+
+ return NULL;
+}
+
+HWND Win32TaskbarManager::getHwnd() {
+ SDL_SysWMinfo wmi;
+ SDL_VERSION(&wmi.version);
+
+ if(!SDL_GetWMInfo(&wmi))
+ return NULL;
+
+ return wmi.window;
+}
+
+#endif
diff --git a/backends/taskbar/win32/win32-taskbar.h b/backends/taskbar/win32/win32-taskbar.h
new file mode 100644
index 0000000000..3415a79bd7
--- /dev/null
+++ b/backends/taskbar/win32/win32-taskbar.h
@@ -0,0 +1,66 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef BACKEND_WIN32_TASKBAR_H
+#define BACKEND_WIN32_TASKBAR_H
+
+#if defined(WIN32) && defined(USE_TASKBAR)
+
+#include "common/str.h"
+#include "common/taskbar.h"
+
+struct ITaskbarList3;
+
+class Win32TaskbarManager : public Common::TaskbarManager {
+public:
+ Win32TaskbarManager();
+ virtual ~Win32TaskbarManager();
+
+ virtual void setOverlayIcon(const Common::String &name, const Common::String &description);
+ virtual void setProgressValue(int completed, int total);
+ virtual void setProgressState(TaskbarProgressState state);
+ virtual void addRecent(const Common::String &name, const Common::String &description);
+
+private:
+ ITaskbarList3 *_taskbar;
+
+ /**
+ * Get the path to an icon for the game
+ *
+ * @param target The game target
+ *
+ * @return The icon path (or "" if no icon was found)
+ */
+ Common::String getIconPath(Common::String target);
+
+ // Helper functions
+ bool isWin7OrLater();
+ LPWSTR ansiToUnicode(const char *s);
+ HWND getHwnd();
+};
+
+#endif
+
+#endif // BACKEND_WIN32_TASKBAR_H
diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp
index 5e4ce11fe4..58f0c468f6 100644
--- a/backends/vkeybd/virtual-keyboard-parser.cpp
+++ b/backends/vkeybd/virtual-keyboard-parser.cpp
@@ -205,6 +205,9 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) {
evt->type = VirtualKeyboard::kVKEventModifier;
byte *flags = (byte*) malloc(sizeof(byte));
+ if (!flags)
+ error("[VirtualKeyboardParser::parserCallback_event] Cannot allocate memory");
+
*(flags) = parseFlags(node->values["modifiers"]);
evt->data = flags;
@@ -217,6 +220,9 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) {
evt->type = VirtualKeyboard::kVKEventSwitchMode;
String& mode = node->values["mode"];
char *str = (char*) malloc(sizeof(char) * mode.size() + 1);
+ if (!str)
+ error("[VirtualKeyboardParser::parserCallback_event] Cannot allocate memory");
+
memcpy(str, mode.c_str(), sizeof(char) * mode.size());
str[mode.size()] = 0;
evt->data = str;