WINCE: Fix compilation

This commit is contained in:
Cameron Cawley 2019-03-31 19:07:40 +01:00 committed by Filippos Karapetis
parent 82f4ee86a9
commit bcef809e61
24 changed files with 116 additions and 142 deletions

View file

@ -43,7 +43,7 @@ void WINCESdlEventSource::init(WINCESdlGraphicsManager *graphicsMan) {
_graphicsMan = 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.x = x;
event.mouse.y = y; 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.x = event.mouse.x * _graphicsMan->_scaleFactorXd / _graphicsMan->_scaleFactorXm;
event.mouse.y = event.mouse.y * _graphicsMan->_scaleFactorYd / _graphicsMan->_scaleFactorYm; event.mouse.y = event.mouse.y * _graphicsMan->_scaleFactorYd / _graphicsMan->_scaleFactorYm;
return true;
} }
bool WINCESdlEventSource::pollEvent(Common::Event &event) { bool WINCESdlEventSource::pollEvent(Common::Event &event) {
@ -69,7 +71,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
memset(&event, 0, sizeof(Common::Event)); memset(&event, 0, sizeof(Common::Event));
if (handleKbdMouse(event) { if (handleKbdMouse(event)) {
return true; return true;
} }
@ -155,7 +157,9 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
event.type = Common::EVENT_MOUSEMOVE; 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 // update KbdMouse
_km.x = ev.motion.x * MULTIPLIER; _km.x = ev.motion.x * MULTIPLIER;
_km.y = ev.motion.y * MULTIPLIER; _km.y = ev.motion.y * MULTIPLIER;
@ -171,7 +175,9 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
event.type = Common::EVENT_RBUTTONDOWN; event.type = Common::EVENT_RBUTTONDOWN;
else else
break; break;
processMouseEvent(event, ev.button.x, ev.button.y); if (!processMouseEvent(event, ev.button.x, ev.button.y)) {
return false;
}
// update KbdMouse // update KbdMouse
_km.x = ev.button.x * MULTIPLIER; _km.x = ev.button.x * MULTIPLIER;
_km.y = ev.button.y * MULTIPLIER; _km.y = ev.button.y * MULTIPLIER;
@ -249,7 +255,9 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
_rbutton = false; _rbutton = false;
} }
processMouseEvent(event, ev.button.x, ev.button.y); if (!processMouseEvent(event, ev.button.x, ev.button.y)) {
return false;
}
// update KbdMouse // update KbdMouse
_km.x = ev.button.x * MULTIPLIER; _km.x = ev.button.x * MULTIPLIER;
_km.y = ev.button.y * MULTIPLIER; _km.y = ev.button.y * MULTIPLIER;

View file

@ -43,7 +43,7 @@ public:
// Overloaded from SDL backend (toolbar handling) // Overloaded from SDL backend (toolbar handling)
bool pollEvent(Common::Event &event); bool pollEvent(Common::Event &event);
// Overloaded from SDL backend (mouse and new scaler handling) // 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: protected:

View file

@ -26,6 +26,9 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL #define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "backends/fs/stdiostream.h" #include "backends/fs/stdiostream.h"
#ifdef _WIN32_WCE
#include "backends/platform/wince/missing/fopen.h"
#endif
StdioStream::StdioStream(void *handle) : _handle(handle) { StdioStream::StdioStream(void *handle) : _handle(handle) {
assert(handle); assert(handle);

View file

@ -207,7 +207,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() {
ScalerProc *scalerProc; ScalerProc *scalerProc;
int scale1; 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 != NULL);
assert(_hwScreen->map->sw_data != NULL); assert(_hwScreen->map->sw_data != NULL);
#endif #endif

View file

@ -53,8 +53,8 @@ WINCESdlGraphicsManager::WINCESdlGraphicsManager(SdlEventSource *sdlEventSource,
_hasfocus(true), _zoomUp(false), _zoomDown(false) { _hasfocus(true), _zoomUp(false), _zoomDown(false) {
memset(&_mouseCurState, 0, sizeof(_mouseCurState)); memset(&_mouseCurState, 0, sizeof(_mouseCurState));
if (_isSmartphone) { if (_isSmartphone) {
_mouseCurState.x = 20; _cursorX = 20;
_mouseCurState.y = 20; _cursorY = 20;
} }
loadDeviceConfigurationElement("repeatTrigger", _keyRepeatTrigger, 200); loadDeviceConfigurationElement("repeatTrigger", _keyRepeatTrigger, 200);
@ -292,8 +292,8 @@ void WINCESdlGraphicsManager::move_cursor_right() {
} }
void WINCESdlGraphicsManager::retrieve_mouse_location(int &x, int &y) { void WINCESdlGraphicsManager::retrieve_mouse_location(int &x, int &y) {
x = _mouseCurState.x; x = _cursorX;
y = _mouseCurState.y; y = _cursorY;
x = x * _scaleFactorXm / _scaleFactorXd; x = x * _scaleFactorXm / _scaleFactorXd;
y = y * _scaleFactorYm / _scaleFactorYd; y = y * _scaleFactorYm / _scaleFactorYd;
@ -489,7 +489,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
int numRectsOut = 0; int numRectsOut = 0;
int16 routx, routy, routw, routh, stretch, shakestretch; int16 routx, routy, routw, routh, stretch, shakestretch;
assert(_hwscreen != NULL); assert(_hwScreen != NULL);
// bail if the application is minimized, be nice to OS // bail if the application is minimized, be nice to OS
if (!_hasfocus) { if (!_hasfocus) {
@ -502,9 +502,9 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
SDL_Rect blackrect = {0, 0, _videoMode.screenWidth *_scaleFactorXm / _scaleFactorXd, _newShakePos *_scaleFactorYm / _scaleFactorYd}; SDL_Rect blackrect = {0, 0, _videoMode.screenWidth *_scaleFactorXm / _scaleFactorXd, _newShakePos *_scaleFactorYm / _scaleFactorYd};
if (_videoMode.aspectRatioCorrection) if (_videoMode.aspectRatioCorrection)
blackrect.h = real2Aspect(blackrect.h - 1) + 1; blackrect.h = real2Aspect(blackrect.h - 1) + 1;
SDL_FillRect(_hwscreen, &blackrect, 0); SDL_FillRect(_hwScreen, &blackrect, 0);
_currentShakePos = _newShakePos; _currentShakePos = _newShakePos;
_forceFull = true; _forceRedraw = true;
} }
// Make sure the mouse is drawn, if it should be drawn. // Make sure the mouse is drawn, if it should be drawn.
@ -515,7 +515,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
if (_paletteDirtyEnd != 0) { if (_paletteDirtyEnd != 0) {
SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart, _paletteDirtyStart, _paletteDirtyEnd - _paletteDirtyStart); SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart, _paletteDirtyStart, _paletteDirtyEnd - _paletteDirtyStart);
_paletteDirtyEnd = 0; _paletteDirtyEnd = 0;
_forceFull = true; _forceRedraw = true;
} }
if (!_overlayVisible) { if (!_overlayVisible) {
@ -532,7 +532,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
} }
// Force a full redraw if requested // Force a full redraw if requested
if (_forceFull) { if (_forceRedraw) {
_numDirtyRects = 1; _numDirtyRects = 1;
_dirtyRectList[0].x = 0; _dirtyRectList[0].x = 0;
@ -569,10 +569,10 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
} }
SDL_LockSurface(srcSurf); SDL_LockSurface(srcSurf);
SDL_LockSurface(_hwscreen); SDL_LockSurface(_hwScreen);
srcPitch = srcSurf->pitch; srcPitch = srcSurf->pitch;
dstPitch = _hwscreen->pitch; dstPitch = _hwScreen->pitch;
for (r = _dirtyRectList, rout = _dirtyRectOut; r != last_rect; ++r) { 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) // 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, _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); r->w, r->h - _currentShakePos);
// add this rect to output // add this rect to output
@ -640,7 +640,7 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
} }
SDL_UnlockSurface(srcSurf); SDL_UnlockSurface(srcSurf);
SDL_UnlockSurface(_hwscreen); SDL_UnlockSurface(_hwScreen);
} }
// Add the toolbar if needed // Add the toolbar if needed
SDL_Rect toolbar_rect[1]; SDL_Rect toolbar_rect[1];
@ -670,9 +670,9 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
// Apply the appropriate scaler // Apply the appropriate scaler
SDL_LockSurface(toolbarSurface); SDL_LockSurface(toolbarSurface);
SDL_LockSurface(_hwscreen); SDL_LockSurface(_hwScreen);
srcPitch = toolbarSurface->pitch; srcPitch = toolbarSurface->pitch;
dstPitch = _hwscreen->pitch; dstPitch = _hwScreen->pitch;
toolbarScaler = _scalerProc; toolbarScaler = _scalerProc;
if (_videoMode.scaleFactor == 2) if (_videoMode.scaleFactor == 2)
@ -680,10 +680,10 @@ void WINCESdlGraphicsManager::internUpdateScreen() {
else if (_videoMode.scaleFactor == 3) else if (_videoMode.scaleFactor == 3)
toolbarScaler = Normal3x; toolbarScaler = Normal3x;
toolbarScaler((byte *)toolbarSurface->pixels, srcPitch, 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); dstPitch, toolbar_rect[0].w, toolbar_rect[0].h);
SDL_UnlockSurface(toolbarSurface); SDL_UnlockSurface(toolbarSurface);
SDL_UnlockSurface(_hwscreen); SDL_UnlockSurface(_hwScreen);
// And blit it // And blit it
toolbar_rect[0].y = _toolbarHandler.getOffset(); 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].w = toolbar_rect[0].w * _scaleFactorXm / _scaleFactorXd;
toolbar_rect[0].h = toolbar_rect[0].h * _scaleFactorYm / _scaleFactorYd; 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 drawToolbarMouse(toolbarSurface, false); // undraw toolbar mouse
} }
// Finally, blit all our changes to the screen // Finally, blit all our changes to the screen
if (numRectsOut > 0) if (numRectsOut > 0)
SDL_UpdateRects(_hwscreen, numRectsOut, _dirtyRectOut); SDL_UpdateRects(_hwScreen, numRectsOut, _dirtyRectOut);
_numDirtyRects = 0; _numDirtyRects = 0;
_forceFull = false; _forceRedraw = false;
} }
bool WINCESdlGraphicsManager::setGraphicsMode(int mode) { bool WINCESdlGraphicsManager::setGraphicsMode(int mode) {
@ -809,7 +809,7 @@ bool WINCESdlGraphicsManager::setGraphicsMode(int mode) {
_scaleFactorYd = 1; _scaleFactorYd = 1;
} }
_forceFull = true; _forceRedraw = true;
if (oldScaleFactorXm != _scaleFactorXm || if (oldScaleFactorXm != _scaleFactorXm ||
oldScaleFactorXd != _scaleFactorXd || oldScaleFactorXd != _scaleFactorXd ||
@ -830,7 +830,7 @@ bool WINCESdlGraphicsManager::loadGFXMode() {
unsigned int flags = SDL_FULLSCREEN | SDL_SWSURFACE; unsigned int flags = SDL_FULLSCREEN | SDL_SWSURFACE;
_videoMode.fullscreen = true; // forced _videoMode.fullscreen = true; // forced
_forceFull = true; _forceRedraw = true;
_tmpscreen = NULL; _tmpscreen = NULL;
@ -862,32 +862,32 @@ bool WINCESdlGraphicsManager::loadGFXMode() {
default: default:
flags |= SDL_PORTRTVIDEO; 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()); warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
g_system->quit(); g_system->quit();
} }
// see what orientation sdl finally accepted // see what orientation sdl finally accepted
if (_hwscreen->flags & SDL_PORTRTVIDEO) if (_hwScreen->flags & SDL_PORTRTVIDEO)
_orientationLandscape = _newOrientation = 0; _orientationLandscape = _newOrientation = 0;
else if (_hwscreen->flags & SDL_LANDSCVIDEO) else if (_hwScreen->flags & SDL_LANDSCVIDEO)
_orientationLandscape = _newOrientation = 1; _orientationLandscape = _newOrientation = 1;
else else
_orientationLandscape = _newOrientation = 2; _orientationLandscape = _newOrientation = 2;
// Create the surface used for the graphics in 16 bit before scaling, and also the overlay // Create the surface used for the graphics in 16 bit before scaling, and also the overlay
// Distinguish 555 and 565 mode // Distinguish 555 and 565 mode
if (_hwscreen->format->Rmask == 0x7C00) if (_hwScreen->format->Rmask == 0x7C00)
InitScalers(555); InitScalers(555);
else else
InitScalers(565); InitScalers(565);
_overlayFormat = convertSDLPixelFormat(_hwscreen->format); _overlayFormat = convertSDLPixelFormat(_hwScreen->format);
// Need some extra bytes around when using 2xSaI // 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) if (_tmpscreen == NULL)
error("_tmpscreen creation failed (%s)", SDL_GetError()); error("_tmpscreen creation failed (%s)", SDL_GetError());
@ -912,14 +912,14 @@ bool WINCESdlGraphicsManager::loadGFXMode() {
// Toolbar // Toolbar
_toolbarHighDrawn = false; _toolbarHighDrawn = false;
uint16 *toolbar_screen = (uint16 *)calloc(320 * 40, sizeof(uint16)); // *not* leaking memory here 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) if (_toolbarLow == NULL)
error("_toolbarLow failed (%s)", SDL_GetError()); error("_toolbarLow failed (%s)", SDL_GetError());
if (_videoMode.screenHeight > 240) { if (_videoMode.screenHeight > 240) {
uint16 *toolbar_screen_high = (uint16 *)calloc(640 * 80, sizeof(uint16)); 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) if (_toolbarHigh == NULL)
error("_toolbarHigh failed (%s)", SDL_GetError()); error("_toolbarHigh failed (%s)", SDL_GetError());
@ -938,9 +938,9 @@ void WINCESdlGraphicsManager::unloadGFXMode() {
_screen = NULL; _screen = NULL;
} }
if (_hwscreen) { if (_hwScreen) {
SDL_FreeSurface(_hwscreen); SDL_FreeSurface(_hwScreen);
_hwscreen = NULL; _hwScreen = NULL;
} }
if (_tmpscreen) { if (_tmpscreen) {
@ -961,7 +961,7 @@ bool WINCESdlGraphicsManager::hotswapGFXMode() {
SDL_Surface *old_tmpscreen2 = _tmpscreen2; SDL_Surface *old_tmpscreen2 = _tmpscreen2;
// Release the HW screen surface // Release the HW screen surface
SDL_FreeSurface(_hwscreen); SDL_FreeSurface(_hwScreen);
// Release toolbars // Release toolbars
free(_toolbarLow->pixels); free(_toolbarLow->pixels);
@ -1009,10 +1009,10 @@ bool WINCESdlGraphicsManager::hotswapGFXMode() {
} }
bool WINCESdlGraphicsManager::saveScreenshot(const char *filename) { bool WINCESdlGraphicsManager::saveScreenshot(const char *filename) {
assert(_hwscreen != NULL); assert(_hwScreen != NULL);
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
SDL_SaveBMP(_hwscreen, filename); SDL_SaveBMP(_hwScreen, filename);
return true; return true;
} }
@ -1168,10 +1168,10 @@ void WINCESdlGraphicsManager::transformMouseCoordinates(Common::Point &point) {
} }
void WINCESdlGraphicsManager::setMousePos(int x, int y) { void WINCESdlGraphicsManager::setMousePos(int x, int y) {
if (x != _mouseCurState.x || y != _mouseCurState.y) { if (x != _cursorX || y != _cursorY) {
undrawMouse(); undrawMouse();
_mouseCurState.x = x; _cursorX = x;
_mouseCurState.y = y; _cursorY = y;
updateScreen(); updateScreen();
} }
} }
@ -1203,7 +1203,7 @@ void WINCESdlGraphicsManager::hideOverlay() {
undrawMouse(); undrawMouse();
_overlayVisible = false; _overlayVisible = false;
clearOverlay(); clearOverlay();
_forceFull = true; _forceRedraw = true;
} }
void WINCESdlGraphicsManager::blitCursor() { void WINCESdlGraphicsManager::blitCursor() {
@ -1214,8 +1214,8 @@ void WINCESdlGraphicsManager::drawToolbarMouse(SDL_Surface *surf, bool draw) {
if (!_mouseData || !_usesEmulatedMouse) if (!_mouseData || !_usesEmulatedMouse)
return; return;
int x = _mouseCurState.x - _mouseHotspotX; int x = _cursorX - _mouseHotspotX;
int y = _mouseCurState.y - _mouseHotspotY - _toolbarHandler.getOffset(); int y = _cursorY - _mouseHotspotY - _toolbarHandler.getOffset();
int w = _mouseCurState.w; int w = _mouseCurState.w;
int h = _mouseCurState.h; int h = _mouseCurState.h;
byte color; byte color;
@ -1272,7 +1272,7 @@ void WINCESdlGraphicsManager::drawToolbarMouse(SDL_Surface *surf, bool draw) {
} }
void WINCESdlGraphicsManager::warpMouse(int x, int y) { 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(x * _scaleFactorXm / _scaleFactorXd, y * _scaleFactorYm / _scaleFactorYd);
// SDL_WarpMouse() generates a mouse movement event, so // SDL_WarpMouse() generates a mouse movement event, so
@ -1291,11 +1291,11 @@ void WINCESdlGraphicsManager::unlockScreen() {
} }
void WINCESdlGraphicsManager::internDrawMouse() { void WINCESdlGraphicsManager::internDrawMouse() {
if (!_mouseNeedsRedraw || !_mouseVisible || !_mouseData) if (!_cursorNeedsRedraw || !_cursorVisible || !_mouseData)
return; return;
int x = _mouseCurState.x - _mouseHotspotX; int x = _cursorX - _mouseHotspotX;
int y = _mouseCurState.y - _mouseHotspotY; int y = _cursorY - _mouseHotspotY;
int w = _mouseCurState.w; int w = _mouseCurState.w;
int h = _mouseCurState.h; int h = _mouseCurState.h;
byte color; byte color;
@ -1376,17 +1376,17 @@ void WINCESdlGraphicsManager::internDrawMouse() {
SDL_UnlockSurface(_overlayVisible ? _overlayscreen : _screen); SDL_UnlockSurface(_overlayVisible ? _overlayscreen : _screen);
// Finally, set the flag to indicate the mouse has been drawn // Finally, set the flag to indicate the mouse has been drawn
_mouseNeedsRedraw = false; _cursorNeedsRedraw = false;
} }
void WINCESdlGraphicsManager::undrawMouse() { void WINCESdlGraphicsManager::undrawMouse() {
assert(_transactionMode == kTransactionNone); assert(_transactionMode == kTransactionNone);
if (_mouseNeedsRedraw) if (_cursorNeedsRedraw)
return; return;
int old_mouse_x = _mouseCurState.x - _mouseHotspotX; int old_mouse_x = _cursorX - _mouseHotspotX;
int old_mouse_y = _mouseCurState.y - _mouseHotspotY; int old_mouse_y = _cursorY - _mouseHotspotY;
int old_mouse_w = _mouseCurState.w; int old_mouse_w = _mouseCurState.w;
int old_mouse_h = _mouseCurState.h; int old_mouse_h = _mouseCurState.h;
@ -1435,31 +1435,31 @@ void WINCESdlGraphicsManager::undrawMouse() {
SDL_UnlockSurface(_overlayVisible ? _overlayscreen : _screen); SDL_UnlockSurface(_overlayVisible ? _overlayscreen : _screen);
_mouseNeedsRedraw = true; _cursorNeedsRedraw = true;
} }
void WINCESdlGraphicsManager::drawMouse() { void WINCESdlGraphicsManager::drawMouse() {
if (!(_toolbarHandler.visible() && _mouseCurState.y >= _toolbarHandler.getOffset() && !_usesEmulatedMouse) && !_forceHideMouse) if (!(_toolbarHandler.visible() && _cursorY >= _toolbarHandler.getOffset() && !_usesEmulatedMouse) && !_forceHideMouse)
internDrawMouse(); internDrawMouse();
} }
bool WINCESdlGraphicsManager::showMouse(bool visible) { bool WINCESdlGraphicsManager::showMouse(bool visible) {
if (_mouseVisible == visible) if (_cursorVisible == visible)
return visible; return visible;
if (visible == false) if (visible == false)
undrawMouse(); undrawMouse();
bool last = _mouseVisible; bool last = _cursorVisible;
_mouseVisible = visible; _cursorVisible = visible;
_mouseNeedsRedraw = true; _cursorNeedsRedraw = true;
return last; return last;
} }
void WINCESdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool mouseRect) { void WINCESdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool mouseRect) {
if (_forceFull || _paletteDirtyEnd) if (_forceRedraw || _paletteDirtyEnd)
return; return;
SurfaceSdlGraphicsManager::addDirtyRect(x, y, w, h, false); SurfaceSdlGraphicsManager::addDirtyRect(x, y, w, h, false);

View file

@ -27,6 +27,7 @@
#include "common/config-manager.h" #include "common/config-manager.h"
#include "backends/platform/wince/wince-sdl.h" #include "backends/platform/wince/wince-sdl.h"
#include "backends/platform/wince/missing/fopen.h"
#include "backends/mixer/wincesdl/wincesdl-mixer.h" #include "backends/mixer/wincesdl/wincesdl-mixer.h"
#include "common/system.h" #include "common/system.h"
#include "common/textconsole.h" #include "common/textconsole.h"

View file

@ -23,6 +23,8 @@
#ifndef CEDEVICE_H #ifndef CEDEVICE_H
#define CEDEVICE_H #define CEDEVICE_H
#include <windows.h>
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/system.h" #include "common/system.h"
#include "common/str.h" #include "common/str.h"

View file

@ -95,7 +95,7 @@ void CELauncherDialog::addGame() {
updateListing(); updateListing();
selectTarget(newTarget); selectTarget(newTarget);
} }
draw(); g_gui.scheduleTopDialogRedraw();
} else } else
GUILauncherDialog::addGame(); GUILauncherDialog::addGame();
} }

View file

@ -23,6 +23,8 @@
#ifndef CEGUI_GUIELEMENT_H #ifndef CEGUI_GUIELEMENT_H
#define CEGUI_GUIELEMENT_H #define CEGUI_GUIELEMENT_H
#include <windows.h>
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/system.h" #include "common/system.h"

View file

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

View file

@ -1 +1,4 @@
/* Header is not present in Windows CE SDK */ /* Header is not present in Windows CE SDK */
extern int errno;
#define EINTR 4

View file

@ -1,11 +1,11 @@
/* Header is not present in Windows CE SDK */ /* Header is not present in Windows CE SDK */
extern "C" {
/* This stuff will live here until port configuration file is in place */ /* This stuff will live here until port configuration file is in place */
#define strdup _strdup
#ifndef _FILE_DEFINED #ifndef _FILE_DEFINED
typedef void FILE; typedef void FILE;
#define _FILE_DEFINED #define _FILE_DEFINED
#endif #endif
FILE *wce_fopen(const char *fname, const char *fmode); FILE *wce_fopen(const char *fname, const char *fmode);
#define fopen wce_fopen #define fopen wce_fopen
}

View file

@ -36,8 +36,6 @@
#include <stdio.h> #include <stdio.h>
#include "common/debug.h" #include "common/debug.h"
char *strdup(const char *strSource);
#ifdef __GNUC__ #ifdef __GNUC__
#define EXT_C extern "C" #define EXT_C extern "C"
#else #else
@ -46,6 +44,10 @@ char *strdup(const char *strSource);
// common missing functions required by both gcc and evc // 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, void *bsearch(const void *key, const void *base, size_t nmemb,
size_t size, int (*compar)(const void *, const void *)) { size_t size, int (*compar)(const void *, const void *)) {
// Perform binary search // Perform binary search
@ -68,7 +70,7 @@ void *bsearch(const void *key, const void *base, size_t nmemb,
static char cwd[MAX_PATH + 1] = ""; 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]; TCHAR fileUnc[MAX_PATH + 1];
char *plast; char *plast;
@ -91,7 +93,7 @@ EXT_C char *getcwd(char *buffer, int maxlen) {
#undef GetCurrentDirectory #undef GetCurrentDirectory
#endif #endif
EXT_C void GetCurrentDirectory(int len, char *buf) { 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') if (!fname || fname[0] == '\0')
return NULL; return NULL;
if (fname[0] != '\\' && fname[0] != '/') { if (fname[0] != '\\' && fname[0] != '/') {
getcwd(fullname, MAX_PATH); wce_getcwd(fullname, MAX_PATH);
strcat(fullname, "\\"); strcat(fullname, "\\");
strcat(fullname, fname); strcat(fullname, fname);
return fopen(fullname, fmode); return fopen(fullname, fmode);
@ -128,7 +130,7 @@ int _access(const char *path, int mode) {
char fullname[MAX_PATH + 1]; char fullname[MAX_PATH + 1];
if (path[0] != '\\' && path[0] != '/') { if (path[0] != '\\' && path[0] != '/') {
getcwd(fullname, MAX_PATH); wce_getcwd(fullname, MAX_PATH);
strcat(fullname, "\\"); strcat(fullname, "\\");
strcat(fullname, path); strcat(fullname, path);
MultiByteToWideChar(CP_ACP, 0, fullname, -1, fname, sizeof(fname) / sizeof(TCHAR)); MultiByteToWideChar(CP_ACP, 0, fullname, -1, fname, sizeof(fname) / sizeof(TCHAR));
@ -179,20 +181,8 @@ int _access(const char *path, int mode) {
return -1; 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 // gcc build only functions follow
#else // defined(__GNUC__) #if defined(__GNUC__)
#ifndef __MINGW32CE__ #ifndef __MINGW32CE__
int islower(int c) { int islower(int c) {

View file

@ -5,7 +5,9 @@
#include <stdlib.h> #include <stdlib.h>
#ifndef __MINGW32CE__ #ifdef __MINGW32CE__
#include_next <time.h>
#else
struct tm { struct tm {
short tm_year; short tm_year;
short tm_mon; short tm_mon;

View file

@ -39,11 +39,9 @@
int isprint(int c); int isprint(int c);
int isspace(int c); int isspace(int c);
char *strrchr(const char *s, int c); char *strrchr(const char *s, int c);
char *strdup(const char *s);
void assert(void *expression); void assert(void *expression);
void assert(int expression); void assert(int expression);
long int strtol(const char *nptr, char **endptr, int base); long int strtol(const char *nptr, char **endptr, int base);
char *_strdup(const char *s);
char *strpbrk(const char *s, const char *accept); char *strpbrk(const char *s, const char *accept);
#endif #endif
@ -51,7 +49,6 @@
#ifndef __GNUC__ #ifndef __GNUC__
void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *)); 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; typedef int ptrdiff_t;
void GetCurrentDirectory(int len, char *buf); void GetCurrentDirectory(int len, char *buf);
#define INVALID_FILE_ATTRIBUTES 0xffffffff #define INVALID_FILE_ATTRIBUTES 0xffffffff
@ -60,18 +57,15 @@
#undef GetCurrentDirectory #undef GetCurrentDirectory
extern "C" void GetCurrentDirectory(int len, char *buf); extern "C" void GetCurrentDirectory(int len, char *buf);
#define snprintf _snprintf #define snprintf _snprintf
#define strdup _strdup
#define fopen wce_fopen #define fopen wce_fopen
#endif #endif
#include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <io.h> #include <io.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <mmsystem.h>
#include <ctype.h> #include <ctype.h>
//#include <direct.h> //#include <direct.h>
#include <new> #include <new>
@ -81,6 +75,9 @@
#endif #endif
int remove(const char *path); int remove(const char *path);
int _access(const char *path, int mode); int _access(const char *path, int mode);
extern "C" {
char *wce_getcwd(char *buf, int size);
}
void drawError(char *); void drawError(char *);

View file

@ -24,6 +24,9 @@
// Disable symbol overrides so that we can use system headers. // Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL #define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <windows.h>
#include "backends/platform/wince/missing/fopen.h"
#include "backends/platform/wince/wince-sdl.h" #include "backends/platform/wince/wince-sdl.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -163,7 +166,6 @@ int handleException(EXCEPTION_POINTERS *exceptionPointers) {
} }
#endif #endif
extern "C" char *getcwd(char *buf, int size);
int SDL_main(int argc, char **argv) { int SDL_main(int argc, char **argv) {
FILE *newfp = NULL; FILE *newfp = NULL;
#ifdef __GNUC__ #ifdef __GNUC__
@ -182,8 +184,8 @@ int SDL_main(int argc, char **argv) {
CEDevice::init(); CEDevice::init();
/* Redirect standard input and standard output */ /* Redirect standard input and standard output */
strcpy(stdout_fname, getcwd(NULL, MAX_PATH)); strcpy(stdout_fname, wce_getcwd(NULL, MAX_PATH));
strcpy(stderr_fname, getcwd(NULL, MAX_PATH)); strcpy(stderr_fname, wce_getcwd(NULL, MAX_PATH));
strcat(stdout_fname, STDOUT_FNAME); strcat(stdout_fname, STDOUT_FNAME);
strcat(stderr_fname, STDERR_FNAME); strcat(stderr_fname, STDERR_FNAME);
#ifndef __GNUC__ #ifndef __GNUC__
@ -279,7 +281,7 @@ int console_main(int argc, char *argv[]) {
appname = bufp; appname = bufp;
if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) { if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) {
error("WinMain() error: %d", SDL_GetError()); error("WinMain() error: %s", SDL_GetError());
return(FALSE); return(FALSE);
} }
@ -461,7 +463,7 @@ bool OSystem_WINCE3::isOzone() {
Common::String OSystem_WINCE3::getDefaultConfigFileName() { Common::String OSystem_WINCE3::getDefaultConfigFileName() {
char configFile[MAXPATHLEN]; char configFile[MAXPATHLEN];
strcpy(configFile, getcwd(NULL, MAX_PATH)); strcpy(configFile, wce_getcwd(NULL, MAX_PATH));
strcat(configFile, "\\"); strcat(configFile, "\\");
strcat(configFile, DEFAULT_CONFIG_FILE); strcat(configFile, DEFAULT_CONFIG_FILE);
return configFile; return configFile;

View file

@ -4,7 +4,7 @@ endif
ifdef DYNAMIC_MODULES ifdef DYNAMIC_MODULES
plugins: backends/platform/wince/stub.o backends/platform/wince/PocketSCUMM.o 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 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 $(CXX) -c $(srcdir)/backends/platform/wince/stub.cpp -o backends/platform/wince/stub.o

View file

@ -36,7 +36,7 @@
class Win32Plugin : public DynamicPlugin { class Win32Plugin : public DynamicPlugin {
private: private:
static const TCHAR* toUnicode(const char *x) { static const TCHAR* toUnicode(const char *x) {
#ifndef _WIN32_WCE #ifndef UNICODE
return (const TCHAR *)x; return (const TCHAR *)x;
#else #else
static TCHAR unicodeString[MAX_PATH]; static TCHAR unicodeString[MAX_PATH];
@ -50,11 +50,7 @@ protected:
void *_dlHandle; void *_dlHandle;
virtual VoidFunc findSymbol(const char *symbol) { virtual VoidFunc findSymbol(const char *symbol) {
#ifndef _WIN32_WCE
FARPROC func = GetProcAddress((HMODULE)_dlHandle, symbol);
#else
FARPROC func = GetProcAddress((HMODULE)_dlHandle, toUnicode(symbol)); FARPROC func = GetProcAddress((HMODULE)_dlHandle, toUnicode(symbol));
#endif
if (!func) if (!func)
debug("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str()); debug("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str());
@ -67,11 +63,7 @@ public:
bool loadPlugin() { bool loadPlugin() {
assert(!_dlHandle); assert(!_dlHandle);
#ifndef _WIN32_WCE
_dlHandle = LoadLibrary(_filename.c_str());
#else
_dlHandle = LoadLibrary(toUnicode(_filename.c_str())); _dlHandle = LoadLibrary(toUnicode(_filename.c_str()));
#endif
if (!_dlHandle) { if (!_dlHandle) {
debug("Failed loading plugin '%s' (error code %d)", _filename.c_str(), (int32) GetLastError()); debug("Failed loading plugin '%s' (error code %d)", _filename.c_str(), (int32) GetLastError());

View file

@ -35,10 +35,6 @@
#define GCC_ATLEAST(major, minor) 0 #define GCC_ATLEAST(major, minor) 0
#endif #endif
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
#define NONSTANDARD_PORT
#endif
#if defined(NONSTANDARD_PORT) #if defined(NONSTANDARD_PORT)
// Ports which need to perform #includes and #defines visible in // Ports which need to perform #includes and #defines visible in
@ -89,8 +85,6 @@
} }
#endif #endif
#if !defined(_WIN32_WCE)
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define NOGDICAPMASKS #define NOGDICAPMASKS
#define OEMRESOURCE #define OEMRESOURCE
@ -115,8 +109,6 @@
#define NOSOUND #define NOSOUND
#define NODRAWTEXT #define NODRAWTEXT
#endif
#endif #endif
#if defined(__QNXNTO__) #if defined(__QNXNTO__)

5
configure vendored
View file

@ -3431,7 +3431,9 @@ if test -n "$_host"; then
;; ;;
wince) wince)
append_var LDFLAGS "-Wl,--stack,65536" append_var LDFLAGS "-Wl,--stack,65536"
_tremolo=yes if test "$_tremor" = auto; then
_tremolo=yes
fi
_backend="wince" _backend="wince"
_detectlang=yes _detectlang=yes
_mt32emu=no _mt32emu=no
@ -3625,6 +3627,7 @@ case $_backend in
append_var INCLUDES '-I$(srcdir)/backends/platform/wince' append_var INCLUDES '-I$(srcdir)/backends/platform/wince'
append_var INCLUDES '-I$(srcdir)/backends/platform/wince/CEgui' append_var INCLUDES '-I$(srcdir)/backends/platform/wince/CEgui'
append_var INCLUDES '-I$(srcdir)/backends/platform/wince/CEkeys' append_var INCLUDES '-I$(srcdir)/backends/platform/wince/CEkeys'
append_var INCLUDES '-I$(srcdir)/backends/platform/wince/missing'
append_var LIBS "-static -lSDL" append_var LIBS "-static -lSDL"
_sdl=yes _sdl=yes
_sdlversion=1.2.0 _sdlversion=1.2.0

View file

@ -30,10 +30,6 @@
#include "agos/agos.h" #include "agos/agos.h"
#include "agos/intern.h" #include "agos/intern.h"
#ifdef _WIN32_WCE
extern bool isSmartphone();
#endif
namespace AGOS { namespace AGOS {
void AGOSEngine::setupOpcodes() { void AGOSEngine::setupOpcodes() {

View file

@ -29,10 +29,6 @@
#include "agos/intern.h" #include "agos/intern.h"
#include "agos/sound.h" #include "agos/sound.h"
#ifdef _WIN32_WCE
extern bool isSmartphone();
#endif
namespace AGOS { namespace AGOS {
#define OPCODE(x) _OPCODE(AGOSEngine_Simon1, x) #define OPCODE(x) _OPCODE(AGOSEngine_Simon1, x)

View file

@ -72,7 +72,7 @@ protected:
int _languageIndexSize; int _languageIndexSize;
char _lastStringTag[12+1]; char _lastStringTag[12+1];
#if defined(__SYMBIAN32__) || defined(_WIN32_WCE) // for some reason VC6 cannot find the base class TextObject #if defined(__SYMBIAN32__) // for some reason VC6 cannot find the base class TextObject
struct SubtitleText { struct SubtitleText {
int16 xpos, ypos; int16 xpos, ypos;
byte color; byte color;

View file

@ -47,13 +47,6 @@
#include "engines/util.h" #include "engines/util.h"
#ifdef _WIN32_WCE
extern bool toolbar_drawn;
extern bool draw_keyboard;
#endif
/* /*
At the beginning the reverse engineers were happy, and did rejoice at At the beginning the reverse engineers were happy, and did rejoice at
their task, for the engine before them did shineth and was full of their task, for the engine before them did shineth and was full of