[Scummvm-cvs-logs] CVS: scummvm/backends/wince CEActions.cpp,1.5,1.6 CEActions.h,1.3,1.4 CEActionsPocket.cpp,1.2,1.3 CEActionsPocket.h,1.1,1.2 CEActionsSmartphone.cpp,1.1,1.2 CEActionsSmartphone.h,1.1,1.2 CEDevice.cpp,1.5,1.6 CEDevice.h,1.2,1.3 CEScaler.cpp,1.6,1.7 CEScaler.h,1.3,1.4
Nicolas Bacca
arisme at users.sourceforge.net
Mon Dec 20 15:53:00 CET 2004
Update of /cvsroot/scummvm/scummvm/backends/wince
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31035
Modified Files:
CEActions.cpp CEActions.h CEActionsPocket.cpp
CEActionsPocket.h CEActionsSmartphone.cpp
CEActionsSmartphone.h CEDevice.cpp CEDevice.h CEScaler.cpp
CEScaler.h
Log Message:
Re-add Smartphone support (sorry for the year lag :p)
Index: CEActions.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActions.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CEActions.cpp 9 May 2004 14:57:04 -0000 1.5
+++ CEActions.cpp 20 Dec 2004 23:52:16 -0000 1.6
@@ -47,17 +47,21 @@
void CEActions::init(GameDetector &detector) {
if (!CEDevice::hasSmartphoneResolution())
CEActionsPocket::init(detector);
-#ifdef WIN32_PLATFORM_WFSP
+//#ifdef WIN32_PLATFORM_WFSP
else
CEActionsSmartphone::init(detector);
-#endif
+//#endif
}
-void CEActions::initInstance(OSystem_WINCE3 *mainSystem) {
+void CEActions::initInstanceMain(OSystem_WINCE3 *mainSystem) {
_mainSystem = mainSystem;
+}
+
+void CEActions::initInstanceGame() {
_instance->_initialized = true;
}
+
bool CEActions::initialized() {
return _initialized;
}
@@ -82,7 +86,7 @@
int i;
for (i=0; i<size(); i++) {
- if (_action_mapping[i] == keyCode)
+ if (_action_mapping[i] == keyCode && _action_enabled[i])
return perform((ActionType)i, pushed);
}
Index: CEActions.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActions.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CEActions.h 9 May 2004 14:57:04 -0000 1.3
+++ CEActions.h 20 Dec 2004 23:52:16 -0000 1.4
@@ -41,7 +41,8 @@
public:
static CEActions* Instance();
static void init(GameDetector &detector);
- virtual void initInstance(OSystem_WINCE3 *mainSystem);
+ virtual void initInstanceMain(OSystem_WINCE3 *mainSystem);
+ virtual void initInstanceGame();
bool initialized();
// Actions
Index: CEActionsPocket.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActionsPocket.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CEActionsPocket.cpp 11 Aug 2004 21:49:56 -0000 1.2
+++ CEActionsPocket.cpp 20 Dec 2004 23:52:16 -0000 1.3
@@ -82,7 +82,12 @@
}
-void CEActionsPocket::initInstance(OSystem_WINCE3 *mainSystem) {
+void CEActionsPocket::initInstanceMain(OSystem_WINCE3 *mainSystem) {
+ // Nothing generic to do for Pocket PC
+ CEActions::initInstanceMain(mainSystem);
+}
+
+void CEActionsPocket::initInstanceGame() {
bool is_simon = (strncmp(_detector->_targetName.c_str(), "simon", 5) == 0);
bool is_sword1 = (_detector->_targetName == "sword1");
bool is_sword2 = (strcmp(_detector->_targetName.c_str(), "sword2") == 0);
@@ -90,7 +95,7 @@
bool is_sky = (_detector->_targetName == "sky");
bool is_comi = (strncmp(_detector->_targetName.c_str(), "comi", 4) == 0);
- CEActions::initInstance(mainSystem);
+ CEActions::initInstanceGame();
// See if a right click mapping could be needed
if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi ||
Index: CEActionsPocket.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActionsPocket.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CEActionsPocket.h 9 May 2004 14:57:04 -0000 1.1
+++ CEActionsPocket.h 20 Dec 2004 23:52:16 -0000 1.2
@@ -58,8 +58,10 @@
bool perform(ActionType action, bool pushed = true);
String actionName(ActionType action);
int size();
+
static void init(GameDetector &detector);
- void initInstance(OSystem_WINCE3 *mainSystem);
+ void initInstanceMain(OSystem_WINCE3 *mainSystem);
+ void initInstanceGame();
// Action domain
String domain();
Index: CEActionsSmartphone.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActionsSmartphone.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CEActionsSmartphone.cpp 9 May 2004 14:57:04 -0000 1.1
+++ CEActionsSmartphone.cpp 20 Dec 2004 23:52:16 -0000 1.2
@@ -19,12 +19,13 @@
*
*/
+//#define SIMU_SMARTPHONE 1
-#ifdef WIN32_PLATFORM_WFSP
+//#ifdef WIN32_PLATFORM_WFSP
#include "stdafx.h"
-#include "CEActionsPocket.h"
-#include "KeysBuffer.h"
+#include "CEActionsSmartphone.h"
+#include "EventsBuffer.h"
#include "gui/message.h"
@@ -44,6 +45,12 @@
"Zone"
};
+#ifdef SIMU_SMARTPHONE
+const int ACTIONS_SMARTPHONE_DEFAULT[] = { 0x111, 0x112, 0x114, 0x113, 0x11a, 0x11b, VK_LWIN, VK_ESCAPE, VK_F8 };
+#else
+const int ACTIONS_SMARTPHONE_DEFAULT[] = { '4', '6', '8', '2', 0x11a, 0x11b, '0', VK_ESCAPE, VK_F10 };
+#endif
+
void CEActionsSmartphone::init(GameDetector &detector) {
_instance = new CEActionsSmartphone(detector);
}
@@ -71,25 +78,15 @@
int i;
for (i=0; i<SMARTPHONE_ACTION_LAST; i++) {
- _action_mapping[i] = 0;
+ _action_mapping[i] = ACTIONS_SMARTPHONE_DEFAULT[i];
_action_enabled[i] = false;
}
}
-void CEActionsSmartphone::initInstance(OSystem_WINCE3 *mainSystem) {
-{
- int i;
- bool is_simon = (strncmp(_detector->_targetName.c_str(), "simon", 5) == 0);
- bool is_sky = (_detector->_targetName == "sky");
-
- CEActions::initInstance(mainSystem);
-
- // See if a right click mapping could be needed
- if (is_sky || _detector->_targetName == "samnmax")
- _right_click_needed = true;
-
- // Initialize keys for different actions
+void CEActionsSmartphone::initInstanceMain(OSystem_WINCE3 *mainSystem) {
+ CEActions::initInstanceMain(mainSystem);
+
// Mouse Up
_action_enabled[SMARTPHONE_ACTION_UP] = true;
// Mouse Down
@@ -101,7 +98,21 @@
// Left Click
_action_enabled[SMARTPHONE_ACTION_LEFTCLICK] = true;
// Right Click
- _action_enabled[ACTION_RIGHTCLICK] = true;
+ _action_enabled[SMARTPHONE_ACTION_RIGHTCLICK] = true;
+}
+
+void CEActionsSmartphone::initInstanceGame() {
+ bool is_simon = (strncmp(_detector->_targetName.c_str(), "simon", 5) == 0);
+ bool is_sky = (_detector->_targetName == "sky");
+ bool is_queen = (_detector->_targetName == "queen");
+
+ CEActions::initInstanceGame();
+
+ // See if a right click mapping could be needed
+ if (is_sky || _detector->_targetName == "samnmax")
+ _right_click_needed = true;
+
+ // Initialize keys for different actions
// Save
if (is_simon)
_action_enabled[SMARTPHONE_ACTION_SAVE] = false;
@@ -133,10 +144,9 @@
CEActionsSmartphone::~CEActionsSmartphone() {
}
-bool CEActionsSmartphone::perform(ActionType action, bool pushed = true) {
+bool CEActionsSmartphone::perform(ActionType action, bool pushed) {
if (!pushed) {
- _mainSystem->clear_key_repeat();
- return true;
+ return false;
}
switch (action) {
@@ -170,4 +180,4 @@
return false;
}
-#endif
+//#endif
Index: CEActionsSmartphone.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActionsSmartphone.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CEActionsSmartphone.h 9 May 2004 14:57:04 -0000 1.1
+++ CEActionsSmartphone.h 20 Dec 2004 23:52:16 -0000 1.2
@@ -22,7 +22,7 @@
#ifndef CEACTIONSSMARTPHONE
#define CEACTIONSSMARTPHONE
-#ifdef WIN32_PLATFORM_WFSP
+//#ifdef WIN32_PLATFORM_WFSP
#include "common/stdafx.h"
#include "common/scummsys.h"
@@ -59,7 +59,8 @@
String actionName(ActionType action);
int size();
static void init(GameDetector &detector);
- void initInstance(OSystem_WINCE3 *mainSystem);
+ void initInstanceMain(OSystem_WINCE3 *mainSystem);
+ void initInstanceGame();
// Action domain
String domain();
@@ -68,8 +69,9 @@
~CEActionsSmartphone();
private:
CEActionsSmartphone(GameDetector &detector);
+ bool _right_click_needed;
};
#endif
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
Index: CEDevice.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEDevice.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CEDevice.cpp 30 May 2004 13:24:51 -0000 1.5
+++ CEDevice.cpp 20 Dec 2004 23:52:16 -0000 1.6
@@ -31,7 +31,7 @@
#define KEY_INBOX 0xc3
#define KEY_TASK 0xc4
-#ifdef WIN32_PLATFORM_WFSP
+//#ifdef WIN32_PLATFORM_WFSP
const char* SMARTPHONE_KEYS_NAME[] = {
"1", "2", "3","4", "5", "6", "7", "8", "9", "*", "0", "#",
"Home", "Back", "Up", "Down", "Left", "Right", "Action", "Hang up", "Call",
@@ -39,32 +39,99 @@
0
};
+// Old mapping from the previous (non SDL) version. To be forgotten.
+/*
const int SMARTPHONE_KEYS_MAPPING[] = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', VK_F8, '0', VK_F9,
VK_LWIN, VK_ESCAPE, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT, VK_RETURN, VK_F4, VK_F3,
VK_F1, VK_F2, VK_F18, VK_F6, VK_F7, VK_F10, 0xff, 0
};
-#endif
+*/
+
+// FIXME : Home and Record are not mapped
+const int SMARTPHONE_KEYS_MAPPING[] = {
+ '1', '2', '3', '4', '5', '6', '7', '8', '9', VK_F9, '0', VK_F10,
+ 0xFF, VK_ESCAPE, 0x113, 0x114, 0x111, 0x112, VK_RETURN, 0x11D, 0x11C,
+ 0x11A, 0x11B, 0x11D, 0x11F, 0x120, 0xFF, 0
+};
+
+static void (WINAPI* _SHIdleTimerReset)(void) = NULL;
+static HANDLE (WINAPI* _SetPowerRequirement)(PVOID,int,ULONG,PVOID,ULONG) = NULL;
+static DWORD (WINAPI* _ReleasePowerRequirement)(HANDLE) = NULL;
+static HANDLE _hPowerManagement = NULL;
+static DWORD _lastTime = 0;
+#define TIMER_TRIGGER 9000
+
+//#endif
+
+// Power management code borrowed from MoDaCo & Betaplayer. Thanks !
+void CEDevice::init() {
+ HINSTANCE dll = LoadLibrary(TEXT("aygshell.dll"));
+ if (dll) {
+ *(FARPROC*)&_SHIdleTimerReset = GetProcAddress(dll, MAKEINTRESOURCE(2006));
+ }
+ dll = LoadLibrary(TEXT("coredll.dll"));
+ if (dll) {
+ *(FARPROC*)&_SetPowerRequirement = GetProcAddress(dll, TEXT("SetPowerRequirement"));
+ *(FARPROC*)&_ReleasePowerRequirement = GetProcAddress(dll, TEXT("ReleasePowerRequirement"));
+
+ }
+ if (_SetPowerRequirement)
+ _hPowerManagement = _SetPowerRequirement(TEXT("BKL1:"), 0, 1, NULL, 0);
+ _lastTime = GetTickCount();
+}
+
+void CEDevice::end() {
+ if (_ReleasePowerRequirement && _hPowerManagement) {
+ _ReleasePowerRequirement(_hPowerManagement);
+ }
+}
+
+void CEDevice::wakeUp() {
+ DWORD currentTime = GetTickCount();
+ if (currentTime > _lastTime + TIMER_TRIGGER) {
+ _lastTime = currentTime;
+ SystemIdleTimerReset();
+ if (_SHIdleTimerReset)
+ _SHIdleTimerReset();
+ }
+}
bool CEDevice::hasPocketPCResolution() {
+#ifdef SIMU_SMARTPHONE
+ return false;
+#else
if (OSystem_WINCE3::isOzone() && hasWideResolution())
return true;
return (OSystem_WINCE3::getScreenWidth() < 320 && OSystem_WINCE3::getScreenWidth() >= 240);
+#endif
}
bool CEDevice::hasDesktopResolution() {
+#ifdef SIMU_SMARTPHONE
+ return false;
+#else
if (OSystem_WINCE3::isOzone() && hasWideResolution())
return true;
return (OSystem_WINCE3::getScreenWidth() >= 320);
+#endif
}
bool CEDevice::hasWideResolution() {
+#ifdef SIMU_SMARTPHONE
+ return false;
+#else
return (OSystem_WINCE3::getScreenWidth() >= 640 || OSystem_WINCE3::getScreenHeight() >= 640);
+#endif
}
bool CEDevice::hasSmartphoneResolution() {
+#ifdef SIMU_SMARTPHONE
+ return true;
+#else
return (OSystem_WINCE3::getScreenWidth() < 240);
+#endif
}
Common::String CEDevice::getKeyName(unsigned int keyCode) {
@@ -90,7 +157,7 @@
if (keyCode == SDLK_F4)
return "F4 (hard 4)";
-#ifdef WIN32_PLATFORM_WFSP
+//#ifdef WIN32_PLATFORM_WFSP
if (hasSmartphoneResolution()) {
int i = 0;
while (SMARTPHONE_KEYS_MAPPING[i]) {
@@ -99,7 +166,7 @@
i++;
}
}
-#endif
+//#endif
sprintf(key_name, "Key %.4x", keyCode);
return key_name;
Index: CEDevice.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEDevice.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CEDevice.h 9 May 2004 14:53:05 -0000 1.2
+++ CEDevice.h 20 Dec 2004 23:52:16 -0000 1.3
@@ -31,15 +31,14 @@
class CEDevice {
public:
+ static void init();
+ static void end();
+ static void wakeUp();
static bool hasPocketPCResolution();
static bool hasDesktopResolution();
static bool hasWideResolution();
static bool hasSmartphoneResolution();
- static Common::String getKeyName(unsigned int keyCode);
- private:
- typedef int (*tGXVoidFunction)(void);
- typedef struct GXKeyList (*tGXGetDefaultKeys)(int);
-
+ static Common::String getKeyName(unsigned int keyCode);
};
#endif
Index: CEScaler.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEScaler.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CEScaler.cpp 9 May 2004 14:51:08 -0000 1.6
+++ CEScaler.cpp 20 Dec 2004 23:52:16 -0000 1.7
@@ -120,7 +120,7 @@
}
}
-#ifdef WIN32_PLATFORM_WFSP
+//#ifdef WIN32_PLATFORM_WFSP
void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
uint8 *work;
int i;
@@ -151,5 +151,5 @@
}
}
}
-#endif
+//#endif
Index: CEScaler.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEScaler.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CEScaler.h 9 May 2004 14:51:08 -0000 1.3
+++ CEScaler.h 20 Dec 2004 23:52:16 -0000 1.4
@@ -31,9 +31,9 @@
DECLARE_SCALER(PocketPCPortrait);
DECLARE_SCALER(PocketPCHalf);
DECLARE_SCALER(PocketPCHalfZoom);
-#ifdef WIN32_PLATFORM_WFSP
+//#ifdef WIN32_PLATFORM_WFSP
DECLARE_SCALER(SmartphoneLandscape);
-#endif
+//#endif
void initCEScaler(void);
More information about the Scummvm-git-logs
mailing list