update the CE port to work under 0.9.0 codebase

svn-id: r22956
This commit is contained in:
Kostas Nakos 2006-06-06 19:31:49 +00:00
parent 318770280c
commit 506456d014
18 changed files with 78 additions and 47 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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;
};

View File

@ -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;

View File

@ -99,7 +99,7 @@ void CELauncherDialog::addCandidate(String &path, DetectedGameList &candidates)
strcpy(candidateName, &path[i + 1]);
candidateName[strlen(candidateName) - 1] = '\0';
for (i=0; i<candidates.size(); i++) {
if (scumm_stricmp(candidateName, candidates[i].description) == 0) {
if (scumm_stricmp(candidateName, candidates[i].description.c_str()) == 0) {
idx = i;
break;
}
@ -119,7 +119,7 @@ void CELauncherDialog::addCandidate(String &path, DetectedGameList &candidates)
// The auto detector or the user made a choice.
// Pick a domain name which does not yet exist (after all, we
// are *adding* a game to the config, not replacing).
String domain(result.description);
String domain(result.gameid);
if (ConfMan.hasGameDomain(domain)) {
char suffix = 'a';
domain += suffix;
@ -131,7 +131,9 @@ void CELauncherDialog::addCandidate(String &path, DetectedGameList &candidates)
}
ConfMan.set("gameid", result.description, domain);
ConfMan.set("description", result.description, domain);
}
} else
ConfMan.addGameDomain(domain);
ConfMan.set("path", path, domain);
// Set language if specified

View File

@ -19,7 +19,7 @@
* $Id$
*
*/
#include "common/scaler/intern.h"
#include "graphics/scaler/intern.h"
#include "common/stdafx.h"
#include "CEScaler.h"

View File

@ -26,8 +26,8 @@
#include "common/stdafx.h"
#include "common/scummsys.h"
#include "common/system.h"
#include "common/scaler.h"
#include "common/scaler/intern.h"
#include "graphics/scaler.h"
#include "graphics/scaler/intern.h"
DECLARE_SCALER(PocketPCPortrait);
DECLARE_SCALER(PocketPCHalf);

View File

@ -33,10 +33,10 @@ namespace CEGUI {
bool Panel::add(const String &name, const PanelItem *item) {
_itemsMap.addKey(name);
_itemsMap[name] = (PanelItem*)item;
_itemsMap[name]->move(_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;

View File

@ -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<String, PanelItem*, IgnoreCaseComparator> ItemMap;
typedef HashMap<String, PanelItem*, Common::IgnoreCase_Hash , IgnoreCaseComparator> ItemMap;
ItemMap _itemsMap;
int _interleave;

View File

@ -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"

View File

@ -31,7 +31,6 @@ namespace CEGUI {
bool ToolbarHandler::add(const String &name, const Toolbar &toolbar) {
_toolbarMap.addKey(name);
_toolbarMap[name] = (Toolbar*)&toolbar;
if (!_active) {

View File

@ -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<String, Toolbar*, IgnoreCaseComparator> _toolbarMap;
HashMap<String, Toolbar*, Common::IgnoreCase_Hash, IgnoreCaseComparator> _toolbarMap;
String _current;
Toolbar *_active;
int _offset;

View File

@ -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__)))

View File

@ -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)
{

View File

@ -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

View File

@ -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 <windows.h>
#include <stdio.h>
#include <stdlib.h>
@ -66,6 +68,6 @@ char *getcwd(char *buf, int size);
void drawError(char*);
#define vsnprintf _vsnprintf
typedef int ptrdiff_t;
#endif

View File

@ -49,7 +49,11 @@
#include "CEException.h"
#ifdef USE_VORBIS
#ifndef USE_TREMOR
#include <vorbis/vorbisfile.h>
#else
#include <tremor/ivorbisfile.h>
#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();

View File

@ -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