From 4c0057db7de5f9d434bdbba5b204c75cb8ee8407 Mon Sep 17 00:00:00 2001 From: Nicolas Bacca Date: Sun, 12 Oct 2003 13:51:05 +0000 Subject: New config-manager updates, misc updates svn-id: r10751 --- backends/wince/pocketpc.cpp | 16 +++++++-- backends/wince/smartphone.cpp | 78 +++++++++++++++++++++++++------------------ backends/wince/wince.h | 7 ++-- 3 files changed, 64 insertions(+), 37 deletions(-) (limited to 'backends') diff --git a/backends/wince/pocketpc.cpp b/backends/wince/pocketpc.cpp index e39fe2a384..8236979641 100644 --- a/backends/wince/pocketpc.cpp +++ b/backends/wince/pocketpc.cpp @@ -20,14 +20,17 @@ */ #include "wince.h" +#include "scumm/scumm.h" extern bool select_game; +extern bool _force_get_key_mapping; extern bool _get_key_mapping; extern bool draw_keyboard; extern bool hide_toolbar; extern bool freelook; extern bool is_simon; extern bool is_bass; +extern bool is_sword2; extern int num_of_dirty_square; extern bool toolbar_drawn; extern Engine *engine; @@ -69,6 +72,12 @@ BOOL PPCWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, OSystem_W GAPI_key = getGAPIKeyMapping((short)wParam); if (GAPI_key) { */ + if (_force_get_key_mapping) { + unsigned char selected_key = GAPIKeysTranslate((unsigned int)(wParam)) & 0xff; + clearActionKey(selected_key); + getAction(ACTION_RIGHTCLICK)->action_key = selected_key; + } + else if (_get_key_mapping) { wm->_event.kbd.flags = 0xff; wm->_event.kbd.ascii = GAPIKeysTranslate((unsigned int)(wParam)); @@ -91,6 +100,9 @@ BOOL PPCWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, OSystem_W break; case WM_KEYUP: + if (_force_get_key_mapping) + _force_get_key_mapping = false; + else if (_get_key_mapping) { _get_key_mapping = false; wm->_event.kbd.flags = 0xff; @@ -246,7 +258,7 @@ BOOL PPCWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, OSystem_W do_quit(); wm->_event.event_code = OSystem::EVENT_KEYDOWN; - if (is_simon || is_bass) { + if (is_simon || is_bass || is_sword2) { wm->_event.kbd.ascii = mapKey(VK_ESCAPE); wm->_event.kbd.keycode = mapKey(VK_ESCAPE); break; @@ -260,7 +272,7 @@ BOOL PPCWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, OSystem_W else wm->_event.kbd.ascii = mapKey(VK_ESCAPE); */ - wm->_event.kbd.ascii = KEY_ALL_SKIP; + wm->_event.kbd.ascii = Scumm::KEY_ALL_SKIP; break; case ToolbarSound: sound_activated = !sound_activated; diff --git a/backends/wince/smartphone.cpp b/backends/wince/smartphone.cpp index 55f08fff12..1fc620a1d6 100644 --- a/backends/wince/smartphone.cpp +++ b/backends/wince/smartphone.cpp @@ -30,7 +30,7 @@ #define IDM_SMARTFON_MAP_BASE 99200 -#define SCAN_LOCATION "\\Storage Card" +#define SCAN_LOCATION "" #define KEYS_VERSION 1 #define TOTAL_KEYS 10 @@ -71,8 +71,6 @@ HMENU keysMappingMenu; HWND _hWnd; HWND _hWndMenu; -extern Config *g_config; - int mouseX; int mouseY; int lastKeyPressed = 0; @@ -346,7 +344,7 @@ void SmartfonSkip(OSystem_WINCE3 *wm, int repeat) { else wm->_event.kbd.ascii = VK_ESCAPE; */ - wm->_event.kbd.ascii = KEY_ALL_SKIP; + wm->_event.kbd.ascii = Scumm::KEY_ALL_SKIP; } void SmartfonBoss(OSystem_WINCE3 *wm, int repeat) { @@ -354,8 +352,8 @@ void SmartfonBoss(OSystem_WINCE3 *wm, int repeat) { sound_activated = false; Cls(); - g_scumm->requestSave(0, "BOSS"); - g_scumm->scummLoop(0); + Scumm::g_scumm->requestSave(0, "BOSS"); + Scumm::g_scumm->scummLoop(0); dynamicGXCloseInput(); dynamicGXCloseDisplay(); SDL_AudioQuit(); @@ -461,36 +459,52 @@ BOOL saveKeyMapping() { char tempo[1024]; tempo[0] = '\0'; - g_config->setInt("KeysVersion", KEYS_VERSION, "smartfon"); + ConfMan.set("KeysVersion", KEYS_VERSION, "smartfon"); for (i=0; iset("ActionKeys", tempo, "smartfon"); - g_config->flush(); + ConfMan.set("ActionKeys", tempo, "smartfon"); + ConfMan.flushToDisk(); return TRUE; } void loadKeyRepeat() { - repeatY = g_config->getInt("repeatY", 4, "smartfon-keys"); - g_config->setInt("repeatY", repeatY, "smartfon-keys"); - stepY1 = g_config->getInt("stepY1", 2, "smartfon-keys"); - g_config->setInt("stepY1", stepY1, "smartfon-keys"); - stepY2 = g_config->getInt("stepY2", 10, "smartfon-keys"); - g_config->setInt("stepY2", stepY2, "smartfon-keys"); - stepY3 = g_config->getInt("stepY3", 20, "smartfon-keys"); - g_config->setInt("stepY3", stepY3, "smartfon-keys"); - repeatX = g_config->getInt("repeatX", 4, "smartfon-keys"); - g_config->setInt("repeatX", repeatX, "smartfon-keys"); - stepX1 = g_config->getInt("stepX1", 2, "smartfon-keys"); - g_config->setInt("stepX1", stepX1, "smartfon-keys"); - stepX2 = g_config->getInt("stepX2", 10, "smartfon-keys"); - g_config->setInt("stepX2", stepX2, "smartfon-keys"); - stepX3 = g_config->getInt("stepX3", 40, "smartfon-keys"); - g_config->setInt("stepX3", stepX3, "smartfon-keys"); - g_config->flush(); + repeatY = ConfMan.getInt("repeatY", "smartfon-keys"); + if (!repeatY) + repeatY = 4; + ConfMan.set("repeatY", repeatY, "smartfon-keys"); + stepY1 = ConfMan.getInt("stepY1", "smartfon-keys"); + if (!stepY1) + stepY1 = 2; + ConfMan.set("stepY1", stepY1, "smartfon-keys"); + stepY2 = ConfMan.getInt("stepY2", "smartfon-keys"); + if (!stepY2) + stepY2 = 10; + ConfMan.set("stepY2", stepY2, "smartfon-keys"); + stepY3 = ConfMan.getInt("stepY3", "smartfon-keys"); + if (!stepY3) + stepY3 = 20; + ConfMan.set("stepY3", stepY3, "smartfon-keys"); + repeatX = ConfMan.getInt("repeatX", "smartfon-keys"); + if (!repeatX) + repeatX = 4; + ConfMan.set("repeatX", repeatX, "smartfon-keys"); + stepX1 = ConfMan.getInt("stepX1", "smartfon-keys"); + if (!stepX1) + stepX1 = 2; + ConfMan.set("stepX1", stepX1, "smartfon-keys"); + stepX2 = ConfMan.getInt("stepX2", "smartfon-keys"); + if (!stepX2) + stepX2 = 10; + ConfMan.set("stepX2", stepX2, "smartfon-keys"); + stepX3 = ConfMan.getInt("stepX3", "smartfon-keys"); + if (!stepX3) + stepX3 = 40; + ConfMan.set("stepX3", stepX3, "smartfon-keys"); + ConfMan.flushToDisk(); } @@ -498,8 +512,8 @@ BOOL loadKeyMapping() { int version; const char *current; - version = g_config->getInt("KeysVersion", 0, "smartfon"); - current = g_config->get("ActionKeys", "smartfon"); + version = ConfMan.getInt("KeysVersion", "smartfon"); + current = ConfMan.get("ActionKeys", "smartfon").c_str(); if (current && version == KEYS_VERSION) { int i; for (i=0; igetBool("Sound", true, "wince")) + if (ConfMan.getBool("Sound", "wince") || ConfMan.get("Sound", "wince").c_str() == NULL) CheckMenuItem(optionsMenu, IDM_SMARTFON_SOUND, MF_BYCOMMAND | MF_CHECKED); else CheckMenuItem(optionsMenu, IDM_SMARTFON_SOUND, MF_BYCOMMAND | MF_UNCHECKED); @@ -745,14 +759,14 @@ BOOL SmartphoneWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, OS free(help); break; case IDM_SMARTFON_SOUND: - if (g_config->getBool("Sound", true, "wince")) { + if (ConfMan.getBool("Sound", "wince") || ConfMan.get("Sound", "wince").c_str() == NULL) { sound_activated = false; - g_config->setBool("Sound", false, "wince"); + ConfMan.set("Sound", false, "wince"); CheckMenuItem(optionsMenu, IDM_SMARTFON_SOUND, MF_BYCOMMAND | MF_UNCHECKED); } else { sound_activated = true; - g_config->setBool("Sound", true, "wince"); + ConfMan.set("Sound", true, "wince"); CheckMenuItem(optionsMenu, IDM_SMARTFON_SOUND, MF_BYCOMMAND | MF_CHECKED); } break; diff --git a/backends/wince/wince.h b/backends/wince/wince.h index d4cd0660da..d433842b86 100644 --- a/backends/wince/wince.h +++ b/backends/wince/wince.h @@ -38,15 +38,16 @@ #include #include "resource.h" -#include "scumm.h" +#include "scumm/scumm.h" //#include "debug.h" #include "screen.h" #include "gui/newgui.h" #include "sound/mididrv.h" #include "base/engine.h" +#include "common/timer.h" //#include "simon/simon.h" #include "gapi_keys.h" -#include "config-file.h" +#include "common/config-manager.h" #include "SDL.h" @@ -69,7 +70,7 @@ class OSystem_WINCE3; #include "pocketpc.h" #include "smartphone.h" -#define MAX_NUMBER_OF_DIRTY_SQUARES 10 +#define MAX_NUMBER_OF_DIRTY_SQUARES 32 class OSystem_WINCE3 : public OSystem { public: -- cgit v1.2.3