aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Persson2005-07-05 20:22:56 +0000
committerLars Persson2005-07-05 20:22:56 +0000
commitd4716a1fb525540f3395262d236df51ef70874f1 (patch)
tree7e5ddbbd1b7cfb28df2c25f041bf07d487bed662
parent57858a8757a5b3d96958ec856862886184082652 (diff)
downloadscummvm-rg350-d4716a1fb525540f3395262d236df51ef70874f1.tar.gz
scummvm-rg350-d4716a1fb525540f3395262d236df51ef70874f1.tar.bz2
scummvm-rg350-d4716a1fb525540f3395262d236df51ef70874f1.zip
* Start of generic key configuration support for ScummVM
* Moved KeyConfigDialog, key from WinCE to gui * Updated wince code to inherit and use new GUI::Keys and launch new dialog * New definition SMALL_SCREEN_DEVICE when keysdialog should be inittialized from options.cpp * Added new function to SDL\Events that handles key remapping. LINUPY & QTOPIA remapping moved to that function. SymbianOs.cpp overrides this function to enable key remapping to events * Compiled VC6++ project. This with warnings and errors, but NOT in the changed code. (SAGA,KYRA) * Compiled using WCE tools 3 for X86 target and running Scummvm in emulator to test * Compiled with UIQ target. The rest Symbian platforms might require further configuration to operate properly * Actor.h in Saga now compiles for default VC6 setting. * Aspect.cpp does not compile in VC6/WCE due to template problems with the kFastAndNiceAspectMode setting. * Changed order of creation of gamedetector and mainsystem in Main.cpp * If anything does not compile, or is totally out of order, please revert changes. svn-id: r18498
-rw-r--r--backends/epoc/ScummApp.cpp3
-rw-r--r--backends/epoc/ScummApp.h4
-rw-r--r--backends/epoc/SymbianActions.cpp190
-rw-r--r--backends/epoc/SymbianActions.h77
-rw-r--r--backends/epoc/SymbianOS.cpp167
-rw-r--r--backends/epoc/SymbianOS.h32
-rw-r--r--backends/epoc/build/S60/BLD.INF1
-rw-r--r--backends/epoc/build/S60/EScummVM_S60.mmp24
-rw-r--r--backends/epoc/build/S60/EScummVM_S60_EXE.mmp95
-rw-r--r--backends/epoc/build/S60/ScummVMApp.cpp1
-rw-r--r--backends/epoc/build/S80/EScummVM_S80.mmp4
-rw-r--r--backends/epoc/build/S90/EScummvm_S90.mmp4
-rw-r--r--backends/epoc/build/UIQ/EScummVM.rss19
-rw-r--r--backends/epoc/build/UIQ/EScummVM_UIQ.mmp10
-rw-r--r--backends/epoc/build/scummvm_base.mmp1
-rw-r--r--backends/sdl/events.cpp147
-rw-r--r--backends/sdl/sdl-common.h2
-rw-r--r--backends/wince/CEActions.cpp2
-rw-r--r--backends/wince/CEActions.h2
-rw-r--r--backends/wince/CEActionsPocket.cpp31
-rw-r--r--backends/wince/CEActionsPocket.h13
-rw-r--r--backends/wince/CEActionsSmartphone.cpp32
-rw-r--r--backends/wince/CEActionsSmartphone.h13
-rw-r--r--backends/wince/CELauncherDialog.cpp4
-rw-r--r--backends/wince/CEScaler.cpp2
-rw-r--r--backends/wince/wince-sdl.cpp38
-rw-r--r--base/main.cpp18
-rw-r--r--common/scummsys.h2
-rw-r--r--gui/Actions.cpp169
-rw-r--r--gui/Actions.h84
-rw-r--r--gui/Key.cpp (renamed from backends/wince/CEkeys/Key.cpp)58
-rw-r--r--gui/Key.h (renamed from backends/wince/CEkeys/Key.h)45
-rw-r--r--gui/KeysDialog.cpp174
-rw-r--r--gui/KeysDialog.h50
-rw-r--r--gui/options.cpp18
-rw-r--r--gui/options.h8
-rw-r--r--saga/actor.h10
-rw-r--r--scumm/dialogs.cpp14
-rw-r--r--scumm/dialogs.h2
-rw-r--r--simon/simon.cpp3
-rw-r--r--sky/sky.cpp2
41 files changed, 1323 insertions, 252 deletions
diff --git a/backends/epoc/ScummApp.cpp b/backends/epoc/ScummApp.cpp
index f4caa7ea33..408d52550f 100644
--- a/backends/epoc/ScummApp.cpp
+++ b/backends/epoc/ScummApp.cpp
@@ -29,7 +29,8 @@ extern "C" int _chkstk(int /*a*/) {
return 1;
}
#endif
-#if !defined (__AVKON_ELAF__) && !defined (S60)
+
+#ifdef EPOC_AS_APP
// this function is called by Symbian to deliver the new CApaApplication object
EXPORT_C CApaApplication* NewApplication() {
// Return pointer to newly created CQMApp
diff --git a/backends/epoc/ScummApp.h b/backends/epoc/ScummApp.h
index af44952b16..eab91c736a 100644
--- a/backends/epoc/ScummApp.h
+++ b/backends/epoc/ScummApp.h
@@ -27,7 +27,7 @@
#include <eikapp.h>
#include <e32base.h>
#include <sdlapp.h>
-#if!defined (__AVKON_ELAF__) && !defined(S60)
+#ifdef EPOC_AS_APP
#include "ECompXL.h"
#endif
@@ -37,7 +37,7 @@ public:
~CScummApp();
TUid AppDllUid() const;
-#if!defined (__AVKON_ELAF__) && !defined(S60)
+#ifdef EPOC_AS_APP
TECompXL iECompXL;
#endif
};
diff --git a/backends/epoc/SymbianActions.cpp b/backends/epoc/SymbianActions.cpp
new file mode 100644
index 0000000000..6ec2ed9484
--- /dev/null
+++ b/backends/epoc/SymbianActions.cpp
@@ -0,0 +1,190 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "SymbianActions.h"
+
+#include "gui/message.h"
+#include "scumm/scumm.h"
+#include "common/config-manager.h"
+
+// this next one needs to be replaced with Symbian specific include(s)
+//#include "EventsBuffer.h" for //EventsBuffer::simulateKey()
+#include <sdl.h>
+// and use the correct Symbian calls for: //_mainSystem->fcns()
+
+namespace GUI {
+
+// SumthinWicked says: we either split our Actions like WinCE did with Pocket/Smartphone
+// or we put them in this file separated by #ifdefs, this one is up to you, AnotherGuest :)
+
+const Common::String actionNames[] = {
+ "Up",
+ "Down",
+ "Left",
+ "Right",
+ "Left Click",
+ "Right Click",
+ "Save",
+ "Skip",
+ "Zone",
+ "FT Cheat",
+ "Swap character",
+ "Skip text",
+ "Pause",
+ "Quit"
+};
+
+#ifdef UIQ
+static const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0x11a, 0x11b, SDLK_MENU, SDLK_PAGEDOWN, 0, 0,SDLK_PAGEUP,0,0};
+#elif defined (S60)
+const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0, 0, '*', '#', '0',0,0,0,0,0};
+#else
+const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0x11a, 0x11b, SDLK_MENU, VK_ESCAPE, '9', 0,0,0,0};
+#endif
+// creator function according to Factory Pattern
+void SymbianActions::init(GameDetector &detector) {
+ _instance = new SymbianActions(detector);
+}
+
+
+Common::String SymbianActions::actionName(ActionType action) {
+ return actionNames[action];
+}
+
+int SymbianActions::size() {
+ return ACTION_LAST;
+}
+
+Common::String SymbianActions::domain() {
+ return "symbian";
+}
+
+int SymbianActions::version() {
+ return ACTION_VERSION;
+}
+
+SymbianActions::SymbianActions(GameDetector &detector) :
+ Actions(detector)
+{
+ int i;
+
+ for (i=0; i<ACTION_LAST; i++) {
+ _action_mapping[i] = ACTIONS_DEFAULT[i];
+ _action_enabled[i] = false;
+ }
+
+}
+
+void SymbianActions::initInstanceMain(OSystem *mainSystem) {
+ Actions::initInstanceMain(mainSystem);
+
+ // Mouse Up
+ _action_enabled[ACTION_UP] = true;
+
+ // Mouse Down
+ _action_enabled[ACTION_DOWN] = true;
+
+ // Mouse Left
+ _action_enabled[ACTION_LEFT] = true;
+
+ // Mouse Right
+ _action_enabled[ACTION_RIGHT] = true;
+
+ // Left Click
+ _action_enabled[ACTION_LEFTCLICK] = true;
+
+ // Right Click
+ _action_enabled[ACTION_RIGHTCLICK] = true;
+
+ // Skip
+ _action_enabled[ACTION_SKIP] = true;
+ _key_action[ACTION_SKIP].setAscii(SDLK_ESCAPE);
+}
+
+void SymbianActions::initInstanceGame() {
+ bool is_simon = (strncmp(_detector->_targetName.c_str(), "simon", 5) == 0);
+ bool is_sky = (_detector->_targetName == "sky");
+ bool is_queen = (_detector->_targetName == "queen");
+ bool is_gob = (strncmp(_detector->_targetName.c_str(), "gob", 3) == 0);
+
+ Actions::initInstanceGame();
+
+ // See if a right click mapping could be needed
+ if (is_sky || _detector->_targetName == "samnmax" || is_gob)
+ _right_click_needed = true;
+
+ // Initialize keys for different actions
+ // Save
+ if (is_simon || is_gob)
+ _action_enabled[ACTION_SAVE] = false;
+ else
+ if (is_queen) {
+ _action_enabled[ACTION_SAVE] = true;
+ _key_action[ACTION_SAVE].setAscii(SDLK_F1); // F1 key for FOTAQ or F5??!?
+ }
+ else
+ if (is_sky) {
+ _action_enabled[ACTION_SAVE] = true;
+ _key_action[ACTION_SAVE].setAscii(63);
+ }
+ else {
+ _action_enabled[ACTION_SAVE] = true;
+ _key_action[ACTION_SAVE].setAscii(SDLK_F5); // F5 key
+ }
+
+ // Swap character
+ _action_enabled[ACTION_SWAPCHAR] = true;
+ _key_action[ACTION_SWAPCHAR].setAscii('b'); // b
+
+ // Zone
+ _action_enabled[ACTION_ZONE] = true;
+
+ // FT Cheat
+ _action_enabled[ACTION_FT_CHEAT] = true;
+ _key_action[ACTION_FT_CHEAT].setAscii(86); // shift-V
+ // Skip text
+ _action_enabled[ACTION_SKIP_TEXT]=true;
+ if (is_queen) {
+ _key_action[ACTION_SKIP_TEXT].setAscii(SDLK_SPACE);
+ }
+ else {
+ _key_action[ACTION_SKIP_TEXT].setAscii(SDLK_PERIOD);
+ }
+
+ // Pause
+ _key_action[ACTION_PAUSE].setAscii(' ');
+ _action_enabled[ACTION_PAUSE] = true;
+
+ // Quit
+ _action_enabled[ACTION_QUIT] = true;
+}
+
+
+SymbianActions::~SymbianActions() {
+}
+
+bool SymbianActions::perform(ActionType action, bool pushed) {
+
+ return false;
+}
+
+} // namespace GUI
diff --git a/backends/epoc/SymbianActions.h b/backends/epoc/SymbianActions.h
new file mode 100644
index 0000000000..9e556a04af
--- /dev/null
+++ b/backends/epoc/SymbianActions.h
@@ -0,0 +1,77 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef SYMBIANACTIONS_H
+#define SYMBIANACTIONS_H
+
+#include "common/stdafx.h"
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "base/gameDetector.h"
+#include "gui/Key.h"
+#include "gui/Actions.h"
+//#include "sdl.h"
+
+namespace GUI {
+
+#define ACTION_VERSION 6
+
+enum actionType {
+ ACTION_UP = 0,
+ ACTION_DOWN,
+ ACTION_LEFT,
+ ACTION_RIGHT,
+ ACTION_LEFTCLICK,
+ ACTION_RIGHTCLICK,
+ ACTION_SAVE,
+ ACTION_SKIP,
+ ACTION_ZONE,
+ ACTION_FT_CHEAT,
+ ACTION_SWAPCHAR,
+ ACTION_SKIP_TEXT,
+ ACTION_PAUSE,
+ ACTION_QUIT,
+ ACTION_LAST
+};
+
+class SymbianActions : public Actions {
+public:
+ // Actions
+ bool perform(ActionType action, bool pushed = true);
+ Common::String actionName(ActionType action);
+ int size();
+ static void init(GameDetector &detector);
+ void initInstanceMain(OSystem *mainSystem);
+ void initInstanceGame();
+
+ // Action domain
+ Common::String domain();
+ int version();
+
+ ~SymbianActions();
+private:
+ SymbianActions(GameDetector &detector);
+ bool _right_click_needed;
+};
+
+} // namespace GUI
+
+#endif
diff --git a/backends/epoc/SymbianOS.cpp b/backends/epoc/SymbianOS.cpp
index 55f52260a0..ce8722920c 100644
--- a/backends/epoc/SymbianOS.cpp
+++ b/backends/epoc/SymbianOS.cpp
@@ -22,7 +22,10 @@
*/
#include "SymbianOS.h"
-
+#include "SymbianActions.h"
+#include "Actions.h"
+#include "Key.h"
+#include "gui\message.h"
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{"1x", "Fullscreen", GFX_NORMAL},
{0, 0, 0}
@@ -37,11 +40,22 @@ OSystem *OSystem_SymbianOS_create() {
extern Common::ConfigManager *g_config;
-OSystem_SDL_Symbian::OSystem_SDL_Symbian() :_channels(0),_stereo_mix_buffer(0){
+OSystem_SDL_Symbian::zoneDesc OSystem_SDL_Symbian::_zones[TOTAL_ZONES] = {
+ { 0, 0, 320, 145 },
+ { 0, 145, 150, 55 },
+ { 150, 145, 170, 55 }
+};
+OSystem_SDL_Symbian::OSystem_SDL_Symbian() :_channels(0),_stereo_mix_buffer(0)
+{
ConfMan.set("FM_high_quality", false);
ConfMan.set("FM_medium_quality", true);
// ConfMan.set("joystick_num",0); // S60 should have joystick_num set to 0 in the ini file
ConfMan.flushToDisk();
+ // Initialize global key mapping for Smartphones
+ GUI::Actions* actions = GUI::Actions::Instance();
+ actions->initInstanceMain(this);
+ actions->loadMapping();
+ initZones();
}
OSystem_SDL_Symbian::~OSystem_SDL_Symbian() {
@@ -165,8 +179,7 @@ void OSystem_SDL_Symbian::symbianMix(byte *samples, int len){
int16* bitmixDst=(int16*)samples;
int16* bitmixSrc=(int16*)_stereo_mix_buffer;
- for(int loop=len/2;loop>=0;loop--)
- {
+ for(int loop=len/2;loop>=0;loop--){
*bitmixDst=(*bitmixSrc+*(bitmixSrc+1))>>1;
bitmixDst++;
bitmixSrc+=2;
@@ -177,6 +190,152 @@ void OSystem_SDL_Symbian::symbianMix(byte *samples, int len){
}
+/**
+ * This is an implementation by the remapKey function
+ * @param SDL_Event to remap
+ * @param ScumVM event to modify if special result is requested
+ * @return true if Event has a valid return status
+ */
+bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev,Event &event)
+{
+ if(!GUI::Actions::Instance()->mappingActive() && ev.key.keysym.sym>SDLK_UNKNOWN)
+ for(TInt loop=0;loop<GUI::ACTION_LAST;loop++){
+ if(GUI::Actions::Instance()->getMapping(loop) ==ev.key.keysym.sym &&
+ GUI::Actions::Instance()->isEnabled(loop)){
+ // Create proper event instead
+ switch(loop)
+ {
+ case GUI::ACTION_UP:
+ if(ev.type == SDL_KEYDOWN)
+ {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ }
+ else
+ {
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
+ }
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ case GUI::ACTION_DOWN:
+ if(ev.type == SDL_KEYDOWN)
+ {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ }
+ else
+ {
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
+ }
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ case GUI::ACTION_LEFT:
+ if(ev.type == SDL_KEYDOWN)
+ {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ }
+ else
+ {
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
+ }
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ case GUI::ACTION_RIGHT:
+ if(ev.type == SDL_KEYDOWN)
+ {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ }
+ else
+ {
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
+ }
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ case GUI::ACTION_LEFTCLICK:
+ event.type = ev.type == SDL_KEYDOWN?EVENT_LBUTTONDOWN:EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ case GUI::ACTION_RIGHTCLICK:
+ event.type = ev.type == SDL_KEYDOWN?EVENT_RBUTTONDOWN:EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
+ return true;
+ case GUI::ACTION_ZONE:
+ if(ev.type == SDL_KEYDOWN)
+ {
+ int i;
+
+ for (i=0; i<TOTAL_ZONES; i++)
+ if (_km.x >= _zones[i].x && _km.y >= _zones[i].y &&
+ _km.x <= _zones[i].x + _zones[i].width && _km.y <= _zones[i].y + _zones[i].height
+ ) {
+ _mouseXZone[i] = _km.x;
+ _mouseYZone[i] = _km.y;
+ break;
+ }
+ _currentZone++;
+ if (_currentZone >= TOTAL_ZONES)
+ _currentZone = 0;
+ event.type = EVENT_MOUSEMOVE;
+ fillMouseEvent(event, _mouseXZone[_currentZone],_mouseYZone[_currentZone]);
+ SDL_WarpMouse(event.mouse.x,event.mouse.y);
+ }
+ return true;
+ case GUI::ACTION_SAVE:
+ case GUI::ACTION_SKIP:
+ case GUI::ACTION_FT_CHEAT:
+ case GUI::ACTION_SKIP_TEXT:
+ case GUI::ACTION_PAUSE:
+ {
+ GUI::Key& key = GUI::Actions::Instance()->getKeyAction(loop);
+ ev.key.keysym.sym =(SDLKey) key.ascii();
+ ev.key.keysym.scancode= key.keycode();
+ ev.key.keysym.mod =(SDLMod) key.flags();
+ return false;
+ }
+ case GUI::ACTION_QUIT:{
+ GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
+ if (alert.runModal() == GUI::kMessageOK)
+ quit();
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+void OSystem_SDL_Symbian::setWindowCaption(const char *caption) {
+ OSystem_SDL::setWindowCaption(caption);
+ check_mappings();
+}
+
+void OSystem_SDL_Symbian::check_mappings() {
+ if (!GUI::Actions::Instance()->gameDetector()._targetName.size() || GUI::Actions::Instance()->initialized())
+ return;
+
+ GUI::Actions::Instance()->initInstanceGame();
+}
+
+void OSystem_SDL_Symbian::initZones() {
+ int i;
+
+ _currentZone = 0;
+ for (i=0; i<TOTAL_ZONES; i++) {
+ _mouseXZone[i] = (_zones[i].x + (_zones[i].width / 2));
+ _mouseYZone[i] = (_zones[i].y + (_zones[i].height / 2));
+ }
+}
+
/*
// probably don't need this anymore: will remove later
#define EMPTY_SCALER_IMPLEMENTATION(x) \
diff --git a/backends/epoc/SymbianOS.h b/backends/epoc/SymbianOS.h
index abe72dc57d..5f281cfd3b 100644
--- a/backends/epoc/SymbianOS.h
+++ b/backends/epoc/SymbianOS.h
@@ -26,6 +26,8 @@
#include "sdl-common.h"
+#define TOTAL_ZONES 3
+
class OSystem_SDL_Symbian : public OSystem_SDL {
public:
OSystem_SDL_Symbian();
@@ -53,6 +55,23 @@ protected:
*/
void symbianMix(byte *samples, int len);
+ /**
+ * This is an implementation by the remapKey function
+ * @param SDL_Event to remap
+ * @param ScumVM event to modify if special result is requested
+ * @return true if Event has a valid return status
+ */
+ bool remapKey(SDL_Event &ev,Event &event);
+
+ void setWindowCaption(const char *caption);
+
+ /**
+ * Used to intialized special game mappings
+ */
+ void check_mappings();
+
+ void initZones();
+
// Audio
int _channels;
@@ -60,6 +79,19 @@ protected:
void *_sound_proc_param;
byte* _stereo_mix_buffer;
+ // Used to handle joystick navi zones
+ int _mouseXZone[TOTAL_ZONES];
+ int _mouseYZone[TOTAL_ZONES];
+ int _currentZone;
+
+ typedef struct zoneDesc {
+ int x;
+ int y;
+ int width;
+ int height;
+ } zoneDesc;
+
+ static zoneDesc _zones[TOTAL_ZONES];
};
#endif
diff --git a/backends/epoc/build/S60/BLD.INF b/backends/epoc/build/S60/BLD.INF
index 25d2d236ca..b65f65c7e2 100644
--- a/backends/epoc/build/S60/BLD.INF
+++ b/backends/epoc/build/S60/BLD.INF
@@ -10,3 +10,4 @@ PRJ_MMPFILES
..\scummvm_gob.mmp
.\EScummVM_S60.mmp
.\EScummVM_S60_App.mmp
+.\EScummVM_S60_Exe.mmp
diff --git a/backends/epoc/build/S60/EScummVM_S60.mmp b/backends/epoc/build/S60/EScummVM_S60.mmp
index 9fe8e1e9c7..143306a72c 100644
--- a/backends/epoc/build/S60/EScummVM_S60.mmp
+++ b/backends/epoc/build/S60/EScummVM_S60.mmp
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Header:
+ * $Header$
*/
//
@@ -27,22 +27,22 @@
// *** Definitions
-#if defined(WINS)
- TARGET EScummVM.dll
-#else
- TARGET EScummVM.exe
-#endif
-TARGETPATH system\apps\EScummVMs60
-TARGETTYPE EXEDLL
+TARGET ESCUMMVM.APP
+TARGETPATH system\apps\EScummVM
+TARGETTYPE app
// /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION MSVC /QIfist /Ob1 /Oy /GF
//OPTION GCC -O3 -funroll-loops -finline-functions -ffast-math -frerun-loop-opt -fconserve-space -fexpensive-optimizations -Wno-multichar -Wno-reorder
-sourcepath ..\
-EPOCSTACKSIZE 0x00008000
EPOCHEAPSIZE 1024 5242880
+EPOCSTACKSIZE 0x80008000 // this enables ECompXL app compression
+AIF EScummVm.Aif ..\ ScummVmAif.rss c16 ScummL.bmp ScummLM.bmp ScummS.bmp ScummSM.bmp // mine still fails: I think it's because I have JRE 1.5 instead of 1.3 :P
+UID 0x100039ce 0x101f9b57
+
+RESOURCE EScummVM.rss
MACRO S60
+MACRO EPOC_AS_APP
MACRO NONSTANDARD_PORT
// these need too high a resolution
@@ -100,8 +100,12 @@ SOURCE backends\sdl\graphics.cpp
SOURCE backends\sdl\sdl.cpp
SOURCE backends\fs\symbian\symbian-fs.cpp
SOURCE backends\epoc\SymbianOS.cpp
+SOURCE backends\epoc\SymbianActions.cpp
SOURCE backends\epoc\ScummApp.cpp
+SOURCE gui\Key.cpp
+SOURCE gui\KeysDialog.cpp
+SOURCE gui\Actions.cpp
// *** Dynamic Libraries
LIBRARY cone.lib eikcore.lib
diff --git a/backends/epoc/build/S60/EScummVM_S60_EXE.mmp b/backends/epoc/build/S60/EScummVM_S60_EXE.mmp
new file mode 100644
index 0000000000..ebb58553bb
--- /dev/null
+++ b/backends/epoc/build/S60/EScummVM_S60_EXE.mmp
@@ -0,0 +1,95 @@
+//
+// EPOC S60 MMP makefile project for ScummVM
+//
+
+// *** Definitions
+
+#if defined(WINS)
+ TARGET EScummVM.dll
+#else
+ TARGET EScummVM.exe
+#endif
+TARGETPATH system\apps\EScummVMs60
+TARGETTYPE EXEDLL
+ // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
+OPTION MSVC /QIfist /Ob1 /Oy /GF
+//OPTION GCC -O3 -funroll-loops -finline-functions -ffast-math -frerun-loop-opt -fconserve-space -fexpensive-optimizations -Wno-multichar -Wno-reorder
+sourcepath ..\
+
+EPOCSTACKSIZE 0x00008000
+
+EPOCHEAPSIZE 1024 5242880
+
+MACRO S60
+MACRO NONSTANDARD_PORT
+
+// these need too high a resolution
+MACRO DISABLE_SWORD1
+MACRO DISABLE_SWORD2
+// these are not ready to be released
+MACRO DISABLE_SAGA
+MACRO DISABLE_KYRA
+// these work, so don't disable them :)
+//MACRO DISABLE_SIMON
+//MACRO DISABLE_SKY
+//MACRO DISABLE_QUEEN
+//MACRO DISABLE_GOB
+
+// *** Static Libraries
+
+STATICLIBRARY scummvm_scumm.lib
+STATICLIBRARY scummvm_simon.lib
+STATICLIBRARY scummvm_sky.lib
+STATICLIBRARY scummvm_queen.lib
+STATICLIBRARY scummvm_gob.lib
+STATICLIBRARY scummvm_base.lib
+
+STATICLIBRARY libmad.lib
+STATICLIBRARY zlib.lib
+STATICLIBRARY esdl_exe.lib
+#if !defined(WINS)
+STATICLIBRARY egcc.lib // for __fixunsdfsi
+#endif
+// *** Include paths
+
+USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui
+USERINCLUDE ..\..\..\..\backends\fs ..\..\..\..\backends\epoc ..\..\..\..\backends\sdl ..\..\..\..\sound
+
+SYSTEMINCLUDE \epoc32\include\ESDL
+SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version
+SYSTEMINCLUDE \epoc32\include\libc
+SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE ..\..\..\..\backends\epoc // for portdefs.h
+
+// *** SOURCE files
+
+SOURCEPATH ..\..\..\..
+
+//START_AUTO_OBJECTS_BASE_// Updated @ Tue May 31 18:35:38 2005
+SOURCE base\engine.cpp
+SOURCE base\gameDetector.cpp
+SOURCE base\main.cpp
+SOURCE base\plugins.cpp
+//STOP_AUTO_OBJECTS_BASE_//
+
+// backend EPOC/SDL/ESDL specific includes
+SOURCE backends\sdl\events.cpp
+SOURCE backends\sdl\graphics.cpp
+SOURCE backends\sdl\sdl.cpp
+SOURCE backends\fs\symbian\symbian-fs.cpp
+SOURCE backends\epoc\SymbianOS.cpp
+SOURCE backends\epoc\SymbianActions.cpp
+SOURCE backends\epoc\ScummApp.cpp
+
+SOURCE gui\Key.cpp
+SOURCE gui\KeysDialog.cpp
+SOURCE gui\Actions.cpp
+// *** Dynamic Libraries
+
+LIBRARY cone.lib eikcore.lib
+LIBRARY euser.lib apparc.lib fbscli.lib
+LIBRARY estlib.lib apgrfx.lib
+LIBRARY gdi.lib hal.lib bitgdi.lib
+LIBRARY mediaclientaudiostream.lib efsrv.lib ws32.lib
+LIBRARY AVKON.LIB
+
diff --git a/backends/epoc/build/S60/ScummVMApp.cpp b/backends/epoc/build/S60/ScummVMApp.cpp
index 1702a88ba7..93a28694c3 100644
--- a/backends/epoc/build/S60/ScummVMApp.cpp
+++ b/backends/epoc/build/S60/ScummVMApp.cpp
@@ -95,6 +95,7 @@ void CScummVMUi::ConstructL() {
lsSession.StartApp(*cmdLine,iThreadId);
CleanupStack::PopAndDestroy();//close lsSession
CleanupStack::PopAndDestroy(cmdLine);
+ User::After(500000);// Let the application start
TApaTaskList taskList(iEikonEnv->WsSession());
TApaTask myTask=taskList.FindApp(TUid::Uid(0x101f9b57));
diff --git a/backends/epoc/build/S80/EScummVM_S80.mmp b/backends/epoc/build/S80/EScummVM_S80.mmp
index 4b12e269b7..3e843ab2cf 100644
--- a/backends/epoc/build/S80/EScummVM_S80.mmp
+++ b/backends/epoc/build/S80/EScummVM_S80.mmp
@@ -100,8 +100,12 @@ SOURCE backends\sdl\graphics.cpp
SOURCE backends\sdl\sdl.cpp
SOURCE backends\fs\symbian\symbian-fs.cpp
SOURCE backends\epoc\SymbianOS.cpp
+SOURCE backends\epoc\SymbianActions.cpp
SOURCE backends\epoc\ScummApp.cpp
+SOURCE gui\Key.cpp
+SOURCE gui\KeysDialog.cpp
+SOURCE gui\Actions.cpp
// *** Dynamic Libraries
LIBRARY cone.lib eikcore.lib
diff --git a/backends/epoc/build/S90/EScummvm_S90.mmp b/backends/epoc/build/S90/EScummvm_S90.mmp
index 6327b93c74..79d729b2a1 100644
--- a/backends/epoc/build/S90/EScummvm_S90.mmp
+++ b/backends/epoc/build/S90/EScummvm_S90.mmp
@@ -100,8 +100,12 @@ SOURCE backends\sdl\graphics.cpp
SOURCE backends\sdl\sdl.cpp
SOURCE backends\fs\symbian\symbian-fs.cpp
SOURCE backends\epoc\SymbianOS.cpp
+SOURCE backends\epoc\SymbianActions.cpp
SOURCE backends\epoc\ScummApp.cpp
+SOURCE gui\Key.cpp
+SOURCE gui\KeysDialog.cpp
+SOURCE gui\Actions.cpp
// *** Dynamic Libraries
LIBRARY cone.lib eikcore.lib
diff --git a/backends/epoc/build/UIQ/EScummVM.rss b/backends/epoc/build/UIQ/EScummVM.rss
index 470e819220..72f798781d 100644
--- a/backends/epoc/build/UIQ/EScummVM.rss
+++ b/backends/epoc/build/UIQ/EScummVM.rss
@@ -28,7 +28,7 @@ NAME SCUM
// Include definitions of resource STRUCTS used by this
// resource script
#include <eikon.rh>
-#include "..\backends\epoc\Scummvm.hrh"
+#include "..\..\Scummvm.hrh"
// Include the standard Eikon resource ids
#include <eikon.rsg>
@@ -41,22 +41,5 @@ RESOURCE TBUF16 { buf=""; }
RESOURCE EIK_APP_INFO
{
- menubar = r_scum_menubar;
}
-RESOURCE MENU_BAR r_scum_menubar // *** Menu bar
-{
- titles =
- {
- MENU_TITLE { menu_pane = r_scum_menu; txt = "ScummVM"; }
- };
-}
-
-RESOURCE MENU_PANE r_scum_menu // *** Submenu
-{
- items =
- {
-
- MENU_ITEM{command = EEikCmdExit;txt = "Exit";}
- };
-}
diff --git a/backends/epoc/build/UIQ/EScummVM_UIQ.mmp b/backends/epoc/build/UIQ/EScummVM_UIQ.mmp
index c0ad2e1bef..fd4acda861 100644
--- a/backends/epoc/build/UIQ/EScummVM_UIQ.mmp
+++ b/backends/epoc/build/UIQ/EScummVM_UIQ.mmp
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Header:
+ * $Header$
*/
//
@@ -36,11 +36,12 @@ OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way
RESOURCE EScummVM.rss
EPOCSTACKSIZE 0x80008000 // this enables ECompXL app compression
-AIF EScummVm.Aif ..\ ScummVmAif.rss c16 ScummL.bmp ScummLM.bmp ScummS.bmp ScummSM.bmp // still fails?
+AIF EScummVm.Aif ..\ ScummVmAif.rss c16 ScummL.bmp ScummLM.bmp ScummS.bmp ScummSM.bmp // mine still fails: I think it's because I have JRE 1.5 instead of 1.3 :P
UID 0x100039ce 0x101f9b57
MACRO UIQ
MACRO NONSTANDARD_PORT
+MACRO EPOC_AS_APP
// these need too high a resolution
MACRO DISABLE_SWORD1
@@ -98,8 +99,13 @@ SOURCE backends\sdl\graphics.cpp
SOURCE backends\sdl\sdl.cpp
SOURCE backends\fs\symbian\symbian-fs.cpp
SOURCE backends\epoc\SymbianOS.cpp
+SOURCE backends\epoc\SymbianActions.cpp
SOURCE backends\epoc\ScummApp.cpp
+SOURCE gui\Key.cpp
+SOURCE gui\KeysDialog.cpp
+SOURCE gui\Actions.cpp
+
// *** Dynamic Libraries
LIBRARY cone.lib eikcore.lib
diff --git a/backends/epoc/build/scummvm_base.mmp b/backends/epoc/build/scummvm_base.mmp
index e7c0a5f3de..9fb213935f 100644
--- a/backends/epoc/build/scummvm_base.mmp
+++ b/backends/epoc/build/scummvm_base.mmp
@@ -21,7 +21,6 @@
* $Header:
*/
-
//
// EPOC MMP makefile project for ScummVM
//
diff --git a/backends/sdl/events.cpp b/backends/sdl/events.cpp
index cdc803409c..f195b11e86 100644
--- a/backends/sdl/events.cpp
+++ b/backends/sdl/events.cpp
@@ -189,7 +189,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
while(SDL_PollEvent(&ev)) {
switch(ev.type) {
- case SDL_KEYDOWN:
+ case SDL_KEYDOWN:{
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
// Alt-Return and Alt-Enter toggle full screen mode
@@ -331,78 +331,24 @@ bool OSystem_SDL::pollEvent(Event &event) {
}
break;
}
-
-#ifdef LINUPY
- // On Yopy map the End button to quit
- if ((ev.key.keysym.sym == 293)) {
- event.type = EVENT_QUIT;
- return true;
- }
- // Map menu key to f5 (scumm menu)
- if (ev.key.keysym.sym == 306) {
- event.type = EVENT_KEYDOWN;
- event.kbd.keycode = SDLK_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- return true;
- }
- // Map action key to action
- if (ev.key.keysym.sym == 291) {
- event.type = EVENT_KEYDOWN;
- event.kbd.keycode = SDLK_TAB;
- event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0);
- return true;
- }
- // Map OK key to skip cinematic
- if (ev.key.keysym.sym == 292) {
- event.type = EVENT_KEYDOWN;
- event.kbd.keycode = SDLK_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ const bool event_complete= remapKey(ev,event);
+
+ if(event_complete)
return true;
- }
-#endif
-#ifdef QTOPIA
- // quit on fn+backspace on zaurus
- if (ev.key.keysym.sym == 127) {
- event.type = EVENT_QUIT;
- return true;
- }
-
- // map menu key (f11) to f5 (scumm menu)
- if (ev.key.keysym.sym == SDLK_F11) {
- event.type = EVENT_KEYDOWN;
- event.kbd.keycode = SDLK_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- // map center (space) to tab (default action )
- // I wanted to map the calendar button but the calendar comes up
- //
- else if (ev.key.keysym.sym == SDLK_SPACE) {
- event.type = EVENT_KEYDOWN;
- event.kbd.keycode = SDLK_TAB;
- event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0);
- }
- // since we stole space (pause) above we'll rebind it to the tab key on the keyboard
- else if (ev.key.keysym.sym == SDLK_TAB) {
- event.type = EVENT_KEYDOWN;
- event.kbd.keycode = SDLK_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- } else {
- // let the events fall through if we didn't change them, this may not be the best way to
- // set it up, but i'm not sure how sdl would like it if we let if fall through then redid it though.
- // and yes i have an huge terminal size so i dont wrap soon enough.
- event.type = EVENT_KEYDOWN;
- event.kbd.keycode = ev.key.keysym.sym;
- event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
- }
-#else
event.type = EVENT_KEYDOWN;
event.kbd.keycode = ev.key.keysym.sym;
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
-#endif
+
return true;
-
+ }
case SDL_KEYUP:
+ {
+ const bool event_complete= remapKey(ev,event);
+
+ if(event_complete)
+ return true;
+
event.type = EVENT_KEYUP;
event.kbd.keycode = ev.key.keysym.sym;
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
@@ -415,7 +361,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
}
return true;
-
+ }
case SDL_MOUSEMOTION:
event.type = EVENT_MOUSEMOVE;
fillMouseEvent(event, ev.motion.x, ev.motion.y);
@@ -571,4 +517,71 @@ bool OSystem_SDL::pollEvent(Event &event) {
return false;
}
+bool OSystem_SDL::remapKey(SDL_Event &ev,Event &event){
+#ifdef LINUPY
+ // On Yopy map the End button to quit
+ if ((ev.key.keysym.sym == 293)) {
+ event.type = EVENT_QUIT;
+ return true;
+ }
+ // Map menu key to f5 (scumm menu)
+ if (ev.key.keysym.sym == 306) {
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = SDLK_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ return true;
+ }
+ // Map action key to action
+ if (ev.key.keysym.sym == 291) {
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = SDLK_TAB;
+ event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0);
+ return true;
+ }
+ // Map OK key to skip cinematic
+ if (ev.key.keysym.sym == 292) {
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = SDLK_ESCAPE;
+ event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
+ return true;
+ }
+#endif
+
+#ifdef QTOPIA
+ // quit on fn+backspace on zaurus
+ if (ev.key.keysym.sym == 127) {
+ event.type = EVENT_QUIT;
+ return true;
+ }
+
+ // map menu key (f11) to f5 (scumm menu)
+ if (ev.key.keysym.sym == SDLK_F11) {
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = SDLK_F5;
+ event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
+ }
+ // map center (space) to tab (default action )
+ // I wanted to map the calendar button but the calendar comes up
+ //
+ else if (ev.key.keysym.sym == SDLK_SPACE) {
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = SDLK_TAB;
+ event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0);
+ }
+ // since we stole space (pause) above we'll rebind it to the tab key on the keyboard
+ else if (ev.key.keysym.sym == SDLK_TAB) {
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = SDLK_SPACE;
+ event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
+ } else {
+ // let the events fall through if we didn't change them, this may not be the best way to
+ // set it up, but i'm not sure how sdl would like it if we let if fall through then redid it though.
+ // and yes i have an huge terminal size so i dont wrap soon enough.
+ event.type = EVENT_KEYDOWN;
+ event.kbd.keycode = ev.key.keysym.sym;
+ event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+ }
+#endif
+ return false;
+}
diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h
index 036a63fd05..87e2eb3a34 100644
--- a/backends/sdl/sdl-common.h
+++ b/backends/sdl/sdl-common.h
@@ -196,6 +196,8 @@ public:
#endif
protected:
+ virtual bool remapKey(SDL_Event &ev, Event &event);
+
bool _inited;
#ifdef USE_OSD
diff --git a/backends/wince/CEActions.cpp b/backends/wince/CEActions.cpp
index 534683ea62..2e7d9fd4b8 100644
--- a/backends/wince/CEActions.cpp
+++ b/backends/wince/CEActions.cpp
@@ -53,7 +53,7 @@ void CEActions::init(GameDetector &detector) {
//#endif
}
-void CEActions::initInstanceMain(OSystem_WINCE3 *mainSystem) {
+void CEActions::initInstanceMain(OSystem *mainSystem) {
_mainSystem = mainSystem;
}
diff --git a/backends/wince/CEActions.h b/backends/wince/CEActions.h
index e146fb5ae9..fddd935ba6 100644
--- a/backends/wince/CEActions.h
+++ b/backends/wince/CEActions.h
@@ -41,7 +41,7 @@ class CEActions {
public:
static CEActions* Instance();
static void init(GameDetector &detector);
- virtual void initInstanceMain(OSystem_WINCE3 *mainSystem);
+ virtual void initInstanceMain(OSystem *mainSystem);
virtual void initInstanceGame();
bool initialized();
diff --git a/backends/wince/CEActionsPocket.cpp b/backends/wince/CEActionsPocket.cpp
index 342a3baa28..6c55be3fa5 100644
--- a/backends/wince/CEActionsPocket.cpp
+++ b/backends/wince/CEActionsPocket.cpp
@@ -51,7 +51,7 @@ void CEActionsPocket::init(GameDetector &detector) {
}
-String CEActionsPocket::actionName(ActionType action) {
+String CEActionsPocket::actionName(GUI::ActionType action) {
return pocketActionNames[action];
}
@@ -68,7 +68,7 @@ int CEActionsPocket::version() {
}
CEActionsPocket::CEActionsPocket(GameDetector &detector) :
- CEActions(detector)
+GUI::Actions(detector)
{
int i;
@@ -83,9 +83,10 @@ CEActionsPocket::CEActionsPocket(GameDetector &detector) :
}
-void CEActionsPocket::initInstanceMain(OSystem_WINCE3 *mainSystem) {
+void CEActionsPocket::initInstanceMain(OSystem *mainSystem) {
// Nothing generic to do for Pocket PC
- CEActions::initInstanceMain(mainSystem);
+ _CESystem = static_cast<OSystem_WINCE3*>(mainSystem);
+ GUI_Actions::initInstanceMain(mainSystem);
}
void CEActionsPocket::initInstanceGame() {
@@ -97,7 +98,7 @@ void CEActionsPocket::initInstanceGame() {
bool is_comi = (strncmp(_detector->_targetName.c_str(), "comi", 4) == 0);
bool is_gob = (strncmp(_detector->_targetName.c_str(), "gob", 3) == 0);
- CEActions::initInstanceGame();
+ GUI_Actions::initInstanceGame();
// See if a right click mapping could be needed
if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob ||
@@ -164,11 +165,11 @@ void CEActionsPocket::initInstanceGame() {
CEActionsPocket::~CEActionsPocket() {
}
-bool CEActionsPocket::perform(ActionType action, bool pushed) {
+bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
if (!pushed) {
switch(action) {
case POCKET_ACTION_RIGHTCLICK:
- _mainSystem->add_right_click(false);
+ _CESystem->add_right_click(false);
return true;
case POCKET_ACTION_PAUSE:
case POCKET_ACTION_SAVE:
@@ -189,28 +190,28 @@ bool CEActionsPocket::perform(ActionType action, bool pushed) {
EventsBuffer::simulateKey(&_key_action[action], true);
return true;
case POCKET_ACTION_KEYBOARD:
- _mainSystem->swap_panel();
+ _CESystem->swap_panel();
return true;
case POCKET_ACTION_HIDE:
- _mainSystem->swap_panel_visibility();
+ _CESystem->swap_panel_visibility();
return true;
case POCKET_ACTION_SOUND:
- _mainSystem->swap_sound_master();
+ _CESystem->swap_sound_master();
return true;
case POCKET_ACTION_RIGHTCLICK:
- _mainSystem->add_right_click(true);
+ _CESystem->add_right_click(true);
return true;
case POCKET_ACTION_CURSOR:
- _mainSystem->swap_mouse_visibility();
+ _CESystem->swap_mouse_visibility();
return true;
case POCKET_ACTION_FREELOOK:
- _mainSystem->swap_freeLook();
+ _CESystem->swap_freeLook();
return true;
case POCKET_ACTION_ZOOM_UP:
- _mainSystem->swap_zoom_up();
+ _CESystem->swap_zoom_up();
return true;
case POCKET_ACTION_ZOOM_DOWN:
- _mainSystem->swap_zoom_down();
+ _CESystem->swap_zoom_down();
return true;
case POCKET_ACTION_QUIT:
GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
diff --git a/backends/wince/CEActionsPocket.h b/backends/wince/CEActionsPocket.h
index a473371a60..ce5ac1499a 100644
--- a/backends/wince/CEActionsPocket.h
+++ b/backends/wince/CEActionsPocket.h
@@ -29,9 +29,9 @@
#include "base/gameDetector.h"
#include "wince-sdl.h"
-#include "Key.h"
+#include "gui/Key.h"
-#include "CEActions.h"
+#include "gui/Actions.h"
#define POCKET_ACTION_VERSION 4
@@ -53,15 +53,15 @@ enum pocketActionType {
POCKET_ACTION_LAST
};
-class CEActionsPocket : public CEActions {
+class CEActionsPocket : public GUI::Actions {
public:
// Actions
- bool perform(ActionType action, bool pushed = true);
- String actionName(ActionType action);
+ bool perform(GUI::ActionType action, bool pushed = true);
+ String actionName(GUI::ActionType action);
int size();
static void init(GameDetector &detector);
- void initInstanceMain(OSystem_WINCE3 *mainSystem);
+ void initInstanceMain(OSystem *mainSystem);
void initInstanceGame();
// Action domain
@@ -79,6 +79,7 @@ class CEActionsPocket : public CEActions {
bool _right_click_needed;
bool _hide_toolbar_needed;
bool _zoom_needed;
+ OSystem_WINCE3 *_CESystem;
};
#endif
diff --git a/backends/wince/CEActionsSmartphone.cpp b/backends/wince/CEActionsSmartphone.cpp
index b732360f28..c8938b8859 100644
--- a/backends/wince/CEActionsSmartphone.cpp
+++ b/backends/wince/CEActionsSmartphone.cpp
@@ -57,7 +57,7 @@ void CEActionsSmartphone::init(GameDetector &detector) {
}
-String CEActionsSmartphone::actionName(ActionType action) {
+String CEActionsSmartphone::actionName(GUI::ActionType action) {
return smartphoneActionNames[action];
}
@@ -74,7 +74,7 @@ int CEActionsSmartphone::version() {
}
CEActionsSmartphone::CEActionsSmartphone(GameDetector &detector) :
- CEActions(detector)
+GUI::Actions(detector)
{
int i;
@@ -85,9 +85,9 @@ CEActionsSmartphone::CEActionsSmartphone(GameDetector &detector) :
}
-void CEActionsSmartphone::initInstanceMain(OSystem_WINCE3 *mainSystem) {
- CEActions::initInstanceMain(mainSystem);
-
+void CEActionsSmartphone::initInstanceMain(OSystem *mainSystem) {
+ _CESystem = static_cast<OSystem_WINCE3*>(mainSystem);
+ GUI_Actions::initInstanceMain(mainSystem);
// Mouse Up
_action_enabled[SMARTPHONE_ACTION_UP] = true;
// Mouse Down
@@ -108,7 +108,7 @@ void CEActionsSmartphone::initInstanceGame() {
bool is_queen = (_detector->_targetName == "queen");
bool is_gob = (strncmp(_detector->_targetName.c_str(), "gob", 3) == 0);
- CEActions::initInstanceGame();
+ GUI_Actions::initInstanceGame();
// See if a right click mapping could be needed
if (is_sky || _detector->_targetName == "samnmax" || is_gob)
@@ -149,14 +149,14 @@ void CEActionsSmartphone::initInstanceGame() {
CEActionsSmartphone::~CEActionsSmartphone() {
}
-bool CEActionsSmartphone::perform(ActionType action, bool pushed) {
+bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
if (!pushed) {
switch (action) {
case SMARTPHONE_ACTION_RIGHTCLICK:
- _mainSystem->add_right_click(false);
+ _CESystem->add_right_click(false);
return true;
case SMARTPHONE_ACTION_LEFTCLICK:
- _mainSystem->add_left_click(false);
+ _CESystem->add_left_click(false);
return true;
case SMARTPHONE_ACTION_SAVE:
case SMARTPHONE_ACTION_SKIP:
@@ -174,25 +174,25 @@ bool CEActionsSmartphone::perform(ActionType action, bool pushed) {
EventsBuffer::simulateKey(&_key_action[action], true);
return true;
case SMARTPHONE_ACTION_RIGHTCLICK:
- _mainSystem->add_right_click(true);
+ _CESystem->add_right_click(true);
return true;
case SMARTPHONE_ACTION_LEFTCLICK:
- _mainSystem->add_left_click(true);
+ _CESystem->add_left_click(true);
return true;
case SMARTPHONE_ACTION_UP:
- _mainSystem->move_cursor_up();
+ _CESystem->move_cursor_up();
return true;
case SMARTPHONE_ACTION_DOWN:
- _mainSystem->move_cursor_down();
+ _CESystem->move_cursor_down();
return true;
case SMARTPHONE_ACTION_LEFT:
- _mainSystem->move_cursor_left();
+ _CESystem->move_cursor_left();
return true;
case SMARTPHONE_ACTION_RIGHT:
- _mainSystem->move_cursor_right();
+ _CESystem->move_cursor_right();
return true;
case SMARTPHONE_ACTION_ZONE:
- _mainSystem->switch_zone();
+ _CESystem->switch_zone();
return true;
}
diff --git a/backends/wince/CEActionsSmartphone.h b/backends/wince/CEActionsSmartphone.h
index 5a48b4c762..b532e2004c 100644
--- a/backends/wince/CEActionsSmartphone.h
+++ b/backends/wince/CEActionsSmartphone.h
@@ -31,9 +31,9 @@
#include "base/gameDetector.h"
#include "wince-sdl.h"
-#include "Key.h"
+#include "gui/Key.h"
-#include "CEActions.h"
+#include "gui/Actions.h"
#define SMARTPHONE_ACTION_VERSION 4
@@ -53,14 +53,14 @@ enum smartphoneActionType {
};
-class CEActionsSmartphone : public CEActions {
+class CEActionsSmartphone : public GUI::Actions {
public:
// Actions
- bool perform(ActionType action, bool pushed = true);
- String actionName(ActionType action);
+ bool perform(GUI::ActionType action, bool pushed = true);
+ String actionName(GUI::ActionType action);
int size();
static void init(GameDetector &detector);
- void initInstanceMain(OSystem_WINCE3 *mainSystem);
+ void initInstanceMain(OSystem *mainSystem);
void initInstanceGame();
// Action domain
@@ -71,6 +71,7 @@ class CEActionsSmartphone : public CEActions {
private:
CEActionsSmartphone(GameDetector &detector);
bool _right_click_needed;
+ OSystem_WINCE3 *_CESystem;
};
#endif
diff --git a/backends/wince/CELauncherDialog.cpp b/backends/wince/CELauncherDialog.cpp
index cf6d65c346..9de00a1231 100644
--- a/backends/wince/CELauncherDialog.cpp
+++ b/backends/wince/CELauncherDialog.cpp
@@ -43,7 +43,7 @@ public:
: Dialog(10, 60, 300, 77) {
char tempo[100];
- addButton((_w - kButtonWidth) / 2, 45, "OK", kCloseCmd, '\r'); // Close dialog - FIXME
+ addButton(this,(_w - kButtonWidth) / 2, 45, "OK", kCloseCmd, '\r'); // Close dialog - FIXME
Common::String videoDriver("Using SDL driver ");
SDL_VideoDriverName(tempo, sizeof(tempo));
@@ -61,7 +61,7 @@ public:
CEConflictDialog::CEConflictDialog(const Common::String &name)
: Dialog(10, 60, 300, 77) {
- addButton((_w - kButtonWidth) / 2, 45, "OK", kCloseCmd, '\r'); // Close dialog - FIXME
+ addButton(this,(_w - kButtonWidth) / 2, 45, "OK", kCloseCmd, '\r'); // Close dialog - FIXME
Common::String conflict("Too many matches for directory ");
conflict += name;
diff --git a/backends/wince/CEScaler.cpp b/backends/wince/CEScaler.cpp
index e07c7f8ad2..394dbeb066 100644
--- a/backends/wince/CEScaler.cpp
+++ b/backends/wince/CEScaler.cpp
@@ -18,7 +18,7 @@
* $Header$
*
*/
-
+#include "common/scaler/intern.h"
#include "common/stdafx.h"
#include "CEScaler.h"
diff --git a/backends/wince/wince-sdl.cpp b/backends/wince/wince-sdl.cpp
index 1562832847..39aeae10cd 100644
--- a/backends/wince/wince-sdl.cpp
+++ b/backends/wince/wince-sdl.cpp
@@ -34,11 +34,11 @@
#include "resource.h"
-#include "CEActions.h"
+#include "gui/Actions.h"
#include "CEActionsPocket.h"
#include "CEActionsSmartphone.h"
#include "ItemAction.h"
-#include "CEKeysDialog.h"
+#include "gui/KeysDialog.h"
#include "gui/message.h"
@@ -142,7 +142,7 @@ int SDL_main(int argc, char **argv) {
/* Avoid print problems - this file will be put in RAM anyway */
stdout_file = fopen("\\scummvm_stdout.txt", "w");
stderr_file = fopen("\\scummvm_stderr.txt", "w");
- CEActions::init(_gameDetector);
+ GUI::Actions::init(_gameDetector);
__try {
return scummvm_main(_gameDetector, argc, argv);
@@ -222,8 +222,8 @@ OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(),
}
create_toolbar();
// Initialize global key mapping for Smartphones
- CEActions::Instance()->initInstanceMain(this);
- CEActions::Instance()->loadMapping();
+ GUI_Actions::Instance()->initInstanceMain(this);
+ GUI_Actions::Instance()->loadMapping();
if (_isSmartphone) {
loadSmartphoneConfiguration();
@@ -641,15 +641,15 @@ bool OSystem_WINCE3::setSoundCallback(SoundProc proc, void *param) {
void OSystem_WINCE3::check_mappings() {
CEActionsPocket *instance;
- if (!_gameDetector._targetName.size() || CEActions::Instance()->initialized())
+ if (!_gameDetector._targetName.size() || GUI_Actions::Instance()->initialized())
return;
- CEActions::Instance()->initInstanceGame();
- instance = (CEActionsPocket*)CEActions::Instance();
+ GUI_Actions::Instance()->initInstanceGame();
+ instance = (CEActionsPocket*)GUI_Actions::Instance();
// Some games need to map the right click button, signal it here if it wasn't done
if (instance->needsRightClickMapping()) {
- CEKeysDialog *keysDialog = new CEKeysDialog("Map right click action");
+ GUI::KeysDialog *keysDialog = new GUI::KeysDialog("Map right click action");
while (!instance->getMapping(POCKET_ACTION_RIGHTCLICK)) {
keysDialog->runModal();
if (!instance->getMapping(POCKET_ACTION_RIGHTCLICK)) {
@@ -662,7 +662,7 @@ void OSystem_WINCE3::check_mappings() {
// Map the "hide toolbar" action if needed
if (instance->needsHideToolbarMapping()) {
- CEKeysDialog *keysDialog = new CEKeysDialog("Map hide toolbar action");
+ GUI::KeysDialog *keysDialog = new GUI::KeysDialog("Map hide toolbar action");
while (!instance->getMapping(POCKET_ACTION_HIDE)) {
keysDialog->runModal();
if (!instance->getMapping(POCKET_ACTION_HIDE)) {
@@ -675,17 +675,17 @@ void OSystem_WINCE3::check_mappings() {
// Map the "zoom" actions if needed
if (instance->needsZoomMapping()) {
- CEKeysDialog *keysDialog = new CEKeysDialog("Map Zoom Up action (optional)");
+ GUI::KeysDialog *keysDialog = new GUI::KeysDialog("Map Zoom Up action (optional)");
keysDialog->runModal();
delete keysDialog;
- keysDialog = new CEKeysDialog("Map Zoom Down action (optional)");
+ keysDialog = new GUI::KeysDialog("Map Zoom Down action (optional)");
keysDialog->runModal();
delete keysDialog;
}
// Extra warning for Zak Mc Kracken
if (strncmp(_gameDetector._targetName.c_str(), "zak", 3) == 0 &&
- !CEActions::Instance()->getMapping(POCKET_ACTION_HIDE)) {
+ !GUI_Actions::Instance()->getMapping(POCKET_ACTION_HIDE)) {
GUI::MessageDialog alert("Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory");
alert.runModal();
}
@@ -1389,7 +1389,7 @@ bool OSystem_WINCE3::saveScreenshot(const char *filename) {
static int mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode)
{
- if (CEActions::Instance()->mappingActive())
+ if (GUI::Actions::Instance()->mappingActive())
return key;
if (key >= SDLK_F1 && key <= SDLK_F9) {
@@ -1540,7 +1540,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
_keyRepeat = 0;
}
- if (!CEActions::Instance()->mappingActive() && CEActions::Instance()->performMapped(ev.key.keysym.sym, true))
+ if (!GUI_Actions::Instance()->mappingActive() && GUI_Actions::Instance()->performMapped(ev.key.keysym.sym, true))
return true;
}
@@ -1548,7 +1548,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
event.kbd.keycode = ev.key.keysym.sym;
event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
- if (CEActions::Instance()->mappingActive())
+ if (GUI_Actions::Instance()->mappingActive())
event.kbd.flags = 0xFF;
return true;
@@ -1561,7 +1561,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
_lastKeyPressed = 0;
}
- if (!CEActions::Instance()->mappingActive() && CEActions::Instance()->performMapped(ev.key.keysym.sym, false))
+ if (!GUI_Actions::Instance()->mappingActive() && GUI_Actions::Instance()->performMapped(ev.key.keysym.sym, false))
return true;
}
@@ -1569,7 +1569,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
event.kbd.keycode = ev.key.keysym.sym;
event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
- if (CEActions::Instance()->mappingActive())
+ if (GUI_Actions::Instance()->mappingActive())
event.kbd.flags = 0xFF;
return true;
@@ -1648,7 +1648,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
if (currentTime > _keyRepeatTime + _keyRepeatTrigger) {
_keyRepeatTime = currentTime;
_keyRepeat++;
- CEActions::Instance()->performMapped(_lastKeyPressed, true);
+ GUI_Actions::Instance()->performMapped(_lastKeyPressed, true);
}
}
}
diff --git a/base/main.cpp b/base/main.cpp
index d981dbc69e..30b7e6e49f 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -156,6 +156,10 @@ extern "C" int main(int argc, char *argv[]);
#include "allegro.h"
#endif
+#ifdef __SYMBIAN32__
+#include "gui/Actions.h"
+#endif
+
#if defined(UNIX)
#include <signal.h>
@@ -398,14 +402,20 @@ extern "C" int main(int argc, char *argv[]) {
// Load the plugins
PluginManager::instance().loadPlugins();
- // Ensure the system object exists (it may have already been created
- // at an earlier point, though!)
- OSystem &system = OSystem::instance();
-
// Parse the command line information
#ifndef _WIN32_WCE
GameDetector detector;
#endif
+
+#ifdef __SYMBIAN32__
+ // init keymap support here: we wanna move this somewhere else?
+ GUI::Actions::init(detector);
+#endif
+
+ // Ensure the system object exists (it may have already been created
+ // at an earlier point, though!)
+ OSystem &system = OSystem::instance();
+
detector.parseCommandLine(argc, argv);
#ifdef __PALM_OS__
diff --git a/common/scummsys.h b/common/scummsys.h
index a60025e0fc..f0cf21ae46 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -75,6 +75,7 @@
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
#define CDECL __cdecl
+ #define SMALL_SCREEN_DEVICE
#endif
@@ -303,6 +304,7 @@
#define SCUMM_NEED_ALIGNMENT
#define SCUMM_LITTLE_ENDIAN
#define CHECK_HEAP
+ #define SMALL_SCREEN_DEVICE
#define FORCEINLINE inline
#define _HEAPOK 0
diff --git a/gui/Actions.cpp b/gui/Actions.cpp
new file mode 100644
index 0000000000..58f96e7bbb
--- /dev/null
+++ b/gui/Actions.cpp
@@ -0,0 +1,169 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "gui/Actions.h"
+#include "gui/message.h"
+#include "scumm/scumm.h"
+#include "common/config-manager.h"
+
+#ifdef _WIN32_WCE
+ #include "backends/wince/CEActionsPocket.h"
+ #include "backends/wince/CEActionsSmartphone.h"
+#elif defined(__SYMBIAN32__)
+ #include "backends/epoc/SymbianActions.h"
+#endif
+
+namespace GUI {
+
+Actions* Actions::Instance() {
+ return _instance;
+}
+
+Actions::Actions(GameDetector &detector) :
+ _detector(&detector), _mapping_active(false), _initialized(false)
+{
+}
+
+
+Actions::~Actions() {
+}
+
+// call the correct object creator function according to the Factory Pattern
+void Actions::init(GameDetector &detector) {
+#ifdef _WIN32_WCE
+ // For WinCE: now use software + Factory pattern to create correct objects
+ if (!CEDevice::hasSmartphoneResolution())
+ CEActionsPocket::init(detector);
+ else
+ CEActionsSmartphone::init(detector);
+#elif defined(__SYMBIAN32__)
+ SymbianActions::init(detector);
+#endif
+}
+
+void Actions::initInstanceMain(OSystem *mainSystem) {
+ _mainSystem = mainSystem;
+}
+
+void Actions::initInstanceGame() {
+ _instance->_initialized = true;
+}
+
+
+bool Actions::initialized() {
+ return _initialized;
+}
+
+bool Actions::isActive(ActionType action) {
+ return false;
+}
+
+bool Actions::isEnabled(ActionType action) {
+ return _action_enabled[action];
+}
+
+void Actions::beginMapping(bool start) {
+ _mapping_active = start;
+}
+
+bool Actions::mappingActive() {
+ return _mapping_active;
+}
+
+bool Actions::performMapped(unsigned int keyCode, bool pushed) {
+ int i;
+
+ for (i=0; i<size(); i++) {
+ if (_action_mapping[i] == keyCode && _action_enabled[i])
+ return perform((ActionType)i, pushed);
+ }
+
+ return false;
+}
+
+bool Actions::loadMapping() {
+ const char *tempo;
+ int current_version;
+ int i;
+ current_version = ConfMan.getInt("action_mapping_version", domain());
+ if (current_version != version())
+ return false;
+ tempo = ConfMan.get("action_mapping", domain()).c_str();
+ if (tempo && strlen(tempo)) {
+ for (i=0; i<size(); i++) {
+ char x[7];
+ int j;
+ memset(x, 0, sizeof(x));
+ memcpy(x, tempo + 5 * i, 4);
+ sscanf(x, "%x", &j);
+ _action_mapping[i] = j;
+ }
+ return true;
+ }
+ else
+ return false;
+}
+
+bool Actions::saveMapping() {
+ char tempo[200];
+ int i;
+ tempo[0] = '\0';
+ ConfMan.set("action_mapping_version", version(), domain());
+ for (i=0; i<size(); i++) {
+ char x[10];
+ sprintf(x, "%.4x ", _action_mapping[i]);
+ strcat(tempo, x);
+ }
+ ConfMan.set("action_mapping", tempo, domain());
+ ConfMan.flushToDisk();
+ return true;
+}
+
+unsigned int Actions::getMapping(ActionType action) {
+ return _action_mapping[action];
+}
+
+
+void Actions::setMapping(ActionType action, unsigned int keyCode) {
+ int i;
+
+ for (i=0; i<size(); i++) {
+ if (_action_mapping[i] == keyCode)
+ _action_mapping[i] = 0;
+ }
+
+ _action_mapping[action] = keyCode;
+}
+
+Key& Actions::getKeyAction(ActionType action)
+{
+ return _key_action[action];
+}
+
+// Game detector
+GameDetector& Actions::gameDetector(){
+ return *_detector;
+}
+Actions *Actions::_instance = NULL;
+
+
+} // namespace GUI
diff --git a/gui/Actions.h b/gui/Actions.h
new file mode 100644
index 0000000000..235312fe2c
--- /dev/null
+++ b/gui/Actions.h
@@ -0,0 +1,84 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef ACTIONS_H
+#define ACTIONS_H
+
+#include "common/stdafx.h"
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "base/gameDetector.h"
+#include "gui/Key.h"
+namespace GUI {
+
+#define MAX_ACTIONS 20
+
+typedef int ActionType;
+
+class Actions {
+
+public:
+ static Actions* Instance();
+ static void init(GameDetector &detector);
+ virtual void initInstanceMain(OSystem *mainSystem);
+ virtual void initInstanceGame();
+ bool initialized();
+
+ // Actions
+ virtual bool perform(ActionType action, bool pushed = true) = 0;
+ bool isActive(ActionType action);
+ bool isEnabled(ActionType action);
+ virtual Common::String actionName(ActionType action) = 0;
+ virtual int size() = 0;
+
+ // Mapping
+ void beginMapping(bool start);
+ bool mappingActive();
+ bool performMapped(unsigned int keyCode, bool pushed);
+ bool loadMapping();
+ bool saveMapping();
+ unsigned int getMapping(ActionType action);
+ void setMapping(ActionType action, unsigned int keyCode);
+ Key& getKeyAction(ActionType action);
+
+ // Action domain
+ virtual Common::String domain() = 0;
+ virtual int version() = 0;
+
+ virtual ~Actions();
+
+ // Game detector
+ GameDetector& gameDetector();
+protected:
+ Actions(GameDetector &detector);
+ static Actions* _instance;
+ OSystem *_mainSystem;
+ GameDetector *_detector;
+ Key _key_action[MAX_ACTIONS + 1];
+ bool _action_enabled[MAX_ACTIONS + 1];
+ unsigned int _action_mapping[MAX_ACTIONS + 1];
+ bool _mapping_active;
+ bool _initialized;
+};
+
+} // namespace GUI
+typedef GUI::Actions GUI_Actions;
+#endif
diff --git a/backends/wince/CEkeys/Key.cpp b/gui/Key.cpp
index 1cf9f0eaa2..46d6096e7a 100644
--- a/backends/wince/CEkeys/Key.cpp
+++ b/gui/Key.cpp
@@ -19,41 +19,43 @@
*
*/
-#include "common/stdafx.h"
-#include "Key.h"
+#include "stdafx.h"
+#include "gui/Key.h"
-namespace CEKEYS {
- Key::Key() :
- _ascii(0), _keycode(0), _flags(0) {
- }
+namespace GUI {
- Key::Key(int ascii, int keycode, int flags) :
- _ascii(ascii), _keycode(keycode), _flags(flags) {
- }
+Key::Key() :
+_ascii(0), _keycode(0), _flags(0) {
+}
- int Key::ascii() {
- return _ascii;
- }
+Key::Key(int ascii, int keycode, int flags) :
+_ascii(ascii), _keycode(keycode), _flags(flags) {
+}
- int Key::keycode() {
- return _keycode;
- }
+int Key::ascii() {
+ return _ascii;
+}
- int Key::flags() {
- return _flags;
- }
+int Key::keycode() {
+ return _keycode;
+}
+int Key::flags() {
+ return _flags;
+}
- void Key::setAscii(int ascii) {
- _ascii = ascii;
- _keycode = ascii; // default
- }
- void Key::setKeycode(int keycode) {
- _keycode = keycode;
- }
+void Key::setAscii(int ascii) {
+ _ascii = ascii;
+ _keycode = ascii; // default
+}
+
+void Key::setKeycode(int keycode) {
+ _keycode = keycode;
+}
- void Key::setFlags(int flags) {
- _flags = flags;
- }
+void Key::setFlags(int flags) {
+ _flags = flags;
}
+
+} // namespace GUI
diff --git a/backends/wince/CEkeys/Key.h b/gui/Key.h
index 0901f32444..da91d977f7 100644
--- a/backends/wince/CEkeys/Key.h
+++ b/gui/Key.h
@@ -19,30 +19,31 @@
*
*/
-#ifndef CEKEYS_KEY
-#define CEKEYS_KEY
+#ifndef KEY_H
+#define KEY_H
#include "common/stdafx.h"
#include "common/scummsys.h"
#include "common/system.h"
-namespace CEKEYS {
-
- class Key {
- public:
- Key(int ascii, int keycode = 0, int flags = 0);
- Key();
- void setAscii(int ascii);
- void setKeycode(int keycode);
- void setFlags(int flags);
- int ascii();
- int keycode();
- int flags();
- private:
- int _ascii;
- int _keycode;
- int _flags;
- };
-}
-
-#endif \ No newline at end of file
+namespace GUI {
+
+class Key {
+public:
+ Key(int ascii, int keycode = 0, int flags = 0);
+ Key();
+ void setAscii(int ascii);
+ void setKeycode(int keycode);
+ void setFlags(int flags);
+ int ascii();
+ int keycode();
+ int flags();
+private:
+ int _ascii;
+ int _keycode;
+ int _flags;
+};
+
+} // namespace GUI
+
+#endif
diff --git a/gui/KeysDialog.cpp b/gui/KeysDialog.cpp
new file mode 100644
index 0000000000..04e6d26f6b
--- /dev/null
+++ b/gui/KeysDialog.cpp
@@ -0,0 +1,174 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "gui/KeysDialog.h"
+#include "gui/Actions.h"
+#include <sdl_keyboard.h>
+
+#ifdef _WIN32_WCE
+#include "CEDevice.h"
+#endif
+
+namespace GUI {
+
+/*
+using GUI::ListWidget;
+using GUI::kListNumberingZero;
+using GUI::WIDGET_CLEARBG;
+using GUI::kListSelectionChangedCmd;
+using GUI::kCloseCmd;
+using GUI::StaticTextWidget;
+using GUI::kTextAlignCenter;
+using GUI::CommandSender;
+*/
+
+enum {
+ kMapCmd = 'map ',
+ kOKCmd = 'ok '
+};
+
+KeysDialog::KeysDialog(const Common::String &title)
+ : GUI::Dialog(30, 20, 260, 160) {
+
+ GUI::WidgetSize ws = GUI::kNormalWidgetSize;
+
+//tmp
+// addButton(this, _w - (buttonWidth + 10), _h - buttonHeight - 8, "Choose", kChooseCmd, 0, ws);
+//tmp
+ addButton(this, 160, 20, "Map", kMapCmd, 0, ws); // Map
+ addButton(this, 160, 40, "OK", kOKCmd, 0, ws); // OK
+ addButton(this, 160, 60, "Cancel", kCloseCmd, 0, ws); // Cancel
+
+ _actionsList = new ListWidget(this, 10, 20, 140, 90);
+ _actionsList->setNumberingMode(kListNumberingZero);
+
+ _actionTitle = new StaticTextWidget(this, 10, 120, 240, 16, title, kTextAlignCenter);
+ _keyMapping = new StaticTextWidget(this, 10, 140, 240, 16, "", kTextAlignCenter);
+
+ _actionTitle->setFlags(WIDGET_CLEARBG);
+ _keyMapping->setFlags(WIDGET_CLEARBG);
+
+ // Get actions names
+ Common::StringList l;
+
+ for (int i = 0; i < Actions::Instance()->size(); i++)
+ l.push_back(Actions::Instance()->actionName((ActionType)i));
+
+ _actionsList->setList(l);
+
+ _actionSelected = -1;
+ Actions::Instance()->beginMapping(false);
+}
+
+void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ switch(cmd) {
+
+ case kListSelectionChangedCmd:
+ if (_actionsList->getSelected() >= 0) {
+ char selection[100];
+#ifdef __SYMBIAN32__
+ uint16 key = Actions::Instance()->getMapping(_actionsList->getSelected());
+ if(key != 0)
+ sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey)key));
+ else
+ sprintf(selection, "Associated key : none");
+#else
+ sprintf(selection, "Associated key : %s", CEDevice::getKeyName(Actions::Instance()->getMapping((ActionType)(_actionsList->getSelected()))).c_str());
+#endif
+ _keyMapping->setLabel(selection);
+ _keyMapping->draw();
+ }
+ break;
+ case kMapCmd:
+ if (_actionsList->getSelected() < 0) {
+ _actionTitle->setLabel("Please select an action");
+ }
+ else {
+ char selection[100];
+
+ _actionSelected = _actionsList->getSelected();
+#ifdef __SYMBIAN32__
+ uint16 key = Actions::Instance()->getMapping(_actionSelected);
+ if(key != 0)
+ sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey)key));
+ else
+ sprintf(selection, "Associated key : none");
+#else
+ sprintf(selection, "Associated key : %s", CEDevice::getKeyName(Actions::Instance()->getMapping((ActionType)_actionSelected)).c_str());
+#endif
+ _actionTitle->setLabel("Press the key to associate");
+ _keyMapping->setLabel(selection);
+ _keyMapping->draw();
+ Actions::Instance()->beginMapping(true);
+ _actionsList->setEnabled(false);
+ }
+ _actionTitle->draw();
+ break;
+ case kOKCmd:
+ Actions::Instance()->saveMapping();
+ close();
+ break;
+ case kCloseCmd:
+ Actions::Instance()->loadMapping();
+ close();
+ break;
+ }
+}
+
+void KeysDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers){
+ if (!Actions::Instance()->mappingActive()) {
+ Dialog::handleKeyDown(ascii,keycode,modifiers);
+ }
+}
+
+void KeysDialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
+#ifdef __SYMBIAN32__
+ if (Actions::Instance()->mappingActive()) {
+#else
+ // GAPI key was selected
+ if (modifiers == 0xff && Actions::Instance()->mappingActive()) {
+#endif
+ char selection[100];
+
+ Actions::Instance()->setMapping((ActionType)_actionSelected, ascii);
+#ifdef __SYMBIAN32__
+ if(ascii != 0)
+ sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey)ascii));
+ else
+ sprintf(selection, "Associated key : none");
+#else
+ sprintf(selection, "Associated key : %s", CEDevice::getKeyName(Actions::Instance()->getMapping((ActionType)_actionSelected)).c_str());
+#endif
+ _actionTitle->setLabel("Choose an action to map");
+ _keyMapping->setLabel(selection);
+ _keyMapping->draw();
+ _actionTitle->draw();
+ _actionSelected = -1;
+ _actionsList->setEnabled(true);
+ Actions::Instance()->beginMapping(false);
+ }
+ else {
+ Dialog::handleKeyUp(ascii,keycode,modifiers);
+ }
+}
+
+} // namespace GUI
diff --git a/gui/KeysDialog.h b/gui/KeysDialog.h
new file mode 100644
index 0000000000..b66ea4f1ed
--- /dev/null
+++ b/gui/KeysDialog.h
@@ -0,0 +1,50 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2005 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef KEYSDIALOG_H
+#define KEYSDIALOG_H
+
+#include "gui/newgui.h"
+#include "gui/dialog.h"
+#include "gui/ListWidget.h"
+#include "common/str.h"
+
+namespace GUI {
+
+class KeysDialog : public GUI::Dialog {
+public:
+ KeysDialog(const Common::String &title = "Choose an action to map");
+
+ virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
+ virtual void handleKeyUp(uint16 ascii, int keycode, int modifiers);
+ virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+
+protected:
+
+ GUI::ListWidget *_actionsList;
+ GUI::StaticTextWidget *_actionTitle;
+ GUI::StaticTextWidget *_keyMapping;
+ int _actionSelected;
+};
+
+} // namespace GUI
+
+#endif
diff --git a/gui/options.cpp b/gui/options.cpp
index c800e3921a..72372e881c 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -64,7 +64,7 @@ enum {
kChooseExtraDirCmd = 'chex'
};
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
enum {
kChooseKeyMappingCmd = 'chma'
};
@@ -122,7 +122,7 @@ void OptionsDialog::open() {
_renderModePopUp->setSelected(sel);
}
-#ifndef _WIN32_WCE
+#ifndef SMALL_SCREEN_DEVICE
// Fullscreen setting
_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain));
@@ -274,7 +274,7 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) {
_gfxPopUp->setEnabled(enabled);
_renderModePopUp->setEnabled(enabled);
-#ifndef _WIN32_WCE
+#ifndef SMALL_SCREEN_DEVICE
_fullscreenCheckbox->setEnabled(enabled);
_aspectCheckbox->setEnabled(enabled);
#endif
@@ -350,7 +350,7 @@ int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset, WidgetSize w
_aspectCheckbox = addCheckbox(boss, x, yoffset, "Aspect ratio correction", 0, 0, ws);
yoffset += _aspectCheckbox->getHeight();
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
_fullscreenCheckbox->setState(TRUE);
_fullscreenCheckbox->setEnabled(FALSE);
_aspectCheckbox->setEnabled(FALSE);
@@ -556,7 +556,7 @@ GlobalOptionsDialog::GlobalOptionsDialog()
yoffset += buttonHeight + 4;
#endif
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
addButton(tab, 5, yoffset, "Keys", kChooseKeyMappingCmd, 0, ws);
yoffset += buttonHeight + 4;
#endif
@@ -575,8 +575,8 @@ GlobalOptionsDialog::GlobalOptionsDialog()
_dirBrowser = new BrowserDialog("Select directory for savegames", true);
_fileBrowser = new BrowserDialog("Select SoundFont", false);
-#ifdef _WIN32_WCE
- _keysDialog = new CEKeysDialog();
+#ifdef SMALL_SCREEN_DEVICE
+ _keysDialog = new KeysDialog();
#endif
}
@@ -584,7 +584,7 @@ GlobalOptionsDialog::~GlobalOptionsDialog() {
delete _dirBrowser;
delete _fileBrowser;
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
delete _keysDialog;
#endif
}
@@ -664,7 +664,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
draw();
}
break;
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
case kChooseKeyMappingCmd:
_keysDialog->runModal();
break;
diff --git a/gui/options.h b/gui/options.h
index 107c903c2f..9a35fe8d12 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -24,8 +24,8 @@
#include "gui/dialog.h"
#include "common/str.h"
-#ifdef _WIN32_WCE
-#include "backends/wince/CEKeysDialog.h"
+#ifdef SMALL_SCREEN_DEVICE
+#include "gui/KeysDialog.h"
#endif
namespace GUI {
@@ -120,8 +120,8 @@ public:
protected:
BrowserDialog *_dirBrowser;
BrowserDialog *_fileBrowser;
-#ifdef _WIN32_WCE
- CEKeysDialog *_keysDialog;
+#ifdef SMALL_SCREEN_DEVICE
+ KeysDialog *_keysDialog;
#endif
StaticTextWidget *_savePath;
StaticTextWidget *_extraPath;
diff --git a/saga/actor.h b/saga/actor.h
index bbc6965501..39b14ff10d 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -336,6 +336,7 @@ public:
int32 walkFrameSequence;
void saveState(Common::OutSaveFile *out) {
+ int i = 0;
CommonObjectData::saveState(out);
out->writeUint16LE(actorFlags);
out->writeSint32LE(currentAction);
@@ -357,12 +358,12 @@ public:
out->writeSint32LE(frameNumber);
out->writeSint32LE(tileDirectionsAlloced);
- for (int i = 0; i < tileDirectionsAlloced; i++) {
+ for (i = 0; i < tileDirectionsAlloced; i++) {
out->writeByte(tileDirections[i]);
}
out->writeSint32LE(walkStepsAlloced);
- for (int i = 0; i < walkStepsAlloced; i++) {
+ for (i = 0; i < walkStepsAlloced; i++) {
out->writeSint16LE(walkStepsPoints[i].x);
out->writeSint16LE(walkStepsPoints[i].y);
}
@@ -375,6 +376,7 @@ public:
}
void loadState(Common::InSaveFile *in) {
+ int i = 0;
CommonObjectData::loadState(in);
actorFlags = in->readUint16LE();
currentAction = in->readSint32LE();
@@ -407,12 +409,12 @@ public:
setTileDirectionsSize(in->readSint32LE(), true);
- for (int i = 0; i < tileDirectionsAlloced; i++) {
+ for (i = 0; i < tileDirectionsAlloced; i++) {
tileDirections[i] = in->readByte();
}
setWalkStepsPointsSize(in->readSint32LE(), true);
- for (int i = 0; i < walkStepsAlloced; i++) {
+ for (i = 0; i < walkStepsAlloced; i++) {
walkStepsPoints[i].x = in->readSint16LE();
walkStepsPoints[i].y = in->readSint16LE();
}
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index aeef1ec376..9125e5324b 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -43,8 +43,8 @@
#include "scumm/help.h"
#endif
-#ifdef _WIN32_WCE
-#include "backends/wince/CEKeysDialog.h"
+#ifdef SMALL_SCREEN_DEVICE
+#include "KeysDialog.h"
#endif
using GUI::CommandSender;
@@ -590,7 +590,7 @@ ConfigDialog::ConfigDialog(ScummEngine *scumm)
addButton(this, _w - (buttonWidth + 4) - 4, yoffset, "OK", GUI::OptionsDialog::kOKCmd, 'O', ws);
addButton(this, _w - 2 * (buttonWidth + 4) - 4, yoffset, "Cancel", kCloseCmd, 'C', ws);
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
addButton(this, _w - 3 * (buttonWidth + 4) - 4, yoffset, "Keys", kKeysCmd, 'K', ws);
#endif
@@ -601,17 +601,17 @@ ConfigDialog::ConfigDialog(ScummEngine *scumm)
_x = (screenW - _w) / 2;
_y = (screenH - _h) / 2;
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
//
// Create the sub dialog(s)
//
- _keysDialog = new CEKeysDialog();
+ _keysDialog = new GUI::KeysDialog();
#endif
}
ConfigDialog::~ConfigDialog() {
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
delete _keysDialog;
#endif
}
@@ -647,7 +647,7 @@ void ConfigDialog::close() {
void ConfigDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kKeysCmd:
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
_keysDialog->runModal();
#endif
break;
diff --git a/scumm/dialogs.h b/scumm/dialogs.h
index c390fa9abe..2a16a748cf 100644
--- a/scumm/dialogs.h
+++ b/scumm/dialogs.h
@@ -113,7 +113,7 @@ protected:
class ConfigDialog : public GUI::OptionsDialog {
protected:
ScummEngine *_vm;
-#ifdef _WIN32_WCE
+#ifdef SMALL_SCREEN_DEVICE
GUI::Dialog *_keysDialog;
#endif
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 6079b9ab61..0c632b172f 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -41,6 +41,9 @@
#include "simon/simon-md5.h"
#include "sound/mididrv.h"
+#ifdef _WIN32_WCE
+extern bool isSmartphone(void);
+#endif
#ifdef __PALM_OS__
#include "globals.h"
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 151daa1c1e..29bc9e5c69 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -56,7 +56,7 @@
extern bool toolbar_drawn;
extern bool draw_keyboard;
-
+extern bool isSmartphone(void);
#endif
/*