diff options
Diffstat (limited to 'backends')
43 files changed, 274 insertions, 214 deletions
diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h index 0d6fa30418..24397228e6 100644 --- a/backends/graphics/graphics.h +++ b/backends/graphics/graphics.h @@ -60,7 +60,7 @@ public: virtual int16 getWidth() = 0; virtual void setPalette(const byte *colors, uint start, uint num) = 0; virtual void grabPalette(byte *colors, uint start, uint num) = 0; - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0; + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0; virtual Graphics::Surface *lockScreen() = 0; virtual void unlockScreen() = 0; virtual void fillScreen(uint32 col) = 0; @@ -73,14 +73,14 @@ public: virtual void hideOverlay() = 0; virtual Graphics::PixelFormat getOverlayFormat() const = 0; virtual void clearOverlay() = 0; - virtual void grabOverlay(OverlayColor *buf, int pitch) = 0; - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h)= 0; + virtual void grabOverlay(void *buf, int pitch) = 0; + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h)= 0; virtual int16 getOverlayHeight() = 0; virtual int16 getOverlayWidth() = 0; virtual bool showMouse(bool visible) = 0; virtual void warpMouse(int x, int y) = 0; - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0; + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0; virtual void setCursorPalette(const byte *colors, uint start, uint num) = 0; virtual void displayMessageOnOSD(const char *msg) {} diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h index 2f8baae3e8..276be7d3fa 100644 --- a/backends/graphics/null/null-graphics.h +++ b/backends/graphics/null/null-graphics.h @@ -58,7 +58,7 @@ public: int16 getWidth() { return 0; } void setPalette(const byte *colors, uint start, uint num) {} void grabPalette(byte *colors, uint start, uint num) {} - void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {} + void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {} Graphics::Surface *lockScreen() { return NULL; } void unlockScreen() {} void fillScreen(uint32 col) {} @@ -71,14 +71,14 @@ public: void hideOverlay() {} Graphics::PixelFormat getOverlayFormat() const { return Graphics::PixelFormat(); } void clearOverlay() {} - void grabOverlay(OverlayColor *buf, int pitch) {} - void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {} + void grabOverlay(void *buf, int pitch) {} + void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {} int16 getOverlayHeight() { return 0; } int16 getOverlayWidth() { return 0; } bool showMouse(bool visible) { return !visible; } void warpMouse(int x, int y) {} - void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) {} + void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) {} void setCursorPalette(const byte *colors, uint start, uint num) {} }; diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 8449048997..dce902d894 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -349,14 +349,14 @@ void OpenGLGraphicsManager::grabPalette(byte *colors, uint start, uint num) { memcpy(colors, _gamePalette + start * 3, num * 3); } -void OpenGLGraphicsManager::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OpenGLGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { assert(x >= 0 && x < _screenData.w); assert(y >= 0 && y < _screenData.h); assert(h > 0 && y + h <= _screenData.h); assert(w > 0 && x + w <= _screenData.w); // Copy buffer data to game screen internal buffer - const byte *src = buf; + const byte *src = (const byte *)buf; byte *dst = (byte *)_screenData.pixels + y * _screenData.pitch + x * _screenData.format.bytesPerPixel; for (int i = 0; i < h; i++) { memcpy(dst, src, w * _screenData.format.bytesPerPixel); @@ -467,33 +467,35 @@ void OpenGLGraphicsManager::clearOverlay() { _overlayNeedsRedraw = true; } -void OpenGLGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) { - assert(_overlayData.format.bytesPerPixel == sizeof(buf[0])); +void OpenGLGraphicsManager::grabOverlay(void *buf, int pitch) { const byte *src = (byte *)_overlayData.pixels; + byte *dst = (byte *)buf; for (int i = 0; i < _overlayData.h; i++) { // Copy overlay data to buffer - memcpy(buf, src, _overlayData.pitch); - buf += pitch; + memcpy(dst, src, _overlayData.pitch); + dst += pitch; src += _overlayData.pitch; } } -void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OpenGLGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { assert(_transactionMode == kTransactionNone); if (_overlayTexture == NULL) return; + const byte *src = (const byte *)buf; + // Clip the coordinates if (x < 0) { w += x; - buf -= x; + src -= x * 2; x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -507,11 +509,10 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch return; // Copy buffer data to internal overlay surface - const byte *src = (const byte *)buf; byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch; for (int i = 0; i < h; i++) { memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel); - src += pitch * sizeof(buf[0]); + src += pitch; dst += _overlayData.pitch; } @@ -591,7 +592,7 @@ void OpenGLGraphicsManager::warpMouse(int x, int y) { setInternalMousePosition(scaledX, scaledY); } -void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { +void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { #ifdef USE_RGB_COLOR if (format) _cursorFormat = *format; diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 956722c08f..9d8d418d11 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -84,7 +84,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); virtual void fillScreen(uint32 col); @@ -97,14 +97,14 @@ public: virtual void hideOverlay(); virtual Graphics::PixelFormat getOverlayFormat() const; virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual void displayMessageOnOSD(const char *msg); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 652c08dc45..fb964d6951 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -1227,9 +1227,9 @@ void SurfaceSdlGraphicsManager::setAspectRatioCorrection(bool enable) { } } -void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) { +void SurfaceSdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { assert(_transactionMode == kTransactionNone); - assert(src); + assert(buf); if (_screen == NULL) { warning("SurfaceSdlGraphicsManager::copyRectToScreen: _screen == NULL"); @@ -1252,8 +1252,9 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int #ifdef USE_RGB_COLOR byte *dst = (byte *)_screen->pixels + y * _screen->pitch + x * _screenFormat.bytesPerPixel; if (_videoMode.screenWidth == w && pitch == _screen->pitch) { - memcpy(dst, src, h*pitch); + memcpy(dst, buf, h*pitch); } else { + const byte *src = (const byte *)buf; do { memcpy(dst, src, w * _screenFormat.bytesPerPixel); src += pitch; @@ -1263,8 +1264,9 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int #else byte *dst = (byte *)_screen->pixels + y * _screen->pitch + x; if (_screen->pitch == pitch && pitch == w) { - memcpy(dst, src, h*w); + memcpy(dst, buf, h*w); } else { + const byte *src = (const byte *)buf; do { memcpy(dst, src, w); src += pitch; @@ -1595,7 +1597,7 @@ void SurfaceSdlGraphicsManager::clearOverlay() { _forceFull = true; } -void SurfaceSdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) { +void SurfaceSdlGraphicsManager::grabOverlay(void *buf, int pitch) { assert(_transactionMode == kTransactionNone); if (_overlayscreen == NULL) @@ -1605,31 +1607,35 @@ void SurfaceSdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) { error("SDL_LockSurface failed: %s", SDL_GetError()); byte *src = (byte *)_overlayscreen->pixels; + byte *dst = (byte *)buf; int h = _videoMode.overlayHeight; do { - memcpy(buf, src, _videoMode.overlayWidth * 2); + memcpy(dst, src, _videoMode.overlayWidth * 2); src += _overlayscreen->pitch; - buf += pitch; + dst += pitch; } while (--h); SDL_UnlockSurface(_overlayscreen); } -void SurfaceSdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void SurfaceSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { assert(_transactionMode == kTransactionNone); if (_overlayscreen == NULL) return; + const byte *src = (const byte *)buf; + // Clip the coordinates if (x < 0) { w += x; - buf -= x; + src -= x * 2; x = 0; } if (y < 0) { - h += y; buf -= y * pitch; + h += y; + src -= y * pitch; y = 0; } @@ -1652,9 +1658,9 @@ void SurfaceSdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int p byte *dst = (byte *)_overlayscreen->pixels + y * _overlayscreen->pitch + x * 2; do { - memcpy(dst, buf, w * 2); + memcpy(dst, src, w * 2); dst += _overlayscreen->pitch; - buf += pitch; + src += pitch; } while (--h); SDL_UnlockSurface(_overlayscreen); @@ -1713,7 +1719,7 @@ void SurfaceSdlGraphicsManager::warpMouse(int x, int y) { } } -void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { +void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { #ifdef USE_RGB_COLOR if (!format) _cursorFormat = Graphics::PixelFormat::createFormatCLUT8(); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index 32fb219bcd..21444cc25d 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -111,7 +111,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); virtual void fillScreen(uint32 col); @@ -124,14 +124,14 @@ public: virtual void hideOverlay(); virtual Graphics::PixelFormat getOverlayFormat() const { return _overlayFormat; } virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight() { return _videoMode.overlayHeight; } virtual int16 getOverlayWidth() { return _videoMode.overlayWidth; } virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); virtual void setCursorPalette(const byte *colors, uint start, uint num); #ifdef USE_OSD diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp index bb79813f3b..f075f8cf8a 100644 --- a/backends/graphics/wincesdl/wincesdl-graphics.cpp +++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp @@ -1023,22 +1023,24 @@ bool WINCESdlGraphicsManager::saveScreenshot(const char *filename) { return true; } -void WINCESdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void WINCESdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { assert(_transactionMode == kTransactionNone); if (_overlayscreen == NULL) return; + const byte *src = (const byte *)buf; + // Clip the coordinates if (x < 0) { w += x; - buf -= x; + src -= x * 2; x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -1063,23 +1065,24 @@ void WINCESdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pit byte *dst = (byte *)_overlayscreen->pixels + y * _overlayscreen->pitch + x * 2; do { - memcpy(dst, buf, w * 2); + memcpy(dst, src, w * 2); dst += _overlayscreen->pitch; - buf += pitch; + src += pitch; } while (--h); SDL_UnlockSurface(_overlayscreen); } -void WINCESdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) { +void WINCESdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { assert(_transactionMode == kTransactionNone); - assert(src); + assert(buf); if (_screen == NULL) return; Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends + const byte *src = (const byte *)buf; /* Clip the coordinates */ if (x < 0) { w += x; @@ -1128,7 +1131,7 @@ void WINCESdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x SDL_UnlockSurface(_screen); } -void WINCESdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { +void WINCESdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { undrawMouse(); if (w == 0 || h == 0) diff --git a/backends/graphics/wincesdl/wincesdl-graphics.h b/backends/graphics/wincesdl/wincesdl-graphics.h index 7cff8a16d9..2897ca5f40 100644 --- a/backends/graphics/wincesdl/wincesdl-graphics.h +++ b/backends/graphics/wincesdl/wincesdl-graphics.h @@ -73,9 +73,9 @@ public: void internDrawMouse(); void undrawMouse(); bool showMouse(bool visible); - void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // overloaded by CE backend - void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); - void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME) + void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // overloaded by CE backend + void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); + void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME) Graphics::Surface *lockScreen(); void unlockScreen(); void blitCursor(); diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index f133c65ed5..b46f33a2bc 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -124,7 +124,7 @@ PaletteManager *ModularBackend::getPaletteManager() { return _graphicsManager; } -void ModularBackend::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void ModularBackend::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { _graphicsManager->copyRectToScreen(buf, pitch, x, y, w, h); } @@ -171,11 +171,11 @@ void ModularBackend::clearOverlay() { _graphicsManager->clearOverlay(); } -void ModularBackend::grabOverlay(OverlayColor *buf, int pitch) { +void ModularBackend::grabOverlay(void *buf, int pitch) { _graphicsManager->grabOverlay(buf, pitch); } -void ModularBackend::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void ModularBackend::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { _graphicsManager->copyRectToOverlay(buf, pitch, x, y, w, h); } @@ -195,7 +195,7 @@ void ModularBackend::warpMouse(int x, int y) { _graphicsManager->warpMouse(x, y); } -void ModularBackend::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { +void ModularBackend::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { _graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format); } diff --git a/backends/modular-backend.h b/backends/modular-backend.h index 150c12c3c8..b43769c716 100644 --- a/backends/modular-backend.h +++ b/backends/modular-backend.h @@ -80,7 +80,7 @@ public: virtual int16 getHeight(); virtual int16 getWidth(); virtual PaletteManager *getPaletteManager(); - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); virtual void fillScreen(uint32 col); @@ -93,14 +93,14 @@ public: virtual void hideOverlay(); virtual Graphics::PixelFormat getOverlayFormat() const; virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); virtual void setCursorPalette(const byte *colors, uint start, uint num); //@} diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 902599d50f..0b31ee717c 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -554,6 +554,7 @@ void OSystem_Android::getTimeAndDate(TimeDate &td) const { td.tm_mday = tm.tm_mday; td.tm_mon = tm.tm_mon; td.tm_year = tm.tm_year; + td.tm_wday = tm.tm_wday; } void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s, diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 4dad1ee7ed..4b13ca4b0f 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -244,7 +244,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); @@ -257,8 +257,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); @@ -267,7 +267,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 304031b4ba..cd0fd88484 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -421,7 +421,7 @@ void OSystem_Android::grabPalette(byte *colors, uint start, uint num) { pf.colorToRGB(READ_UINT16(p), colors[0], colors[1], colors[2]); } -void OSystem_Android::copyRectToScreen(const byte *buf, int pitch, +void OSystem_Android::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { ENTER("%p, %d, %d, %d, %d, %d", buf, pitch, x, y, w, h); @@ -636,33 +636,32 @@ void OSystem_Android::clearOverlay() { _overlay_texture->fillBuffer(0); } -void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_Android::grabOverlay(void *buf, int pitch) { ENTER("%p, %d", buf, pitch); GLTHREADCHECK; const Graphics::Surface *surface = _overlay_texture->surface_const(); - assert(surface->format.bytesPerPixel == sizeof(buf[0])); + assert(surface->format.bytesPerPixel == sizeof(uint16)); + byte *dst = (byte *)buf; const byte *src = (const byte *)surface->pixels; uint h = surface->h; do { - memcpy(buf, src, surface->w * surface->format.bytesPerPixel); + memcpy(dst, src, surface->w * surface->format.bytesPerPixel); src += surface->pitch; - // This 'pitch' is pixels not bytes - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_Android::copyRectToOverlay(const OverlayColor *buf, int pitch, +void OSystem_Android::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { ENTER("%p, %d, %d, %d, %d, %d", buf, pitch, x, y, w, h); GLTHREADCHECK; - // This 'pitch' is pixels not bytes - _overlay_texture->updateBuffer(x, y, w, h, buf, pitch * sizeof(buf[0])); + _overlay_texture->updateBuffer(x, y, w, h, buf, pitch); } int16 OSystem_Android::getOverlayHeight() { @@ -685,7 +684,7 @@ bool OSystem_Android::showMouse(bool visible) { return true; } -void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h, +void OSystem_Android::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { @@ -741,7 +740,7 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h, byte *tmp = new byte[pitch * h]; // meh, a 16bit cursor without alpha bits... this is so silly - if (!crossBlit(tmp, buf, pitch, w * 2, w, h, + if (!crossBlit(tmp, (const byte *)buf, pitch, w * 2, w, h, _mouse_texture->getPixelFormat(), *format)) { LOGE("crossblit failed"); diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp index d284688068..816a6755fc 100644 --- a/backends/platform/bada/system.cpp +++ b/backends/platform/bada/system.cpp @@ -399,6 +399,11 @@ void BadaSystem::getTimeAndDate(TimeDate &td) const { td.tm_mday = currentTime.GetDay(); td.tm_mon = currentTime.GetMonth(); td.tm_year = currentTime.GetYear(); +#ifdef RELEASE_BUILD + #error getTimeAndDate() is not setting the day of the week +#else + td.tm_wday = 0; // FIXME +#endif } } diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index ffe003ea1d..d41839d961 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -127,7 +127,7 @@ public: // Draw a bitmap to screen. // The screen will not be updated to reflect the new bitmap - void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); @@ -142,7 +142,7 @@ public: void warpMouse(int x, int y); // Set the bitmap that's used when drawing the cursor. - void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); + void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // Replace the specified range of cursor the palette with new colors. void setCursorPalette(const byte *colors, uint start, uint num); @@ -172,8 +172,8 @@ public: void showOverlay(); void hideOverlay(); void clearOverlay(); - void grabOverlay(OverlayColor *buf, int pitch); - void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + void grabOverlay(void *buf, int pitch); + void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); } // Mutex handling diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index 3e3279f9c3..bec1fdae3a 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -213,6 +213,7 @@ void OSystem_Dreamcast::getTimeAndDate(TimeDate &td) const { td.tm_mday = t.tm_mday; td.tm_mon = t.tm_mon; td.tm_year = t.tm_year; + td.tm_wday = t.tm_wday; } Common::SeekableReadStream *OSystem_Dreamcast::createConfigReadStream() { diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index e4e9a94ec8..cc5798fc10 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -260,7 +260,7 @@ void OSystem_Dreamcast::initSize(uint w, uint h, const Graphics::PixelFormat *fo _devpoll = Timer(); } -void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int y, +void OSystem_Dreamcast::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { if (w<1 || h<1) @@ -269,10 +269,11 @@ void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int x<<=1; w<<=1; } unsigned char *dst = screen + y*SCREEN_W*2 + x; + const byte *src = (const byte *)buf; do { - memcpy(dst, buf, w); + memcpy(dst, src, w); dst += SCREEN_W*2; - buf += pitch; + src += pitch; } while (--h); _screen_dirty = true; } @@ -291,7 +292,7 @@ void OSystem_Dreamcast::warpMouse(int x, int y) _ms_cur_y = y; } -void OSystem_Dreamcast::setMouseCursor(const byte *buf, uint w, uint h, +void OSystem_Dreamcast::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { @@ -652,27 +653,29 @@ void OSystem_Dreamcast::clearOverlay() _overlay_dirty = true; } -void OSystem_Dreamcast::grabOverlay(OverlayColor *buf, int pitch) +void OSystem_Dreamcast::grabOverlay(void *buf, int pitch) { int h = OVL_H; unsigned short *src = overlay; + unsigned char *dst = (unsigned char *)buf; do { - memcpy(buf, src, OVL_W*sizeof(int16)); + memcpy(dst, src, OVL_W*sizeof(int16)); src += OVL_W; - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_Dreamcast::copyRectToOverlay(const OverlayColor *buf, int pitch, +void OSystem_Dreamcast::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { if (w<1 || h<1) return; unsigned short *dst = overlay + y*OVL_W + x; + const unsigned char *src = (const unsigned char *)buf; do { - memcpy(dst, buf, w*sizeof(int16)); + memcpy(dst, src, w*sizeof(int16)); dst += OVL_W; - buf += pitch; + src += pitch; } while (--h); _overlay_dirty = true; } diff --git a/backends/platform/dingux/README.DINGUX b/backends/platform/dingux/README.DINGUX index 04f0d30844..9e65d4c36d 100644 --- a/backends/platform/dingux/README.DINGUX +++ b/backends/platform/dingux/README.DINGUX @@ -29,10 +29,27 @@ file included into the scummvm directory you copied to the SD card, and then lau Building from binaries ============================== -* ToDO * +It's pretty simple if you are running Linux on an x86/amd64 machine: +1. Download and install the OpenDingux toolchain (http://www.treewalker.org/opendingux/) +2. Download ScummVM sources and uncompress them +3. Create a build directory and run configure specifying the correct library path. Eg. + mkdir build_dingux + LDFLAGS="-L/path-to-toolchain/usr/lib" ../path-to-scummvm-sources/configure --host=dingux --enable-plugins --default-dynamic + make +4. Prepare the distribution directory + make dingux-dist +5. Copy the distribution directory located in dingux-dist/scummvm to your SD card +6. Enjoy Kernel and rootfs WARNINGS ============================== + +*** A WARNING about the WARNING! *** +The info below should no longer be valid relating to the new OpenDingux (http://www.treewalker.org/opendingux/) +toolchain. When using OpenDingux you don't need custom kernels or libraries, +after some checking I will remove the following warnings and keep OpenDingux +as the only supported toolchain. + All the dingux root images (rootfs) i found floating on the net have broken tremor libraries, which make scummvm crash in a bad way. One solution is to replace the libraries in your rootfs by injecting these fixed ones: diff --git a/backends/platform/dingux/dingux.mk b/backends/platform/dingux/dingux.mk index 882078fe46..e0aca42856 100644 --- a/backends/platform/dingux/dingux.mk +++ b/backends/platform/dingux/dingux.mk @@ -28,3 +28,4 @@ endif $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/ $(CP) $(srcdir)/backends/platform/dingux/scummvm.gpe $(bundle_name)/ $(CP) $(srcdir)/backends/platform/dingux/README.DINGUX $(bundle_name)/ + $(CP) $(srcdir)/backends/platform/dingux/scummvm.png $(bundle_name)/ diff --git a/backends/platform/dingux/scummvm.png b/backends/platform/dingux/scummvm.png Binary files differnew file mode 100644 index 0000000000..128e59efc4 --- /dev/null +++ b/backends/platform/dingux/scummvm.png diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index a6b85f207f..a4b9c842fc 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -280,7 +280,7 @@ void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) { #define MISALIGNED16(ptr) (((u32) (ptr) & 1) != 0) -void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { if (!_graphicsEnable) return; if (w <= 1) return; if (h < 0) return; @@ -509,13 +509,13 @@ void OSystem_DS::clearOverlay() { // consolePrintf("clearovl\n"); } -void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_DS::grabOverlay(void *buf, int pitch) { // consolePrintf("grabovl\n") u16 *start = DS::get16BitBackBuffer(); for (int y = 0; y < 200; y++) { u16 *src = start + (y * 320); - u16 *dest = ((u16 *) (buf)) + (y * pitch); + u16 *dest = (u16 *)((u8 *)buf + (y * pitch)); for (int x = 0; x < 320; x++) { *dest++ = *src++; @@ -524,9 +524,9 @@ void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) { } -void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OSystem_DS::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { u16 *bg = (u16 *) DS::get16BitBackBuffer(); - const u16 *src = (const u16 *) buf; + const u8 *source = (const u8 *)buf; // if (x + w > 256) w = 256 - x; //if (x + h > 256) h = 256 - y; @@ -536,7 +536,7 @@ void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, in for (int dy = y; dy < y + h; dy++) { - + const u16 *src = (const u16 *)source; // Slow but save copy: for (int dx = x; dx < x + w; dx++) { @@ -546,7 +546,7 @@ void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, in //consolePrintf("%d,", *src); src++; } - src += (pitch - w); + source += pitch; // Fast but broken copy: (why?) /* @@ -580,7 +580,7 @@ bool OSystem_DS::showMouse(bool visible) { void OSystem_DS::warpMouse(int x, int y) { } -void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { +void OSystem_DS::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { if ((w > 0) && (w < 64) && (h > 0) && (h < 64)) { memcpy(_cursorImage, buf, w * h); _cursorW = w; @@ -690,6 +690,7 @@ void OSystem_DS::getTimeAndDate(TimeDate &td) const { td.tm_mday = t.tm_mday; td.tm_mon = t.tm_mon; td.tm_year = t.tm_year; + td.tm_wday = t.tm_wday; } FilesystemFactory *OSystem_DS::getFilesystemFactory() { diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 11b0988666..a6001da764 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -98,15 +98,15 @@ protected: public: void restoreHardwarePalette(); - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual void setShakePos(int shakeOffset); virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); } @@ -114,7 +114,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format); + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format); virtual bool pollEvent(Common::Event &event); virtual uint32 getMillis(); diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index 6935399c95..f9b2a81ce6 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -235,6 +235,7 @@ void OSystem_IPHONE::getTimeAndDate(TimeDate &td) const { td.tm_mday = t.tm_mday; td.tm_mon = t.tm_mon; td.tm_year = t.tm_year; + td.tm_wday = t.tm_wday; } Audio::Mixer *OSystem_IPHONE::getMixer() { diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index e06c7973ab..037125490d 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -143,7 +143,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); @@ -152,8 +152,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<5551>(); } @@ -161,7 +161,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL); + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL); virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual bool pollEvent(Common::Event &event); diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index ddfa8f5030..aa1856490f 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -161,18 +161,19 @@ void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) { } } -void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_IPHONE::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { //printf("copyRectToScreen(%p, %d, %i, %i, %i, %i)\n", buf, pitch, x, y, w, h); //Clip the coordinates + const byte *src = (const byte *)buf; if (x < 0) { w += x; - buf -= x; + src -= x; x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -193,11 +194,11 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, byte *dst = (byte *)_framebuffer.getBasePtr(x, y); if (_framebuffer.pitch == pitch && _framebuffer.w == w) { - memcpy(dst, buf, h * pitch); + memcpy(dst, src, h * pitch); } else { do { - memcpy(dst, buf, w * _framebuffer.format.bytesPerPixel); - buf += pitch; + memcpy(dst, src, w * _framebuffer.format.bytesPerPixel); + src += pitch; dst += _framebuffer.pitch; } while (--h); } @@ -308,31 +309,33 @@ void OSystem_IPHONE::clearOverlay() { dirtyFullOverlayScreen(); } -void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_IPHONE::grabOverlay(void *buf, int pitch) { //printf("grabOverlay()\n"); int h = _videoContext->overlayHeight; + byte *dst = (byte *)buf; const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0); do { - memcpy(buf, src, _videoContext->overlayWidth * sizeof(OverlayColor)); + memcpy(dst, src, _videoContext->overlayWidth * sizeof(uint16)); src += _videoContext->overlayTexture.pitch; - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OSystem_IPHONE::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { //printf("copyRectToOverlay(%p, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", (const void *)buf, pitch, x, y, w, h); + const byte *src = (const byte *)buf; //Clip the coordinates if (x < 0) { w += x; - buf -= x; + src -= x * sizeof(uint16); x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -351,8 +354,8 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x byte *dst = (byte *)_videoContext->overlayTexture.getBasePtr(x, y); do { - memcpy(dst, buf, w * sizeof(OverlayColor)); - buf += pitch; + memcpy(dst, src, w * sizeof(uint16)); + src += pitch; dst += _videoContext->overlayTexture.pitch; } while (--h); } @@ -398,7 +401,7 @@ void OSystem_IPHONE::dirtyFullOverlayScreen() { } } -void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { +void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { //printf("setMouseCursor(%p, %u, %u, %i, %i, %u, %d, %p)\n", (const void *)buf, w, h, hotspotX, hotspotY, keycolor, dontScale, (const void *)format); const Graphics::PixelFormat pixelFormat = format ? *format : Graphics::PixelFormat::createFormatCLUT8(); diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index b8519eeea6..249f72d8fc 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -81,7 +81,7 @@ protected: uint16 *_offscreen_hic; // Offscreen converted to 16bit surface uint8 *_offscreen_pal; // Offscreen with palette indexes - OverlayColor *_overlayBuffer; // Offscreen for the overlay (16 bit) + uint16 *_overlayBuffer; // Offscreen for the overlay (16 bit) uint16 *_screenPalette; // Array for palette entries (256 colors max) @@ -162,7 +162,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); @@ -171,8 +171,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual Graphics::PixelFormat getOverlayFormat() const { @@ -182,7 +182,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual bool pollEvent(Common::Event &event); diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index f36f7399e1..7d6f8f0b5c 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -95,7 +95,7 @@ OSystem_N64::OSystem_N64() { // Allocate memory for offscreen buffers _offscreen_hic = (uint16 *)memalign(8, _screenWidth * _screenHeight * 2); _offscreen_pal = (uint8 *)memalign(8, _screenWidth * _screenHeight); - _overlayBuffer = (uint16 *)memalign(8, _overlayWidth * _overlayHeight * sizeof(OverlayColor)); + _overlayBuffer = (uint16 *)memalign(8, _overlayWidth * _overlayHeight * sizeof(uint16)); _cursor_pal = NULL; _cursor_hic = NULL; @@ -108,7 +108,7 @@ OSystem_N64::OSystem_N64() { // Clean offscreen buffers memset(_offscreen_hic, 0, _screenWidth * _screenHeight * 2); memset(_offscreen_pal, 0, _screenWidth * _screenHeight); - memset(_overlayBuffer, 0, _overlayWidth * _overlayHeight * sizeof(OverlayColor)); + memset(_overlayBuffer, 0, _overlayWidth * _overlayHeight * sizeof(uint16)); // Default graphic mode _graphicMode = OVERS_NTSC_340X240; @@ -442,17 +442,18 @@ void OSystem_N64::setCursorPalette(const byte *colors, uint start, uint num) { _dirtyOffscreen = true; } -void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_N64::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { //Clip the coordinates + const byte *src = (const byte *)buf; if (x < 0) { w += x; - buf -= x; + src -= x; x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -472,14 +473,14 @@ void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int do { for (int hor = 0; hor < w; hor++) { - if (dst_pal[hor] != buf[hor]) { - uint16 color = _screenPalette[buf[hor]]; + if (dst_pal[hor] != src[hor]) { + uint16 color = _screenPalette[src[hor]]; dst_hicol[hor] = color; // Save image converted to 16-bit - dst_pal[hor] = buf[hor]; // Save palettized display + dst_pal[hor] = src[hor]; // Save palettized display } } - buf += pitch; + src += pitch; dst_pal += _screenWidth; dst_hicol += _screenWidth; } while (--h); @@ -666,7 +667,7 @@ void OSystem_N64::hideOverlay() { } void OSystem_N64::clearOverlay() { - memset(_overlayBuffer, 0, _overlayWidth * _overlayHeight * sizeof(OverlayColor)); + memset(_overlayBuffer, 0, _overlayWidth * _overlayHeight * sizeof(uint16)); uint8 skip_lines = (_screenHeight - _gameHeight) / 4; uint8 skip_pixels = (_screenWidth - _gameWidth) / 2; // Center horizontally the image @@ -682,28 +683,30 @@ void OSystem_N64::clearOverlay() { _dirtyOffscreen = true; } -void OSystem_N64::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_N64::grabOverlay(void *buf, int pitch) { int h = _overlayHeight; - OverlayColor *src = _overlayBuffer; + uint16 *src = _overlayBuffer; + byte *dst = (byte *)buf; do { - memcpy(buf, src, _overlayWidth * sizeof(OverlayColor)); + memcpy(dst, src, _overlayWidth * sizeof(uint16)); src += _overlayWidth; - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_N64::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OSystem_N64::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { + const byte *src = (const byte *)buf; //Clip the coordinates if (x < 0) { w += x; - buf -= x; + src -= x * sizeof(uint16); x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -719,14 +722,14 @@ void OSystem_N64::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i return; - OverlayColor *dst = _overlayBuffer + (y * _overlayWidth + x); + uint16 *dst = _overlayBuffer + (y * _overlayWidth + x); - if (_overlayWidth == pitch && pitch == w) { - memcpy(dst, buf, h * w * sizeof(OverlayColor)); + if (_overlayWidth == w && pitch == _overlayWidth * sizeof(uint16)) { + memcpy(dst, src, h * pitch); } else { do { - memcpy(dst, buf, w * sizeof(OverlayColor)); - buf += pitch; + memcpy(dst, src, w * sizeof(uint16)); + src += pitch; dst += _overlayWidth; } while (--h); } @@ -773,7 +776,7 @@ void OSystem_N64::warpMouse(int x, int y) { _dirtyOffscreen = true; } -void OSystem_N64::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { +void OSystem_N64::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { if (!w || !h) return; _mouseHotspotX = hotspotX; @@ -866,6 +869,7 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const { t.tm_mday = 1; t.tm_mon = 0; t.tm_year = 110; + t.tm_wday = 0; return; } diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 8df6198c38..f93166ef67 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -564,7 +564,7 @@ void Gs2dScreen::clearPrintfOverlay(void) { free(tmpBuf); } -void Gs2dScreen::copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h) { +void Gs2dScreen::copyOverlayRect(const byte *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h) { WaitSema(g_DmacSema); // warning("_overlayBuf [dst] = %x", _overlayBuf); @@ -601,7 +601,7 @@ void Gs2dScreen::clearOverlay(void) { SignalSema(g_DmacSema); } -void Gs2dScreen::grabOverlay(uint16 *buf, uint16 pitch) { +void Gs2dScreen::grabOverlay(byte *buf, uint16 pitch) { uint16 *src = _overlayBuf; for (uint32 cnt = 0; cnt < _height; cnt++) { memcpy(buf, src, _width * 2); diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h index 4fbb3fdef8..005dabc809 100644 --- a/backends/platform/ps2/Gs2dScreen.h +++ b/backends/platform/ps2/Gs2dScreen.h @@ -62,8 +62,8 @@ public: void updateScreen(void); void grabPalette(uint8 *pal, uint8 start, uint16 num); //- overlay routines - void copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h); - void grabOverlay(uint16 *buf, uint16 pitch); + void copyOverlayRect(const byte *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h); + void grabOverlay(byte *buf, uint16 pitch); void clearOverlay(void); void showOverlay(void); void hideOverlay(void); diff --git a/backends/platform/ps2/ps2time.cpp b/backends/platform/ps2/ps2time.cpp index 2c3275b2b2..1cddd230a0 100644 --- a/backends/platform/ps2/ps2time.cpp +++ b/backends/platform/ps2/ps2time.cpp @@ -105,8 +105,14 @@ void OSystem_PS2::readRtcTime(void) { g_day, g_month, g_year + 2000); } -void OSystem_PS2::getTimeAndDate(TimeDate &t) const { +// Tomohiko Sakamoto's 1993 algorithm for any Gregorian date +static int dayOfWeek(int y, int m, int d) { + static const int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }; + y -= m < 3; + return (y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7; +} +void OSystem_PS2::getTimeAndDate(TimeDate &t) const { uint32 currentSecs = g_timeSecs + (msecCount - g_lastTimeCheck) / 1000; if (currentSecs >= SECONDS_PER_DAY) { buildNewDate(+1); @@ -120,4 +126,5 @@ void OSystem_PS2::getTimeAndDate(TimeDate &t) const { t.tm_year = g_year + 100; t.tm_mday = g_day; t.tm_mon = g_month - 1; + t.tm_wday = dayOfWeek(t.tm_year, t.tm_mon, t.tm_mday); } diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 668ac93a07..5628658381 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -554,7 +554,7 @@ void OSystem_PS2::grabPalette(byte *colors, uint start, uint num) { _screen->grabPalette(colors, (uint8)start, (uint16)num); } -void OSystem_PS2::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_PS2::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { _screen->copyScreenRect((const uint8*)buf, pitch, x, y, w, h); } @@ -618,8 +618,8 @@ void OSystem_PS2::warpMouse(int x, int y) { _screen->setMouseXy(x, y); } -void OSystem_PS2::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { - _screen->setMouseOverlay(buf, w, h, hotspot_x, hotspot_y, keycolor); +void OSystem_PS2::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { + _screen->setMouseOverlay((const byte *)buf, w, h, hotspot_x, hotspot_y, keycolor); } void OSystem_PS2::showOverlay(void) { @@ -634,12 +634,12 @@ void OSystem_PS2::clearOverlay(void) { _screen->clearOverlay(); } -void OSystem_PS2::grabOverlay(OverlayColor *buf, int pitch) { - _screen->grabOverlay((uint16 *)buf, (uint16)pitch); +void OSystem_PS2::grabOverlay(void *buf, int pitch) { + _screen->grabOverlay((byte *)buf, (uint16)pitch); } -void OSystem_PS2::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { - _screen->copyOverlayRect((const uint16*)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h); +void OSystem_PS2::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { + _screen->copyOverlayRect((const byte *)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h); } Graphics::PixelFormat OSystem_PS2::getOverlayFormat(void) const { diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 7bbe061e42..99482d4da4 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -62,7 +62,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void setShakePos(int shakeOffset); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); @@ -72,15 +72,15 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayWidth(void); virtual int16 getOverlayHeight(void); virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = 0); + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = 0); virtual uint32 getMillis(); virtual void delayMillis(uint msecs); diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp index 2ee7ff5b74..bc252144fa 100644 --- a/backends/platform/psp/default_display_client.cpp +++ b/backends/platform/psp/default_display_client.cpp @@ -123,15 +123,15 @@ void Overlay::setSize(uint32 width, uint32 height) { _renderer.setDrawWholeBuffer(); // We need to let the renderer know how much to draw } -void Overlay::copyToArray(OverlayColor *buf, int pitch) { +void Overlay::copyToArray(void *buf, int pitch) { DEBUG_ENTER_FUNC(); - _buffer.copyToArray((byte *)buf, pitch * sizeof(OverlayColor)); // Change to bytes + _buffer.copyToArray((byte *)buf, pitch); // Change to bytes } -void Overlay::copyFromRect(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void Overlay::copyFromRect(const void *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); - _buffer.copyFromRect((byte *)buf, pitch * sizeof(OverlayColor), x, y, w, h); // Change to bytes + _buffer.copyFromRect((byte *)buf, pitch, x, y, w, h); // Change to bytes // debug //_buffer.print(0xFF); setDirty(); diff --git a/backends/platform/psp/default_display_client.h b/backends/platform/psp/default_display_client.h index 721a7e6fea..95c52e2352 100644 --- a/backends/platform/psp/default_display_client.h +++ b/backends/platform/psp/default_display_client.h @@ -69,8 +69,8 @@ public: bool allocate(); void setBytesPerPixel(uint32 size); void setSize(uint32 width, uint32 height); - void copyToArray(OverlayColor *buf, int pitch); - void copyFromRect(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + void copyToArray(void *buf, int pitch); + void copyFromRect(const void *buf, int pitch, int x, int y, int w, int h); }; /** diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index 10a732b1e3..c2ff84c7f5 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -302,7 +302,7 @@ void DisplayManager::init() { // Init overlay since we never change the size _overlay->deallocate(); - _overlay->setBytesPerPixel(sizeof(OverlayColor)); + _overlay->setBytesPerPixel(sizeof(uint16)); _overlay->setSize(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT); _overlay->allocate(); } diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 958a3a22c6..fb8c1c60bf 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -204,11 +204,11 @@ void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) { _cursor.clearKeyColor(); // Do we need this? } -void OSystem_PSP::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_PSP::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); _displayManager.waitUntilRenderFinished(); _pendingUpdate = false; - _screen.copyFromRect(buf, pitch, x, y, w, h); + _screen.copyFromRect((const byte *)buf, pitch, x, y, w, h); } Graphics::Surface *OSystem_PSP::lockScreen() { @@ -260,12 +260,12 @@ void OSystem_PSP::clearOverlay() { _overlay.clearBuffer(); } -void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_PSP::grabOverlay(void *buf, int pitch) { DEBUG_ENTER_FUNC(); _overlay.copyToArray(buf, pitch); } -void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OSystem_PSP::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); _displayManager.waitUntilRenderFinished(); _pendingUpdate = false; @@ -303,7 +303,7 @@ void OSystem_PSP::warpMouse(int x, int y) { _cursor.setXY(x, y); } -void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { +void OSystem_PSP::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { DEBUG_ENTER_FUNC(); _displayManager.waitUntilRenderFinished(); _pendingUpdate = false; @@ -320,7 +320,7 @@ void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, _cursor.setSizeAndScummvmPixelFormat(w, h, format); _cursor.setHotspot(hotspotX, hotspotY); _cursor.clearKeyColor(); - _cursor.copyFromArray(buf); + _cursor.copyFromArray((const byte *)buf); } bool OSystem_PSP::pollEvent(Common::Event &event) { @@ -446,6 +446,7 @@ void OSystem_PSP::getTimeAndDate(TimeDate &td) const { td.tm_mday = t.tm_mday; td.tm_mon = t.tm_mon; td.tm_year = t.tm_year; + td.tm_wday = t.tm_wday; } Common::String OSystem_PSP::getDefaultConfigFileName() { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index c72053f52c..2afdabd0fc 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -99,7 +99,7 @@ public: void setCursorPalette(const byte *colors, uint start, uint num); // Screen related - void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); Graphics::Surface *lockScreen(); void unlockScreen(); void updateScreen(); @@ -109,8 +109,8 @@ public: void showOverlay(); void hideOverlay(); void clearOverlay(); - void grabOverlay(OverlayColor *buf, int pitch); - void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + void grabOverlay(void *buf, int pitch); + void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); int16 getOverlayHeight(); int16 getOverlayWidth(); Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); } @@ -118,7 +118,7 @@ public: // Mouse related bool showMouse(bool visible); void warpMouse(int x, int y); - void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); + void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // Events and input bool pollEvent(Common::Event &event); diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 8dff5cec05..d54854352d 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -486,6 +486,7 @@ void OSystem_SDL::getTimeAndDate(TimeDate &td) const { td.tm_mday = t.tm_mday; td.tm_mon = t.tm_mon; td.tm_year = t.tm_year; + td.tm_wday = t.tm_wday; } Audio::Mixer *OSystem_SDL::getMixer() { diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index 258a782cc4..681675529a 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -269,6 +269,7 @@ void OSystem_Wii::getTimeAndDate(TimeDate &td) const { td.tm_mday = t.tm_mday; td.tm_mon = t.tm_mon; td.tm_year = t.tm_year; + td.tm_wday = t.tm_wday; } void OSystem_Wii::showOptionsDialog() { diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index b6784d59e4..abafa7f642 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -72,7 +72,7 @@ private: bool _overlayVisible; u16 _overlayWidth, _overlayHeight; u32 _overlaySize; - OverlayColor *_overlayPixels; + uint16 *_overlayPixels; gfx_screen_coords_t _coordsOverlay; gfx_tex_t _texOverlay; bool _overlayDirty; @@ -167,7 +167,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: virtual void setCursorPalette(const byte *colors, uint start, uint num); - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); @@ -177,8 +177,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayWidth(); virtual int16 getOverlayHeight(); @@ -187,7 +187,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, + virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index a00cea8252..90e4d98c6b 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -74,7 +74,7 @@ void OSystem_Wii::initGfx() { #endif _overlaySize = _overlayWidth * _overlayHeight * 2; - _overlayPixels = (OverlayColor *) memalign(32, _overlaySize); + _overlayPixels = (uint16 *) memalign(32, _overlaySize); memset(&_texMouse, 0, sizeof(gfx_tex_t)); memset(&_texOverlay, 0, sizeof(gfx_tex_t)); @@ -395,7 +395,7 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) { _cursorPaletteDirty = true; } -void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y, +void OSystem_Wii::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { assert(x >= 0 && x < _gameWidth); assert(y >= 0 && y < _gameHeight); @@ -407,7 +407,7 @@ void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y, if (!Graphics::crossBlit(_gamePixels + y * _gameWidth * _pfGame.bytesPerPixel + x * _pfGame.bytesPerPixel, - buf, _gameWidth * _pfGame.bytesPerPixel, + (const byte *)buf, _gameWidth * _pfGame.bytesPerPixel, pitch, w, h, _pfGameTexture, _pfGame)) { printf("crossBlit failed\n"); ::abort(); @@ -418,9 +418,10 @@ void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y, if (_gameWidth == pitch && pitch == w) { memcpy(dst, buf, h * w); } else { + const byte *src = (const byte *)buf; do { - memcpy(dst, buf, w); - buf += pitch; + memcpy(dst, src, w); + src += pitch; dst += _gameWidth; } while (--h); } @@ -570,28 +571,30 @@ void OSystem_Wii::clearOverlay() { _overlayDirty = true; } -void OSystem_Wii::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_Wii::grabOverlay(void *buf, int pitch) { int h = _overlayHeight; - OverlayColor *src = _overlayPixels; + uint16 *src = _overlayPixels; + byte *dst = (byte *)buf; do { - memcpy(buf, src, _overlayWidth * sizeof(OverlayColor)); + memcpy(dst, src, _overlayWidth * sizeof(uint16)); src += _overlayWidth; - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_Wii::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, +void OSystem_Wii::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { + const byte *src = (const byte *)buf; if (x < 0) { w += x; - buf -= x; + src -= x * sizeof(uint16); x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -604,13 +607,13 @@ void OSystem_Wii::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, if (w <= 0 || h <= 0) return; - OverlayColor *dst = _overlayPixels + (y * _overlayWidth + x); - if (_overlayWidth == pitch && pitch == w) { - memcpy(dst, buf, h * w * sizeof(OverlayColor)); + uint16 *dst = _overlayPixels + (y * _overlayWidth + x); + if (_overlayWidth == w && pitch == _overlayWidth * sizeof(uint16)) { + memcpy(dst, src, h * pitch); } else { do { - memcpy(dst, buf, w * sizeof(OverlayColor)); - buf += pitch; + memcpy(dst, src, w * sizeof(uint16)); + src += pitch; dst += _overlayWidth; } while (--h); } @@ -642,7 +645,7 @@ void OSystem_Wii::warpMouse(int x, int y) { _mouseY = y; } -void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, +void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { @@ -685,7 +688,7 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, tmpBuf = true; if (!tmpBuf) { - gfx_tex_convert(&_texMouse, buf); + gfx_tex_convert(&_texMouse, (const byte *)buf); } else { u8 bpp = _texMouse.bpp >> 3; byte *tmp = (byte *) malloc(tw * th * bpp); @@ -702,7 +705,7 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, #ifdef USE_RGB_COLOR if (bpp > 1) { - if (!Graphics::crossBlit(tmp, buf, + if (!Graphics::crossBlit(tmp, (const byte *)buf, tw * _pfRGB3444.bytesPerPixel, w * _pfCursor.bytesPerPixel, tw, th, _pfRGB3444, _pfCursor)) { @@ -726,10 +729,10 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, } else { #endif byte *dst = tmp; - + const byte *src = (const byte *)buf; do { - memcpy(dst, buf, w * bpp); - buf += w * bpp; + memcpy(dst, src, w * bpp); + src += w * bpp; dst += tw * bpp; } while (--h); #ifdef USE_RGB_COLOR diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index a57fcb9628..3897731db4 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -622,6 +622,7 @@ void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const { t.tm_hour = systime.wHour; t.tm_min = systime.wMinute; t.tm_sec = systime.wSecond; + t.tm_wday = systime.wDayOfWeek; } Common::String OSystem_WINCE3::getSystemLanguage() const { diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index 42f9707ddc..75de86472f 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -161,7 +161,7 @@ void VirtualKeyboardGUI::run() { _system->clearOverlay(); } _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); - _system->grabOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w); + _system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch); setupCursor(); @@ -171,7 +171,7 @@ void VirtualKeyboardGUI::run() { removeCursor(); - _system->copyRectToOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w, 0, 0, _overlayBackup.w, _overlayBackup.h); + _system->copyRectToOverlay(_overlayBackup.pixels, _overlayBackup.pitch, 0, 0, _overlayBackup.w, _overlayBackup.h); if (!g_gui.isActive()) _system->hideOverlay(); _overlayBackup.free(); @@ -262,7 +262,7 @@ void VirtualKeyboardGUI::screenChanged() { _screenH = newScreenH; _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); - _system->grabOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w); + _system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch); if (!_kbd->checkModeResolutions()) { _displaying = false; @@ -371,7 +371,7 @@ void VirtualKeyboardGUI::redraw() { blit(&surf, &_dispSurface, _dispX - _dirtyRect.left, _dispY - _dirtyRect.top, _dispBackColor); } - _system->copyRectToOverlay((OverlayColor *)surf.pixels, surf.w, + _system->copyRectToOverlay(surf.pixels, surf.pitch, _dirtyRect.left, _dirtyRect.top, surf.w, surf.h); surf.free(); |