From 506456d0146fd83c16e117ad2d543bdb828223dd Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Tue, 6 Jun 2006 19:31:49 +0000 Subject: update the CE port to work under 0.9.0 codebase svn-id: r22956 --- backends/wince/CEActionsPocket.cpp | 8 +++---- backends/wince/CEActionsPocket.h | 2 +- backends/wince/CEActionsSmartphone.h | 4 ++-- backends/wince/CEKeysDialog.cpp | 12 +++++----- backends/wince/CELauncherDialog.cpp | 8 ++++--- backends/wince/CEScaler.cpp | 2 +- backends/wince/CEScaler.h | 4 ++-- backends/wince/CEgui/Panel.cpp | 8 +++---- backends/wince/CEgui/Panel.h | 7 +++--- backends/wince/CEgui/Toolbar.h | 2 +- backends/wince/CEgui/ToolbarHandler.cpp | 1 - backends/wince/CEgui/ToolbarHandler.h | 7 +++--- backends/wince/missing/assert.h | 3 ++- backends/wince/missing/missing.cpp | 5 +++++ backends/wince/ozone.h | 3 ++- backends/wince/portdefs.h | 4 +++- backends/wince/wince-sdl.cpp | 39 +++++++++++++++++++++++---------- backends/wince/wince-sdl.h | 6 +++-- 18 files changed, 78 insertions(+), 47 deletions(-) diff --git a/backends/wince/CEActionsPocket.cpp b/backends/wince/CEActionsPocket.cpp index 3c2b3e3e4d..b0103a8ab9 100644 --- a/backends/wince/CEActionsPocket.cpp +++ b/backends/wince/CEActionsPocket.cpp @@ -54,8 +54,8 @@ const String pocketActionNames[] = { "Bind Keys" }; -void CEActionsPocket::init(const Common::String &gameid) { - _instance = new CEActionsPocket(gameid); +void CEActionsPocket::init() { + _instance = new CEActionsPocket(ConfMan.get("gameid")); } @@ -68,7 +68,7 @@ int CEActionsPocket::size() { } String CEActionsPocket::domain() { - return "pocketpc"; + return "scummvm"; } int CEActionsPocket::version() { @@ -76,7 +76,7 @@ int CEActionsPocket::version() { } CEActionsPocket::CEActionsPocket(const Common::String &gameid) : -GUI::Actions(gameid) +GUI::Actions() { int i; diff --git a/backends/wince/CEActionsPocket.h b/backends/wince/CEActionsPocket.h index 3288dfbdf4..37c0f8b9f9 100644 --- a/backends/wince/CEActionsPocket.h +++ b/backends/wince/CEActionsPocket.h @@ -61,7 +61,7 @@ class CEActionsPocket : public GUI::Actions { String actionName(GUI::ActionType action); int size(); - static void init(const Common::String &gameid); + static void init(); void initInstanceMain(OSystem *mainSystem); void initInstanceGame(); diff --git a/backends/wince/CEActionsSmartphone.h b/backends/wince/CEActionsSmartphone.h index d408398e29..9549297d84 100644 --- a/backends/wince/CEActionsSmartphone.h +++ b/backends/wince/CEActionsSmartphone.h @@ -60,7 +60,7 @@ class CEActionsSmartphone : public GUI::Actions { bool perform(GUI::ActionType action, bool pushed = true); String actionName(GUI::ActionType action); int size(); - static void init(const Common::String &gameid); + static void init(); void initInstanceMain(OSystem *mainSystem); void initInstanceGame(); @@ -70,7 +70,7 @@ class CEActionsSmartphone : public GUI::Actions { ~CEActionsSmartphone(); private: - CEActionsSmartphone(const Common::String &gameid); + CEActionsSmartphone(); bool _right_click_needed; OSystem_WINCE3 *_CESystem; }; diff --git a/backends/wince/CEKeysDialog.cpp b/backends/wince/CEKeysDialog.cpp index 54745a8729..737a33577c 100644 --- a/backends/wince/CEKeysDialog.cpp +++ b/backends/wince/CEKeysDialog.cpp @@ -42,12 +42,9 @@ enum { CEKeysDialog::CEKeysDialog(const Common::String &title) : GUI::Dialog(30, 20, 260, 160) { - addButton(this, 160, 20, "Map", kMapCmd, 'M', GUI::kDefaultWidgetSize); // Map - addButton(this, 160, 40, "OK", kOKCmd, 'O', GUI::kDefaultWidgetSize); // OK - addButton(this, 160, 60, "Cancel", kCloseCmd, 'C', GUI::kDefaultWidgetSize); // Cancel - - _actionsList = new ListWidget(this, 10, 20, 140, 90); - _actionsList->setNumberingMode(kListNumberingZero); + addButton(this, 160, 20, "Map", kMapCmd, 'M'); // Map + addButton(this, 160, 40, "OK", kOKCmd, 'O'); // OK + addButton(this, 160, 60, "Cancel", kCloseCmd, 'C'); // Cancel _actionTitle = new StaticTextWidget(this, 10, 120, 240, 16, title, kTextAlignCenter); _keyMapping = new StaticTextWidget(this, 10, 140, 240, 16, "", kTextAlignCenter); @@ -55,6 +52,9 @@ CEKeysDialog::CEKeysDialog(const Common::String &title) _actionTitle->setFlags(WIDGET_CLEARBG); _keyMapping->setFlags(WIDGET_CLEARBG); + _actionsList = new ListWidget(this, "Actions List"); + _actionsList->setNumberingMode(kListNumberingZero); + // Get actions names Common::StringList l; diff --git a/backends/wince/CELauncherDialog.cpp b/backends/wince/CELauncherDialog.cpp index 99bb82e47e..3a5dfb6459 100644 --- a/backends/wince/CELauncherDialog.cpp +++ b/backends/wince/CELauncherDialog.cpp @@ -99,7 +99,7 @@ void CELauncherDialog::addCandidate(String &path, DetectedGameList &candidates) strcpy(candidateName, &path[i + 1]); candidateName[strlen(candidateName) - 1] = '\0'; for (i=0; imove(_currentItem, _y + 10); - _itemsMap[name]->setPanel(this); + PanelItem *ni; + ni = _itemsMap[name] = (PanelItem*)item; + ni->move(_currentItem, _y + 10); + ni->setPanel(this); _currentItem += _interleave; return true; diff --git a/backends/wince/CEgui/Panel.h b/backends/wince/CEgui/Panel.h index fa1595ae42..cae2fa238f 100644 --- a/backends/wince/CEgui/Panel.h +++ b/backends/wince/CEgui/Panel.h @@ -26,14 +26,15 @@ #include "common/stdafx.h" #include "common/scummsys.h" #include "common/system.h" -#include "common/map.h" +#include "common/hashmap.h" #include "common/str.h" +#include "common/config-manager.h" #include "PanelItem.h" #include "Toolbar.h" using Common::String; -using Common::Map; +using Common::HashMap; namespace CEGUI { @@ -52,7 +53,7 @@ namespace CEGUI { return scumm_stricmp(x.c_str(), y.c_str()); } }; - typedef Map ItemMap; + typedef HashMap ItemMap; ItemMap _itemsMap; int _interleave; diff --git a/backends/wince/CEgui/Toolbar.h b/backends/wince/CEgui/Toolbar.h index 2e7d098a7f..ae97c1c8d5 100644 --- a/backends/wince/CEgui/Toolbar.h +++ b/backends/wince/CEgui/Toolbar.h @@ -27,7 +27,7 @@ #include "common/scummsys.h" #include "common/system.h" -#include "common/map.h" +//#include "common/map.h" #include "common/str.h" #include "GUIElement.h" diff --git a/backends/wince/CEgui/ToolbarHandler.cpp b/backends/wince/CEgui/ToolbarHandler.cpp index 5893c6036d..1470479478 100644 --- a/backends/wince/CEgui/ToolbarHandler.cpp +++ b/backends/wince/CEgui/ToolbarHandler.cpp @@ -31,7 +31,6 @@ namespace CEGUI { bool ToolbarHandler::add(const String &name, const Toolbar &toolbar) { - _toolbarMap.addKey(name); _toolbarMap[name] = (Toolbar*)&toolbar; if (!_active) { diff --git a/backends/wince/CEgui/ToolbarHandler.h b/backends/wince/CEgui/ToolbarHandler.h index bfd81269a5..55763d77ab 100644 --- a/backends/wince/CEgui/ToolbarHandler.h +++ b/backends/wince/CEgui/ToolbarHandler.h @@ -27,12 +27,13 @@ #include "common/scummsys.h" #include "common/system.h" #include "common/str.h" -#include "common/map.h" +#include "common/hashmap.h" +#include "common/config-manager.h" #include "Toolbar.h" using Common::String; -using Common::Map; +using Common::HashMap; namespace CEGUI { @@ -59,7 +60,7 @@ namespace CEGUI { return scumm_stricmp(x.c_str(), y.c_str()); } }; - Map _toolbarMap; + HashMap _toolbarMap; String _current; Toolbar *_active; int _offset; diff --git a/backends/wince/missing/assert.h b/backends/wince/missing/assert.h index 509837c972..0a9dc23bb8 100644 --- a/backends/wince/missing/assert.h +++ b/backends/wince/missing/assert.h @@ -1,6 +1,7 @@ /* Header is not present in Windows CE SDK */ -#include "common/util.h" +// defined in common/util.h +void CDECL _declspec(noreturn) error(const char *s, ...); #define assert(e) ((e) ? 0 : (::error("Assertion failed " #e " (%s, %d)", __FILE__, __LINE__))) diff --git a/backends/wince/missing/missing.cpp b/backends/wince/missing/missing.cpp index 49f3d7339b..e85babc13f 100644 --- a/backends/wince/missing/missing.cpp +++ b/backends/wince/missing/missing.cpp @@ -287,6 +287,11 @@ char *getcwd(char *buffer, int maxlen) return cwd; } +void GetCurrentDirectory(int len, char *buf) +{ + getcwd(buf,len); +}; + /* Limited implementation of time.h. time_t formula is possibly incorrect. */ time_t time(time_t* res) { diff --git a/backends/wince/ozone.h b/backends/wince/ozone.h index 711dd0061e..45de0bbb97 100644 --- a/backends/wince/ozone.h +++ b/backends/wince/ozone.h @@ -26,6 +26,7 @@ #define FORMAT_555 2 #define FORMAT_OTHER 3 +#if defined(_WIN32_WCE) && _WIN32_WCE <= 300 typedef struct _RawFrameBufferInfo { WORD wFormat; @@ -36,4 +37,4 @@ typedef struct _RawFrameBufferInfo int cxPixels; int cyPixels; } RawFrameBufferInfo; - +#endif diff --git a/backends/wince/portdefs.h b/backends/wince/portdefs.h index 216856e522..c82e3159f4 100644 --- a/backends/wince/portdefs.h +++ b/backends/wince/portdefs.h @@ -47,6 +47,8 @@ char *strpbrk(const char *s, const char *accept); void *bsearch(const void *, const void *, size_t, size_t, int (*x) (const void *, const void *)); char *getcwd(char *buf, int size); +void GetCurrentDirectory(int len, char *buf); +#define INVALID_FILE_ATTRIBUTES 0xbadc0de #include #include #include @@ -66,6 +68,6 @@ char *getcwd(char *buf, int size); void drawError(char*); #define vsnprintf _vsnprintf - +typedef int ptrdiff_t; #endif diff --git a/backends/wince/wince-sdl.cpp b/backends/wince/wince-sdl.cpp index 8427da1882..9d179be8a5 100644 --- a/backends/wince/wince-sdl.cpp +++ b/backends/wince/wince-sdl.cpp @@ -49,7 +49,11 @@ #include "CEException.h" #ifdef USE_VORBIS +#ifndef USE_TREMOR #include +#else +#include +#endif #endif using namespace CEGUI; @@ -129,6 +133,10 @@ int handleException(EXCEPTION_POINTERS *exceptionPointers) { return EXCEPTION_EXECUTE_HANDLER; } +OSystem *OSystem_WINCE3_create() { + return new OSystem_WINCE3(); +} + int SDL_main(int argc, char **argv) { CEDevice::init(); OSystem_WINCE3::initScreenInfos(); @@ -143,18 +151,22 @@ int SDL_main(int argc, char **argv) { stdout_file = fopen("\\scummvm_stdout.txt", "w"); stderr_file = fopen("\\scummvm_stderr.txt", "w"); - int rest = 0; + int res = 0; +#ifndef DEBUG __try { +#endif g_system = OSystem_WINCE3_create(); assert(g_system); // Invoke the actual ScummVM main entry point: res = scummvm_main(argc, argv); g_system->quit(); // TODO: Consider removing / replacing this! +#ifndef DEBUG } __except (handleException(GetExceptionInformation())) { } +#endif return res; } @@ -182,6 +194,11 @@ void drawError(char *error) { // ******************************************************************************************** +void OSystem_WINCE3::initBackend() +{ + //GUI::Actions::init(); +} + int OSystem_WINCE3::getScreenWidth() { return _platformScreenWidth; } @@ -210,10 +227,6 @@ bool OSystem_WINCE3::isOzone() { // ******************************************************************************************** -OSystem *OSystem_WINCE3_create() { - return new OSystem_WINCE3(); -} - OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(), _orientationLandscape(false), _newOrientation(false), _panelInitialized(false), _panelVisible(false), _panelStateForced(false), _forceHideMouse(false), @@ -229,6 +242,7 @@ OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(), } create_toolbar(); // Initialize global key mapping for Smartphones + GUI::Actions::init(); GUI_Actions::Instance()->initInstanceMain(this); GUI_Actions::Instance()->loadMapping(); @@ -364,7 +378,7 @@ void OSystem_WINCE3::loadSmartphoneConfigurationElement(String element, int &val value = ConfMan.getInt(element, "smartphone"); if (!value) { value = defaultValue; - ConfMan.set(element, value, "smartphone"); + ConfMan.setInt(element, value, "smartphone"); } } @@ -526,12 +540,12 @@ void OSystem_WINCE3::get_sample_rate() { if (gameid == "queen") { if (!((ConfMan.hasKey("FM_high_quality") && ConfMan.getBool("FM_high_quality")) || (ConfMan.hasKey("FM_medium_quality") && ConfMan.getBool("FM_medium_quality")))) { - ConfMan.set("FM_medium_quality", true); + ConfMan.setBool("FM_medium_quality", true); ConfMan.flushToDisk(); } } // See if the output frequency is forced by the game - if ((gameid == "ft" || + if (gameid == "ft" || gameid == "dig" || gameid == "comi" || gameid == "queen" || @@ -748,7 +762,7 @@ void OSystem_WINCE3::update_game_settings() { // Set Smush Force Redraw rate for Full Throttle if (!ConfMan.hasKey("Smush_force_redraw")) { - ConfMan.set("Smush_force_redraw", 30); + ConfMan.setInt("Smush_force_redraw", 30); ConfMan.flushToDisk(); } } @@ -785,9 +799,12 @@ void OSystem_WINCE3::initSize(uint w, uint h) { _toolbarHandler.setOffset(400); } - if (w != _screenWidth || h != _screenHeight) + if (w != (uint) _screenWidth || h != (uint) _screenHeight) _scalersChanged = false; + _overlayWidth = w; + _overlayHeight = h; + OSystem_SDL::initSize(w, h); if (_scalersChanged) { @@ -1965,7 +1982,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) { internUpdateScreen(); if (_newOrientation != _orientationLandscape && _mode == GFX_NORMAL) { _orientationLandscape = _newOrientation; - ConfMan.set("landscape", _orientationLandscape); + ConfMan.setBool("landscape", _orientationLandscape); ConfMan.flushToDisk(); setGraphicsMode(GFX_NORMAL); hotswapGFXMode(); diff --git a/backends/wince/wince-sdl.h b/backends/wince/wince-sdl.h index 363f0ba515..d4988bd4d6 100644 --- a/backends/wince/wince-sdl.h +++ b/backends/wince/wince-sdl.h @@ -26,7 +26,7 @@ #include "common/stdafx.h" #include "common/scummsys.h" #include "common/system.h" -#include "common/scaler.h" +#include "graphics/scaler.h" #include "backends/intern.h" #include "backends/sdl/sdl-common.h" @@ -50,6 +50,8 @@ public: void initSize(uint w, uint h); + void initBackend(); + // Overloaded from SDL_Common (toolbar handling) bool pollEvent(Event &event); // Overloaded from SDL_Common (toolbar handling) @@ -191,7 +193,7 @@ private: long _tapTime; // Mouse - + int _mouseHotspotX, _mouseHotspotY; byte *_mouseBackupOld; // Smartphone specific variables -- cgit v1.2.3