aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/events/gph/gph-events.cpp152
-rw-r--r--backends/events/gph/gph-events.h7
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp2
-rw-r--r--backends/graphics/gph/gph-graphics.cpp8
-rw-r--r--backends/graphics/graphics.h8
-rw-r--r--backends/graphics/null/null-graphics.h8
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp96
-rw-r--r--backends/graphics/opengl/opengl-graphics.h10
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp2
-rw-r--r--backends/graphics/openpandora/op-graphics.cpp43
-rw-r--r--backends/graphics/openpandora/op-graphics.h23
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp126
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h10
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.cpp19
-rw-r--r--backends/graphics/wincesdl/wincesdl-graphics.h6
-rw-r--r--backends/midi/sndio.cpp152
-rw-r--r--backends/modular-backend.cpp10
-rw-r--r--backends/modular-backend.h8
-rw-r--r--backends/module.mk1
-rw-r--r--backends/platform/android/android.cpp1
-rw-r--r--backends/platform/android/android.h10
-rw-r--r--backends/platform/android/android.mk13
-rw-r--r--backends/platform/android/gfx.cpp28
-rw-r--r--backends/platform/android/texture.cpp63
-rw-r--r--backends/platform/bada/system.cpp14
-rw-r--r--backends/platform/dc/dc.h8
-rw-r--r--backends/platform/dc/dcmain.cpp1
-rw-r--r--backends/platform/dc/display.cpp25
-rw-r--r--backends/platform/dc/vmsave.cpp5
-rw-r--r--backends/platform/dingux/README.DINGUX19
-rw-r--r--backends/platform/dingux/dingux.mk1
-rw-r--r--backends/platform/dingux/scummvm.pngbin0 -> 2656 bytes
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.cpp2
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.h2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp21
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h8
-rw-r--r--backends/platform/gph/gph-backend.cpp49
-rw-r--r--backends/platform/gph/gph-main.cpp4
-rw-r--r--backends/platform/gph/gph.h9
-rw-r--r--backends/platform/iphone/osys_main.cpp1
-rw-r--r--backends/platform/iphone/osys_main.h8
-rw-r--r--backends/platform/iphone/osys_video.mm35
-rw-r--r--backends/platform/maemo/debian/changelog16
-rw-r--r--backends/platform/maemo/debian/control2
-rwxr-xr-xbackends/platform/maemo/debian/rules2
-rw-r--r--backends/platform/maemo/maemo.cpp6
-rw-r--r--backends/platform/n64/framfs_save_manager.h4
-rw-r--r--backends/platform/n64/osys_n64.h10
-rw-r--r--backends/platform/n64/osys_n64_base.cpp50
-rw-r--r--backends/platform/n64/pakfs_save_manager.h4
-rw-r--r--backends/platform/openpandora/op-backend.cpp98
-rw-r--r--backends/platform/openpandora/op-sdl.h2
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp4
-rw-r--r--backends/platform/ps2/Gs2dScreen.h4
-rw-r--r--backends/platform/ps2/ps2time.cpp9
-rw-r--r--backends/platform/ps2/savefilemgr.cpp4
-rw-r--r--backends/platform/ps2/savefilemgr.h2
-rw-r--r--backends/platform/ps2/systemps2.cpp14
-rw-r--r--backends/platform/ps2/systemps2.h8
-rw-r--r--backends/platform/psp/README.PSP2
-rw-r--r--backends/platform/psp/default_display_client.cpp8
-rw-r--r--backends/platform/psp/default_display_client.h4
-rw-r--r--backends/platform/psp/display_manager.cpp2
-rw-r--r--backends/platform/psp/osys_psp.cpp17
-rw-r--r--backends/platform/psp/osys_psp.h8
-rw-r--r--backends/platform/sdl/sdl.cpp1
-rw-r--r--backends/platform/webos/webos.cpp20
-rw-r--r--backends/platform/webos/webos.h3
-rw-r--r--backends/platform/wii/osystem.cpp3
-rw-r--r--backends/platform/wii/osystem.h14
-rw-r--r--backends/platform/wii/osystem_gfx.cpp78
-rw-r--r--backends/platform/wince/wince-sdl.cpp1
-rw-r--r--backends/saves/default/default-saves.cpp4
-rw-r--r--backends/saves/default/default-saves.h2
-rw-r--r--backends/saves/windows/windows-saves.cpp4
-rw-r--r--backends/timer/default/default-timer.cpp1
-rw-r--r--backends/timer/default/default-timer.h1
-rw-r--r--backends/vkeybd/virtual-keyboard-gui.cpp8
78 files changed, 807 insertions, 631 deletions
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp
index b4e106b790..91118d36c1 100644
--- a/backends/events/gph/gph-events.cpp
+++ b/backends/events/gph/gph-events.cpp
@@ -161,49 +161,6 @@ GPHEventSource::GPHEventSource()
: _buttonStateL(false) {
}
-void GPHEventSource::moveStick() {
- bool stickBtn[32];
-
- memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
-
- if ((stickBtn[0]) || (stickBtn[2]) || (stickBtn[4]) || (stickBtn[6]))
- stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0;
-
- if ((stickBtn[1]) || (stickBtn[2]) || (stickBtn[3])) {
- if (_km.x_down_count != 2) {
- _km.x_vel = -1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = -4;
- } else if ((stickBtn[5]) || (stickBtn[6]) || (stickBtn[7])) {
- if (_km.x_down_count != 2) {
- _km.x_vel = 1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = 4;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
-
- if ((stickBtn[0]) || (stickBtn[1]) || (stickBtn[7])) {
- if (_km.y_down_count != 2) {
- _km.y_vel = -1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = -4;
- } else if ((stickBtn[3]) || (stickBtn[4]) || (stickBtn[5])) {
- if (_km.y_down_count != 2) {
- _km.y_vel = 1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = 4;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-}
-
/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
bool GPHEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
@@ -268,19 +225,110 @@ bool GPHEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 1;
event.kbd.flags = 0;
switch (ev.jbutton.button) {
case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
+ if (_km.y_down_count != 2) {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = -4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
+ if (_km.y_down_count != 2) {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = 4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_LEFT:
+ if (_km.x_down_count != 2) {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = -4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
case BUTTON_RIGHT:
+ if (_km.x_down_count != 3) {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = 4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_UPLEFT:
+ if (_km.x_down_count != 2) {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = -4;
+ }
+ if (_km.y_down_count != 2) {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = -4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
case BUTTON_UPRIGHT:
- moveStick();
+ if (_km.x_down_count != 2) {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = 4;
+ }
+ if (_km.y_down_count != 2) {
+ _km.y_vel = -1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = -4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_DOWNLEFT:
+ if (_km.x_down_count != 2) {
+ _km.x_vel = -1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = -4;
+ }
+ if (_km.y_down_count != 2) {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = 4;
+ }
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ break;
+ case BUTTON_DOWNRIGHT:
+ if (_km.x_down_count != 2) {
+ _km.x_vel = 1;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = 4;
+ }
+ if (_km.y_down_count != 2) {
+ _km.y_vel = 1;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = 4;
+ }
event.type = Common::EVENT_MOUSEMOVE;
processMouseEvent(event, _km.x, _km.y);
break;
@@ -391,7 +439,6 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
bool GPHEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 0;
event.kbd.flags = 0;
switch (ev.jbutton.button) {
@@ -403,7 +450,10 @@ bool GPHEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
case BUTTON_DOWNRIGHT:
case BUTTON_RIGHT:
case BUTTON_UPRIGHT:
- moveStick();
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
event.type = Common::EVENT_MOUSEMOVE;
processMouseEvent(event, _km.x, _km.y);
break;
diff --git a/backends/events/gph/gph-events.h b/backends/events/gph/gph-events.h
index 7672bffed2..3b1e6f090a 100644
--- a/backends/events/gph/gph-events.h
+++ b/backends/events/gph/gph-events.h
@@ -34,18 +34,11 @@ public:
GPHEventSource();
protected:
- bool _stickBtn[32];
-
/**
* Button state for L button modifier
*/
bool _buttonStateL;
- /**
- * Handles the stick movement
- */
- void moveStick();
-
bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 205dcfdbec..f515343d3c 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -432,7 +432,7 @@ bool DINGUXSdlGraphicsManager::loadGFXMode() {
// Forcefully disable aspect ratio correction for games
// which starts with a native 240px height resolution.
// This fixes games with weird resolutions, like MM Nes (256x240)
- if(_videoMode.screenHeight == 240) {
+ if (_videoMode.screenHeight == 240) {
_videoMode.aspectRatioCorrection = false;
}
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index 8521e88eaf..92553564bf 100644
--- a/backends/graphics/gph/gph-graphics.cpp
+++ b/backends/graphics/gph/gph-graphics.cpp
@@ -486,7 +486,13 @@ bool GPHGraphicsManager::loadGFXMode() {
if (_videoMode.aspectRatioCorrection)
_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
}
- return SurfaceSdlGraphicsManager::loadGFXMode();
+ SurfaceSdlGraphicsManager::loadGFXMode();
+
+ // The old GP2X hacked SDL needs this after any call to SDL_SetVideoMode
+ // and it does not hurt other devices.
+ SDL_ShowCursor(SDL_DISABLE);
+
+ return true;
}
bool GPHGraphicsManager::hasFeature(OSystem::Feature f) {
diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index 3f282df587..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, int cursorTargetScale = 1, 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 2e6b24d147..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, int cursorTargetScale = 1, 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 45804b5d6e..48e2663d44 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -49,7 +49,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager()
_transactionMode(kTransactionNone),
_cursorNeedsRedraw(false), _cursorPaletteDisabled(true),
_cursorVisible(false), _cursorKeyColor(0),
- _cursorTargetScale(1),
+ _cursorDontScale(false),
_formatBGR(false),
_displayX(0), _displayY(0), _displayWidth(0), _displayHeight(0) {
@@ -70,6 +70,11 @@ OpenGLGraphicsManager::~OpenGLGraphicsManager() {
free(_gamePalette);
free(_cursorPalette);
+ _screenData.free();
+ _overlayData.free();
+ _cursorData.free();
+ _osdSurface.free();
+
delete _gameTexture;
delete _overlayTexture;
delete _cursorTexture;
@@ -344,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);
@@ -462,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;
}
@@ -502,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;
}
@@ -586,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, int cursorTargetScale, 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;
@@ -611,7 +617,7 @@ void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int
_cursorState.hotX = hotspotX;
_cursorState.hotY = hotspotY;
_cursorKeyColor = keycolor;
- _cursorTargetScale = cursorTargetScale;
+ _cursorDontScale = dontScale;
_cursorNeedsRedraw = true;
refreshCursorScale();
@@ -824,28 +830,19 @@ void OpenGLGraphicsManager::refreshCursor() {
}
void OpenGLGraphicsManager::refreshCursorScale() {
- // Calculate the scale factors of the screen. We limit ourselves to 3 at
- // most here to avoid really big (and ugly) cursors for big resolutions.
- // It might be noteworthy that 3 is the (current) target scale for the
- // modern theme and thus assures the cursor is *never* scaled.
+ // Calculate the scale factors of the screen.
// We also totally ignore the aspect of the overlay cursor, since aspect
// ratio correction only applies to the game screen.
- uint screenScaleFactorX = MIN(30000, _videoMode.hardwareWidth * 10000 / _videoMode.screenWidth);
- uint screenScaleFactorY = MIN(30000, _videoMode.hardwareHeight * 10000 / _videoMode.screenHeight);
-
- // Apply the target scale factor to the cursor.
- // It might be noteworthy we only apply any scaling to the cursor in case
- // the current scale factor is bigger than the target scale to match
- // SurfaceSdlGraphicsManager's behavior. Otherwise we would downscale the
- // GUI cursor of the modern theme for example.
- if (screenScaleFactorX > uint(_cursorTargetScale * 10000))
- screenScaleFactorX /= _cursorTargetScale;
- else
+ // TODO: It might make sense to always ignore scaling of the mouse cursor
+ // when the overlay is visible.
+ uint screenScaleFactorX = _videoMode.hardwareWidth * 10000 / _videoMode.screenWidth;
+ uint screenScaleFactorY = _videoMode.hardwareHeight * 10000 / _videoMode.screenHeight;
+
+ // Ignore scaling when the cursor should not be scaled.
+ if (_cursorDontScale) {
screenScaleFactorX = 10000;
- if (screenScaleFactorY > uint(_cursorTargetScale * 10000))
- screenScaleFactorY /= _cursorTargetScale;
- else
screenScaleFactorY = 10000;
+ }
// Apply them (without any possible) aspect ratio correction to the
// overlay.
@@ -854,16 +851,19 @@ void OpenGLGraphicsManager::refreshCursorScale() {
_cursorState.rHotX = (int16)(_cursorState.hotX * screenScaleFactorX / 10000);
_cursorState.rHotY = (int16)(_cursorState.hotY * screenScaleFactorY / 10000);
- // Make sure we properly scale the cursor according to the desired aspect.
- // It might be noteworthy that, unlike with the overlay, we do not limit
- // the scale factor here to avoid odd looks if the game uses items as
- // mouse cursor, which would otherwise suddenly be smaller.
- int width, height;
- calculateDisplaySize(width, height);
- screenScaleFactorX = (width * 10000 / _videoMode.screenWidth) / _cursorTargetScale;
- screenScaleFactorY = (height * 10000 / _videoMode.screenHeight) / _cursorTargetScale;
+ // Only apply scaling when it's desired.
+ if (_cursorDontScale) {
+ screenScaleFactorX = 10000;
+ screenScaleFactorY = 10000;
+ } else {
+ // Make sure we properly scale the cursor according to the desired aspect.
+ int width, height;
+ calculateDisplaySize(width, height);
+ screenScaleFactorX = (width * 10000 / _videoMode.screenWidth);
+ screenScaleFactorY = (height * 10000 / _videoMode.screenHeight);
+ }
- // Always scale the cursor for the game.
+ // Apply the scale cursor scaling for the game screen.
_cursorState.vW = (int16)(_cursorState.w * screenScaleFactorX / 10000);
_cursorState.vH = (int16)(_cursorState.h * screenScaleFactorY / 10000);
_cursorState.vHotX = (int16)(_cursorState.hotX * screenScaleFactorX / 10000);
@@ -902,7 +902,7 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat,
bpp = 4;
intFormat = GL_RGBA;
glFormat = GL_RGBA;
- gltype = GL_UNSIGNED_BYTE;
+ gltype = GL_UNSIGNED_INT_8_8_8_8;
} else if (pixelFormat == Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0)) { // RGB888
bpp = 3;
intFormat = GL_RGB;
@@ -918,11 +918,6 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat,
intFormat = GL_RGBA;
glFormat = GL_RGBA;
gltype = GL_UNSIGNED_SHORT_5_5_5_1;
- } else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555
- bpp = 2;
- intFormat = GL_RGB;
- glFormat = GL_BGRA;
- gltype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
} else if (pixelFormat == Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)) { // RGBA4444
bpp = 2;
intFormat = GL_RGBA;
@@ -936,6 +931,13 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat,
glFormat = GL_RGB;
gltype = GL_UNSIGNED_BYTE;
#ifndef USE_GLES
+ } else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555
+ // GL_BGRA does not exist in every GLES implementation so should not be configured if
+ // USE_GLES is set.
+ bpp = 2;
+ intFormat = GL_RGB;
+ glFormat = GL_BGRA;
+ gltype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
} else if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24)) { // ARGB8888
bpp = 4;
intFormat = GL_RGBA;
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index ad8765bab1..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, int cursorTargetScale = 1, 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);
@@ -283,7 +283,7 @@ protected:
MousePos _cursorState;
bool _cursorVisible;
uint32 _cursorKeyColor;
- int _cursorTargetScale;
+ bool _cursorDontScale;
bool _cursorNeedsRedraw;
/**
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index b37d631c6d..67041ae17b 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -160,7 +160,7 @@ void OpenGLSdlGraphicsManager::detectSupportedFormats() {
_hwscreen->format->Rshift, _hwscreen->format->Gshift,
_hwscreen->format->Bshift, _hwscreen->format->Ashift);
- // Workaround to MacOSX SDL not providing an accurate Aloss value.
+ // Workaround to SDL not providing an accurate Aloss value on Mac OS X.
if (_hwscreen->format->Amask == 0)
format.aLoss = 8;
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index 5f0301a0c8..f371081fde 100644
--- a/backends/graphics/openpandora/op-graphics.cpp
+++ b/backends/graphics/openpandora/op-graphics.cpp
@@ -26,28 +26,59 @@
#include "backends/graphics/openpandora/op-graphics.h"
#include "backends/events/openpandora/op-events.h"
-//#include "backends/platform/openpandora/op-sdl.h"
#include "graphics/scaler/aspect.h"
#include "common/mutex.h"
#include "common/textconsole.h"
+static SDL_Cursor *hiddenCursor;
+
OPGraphicsManager::OPGraphicsManager(SdlEventSource *sdlEventSource)
: SurfaceSdlGraphicsManager(sdlEventSource) {
}
bool OPGraphicsManager::loadGFXMode() {
- /* FIXME: For now we just cheat and set the overlay to 640*480 not 800*480 and let SDL
- deal with the boarders (it saves cleaning up the overlay when the game screen is
- smaller than the overlay ;)
+
+ uint8_t hiddenCursorData = 0;
+ hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
+
+ /* On the OpenPandora we need to work around an SDL assumption that
+ returns relative mouse coordinates when you get to the screen
+ edges using the touchscreen. The workaround is to set a blank
+ SDL cursor and not disable it (Hackish I know).
+
+ The root issues likes in the Windows Manager GRAB code in SDL.
+ That is why the issue is not seen on framebuffer devices like the
+ GP2X (there is no X window manager ;)).
*/
- _videoMode.overlayWidth = 640;
- _videoMode.overlayHeight = 480;
+ SDL_ShowCursor(SDL_ENABLE);
+ SDL_SetCursor(hiddenCursor);
+
_videoMode.fullscreen = true;
+ _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+ _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+
if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
_videoMode.aspectRatioCorrection = false;
+ if (_videoMode.aspectRatioCorrection)
+ _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
+
+ _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+ _videoMode.hardwareHeight = effectiveScreenHeight();
+
return SurfaceSdlGraphicsManager::loadGFXMode();
}
+void OPGraphicsManager::unloadGFXMode() {
+
+ uint8_t hiddenCursorData = 0;
+ hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
+
+ // Free the hidden SDL cursor created in loadGFXMode
+ SDL_FreeCursor(hiddenCursor);
+
+ SurfaceSdlGraphicsManager::unloadGFXMode();
+}
+
#endif
diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h
index 0b3eeae8ec..2e3d63e3ad 100644
--- a/backends/graphics/openpandora/op-graphics.h
+++ b/backends/graphics/openpandora/op-graphics.h
@@ -24,7 +24,6 @@
#define BACKENDS_GRAPHICS_OP_H
#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
-#include "graphics/scaler/aspect.h" // for aspect2Real
#include "graphics/scaler/downscaler.h"
enum {
@@ -35,28 +34,8 @@ class OPGraphicsManager : public SurfaceSdlGraphicsManager {
public:
OPGraphicsManager(SdlEventSource *sdlEventSource);
-// bool hasFeature(OSystem::Feature f);
-// void setFeatureState(OSystem::Feature f, bool enable);
-// bool getFeatureState(OSystem::Feature f);
-// int getDefaultGraphicsMode() const;
-
-// void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
-// const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
-// bool setGraphicsMode(const char *name);
-// bool setGraphicsMode(int mode);
-// void setGraphicsModeIntern();
-// void internUpdateScreen();
-// void showOverlay();
-// void hideOverlay();
bool loadGFXMode();
-// void drawMouse();
-// void undrawMouse();
-// virtual void warpMouse(int x, int y);
-
-// SurfaceSdlGraphicsManager::MousePos *getMouseCurState();
-// SurfaceSdlGraphicsManager::VideoState *getVideoMode();
-
-// virtual void adjustMouseEvent(const Common::Event &event);
+ void unloadGFXMode();
};
#endif /* BACKENDS_GRAPHICS_OP_H */
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 9631c3c07e..fb964d6951 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -63,17 +63,12 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Normal (no scaling)", "lowres")
-// Table of relative scalers magnitudes
-// [definedScale - 1][scaleFactor - 1]
-static ScalerProc *scalersMagn[3][3] = {
+// Table of the cursor scalers [scaleFactor - 1]
+static ScalerProc *scalersMagn[3] = {
#ifdef USE_SCALERS
- { Normal1x, AdvMame2x, AdvMame3x },
- { Normal1x, Normal1x, Normal1o5x },
- { Normal1x, Normal1x, Normal1x }
+ Normal1x, AdvMame2x, AdvMame3x
#else // remove dependencies on other scalers
- { Normal1x, Normal1x, Normal1x },
- { Normal1x, Normal1x, Normal1x },
- { Normal1x, Normal1x, Normal1x }
+ Normal1x, Normal1x, Normal1x
#endif
};
@@ -135,7 +130,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
_overlayscreen(0), _tmpscreen2(0),
_scalerProc(0), _screenChangeCount(0),
_mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0),
- _mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
+ _mouseOrigSurface(0), _cursorDontScale(false), _cursorPaletteDisabled(true),
_currentShakePos(0), _newShakePos(0),
_paletteDirtyStart(0), _paletteDirtyEnd(0),
_screenIsLocked(false),
@@ -458,7 +453,7 @@ void SurfaceSdlGraphicsManager::detectSupportedFormats() {
_hwscreen->format->Rshift, _hwscreen->format->Gshift,
_hwscreen->format->Bshift, _hwscreen->format->Ashift);
- // Workaround to MacOSX SDL not providing an accurate Aloss value.
+ // Workaround to SDL not providing an accurate Aloss value on Mac OS X.
if (_hwscreen->format->Amask == 0)
format.aLoss = 8;
@@ -1232,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");
@@ -1257,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;
@@ -1268,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;
@@ -1600,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)
@@ -1610,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;
}
@@ -1657,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);
@@ -1718,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, int cursorTargetScale, 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();
@@ -1739,7 +1740,7 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h,
_mouseKeyColor = keycolor;
- _cursorTargetScale = cursorTargetScale;
+ _cursorDontScale = dontScale;
if (_mouseCurState.w != (int)w || _mouseCurState.h != (int)h) {
_mouseCurState.w = w;
@@ -1847,51 +1848,34 @@ void SurfaceSdlGraphicsManager::blitCursor() {
}
int rW, rH;
+ int cursorScale;
- if (_cursorTargetScale >= _videoMode.scaleFactor) {
- // The cursor target scale is greater or equal to the scale at
- // which the rest of the screen is drawn. We do not downscale
- // the cursor image, we draw it at its original size. It will
- // appear too large on screen.
-
- rW = w;
- rH = h;
- _mouseCurState.rHotX = _mouseCurState.hotX;
- _mouseCurState.rHotY = _mouseCurState.hotY;
-
- // The virtual dimensions may be larger than the original.
-
- _mouseCurState.vW = w * _cursorTargetScale / _videoMode.scaleFactor;
- _mouseCurState.vH = h * _cursorTargetScale / _videoMode.scaleFactor;
- _mouseCurState.vHotX = _mouseCurState.hotX * _cursorTargetScale /
- _videoMode.scaleFactor;
- _mouseCurState.vHotY = _mouseCurState.hotY * _cursorTargetScale /
- _videoMode.scaleFactor;
+ if (_cursorDontScale) {
+ // Don't scale the cursor at all if the user requests this behavior.
+ cursorScale = 1;
} else {
- // The cursor target scale is smaller than the scale at which
- // the rest of the screen is drawn. We scale up the cursor
- // image to make it appear correct.
+ // Scale the cursor with the game screen scale factor.
+ cursorScale = _videoMode.scaleFactor;
+ }
- rW = w * _videoMode.scaleFactor / _cursorTargetScale;
- rH = h * _videoMode.scaleFactor / _cursorTargetScale;
- _mouseCurState.rHotX = _mouseCurState.hotX * _videoMode.scaleFactor /
- _cursorTargetScale;
- _mouseCurState.rHotY = _mouseCurState.hotY * _videoMode.scaleFactor /
- _cursorTargetScale;
+ // Adapt the real hotspot according to the scale factor.
+ rW = w * cursorScale;
+ rH = h * cursorScale;
+ _mouseCurState.rHotX = _mouseCurState.hotX * cursorScale;
+ _mouseCurState.rHotY = _mouseCurState.hotY * cursorScale;
- // The virtual dimensions will be the same as the original.
+ // The virtual dimensions will be the same as the original.
- _mouseCurState.vW = w;
- _mouseCurState.vH = h;
- _mouseCurState.vHotX = _mouseCurState.hotX;
- _mouseCurState.vHotY = _mouseCurState.hotY;
- }
+ _mouseCurState.vW = w;
+ _mouseCurState.vH = h;
+ _mouseCurState.vHotX = _mouseCurState.hotX;
+ _mouseCurState.vHotY = _mouseCurState.hotY;
#ifdef USE_SCALERS
int rH1 = rH; // store original to pass to aspect-correction function later
#endif
- if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1) {
+ if (!_cursorDontScale && _videoMode.aspectRatioCorrection) {
rH = real2Aspect(rH - 1) + 1;
_mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY);
}
@@ -1922,21 +1906,25 @@ void SurfaceSdlGraphicsManager::blitCursor() {
ScalerProc *scalerProc;
- // If possible, use the same scaler for the cursor as for the rest of
- // the game. This only works well with the non-blurring scalers so we
- // actually only use the 1x, 1.5x, 2x and AdvMame scalers.
-
- if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE))
- scalerProc = _scalerProc;
- else
- scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1];
+ // Only apply scaling, when the user allows it.
+ if (!_cursorDontScale) {
+ // If possible, use the same scaler for the cursor as for the rest of
+ // the game. This only works well with the non-blurring scalers so we
+ // actually only use the 1x, 2x and AdvMame scalers.
+ if (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE)
+ scalerProc = _scalerProc;
+ else
+ scalerProc = scalersMagn[_videoMode.scaleFactor - 1];
+ } else {
+ scalerProc = Normal1x;
+ }
scalerProc((byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2,
_mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch,
_mouseCurState.w, _mouseCurState.h);
#ifdef USE_SCALERS
- if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1)
+ if (!_cursorDontScale && _videoMode.aspectRatioCorrection)
cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0);
#endif
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index f71096d43e..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, int cursorTargetScale = 1, 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
@@ -281,7 +281,7 @@ protected:
#else
byte _mouseKeyColor;
#endif
- int _cursorTargetScale;
+ bool _cursorDontScale;
bool _cursorPaletteDisabled;
SDL_Surface *_mouseOrigSurface;
SDL_Surface *_mouseSurface;
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index 58b735ef8b..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, int cursorTargetScale, 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 2e8c3313b3..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, int cursorTargetScale, 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/midi/sndio.cpp b/backends/midi/sndio.cpp
new file mode 100644
index 0000000000..21c9ea4fec
--- /dev/null
+++ b/backends/midi/sndio.cpp
@@ -0,0 +1,152 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "common/scummsys.h"
+
+#if defined(USE_SNDIO)
+
+#include "common/error.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "audio/musicplugin.h"
+#include "audio/mpu401.h"
+
+#include <sndio.h>
+
+////////////////////////////////////////
+//
+// sndio MIDI driver
+//
+////////////////////////////////////////
+
+class MidiDriver_Sndio : public MidiDriver_MPU401 {
+public:
+ MidiDriver_Sndio();
+ int open();
+ bool isOpen() const { return hdl != NULL; }
+ void close();
+ void send(uint32 b);
+ void sysEx(const byte *msg, uint16 length);
+
+private:
+ struct mio_hdl *hdl;
+};
+
+MidiDriver_Sndio::MidiDriver_Sndio() {
+ hdl = NULL;
+}
+
+int MidiDriver_Sndio::open() {
+ if (hdl != NULL)
+ return MERR_ALREADY_OPEN;
+
+ hdl = ::mio_open(NULL, MIO_OUT, 0);
+ if (hdl == NULL)
+ warning("Could open MIDI port (no music)");
+ return 0;
+}
+
+void MidiDriver_Sndio::close() {
+ MidiDriver_MPU401::close();
+ if (!hdl)
+ return;
+ mio_close(hdl);
+ hdl = NULL;
+}
+
+void MidiDriver_Sndio::send(uint32 b) {
+ unsigned char buf[4];
+ unsigned int len;
+
+ if (!hdl)
+ return;
+ buf[0] = b & 0xff;
+ buf[1] = (b >> 8) & 0xff;
+ buf[2] = (b >> 16) & 0xff;
+ buf[3] = (b >> 24) & 0xff;
+ switch (buf[0] & 0xf0) {
+ case 0xf0:
+ return;
+ case 0xc0:
+ case 0xd0:
+ len = 2;
+ break;
+ default:
+ len = 3;
+ }
+ mio_write(hdl, buf, len);
+}
+
+void MidiDriver_Sndio::sysEx(const byte *msg, uint16 length) {
+ if (!hdl)
+ return;
+
+ unsigned char buf[266];
+
+ assert(length + 2 <= ARRAYSIZE(buf));
+
+ // Add SysEx frame
+ buf[0] = 0xF0;
+ memcpy(buf + 1, msg, length);
+ buf[length + 1] = 0xF7;
+
+ mio_write(hdl, buf, length + 2);
+}
+
+
+// Plugin interface
+
+class SndioMusicPlugin : public MusicPluginObject {
+public:
+ const char *getName() const {
+ return "Sndio";
+ }
+
+ const char *getId() const {
+ return "sndio";
+ }
+
+ MusicDevices getDevices() const;
+ Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
+};
+
+MusicDevices SndioMusicPlugin::getDevices() const {
+ MusicDevices devices;
+ devices.push_back(MusicDevice(this, "", MT_GM));
+ return devices;
+}
+
+Common::Error SndioMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
+ *mididriver = new MidiDriver_Sndio();
+
+ return Common::kNoError;
+}
+
+//#if PLUGIN_ENABLED_DYNAMIC(Sndio)
+ //REGISTER_PLUGIN_DYNAMIC(SNDIO, PLUGIN_TYPE_MUSIC, SndioMusicPlugin);
+//#else
+ REGISTER_PLUGIN_STATIC(SNDIO, PLUGIN_TYPE_MUSIC, SndioMusicPlugin);
+//#endif
+
+#endif
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index 525170d685..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,8 +195,8 @@ 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, int cursorTargetScale, const Graphics::PixelFormat *format) {
- _graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, 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);
}
void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num) {
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 072ee805b6..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, int cursorTargetScale = 1, 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/module.mk b/backends/module.mk
index 95725d9d87..a4f525d21d 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS := \
midi/alsa.o \
midi/dmedia.o \
midi/seq.o \
+ midi/sndio.o \
midi/stmidi.o \
midi/timidity.o \
saves/savefile.o \
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 47a6515a2a..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,9 +267,9 @@ 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,
- int cursorTargetScale,
+ bool dontScale,
const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index 2e8fd62152..9292a16595 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -130,7 +130,18 @@ $(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png: $(PATH_RESOURCES)/drawable/scum
$(FILE_RESOURCES_MAIN): $(FILE_MANIFEST) $(RESOURCES) $(ANDROID_JAR8) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA)
$(INSTALL) -d $(PATH_BUILD_ASSETS)
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(PATH_BUILD_ASSETS)/
- $(AAPT) package -f -M $< -S $(PATH_RESOURCES) -A $(PATH_BUILD_ASSETS) -I $(ANDROID_JAR8) -F $@
+ work_dir=`pwd`; \
+ for i in $(PATH_BUILD_ASSETS)/*.zip; do \
+ echo "recompress $$i"; \
+ cd $$work_dir; \
+ $(RM) -rf $(PATH_BUILD_ASSETS)/tmp; \
+ $(MKDIR) $(PATH_BUILD_ASSETS)/tmp; \
+ unzip -q $$i -d $(PATH_BUILD_ASSETS)/tmp; \
+ cd $(PATH_BUILD_ASSETS)/tmp; \
+ zip -r ../`basename $$i` *; \
+ done
+ @$(RM) -rf $(PATH_BUILD_ASSETS)/tmp
+ $(AAPT) package -f -0 zip -M $< -S $(PATH_RESOURCES) -A $(PATH_BUILD_ASSETS) -I $(ANDROID_JAR8) -F $@
$(PATH_BUILD)/%/$(FILE_RESOURCES): $(PATH_BUILD)/%/AndroidManifest.xml $(PATH_STAGE_PREFIX).%/res/values/strings.xml $(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png plugins/lib%.so $(ANDROID_JAR8)
$(AAPT) package -f -M $< -S $(PATH_STAGE_PREFIX).$*/res -I $(ANDROID_JAR8) -F $@
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 8bc914f567..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,12 +684,12 @@ 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, int cursorTargetScale,
+ uint32 keycolor, bool dontScale,
const Graphics::PixelFormat *format) {
ENTER("%p, %u, %u, %d, %d, %u, %d, %p", buf, w, h, hotspotX, hotspotY,
- keycolor, cursorTargetScale, format);
+ keycolor, dontScale, format);
GLTHREADCHECK;
@@ -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");
@@ -766,7 +765,8 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
}
_mouse_hotspot = Common::Point(hotspotX, hotspotY);
- _mouse_targetscale = cursorTargetScale;
+ // TODO: Adapt to the new "do not scale" cursor logic.
+ _mouse_targetscale = 1;
}
void OSystem_Android::setCursorPaletteInternal(const byte *colors,
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 95c96e0d25..b174e93191 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -52,9 +52,6 @@
// Supported GL extensions
static bool npot_supported = false;
-#ifdef GL_OES_draw_texture
-static bool draw_tex_supported = false;
-#endif
static inline GLfixed xdiv(int numerator, int denominator) {
assert(numerator < (1 << 16));
@@ -85,11 +82,6 @@ void GLESBaseTexture::initGLExtensions() {
if (token == "GL_ARB_texture_non_power_of_two")
npot_supported = true;
-
-#ifdef GL_OES_draw_texture
- if (token == "GL_OES_draw_texture")
- draw_tex_supported = true;
-#endif
}
}
@@ -180,45 +172,28 @@ void GLESBaseTexture::allocBuffer(GLuint w, GLuint h) {
void GLESBaseTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name));
-#ifdef GL_OES_draw_texture
- // Great extension, but only works under specific conditions.
- // Still a work-in-progress - disabled for now.
- if (false && draw_tex_supported && !hasPalette()) {
- //GLCALL(glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE));
- const GLint crop[4] = { 0, _surface.h, _surface.w, -_surface.h };
+ const GLfixed tex_width = xdiv(_surface.w, _texture_width);
+ const GLfixed tex_height = xdiv(_surface.h, _texture_height);
+ const GLfixed texcoords[] = {
+ 0, 0,
+ tex_width, 0,
+ 0, tex_height,
+ tex_width, tex_height,
+ };
- GLCALL(glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop));
+ GLCALL(glTexCoordPointer(2, GL_FIXED, 0, texcoords));
- // Android GLES bug?
- GLCALL(glColor4ub(0xff, 0xff, 0xff, 0xff));
+ const GLshort vertices[] = {
+ x, y,
+ x + w, y,
+ x, y + h,
+ x + w, y + h,
+ };
- GLCALL(glDrawTexiOES(x, y, 0, w, h));
- } else
-#endif
- {
- const GLfixed tex_width = xdiv(_surface.w, _texture_width);
- const GLfixed tex_height = xdiv(_surface.h, _texture_height);
- const GLfixed texcoords[] = {
- 0, 0,
- tex_width, 0,
- 0, tex_height,
- tex_width, tex_height,
- };
-
- GLCALL(glTexCoordPointer(2, GL_FIXED, 0, texcoords));
-
- const GLshort vertices[] = {
- x, y,
- x + w, y,
- x, y + h,
- x + w, y + h,
- };
-
- GLCALL(glVertexPointer(2, GL_SHORT, 0, vertices));
-
- assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords));
- GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2));
- }
+ GLCALL(glVertexPointer(2, GL_SHORT, 0, vertices));
+
+ assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords));
+ GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2));
clearDirty();
}
diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp
index d284688068..3f862c2571 100644
--- a/backends/platform/bada/system.cpp
+++ b/backends/platform/bada/system.cpp
@@ -21,6 +21,7 @@
*/
#include <FUiCtrlMessageBox.h>
+#include <FLocales.h>
#include "common/config-manager.h"
#include "common/file.h"
@@ -42,7 +43,9 @@
using namespace Osp::Base;
using namespace Osp::Base::Runtime;
+using namespace Osp::Locales;
using namespace Osp::Ui::Controls;
+using namespace Osp::System;
#define DEFAULT_CONFIG_FILE "/Home/scummvm.ini"
#define RESOURCE_PATH "/Res"
@@ -305,7 +308,7 @@ void BadaSystem::initBackend() {
ConfMan.registerDefault("aspect_ratio", false);
ConfMan.setBool("confirm_exit", false);
- Osp::System::SystemTime::GetTicks(_epoch);
+ SystemTime::GetTicks(_epoch);
if (E_SUCCESS != initModules()) {
AppLog("initModules failed");
@@ -372,7 +375,7 @@ bool BadaSystem::pollEvent(Common::Event &event) {
uint32 BadaSystem::getMillis() {
long long result, ticks = 0;
- Osp::System::SystemTime::GetTicks(ticks);
+ SystemTime::GetTicks(ticks);
result = ticks - _epoch;
return result;
}
@@ -392,13 +395,18 @@ void BadaSystem::updateScreen() {
void BadaSystem::getTimeAndDate(TimeDate &td) const {
DateTime currentTime;
- if (E_SUCCESS == Osp::System::SystemTime::GetCurrentTime(currentTime)) {
+ if (E_SUCCESS == SystemTime::GetCurrentTime(WALL_TIME, currentTime)) {
td.tm_sec = currentTime.GetSecond();
td.tm_min = currentTime.GetMinute();
td.tm_hour = currentTime.GetHour();
td.tm_mday = currentTime.GetDay();
td.tm_mon = currentTime.GetMonth();
td.tm_year = currentTime.GetYear();
+
+ Calendar *calendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
+ calendar->SetTime(currentTime);
+ td.tm_wday = calendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1;
+ delete calendar;
}
}
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index 8ca48bf19e..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, int cursorTargetScale, 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 e886b55869..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,9 +292,9 @@ 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, int cursorTargetScale, const Graphics::PixelFormat *format)
+ uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format)
{
_ms_cur_w = w;
_ms_cur_h = h;
@@ -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/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp
index e06dd7fa43..ba3b787942 100644
--- a/backends/platform/dc/vmsave.cpp
+++ b/backends/platform/dc/vmsave.cpp
@@ -316,8 +316,9 @@ public:
class VMSaveManager : public Common::SaveFileManager {
public:
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename) {
- return Common::wrapCompressedWriteStream(new OutVMSave(filename.c_str()));
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) {
+ OutVMSave *s = new OutVMSave(filename.c_str());
+ return compress ? Common::wrapCompressedWriteStream(s) : s;
}
virtual Common::InSaveFile *openForLoading(const Common::String &filename) {
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
new file mode 100644
index 0000000000..128e59efc4
--- /dev/null
+++ b/backends/platform/dingux/scummvm.png
Binary files differ
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp
index 03729c5e6e..3192e2d277 100644
--- a/backends/platform/ds/arm9/source/gbampsave.cpp
+++ b/backends/platform/ds/arm9/source/gbampsave.cpp
@@ -45,7 +45,7 @@ static Common::String getSavePath() {
// GBAMP Save File Manager
//////////////////////////
-Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &filename) {
+Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &filename, bool compress) {
Common::String fileSpec = getSavePath();
if (fileSpec.lastChar() != '/')
fileSpec += '/';
diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h
index 492054dc52..0d9d9aca8c 100644
--- a/backends/platform/ds/arm9/source/gbampsave.h
+++ b/backends/platform/ds/arm9/source/gbampsave.h
@@ -27,7 +27,7 @@
class GBAMPSaveFileManager : public Common::SaveFileManager {
public:
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename);
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true);
virtual Common::InSaveFile *openForLoading(const Common::String &filename);
virtual bool removeSavefile(const Common::String &filename);
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 73340ed18a..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, int targetCursorScale, 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;
@@ -588,7 +588,9 @@ void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, i
_cursorHotX = hotspotX;
_cursorHotY = hotspotY;
_cursorKey = keycolor;
- _cursorScale = targetCursorScale;
+ // TODO: The old target scales was saved, but never used. Should the
+ // new "do not scale" logic be implemented?
+ //_cursorScale = targetCursorScale;
refreshCursor();
}
}
@@ -688,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 6aa3731916..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, int targetCursorScale, 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/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp
index 49a1edf411..485780b472 100644
--- a/backends/platform/gph/gph-backend.cpp
+++ b/backends/platform/gph/gph-backend.cpp
@@ -20,6 +20,8 @@
*
*/
+#if defined(GPH_DEVICE)
+
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
@@ -32,8 +34,6 @@
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
-#include "base/main.h"
-
#include "common/archive.h"
#include "common/config-manager.h"
#include "common/debug.h"
@@ -64,23 +64,6 @@ void OSystem_GPH::initBackend() {
assert(!_inited);
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new GPHEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0) {
- _graphicsManager = new GPHGraphicsManager(_eventSource);
- }
-
- // Create the mixer manager
- if (_mixer == 0) {
- _mixerManager = new DoubleBufferSDLMixerManager();
-
- // Setup and start mixer
- _mixerManager->init();
- }
-
/* Setup default save path to be workingdir/saves */
char savePath[PATH_MAX+1];
@@ -165,16 +148,42 @@ void OSystem_GPH::initBackend() {
/* Make sure that aspect ratio correction is enabled on the 1st run to stop
users asking me what the 'wasted space' at the bottom is ;-). */
ConfMan.registerDefault("aspect_ratio", true);
+ ConfMan.registerDefault("fullscreen", true);
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
+ // Create the events manager
+ if (_eventSource == 0)
+ _eventSource = new GPHEventSource();
+
+ // Create the graphics manager
+ if (_graphicsManager == 0) {
+ _graphicsManager = new GPHGraphicsManager(_eventSource);
+ }
+
/* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
_inited = true;
}
+void OSystem_GPH::initSDL() {
+ // Check if SDL has not been initialized
+ if (!_initedSDL) {
+
+ uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
+ if (ConfMan.hasKey("disable_sdl_parachute"))
+ sdlFlags |= SDL_INIT_NOPARACHUTE;
+
+ // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
+ if (SDL_Init(sdlFlags) == -1)
+ error("Could not initialize SDL: %s", SDL_GetError());
+
+ _initedSDL = true;
+ }
+}
+
void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
/* Setup default extra data paths for engine data files and plugins */
@@ -222,3 +231,5 @@ void OSystem_GPH::quit() {
OSystem_POSIX::quit();
}
+
+#endif
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index 2c43af151f..876de0f358 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -21,7 +21,7 @@
*/
#include "backends/platform/gph/gph.h"
-#include "backends/plugins/posix/posix-provider.h"
+#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
#if defined(GPH_DEVICE)
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
((OSystem_GPH *)g_system)->init();
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
+ PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
diff --git a/backends/platform/gph/gph.h b/backends/platform/gph/gph.h
index 80f43f0bab..90a798154f 100644
--- a/backends/platform/gph/gph.h
+++ b/backends/platform/gph/gph.h
@@ -26,13 +26,11 @@
#if defined(GPH_DEVICE)
#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/sdl/posix/posix.h"
#include "backends/events/gph/gph-events.h"
#include "backends/graphics/gph/gph-graphics.h"
-#define __GP2XWIZ__
-
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
@@ -45,6 +43,11 @@ public:
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
void quit();
+
+protected:
+ bool _inited;
+ bool _initedSDL;
+ virtual void initSDL();
};
#endif
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 b443e22f56..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, int cursorTargetScale = 1, 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 c6b6e6d757..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,8 +401,8 @@ void OSystem_IPHONE::dirtyFullOverlayScreen() {
}
}
-void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
- //printf("setMouseCursor(%p, %u, %u, %i, %i, %u, %d, %p)\n", (const void *)buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, (const void *)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();
#if 0
diff --git a/backends/platform/maemo/debian/changelog b/backends/platform/maemo/debian/changelog
index 8a9d8ee3c3..ea44574e96 100644
--- a/backends/platform/maemo/debian/changelog
+++ b/backends/platform/maemo/debian/changelog
@@ -1,8 +1,20 @@
-scummvm (1.5.0~git) unstable; urgency=low
+scummvm (1.6.0~git) unstable; urgency=low
* Development snapshot
- -- Tarek Soliman <tsoliman@scummvm.org> Tue, 15 Nov 2011 14:56:57 -0600
+ -- Tarek Soliman <tsoliman@scummvm.org> Tue, 10 Jul 2012 23:02:00 -0500
+
+scummvm (1.5.0) unstable; urgency=low
+
+ * 1.5.0 release
+
+ -- Tarek Soliman <tsoliman@scummvm.org> Fri, 20 Jul 2012 14:48:44 -0500
+
+scummvm (1.4.1) unstable; urgency=low
+
+ * 1.4.1 release
+
+ -- Tarek Soliman <tsoliman@scummvm.org> Wed, 11 Jan 2012 17:17:26 -0600
scummvm (1.4.0) unstable; urgency=low
diff --git a/backends/platform/maemo/debian/control b/backends/platform/maemo/debian/control
index 6e1dfe2fd4..bdaccd2359 100644
--- a/backends/platform/maemo/debian/control
+++ b/backends/platform/maemo/debian/control
@@ -2,7 +2,7 @@ Source: scummvm
Section: user/games
Priority: optional
Maintainer: Tarek Soliman <tsoliman@scummvm.org>
-Build-Depends: debhelper (>> 4.0.0), libsdl1.2-dev, libmad0-dev, libasound2-dev, libvorbisidec-dev, libmpeg2-4-dev, libflac-dev (>= 1.1.2), libz-dev, quilt
+Build-Depends: debhelper (>> 4.0.0), libsdl1.2-dev, libmad0-dev, libasound2-dev, libvorbisidec-dev, libmpeg2-4-dev, libflac-dev (>= 1.1.2), libfreetype6-dev, libz-dev, quilt
Standards-Version: 3.6.1.1
Package: scummvm
diff --git a/backends/platform/maemo/debian/rules b/backends/platform/maemo/debian/rules
index 64add08de8..43a34399a3 100755
--- a/backends/platform/maemo/debian/rules
+++ b/backends/platform/maemo/debian/rules
@@ -50,7 +50,7 @@ install: build
install -m0644 dists/engine-data/drascula.dat dists/engine-data/hugo.dat dists/engine-data/kyra.dat dists/engine-data/lure.dat dists/engine-data/queen.tbl dists/engine-data/sky.cpt dists/engine-data/teenagent.dat dists/engine-data/toon.dat debian/scummvm/opt/scummvm/share
install -m0644 -d debian/scummvm/usr/share/doc/scummvm
- install -m0644 NEWS README COPYRIGHT debian/scummvm/usr/share/doc/scummvm
+ install -m0644 AUTHORS COPYING COPYING.BSD COPYING.FREEFONT COPYING.LGPL COPYRIGHT NEWS README debian/scummvm/usr/share/doc/scummvm
binary: binary-arch
binary-arch: build install
diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp
index e296d4787c..6bd229177b 100644
--- a/backends/platform/maemo/maemo.cpp
+++ b/backends/platform/maemo/maemo.cpp
@@ -43,6 +43,7 @@ namespace Maemo {
OSystem_SDL_Maemo::OSystem_SDL_Maemo()
:
+ _eventObserver(0),
OSystem_POSIX() {
}
@@ -84,6 +85,9 @@ static void registerDefaultKeyBindings(Common::KeymapperDefaultBindings *_keymap
#endif
void OSystem_SDL_Maemo::initBackend() {
+ ConfMan.registerDefault("fullscreen", true);
+ ConfMan.registerDefault("aspect_ratio", true);
+
// Create the events manager
if (_eventSource == 0)
_eventSource = new MaemoSdlEventSource();
@@ -180,6 +184,7 @@ void OSystem_SDL_Maemo::setupIcon() {
// http://bugzilla.libsdl.org/show_bug.cgi?id=586
}
+#ifdef ENABLE_KEYMAPPER
static const Common::KeyTableEntry maemoKeys[] = {
// Function keys
{"MENU", Common::KEYCODE_F11, 0, "Menu", false},
@@ -191,7 +196,6 @@ static const Common::KeyTableEntry maemoKeys[] = {
{0, Common::KEYCODE_INVALID, 0, 0, false}
};
-#ifdef ENABLE_KEYMAPPER
Common::HardwareInputSet *OSystem_SDL_Maemo::getHardwareInputSet() {
return new Common::HardwareInputSet(true, maemoKeys);
}
diff --git a/backends/platform/n64/framfs_save_manager.h b/backends/platform/n64/framfs_save_manager.h
index da553e423a..0a88c8666b 100644
--- a/backends/platform/n64/framfs_save_manager.h
+++ b/backends/platform/n64/framfs_save_manager.h
@@ -100,10 +100,10 @@ public:
class FRAMSaveManager : public Common::SaveFileManager {
public:
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename) {
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) {
OutFRAMSave *s = new OutFRAMSave(filename.c_str());
if (!s->err()) {
- return Common::wrapCompressedWriteStream(s);
+ return compress ? Common::wrapCompressedWriteStream(s) : s;
} else {
delete s;
return 0;
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 4788beb1ca..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, int cursorTargetScale, 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 c3adb9691c..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, int cursorTargetScale, 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/n64/pakfs_save_manager.h b/backends/platform/n64/pakfs_save_manager.h
index e0fcbc1e2d..6e67fb0f5f 100644
--- a/backends/platform/n64/pakfs_save_manager.h
+++ b/backends/platform/n64/pakfs_save_manager.h
@@ -101,10 +101,10 @@ public:
class PAKSaveManager : public Common::SaveFileManager {
public:
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename) {
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) {
OutPAKSave *s = new OutPAKSave(filename.c_str());
if (!s->err()) {
- return Common::wrapCompressedWriteStream(s);
+ return compress ? Common::wrapCompressedWriteStream(s) : s;
} else {
delete s;
return NULL;
diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp
index dcec387f97..354aa24b24 100644
--- a/backends/platform/openpandora/op-backend.cpp
+++ b/backends/platform/openpandora/op-backend.cpp
@@ -54,53 +54,15 @@
/* Dump console info to files. */
#define DUMP_STDOUT
-static SDL_Cursor *hiddenCursor;
-
OSystem_OP::OSystem_OP()
:
OSystem_POSIX() {
}
-//static Uint32 timer_handler(Uint32 interval, void *param) {
-// ((DefaultTimerManager *)param)->handler();
-// return interval;
-//}
-
void OSystem_OP::initBackend() {
assert(!_inited);
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new OPEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0) {
- _graphicsManager = new OPGraphicsManager(_eventSource);
- }
-
-// int joystick_num = ConfMan.getInt("joystick_num");
-// uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
-//
-// if (ConfMan.hasKey("disable_sdl_parachute"))
-// sdlFlags |= SDL_INIT_NOPARACHUTE;
-//
-// if (joystick_num > -1)
-// sdlFlags |= SDL_INIT_JOYSTICK;
-//
-// if (SDL_Init(sdlFlags) == -1) {
-// error("Could not initialize SDL: %s", SDL_GetError());
-// }
-//
-
- // Create the mixer manager
-// if (_mixer == 0) {
-// _mixerManager = new DoubleBufferSDLMixerManager();
-
- // Setup and start mixer
-// _mixerManager->init();
-// }
-
/* Setup default save path to be workingdir/saves */
char savePath[PATH_MAX+1];
@@ -179,7 +141,14 @@ void OSystem_OP::initBackend() {
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
-// _graphicsMutex = createMutex();
+ // Create the events manager
+ if (_eventSource == 0)
+ _eventSource = new OPEventSource();
+
+ // Create the graphics manager
+ if (_graphicsManager == 0) {
+ _graphicsManager = new OPGraphicsManager(_eventSource);
+ }
/* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
@@ -187,24 +156,6 @@ void OSystem_OP::initBackend() {
_inited = true;
}
-// enable joystick
-// if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
-// printf("Using joystick: %s\n", SDL_JoystickName(0));
-// _joystick = SDL_JoystickOpen(joystick_num);
-// }
-//
-// setupMixer();
-
-// Note: We could implement a custom SDLTimerManager by using
-// SDL_AddTimer. That might yield better timer resolution, but it would
-// also change the semantics of a timer: Right now, ScummVM timers
-// *never* run in parallel, due to the way they are implemented. If we
-// switched to SDL_AddTimer, each timer might run in a separate thread.
-// However, not all our code is prepared for that, so we can't just
-// switch. Still, it's a potential future change to keep in mind.
-// _timer = new DefaultTimerManager();
-// _timerID = SDL_AddTimer(10, &timer_handler, _timer);
-
void OSystem_OP::initSDL() {
// Check if SDL has not been initialized
if (!_initedSDL) {
@@ -217,38 +168,7 @@ void OSystem_OP::initSDL() {
if (SDL_Init(sdlFlags) == -1)
error("Could not initialize SDL: %s", SDL_GetError());
- uint8_t hiddenCursorData = 0;
-
- hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
-
- /* On the OpenPandora we need to work around an SDL assumption that
- returns relative mouse coordinates when you get to the screen
- edges using the touchscreen. The workaround is to set a blank
- SDL cursor and not disable it (Hackish I know).
-
- The root issues likes in the Windows Manager GRAB code in SDL.
- That is why the issue is not seen on framebuffer devices like the
- GP2X (there is no X window manager ;)).
- */
- SDL_ShowCursor(SDL_ENABLE);
- SDL_SetCursor(hiddenCursor);
- SDL_EnableUNICODE(1);
-
-// memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
-// memset(&_videoMode, 0, sizeof(_videoMode));
-// memset(&_transactionDetails, 0, sizeof(_transactionDetails));
-
-// _videoMode.mode = GFX_DOUBLESIZE;
-// _videoMode.scaleFactor = 2;
-// _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
-// _scalerProc = Normal2x;
-// _scalerType = 0;
-
-// _videoMode.fullscreen = true;
-
_initedSDL = true;
-
-// OSystem_POSIX::initSDL();
}
}
@@ -275,8 +195,6 @@ void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
void OSystem_OP::quit() {
- SDL_FreeCursor(hiddenCursor);
-
#ifdef DUMP_STDOUT
printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
fclose(stdout);
diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h
index 8cccbb5f86..1eddad5c4a 100644
--- a/backends/platform/openpandora/op-sdl.h
+++ b/backends/platform/openpandora/op-sdl.h
@@ -31,8 +31,6 @@
#include "backends/events/openpandora/op-events.h"
#include "backends/graphics/openpandora/op-graphics.h"
-//#define MIXER_DOUBLE_BUFFERING 1
-
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
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/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp
index 421edc3e2e..46af42e193 100644
--- a/backends/platform/ps2/savefilemgr.cpp
+++ b/backends/platform/ps2/savefilemgr.cpp
@@ -145,7 +145,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil
return Common::wrapCompressedReadStream(sf);
}
-Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &filename) {
+Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &filename, bool compress) {
Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
Common::WriteStream *sf;
@@ -193,7 +193,7 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &fil
}
_screen->wantAnim(false);
- return Common::wrapCompressedWriteStream(sf);
+ return compress ? Common::wrapCompressedWriteStream(sf) : sf;
}
bool Ps2SaveFileManager::removeSavefile(const Common::String &filename) {
diff --git a/backends/platform/ps2/savefilemgr.h b/backends/platform/ps2/savefilemgr.h
index a25fb063ae..163706eace 100644
--- a/backends/platform/ps2/savefilemgr.h
+++ b/backends/platform/ps2/savefilemgr.h
@@ -35,7 +35,7 @@ public:
virtual ~Ps2SaveFileManager();
virtual Common::InSaveFile *openForLoading(const Common::String &filename);
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename);
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true);
virtual Common::StringArray listSavefiles(const Common::String &pattern);
virtual bool removeSavefile(const Common::String &filename);
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index d4e993da63..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, int cursorTargetScale, 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 3a0e247737..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, int cursorTargetScale = 1, 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/README.PSP b/backends/platform/psp/README.PSP
index bc0bd35a6e..969459dc5b 100644
--- a/backends/platform/psp/README.PSP
+++ b/backends/platform/psp/README.PSP
@@ -1,4 +1,4 @@
-ScummVM-PSP 1.5.0git README
+ScummVM-PSP 1.6.0git README
==============================================================================
Installation
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 5fa5110684..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, int cursorTargetScale, 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;
@@ -314,11 +314,13 @@ void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
}
_cursor.setKeyColor(keycolor);
- _cursor.setCursorTargetScale(cursorTargetScale);
+ // TODO: The old target scale was saved but never used. Should the new
+ // "do not scale" logic be implemented?
+ //_cursor.setCursorTargetScale(cursorTargetScale);
_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) {
@@ -444,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 e6b445e232..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, int cursorTargetScale, 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/webos/webos.cpp b/backends/platform/webos/webos.cpp
index 4ec153a7e9..fc18628235 100644
--- a/backends/platform/webos/webos.cpp
+++ b/backends/platform/webos/webos.cpp
@@ -45,24 +45,4 @@ void OSystem_SDL_WebOS::initBackend() {
OSystem_SDL::initBackend();
}
-/**
- * Gets the original SDL hardware key set, adds WebOS specific keys and
- * returns the new key set.
- *
- * @return The hardware key set with added webOS specific keys.
- */
-#ifdef ENABLE_KEYMAPPER
-HardwareInputSet *OSystem_SDL_WebOS::getHardwareInputSet() {
- // Get the original SDL hardware key set
- HardwareInputSet *inputSet = OSystem_SDL::getHardwareInputSet();
-
- // Add WebOS specific keys
- inputSet->addHardwareInput(new HardwareInput("FORWARD",
- KeyState((KeyCode) 229, 229, 0), "Forward"));
-
- // Return the modified hardware key set
- return inputSet;
-}
-#endif
-
#endif
diff --git a/backends/platform/webos/webos.h b/backends/platform/webos/webos.h
index 8dfa43239c..dda56a70da 100644
--- a/backends/platform/webos/webos.h
+++ b/backends/platform/webos/webos.h
@@ -31,9 +31,6 @@ public:
OSystem_SDL_WebOS();
virtual void initBackend();
-#ifdef ENABLE_KEYMAPPER
- virtual Common::HardwareInputSet *getHardwareInputSet();
-#endif
};
#endif
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 258a782cc4..22a6495f8f 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -39,7 +39,7 @@
OSystem_Wii::OSystem_Wii() :
_startup_time(0),
- _cursorScale(1),
+ _cursorDontScale(true),
_cursorPaletteDisabled(true),
_cursorPalette(NULL),
_cursorPaletteDirty(false),
@@ -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 64197f913a..5d6998d0b6 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -56,7 +56,7 @@ class OSystem_Wii : public EventsBaseBackend, public PaletteManager {
private:
s64 _startup_time;
- int _cursorScale;
+ bool _cursorDontScale;
bool _cursorPaletteDisabled;
u16 *_cursorPalette;
bool _cursorPaletteDirty;
@@ -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,9 +187,9 @@ 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,
- int cursorTargetScale,
+ bool dontScale,
const Graphics::PixelFormat *format);
virtual bool pollEvent(Common::Event &event);
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 83607984cc..fc0802dd4c 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);
}
@@ -450,7 +451,7 @@ bool OSystem_Wii::needsScreenUpdate() {
void OSystem_Wii::updateScreen() {
static f32 ar;
static gfx_screen_coords_t cc;
- static int cs;
+ static f32 csx, csy;
u32 now = getMillis();
if (now - _lastScreenUpdate < 1000 / MAX_FPS)
@@ -465,7 +466,6 @@ void OSystem_Wii::updateScreen() {
wii_memstats();
#endif
- cs = _cursorScale;
_lastScreenUpdate = now;
if (_overlayVisible || _consoleVisible)
@@ -487,12 +487,6 @@ void OSystem_Wii::updateScreen() {
if (_gameRunning)
ar = gfx_set_ar(4.0 / 3.0);
- // ugly, but the modern theme sets a factor of 3, only god knows why
- if (cs > 2)
- cs = 1;
- else
- cs *= 2;
-
if (_overlayDirty) {
gfx_tex_convert(&_texOverlay, _overlayPixels);
_overlayDirty = false;
@@ -502,10 +496,18 @@ void OSystem_Wii::updateScreen() {
}
if (_mouseVisible) {
- cc.x = f32(_mouseX - cs * _mouseHotspotX) * _currentXScale;
- cc.y = f32(_mouseY - cs * _mouseHotspotY) * _currentYScale;
- cc.w = f32(_texMouse.width) * _currentXScale * cs;
- cc.h = f32(_texMouse.height) * _currentYScale * cs;
+ if (_cursorDontScale) {
+ csx = 1.0f / _currentXScale;
+ csy = 1.0f / _currentYScale;
+ } else {
+ csx = 1.0f;
+ csy = 1.0f;
+ }
+
+ cc.x = f32(_mouseX - csx * _mouseHotspotX) * _currentXScale;
+ cc.y = f32(_mouseY - csy * _mouseHotspotY) * _currentYScale;
+ cc.w = f32(_texMouse.width) * _currentXScale * csx;
+ cc.h = f32(_texMouse.height) * _currentYScale * csy;
if (_texMouse.palette && _cursorPaletteDirty) {
_texMouse.palette[_mouseKeyColor] = 0;
@@ -570,28 +572,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 +608,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,9 +646,9 @@ 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,
- int cursorTargetScale,
+ bool dontScale,
const Graphics::PixelFormat *format) {
gfx_tex_format_t tex_format = GFX_TF_PALETTE_RGB5A3;
uint tw, th;
@@ -685,7 +689,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 +706,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 +730,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
@@ -742,7 +746,7 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
_mouseHotspotX = hotspotX;
_mouseHotspotY = hotspotY;
- _cursorScale = cursorTargetScale;
+ _cursorDontScale = dontScale;
if ((_texMouse.palette) && (oldKeycolor != _mouseKeyColor))
_cursorPaletteDirty = true;
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/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp
index 237c50a1ba..64e7e778b6 100644
--- a/backends/saves/default/default-saves.cpp
+++ b/backends/saves/default/default-saves.cpp
@@ -97,7 +97,7 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String
return Common::wrapCompressedReadStream(sf);
}
-Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename) {
+Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename, bool compress) {
// Ensure that the savepath is valid. If not, generate an appropriate error.
Common::String savePathName = getSavePath();
checkPath(Common::FSNode(savePathName));
@@ -112,7 +112,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String
// Open the file for saving
Common::WriteStream *sf = file.createWriteStream();
- return Common::wrapCompressedWriteStream(sf);
+ return compress ? Common::wrapCompressedWriteStream(sf) : sf;
}
bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h
index 1ea87efc67..c7fca279bc 100644
--- a/backends/saves/default/default-saves.h
+++ b/backends/saves/default/default-saves.h
@@ -38,7 +38,7 @@ public:
virtual Common::StringArray listSavefiles(const Common::String &pattern);
virtual Common::InSaveFile *openForLoading(const Common::String &filename);
- virtual Common::OutSaveFile *openForSaving(const Common::String &filename);
+ virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true);
virtual bool removeSavefile(const Common::String &filename);
protected:
diff --git a/backends/saves/windows/windows-saves.cpp b/backends/saves/windows/windows-saves.cpp
index 87348c3416..d520632394 100644
--- a/backends/saves/windows/windows-saves.cpp
+++ b/backends/saves/windows/windows-saves.cpp
@@ -26,8 +26,12 @@
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
+#if defined(ARRAYSIZE)
+#undef ARRAYSIZE
+#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
#include "common/config-manager.h"
#include "common/savefile.h"
diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp
index 8681102cd0..9cd803f148 100644
--- a/backends/timer/default/default-timer.cpp
+++ b/backends/timer/default/default-timer.cpp
@@ -59,7 +59,6 @@ void insertPrioQueue(TimerSlot *head, TimerSlot *newSlot) {
DefaultTimerManager::DefaultTimerManager() :
- _timerHandler(0),
_head(0) {
_head = new TimerSlot();
diff --git a/backends/timer/default/default-timer.h b/backends/timer/default/default-timer.h
index e5a9dada79..5884979da0 100644
--- a/backends/timer/default/default-timer.h
+++ b/backends/timer/default/default-timer.h
@@ -34,7 +34,6 @@ private:
typedef Common::HashMap<Common::String, TimerProc, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> TimerSlotMap;
Common::Mutex _mutex;
- void *_timerHandler;
TimerSlot *_head;
TimerSlotMap _callbacks;
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();