aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorCameron Cawley2019-03-31 19:07:40 +0100
committerFilippos Karapetis2019-04-15 08:06:39 +0300
commitbcef809e612177c2bcb7ca3f8682ea96d38c4cdc (patch)
tree14bc067ff02ef2e1aabd19360db67e22deb8704f /backends
parent82f4ee86a9824a9cdfd5060d7bab23be381a46df (diff)
downloadscummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.tar.gz
scummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.tar.bz2
scummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.zip
WINCE: Fix compilation
Diffstat (limited to 'backends')
-rw-r--r--backends/events/wincesdl/wincesdl-events.cpp18
-rw-r--r--backends/events/wincesdl/wincesdl-events.h2
-rw-r--r--backends/fs/stdiostream.cpp3
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp2
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.cpp116
-rw-r--r--backends/mixer/wincesdl/wincesdl-mixer.cpp1
-rw-r--r--backends/platform/wince/CEDevice.h2
-rw-r--r--backends/platform/wince/CELauncherDialog.cpp2
-rw-r--r--backends/platform/wince/CEgui/GUIElement.h2
-rw-r--r--backends/platform/wince/missing/assert.h8
-rw-r--r--backends/platform/wince/missing/errno.h3
-rw-r--r--backends/platform/wince/missing/fopen.h (renamed from backends/platform/wince/missing/io.h)4
-rw-r--r--backends/platform/wince/missing/missing.cpp28
-rw-r--r--backends/platform/wince/missing/time.h4
-rw-r--r--backends/platform/wince/portdefs.h9
-rw-r--r--backends/platform/wince/wince-sdl.cpp12
-rw-r--r--backends/platform/wince/wince.mk2
-rw-r--r--backends/plugins/win32/win32-provider.cpp10
18 files changed, 111 insertions, 117 deletions
diff --git a/backends/events/wincesdl/wincesdl-events.cpp b/backends/events/wincesdl/wincesdl-events.cpp
index c949d1c41c..a7ffb1eadb 100644
--- a/backends/events/wincesdl/wincesdl-events.cpp
+++ b/backends/events/wincesdl/wincesdl-events.cpp
@@ -43,7 +43,7 @@ void WINCESdlEventSource::init(WINCESdlGraphicsManager *graphicsMan) {
_graphicsMan = graphicsMan;
}
-void WINCESdlEventSource::processMouseEvent(Common::Event &event, int x, int y) {
+bool WINCESdlEventSource::processMouseEvent(Common::Event &event, int x, int y) {
event.mouse.x = x;
event.mouse.y = y;
@@ -57,6 +57,8 @@ void WINCESdlEventSource::processMouseEvent(Common::Event &event, int x, int y)
event.mouse.x = event.mouse.x * _graphicsMan->_scaleFactorXd / _graphicsMan->_scaleFactorXm;
event.mouse.y = event.mouse.y * _graphicsMan->_scaleFactorYd / _graphicsMan->_scaleFactorYm;
+
+ return true;
}
bool WINCESdlEventSource::pollEvent(Common::Event &event) {
@@ -69,7 +71,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
memset(&event, 0, sizeof(Common::Event));
- if (handleKbdMouse(event) {
+ if (handleKbdMouse(event)) {
return true;
}
@@ -155,7 +157,9 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
case SDL_MOUSEMOTION:
event.type = Common::EVENT_MOUSEMOVE;
- processMouseEvent(event, ev.motion.x, ev.motion.y);
+ if (!processMouseEvent(event, ev.motion.x, ev.motion.y)) {
+ return false;
+ }
// update KbdMouse
_km.x = ev.motion.x * MULTIPLIER;
_km.y = ev.motion.y * MULTIPLIER;
@@ -171,7 +175,9 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
event.type = Common::EVENT_RBUTTONDOWN;
else
break;
- processMouseEvent(event, ev.button.x, ev.button.y);
+ if (!processMouseEvent(event, ev.button.x, ev.button.y)) {
+ return false;
+ }
// update KbdMouse
_km.x = ev.button.x * MULTIPLIER;
_km.y = ev.button.y * MULTIPLIER;
@@ -249,7 +255,9 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
_rbutton = false;
}
- processMouseEvent(event, ev.button.x, ev.button.y);
+ if (!processMouseEvent(event, ev.button.x, ev.button.y)) {
+ return false;
+ }
// update KbdMouse
_km.x = ev.button.x * MULTIPLIER;
_km.y = ev.button.y * MULTIPLIER;
diff --git a/backends/events/wincesdl/wincesdl-events.h b/backends/events/wincesdl/wincesdl-events.h
index 38327681a5..0f38f6753e 100644
--- a/backends/events/wincesdl/wincesdl-events.h
+++ b/backends/events/wincesdl/wincesdl-events.h
@@ -43,7 +43,7 @@ public:
// Overloaded from SDL backend (toolbar handling)
bool pollEvent(Common::Event &event);
// Overloaded from SDL backend (mouse and new scaler handling)
- void processMouseEvent(Common::Event &event, int x, int y);
+ bool processMouseEvent(Common::Event &event, int x, int y);
protected:
diff --git a/backends/fs/stdiostream.cpp b/backends/fs/stdiostream.cpp
index 8206bd180f..a893149e9a 100644
--- a/backends/fs/stdiostream.cpp
+++ b/backends/fs/stdiostream.cpp
@@ -26,6 +26,9 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "backends/fs/stdiostream.h"
+#ifdef _WIN32_WCE
+#include "backends/platform/wince/missing/fopen.h"
+#endif
StdioStream::StdioStream(void *handle) : _handle(handle) {
assert(handle);
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 5cfcdcfcb8..5e86a2be11 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -207,7 +207,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() {
ScalerProc *scalerProc;
int scale1;
-#if defined(DEBUG) && ! defined(_WIN32_WCE) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
+#if defined(DEBUG)
assert(_hwScreen != NULL);
assert(_hwScreen->map->sw_data != NULL);
#endif
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index 8e51f43efa..80792d439c 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.cpp
+++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp
@@ -53,8 +53,8 @@ WINCESdlGraphicsManager::WINCESdlGraphicsManager(SdlEventSource *sdlEventSource,
_hasfocus(true), _zoomUp(false), _zoomDown(false) {
memset(&_mouseCurState, 0, sizeof(_mouseCurState));
if (_isSmartphone) {
- _mouseCurState.x = 20;
- _mouseCurState.y = 20;
+ _cursorX = 20;
+ _cursorY = 20;
}
loadDeviceConfigurationElement("repeatTrigger", _keyRepeatTrigger, 200);
@@ -292,8 +292,8 @@ void WINCESdlGraphicsManager::move_cursor_right() {
}
void WINCESdlGraphicsManager::retrieve_mouse_location(int &x, int &y) {
- x = _mouseCurState.x;
- y = _mouseCurState.y;
+ x = _cursorX;
+ y = _cursorY;
x = x * _scaleFactorXm / _scaleFactorXd;
y = y * _scaleFactorYm / _scaleFactorYd;
@@ -489,7 +489,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
int numRectsOut = 0;
int16 routx, routy, routw, routh, stretch, shakestretch;
- assert(_hwscreen != NULL);
+ assert(_hwScreen != NULL);
// bail if the application is minimized, be nice to OS
if (!_hasfocus) {
@@ -502,9 +502,9 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
SDL_Rect blackrect = {0, 0, _videoMode.screenWidth *_scaleFactorXm / _scaleFactorXd, _newShakePos *_scaleFactorYm / _scaleFactorYd};
if (_videoMode.aspectRatioCorrection)
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
- SDL_FillRect(_hwscreen, &blackrect, 0);
+ SDL_FillRect(_hwScreen, &blackrect, 0);
_currentShakePos = _newShakePos;
- _forceFull = true;
+ _forceRedraw = true;
}
// Make sure the mouse is drawn, if it should be drawn.
@@ -515,7 +515,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
if (_paletteDirtyEnd != 0) {
SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart, _paletteDirtyStart, _paletteDirtyEnd - _paletteDirtyStart);
_paletteDirtyEnd = 0;
- _forceFull = true;
+ _forceRedraw = true;
}
if (!_overlayVisible) {
@@ -532,7 +532,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
}
// Force a full redraw if requested
- if (_forceFull) {
+ if (_forceRedraw) {
_numDirtyRects = 1;
_dirtyRectList[0].x = 0;
@@ -569,10 +569,10 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
}
SDL_LockSurface(srcSurf);
- SDL_LockSurface(_hwscreen);
+ SDL_LockSurface(_hwScreen);
srcPitch = srcSurf->pitch;
- dstPitch = _hwscreen->pitch;
+ dstPitch = _hwScreen->pitch;
for (r = _dirtyRectList, rout = _dirtyRectOut; r != last_rect; ++r) {
@@ -627,7 +627,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
// blit it (with added voodoo from the sdl backend, shifting the source rect again)
_scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
- (byte *)_hwscreen->pixels + routx * 2 + routy * dstPitch, dstPitch,
+ (byte *)_hwScreen->pixels + routx * 2 + routy * dstPitch, dstPitch,
r->w, r->h - _currentShakePos);
// add this rect to output
@@ -640,7 +640,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
}
SDL_UnlockSurface(srcSurf);
- SDL_UnlockSurface(_hwscreen);
+ SDL_UnlockSurface(_hwScreen);
}
// Add the toolbar if needed
SDL_Rect toolbar_rect[1];
@@ -670,9 +670,9 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
// Apply the appropriate scaler
SDL_LockSurface(toolbarSurface);
- SDL_LockSurface(_hwscreen);
+ SDL_LockSurface(_hwScreen);
srcPitch = toolbarSurface->pitch;
- dstPitch = _hwscreen->pitch;
+ dstPitch = _hwScreen->pitch;
toolbarScaler = _scalerProc;
if (_videoMode.scaleFactor == 2)
@@ -680,10 +680,10 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
else if (_videoMode.scaleFactor == 3)
toolbarScaler = Normal3x;
toolbarScaler((byte *)toolbarSurface->pixels, srcPitch,
- (byte *)_hwscreen->pixels + (_toolbarHandler.getOffset() * _scaleFactorYm / _scaleFactorYd * dstPitch),
+ (byte *)_hwScreen->pixels + (_toolbarHandler.getOffset() * _scaleFactorYm / _scaleFactorYd * dstPitch),
dstPitch, toolbar_rect[0].w, toolbar_rect[0].h);
SDL_UnlockSurface(toolbarSurface);
- SDL_UnlockSurface(_hwscreen);
+ SDL_UnlockSurface(_hwScreen);
// And blit it
toolbar_rect[0].y = _toolbarHandler.getOffset();
@@ -692,17 +692,17 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
toolbar_rect[0].w = toolbar_rect[0].w * _scaleFactorXm / _scaleFactorXd;
toolbar_rect[0].h = toolbar_rect[0].h * _scaleFactorYm / _scaleFactorYd;
- SDL_UpdateRects(_hwscreen, 1, toolbar_rect);
+ SDL_UpdateRects(_hwScreen, 1, toolbar_rect);
drawToolbarMouse(toolbarSurface, false); // undraw toolbar mouse
}
// Finally, blit all our changes to the screen
if (numRectsOut > 0)
- SDL_UpdateRects(_hwscreen, numRectsOut, _dirtyRectOut);
+ SDL_UpdateRects(_hwScreen, numRectsOut, _dirtyRectOut);
_numDirtyRects = 0;
- _forceFull = false;
+ _forceRedraw = false;
}
bool WINCESdlGraphicsManager::setGraphicsMode(int mode) {
@@ -809,7 +809,7 @@ bool WINCESdlGraphicsManager::setGraphicsMode(int mode) {
_scaleFactorYd = 1;
}
- _forceFull = true;
+ _forceRedraw = true;
if (oldScaleFactorXm != _scaleFactorXm ||
oldScaleFactorXd != _scaleFactorXd ||
@@ -830,7 +830,7 @@ bool WINCESdlGraphicsManager::loadGFXMode() {
unsigned int flags = SDL_FULLSCREEN | SDL_SWSURFACE;
_videoMode.fullscreen = true; // forced
- _forceFull = true;
+ _forceRedraw = true;
_tmpscreen = NULL;
@@ -862,32 +862,32 @@ bool WINCESdlGraphicsManager::loadGFXMode() {
default:
flags |= SDL_PORTRTVIDEO;
}
- _hwscreen = SDL_SetVideoMode(displayWidth, displayHeight, 16, flags);
+ _hwScreen = SDL_SetVideoMode(displayWidth, displayHeight, 16, flags);
- if (_hwscreen == NULL) {
+ if (_hwScreen == NULL) {
warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
g_system->quit();
}
// see what orientation sdl finally accepted
- if (_hwscreen->flags & SDL_PORTRTVIDEO)
+ if (_hwScreen->flags & SDL_PORTRTVIDEO)
_orientationLandscape = _newOrientation = 0;
- else if (_hwscreen->flags & SDL_LANDSCVIDEO)
+ else if (_hwScreen->flags & SDL_LANDSCVIDEO)
_orientationLandscape = _newOrientation = 1;
else
_orientationLandscape = _newOrientation = 2;
// Create the surface used for the graphics in 16 bit before scaling, and also the overlay
// Distinguish 555 and 565 mode
- if (_hwscreen->format->Rmask == 0x7C00)
+ if (_hwScreen->format->Rmask == 0x7C00)
InitScalers(555);
else
InitScalers(565);
- _overlayFormat = convertSDLPixelFormat(_hwscreen->format);
+ _overlayFormat = convertSDLPixelFormat(_hwScreen->format);
// Need some extra bytes around when using 2xSaI
- _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3, 16, _hwscreen->format->Rmask, _hwscreen->format->Gmask, _hwscreen->format->Bmask, _hwscreen->format->Amask);
+ _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3, 16, _hwScreen->format->Rmask, _hwScreen->format->Gmask, _hwScreen->format->Bmask, _hwScreen->format->Amask);
if (_tmpscreen == NULL)
error("_tmpscreen creation failed (%s)", SDL_GetError());
@@ -912,14 +912,14 @@ bool WINCESdlGraphicsManager::loadGFXMode() {
// Toolbar
_toolbarHighDrawn = false;
uint16 *toolbar_screen = (uint16 *)calloc(320 * 40, sizeof(uint16)); // *not* leaking memory here
- _toolbarLow = SDL_CreateRGBSurfaceFrom(toolbar_screen, 320, 40, 16, 320 * 2, _hwscreen->format->Rmask, _hwscreen->format->Gmask, _hwscreen->format->Bmask, _hwscreen->format->Amask);
+ _toolbarLow = SDL_CreateRGBSurfaceFrom(toolbar_screen, 320, 40, 16, 320 * 2, _hwScreen->format->Rmask, _hwScreen->format->Gmask, _hwScreen->format->Bmask, _hwScreen->format->Amask);
if (_toolbarLow == NULL)
error("_toolbarLow failed (%s)", SDL_GetError());
if (_videoMode.screenHeight > 240) {
uint16 *toolbar_screen_high = (uint16 *)calloc(640 * 80, sizeof(uint16));
- _toolbarHigh = SDL_CreateRGBSurfaceFrom(toolbar_screen_high, 640, 80, 16, 640 * 2, _hwscreen->format->Rmask, _hwscreen->format->Gmask, _hwscreen->format->Bmask, _hwscreen->format->Amask);
+ _toolbarHigh = SDL_CreateRGBSurfaceFrom(toolbar_screen_high, 640, 80, 16, 640 * 2, _hwScreen->format->Rmask, _hwScreen->format->Gmask, _hwScreen->format->Bmask, _hwScreen->format->Amask);
if (_toolbarHigh == NULL)
error("_toolbarHigh failed (%s)", SDL_GetError());
@@ -938,9 +938,9 @@ void WINCESdlGraphicsManager::unloadGFXMode() {
_screen = NULL;
}
- if (_hwscreen) {
- SDL_FreeSurface(_hwscreen);
- _hwscreen = NULL;
+ if (_hwScreen) {
+ SDL_FreeSurface(_hwScreen);
+ _hwScreen = NULL;
}
if (_tmpscreen) {
@@ -961,7 +961,7 @@ bool WINCESdlGraphicsManager::hotswapGFXMode() {
SDL_Surface *old_tmpscreen2 = _tmpscreen2;
// Release the HW screen surface
- SDL_FreeSurface(_hwscreen);
+ SDL_FreeSurface(_hwScreen);
// Release toolbars
free(_toolbarLow->pixels);
@@ -1009,10 +1009,10 @@ bool WINCESdlGraphicsManager::hotswapGFXMode() {
}
bool WINCESdlGraphicsManager::saveScreenshot(const char *filename) {
- assert(_hwscreen != NULL);
+ assert(_hwScreen != NULL);
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
- SDL_SaveBMP(_hwscreen, filename);
+ SDL_SaveBMP(_hwScreen, filename);
return true;
}
@@ -1168,10 +1168,10 @@ void WINCESdlGraphicsManager::transformMouseCoordinates(Common::Point &point) {
}
void WINCESdlGraphicsManager::setMousePos(int x, int y) {
- if (x != _mouseCurState.x || y != _mouseCurState.y) {
+ if (x != _cursorX || y != _cursorY) {
undrawMouse();
- _mouseCurState.x = x;
- _mouseCurState.y = y;
+ _cursorX = x;
+ _cursorY = y;
updateScreen();
}
}
@@ -1203,7 +1203,7 @@ void WINCESdlGraphicsManager::hideOverlay() {
undrawMouse();
_overlayVisible = false;
clearOverlay();
- _forceFull = true;
+ _forceRedraw = true;
}
void WINCESdlGraphicsManager::blitCursor() {
@@ -1214,8 +1214,8 @@ void WINCESdlGraphicsManager::drawToolbarMouse(SDL_Surface *surf, bool draw) {
if (!_mouseData || !_usesEmulatedMouse)
return;
- int x = _mouseCurState.x - _mouseHotspotX;
- int y = _mouseCurState.y - _mouseHotspotY - _toolbarHandler.getOffset();
+ int x = _cursorX - _mouseHotspotX;
+ int y = _cursorY - _mouseHotspotY - _toolbarHandler.getOffset();
int w = _mouseCurState.w;
int h = _mouseCurState.h;
byte color;
@@ -1272,7 +1272,7 @@ void WINCESdlGraphicsManager::drawToolbarMouse(SDL_Surface *surf, bool draw) {
}
void WINCESdlGraphicsManager::warpMouse(int x, int y) {
- if (_mouseCurState.x != x || _mouseCurState.y != y) {
+ if (_cursorX != x || _cursorY != y) {
SDL_WarpMouse(x * _scaleFactorXm / _scaleFactorXd, y * _scaleFactorYm / _scaleFactorYd);
// SDL_WarpMouse() generates a mouse movement event, so
@@ -1291,11 +1291,11 @@ void WINCESdlGraphicsManager::unlockScreen() {
}
void WINCESdlGraphicsManager::internDrawMouse() {
- if (!_mouseNeedsRedraw || !_mouseVisible || !_mouseData)
+ if (!_cursorNeedsRedraw || !_cursorVisible || !_mouseData)
return;
- int x = _mouseCurState.x - _mouseHotspotX;
- int y = _mouseCurState.y - _mouseHotspotY;
+ int x = _cursorX - _mouseHotspotX;
+ int y = _cursorY - _mouseHotspotY;
int w = _mouseCurState.w;
int h = _mouseCurState.h;
byte color;
@@ -1376,17 +1376,17 @@ void WINCESdlGraphicsManager::internDrawMouse() {
SDL_UnlockSurface(_overlayVisible ? _overlayscreen : _screen);
// Finally, set the flag to indicate the mouse has been drawn
- _mouseNeedsRedraw = false;
+ _cursorNeedsRedraw = false;
}
void WINCESdlGraphicsManager::undrawMouse() {
assert(_transactionMode == kTransactionNone);
- if (_mouseNeedsRedraw)
+ if (_cursorNeedsRedraw)
return;
- int old_mouse_x = _mouseCurState.x - _mouseHotspotX;
- int old_mouse_y = _mouseCurState.y - _mouseHotspotY;
+ int old_mouse_x = _cursorX - _mouseHotspotX;
+ int old_mouse_y = _cursorY - _mouseHotspotY;
int old_mouse_w = _mouseCurState.w;
int old_mouse_h = _mouseCurState.h;
@@ -1435,31 +1435,31 @@ void WINCESdlGraphicsManager::undrawMouse() {
SDL_UnlockSurface(_overlayVisible ? _overlayscreen : _screen);
- _mouseNeedsRedraw = true;
+ _cursorNeedsRedraw = true;
}
void WINCESdlGraphicsManager::drawMouse() {
- if (!(_toolbarHandler.visible() && _mouseCurState.y >= _toolbarHandler.getOffset() && !_usesEmulatedMouse) && !_forceHideMouse)
+ if (!(_toolbarHandler.visible() && _cursorY >= _toolbarHandler.getOffset() && !_usesEmulatedMouse) && !_forceHideMouse)
internDrawMouse();
}
bool WINCESdlGraphicsManager::showMouse(bool visible) {
- if (_mouseVisible == visible)
+ if (_cursorVisible == visible)
return visible;
if (visible == false)
undrawMouse();
- bool last = _mouseVisible;
- _mouseVisible = visible;
- _mouseNeedsRedraw = true;
+ bool last = _cursorVisible;
+ _cursorVisible = visible;
+ _cursorNeedsRedraw = true;
return last;
}
void WINCESdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool mouseRect) {
- if (_forceFull || _paletteDirtyEnd)
+ if (_forceRedraw || _paletteDirtyEnd)
return;
SurfaceSdlGraphicsManager::addDirtyRect(x, y, w, h, false);
diff --git a/backends/mixer/wincesdl/wincesdl-mixer.cpp b/backends/mixer/wincesdl/wincesdl-mixer.cpp
index 2c70ee76c7..fff2af5888 100644
--- a/backends/mixer/wincesdl/wincesdl-mixer.cpp
+++ b/backends/mixer/wincesdl/wincesdl-mixer.cpp
@@ -27,6 +27,7 @@
#include "common/config-manager.h"
#include "backends/platform/wince/wince-sdl.h"
+#include "backends/platform/wince/missing/fopen.h"
#include "backends/mixer/wincesdl/wincesdl-mixer.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/backends/platform/wince/CEDevice.h b/backends/platform/wince/CEDevice.h
index 2032b7fb27..c43e4e6999 100644
--- a/backends/platform/wince/CEDevice.h
+++ b/backends/platform/wince/CEDevice.h
@@ -23,6 +23,8 @@
#ifndef CEDEVICE_H
#define CEDEVICE_H
+#include <windows.h>
+
#include "common/scummsys.h"
#include "common/system.h"
#include "common/str.h"
diff --git a/backends/platform/wince/CELauncherDialog.cpp b/backends/platform/wince/CELauncherDialog.cpp
index f7795dfdef..71650060a7 100644
--- a/backends/platform/wince/CELauncherDialog.cpp
+++ b/backends/platform/wince/CELauncherDialog.cpp
@@ -95,7 +95,7 @@ void CELauncherDialog::addGame() {
updateListing();
selectTarget(newTarget);
}
- draw();
+ g_gui.scheduleTopDialogRedraw();
} else
GUILauncherDialog::addGame();
}
diff --git a/backends/platform/wince/CEgui/GUIElement.h b/backends/platform/wince/CEgui/GUIElement.h
index 6695029877..57c6e321e7 100644
--- a/backends/platform/wince/CEgui/GUIElement.h
+++ b/backends/platform/wince/CEgui/GUIElement.h
@@ -23,6 +23,8 @@
#ifndef CEGUI_GUIELEMENT_H
#define CEGUI_GUIELEMENT_H
+#include <windows.h>
+
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/missing/assert.h b/backends/platform/wince/missing/assert.h
deleted file mode 100644
index e9c871da60..0000000000
--- a/backends/platform/wince/missing/assert.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Header is not present in Windows CE SDK */
-
-// defined in common/util.h
-void CDECL _declspec(noreturn) error(const char *s, ...);
-
-#define assert(e) ((e) ? 0 : (::error("Assertion failed %s (%s, %d)", #e, __FILE__, __LINE__)))
-
-#define abort() ::error("Abort (%s, %d)", __FILE__, __LINE__)
diff --git a/backends/platform/wince/missing/errno.h b/backends/platform/wince/missing/errno.h
index 7ee9f5e5ba..1d13c5d7d8 100644
--- a/backends/platform/wince/missing/errno.h
+++ b/backends/platform/wince/missing/errno.h
@@ -1 +1,4 @@
/* Header is not present in Windows CE SDK */
+
+extern int errno;
+#define EINTR 4
diff --git a/backends/platform/wince/missing/io.h b/backends/platform/wince/missing/fopen.h
index b2cb2abd8e..b4f7d03129 100644
--- a/backends/platform/wince/missing/io.h
+++ b/backends/platform/wince/missing/fopen.h
@@ -1,11 +1,11 @@
/* Header is not present in Windows CE SDK */
+extern "C" {
/* This stuff will live here until port configuration file is in place */
-#define strdup _strdup
-
#ifndef _FILE_DEFINED
typedef void FILE;
#define _FILE_DEFINED
#endif
FILE *wce_fopen(const char *fname, const char *fmode);
#define fopen wce_fopen
+}
diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp
index 0355f35a69..ab193a198b 100644
--- a/backends/platform/wince/missing/missing.cpp
+++ b/backends/platform/wince/missing/missing.cpp
@@ -36,8 +36,6 @@
#include <stdio.h>
#include "common/debug.h"
-char *strdup(const char *strSource);
-
#ifdef __GNUC__
#define EXT_C extern "C"
#else
@@ -46,6 +44,10 @@ char *strdup(const char *strSource);
// common missing functions required by both gcc and evc
+#ifndef USE_ZLIB
+int errno = 0;
+#endif
+
void *bsearch(const void *key, const void *base, size_t nmemb,
size_t size, int (*compar)(const void *, const void *)) {
// Perform binary search
@@ -68,7 +70,7 @@ void *bsearch(const void *key, const void *base, size_t nmemb,
static char cwd[MAX_PATH + 1] = "";
-EXT_C char *getcwd(char *buffer, int maxlen) {
+EXT_C char *wce_getcwd(char *buffer, int maxlen) {
TCHAR fileUnc[MAX_PATH + 1];
char *plast;
@@ -91,7 +93,7 @@ EXT_C char *getcwd(char *buffer, int maxlen) {
#undef GetCurrentDirectory
#endif
EXT_C void GetCurrentDirectory(int len, char *buf) {
- getcwd(buf, len);
+ wce_getcwd(buf, len);
}
/*
@@ -106,7 +108,7 @@ EXT_C FILE *wce_fopen(const char *fname, const char *fmode) {
if (!fname || fname[0] == '\0')
return NULL;
if (fname[0] != '\\' && fname[0] != '/') {
- getcwd(fullname, MAX_PATH);
+ wce_getcwd(fullname, MAX_PATH);
strcat(fullname, "\\");
strcat(fullname, fname);
return fopen(fullname, fmode);
@@ -128,7 +130,7 @@ int _access(const char *path, int mode) {
char fullname[MAX_PATH + 1];
if (path[0] != '\\' && path[0] != '/') {
- getcwd(fullname, MAX_PATH);
+ wce_getcwd(fullname, MAX_PATH);
strcat(fullname, "\\");
strcat(fullname, path);
MultiByteToWideChar(CP_ACP, 0, fullname, -1, fname, sizeof(fname) / sizeof(TCHAR));
@@ -179,20 +181,8 @@ int _access(const char *path, int mode) {
return -1;
}
-// evc only functions follow
-#ifndef __GNUC__
-
-char *strdup(const char *strSource) {
- char *buffer;
- size_z len = strlen(strSource) + 1;
- buffer = (char *)malloc(len);
- if (buffer)
- memcpy(buffer, strSource, len);
- return buffer;
-}
-
// gcc build only functions follow
-#else // defined(__GNUC__)
+#if defined(__GNUC__)
#ifndef __MINGW32CE__
int islower(int c) {
diff --git a/backends/platform/wince/missing/time.h b/backends/platform/wince/missing/time.h
index a0ba6c246e..156d2f6a36 100644
--- a/backends/platform/wince/missing/time.h
+++ b/backends/platform/wince/missing/time.h
@@ -5,7 +5,9 @@
#include <stdlib.h>
-#ifndef __MINGW32CE__
+#ifdef __MINGW32CE__
+#include_next <time.h>
+#else
struct tm {
short tm_year;
short tm_mon;
diff --git a/backends/platform/wince/portdefs.h b/backends/platform/wince/portdefs.h
index c74fc39169..2283f94a2b 100644
--- a/backends/platform/wince/portdefs.h
+++ b/backends/platform/wince/portdefs.h
@@ -39,11 +39,9 @@
int isprint(int c);
int isspace(int c);
char *strrchr(const char *s, int c);
- char *strdup(const char *s);
void assert(void *expression);
void assert(int expression);
long int strtol(const char *nptr, char **endptr, int base);
- char *_strdup(const char *s);
char *strpbrk(const char *s, const char *accept);
#endif
@@ -51,7 +49,6 @@
#ifndef __GNUC__
void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
- char *getcwd(char *buf, int size);
typedef int ptrdiff_t;
void GetCurrentDirectory(int len, char *buf);
#define INVALID_FILE_ATTRIBUTES 0xffffffff
@@ -60,18 +57,15 @@
#undef GetCurrentDirectory
extern "C" void GetCurrentDirectory(int len, char *buf);
#define snprintf _snprintf
- #define strdup _strdup
#define fopen wce_fopen
#endif
-#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
#include <stdarg.h>
#include <assert.h>
-#include <mmsystem.h>
#include <ctype.h>
//#include <direct.h>
#include <new>
@@ -81,6 +75,9 @@
#endif
int remove(const char *path);
int _access(const char *path, int mode);
+extern "C" {
+ char *wce_getcwd(char *buf, int size);
+}
void drawError(char *);
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index 8a19eac064..cb26071c97 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -24,6 +24,9 @@
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include <windows.h>
+
+#include "backends/platform/wince/missing/fopen.h"
#include "backends/platform/wince/wince-sdl.h"
#include "common/config-manager.h"
@@ -163,7 +166,6 @@ int handleException(EXCEPTION_POINTERS *exceptionPointers) {
}
#endif
-extern "C" char *getcwd(char *buf, int size);
int SDL_main(int argc, char **argv) {
FILE *newfp = NULL;
#ifdef __GNUC__
@@ -182,8 +184,8 @@ int SDL_main(int argc, char **argv) {
CEDevice::init();
/* Redirect standard input and standard output */
- strcpy(stdout_fname, getcwd(NULL, MAX_PATH));
- strcpy(stderr_fname, getcwd(NULL, MAX_PATH));
+ strcpy(stdout_fname, wce_getcwd(NULL, MAX_PATH));
+ strcpy(stderr_fname, wce_getcwd(NULL, MAX_PATH));
strcat(stdout_fname, STDOUT_FNAME);
strcat(stderr_fname, STDERR_FNAME);
#ifndef __GNUC__
@@ -279,7 +281,7 @@ int console_main(int argc, char *argv[]) {
appname = bufp;
if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) {
- error("WinMain() error: %d", SDL_GetError());
+ error("WinMain() error: %s", SDL_GetError());
return(FALSE);
}
@@ -461,7 +463,7 @@ bool OSystem_WINCE3::isOzone() {
Common::String OSystem_WINCE3::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
- strcpy(configFile, getcwd(NULL, MAX_PATH));
+ strcpy(configFile, wce_getcwd(NULL, MAX_PATH));
strcat(configFile, "\\");
strcat(configFile, DEFAULT_CONFIG_FILE);
return configFile;
diff --git a/backends/platform/wince/wince.mk b/backends/platform/wince/wince.mk
index 64768dcc8a..2496eac5de 100644
--- a/backends/platform/wince/wince.mk
+++ b/backends/platform/wince/wince.mk
@@ -4,7 +4,7 @@ endif
ifdef DYNAMIC_MODULES
plugins: backends/platform/wince/stub.o backends/platform/wince/PocketSCUMM.o
- $(CXX) backends/platform/wince/stub.o backends/platform/wince/PocketSCUMM.o -L. -lscummvm -o scummvm.exe
+ $(CXX) -nostdlib backends/platform/wince/stub.o backends/platform/wince/PocketSCUMM.o -L. -lscummvm -o scummvm.exe
backends/platform/wince/stub.o: $(srcdir)/backends/platform/wince/stub.cpp
$(CXX) -c $(srcdir)/backends/platform/wince/stub.cpp -o backends/platform/wince/stub.o
diff --git a/backends/plugins/win32/win32-provider.cpp b/backends/plugins/win32/win32-provider.cpp
index ae8a5f0472..c97feb4806 100644
--- a/backends/plugins/win32/win32-provider.cpp
+++ b/backends/plugins/win32/win32-provider.cpp
@@ -36,7 +36,7 @@
class Win32Plugin : public DynamicPlugin {
private:
static const TCHAR* toUnicode(const char *x) {
- #ifndef _WIN32_WCE
+ #ifndef UNICODE
return (const TCHAR *)x;
#else
static TCHAR unicodeString[MAX_PATH];
@@ -50,11 +50,7 @@ protected:
void *_dlHandle;
virtual VoidFunc findSymbol(const char *symbol) {
- #ifndef _WIN32_WCE
- FARPROC func = GetProcAddress((HMODULE)_dlHandle, symbol);
- #else
FARPROC func = GetProcAddress((HMODULE)_dlHandle, toUnicode(symbol));
- #endif
if (!func)
debug("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str());
@@ -67,11 +63,7 @@ public:
bool loadPlugin() {
assert(!_dlHandle);
-#ifndef _WIN32_WCE
- _dlHandle = LoadLibrary(_filename.c_str());
-#else
_dlHandle = LoadLibrary(toUnicode(_filename.c_str()));
-#endif
if (!_dlHandle) {
debug("Failed loading plugin '%s' (error code %d)", _filename.c_str(), (int32) GetLastError());