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.cpp77
-rw-r--r--backends/base-backend.h22
-rw-r--r--backends/events/default/default-events.cpp5
-rw-r--r--backends/events/gp2xsdl/gp2xsdl-events.cpp463
-rw-r--r--backends/events/gp2xsdl/gp2xsdl-events.h56
-rw-r--r--backends/events/gph/gph-events.cpp22
-rw-r--r--backends/events/openpandora/op-events.cpp134
-rw-r--r--backends/events/openpandora/op-events.h9
-rw-r--r--backends/events/sdl/sdl-events.cpp6
-rw-r--r--backends/events/wincesdl/wincesdl-events.cpp11
-rw-r--r--backends/events/wincesdl/wincesdl-events.h4
-rw-r--r--backends/fs/ds/ds-fs.cpp24
-rw-r--r--backends/fs/posix/posix-fs-factory.cpp3
-rw-r--r--backends/fs/posix/posix-fs.cpp5
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp2
-rw-r--r--backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp180
-rw-r--r--backends/graphics/gp2xsdl/gp2xsdl-graphics.h46
-rw-r--r--backends/graphics/gph/gph-graphics.cpp97
-rw-r--r--backends/graphics/gph/gph-graphics.h4
-rw-r--r--backends/graphics/graphics.h1
-rw-r--r--backends/graphics/null/null-graphics.h1
-rw-r--r--backends/graphics/opengl/gltexture.h2
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp17
-rw-r--r--backends/graphics/opengl/opengl-graphics.h1
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp23
-rw-r--r--backends/graphics/openpandora/op-graphics.cpp12
-rw-r--r--backends/graphics/openpandora/op-graphics.h42
-rw-r--r--backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp8
-rw-r--r--backends/graphics/sdl/sdl-graphics.cpp30
-rw-r--r--backends/graphics/sdl/sdl-graphics.h1
-rw-r--r--backends/graphics/symbiansdl/symbiansdl-graphics.cpp2
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.cpp13
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.h19
-rw-r--r--backends/midi/alsa.cpp4
-rw-r--r--backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp2
-rw-r--r--backends/mixer/sdl/sdl-mixer.cpp32
-rw-r--r--backends/mixer/sdl/sdl-mixer.h2
-rw-r--r--backends/mixer/symbiansdl/symbiansdl-mixer.cpp6
-rw-r--r--backends/modular-backend.cpp50
-rw-r--r--backends/modular-backend.h25
-rw-r--r--backends/module.mk59
-rw-r--r--backends/platform/android/android.cpp45
-rw-r--r--backends/platform/android/android.h10
-rw-r--r--backends/platform/android/gfx.cpp10
-rw-r--r--backends/platform/android/org/inodes/gus/scummvm/ScummVM.java2
-rw-r--r--backends/platform/dc/Makefile4
-rw-r--r--backends/platform/dc/dc-fs.cpp2
-rw-r--r--backends/platform/dc/dc.h15
-rw-r--r--backends/platform/dc/dcmain.cpp23
-rw-r--r--backends/platform/dc/display.cpp5
-rw-r--r--backends/platform/dc/input.cpp4
-rw-r--r--backends/platform/dc/time.cpp4
-rw-r--r--backends/platform/dc/vmsave.cpp5
-rw-r--r--backends/platform/dingux/module.mk10
-rw-r--r--backends/platform/ds/arm9/dist/readme_ds.txt2
-rw-r--r--backends/platform/ds/arm9/makefile8
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp5
-rw-r--r--backends/platform/ds/arm9/source/fat/gba_nds_fat.c2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp57
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h16
-rw-r--r--backends/platform/ds/arm9/source/portdefs.h7
-rwxr-xr-xbackends/platform/gp2x/build/clean.sh17
-rw-r--r--backends/platform/gp2x/gp2x-common.h49
-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-main.cpp50
-rw-r--r--backends/platform/gp2x/gp2x-mem.cpp84
-rw-r--r--backends/platform/gp2x/gp2x-mem.h51
-rw-r--r--backends/platform/gp2x/gp2x.cpp208
-rw-r--r--backends/platform/gp2x/module.mk12
-rw-r--r--backends/platform/gph/build/caanoo-config-alleng.sh4
-rw-r--r--backends/platform/gph/build/caanoo-config.sh4
-rw-r--r--backends/platform/gph/build/gp2x-config-alleng.sh8
-rw-r--r--backends/platform/gph/build/gp2x-config.sh11
-rw-r--r--backends/platform/gph/build/gp2xwiz-config-alleng.sh5
-rw-r--r--backends/platform/gph/build/gp2xwiz-config.sh5
-rw-r--r--backends/platform/gph/devices/gp2x/scummvm.gpe4
-rw-r--r--backends/platform/gph/gph-backend.cpp22
-rw-r--r--backends/platform/gph/gph-main.cpp4
-rw-r--r--backends/platform/gph/gph-sdl.h4
-rw-r--r--backends/platform/gph/module.mk2
-rw-r--r--backends/platform/iphone/iphone_video.h1
-rw-r--r--backends/platform/iphone/iphone_video.m18
-rw-r--r--backends/platform/iphone/osys_events.cpp4
-rw-r--r--backends/platform/iphone/osys_main.cpp58
-rw-r--r--backends/platform/iphone/osys_main.h13
-rw-r--r--backends/platform/iphone/osys_video.cpp3
-rw-r--r--backends/platform/linuxmoto/module.mk4
-rw-r--r--backends/platform/n64/osys_n64.h12
-rw-r--r--backends/platform/n64/osys_n64_base.cpp60
-rw-r--r--backends/platform/n64/osys_n64_utilities.cpp1
-rw-r--r--backends/platform/n64/portdefs.h13
-rw-r--r--backends/platform/null/null.cpp30
-rwxr-xr-xbackends/platform/openpandora/build/config-alleng.sh1
-rwxr-xr-xbackends/platform/openpandora/build/config.sh1
-rwxr-xr-xbackends/platform/openpandora/module.mk9
-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/Makefile.gdb100
-rw-r--r--backends/platform/ps2/Makefile.ps260
-rw-r--r--backends/platform/ps2/fileio.cpp20
-rw-r--r--backends/platform/ps2/fileio.h2
-rw-r--r--backends/platform/ps2/systemps2.cpp77
-rw-r--r--backends/platform/ps2/systemps2.h22
-rw-r--r--backends/platform/psp/cursor.h1
-rw-r--r--backends/platform/psp/osys_psp.cpp46
-rw-r--r--backends/platform/psp/osys_psp.h13
-rw-r--r--backends/platform/samsungtv/main.cpp6
-rw-r--r--backends/platform/samsungtv/module.mk3
-rw-r--r--backends/platform/samsungtv/samsungtv.cpp9
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp27
-rw-r--r--backends/platform/sdl/macosx/macosx.h4
-rw-r--r--backends/platform/sdl/main.cpp2
-rw-r--r--backends/platform/sdl/module.mk2
-rw-r--r--backends/platform/sdl/posix/posix-main.cpp2
-rw-r--r--backends/platform/sdl/posix/posix.cpp75
-rw-r--r--backends/platform/sdl/posix/posix.h21
-rw-r--r--backends/platform/sdl/sdl.cpp35
-rw-r--r--backends/platform/sdl/sdl.h10
-rw-r--r--backends/platform/sdl/win32/win32.cpp54
-rw-r--r--backends/platform/sdl/win32/win32.h15
-rw-r--r--backends/platform/symbian/BuildPackageUpload_LocalSettings.pl7
-rw-r--r--backends/platform/symbian/README3
-rw-r--r--backends/platform/symbian/src/portdefs.h22
-rw-r--r--backends/platform/wii/options.cpp6
-rw-r--r--backends/platform/wii/osystem.cpp59
-rw-r--r--backends/platform/wii/osystem.h11
-rw-r--r--backends/platform/wii/osystem_events.cpp1
-rw-r--r--backends/platform/wii/osystem_gfx.cpp9
-rw-r--r--backends/platform/wince/CEActionsPocket.cpp45
-rw-r--r--backends/platform/wince/CEActionsPocket.h2
-rw-r--r--backends/platform/wince/CEActionsSmartphone.cpp35
-rw-r--r--backends/platform/wince/CEActionsSmartphone.h2
-rw-r--r--backends/platform/wince/Makefile6
-rw-r--r--backends/platform/wince/README-WinCE.txt42
-rw-r--r--backends/platform/wince/portdefs.h60
-rw-r--r--backends/platform/wince/wince-sdl.cpp83
-rw-r--r--backends/platform/wince/wince-sdl.h5
-rw-r--r--backends/plugins/posix/posix-provider.cpp6
-rw-r--r--backends/plugins/posix/posix-provider.h6
-rw-r--r--backends/saves/posix/posix-saves.cpp11
-rw-r--r--backends/saves/posix/posix-saves.h3
-rw-r--r--backends/vkeybd/image-map.h3
-rw-r--r--backends/vkeybd/polygon.h3
-rw-r--r--backends/vkeybd/virtual-keyboard-gui.h3
-rw-r--r--backends/vkeybd/virtual-keyboard-parser.cpp15
-rw-r--r--backends/vkeybd/virtual-keyboard-parser.h3
-rw-r--r--backends/vkeybd/virtual-keyboard.h3
150 files changed, 1353 insertions, 2608 deletions
diff --git a/backends/audiocd/audiocd.h b/backends/audiocd/audiocd.h
index a4aeb41e74..92b7598cb5 100644
--- a/backends/audiocd/audiocd.h
+++ b/backends/audiocd/audiocd.h
@@ -108,7 +108,7 @@ public:
//@{
/**
- * Initialise the specified CD drive for audio playback.
+ * Initialize the specified CD drive for audio playback.
* @param drive the drive id
* @return true if the CD drive was inited succesfully
*/
diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp
index f3935b5893..8d22ab732d 100644
--- a/backends/base-backend.cpp
+++ b/backends/base-backend.cpp
@@ -18,11 +18,22 @@
* 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$
+ *
*/
#include "backends/base-backend.h"
+
+#ifndef DISABLE_DEFAULT_EVENT_MANAGER
#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) {
@@ -31,16 +42,20 @@ void BaseBackend::displayMessageOnOSD(const char *msg) {
dialog.runModal();
}
+void BaseBackend::initBackend() {
+ // Init Event manager
+#ifndef DISABLE_DEFAULT_EVENT_MANAGER
+ if (!_eventManager)
+ _eventManager = new DefaultEventManager(getDefaultEventSource());
+#endif
-static Common::EventManager *s_eventManager = 0;
+ // Init audio CD manager
+#ifndef DISABLE_DEFAULT_AUDIOCD_MANAGER
+ if (!_audiocdManager)
+ _audiocdManager = new DefaultAudioCDManager();
+#endif
-Common::EventManager *BaseBackend::getEventManager() {
- // FIXME/TODO: Eventually this method should be turned into an abstract one,
- // to force backends to implement this conciously (even if they
- // end up returning the default event manager anyway).
- if (!s_eventManager)
- s_eventManager = new DefaultEventManager(this);
- return s_eventManager;
+ OSystem::initBackend();
}
void BaseBackend::fillScreen(uint32 col) {
@@ -49,49 +64,3 @@ void BaseBackend::fillScreen(uint32 col) {
memset(screen->pixels, col, screen->h * screen->pitch);
unlockScreen();
}
-
-
-/*
- FIXME: Maybe we should push the default config file loading/saving code below
- out to all the backends?
-*/
-
-
-#if defined(UNIX)
-#define DEFAULT_CONFIG_FILE ".scummvmrc"
-#endif
-
-#if !defined(UNIX)
-#define DEFAULT_CONFIG_FILE "scummvm.ini"
-#endif
-
-BaseBackend::BaseBackend() {
- _audiocdManager = 0;
-}
-
-BaseBackend::~BaseBackend() {
- delete _audiocdManager;
-}
-
-Common::SeekableReadStream *BaseBackend::createConfigReadStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
- return file.createReadStream();
-}
-
-Common::WriteStream *BaseBackend::createConfigWriteStream() {
-#ifdef __DC__
- return 0;
-#else
- Common::FSNode file(DEFAULT_CONFIG_FILE);
- return file.createWriteStream();
-#endif
-}
-
-AudioCDManager *BaseBackend::getAudioCDManager() {
- if (!_audiocdManager)
- _audiocdManager = new DefaultAudioCDManager();
- return _audiocdManager;
-}
-
-void BaseBackend::resetGraphicsScale() {
-}
diff --git a/backends/base-backend.h b/backends/base-backend.h
index 864c11544a..c797e831a8 100644
--- a/backends/base-backend.h
+++ b/backends/base-backend.h
@@ -24,26 +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:
- BaseBackend();
- ~BaseBackend();
+ virtual void initBackend();
- virtual Common::EventManager *getEventManager();
virtual void displayMessageOnOSD(const char *msg);
virtual void fillScreen(uint32 col);
+};
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
-
- virtual AudioCDManager *getAudioCDManager();
-
- virtual void resetGraphicsScale();
-
+class EventsBaseBackend : public BaseBackend, Common::EventSource {
protected:
- AudioCDManager *_audiocdManager;
+ 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 86d4de384f..0000000000
--- a/backends/events/gp2xsdl/gp2xsdl-events.cpp
+++ /dev/null
@@ -1,463 +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"
-
-// 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/gp2xsdl/gp2xsdl-events.h b/backends/events/gp2xsdl/gp2xsdl-events.h
deleted file mode 100644
index 0d74c1bcac..0000000000
--- a/backends/events/gp2xsdl/gp2xsdl-events.h
+++ /dev/null
@@ -1,56 +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.
- *
- */
-
-#if !defined(BACKEND_EVENTS_SDL_GP2X_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER)
-#define BACKEND_EVENTS_SDL_GP2X_H
-
-#include "backends/events/sdl/sdl-events.h"
-
-/**
- * SDL events manager for GP2X
- */
-class GP2XSdlEventSource : public SdlEventSource {
-public:
- GP2XSdlEventSource();
-
-protected:
- bool _stickBtn[32];
-
- /** Button state for L button modifier */
- bool _buttonStateL;
-
- /**
- * Handles the stick movement
- */
- void moveStick();
-
- 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 SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event);
-
- virtual bool remapKey(SDL_Event &ev, Common::Event &event);
-};
-
-#endif
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp
index d2b3483f84..b461f85fbb 100644
--- a/backends/events/gph/gph-events.cpp
+++ b/backends/events/gph/gph-events.cpp
@@ -34,6 +34,7 @@
#include "common/util.h"
#include "common/events.h"
+#include "common/translation.h"
#define JOY_DEADZONE 2200
@@ -186,7 +187,6 @@ GPHEventSource::GPHEventSource()
// }
//}
-
void GPHEventSource::moveStick() {
bool stickBtn[32];
@@ -363,11 +363,11 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
if (BUTTON_STATE_L == true) {
GPH::ToggleTapMode();
if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click"));
} else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
} else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
}
} else {
event.kbd.keycode = Common::KEYCODE_SPACE;
@@ -387,17 +387,17 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
case BUTTON_VOLUP:
WIZ_HW::mixerMoveVolume(2);
if (WIZ_HW::volumeLevel == 100) {
- g_system->displayMessageOnOSD("Maximum Volume");
+ g_system->displayMessageOnOSD(_("Maximum Volume"));
} else {
- g_system->displayMessageOnOSD("Increasing Volume");
+ g_system->displayMessageOnOSD(_("Increasing Volume"));
}
break;
case BUTTON_VOLDOWN:
WIZ_HW::mixerMoveVolume(1);
if (WIZ_HW::volumeLevel == 0) {
- g_system->displayMessageOnOSD("Minimal Volume");
+ g_system->displayMessageOnOSD(_("Minimal Volume"));
} else {
- g_system->displayMessageOnOSD("Decreasing Volume");
+ g_system->displayMessageOnOSD(_("Decreasing Volume"));
}
break;
case BUTTON_HOLD:
@@ -406,11 +406,11 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
case BUTTON_HELP2:
GPH::ToggleTapMode();
if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode': Left Click");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click"));
} else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode': Right Click");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
} else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode': Hover (No Click)");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
}
break;
}
diff --git a/backends/events/openpandora/op-events.cpp b/backends/events/openpandora/op-events.cpp
index 381cbf89e9..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)
@@ -34,6 +33,10 @@
#include "backends/platform/openpandora/op-sdl.h"
#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;
@@ -48,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
*/
@@ -73,11 +138,11 @@ bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
case SDLK_PAGEUP:
OP::ToggleTapMode();
if (OP::tapmodeLevel == TAPMODE_LEFT) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode' - Left Click");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click"));
} else if (OP::tapmodeLevel == TAPMODE_RIGHT) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode' - Right Click");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
} else if (OP::tapmodeLevel == TAPMODE_HOVER) {
- g_system->displayMessageOnOSD("Touchscreen 'Tap Mode' - Hover (No Click)");
+ g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
}
break;
case SDLK_RSHIFT:
@@ -122,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/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index cadb10a954..835d98e718 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -279,7 +279,7 @@ bool SdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_QUIT;
return true;
}
-#elif defined(UNIX)
+#elif defined(POSIX)
// On other *nix systems, Control-Q quits
if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') {
event.type = Common::EVENT_QUIT;
@@ -323,7 +323,7 @@ bool SdlEventSource::handleKeyUp(SDL_Event &ev, Common::Event &event) {
if (ev.key.keysym.sym == 'm' || // Ctrl-m toggles mouse capture
#if defined(MACOSX)
// Meta - Q, handled below
-#elif defined(UNIX)
+#elif defined(POSIX)
ev.key.keysym.sym == 'q' || // On other *nix systems, Control-Q quits
#else
ev.key.keysym.sym == 'z' || // Ctrl-z quit
@@ -336,7 +336,7 @@ bool SdlEventSource::handleKeyUp(SDL_Event &ev, Common::Event &event) {
#if defined(MACOSX)
if ((mod & KMOD_META) && ev.key.keysym.sym == 'q')
return false; // On Macintosh, Cmd-Q quits
-#elif defined(UNIX)
+#elif defined(POSIX)
// Control Q has already been handled above
#else
if ((mod & KMOD_ALT) && ev.key.keysym.sym == 'x')
diff --git a/backends/events/wincesdl/wincesdl-events.cpp b/backends/events/wincesdl/wincesdl-events.cpp
index f15a416b76..4fab47a58e 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));
@@ -199,7 +200,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
}
}
- if (_freeLook && !_closeClick) {
+ if (freeLookActive && !_closeClick) {
_rbutton = false;
_tapTime = 0;
_tapX = event.mouse.x;
@@ -241,7 +242,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 +323,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/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp
index 6c11ddc605..e3f282df05 100644
--- a/backends/fs/ds/ds-fs.cpp
+++ b/backends/fs/ds/ds-fs.cpp
@@ -602,35 +602,11 @@ size_t std_fread(void *ptr, size_t size, size_t numItems, FILE *handle) {
}
size_t std_fwrite(const void *ptr, size_t size, size_t numItems, FILE *handle) {
- if ((handle == stdin))
- return 0;
-
- if ((handle == stderr) || (handle == stdout)) {
-#ifndef DISABLE_TEXT_CONSOLE
- nocashMessage((char *) ptr);
-// consolePrintf((char *) ptr);
-#endif
- return size;
- }
-
//consolePrintf("fwrite size=%d\n", size * numItems);
if (DS::isGBAMPAvailable()) {
FAT_fwrite(ptr, size, numItems, (FAT_FILE *) handle);
return numItems;
-
- int length = size * numItems;
- int pos = 0;
-
- while (pos < length) {
- int amount = length > 512? 512: length;
-
- FAT_fwrite(((char *) (ptr)) + pos, 1, amount, (FAT_FILE *) handle);
- length -= amount;
- pos += amount;
- }
-
- return numItems;
}
return 0;
diff --git a/backends/fs/posix/posix-fs-factory.cpp b/backends/fs/posix/posix-fs-factory.cpp
index c94e90ccde..829355be84 100644
--- a/backends/fs/posix/posix-fs-factory.cpp
+++ b/backends/fs/posix/posix-fs-factory.cpp
@@ -19,13 +19,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#if defined(UNIX)
+#if defined(POSIX)
// 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.
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit //Needed for IRIX's unistd.h
#include "backends/fs/posix/posix-fs-factory.h"
#include "backends/fs/posix/posix-fs.h"
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index 7f2ca695c5..0b94c37b16 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(UNIX)
+#if defined(POSIX)
// 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.
@@ -27,6 +27,7 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit //Needed for IRIX's unistd.h
#include "backends/fs/posix/posix-fs.h"
#include "backends/fs/stdiostream.h"
@@ -249,4 +250,4 @@ Common::WriteStream *POSIXFilesystemNode::createWriteStream() {
return StdioStream::makeFromPath(getPath(), true);
}
-#endif //#if defined(UNIX)
+#endif //#if defined(POSIX)
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 6690244fb7..8a141e97a5 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -468,7 +468,7 @@ bool DINGUXSdlGraphicsManager::loadGFXMode() {
bool DINGUXSdlGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette);
+ (f == OSystem::kFeatureCursorPalette);
}
void DINGUXSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
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/gp2xsdl/gp2xsdl-graphics.h b/backends/graphics/gp2xsdl/gp2xsdl-graphics.h
deleted file mode 100644
index 341b913acd..0000000000
--- a/backends/graphics/gp2xsdl/gp2xsdl-graphics.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef BACKENDS_GRAPHICS_SDL_GP2X_H
-#define BACKENDS_GRAPHICS_SDL_GP2X_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();
-
-protected:
- bool _adjustZoomOnMouse;
-};
-
-#endif
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index b407bf1faf..eb748f2fc2 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)
+ : SdlGraphicsManager(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;
}
@@ -433,26 +455,65 @@ void GPHGraphicsManager::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 SdlGraphicsManager::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) {
@@ -476,7 +537,7 @@ bool GPHGraphicsManager::loadGFXMode() {
bool GPHGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette);
+ (f == OSystem::kFeatureCursorPalette);
}
void GPHGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
diff --git a/backends/graphics/gph/gph-graphics.h b/backends/graphics/gph/gph-graphics.h
index 6ba2b344a6..fc3dc5730d 100644
--- a/backends/graphics/gph/gph-graphics.h
+++ b/backends/graphics/gph/gph-graphics.h
@@ -24,7 +24,7 @@
#define BACKENDS_GRAPHICS_GPH_H
#include "backends/graphics/sdl/sdl-graphics.h"
-#include "graphics/scaler/aspect.h" // for aspect2Real
+#include "graphics/scaler/aspect.h" // for aspect2Real
#include "graphics/scaler/downscaler.h"
enum {
@@ -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);
diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index 4e681eb155..20924ed581 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -82,7 +82,6 @@ public:
virtual void warpMouse(int x, int y) = 0;
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0;
virtual void setCursorPalette(const byte *colors, uint start, uint num) = 0;
- virtual void disableCursorPalette(bool disable) = 0;
virtual void displayMessageOnOSD(const char *msg) {}
};
diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h
index 673d59814e..28b24f6aca 100644
--- a/backends/graphics/null/null-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -79,7 +79,6 @@ public:
void warpMouse(int x, int y) {}
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) {}
void setCursorPalette(const byte *colors, uint start, uint num) {}
- void disableCursorPalette(bool disable) {}
};
#endif
diff --git a/backends/graphics/opengl/gltexture.h b/backends/graphics/opengl/gltexture.h
index 63d5e3a733..f0cd7aed56 100644
--- a/backends/graphics/opengl/gltexture.h
+++ b/backends/graphics/opengl/gltexture.h
@@ -20,6 +20,8 @@
*
*/
+#include "common/scummsys.h"
+
#ifdef WIN32
#if defined(ARRAYSIZE) && !defined(_WINDOWS_)
#undef ARRAYSIZE
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 32c0fbca6f..c0551de386 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -91,7 +91,7 @@ void OpenGLGraphicsManager::initEventObserver() {
bool OpenGLGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette);
+ (f == OSystem::kFeatureCursorPalette);
}
void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
@@ -105,6 +105,11 @@ void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
_transactionDetails.needRefresh = true;
break;
+ case OSystem::kFeatureCursorPalette:
+ _cursorPaletteDisabled = !enable;
+ _cursorNeedsRedraw = true;
+ break;
+
default:
break;
}
@@ -118,6 +123,9 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) {
case OSystem::kFeatureAspectRatioCorrection:
return _videoMode.aspectRatioCorrection;
+ case OSystem::kFeatureCursorPalette:
+ return !_cursorPaletteDisabled;
+
default:
return false;
}
@@ -642,11 +650,6 @@ void OpenGLGraphicsManager::setCursorPalette(const byte *colors, uint start, uin
_cursorNeedsRedraw = true;
}
-void OpenGLGraphicsManager::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
- _cursorNeedsRedraw = true;
-}
-
//
// Misc
//
@@ -1382,7 +1385,7 @@ const char *OpenGLGraphicsManager::getCurrentModeName() {
#ifdef USE_OSD
void OpenGLGraphicsManager::updateOSD() {
// The font we are going to use:
- const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kOSDFont);
+ const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont);
if (_osdSurface.w != _osdTexture->getWidth() || _osdSurface.h != _osdTexture->getHeight())
_osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), _overlayFormat);
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index daba7748bc..463715aad8 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -107,7 +107,6 @@ 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);
- virtual void disableCursorPalette(bool disable);
virtual void displayMessageOnOSD(const char *msg);
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 3f9ffc9f3e..87457c3c08 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -28,6 +28,7 @@
#include "backends/platform/sdl/sdl.h"
#include "common/config-manager.h"
#include "common/textconsole.h"
+#include "common/translation.h"
OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
:
@@ -394,7 +395,8 @@ void OpenGLSdlGraphicsManager::displayModeChangedMsg() {
const int scaleFactor = getScale();
char buffer[128];
- sprintf(buffer, "Current display mode: %s\n%d x %d -> %d x %d",
+ sprintf(buffer, "%s: %s\n%d x %d -> %d x %d",
+ _("Current display mode"),
newModeName,
_videoMode.screenWidth * scaleFactor,
_videoMode.screenHeight * scaleFactor,
@@ -406,7 +408,8 @@ void OpenGLSdlGraphicsManager::displayModeChangedMsg() {
void OpenGLSdlGraphicsManager::displayScaleChangedMsg() {
char buffer[128];
const int scaleFactor = getScale();
- sprintf(buffer, "Current scale: x%d\n%d x %d -> %d x %d",
+ sprintf(buffer, "%s: x%d\n%d x %d -> %d x %d",
+ _("Current scale"),
scaleFactor,
_videoMode.screenWidth, _videoMode.screenHeight,
_videoMode.overlayWidth, _videoMode.overlayHeight
@@ -449,11 +452,13 @@ void OpenGLSdlGraphicsManager::toggleFullScreen(int loop) {
#ifdef USE_OSD
char buffer[128];
if (getFullscreenMode())
- sprintf(buffer, "Fullscreen mode\n%d x %d",
+ sprintf(buffer, "%s\n%d x %d",
+ _("Fullscreen mode"),
_hwscreen->w, _hwscreen->h
);
else
- sprintf(buffer, "Windowed mode\n%d x %d",
+ sprintf(buffer, "%s\n%d x %d",
+ _("Windowed mode"),
_hwscreen->w, _hwscreen->h
);
displayMessageOnOSD(buffer);
@@ -508,11 +513,13 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
#ifdef USE_OSD
char buffer[128];
if (getFeatureState(OSystem::kFeatureAspectRatioCorrection))
- sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d",
+ sprintf(buffer, "%s\n%d x %d -> %d x %d",
+ _("Enabled aspect ratio correction"),
_videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h);
else
- sprintf(buffer, "Disabled aspect ratio correction\n%d x %d -> %d x %d",
+ sprintf(buffer, "%s\n%d x %d -> %d x %d",
+ _("Disabled aspect ratio correction"),
_videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h);
displayMessageOnOSD(buffer);
@@ -532,9 +539,9 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
// modes we use, we might want to consider a better way of
// displaying information to the user.
if (getAntialiasingState())
- displayMessageOnOSD("Active filter mode: Linear");
+ displayMessageOnOSD(_("Active filter mode: Linear"));
else
- displayMessageOnOSD("Active filter mode: Nearest");
+ displayMessageOnOSD(_("Active filter mode: Nearest"));
#endif
return true;
}
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index 20ee5dfc36..c8617635a5 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)
+ : SdlGraphicsManager(sdlEventSource) {
}
bool OPGraphicsManager::loadGFXMode() {
diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h
index b0d4298620..4bb89ca1e6 100644
--- a/backends/graphics/openpandora/op-graphics.h
+++ b/backends/graphics/openpandora/op-graphics.h
@@ -33,30 +33,30 @@ enum {
class OPGraphicsManager : public SdlGraphicsManager {
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();
+// SdlGraphicsManager::MousePos *getMouseCurState();
+// SdlGraphicsManager::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 b929b5fe27..f6832978a8 100644
--- a/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
+++ b/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
@@ -20,12 +20,14 @@
*
*/
+#include "common/scummsys.h"
+
+#if defined(SAMSUNGTV)
+
#include "backends/platform/samsungtv/samsungtv.h"
#include "backends/events/samsungtvsdl/samsungtvsdl-events.h"
#include "backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h"
-#if defined(SAMSUNGTV)
-
SamsungTVSdlGraphicsManager::SamsungTVSdlGraphicsManager(SdlEventSource *sdlEventSource)
: SdlGraphicsManager(sdlEventSource) {
}
@@ -33,7 +35,7 @@ SamsungTVSdlGraphicsManager::SamsungTVSdlGraphicsManager(SdlEventSource *sdlEven
bool SamsungTVSdlGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette);
+ (f == OSystem::kFeatureCursorPalette);
}
void SamsungTVSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 7a5b777032..9063f55744 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -223,7 +223,7 @@ bool SdlGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureFullscreenMode) ||
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette) ||
+ (f == OSystem::kFeatureCursorPalette) ||
(f == OSystem::kFeatureIconifyWindow);
}
@@ -235,6 +235,10 @@ void SdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
case OSystem::kFeatureAspectRatioCorrection:
setAspectRatioCorrection(enable);
break;
+ case OSystem::kFeatureCursorPalette:
+ _cursorPaletteDisabled = !enable;
+ blitCursor();
+ break;
case OSystem::kFeatureIconifyWindow:
if (enable)
SDL_WM_IconifyWindow();
@@ -245,13 +249,15 @@ void SdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
}
bool SdlGraphicsManager::getFeatureState(OSystem::Feature f) {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
switch (f) {
case OSystem::kFeatureFullscreenMode:
return _videoMode.fullscreen;
case OSystem::kFeatureAspectRatioCorrection:
return _videoMode.aspectRatioCorrection;
+ case OSystem::kFeatureCursorPalette:
+ return !_cursorPaletteDisabled;
default:
return false;
}
@@ -1458,11 +1464,6 @@ void SdlGraphicsManager::setCursorPalette(const byte *colors, uint start, uint n
blitCursor();
}
-void SdlGraphicsManager::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
- blitCursor();
-}
-
void SdlGraphicsManager::setShakePos(int shake_pos) {
assert (_transactionMode == kTransactionNone);
@@ -2059,7 +2060,7 @@ void SdlGraphicsManager::displayMessageOnOSD(const char *msg) {
_osdSurface->format->Bshift, _osdSurface->format->Ashift);
// The font we are going to use:
- const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kOSDFont);
+ const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont);
// Clear everything with the "transparent" color, i.e. the colorkey
SDL_FillRect(_osdSurface, 0, kOSDColorKey);
@@ -2132,12 +2133,14 @@ bool SdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
#ifdef USE_OSD
char buffer[128];
if (_videoMode.aspectRatioCorrection)
- sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d",
+ sprintf(buffer, "%s\n%d x %d -> %d x %d",
+ _("Enabled aspect ratio correction"),
_videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h
);
else
- sprintf(buffer, "Disabled aspect ratio correction\n%d x %d -> %d x %d",
+ sprintf(buffer, "%s\n%d x %d -> %d x %d",
+ _("Disabled aspect ratio correction"),
_videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h
);
@@ -2191,7 +2194,8 @@ bool SdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
}
if (newScalerName) {
char buffer[128];
- sprintf(buffer, "Active graphics filter: %s\n%d x %d -> %d x %d",
+ sprintf(buffer, "%s %s\n%d x %d -> %d x %d",
+ _("Active graphics filter:"),
newScalerName,
_videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h
@@ -2245,9 +2249,9 @@ void SdlGraphicsManager::toggleFullScreen() {
endGFXTransaction();
#ifdef USE_OSD
if (_videoMode.fullscreen)
- displayMessageOnOSD("Fullscreen mode");
+ displayMessageOnOSD(_("Fullscreen mode"));
else
- displayMessageOnOSD("Windowed mode");
+ displayMessageOnOSD(_("Windowed mode"));
#endif
}
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index 86e52a0bf6..9627ab23a3 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -132,7 +132,6 @@ 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);
- virtual void disableCursorPalette(bool disable);
#ifdef USE_OSD
virtual void displayMessageOnOSD(const char *msg);
diff --git a/backends/graphics/symbiansdl/symbiansdl-graphics.cpp b/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
index 4d656cd7cd..a88c8a8ffe 100644
--- a/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
+++ b/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
@@ -54,7 +54,7 @@ bool SymbianSdlGraphicsManager::hasFeature(OSystem::Feature f) {
switch (f) {
case OSystem::kFeatureFullscreenMode:
case OSystem::kFeatureAspectRatioCorrection:
- case OSystem::kFeatureCursorHasPalette:
+ case OSystem::kFeatureCursorPalette:
#ifdef USE_VIBRA_SE_PXXX
case OSystem::kFeatureVibration:
#endif
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index 80b04ca56d..8ba7b5821d 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.cpp
+++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp
@@ -49,8 +49,8 @@ WINCESdlGraphicsManager::WINCESdlGraphicsManager(SdlEventSource *sdlEventSource)
_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;
@@ -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
@@ -1627,6 +1626,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..2727bc0d27 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.h
+++ b/backends/graphics/wincesdl/wincesdl-graphics.h
@@ -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,8 @@ public:
void swap_zoom_up();
void swap_zoom_down();
void swap_mouse_visibility();
-
+ void swap_freeLook();
+ bool getFreeLookState();
//#ifdef WIN32_PLATFORM_WFSP
void move_cursor_up();
@@ -96,7 +99,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,6 +108,11 @@ 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
@@ -122,11 +129,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 +160,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 +188,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/midi/alsa.cpp b/backends/midi/alsa.cpp
index 28e44b445a..c006b6b6bf 100644
--- a/backends/midi/alsa.cpp
+++ b/backends/midi/alsa.cpp
@@ -164,7 +164,7 @@ int MidiDriver_ALSA::open() {
}
printf("Connected to Alsa sequencer client [%d:%d]\n", seq_client, seq_port);
- printf("ALSA client initialised [%d:0]\n", my_client);
+ printf("ALSA client initialized [%d:0]\n", my_client);
return 0;
}
@@ -382,7 +382,7 @@ MusicDevices AlsaMusicPlugin::getDevices() const {
AlsaDevices alsaDevices = getAlsaDevices();
- // Since the default behaviour is to use the first device in the list,
+ // Since the default behavior is to use the first device in the list,
// try to put something sensible there. We used to have 17:0 and 65:0
// as defaults.
diff --git a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp
index 526a01d1bf..001389b1c0 100644
--- a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp
+++ b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp
@@ -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 61e7f051e5..979b18e264 100644
--- a/backends/mixer/sdl/sdl-mixer.cpp
+++ b/backends/mixer/sdl/sdl-mixer.cpp
@@ -20,6 +20,8 @@
*
*/
+#include "common/scummsys.h"
+
#if defined(SDL_BACKEND)
#include "backends/mixer/sdl/sdl-mixer.h"
@@ -59,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);
_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();
@@ -131,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..82ffa4f901 100644
--- a/backends/mixer/sdl/sdl-mixer.h
+++ b/backends/mixer/sdl/sdl-mixer.h
@@ -67,7 +67,7 @@ protected:
* The obtained audio specification after opening the
* audio system.
*/
- SDL_AudioSpec _obtainedRate;
+ SDL_AudioSpec _obtained;
/** State of the audio system */
bool _audioSuspended;
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 c5f147ffe1..525170d685 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -24,44 +24,25 @@
#include "backends/modular-backend.h"
-#include "backends/fs/fs-factory.h"
-#include "backends/audiocd/audiocd.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),
- _eventManager(0),
- _savefileManager(0),
- _timerManager(0),
_mutexManager(0),
_graphicsManager(0),
- _mixer(0),
- _audiocdManager(0) {
+ _mixer(0) {
}
ModularBackend::~ModularBackend() {
- delete _fsFactory;
- _fsFactory = 0;
delete _graphicsManager;
_graphicsManager = 0;
- delete _eventManager;
- _eventManager = 0;
delete _mixer;
_mixer = 0;
- delete _audiocdManager;
- _audiocdManager = 0;
- delete _savefileManager;
- _savefileManager = 0;
- delete _timerManager;
- _timerManager = 0;
delete _mutexManager;
_mutexManager = 0;
}
@@ -222,20 +203,6 @@ void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num)
_graphicsManager->setCursorPalette(colors, start, num);
}
-void ModularBackend::disableCursorPalette(bool disable) {
- _graphicsManager->disableCursorPalette(disable);
-}
-
-Common::TimerManager *ModularBackend::getTimerManager() {
- assert(_timerManager);
- return _timerManager;
-}
-
-Common::EventManager *ModularBackend::getEventManager() {
- assert(_eventManager);
- return _eventManager;
-}
-
OSystem::MutexRef ModularBackend::createMutex() {
assert(_mutexManager);
return _mutexManager->createMutex();
@@ -261,25 +228,10 @@ Audio::Mixer *ModularBackend::getMixer() {
return (Audio::Mixer *)_mixer;
}
-AudioCDManager *ModularBackend::getAudioCDManager() {
- assert(_audiocdManager);
- return _audiocdManager;
-}
-
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 e46fbfdd21..3593130bf5 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -23,9 +23,7 @@
#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;
@@ -39,8 +37,6 @@ class MutexManager;
* A backend derivated from this class, will need to implement
* these functions on its own:
* OSystem::pollEvent()
- * OSystem::createConfigReadStream()
- * OSystem::createConfigWriteStream()
* OSystem::getMillis()
* OSystem::delayMillis()
* OSystem::getTimeAndDate()
@@ -48,7 +44,7 @@ class MutexManager;
* 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();
@@ -106,15 +102,12 @@ 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);
- virtual void disableCursorPalette(bool disable);
//@}
/** @name Events and Time */
//@{
- virtual Common::TimerManager *getTimerManager();
- virtual Common::EventManager *getEventManager();
virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; }
//@}
@@ -136,18 +129,9 @@ public:
//@}
- /** @name Audio CD */
- //@{
-
- virtual AudioCDManager *getAudioCDManager();
-
- //@}
-
/** @name Miscellaneous */
//@{
- virtual Common::SaveFileManager *getSavefileManager();
- virtual FilesystemFactory *getFilesystemFactory();
virtual void quit();
virtual void displayMessageOnOSD(const char *msg);
@@ -157,14 +141,9 @@ protected:
/** @name Managers variables */
//@{
- FilesystemFactory *_fsFactory;
- Common::EventManager *_eventManager;
- Common::SaveFileManager *_savefileManager;
- Common::TimerManager *_timerManager;
MutexManager *_mutexManager;
GraphicsManager *_graphicsManager;
Audio::Mixer *_mixer;
- AudioCDManager *_audiocdManager;
//@}
};
diff --git a/backends/module.mk b/backends/module.mk
index adef8a2c0a..d1feae4317 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -7,20 +7,19 @@ MODULE_OBJS := \
events/default/default-events.o \
fs/abstract-fs.o \
fs/stdiostream.o \
- graphics/opengl/glerrorcheck.o \
- graphics/opengl/gltexture.o \
- graphics/opengl/opengl-graphics.o \
- graphics/openglsdl/openglsdl-graphics.o \
- keymapper/action.o \
- keymapper/keymap.o \
- keymapper/keymapper.o \
- keymapper/remap-dialog.o \
log/log.o \
midi/alsa.o \
midi/dmedia.o \
midi/seq.o \
midi/stmidi.o \
midi/timidity.o \
+ saves/savefile.o \
+ saves/default/default-saves.o \
+ timer/default/default-timer.o
+
+
+ifdef USE_ELF_LOADER
+MODULE_OBJS += \
plugins/elf/arm-loader.o \
plugins/elf/elf-loader.o \
plugins/elf/elf-provider.o \
@@ -28,23 +27,38 @@ MODULE_OBJS := \
plugins/elf/mips-loader.o \
plugins/elf/ppc-loader.o \
plugins/elf/shorts-segment-manager.o \
- plugins/elf/version.o \
- saves/savefile.o \
- saves/default/default-saves.o \
- timer/default/default-timer.o \
+ plugins/elf/version.o
+endif
+
+ifdef ENABLE_KEYMAPPER
+MODULE_OBJS += \
+ keymapper/action.o \
+ keymapper/keymap.o \
+ keymapper/keymapper.o \
+ keymapper/remap-dialog.o
+endif
+
+ifdef USE_OPENGL
+MODULE_OBJS += \
+ graphics/opengl/glerrorcheck.o \
+ graphics/opengl/gltexture.o \
+ graphics/opengl/opengl-graphics.o \
+ graphics/openglsdl/openglsdl-graphics.o
+endif
+
+ifdef ENABLE_VKEYBD
+MODULE_OBJS += \
vkeybd/image-map.o \
vkeybd/polygon.o \
vkeybd/virtual-keyboard.o \
vkeybd/virtual-keyboard-gui.o \
vkeybd/virtual-keyboard-parser.o
+endif
# SDL specific source files.
# We cannot just check $BACKEND = sdl, as various other backends
# derive from the SDL backend, and they all need the following files.
-# TODO: Add SDL_BACKEND to config.mk; this would match the fact that
-# we also add -DSDL_BACKEND to the DEFINES.
-# However, the latter is only done for *most* SDL based stuff, not always
-# so we really should unify the relevant code in configure.
+ifdef SDL_BACKEND
MODULE_OBJS += \
audiocd/sdl/sdl-audiocd.o \
events/sdl/sdl-events.o \
@@ -54,8 +68,9 @@ MODULE_OBJS += \
mutex/sdl/sdl-mutex.o \
plugins/sdl/sdl-provider.o \
timer/sdl/sdl-timer.o
+endif
-ifdef UNIX
+ifdef POSIX
MODULE_OBJS += \
fs/posix/posix-fs.o \
fs/posix/posix-fs-factory.o \
@@ -103,14 +118,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 \
@@ -147,7 +154,7 @@ MODULE_OBJS += \
timer/psp/timer.o
endif
-ifeq ($(BACKEND),samsungstv)
+ifeq ($(BACKEND),samsungtv)
MODULE_OBJS += \
events/samsungtvsdl/samsungtvsdl-events.o \
graphics/samsungtvsdl/samsungtvsdl-graphics.o
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index eeeddb4c77..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);
@@ -388,6 +388,8 @@ void OSystem_Android::initBackend() {
warning("couldn't renice the main thread");
JNI::setReadyForEvents(true);
+
+ EventsBaseBackend::initBackend();
}
void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {
@@ -399,7 +401,7 @@ void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {
bool OSystem_Android::hasFeature(Feature f) {
return (f == kFeatureFullscreenMode ||
f == kFeatureAspectRatioCorrection ||
- f == kFeatureCursorHasPalette ||
+ f == kFeatureCursorPalette ||
f == kFeatureVirtualKeyboard ||
f == kFeatureOverlaySupportsAlpha);
}
@@ -420,6 +422,11 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) {
_virtkeybd_on = enable;
showVirtualKeyboard(enable);
break;
+ case kFeatureCursorPalette:
+ _use_mouse_palette = enable;
+ if (!enable)
+ disableCursorPalette();
+ break;
default:
break;
}
@@ -433,6 +440,8 @@ bool OSystem_Android::getFeatureState(Feature f) {
return _ar_correction;
case kFeatureVirtualKeyboard:
return _virtkeybd_on;
+ case kFeatureCursorPalette:
+ return _use_mouse_palette;
default:
return false;
}
@@ -526,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);
@@ -554,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("");
@@ -568,6 +563,10 @@ void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,
void OSystem_Android::logMessage(LogMessageType::Type type,
const char *message) {
switch (type) {
+ case LogMessageType::kInfo:
+ __android_log_write(ANDROID_LOG_INFO, android_log_tag, message);
+ break;
+
case LogMessageType::kDebug:
__android_log_write(ANDROID_LOG_DEBUG, android_log_tag, message);
break;
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 752a31a4db..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;
@@ -237,6 +234,7 @@ private:
void clipMouse(Common::Point &p);
void scaleMouse(Common::Point &p, int x, int y, bool deductDrawRect = true);
void updateEventScale();
+ void disableCursorPalette();
protected:
// PaletteManager API
@@ -272,7 +270,6 @@ public:
int cursorTargetScale,
const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
@@ -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/gfx.cpp b/backends/platform/android/gfx.cpp
index 62226eb8b1..b8a9e74437 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -179,7 +179,7 @@ void OSystem_Android::initSurface() {
JNI::initSurface();
- // Initialise OpenGLES context.
+ // Initialize OpenGLES context.
GLESTexture::initGLExtensions();
if (_game_texture)
@@ -801,12 +801,10 @@ void OSystem_Android::setCursorPalette(const byte *colors,
_use_mouse_palette = true;
}
-void OSystem_Android::disableCursorPalette(bool disable) {
- ENTER("%d", disable);
-
+void OSystem_Android::disableCursorPalette() {
// when disabling the cursor palette, and we're running a clut8 game,
// it expects the game palette to be used for the cursor
- if (disable && _game_texture->hasPalette()) {
+ if (_game_texture->hasPalette()) {
const byte *src = _game_texture->palette_const();
byte *dst = _mouse_texture_palette->palette();
@@ -825,8 +823,6 @@ void OSystem_Android::disableCursorPalette(bool disable) {
byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
WRITE_UINT16(p, READ_UINT16(p) & ~1);
}
-
- _use_mouse_palette = !disable;
}
#endif
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
index c4de6d62f8..ef9f4cc1e0 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
@@ -260,7 +260,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
if (_audio_track.getState() != AudioTrack.STATE_INITIALIZED)
throw new Exception(
- String.format("Error initialising AudioTrack: %d",
+ String.format("Error initializing AudioTrack: %d",
_audio_track.getState()));
}
diff --git a/backends/platform/dc/Makefile b/backends/platform/dc/Makefile
index 0133ffd9e9..6da32a9049 100644
--- a/backends/platform/dc/Makefile
+++ b/backends/platform/dc/Makefile
@@ -11,9 +11,13 @@ CXX = sh-elf-g++ -ml -m4-single-only
LD = $(CXX)
CXXFLAGS= -O3 -Wno-multichar -funroll-loops -fschedule-insns2 -fomit-frame-pointer -fdelete-null-pointer-checks -fno-exceptions
DEFINES = -D__DC__ -DNONSTANDARD_PORT -DUSE_MAD -DUSE_ZLIB -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DUSE_RGB_COLOR
+# For release builds:
+#DEFINES += -DNOSERIAL
LDFLAGS = -Wl,-Ttext,0x8c010000 -nostartfiles $(ronindir)/lib/crt0.o
INCLUDES= -I./ -I$(srcdir) -I$(ronindir)/include/ -I$(srcdir)/engines
LIBS = -L$(ronindir)/lib -lmad -lronin -lz -lm
+# For release builds:
+#LIBS = -L$(ronindir)/lib -lmad -lronin-noserial -lz -lm
EXECUTABLE = scummvm.elf
DEPDIR = .deps
CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp
index 16547456c3..ac709f62b9 100644
--- a/backends/platform/dc/dc-fs.cpp
+++ b/backends/platform/dc/dc-fs.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "dc.h"
#include "backends/fs/abstract-fs.h"
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index 81f93a077e..bde50daa2d 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -53,7 +53,7 @@ class DCHardware {
};
class DCCDManager : public DefaultAudioCDManager {
- // Initialise the specified CD drive for audio playback.
+ // Initialize the specified CD drive for audio playback.
bool openCD(int drive);
// Poll cdrom status
@@ -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
@@ -145,9 +145,6 @@ public:
// Replace the specified range of cursor the palette with new colors.
void setCursorPalette(const byte *colors, uint start, uint num);
- // Disable or enable cursor palette.
- void disableCursorPalette(bool disable);
-
// Shaking is used in SCUMM. Set current shake position.
void setShakePos(int shake_pos);
@@ -164,8 +161,6 @@ public:
// Returns true if an event was retrieved.
bool pollEvent(Common::Event &event);
- AudioCDManager *getAudioCDManager() { return _cdManager; }
-
// Quit
void quit();
@@ -190,26 +185,20 @@ 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;
- DCCDManager *_cdManager;
int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y;
int _ms_hotspot_x, _ms_hotspot_y, _ms_visible, _devpoll, _last_screen_refresh;
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index dfce176e90..3faf0185ad 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -20,10 +20,7 @@
*
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <common/scummsys.h>
#include <engines/engine.h>
@@ -44,26 +41,29 @@ 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);
_mixer->setReady(true);
- _cdManager = new DCCDManager();
+ _audiocdManager = new DCCDManager();
+
+ EventsBaseBackend::initBackend();
}
@@ -163,7 +163,7 @@ bool OSystem_Dreamcast::hasFeature(Feature f)
case kFeatureAspectRatioCorrection:
case kFeatureVirtualKeyboard:
case kFeatureOverlaySupportsAlpha:
- case kFeatureCursorHasPalette:
+ case kFeatureCursorPalette:
return true;
default:
return false;
@@ -181,6 +181,9 @@ void OSystem_Dreamcast::setFeatureState(Feature f, bool enable)
case kFeatureVirtualKeyboard:
_softkbd_on = enable;
break;
+ case kFeatureCursorPalette:
+ _enable_cursor_palette = enable;
+ break;
default:
break;
}
@@ -193,6 +196,8 @@ bool OSystem_Dreamcast::getFeatureState(Feature f)
return _aspect_stretch;
case kFeatureVirtualKeyboard:
return _softkbd_on;
+ case kFeatureCursorPalette:
+ return _enable_cursor_palette;
default:
return false;
}
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index 56eef870c0..a11e329df3 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -171,11 +171,6 @@ void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint nu
_enable_cursor_palette = true;
}
-void OSystem_Dreamcast::disableCursorPalette(bool disable)
-{
- _enable_cursor_palette = !disable;
-}
-
void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)
{
const unsigned short *src = palette + start;
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/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/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp
index f18f69efa6..e06dd7fa43 100644
--- a/backends/platform/dc/vmsave.cpp
+++ b/backends/platform/dc/vmsave.cpp
@@ -20,10 +20,7 @@
*
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-
-#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <common/scummsys.h>
#include "engines/engine.h"
diff --git a/backends/platform/dingux/module.mk b/backends/platform/dingux/module.mk
index 2247625a04..b924fec1cf 100644
--- a/backends/platform/dingux/module.mk
+++ b/backends/platform/dingux/module.mk
@@ -4,8 +4,10 @@ MODULE_OBJS := \
main.o \
dingux.o
-MODULE_DIRS += \
- backends/platform/dingux/
+# 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)))
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(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/ds/arm9/dist/readme_ds.txt b/backends/platform/ds/arm9/dist/readme_ds.txt
index ee1db719f4..24c85ad556 100644
--- a/backends/platform/ds/arm9/dist/readme_ds.txt
+++ b/backends/platform/ds/arm9/dist/readme_ds.txt
@@ -679,7 +679,7 @@ not supported.
Cdex can do the conversion very well and I recommend using it to convert
your audio files, although any CD ripping software can be used, so feel
-free to use your favourite program. The format you need to use is
+free to use your favorite program. The format you need to use is
IMA-ADPCM 4-bit Mono. You may use any sample rate. All other formats
will be rejected, including uncompressed WAV files.
diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile
index 781738265c..1b21b41a9b 100644
--- a/backends/platform/ds/arm9/makefile
+++ b/backends/platform/ds/arm9/makefile
@@ -75,7 +75,7 @@ else
ifdef DS_BUILD_K
else
- # USE_MAD = 1
+ USE_MAD = 1
endif
endif
endif
@@ -245,7 +245,9 @@ ifdef USE_MAD
DEFINES += -DUSE_MAD
endif
-DEFINES += -DREDUCE_MEMORY_USAGE -DDISABLE_DEBUGGER -DUSE_TEXT_CONSOLE -DDISABLE_MASS_ADD -DDISABLE_NES_APU
+DEFINES += -DREDUCE_MEMORY_USAGE -DDISABLE_DEBUGGER -DUSE_TEXT_CONSOLE_FOR_DEBUGGER -DDISABLE_MASS_ADD -DDISABLE_NES_APU
+# for release builds:
+#DEFINES += -DNDEBUG
LDFLAGS = -specs=ds_arm9.specs -mthumb-interwork -mno-fpu -Wl,-Map,map.txt -Wl,--gc-sections
@@ -259,7 +261,7 @@ BACKEND := ds
INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \
-I$(portdir)/data -I$(portdir)/../commoninclude \
-I$(portdir)/source -I$(portdir)/source/mad \
- -I$(libndsdir)/include -include $(srcdir)/common/scummsys.h
+ -I$(libndsdir)/include -include $(portdir)/source/portdefs.h
LIBS = -lm -L$(libndsdir)/lib -L$(portdir)/lib -lnds9
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index b3146cc16f..dfd906d816 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -575,7 +575,7 @@ void initGame() {
for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
if (!stricmp(gameName, gameList[r].gameId)) {
s_currentGame = &gameList[r];
- // consolePrintf("Game list num: %d\n", s_currentGame);
+ // consolePrintf("Game list num: %d\n", r);
}
}
}
@@ -1668,8 +1668,7 @@ void addEventsToQueue() {
if (!keyboardEnable) {
-
- if ((isScrollingWithDPad() || (indyFightState)) && (displayModeIs8Bit)) {
+ if ((!isScrollingWithDPad() || (indyFightState)) && (displayModeIs8Bit)) {
// Controls specific to the control method
if (s_currentGame->control == CONT_SKY) {
diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
index 698590418c..76508a1664 100644
--- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
+++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
@@ -1010,7 +1010,7 @@ DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
dir.name[0] = FILE_FREE; // default to no file found
dir.attrib = 0x00;
- // Check if fat has been initialised
+ // Check if fat has been initialized
if (filesysBytePerSec == 0)
{
return (dir);
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 462990cb32..b157a3a87a 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -41,6 +41,9 @@
#include "touchkeyboard.h"
#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"
#endif
@@ -79,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;
@@ -87,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) {
@@ -106,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")) {
@@ -118,21 +129,32 @@ void OSystem_DS::initBackend() {
_mixer = new Audio::MixerImpl(this, DS::getSoundFrequency());
_mixer->setReady(true);
- OSystem::initBackend();
+ /* TODO/FIXME: The NDS should use a custom AudioCD manager instance!
+ if (!_audiocdManager)
+ _audiocdManager = new DSAudioCDManager();
+ */
+
+ EventsBaseBackend::initBackend();
}
bool OSystem_DS::hasFeature(Feature f) {
- return (f == kFeatureVirtualKeyboard) || (f == kFeatureCursorHasPalette);
+ return (f == kFeatureVirtualKeyboard) || (f == kFeatureCursorPalette);
}
void OSystem_DS::setFeatureState(Feature f, bool enable) {
if (f == kFeatureVirtualKeyboard)
DS::setKeyboardIcon(enable);
+ else if (f == kFeatureCursorPalette) {
+ _disableCursorPalette = !enable;
+ refreshCursor();
+ }
}
bool OSystem_DS::getFeatureState(Feature f) {
if (f == kFeatureVirtualKeyboard)
return DS::getKeyboardIcon();
+ if (f == kFeatureCursorPalette)
+ return !_disableCursorPalette;
return false;
}
@@ -734,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
@@ -840,16 +854,15 @@ void OSystem_DS::setCharactersEntered(int count) {
DS::setCharactersEntered(count);
}
-Common::SeekableReadStream *OSystem_DS::createConfigReadStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
-// consolePrintf("R %s", DEFAULT_CONFIG_FILE);
- return file.createReadStream();
+Common::String OSystem_DS::getDefaultConfigFileName() {
+ return DEFAULT_CONFIG_FILE;
}
-Common::WriteStream *OSystem_DS::createConfigWriteStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
-// consolePrintf("W %s", DEFAULT_CONFIG_FILE);
- return file.createWriteStream();
+void OSystem_DS::logMessage(LogMessageType::Type type, const char *message) {
+#ifndef DISABLE_TEXT_CONSOLE
+ nocashMessage((char *)message);
+// consolePrintf((char *)message);
+#endif
}
u16 OSystem_DS::applyGamma(u16 color) {
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 4ab2e36322..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);
@@ -172,14 +167,13 @@ public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool dis) { _disableCursorPalette = dis; refreshCursor(); }
-
- FilesystemFactory *getFilesystemFactory();
+ virtual FilesystemFactory *getFilesystemFactory();
void refreshCursor();
- Common::WriteStream *createConfigWriteStream();
- Common::SeekableReadStream *createConfigReadStream();
+ virtual Common::String getDefaultConfigFileName();
+
+ virtual void logMessage(LogMessageType::Type type, const char *message);
u16 applyGamma(u16 color);
void setGammaValue(int gamma) { _gammaValue = gamma; }
diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h
index 580eb680eb..f512ce3ea2 100644
--- a/backends/platform/ds/arm9/source/portdefs.h
+++ b/backends/platform/ds/arm9/source/portdefs.h
@@ -26,8 +26,11 @@
// Include ndstypes.h for uint16 etc. typedefs
#include "nds/ndstypes.h"
-// Somebody removed these from scummsys.h, but they're still required, so I'm
-// adding them here in the hope that they'll stay.
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
+// Include required headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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-common.h b/backends/platform/gp2x/gp2x-common.h
deleted file mode 100644
index 7efdd7164c..0000000000
--- a/backends/platform/gp2x/gp2x-common.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PLATFORM_SDL_GP2X_H
-#define PLATFORM_SDL_GP2X_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 {
-public:
- OSystem_GP2X() {}
-
- void initBackend();
- void quit();
- void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- void initSDL();
-
-protected:
-
-};
-
-#endif
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-main.cpp b/backends/platform/gp2x/gp2x-main.cpp
deleted file mode 100644
index f1ee5ed5f3..0000000000
--- a/backends/platform/gp2x/gp2x-main.cpp
+++ /dev/null
@@ -1,50 +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 "backends/platform/gp2x/gp2x-common.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();
- assert(g_system);
-
- // Pre initialize the backend
- ((OSystem_GP2X *)g_system)->init();
-
-#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new SDLPluginProvider());
-#endif
-
- // Invoke the actual ScummVM main entry point:
- int res = scummvm_main(argc, argv);
-
- // Free OSystem
- delete (OSystem_GP2X *)g_system;
-
- return res;
-}
-
-#endif
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-mem.h b/backends/platform/gp2x/gp2x-mem.h
deleted file mode 100644
index b2cd00a587..0000000000
--- a/backends/platform/gp2x/gp2x-mem.h
+++ /dev/null
@@ -1,51 +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 Stuff.
- *
- */
-
-#ifndef GP2X_MEM_H
-#define GP2X_MEM_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
-
-#endif //GP2X_MEM_H
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
deleted file mode 100644
index 4cdb4cd0d5..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);
-
- /* Initialise 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 837ad99d7b..0000000000
--- a/backends/platform/gp2x/module.mk
+++ /dev/null
@@ -1,12 +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)))
diff --git a/backends/platform/gph/build/caanoo-config-alleng.sh b/backends/platform/gph/build/caanoo-config-alleng.sh
index 97fed942fa..b7836508ed 100644
--- a/backends/platform/gph/build/caanoo-config-alleng.sh
+++ b/backends/platform/gph/build/caanoo-config-alleng.sh
@@ -8,10 +8,10 @@ echo and let all the build work be done from the backend/build folder.
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac \
+./configure --backend=caanoo --disable-mt32emu --host=caanoo \
+ --disable-alsa --disable-flac \
--disable-nasm --disable-vorbis --disable-hq-scalers \
--with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin \
- --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
diff --git a/backends/platform/gph/build/caanoo-config.sh b/backends/platform/gph/build/caanoo-config.sh
index 11d597481a..fe191647e6 100644
--- a/backends/platform/gph/build/caanoo-config.sh
+++ b/backends/platform/gph/build/caanoo-config.sh
@@ -8,10 +8,10 @@ echo and let all the build work be done from the backend/build folder.
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac \
+./configure --backend=caanoo --disable-mt32emu --host=caanoo \
+ --disable-alsa --disable-flac \
--disable-nasm --disable-vorbis --disable-hq-scalers \
--with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin \
- --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
diff --git a/backends/platform/gph/build/gp2x-config-alleng.sh b/backends/platform/gph/build/gp2x-config-alleng.sh
index 4a3526d50c..83a4fe2046 100644
--- a/backends/platform/gph/build/gp2x-config-alleng.sh
+++ b/backends/platform/gph/build/gp2x-config-alleng.sh
@@ -17,7 +17,13 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --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-all-engines --enable-vkeybd
+./configure --backend=gp2x --disable-mt32emu --host=gp2x \
+ --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
+ --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-all-engines --enable-vkeybd
#--enable-plugins --default-dynamic
echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gph/build/gp2x-config.sh b/backends/platform/gph/build/gp2x-config.sh
index 9092b0b1ea..a9b28b2fd0 100644
--- a/backends/platform/gph/build/gp2x-config.sh
+++ b/backends/platform/gph/build/gp2x-config.sh
@@ -17,8 +17,15 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --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
+./configure --backend=gp2x --disable-mt32emu --host=gp2x \
+ --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
+ --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
echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gph/build/gp2xwiz-config-alleng.sh b/backends/platform/gph/build/gp2xwiz-config-alleng.sh
index 9ec8a09cd2..ff905d0585 100644
--- a/backends/platform/gph/build/gp2xwiz-config-alleng.sh
+++ b/backends/platform/gph/build/gp2xwiz-config-alleng.sh
@@ -16,8 +16,9 @@ export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gph --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers \
- --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+./configure --backend=gph --disable-mt32emu --host=gp2xwiz \
+ --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
--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 \
diff --git a/backends/platform/gph/build/gp2xwiz-config.sh b/backends/platform/gph/build/gp2xwiz-config.sh
index ac7c34ad12..7be103602b 100644
--- a/backends/platform/gph/build/gp2xwiz-config.sh
+++ b/backends/platform/gph/build/gp2xwiz-config.sh
@@ -16,8 +16,9 @@ export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gph --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers \
- --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+./configure --backend=gph --disable-mt32emu --host=gp2xwiz \
+ --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
--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 \
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 375ee37378..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);
}
@@ -141,7 +148,7 @@ void OSystem_GPH::initBackend() {
printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
#endif /* DUMP_STDOUT */
- /* Initialise any GP2X Wiz specific stuff we may want (Batt Status, scaler etc.) */
+ /* Initialize any GP2X Wiz specific stuff we may want (Batt Status, scaler etc.) */
WIZ_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. */
@@ -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/gph/module.mk b/backends/platform/gph/module.mk
index a9951494d1..d8a1a6cd8d 100644
--- a/backends/platform/gph/module.mk
+++ b/backends/platform/gph/module.mk
@@ -11,4 +11,4 @@ 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 \ No newline at end of file
+-include $(srcdir)/backends/platform/sdl/module.mk
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 8e0ffc19cb..223f025978 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -67,6 +67,7 @@
- (void)updateMainSurface;
- (void)updateOverlaySurface;
- (void)updateMouseSurface;
+- (void)clearColorBuffer;
-(void)updateMouseCursor;
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 006603df64..04d25cebf8 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -85,6 +85,8 @@ void iPhone_setMouseCursor(short* buffer, int width, int height) {
void iPhone_enableOverlay(int state) {
_overlayIsEnabled = state;
+
+ [sharedInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES];
}
int iPhone_getScreenHeight() {
@@ -478,12 +480,7 @@ bool getLocalMouseCoords(CGPoint *point) {
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
- // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
- int clearCount = 5;
- while (clearCount-- > 0) {
- glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
- [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
- }
+ [self clearColorBuffer];
if (_keyboardView != nil) {
[_keyboardView removeFromSuperview];
@@ -535,6 +532,15 @@ bool getLocalMouseCoords(CGPoint *point) {
}
}
+- (void)clearColorBuffer {
+ // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
+ int clearCount = 5;
+ while (clearCount-- > 0) {
+ glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
+ [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
+ }
+}
+
- (id)getEvent {
if (_events == nil || [_events count] == 0) {
return nil;
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 12317ad935..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);
- OSystem::initBackend();
+ EventsBaseBackend::initBackend();
}
bool OSystem_IPHONE::hasFeature(Feature f) {
@@ -210,48 +207,25 @@ 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();
}
-Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() {
+Common::String OSystem_IPHONE::getDefaultConfigFileName() {
#ifdef IPHONE_OFFICIAL
- char buf[256];
- strncpy(buf, iPhone_getDocumentsDir(), 256);
- strncat(buf, "/Preferences", 256 - strlen(buf) );
- Common::FSNode file(buf);
+ Common::String path = iPhone_getDocumentsDir();
+ path += "/Preferences";
+ return path;
#else
- Common::FSNode file(SCUMMVM_PREFS_PATH);
+ return SCUMMVM_PREFS_PATH;
#endif
- return file.createReadStream();
}
-Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() {
-#ifdef IPHONE_OFFICIAL
- char buf[256];
- strncpy(buf, iPhone_getDocumentsDir(), 256);
- strncat(buf, "/Preferences", 256 - strlen(buf) );
- Common::FSNode file(buf);
-#else
- Common::FSNode file(SCUMMVM_PREFS_PATH);
-#endif
- return file.createWriteStream();
-}
void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
// Get URL of the Resource directory of the .app bundle
@@ -268,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 1ff87967a1..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,17 @@ 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::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
+ virtual Common::String getDefaultConfigFileName();
+
+ virtual void logMessage(LogMessageType::Type type, const char *message);
protected:
void internUpdateScreen();
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index 263cbd2bcc..fa425b108a 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -349,6 +349,7 @@ void OSystem_IPHONE::showOverlay() {
//printf("showOverlay()\n");
_overlayVisible = true;
dirtyFullOverlayScreen();
+ updateScreen();
iPhone_enableOverlay(true);
}
@@ -368,7 +369,7 @@ void OSystem_IPHONE::clearOverlay() {
void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
//printf("grabOverlay()\n");
- int h = _screenHeight;
+ int h = _overlayHeight;
OverlayColor *src = _overlayBuffer;
do {
diff --git a/backends/platform/linuxmoto/module.mk b/backends/platform/linuxmoto/module.mk
index c604d69da1..4c81aac3f2 100644
--- a/backends/platform/linuxmoto/module.mk
+++ b/backends/platform/linuxmoto/module.mk
@@ -10,5 +10,5 @@ MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
OBJS := $(MODULE_OBJS) $(OBJS)
MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
-# HACK: The linuxmoto backend is based on the SDL one, so we load that, too.
-include $(srcdir)/backends/platform/sdl/module.mk
+# 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/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 8c0b34ce32..285e2afa55 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
@@ -189,7 +184,6 @@ 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, const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
@@ -202,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 094bb839d3..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,28 +182,36 @@ void OSystem_N64::initBackend() {
}
}
- _savefile = new PAKSaveManager();
+ _savefileManager = new PAKSaveManager();
}
- _timer = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
setTimerCallback(&timer_handler, 10);
setupMixer();
- OSystem::initBackend();
-
+ EventsBaseBackend::initBackend();
}
bool OSystem_N64::hasFeature(Feature f) {
- return (f == kFeatureCursorHasPalette);
+ return (f == kFeatureCursorPalette);
}
void OSystem_N64::setFeatureState(Feature f, bool enable) {
- return;
+ if (f == kFeatureCursorPalette) {
+ _cursorPaletteDisabled = !enable;
+
+ // Rebuild cursor hicolor buffer
+ rebuildOffscreenMouseBuffer();
+
+ _dirtyOffscreen = true;
+ }
}
bool OSystem_N64::getFeatureState(Feature f) {
+ if (f == kFeatureCursorPalette)
+ return !_cursorPaletteDisabled;
return false;
}
@@ -437,15 +442,6 @@ void OSystem_N64::setCursorPalette(const byte *colors, uint start, uint num) {
_dirtyOffscreen = true;
}
-void OSystem_N64::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
-
- // Rebuild cursor hicolor buffer
- rebuildOffscreenMouseBuffer();
-
- _dirtyOffscreen = true;
-}
-
void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
//Clip the coordinates
if (x < 0) {
@@ -852,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
@@ -884,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_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/n64/portdefs.h b/backends/platform/n64/portdefs.h
index e62551355d..35ef3c71db 100644
--- a/backends/platform/n64/portdefs.h
+++ b/backends/platform/n64/portdefs.h
@@ -35,5 +35,18 @@
#undef assert
#define assert(x) ((x) ? 0 : (print_error("ASSERT TRIGGERED:\n\n("#x")\n%s\nline: %d", __FILE__, __LINE__)))
+// Typedef basic data types in a way that is compatible with the N64 SDK.
+typedef unsigned char byte;
+typedef unsigned char uint8;
+typedef signed char int8;
+typedef unsigned short int uint16;
+typedef signed short int int16;
+typedef unsigned int uint32;
+typedef signed int int32;
+
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
#endif
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 7dd127fefa..4690a67c55 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -34,7 +34,7 @@
*/
#if defined(__amigaos4__)
#include "backends/fs/amigaos4/amigaos4-fs-factory.h"
-#elif defined(UNIX)
+#elif defined(POSIX)
#include "backends/fs/posix/posix-fs-factory.h"
#elif defined(WIN32)
#include "backends/fs/windows/windows-fs-factory.h"
@@ -53,14 +53,13 @@ public:
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &t) const {}
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
+ virtual void logMessage(LogMessageType::Type type, const char *message);
};
OSystem_NULL::OSystem_NULL() {
#if defined(__amigaos4__)
_fsFactory = new AmigaOSFilesystemFactory();
- #elif defined(UNIX)
+ #elif defined(POSIX)
_fsFactory = new POSIXFilesystemFactory();
#elif defined(WIN32)
_fsFactory = new WindowsFilesystemFactory();
@@ -73,12 +72,11 @@ OSystem_NULL::~OSystem_NULL() {
}
void OSystem_NULL::initBackend() {
- _mutexManager = (MutexManager *)new NullMutexManager();
+ _mutexManager = new NullMutexManager();
_timerManager = new DefaultTimerManager();
_eventManager = new DefaultEventManager(this);
_savefileManager = new DefaultSaveFileManager();
- _graphicsManager = (GraphicsManager *)new NullGraphicsManager();
- _audiocdManager = (AudioCDManager *)new DefaultAudioCDManager();
+ _graphicsManager = new NullGraphicsManager();
_mixer = new Audio::MixerImpl(this, 22050);
((Audio::MixerImpl *)_mixer)->setReady(false);
@@ -87,7 +85,7 @@ void OSystem_NULL::initBackend() {
// this way; they need to be hooked into the system somehow to
// be functional. Of course, can't do that in a NULL backend :).
- OSystem::initBackend();
+ ModularBackend::initBackend();
}
bool OSystem_NULL::pollEvent(Common::Event &event) {
@@ -101,16 +99,16 @@ uint32 OSystem_NULL::getMillis() {
void OSystem_NULL::delayMillis(uint msecs) {
}
-#define DEFAULT_CONFIG_FILE "scummvm.ini"
+void OSystem_NULL::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
-Common::SeekableReadStream *OSystem_NULL::createConfigReadStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
- return file.createReadStream();
-}
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
-Common::WriteStream *OSystem_NULL::createConfigWriteStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
- return file.createWriteStream();
+ fputs(message, output);
+ fflush(output);
}
OSystem *OSystem_NULL_create() {
diff --git a/backends/platform/openpandora/build/config-alleng.sh b/backends/platform/openpandora/build/config-alleng.sh
index f3fa1a0f94..4028f5f4de 100755
--- a/backends/platform/openpandora/build/config-alleng.sh
+++ b/backends/platform/openpandora/build/config-alleng.sh
@@ -19,7 +19,6 @@ export DEFINES=-DNDEBUG
cd ../../../..
./configure --backend=openpandora --host=openpandora --disable-nasm \
--with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin \
- --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
diff --git a/backends/platform/openpandora/build/config.sh b/backends/platform/openpandora/build/config.sh
index 9bc52a9bc4..92476c5525 100755
--- a/backends/platform/openpandora/build/config.sh
+++ b/backends/platform/openpandora/build/config.sh
@@ -19,7 +19,6 @@ export DEFINES=-DNDEBUG
cd ../../../..
./configure --backend=openpandora --host=openpandora --disable-nasm \
--with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin \
- --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
diff --git a/backends/platform/openpandora/module.mk b/backends/platform/openpandora/module.mk
index 8e60b87aa6..5bd568e1c4 100755
--- a/backends/platform/openpandora/module.mk
+++ b/backends/platform/openpandora/module.mk
@@ -5,11 +5,10 @@ MODULE_OBJS := \
op-backend.o \
op-main.o
-MODULE_DIRS += \
- backends/platform/openpandora/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# 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/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/Makefile.gdb b/backends/platform/ps2/Makefile.gdb
index 48dcebc1d4..1e2510d3f4 100644
--- a/backends/platform/ps2/Makefile.gdb
+++ b/backends/platform/ps2/Makefile.gdb
@@ -1,7 +1,7 @@
# $Header: Exp $
include $(PS2SDK)/Defs.make
-PS2_EXTRA = /media/disk/nw8240/extras/scummvm/ports
+PS2_EXTRA = /works/devel/ps2/sdk-extra
PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor
PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor
@@ -9,31 +9,44 @@ ENABLED=STATIC_PLUGIN
ENABLE_SCUMM = $(ENABLED)
ENABLE_SCUMM_7_8 = $(ENABLED)
-#ENABLE_HE = $(ENABLED)
-#ENABLE_AGI = $(ENABLED)
-#ENABLE_AGOS = $(ENABLED)
-#ENABLE_CINE = $(ENABLED)
-#ENABLE_CRUISE = $(ENABLED)
-#ENABLE_DRASCULA = $(ENABLED)
-#ENABLE_GOB = $(ENABLED)
-#ENABLE_KYRA = $(ENABLED)
-#ENABLE_LURE = $(ENABLED)
- # ENABLE_M4 = $(ENABLED)
-#ENABLE_MADE = $(ENABLED)
-#ENABLE_PARALLACTION = $(ENABLED)
-#ENABLE_QUEEN = $(ENABLED)
-#ENABLE_SAGA = $(ENABLED)
-#ENABLE_SAGA2 = $(ENABLED)
-#ENABLE_IHNM = $(ENABLED)
-#ENABLE_SKY = $(ENABLED)
-#ENABLE_SWORD1 = $(ENABLED)
-#ENABLE_SWORD2 = $(ENABLED)
- # ENABLE_TINSEL = $(ENABLED)
-#ENABLE_TOUCHE = $(ENABLED)
+# ENABLE_HE = $(ENABLED)
+# ENABLE_AGI = $(ENABLED)
+# ENABLE_AGOS = $(ENABLED)
+# ENABLE_AGOS2 = $(ENABLED)
+# ENABLE_CINE = $(ENABLED)
+# ENABLE_CRUISE = $(ENABLED)
+# ENABLE_DRACI = $(ENABLED)
+# ENABLE_DRASCULA = $(ENABLED)
+# ENABLE_GOB = $(ENABLED)
+# ENABLE_GROOVIE = $(ENABLED)
+## ENABLE_GROOVIE2 = $(ENABLED)
+# ENABLE_HUGO = $(ENABLED)
+# ENABLE_IHNM = $(ENABLED)
+# ENABLE_KYRA = $(ENABLED)
+## ENABLE_LOL = $(ENABLED)
+# ENABLE_LURE = $(ENABLED)
+## ENABLE_M4 = $(ENABLED)
+# ENABLE_MADE = $(ENABLED)
+# ENABLE_MOHAWK = $(ENABLED)
+# ENABLE_PARALLACTION = $(ENABLED)
+# ENABLE_QUEEN = $(ENABLED)
+# ENABLE_SAGA = $(ENABLED)
+# ENABLE_SAGA2 = $(ENABLED)
+# ENABLE_SCI = $(ENABLED)
+## ENABLE_SCI32 = $(ENABLED)
+# ENABLE_SKY = $(ENABLED)
+# ENABLE_SWORD1 = $(ENABLED)
+# ENABLE_SWORD2 = $(ENABLED)
+# ENABLE_TEENAGENT = $(ENABLED)
+# ENABLE_TINSEL = $(ENABLED)
+# ENABLE_TOON = $(ENABLED)
+# ENABLE_TOUCHE = $(ENABLED)
+# ENABLE_TUCKER = $(ENABLED)
+
HAVE_GCC3 = true
-CC = ee-gcc
+CC = ee-gcc
CXX = ee-g++
AS = ee-gcc
LD = ee-gcc
@@ -48,35 +61,36 @@ VPATH = $(srcdir)
INCDIR = ../../../
# DEPDIR = .deps
-DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar
-
+DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar -fno-rtti -fno-exceptions # -DNO_ADAPTOR
+# for release builds:
+#DEFINES += -DRELEASE_BUILD
INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
INCLUDES += -I $(PS2GDB)/ee -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
+CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
+
TARGET = elf/scummvm.elf
-OBJS := backends/platform/ps2/DmaPipe.o \
- backends/platform/ps2/Gs2dScreen.o \
- backends/platform/ps2/irxboot.o \
- backends/platform/ps2/ps2input.o \
- backends/platform/ps2/ps2pad.o \
- backends/platform/ps2/savefilemgr.o \
- backends/platform/ps2/fileio.o \
- backends/platform/ps2/asyncfio.o \
- backends/platform/ps2/icon.o \
- backends/platform/ps2/cd.o \
- backends/platform/ps2/eecodyvdfs.o \
- backends/platform/ps2/rpckbd.o \
- backends/platform/ps2/systemps2.o \
- backends/platform/ps2/ps2mutex.o \
- backends/platform/ps2/ps2time.o \
- backends/platform/ps2/ps2debug.o
+OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
+ $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
+ $(srcdir)/backends/platform/ps2/irxboot.o \
+ $(srcdir)/backends/platform/ps2/ps2input.o \
+ $(srcdir)/backends/platform/ps2/ps2pad.o \
+ $(srcdir)/backends/platform/ps2/savefilemgr.o \
+ $(srcdir)/backends/platform/ps2/fileio.o \
+ $(srcdir)/backends/platform/ps2/asyncfio.o \
+ $(srcdir)/backends/platform/ps2/icon.o \
+ $(srcdir)/backends/platform/ps2/cd.o \
+ $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
+ $(srcdir)/backends/platform/ps2/rpckbd.o \
+ $(srcdir)/backends/platform/ps2/systemps2.o \
+ $(srcdir)/backends/platform/ps2/ps2mutex.o \
+ $(srcdir)/backends/platform/ps2/ps2time.o \
+ $(srcdir)/backends/platform/ps2/ps2debug.o
MODULE_DIRS += .
-BACKEND := ps2
-
include $(srcdir)/Makefile.common
LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index 472ba5ec3a..77cc735c5f 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -12,28 +12,41 @@ ENABLE_SCUMM_7_8 = $(ENABLED)
ENABLE_HE = $(ENABLED)
ENABLE_AGI = $(ENABLED)
ENABLE_AGOS = $(ENABLED)
+ENABLE_AGOS2 = $(ENABLED)
ENABLE_CINE = $(ENABLED)
ENABLE_CRUISE = $(ENABLED)
+ENABLE_DRACI = $(ENABLED)
ENABLE_DRASCULA = $(ENABLED)
ENABLE_GOB = $(ENABLED)
+ENABLE_GROOVIE = $(ENABLED)
+# ENABLE_GROOVIE2 = $(ENABLED)
+ENABLE_HUGO = $(ENABLED)
+ENABLE_IHNM = $(ENABLED)
ENABLE_KYRA = $(ENABLED)
+# ENABLE_LOL = $(ENABLED)
ENABLE_LURE = $(ENABLED)
# ENABLE_M4 = $(ENABLED)
ENABLE_MADE = $(ENABLED)
+ENABLE_MOHAWK = $(ENABLED)
ENABLE_PARALLACTION = $(ENABLED)
ENABLE_QUEEN = $(ENABLED)
ENABLE_SAGA = $(ENABLED)
-ENABLE_SAGA2 = $(ENABLED)
-ENABLE_IHNM = $(ENABLED)
+# ENABLE_SAGA2 = $(ENABLED)
+ENABLE_SCI = $(ENABLED)
+# ENABLE_SCI32 = $(ENABLED)
ENABLE_SKY = $(ENABLED)
ENABLE_SWORD1 = $(ENABLED)
ENABLE_SWORD2 = $(ENABLED)
-# ENABLE_TINSEL = $(ENABLED)
+ENABLE_TEENAGENT = $(ENABLED)
+ENABLE_TINSEL = $(ENABLED)
+ENABLE_TOON = $(ENABLED)
ENABLE_TOUCHE = $(ENABLED)
+ENABLE_TUCKER = $(ENABLED)
+
HAVE_GCC3 = true
-CC = ee-gcc
+CC = ee-gcc
CXX = ee-g++
AS = ee-gcc
LD = ee-gcc
@@ -48,30 +61,33 @@ VPATH = $(srcdir)
INCDIR = ../../../
# DEPDIR = .deps
-DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar
-
+DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -G2 -O2 -Wall -Wno-multichar -fno-rtti -fno-exceptions # -DNO_ADAPTOR
+# for release builds:
+#DEFINES += -DRELEASE_BUILD
INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
INCLUDES += -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
+CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
+
TARGET = elf/scummvm.elf
-OBJS := backends/platform/ps2/DmaPipe.o \
- backends/platform/ps2/Gs2dScreen.o \
- backends/platform/ps2/irxboot.o \
- backends/platform/ps2/ps2input.o \
- backends/platform/ps2/ps2pad.o \
- backends/platform/ps2/savefilemgr.o \
- backends/platform/ps2/fileio.o \
- backends/platform/ps2/asyncfio.o \
- backends/platform/ps2/icon.o \
- backends/platform/ps2/cd.o \
- backends/platform/ps2/eecodyvdfs.o \
- backends/platform/ps2/rpckbd.o \
- backends/platform/ps2/systemps2.o \
- backends/platform/ps2/ps2mutex.o \
- backends/platform/ps2/ps2time.o \
- backends/platform/ps2/ps2debug.o
+OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
+ $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
+ $(srcdir)/backends/platform/ps2/irxboot.o \
+ $(srcdir)/backends/platform/ps2/ps2input.o \
+ $(srcdir)/backends/platform/ps2/ps2pad.o \
+ $(srcdir)/backends/platform/ps2/savefilemgr.o \
+ $(srcdir)/backends/platform/ps2/fileio.o \
+ $(srcdir)/backends/platform/ps2/asyncfio.o \
+ $(srcdir)/backends/platform/ps2/icon.o \
+ $(srcdir)/backends/platform/ps2/cd.o \
+ $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
+ $(srcdir)/backends/platform/ps2/rpckbd.o \
+ $(srcdir)/backends/platform/ps2/systemps2.o \
+ $(srcdir)/backends/platform/ps2/ps2mutex.o \
+ $(srcdir)/backends/platform/ps2/ps2time.o \
+ $(srcdir)/backends/platform/ps2/ps2debug.o
MODULE_DIRS += .
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index 038cccd9dd..ef01f3a693 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -535,23 +535,3 @@ size_t ps2_fwrite(const void *buf, size_t r, size_t n, FILE *stream) {
assert(r != 0);
return ((Ps2File*)stream)->write(buf, r * n) / r;
}
-
-int ps2_fputs(const char *s, FILE *stream) {
- int len = strlen(s);
-
- if (stream == stderr || stream == stdout) {
- printf("%s", s);
- sioprintf("%s", s);
- return len;
- }
-
- if (ps2_fwrite(s, 1, len, stream) == (size_t)len)
- return len;
- else
- return EOF;
-}
-
-int ps2_fflush(FILE *stream) {
- // printf("fflush not implemented\n");
- return 0;
-}
diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h
index 3fdee5f1dc..afa2ca1f24 100644
--- a/backends/platform/ps2/fileio.h
+++ b/backends/platform/ps2/fileio.h
@@ -115,10 +115,8 @@ public:
// TODO: Get rid of the following, instead use PS2FileStream directly.
FILE *ps2_fopen(const char *fname, const char *mode);
int ps2_fclose(FILE *stream);
-int ps2_fflush(FILE *stream);
size_t ps2_fread(void *buf, size_t r, size_t n, FILE *stream);
size_t ps2_fwrite(const void *buf, size_t r, size_t n, FILE *stream);
-int ps2_fputs(const char *s, FILE *stream);
#endif // __PS2FILE_IO__
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 210454c9aa..d3acd06089 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -33,36 +33,41 @@
#include <assert.h>
#include <iopcontrol.h>
#include <iopheap.h>
-#include "common/scummsys.h"
-#include "engines/engine.h"
-#include "backends/platform/ps2/systemps2.h"
-#include "backends/platform/ps2/Gs2dScreen.h"
-#include "backends/platform/ps2/ps2input.h"
-#include "backends/platform/ps2/irxboot.h"
+
#include <sjpcm.h>
#include <libhdd.h>
-#include "backends/platform/ps2/savefilemgr.h"
-#include "common/file.h"
-#include "backends/platform/ps2/sysdefs.h"
-#include "backends/platform/ps2/fileio.h"
#include <libmc.h>
#include <libpad.h>
-#include "backends/platform/ps2/cd.h"
#include <fileXio_rpc.h>
-#include "backends/platform/ps2/asyncfio.h"
#include "eecodyvdfs.h"
-#include "graphics/surface.h"
-#include "graphics/font.h"
-#include "backends/timer/default/default-timer.h"
-#include "audio/mixer_intern.h"
+
+#include "common/config-manager.h"
#include "common/events.h"
+#include "common/file.h"
+#include "common/scummsys.h"
+
+#include "backends/platform/ps2/asyncfio.h"
+#include "backends/platform/ps2/cd.h"
+#include "backends/platform/ps2/fileio.h"
+#include "backends/platform/ps2/Gs2dScreen.h"
+#include "backends/platform/ps2/irxboot.h"
#include "backends/platform/ps2/ps2debug.h"
-#include "backends/fs/ps2/ps2-fs-factory.h"
+#include "backends/platform/ps2/ps2input.h"
+#include "backends/platform/ps2/savefilemgr.h"
+#include "backends/platform/ps2/sysdefs.h"
+#include "backends/platform/ps2/systemps2.h"
+#include "backends/fs/ps2/ps2-fs-factory.h"
#include "backends/plugins/ps2/ps2-provider.h"
-#include "backends/saves/default/default-saves.h"
-#include "common/config-manager.h"
+#include "backends/timer/default/default-timer.h"
+
+#include "audio/mixer_intern.h"
+
+#include "engines/engine.h"
+
+#include "graphics/font.h"
+#include "graphics/surface.h"
#include "icon.h"
#include "ps2temp.h"
@@ -342,13 +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);
@@ -423,7 +429,7 @@ void OSystem_PS2::initTimer(void) {
void OSystem_PS2::timerThreadCallback(void) {
while (!_systemQuit) {
WaitSema(g_TimerThreadSema);
- _scummTimerManager->handler();
+ ((DefaultTimerManager *)_timerManager)->handler();
}
ExitThread();
}
@@ -593,22 +599,10 @@ void OSystem_PS2::delayMillis(uint msecs) {
}
}
-Common::TimerManager *OSystem_PS2::getTimerManager() {
- return _scummTimerManager;
-}
-/*
-Common::EventManager *OSystem_PS2::getEventManager() {
- return getEventManager();
-}
-*/
Audio::Mixer *OSystem_PS2::getMixer() {
return _scummMixer;
}
-Common::SaveFileManager *OSystem_PS2::getSavefileManager(void) {
- return _saveManager;
-}
-
FilesystemFactory *OSystem_PS2::getFilesystemFactory() {
return &Ps2FilesystemFactory::instance();
}
@@ -767,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:");
@@ -807,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
@@ -976,12 +970,11 @@ void OSystem_PS2::makeConfigPath() {
_configFile = strdup(path);
}
-Common::SeekableReadStream *OSystem_PS2::createConfigReadStream() {
- Common::FSNode file(_configFile);
- return file.createReadStream();
+Common::String OSystem_PS2::getDefaultConfigFileName() {
+ return _configFile;
}
-Common::WriteStream *OSystem_PS2::createConfigWriteStream() {
- Common::FSNode file(_configFile);
- return file.createWriteStream();
+void OSystem_PS2::logMessage(LogMessageType::Type type, const char *message) {
+ printf("%s", message);
+ sioprintf("%s", message);
}
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index b21a56c184..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,8 +85,6 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
- virtual Common::TimerManager *getTimerManager();
-// virtual Common::EventManager *getEventManager();
virtual bool pollEvent(Common::Event &event);
virtual Audio::Mixer *getMixer();
@@ -112,11 +102,11 @@ public:
virtual void quit();
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
+ virtual Common::String getDefaultConfigFileName();
+
+ 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.h b/backends/platform/psp/cursor.h
index 9c24d001fb..f79968243b 100644
--- a/backends/platform/psp/cursor.h
+++ b/backends/platform/psp/cursor.h
@@ -53,6 +53,7 @@ public:
Buffer &buffer() { return _buffer; }
void setCursorPalette(const byte *colors, uint start, uint num);
void enableCursorPalette(bool enable);
+ bool isCursorPaletteEnabled() const { return _useCursorPalette; }
void setLimits(uint32 width, uint32 height);
void setXY(int x, int y);
int32 getX() const { return _x; }
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 3db743eff3..8c8180d04e 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>
@@ -89,9 +88,9 @@ void OSystem_PSP::initBackend() {
_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();
- OSystem::initBackend();
+ EventsBaseBackend::initBackend();
}
// Let's us know an engine
@@ -110,13 +109,20 @@ void OSystem_PSP::engineDone() {
}
bool OSystem_PSP::hasFeature(Feature f) {
- return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorHasPalette);
+ return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorPalette);
}
void OSystem_PSP::setFeatureState(Feature f, bool enable) {
+ if (f == kFeatureCursorPalette) {
+ _pendingUpdate = false;
+ _cursor.enableCursorPalette(enable);
+ }
}
bool OSystem_PSP::getFeatureState(Feature f) {
+ if (f == kFeatureCursorPalette) {
+ return _cursor.isCursorPaletteEnabled();
+ }
return false;
}
@@ -198,12 +204,6 @@ void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) {
_cursor.clearKeyColor(); // Do we need this?
}
-void OSystem_PSP::disableCursorPalette(bool disable) {
- DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
- _cursor.enableCursorPalette(!disable);
-}
-
void OSystem_PSP::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
@@ -421,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
@@ -438,14 +446,6 @@ void OSystem_PSP::getTimeAndDate(TimeDate &td) const {
td.tm_year = t.tm_year;
}
-#define PSP_CONFIG_FILE "ms0:/scummvm.ini"
-
-Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() {
- Common::FSNode file(PSP_CONFIG_FILE);
- return file.createReadStream();
-}
-
-Common::WriteStream *OSystem_PSP::createConfigWriteStream() {
- Common::FSNode file(PSP_CONFIG_FILE);
- return file.createWriteStream();
+Common::String OSystem_PSP::getDefaultConfigFileName() {
+ return "ms0:/scummvm.ini";
}
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 00eec3da90..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();
@@ -99,7 +97,6 @@ protected:
void grabPalette(byte *colors, uint start, uint num);
public:
void setCursorPalette(const byte *colors, uint start, uint num);
- void disableCursorPalette(bool disable);
// Screen related
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
@@ -134,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);
@@ -148,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();
@@ -157,9 +152,7 @@ public:
void logMessage(LogMessageType::Type type, const char *message);
- Common::SeekableReadStream *createConfigReadStream();
- Common::WriteStream *createConfigWriteStream();
-
+ virtual Common::String getDefaultConfigFileName();
};
#endif /* OSYS_PSP_H */
diff --git a/backends/platform/samsungtv/main.cpp b/backends/platform/samsungtv/main.cpp
index 4f3291613d..8274bb00a2 100644
--- a/backends/platform/samsungtv/main.cpp
+++ b/backends/platform/samsungtv/main.cpp
@@ -22,12 +22,14 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+#include "common/scummsys.h"
+
+#if defined(SAMSUNGTV)
+
#include "backends/platform/samsungtv/samsungtv.h"
#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
-#if defined(SAMSUNGTV)
-
#include <unistd.h>
extern "C" int Game_Main(char *path, char *) {
diff --git a/backends/platform/samsungtv/module.mk b/backends/platform/samsungtv/module.mk
index 36ad75da6d..cba09db74c 100644
--- a/backends/platform/samsungtv/module.mk
+++ b/backends/platform/samsungtv/module.mk
@@ -8,3 +8,6 @@ MODULE_OBJS := \
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/samsungtv/samsungtv.cpp b/backends/platform/samsungtv/samsungtv.cpp
index cb657a0a22..9718eed1fe 100644
--- a/backends/platform/samsungtv/samsungtv.cpp
+++ b/backends/platform/samsungtv/samsungtv.cpp
@@ -20,15 +20,18 @@
*
*/
+#include "common/scummsys.h"
+
+#if defined(SAMSUNGTV)
+
#include "backends/platform/samsungtv/samsungtv.h"
#include "backends/events/samsungtvsdl/samsungtvsdl-events.h"
#include "backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h"
-
-#if defined(SAMSUNGTV)
+#include "common/textconsole.h"
OSystem_SDL_SamsungTV::OSystem_SDL_SamsungTV()
:
- OSystem_POSIX("/mtd_rwarea/scummvm/.scummvmrc") {
+ OSystem_POSIX("/mtd_rwarea/.scummvmrc") {
}
void OSystem_SDL_SamsungTV::initBackend() {
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 0ef16d9a6e..9b11eb2c09 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -33,7 +33,9 @@
#include "common/archive.h"
#include "common/fs.h"
-#include "CoreFoundation/CoreFoundation.h"
+#include "ApplicationServices/ApplicationServices.h" // for LSOpenFSRef
+#include "CoreFoundation/CoreFoundation.h" // for CF* stuff
+#include "CoreServices/CoreServices.h" // for FSPathMakeRef
OSystem_MacOSX::OSystem_MacOSX()
:
@@ -75,4 +77,27 @@ void OSystem_MacOSX::setupIcon() {
// Don't set icon on OS X, as we use a nicer external icon there.
}
+bool OSystem_MacOSX::hasFeature(Feature f) {
+ if (f == kFeatureDisplayLogFile)
+ return true;
+ return OSystem_POSIX::hasFeature(f);
+}
+
+bool OSystem_MacOSX::displayLogFile() {
+ // Use LaunchServices to open the log file, if possible.
+
+ if (_logFilePath.empty())
+ return false;
+
+ FSRef ref;
+ OSStatus err;
+
+ err = FSPathMakeRef((const UInt8 *)_logFilePath.c_str(), &ref, NULL);
+ if (err == noErr) {
+ err = LSOpenFSRef(&ref, NULL);
+ }
+
+ return err != noErr;
+}
+
#endif
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index 6d78427522..86c70297ec 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -29,6 +29,10 @@ class OSystem_MacOSX : public OSystem_POSIX {
public:
OSystem_MacOSX();
+ virtual bool hasFeature(Feature f);
+
+ virtual bool displayLogFile();
+
virtual void initBackend();
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
virtual void setupIcon();
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp
index a0a64e1155..1992bdd3f2 100644
--- a/backends/platform/sdl/main.cpp
+++ b/backends/platform/sdl/main.cpp
@@ -24,7 +24,7 @@
// Several SDL based ports use a custom main, and hence do not want to compile
// of this file. The following "#if" ensures that.
-#if !defined(UNIX) && \
+#if !defined(POSIX) && \
!defined(WIN32) && \
!defined(__MAEMO__) && \
!defined(__SYMBIAN32__) && \
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index 87a0e3d658..efc5168d5b 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -5,7 +5,7 @@ MODULE_OBJS := \
main.o \
sdl.o
-ifdef UNIX
+ifdef POSIX
MODULE_OBJS += \
posix/posix-main.o \
posix/posix.o
diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp
index ffc28b354c..f78e001398 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(UNIX) && !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)
#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 4dd0039c1e..d757186134 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -22,11 +22,13 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h //On IRIX, sys/stat.h includes sys/time.h
#include "common/scummsys.h"
-#ifdef UNIX
+#ifdef POSIX
#include "backends/platform/sdl/posix/posix.h"
#include "backends/saves/posix/posix-saves.h"
@@ -34,6 +36,8 @@
#include <errno.h>
#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
OSystem_POSIX::OSystem_POSIX(Common::String baseConfigName)
@@ -58,10 +62,16 @@ void OSystem_POSIX::initBackend() {
OSystem_SDL::initBackend();
}
+bool OSystem_POSIX::hasFeature(Feature f) {
+ if (f == kFeatureDisplayLogFile)
+ return true;
+ return OSystem_SDL::hasFeature(f);
+}
+
Common::String OSystem_POSIX::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
- // On UNIX type systems, by default we store the config file inside
+ // On POSIX type systems, by default we store the config file inside
// to the HOME directory of the user.
const char *home = getenv("HOME");
if (home != NULL && strlen(home) < MAXPATHLEN)
@@ -73,6 +83,10 @@ Common::String OSystem_POSIX::getDefaultConfigFileName() {
}
Common::WriteStream *OSystem_POSIX::createLogFile() {
+ // Start out by resetting _logFilePath, so that in case
+ // of a failure, we know that no log file is open.
+ _logFilePath.clear();
+
const char *home = getenv("HOME");
if (home == NULL)
return 0;
@@ -128,7 +142,62 @@ Common::WriteStream *OSystem_POSIX::createLogFile() {
logFile += "/scummvm.log";
Common::FSNode file(logFile);
- return file.createWriteStream();
+ Common::WriteStream *stream = file.createWriteStream();
+ if (stream)
+ _logFilePath = logFile;
+ return stream;
}
+bool OSystem_POSIX::displayLogFile() {
+ if (_logFilePath.empty())
+ return false;
+
+ // FIXME: This may not work perfectly when in fullscreen mode.
+ // On my system it drops from fullscreen without ScummVM noticing,
+ // so the next Alt-Enter does nothing, going from windowed to windowed.
+ // (wjp, 20110604)
+
+ pid_t pid = fork();
+ if (pid < 0) {
+ // failed to fork
+ return false;
+ } else if (pid == 0) {
+
+ // Try xdg-open first
+ execlp("xdg-open", "xdg-open", _logFilePath.c_str(), (char*)0);
+
+ // If we're here, that clearly failed.
+
+ // TODO: We may also want to try detecting the case where
+ // xdg-open is successfully executed but returns an error code.
+
+ // Try xterm+less next
+
+ execlp("xterm", "xterm", "-e", "less", _logFilePath.c_str(), (char*)0);
+
+ // TODO: If less does not exist we could fall back to 'more'.
+ // However, we'll have to use 'xterm -hold' for that to prevent the
+ // terminal from closing immediately (for short log files) or
+ // unexpectedly.
+
+ exit(127);
+ }
+
+ int status;
+ // Wait for viewer to close.
+ // (But note that xdg-open may have spawned a viewer in the background.)
+
+ // FIXME: We probably want the viewer to always open in the background.
+ // This may require installing a SIGCHLD handler.
+ pid = waitpid(pid, &status, 0);
+
+ if (pid < 0) {
+ // Probably nothing sensible to do in this error situation
+ return false;
+ }
+
+ return WIFEXITED(status) && WEXITSTATUS(status) == 0;
+}
+
+
#endif
diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h
index 0a4f38e2c4..59909a958f 100644
--- a/backends/platform/sdl/posix/posix.h
+++ b/backends/platform/sdl/posix/posix.h
@@ -31,14 +31,31 @@ public:
OSystem_POSIX(Common::String baseConfigName = ".scummvmrc");
virtual ~OSystem_POSIX() {}
+ virtual bool hasFeature(Feature f);
+
+ virtual bool displayLogFile();
+
virtual void init();
virtual void initBackend();
protected:
- // Base string for creating the default path and filename
- // for the configuration file
+ /**
+ * Base string for creating the default path and filename for the
+ * configuration file. This allows the Mac OS X subclass to override
+ * the config file path and name.
+ */
Common::String _baseConfigName;
+ /**
+ * The path of the currently open log file, if any.
+ *
+ * @note This is currently a string and not an FSNode for simplicity;
+ * e.g. we don't need to include fs.h here, and currently the
+ * only use of this value is to use it to open the log file in an
+ * editor; for that, we need it only as a string anyway.
+ */
+ Common::String _logFilePath;
+
virtual Common::String getDefaultConfigFileName();
virtual Common::WriteStream *createLogFile();
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index a3fb719ca4..e36878db07 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -20,8 +20,7 @@
*
*/
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-#define FORBIDDEN_SYMBOL_EXCEPTION_exit
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
@@ -206,6 +205,8 @@ void OSystem_SDL::initBackend() {
setupIcon();
_inited = true;
+
+ ModularBackend::initBackend();
}
void OSystem_SDL::initSDL() {
@@ -244,20 +245,6 @@ void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
}
-Common::String OSystem_SDL::getDefaultConfigFileName() {
- return "scummvm.ini";
-}
-
-Common::SeekableReadStream *OSystem_SDL::createConfigReadStream() {
- Common::FSNode file(getDefaultConfigFileName());
- return file.createReadStream();
-}
-
-Common::WriteStream *OSystem_SDL::createConfigWriteStream() {
- Common::FSNode file(getDefaultConfigFileName());
- return file.createWriteStream();
-}
-
void OSystem_SDL::setWindowCaption(const char *caption) {
Common::String cap;
byte c;
@@ -288,10 +275,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];
@@ -314,7 +313,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
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index e9e9bc5696..9c08752054 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -65,8 +65,6 @@ public:
virtual void setWindowCaption(const char *caption);
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &td) const;
@@ -93,6 +91,8 @@ protected:
*/
SdlEventSource *_eventSource;
+ virtual Common::EventSource *getDefaultEventSource() { return _eventSource; }
+
/**
* Initialze the SDL library.
*/
@@ -103,12 +103,6 @@ protected:
*/
virtual void setupIcon();
- /**
- * Get the file path where the user configuration
- * of ScummVM will be saved.
- */
- virtual Common::String getDefaultConfigFileName();
-
// Logging
virtual Common::WriteStream *createLogFile() { return 0; }
Backends::Log::Log *_logger;
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 93b76f4188..5b14be4417 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -32,6 +32,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
+#include <shellapi.h>
#include "backends/platform/sdl/win32/win32.h"
#include "backends/fs/windows/windows-fs-factory.h"
@@ -87,6 +88,49 @@ void OSystem_Win32::init() {
OSystem_SDL::init();
}
+
+bool OSystem_Win32::hasFeature(Feature f) {
+ if (f == kFeatureDisplayLogFile)
+ return true;
+
+ return OSystem_SDL::hasFeature(f);
+}
+
+bool OSystem_Win32::displayLogFile() {
+ if (_logFilePath.empty())
+ return false;
+
+ // Try opening the log file with the default text editor
+ // log files should be registered as "txtfile" by default and thus open in the default text editor
+ HINSTANCE shellExec = ShellExecute(NULL, NULL, _logFilePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
+ if ((intptr_t)shellExec > 32)
+ return true;
+
+ // ShellExecute with the default verb failed, try the "Open with..." dialog
+ PROCESS_INFORMATION processInformation;
+ STARTUPINFO startupInfo;
+ memset(&processInformation, 0, sizeof(processInformation));
+ memset(&startupInfo, 0, sizeof(startupInfo));
+ startupInfo.cb = sizeof(startupInfo);
+
+ char cmdLine[MAX_PATH * 2]; // CreateProcess may change the contents of cmdLine
+ sprintf(cmdLine, "rundll32 shell32.dll,OpenAs_RunDLL %s", _logFilePath.c_str());
+ BOOL result = CreateProcess(NULL,
+ cmdLine,
+ NULL,
+ NULL,
+ FALSE,
+ NORMAL_PRIORITY_CLASS,
+ NULL,
+ NULL,
+ &startupInfo,
+ &processInformation);
+ if (result)
+ return true;
+
+ return false;
+}
+
Common::String OSystem_Win32::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
@@ -136,6 +180,10 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
}
Common::WriteStream *OSystem_Win32::createLogFile() {
+ // Start out by resetting _logFilePath, so that in case
+ // of a failure, we know that no log file is open.
+ _logFilePath.clear();
+
char logFile[MAXPATHLEN];
OSVERSIONINFO win32OsVersion;
@@ -163,7 +211,11 @@ Common::WriteStream *OSystem_Win32::createLogFile() {
strcat(logFile, "\\scummvm.log");
Common::FSNode file(logFile);
- return file.createWriteStream();
+ Common::WriteStream *stream = file.createWriteStream();
+ if (stream)
+ _logFilePath= logFile;
+
+ return stream;
} else {
return 0;
}
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index 268449eeff..ef7b6af3f1 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -30,7 +30,22 @@ public:
virtual void init();
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
+
+ virtual bool hasFeature(Feature f);
+
+ virtual bool displayLogFile();
+
protected:
+ /**
+ * The path of the currently open log file, if any.
+ *
+ * @note This is currently a string and not an FSNode for simplicity;
+ * e.g. we don't need to include fs.h here, and currently the
+ * only use of this value is to use it to open the log file in an
+ * editor; for that, we need it only as a string anyway.
+ */
+ Common::String _logFilePath;
+
virtual Common::String getDefaultConfigFileName();
virtual Common::WriteStream *createLogFile();
};
diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
index cb1c508fa1..82c15ec3db 100644
--- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
+++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
@@ -104,9 +104,6 @@
#$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "$SdlBase\\S90";
#$SDK_LibraryDirs{'UIQ2'}{'esdl.lib'} = "$SdlBase\\UIQ2"
#$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "$SdlBase\\UIQ3";
-
- ## HardlySupported(TM) :P
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "$DevBase\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@@ -145,7 +142,6 @@
# $SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S60";
# $SDK_LibraryDirs{'S80'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S80";
# $SDK_LibraryDirs{'S90'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S90";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@@ -183,7 +179,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@@ -221,7 +216,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@@ -259,7 +253,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
diff --git a/backends/platform/symbian/README b/backends/platform/symbian/README
index 140f442fb6..1f49c52f02 100644
--- a/backends/platform/symbian/README
+++ b/backends/platform/symbian/README
@@ -114,9 +114,6 @@ Building ScummVM
- flac, the Free Lossless Audio Codec
http://flac.sourceforge.net/
- - libmpeg2, a free MPEG-2 video stream decoder
- http://libmpeg2.sourceforge.net
-
Compiling ScummVM
-----------------
diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h
index ebcd273659..86460e65c5 100644
--- a/backends/platform/symbian/src/portdefs.h
+++ b/backends/platform/symbian/src/portdefs.h
@@ -18,8 +18,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
#ifndef SYMBIAN_PORTDEFS_H
#define SYMBIAN_PORTDEFS_H
+
#include <assert.h>
#include <stdarg.h>
#include <string.h>
@@ -37,6 +39,26 @@
#define M_PI 3.14159265358979323846
#endif /* M_PI */
+
+// Enable Symbians own datatypes
+// This is done for two reasons
+// a) uint is already defined by Symbians libc component
+// b) Symbian is using its "own" datatyping, and the Scummvm port
+// should follow this to ensure the best compability possible.
+typedef unsigned char byte;
+typedef unsigned char uint8;
+typedef signed char int8;
+typedef unsigned short int uint16;
+typedef signed short int int16;
+typedef unsigned long int uint32;
+typedef signed long int int32;
+
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
+#define SMALL_SCREEN_DEVICE
+
#define DISABLE_COMMAND_LINE
#if defined(USE_TREMOR) && !defined(USE_VORBIS)
diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp
index ffabc5ae97..8c12ad9b81 100644
--- a/backends/platform/wii/options.cpp
+++ b/backends/platform/wii/options.cpp
@@ -175,15 +175,15 @@ void WiiOptionsDialog::handleTickle() {
break;
case -EBUSY:
- label = _("Initialising network");
+ label = _("Initializing network");
break;
case -ETIMEDOUT:
- label = _("Timeout while initialising network");
+ label = _("Timeout while initializing network");
break;
default:
- label = String::format(_("Network not initialised (%d)"), status);
+ label = String::format(_("Network not initialized (%d)"), status);
break;
}
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 401b19b0e1..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();
- OSystem::initBackend();
+ EventsBaseBackend::initBackend();
}
void OSystem_Wii::quit() {
@@ -175,7 +165,7 @@ void OSystem_Wii::engineDone() {
bool OSystem_Wii::hasFeature(Feature f) {
return (f == kFeatureFullscreenMode) ||
(f == kFeatureAspectRatioCorrection) ||
- (f == kFeatureCursorHasPalette) ||
+ (f == kFeatureCursorPalette) ||
(f == kFeatureOverlaySupportsAlpha);
}
@@ -188,6 +178,13 @@ void OSystem_Wii::setFeatureState(Feature f, bool enable) {
case kFeatureAspectRatioCorrection:
_arCorrection = enable;
break;
+ case kFeatureCursorPalette:
+ _cursorPaletteDisabled = !enable;
+ if (_texMouse.palette && !enable) {
+ memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
+ _cursorPaletteDirty = true;
+ }
+ break;
default:
break;
}
@@ -199,6 +196,8 @@ bool OSystem_Wii::getFeatureState(Feature f) {
return _fullscreen;
case kFeatureAspectRatioCorrection:
return _arCorrection;
+ case kFeatureCursorPalette:
+ return !_cursorPaletteDisabled;
default:
return false;
}
@@ -252,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();
}
@@ -298,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[] = {
@@ -368,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 0db5f92fff..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 {
@@ -171,7 +167,6 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y,
int w, int h);
virtual void updateScreen();
@@ -212,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 b44c1270f5..859e3a1395 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -394,15 +394,6 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) {
_cursorPaletteDirty = true;
}
-void OSystem_Wii::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
-
- if (_texMouse.palette && disable) {
- memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
- _cursorPaletteDirty = true;
- }
-}
-
void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y,
int w, int h) {
assert(x >= 0 && x < _gameWidth);
diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp
index f2c461fcf9..a4786d330d 100644
--- a/backends/platform/wince/CEActionsPocket.cpp
+++ b/backends/platform/wince/CEActionsPocket.cpp
@@ -233,15 +233,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 +249,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 +270,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..b12dadabb6 100644
--- a/backends/platform/wince/CEActionsSmartphone.cpp
+++ b/backends/platform/wince/CEActionsSmartphone.cpp
@@ -199,15 +199,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 +234,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 +264,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/Makefile b/backends/platform/wince/Makefile
index a9741f396f..7f8d45b3de 100644
--- a/backends/platform/wince/Makefile
+++ b/backends/platform/wince/Makefile
@@ -47,7 +47,6 @@ ENABLE_MADE = STATIC_PLUGIN
## Pick which libraries you want to use here
USE_MAD = 1
-#USE_MPEG2 = 1
#USE_TREMOR = 1
USE_TREMOLO = 1
#USE_FLAC = 1
@@ -133,11 +132,6 @@ DEFINES += -DUSE_MAD
LIBS += -lmad
endif
-ifdef USE_MPEG2
-DEFINES += -DUSE_MPEG2
-LIBS += -lmpeg2
-endif
-
ifdef USE_TREMOR
DEFINES += -DUSE_TREMOR -DUSE_VORBIS
LIBS += -ltremorce
diff --git a/backends/platform/wince/README-WinCE.txt b/backends/platform/wince/README-WinCE.txt
index 69abd66e69..c48d9ca998 100644
--- a/backends/platform/wince/README-WinCE.txt
+++ b/backends/platform/wince/README-WinCE.txt
@@ -1,15 +1,49 @@
ScummVM Windows CE FAQ
-Last updated: $Date$
-Release version: 1.1.0
+Last updated: 2011-05-27
+Release version: 1.3.0
------------------------------------------------------------------------
New in this version
-------------------
-1.1.1
+1.3.0:
+This is the first official Windows CE release since 1.1.1.
+
+The following new engines are now included (changes since last WinCE release):
+ - Draci Engine (Dragon History)
+ - Hugo Engine (Hugo Trilogy)
+ - Mohawk Engine (Myst, Riven, Living Book games & Where in Time is Carmen
+ Sandiego?)
+ - SCI Engine (Sierra SCI games, see main README for a list of supported games)
+ - Toon Engine (Toonstruck)
+
+Also, there are now 4 binaries in this distribution, a single executable
+which contains all engines (for devices with enough memory) and 3 smaller
+binaries which contain only some of the engines. The following lists all
+executables and the engines they contain:
+
+scummvm.exe:
+ - all supported engines
+scummvm1.exe:
+ - scumm, agi, cruise, draci, lure, queen, sky, sword1, tinsel, touche
+scummvm2.exe:
+ - agos, cine, drascula, gob, groovie, kyra, made, parallaction, saga,
+ teenagent, tucker
+scummvm3.exe:
+ - hugo, mohawk, sci, sword2, toon
+
+There are no other port specific changes.
+
+1.2.1:
+(Note: No official 1.2.1 release)
+
+1.2.0:
+(Note: No official 1.2.0 release)
+
+1.1.1:
Fix to the Normal2xAspect scaler that was causing crashes.
-1.1.0
+1.1.0:
The TeenAgent engine is now included, but there are no other port specific
changes since 1.0.0.
diff --git a/backends/platform/wince/portdefs.h b/backends/platform/wince/portdefs.h
index 64aa80abf2..93df6cd39e 100644
--- a/backends/platform/wince/portdefs.h
+++ b/backends/platform/wince/portdefs.h
@@ -20,40 +20,47 @@
*
*/
-// Missing string/stdlib/assert declarations for WinCE 2.xx
+#ifndef WINCE_PORTDEFS_H
+#define WINCE_PORTDEFS_H
+
+#ifndef _WIN32_WCE
+#error For use on WinCE only
+#endif
+// Missing string/stdlib/assert declarations for WinCE 2.xx
#if _WIN32_WCE < 300
-void *calloc(size_t n, size_t s);
-int isalnum(int c);
-int isdigit(int c);
-int isprint(int c);
-int isspace(int c);
-char *strrchr(const char *s, int c);
-char *strdup(const char *s);
-void assert(void *expression);
-void assert(int expression);
-long int strtol(const char *nptr, char **endptr, int base);
-char *_strdup(const char *s);
-char *strpbrk(const char *s, const char *accept);
+ #define SMALL_SCREEN_DEVICE
+
+ void *calloc(size_t n, size_t s);
+ int isalnum(int c);
+ int isdigit(int c);
+ int isprint(int c);
+ int isspace(int c);
+ char *strrchr(const char *s, int c);
+ char *strdup(const char *s);
+ void assert(void *expression);
+ void assert(int expression);
+ long int strtol(const char *nptr, char **endptr, int base);
+ char *_strdup(const char *s);
+ char *strpbrk(const char *s, const char *accept);
#endif
-#ifdef _WIN32_WCE
#ifndef __GNUC__
-void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
-char *getcwd(char *buf, int size);
-typedef int ptrdiff_t;
-void GetCurrentDirectory(int len, char *buf);
-#define INVALID_FILE_ATTRIBUTES 0xffffffff
+ void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
+ char *getcwd(char *buf, int size);
+ typedef int ptrdiff_t;
+ void GetCurrentDirectory(int len, char *buf);
+ #define INVALID_FILE_ATTRIBUTES 0xffffffff
#else
-#include <math.h>
-#undef GetCurrentDirectory
-extern "C" void GetCurrentDirectory(int len, char *buf);
-#define snprintf _snprintf
-#define strdup _strdup
-#define fopen wce_fopen
+ #include <math.h>
+ #undef GetCurrentDirectory
+ extern "C" void GetCurrentDirectory(int len, char *buf);
+ #define snprintf _snprintf
+ #define strdup _strdup
+ #define fopen wce_fopen
#endif
#include <windows.h>
@@ -68,7 +75,7 @@ extern "C" void GetCurrentDirectory(int len, char *buf);
//#include <direct.h>
#ifdef __MINGW32CE__
-void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
+ void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
#endif
int remove(const char *path);
int _access(const char *path, int mode);
@@ -77,4 +84,5 @@ void drawError(char *);
#define vsnprintf _vsnprintf
+
#endif
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index a53bc41667..54fa71cfd2 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -379,10 +379,17 @@ void OSystem_WINCE3::initBackend() {
((WINCESdlEventSource *)_eventSource)->init((WINCESdlGraphicsManager *)_graphicsManager);
+
+ // FIXME: This timer manager is *not accesible* from the outside.
+ // Instead the timer manager setup by OSystem_SDL is visible on the outside.
+ // Since the WinCE backend actually seems to work, my guess is that
+ // SDL_AddTimer works after all and the following code is redundant.
+ // However it may be, this must be resolved one way or another.
+
// Create the timer. 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();
+ _int_timer = new DefaultTimerManager();
//_timerID = NULL; // OSystem_SDL will call removetimer with this, it's ok
SDL_SetTimer(10, &timer_handler_wrapper);
@@ -443,14 +450,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 +466,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 +578,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/posix/posix-provider.cpp b/backends/plugins/posix/posix-provider.cpp
index 39ed247436..a68a792fa4 100644
--- a/backends/plugins/posix/posix-provider.cpp
+++ b/backends/plugins/posix/posix-provider.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#if defined(DYNAMIC_MODULES) && defined(UNIX)
+#if defined(DYNAMIC_MODULES) && defined(POSIX)
#include "backends/plugins/posix/posix-provider.h"
#include "backends/plugins/dynamic-plugin.h"
@@ -77,9 +77,9 @@ public:
};
-Plugin* POSIXPluginProvider::createPlugin(const Common::FSNode &node) const {
+Plugin *POSIXPluginProvider::createPlugin(const Common::FSNode &node) const {
return new POSIXPlugin(node.getPath());
}
-#endif // defined(DYNAMIC_MODULES) && defined(UNIX)
+#endif // defined(DYNAMIC_MODULES) && defined(POSIX)
diff --git a/backends/plugins/posix/posix-provider.h b/backends/plugins/posix/posix-provider.h
index 7d6d6ada4d..b1186ccf3f 100644
--- a/backends/plugins/posix/posix-provider.h
+++ b/backends/plugins/posix/posix-provider.h
@@ -25,13 +25,13 @@
#include "base/plugins.h"
-#if defined(DYNAMIC_MODULES) && defined(UNIX)
+#if defined(DYNAMIC_MODULES) && defined(POSIX)
class POSIXPluginProvider : public FilePluginProvider {
protected:
- Plugin* createPlugin(const Common::FSNode &node) const;
+ Plugin *createPlugin(const Common::FSNode &node) const;
};
-#endif // defined(DYNAMIC_MODULES) && defined(UNIX)
+#endif // defined(DYNAMIC_MODULES) && defined(POSIX)
#endif
diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp
index 37545c77c2..e04609be5b 100644
--- a/backends/saves/posix/posix-saves.cpp
+++ b/backends/saves/posix/posix-saves.cpp
@@ -28,7 +28,7 @@
#include "common/scummsys.h"
-#if defined(UNIX) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
+#if defined(POSIX) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
#include "backends/saves/posix/posix-saves.h"
@@ -51,7 +51,7 @@
POSIXSaveFileManager::POSIXSaveFileManager() {
// Register default savepath based on HOME
#if defined(SAMSUNGTV)
- ConfMan.registerDefault("savepath", "/mtd_rwarea/scummvm/savegames");
+ ConfMan.registerDefault("savepath", "/mtd_wiselink/scummvm savegames");
#else
Common::String savePath;
const char *home = getenv("HOME");
@@ -83,13 +83,7 @@ POSIXSaveFileManager::POSIXSaveFileManager() {
}
#endif
}
-/*
-POSIXSaveFileManager::POSIXSaveFileManager(const Common::String &defaultSavepath)
- : DefaultSaveFileManager(defaultSavepath) {
-}
-*/
-#if defined(UNIX)
void POSIXSaveFileManager::checkPath(const Common::FSNode &dir) {
const Common::String path = dir.getPath();
clearError();
@@ -154,6 +148,5 @@ void POSIXSaveFileManager::checkPath(const Common::FSNode &dir) {
}
}
}
-#endif
#endif
diff --git a/backends/saves/posix/posix-saves.h b/backends/saves/posix/posix-saves.h
index b7ee7ff5b8..160075d3db 100644
--- a/backends/saves/posix/posix-saves.h
+++ b/backends/saves/posix/posix-saves.h
@@ -25,7 +25,7 @@
#include "backends/saves/default/default-saves.h"
-#if defined(UNIX)
+#if defined(POSIX) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
/**
* Customization of the DefaultSaveFileManager for POSIX platforms.
* The only two differences are that the default constructor sets
@@ -35,7 +35,6 @@
class POSIXSaveFileManager : public DefaultSaveFileManager {
public:
POSIXSaveFileManager();
-// POSIXSaveFileManager(const Common::String &defaultSavepath);
protected:
/**
diff --git a/backends/vkeybd/image-map.h b/backends/vkeybd/image-map.h
index 020bf70c67..3bd8cfa0db 100644
--- a/backends/vkeybd/image-map.h
+++ b/backends/vkeybd/image-map.h
@@ -23,9 +23,10 @@
#ifndef COMMON_IMAGEMAP_H
#define COMMON_IMAGEMAP_H
+#include "common/scummsys.h"
+
#ifdef ENABLE_VKEYBD
-#include "common/scummsys.h"
#include "common/hashmap.h"
#include "common/hash-str.h"
diff --git a/backends/vkeybd/polygon.h b/backends/vkeybd/polygon.h
index bc76dfb4d7..19a12a0409 100644
--- a/backends/vkeybd/polygon.h
+++ b/backends/vkeybd/polygon.h
@@ -23,9 +23,10 @@
#ifndef COMMON_POLYGON_H
#define COMMON_POLYGON_H
+#include "common/scummsys.h"
+
#ifdef ENABLE_VKEYBD
-#include "common/scummsys.h"
#include "common/array.h"
#include "common/rect.h"
diff --git a/backends/vkeybd/virtual-keyboard-gui.h b/backends/vkeybd/virtual-keyboard-gui.h
index e3798569fb..da80ef2223 100644
--- a/backends/vkeybd/virtual-keyboard-gui.h
+++ b/backends/vkeybd/virtual-keyboard-gui.h
@@ -23,10 +23,11 @@
#ifndef COMMON_VIRTUAL_KEYBOARD_GUI_H
#define COMMON_VIRTUAL_KEYBOARD_GUI_H
+#include "common/scummsys.h"
+
#ifdef ENABLE_VKEYBD
#include "backends/vkeybd/virtual-keyboard.h"
-#include "common/scummsys.h"
#include "common/rect.h"
#include "common/system.h"
#include "graphics/font.h"
diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp
index e2b35132dc..5e4ce11fe4 100644
--- a/backends/vkeybd/virtual-keyboard-parser.cpp
+++ b/backends/vkeybd/virtual-keyboard-parser.cpp
@@ -59,8 +59,7 @@ bool VirtualKeyboardParser::closedKeyCallback(ParserNode *node) {
return parserError("Initial mode of keyboard pack not defined");
} else if (node->name.equalsIgnoreCase("mode")) {
if (!_layoutParsed) {
- return parserError("'%s' layout missing from '%s' mode",
- _mode->resolution.c_str(), _mode->name.c_str());
+ return parserError("'" + _mode->resolution + "' layout missing from '" + _mode->name + "' mode");
}
}
return true;
@@ -105,7 +104,7 @@ bool VirtualKeyboardParser::parserCallback_mode(ParserNode *node) {
if (_parseMode == kParseFull) {
// if full parse then add new mode to keyboard
if (_keyboard->_modes.contains(name))
- return parserError("Mode '%s' has already been defined", name.c_str());
+ return parserError("Mode '" + name + "' has already been defined");
VirtualKeyboard::Mode mode;
mode.name = name;
@@ -177,7 +176,7 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) {
String name = node->values["name"];
if (_mode->events.contains(name))
- return parserError("Event '%s' has already been defined", name.c_str());
+ return parserError("Event '" + name + "' has already been defined");
VirtualKeyboard::VKEvent *evt = new VirtualKeyboard::VKEvent();
evt->name = name;
@@ -235,7 +234,7 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) {
evt->type = VirtualKeyboard::kVKEventMoveRight;
} else {
delete evt;
- return parserError("Event type '%s' not known", type.c_str());
+ return parserError("Event type '" + type + "' not known");
}
_mode->events[name] = evt;
@@ -257,7 +256,7 @@ bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) {
SeekableReadStream *file = _keyboard->_fileArchive->createReadStreamForMember(_mode->bitmapName);
if (!file)
- return parserError("Bitmap '%s' not found", _mode->bitmapName.c_str());
+ return parserError("Bitmap '" + _mode->bitmapName + "' not found");
const Graphics::PixelFormat format = g_system->getOverlayFormat();
@@ -265,7 +264,7 @@ bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) {
delete file;
if (!_mode->image)
- return parserError("Error loading bitmap '%s'", _mode->bitmapName.c_str());
+ return parserError("Error loading bitmap '" + _mode->bitmapName + "'");
int r, g, b;
if (node->values.contains("transparent_color")) {
@@ -313,7 +312,7 @@ bool VirtualKeyboardParser::parserCallback_area(ParserNode *node) {
Polygon *poly = _mode->imageMap.createArea(target);
return parsePolygon(*poly, coords);
}
- return parserError("Area shape '%s' not known", shape.c_str());
+ return parserError("Area shape '" + shape + "' not known");
}
byte VirtualKeyboardParser::parseFlags(const String& flags) {
diff --git a/backends/vkeybd/virtual-keyboard-parser.h b/backends/vkeybd/virtual-keyboard-parser.h
index a5d0e0e4f1..eb25ebe6fd 100644
--- a/backends/vkeybd/virtual-keyboard-parser.h
+++ b/backends/vkeybd/virtual-keyboard-parser.h
@@ -23,9 +23,10 @@
#ifndef COMMON_VIRTUAL_KEYBOARD_PARSER_H
#define COMMON_VIRTUAL_KEYBOARD_PARSER_H
+#include "common/scummsys.h"
+
#ifdef ENABLE_VKEYBD
-#include "common/scummsys.h"
#include "common/xmlparser.h"
#include "backends/vkeybd/virtual-keyboard.h"
diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h
index 4936275e23..21db5a47da 100644
--- a/backends/vkeybd/virtual-keyboard.h
+++ b/backends/vkeybd/virtual-keyboard.h
@@ -23,11 +23,12 @@
#ifndef COMMON_VIRTUAL_KEYBOARD_H
#define COMMON_VIRTUAL_KEYBOARD_H
+#include "common/scummsys.h"
+
#ifdef ENABLE_VKEYBD
class OSystem;
-#include "common/scummsys.h"
#include "common/events.h"
#include "common/hashmap.h"
#include "common/hash-str.h"