diff options
author | Kostas Nakos | 2007-04-28 17:27:08 +0000 |
---|---|---|
committer | Kostas Nakos | 2007-04-28 17:27:08 +0000 |
commit | 59550346b4270c01a8870a3497df5cab17bcf2e0 (patch) | |
tree | 7faa4c62a9004e60f2df76e8c821a573374af345 /backends/platform/wince/CEDevice.cpp | |
parent | 1337ce8296d84496a2cabd5e58b86274bcb326a2 (diff) | |
download | scummvm-rg350-59550346b4270c01a8870a3497df5cab17bcf2e0.tar.gz scummvm-rg350-59550346b4270c01a8870a3497df5cab17bcf2e0.tar.bz2 scummvm-rg350-59550346b4270c01a8870a3497df5cab17bcf2e0.zip |
cleanup & completely map wm device's keys
svn-id: r26655
Diffstat (limited to 'backends/platform/wince/CEDevice.cpp')
-rw-r--r-- | backends/platform/wince/CEDevice.cpp | 158 |
1 files changed, 60 insertions, 98 deletions
diff --git a/backends/platform/wince/CEDevice.cpp b/backends/platform/wince/CEDevice.cpp index 495ba1b274..09c067ef15 100644 --- a/backends/platform/wince/CEDevice.cpp +++ b/backends/platform/wince/CEDevice.cpp @@ -1,5 +1,5 @@ /* ScummVM - Scumm Interpreter - * Copyright (C) 2001-2006 The ScummVM project + * Copyright (C) 2001-2007 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 @@ -20,9 +20,6 @@ * */ -//#define SIMU_SMARTPHONE 1 -//#define SIMU_SMARTPHONE_2005 1 - #include "common/stdafx.h" #include "CEDevice.h" @@ -30,35 +27,6 @@ #include "wince-sdl.h" -#define KEY_CALENDAR 0xc1 -#define KEY_CONTACTS 0xc2 -#define KEY_INBOX 0xc3 -#define KEY_TASK 0xc4 - -//#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", - "Soft 1", "Soft 2", "Power", "Volume Up" ,"Volume Down", "Record", "None", - 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 -}; -*/ - -// 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; @@ -72,8 +40,6 @@ extern "C" void WINAPI SystemIdleTimerReset(void); #define TIMER_TRIGGER 9000 -//#endif - // Power management code borrowed from MoDaCo & Betaplayer. Thanks ! void CEDevice::init() { HINSTANCE dll = LoadLibrary(TEXT("aygshell.dll")); @@ -108,96 +74,92 @@ void CEDevice::wakeUp() { } bool CEDevice::hasPocketPCResolution() { -#ifdef SIMU_SMARTPHONE -#ifndef SIMU_SMARTPHONE_2005 - return false; -#else - return true; -#endif -#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 -#ifndef SIMU_SMARTPHONE_2005 - return true; -#else - return false; -#endif -#else return (OSystem_WINCE3::getScreenWidth() < 240); -#endif } bool CEDevice::isSmartphone() { -#ifdef SIMU_SMARTPHONE - return true; -#else TCHAR platformType[100]; BOOL result = SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(platformType), platformType, 0); if (!result && GetLastError() == ERROR_ACCESS_DENIED) return true; return (_wcsnicmp(platformType, TEXT("SmartPhone"), 10) == 0); -#endif } Common::String CEDevice::getKeyName(unsigned int keyCode) { - char key_name[10]; - - if (!keyCode) - return "No key"; - - if (keyCode == KEY_CALENDAR) - return "Button Calendar"; - if (keyCode == KEY_CONTACTS) - return "Button Contacts"; - if (keyCode == KEY_INBOX) - return "Button Inbox"; - if (keyCode == KEY_TASK) - return "Button Tasks"; - if (keyCode == SDLK_F1) - return "F1 (hard 1)"; - if (keyCode == SDLK_F2) - return "F2 (hard 2)"; - if (keyCode == SDLK_F3) - return "F3 (hard 3)"; - if (keyCode == SDLK_F4) - return "F4 (hard 4)"; - -//#ifdef WIN32_PLATFORM_WFSP - if (hasSmartphoneResolution()) { - int i = 0; - while (SMARTPHONE_KEYS_MAPPING[i]) { - if (keyCode == SMARTPHONE_KEYS_MAPPING[i]) - return SMARTPHONE_KEYS_NAME[i]; - i++; - } + switch (keyCode) { + case SDLK_F1: + return "Softkey A"; + case SDLK_F2: + return "Softkey B"; + case SDLK_F3: + return "Talk"; + case SDLK_F4: + return "End"; + case SDLK_APP1: + return "Application 1"; + case SDLK_APP2: + return "Application 2"; + case SDLK_APP3: + return "Application 3"; + case SDLK_APP4: + return "Application 4"; + case SDLK_APP5: + return "Application 5"; + case SDLK_APP6: + return "Application 6"; + case SDLK_LSUPER: + return "Home"; + case SDLK_ESCAPE: + return "Back"; + case SDLK_UP: + return "Up"; + case SDLK_DOWN: + return "Down"; + case SDLK_LEFT: + return "Left"; + case SDLK_RIGHT: + return "Right"; + case SDLK_RETURN: + return "Action"; + case SDLK_F10: + return "Record"; + case SDLK_F6: + return "Volume Up"; + case SDLK_F7: + return "Volume Down"; + case SDLK_F17: + return "Flip"; + case SDLK_F18: + return "Power"; + case SDLK_F16: + return "Speaker"; + case SDLK_F8: + return "Star"; + case SDLK_F9: + return "Pound"; + case SDLK_F11: + return "Symbol"; + case SDLK_F19: + return "Red Key"; + case 0: + return "None"; + default: + return SDL_GetKeyName((SDLKey)keyCode); } -//#endif - - sprintf(key_name, "Key %.4x", keyCode); - return key_name; } - |