aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorDavid-John Willis2011-10-03 13:43:42 +0100
committerDavid-John Willis2011-10-03 13:43:42 +0100
commit6269dcdd3cf9dfbbee4abd4441c88051edd70ea8 (patch)
tree9a00bd705b4a7142fbafe7b0bdefb4613b616451 /backends
parent428105b2d393b17e750893556040d665b3fb1c9a (diff)
downloadscummvm-rg350-6269dcdd3cf9dfbbee4abd4441c88051edd70ea8.tar.gz
scummvm-rg350-6269dcdd3cf9dfbbee4abd4441c88051edd70ea8.tar.bz2
scummvm-rg350-6269dcdd3cf9dfbbee4abd4441c88051edd70ea8.zip
GPH: Cleanup the format of code to match our Code Formatting Conventions.
* No functional changes.
Diffstat (limited to 'backends')
-rw-r--r--backends/events/gph/gph-events.cpp246
-rw-r--r--backends/graphics/gph/gph-graphics.cpp52
-rw-r--r--backends/graphics/gph/gph-graphics.h2
-rw-r--r--backends/platform/gph/gph-backend.cpp92
-rw-r--r--backends/platform/gph/gph-hw.cpp58
-rw-r--r--backends/platform/gph/gph-hw.h8
-rw-r--r--backends/platform/gph/gph-main.cpp2
-rw-r--r--backends/platform/gph/gph.h2
8 files changed, 217 insertions, 245 deletions
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp
index ce5d892957..b4e106b790 100644
--- a/backends/events/gph/gph-events.cpp
+++ b/backends/events/gph/gph-events.cpp
@@ -42,167 +42,141 @@
#define JOY_YAXIS 1
/* Quick default button states for modifiers. */
-int BUTTON_STATE_L = false;
+int BUTTON_STATE_L = false;
#if defined(CAANOO)
- /* Caanoo: Main Joystick Button Mappings */
- /* The Caanoo has an analogue stick so no digital DPAD */
- enum {
- /* Joystick Buttons */
- BUTTON_A = 0,
- BUTTON_X = 1,
- BUTTON_B = 2,
- BUTTON_Y = 3,
- BUTTON_L = 4,
- BUTTON_R = 5,
- BUTTON_HOME = 6, // Home
- BUTTON_HOLD = 7, // Hold (on Power)
- BUTTON_HELP = 8, // Help I
- BUTTON_HELP2 = 9, // Help II
- BUTTON_CLICK = 10 // Stick Click
- };
-
- enum {
- /* Unused Joystick Buttons on the Caanoo */
- BUTTON_VOLUP = 51,
- BUTTON_VOLDOWN = 52,
- BUTTON_UP = 53,
- BUTTON_UPLEFT = 54,
- BUTTON_LEFT = 55,
- BUTTON_DOWNLEFT = 56,
- BUTTON_DOWN = 57,
- BUTTON_DOWNRIGHT = 58,
- BUTTON_RIGHT = 59,
- BUTTON_UPRIGHT = 60,
- BUTTON_MENU = 61,
- BUTTON_SELECT = 62
- };
+/* Caanoo: Main Joystick Button Mappings */
+/* The Caanoo has an analogue stick so no digital DPAD */
+enum {
+ /* Joystick Buttons */
+ BUTTON_A = 0,
+ BUTTON_X = 1,
+ BUTTON_B = 2,
+ BUTTON_Y = 3,
+ BUTTON_L = 4,
+ BUTTON_R = 5,
+ BUTTON_HOME = 6, // Home
+ BUTTON_HOLD = 7, // Hold (on Power)
+ BUTTON_HELP = 8, // Help I
+ BUTTON_HELP2 = 9, // Help II
+ BUTTON_CLICK = 10 // Stick Click
+};
-#endif
+enum {
+ /* Unused Joystick Buttons on the Caanoo */
+ BUTTON_VOLUP = 51,
+ BUTTON_VOLDOWN = 52,
+ BUTTON_UP = 53,
+ BUTTON_UPLEFT = 54,
+ BUTTON_LEFT = 55,
+ BUTTON_DOWNLEFT = 56,
+ BUTTON_DOWN = 57,
+ BUTTON_DOWNRIGHT = 58,
+ BUTTON_RIGHT = 59,
+ BUTTON_UPRIGHT = 60,
+ BUTTON_MENU = 61,
+ BUTTON_SELECT = 62
+};
-#if defined(GP2XWIZ)
-
- /* Wiz: Main Joystick Mappings */
- enum {
- /* DPAD */
- BUTTON_UP = 0,
- BUTTON_UPLEFT = 1,
- BUTTON_LEFT = 2,
- BUTTON_DOWNLEFT = 3,
- BUTTON_DOWN = 4,
- BUTTON_DOWNRIGHT = 5,
- BUTTON_RIGHT = 6,
- BUTTON_UPRIGHT = 7,
- /* Joystick Buttons */
- BUTTON_MENU = 8,
- BUTTON_SELECT = 9,
- BUTTON_L = 10,
- BUTTON_R = 11,
- BUTTON_A = 12,
- BUTTON_B = 13,
- BUTTON_X = 14,
- BUTTON_Y = 15,
- BUTTON_VOLUP = 16,
- BUTTON_VOLDOWN = 17
- };
-
- enum {
- /* Unused Joystick Buttons on the Wiz */
- BUTTON_HOME = 51,
- BUTTON_HOLD = 52,
- BUTTON_CLICK = 53,
- BUTTON_HELP = 54,
- BUTTON_HELP2 = 55
- };
+#elif defined(GP2XWIZ)
-#endif
+/* Wiz: Main Joystick Mappings */
+enum {
+ /* DPAD */
+ BUTTON_UP = 0,
+ BUTTON_UPLEFT = 1,
+ BUTTON_LEFT = 2,
+ BUTTON_DOWNLEFT = 3,
+ BUTTON_DOWN = 4,
+ BUTTON_DOWNRIGHT = 5,
+ BUTTON_RIGHT = 6,
+ BUTTON_UPRIGHT = 7,
+ /* Joystick Buttons */
+ BUTTON_MENU = 8,
+ BUTTON_SELECT = 9,
+ BUTTON_L = 10,
+ BUTTON_R = 11,
+ BUTTON_A = 12,
+ BUTTON_B = 13,
+ BUTTON_X = 14,
+ BUTTON_Y = 15,
+ BUTTON_VOLUP = 16,
+ BUTTON_VOLDOWN = 17
+};
-#if defined(GP2X)
+enum {
+ /* Unused Joystick Buttons on the Wiz */
+ BUTTON_HOME = 51,
+ BUTTON_HOLD = 52,
+ BUTTON_CLICK = 53,
+ BUTTON_HELP = 54,
+ BUTTON_HELP2 = 55
+};
+
+#elif defined(GP2X)
enum {
/* DPAD/Stick */
- BUTTON_UP = 0,
- BUTTON_UPLEFT = 1,
- BUTTON_LEFT = 2,
- BUTTON_DOWNLEFT = 3,
- BUTTON_DOWN = 4,
- BUTTON_DOWNRIGHT = 5,
- BUTTON_RIGHT = 6,
- BUTTON_UPRIGHT = 7,
+ BUTTON_UP = 0,
+ BUTTON_UPLEFT = 1,
+ BUTTON_LEFT = 2,
+ BUTTON_DOWNLEFT = 3,
+ BUTTON_DOWN = 4,
+ BUTTON_DOWNRIGHT = 5,
+ BUTTON_RIGHT = 6,
+ BUTTON_UPRIGHT = 7,
/* Joystick Buttons */
- BUTTON_MENU = 8, // Start on F100 GP2X
- BUTTON_SELECT = 9,
- BUTTON_L = 10,
- BUTTON_R = 11,
- BUTTON_A = 12,
- BUTTON_B = 13,
- BUTTON_X = 14,
- BUTTON_Y = 15,
- BUTTON_VOLUP = 16,
- BUTTON_VOLDOWN = 17,
- BUTTON_CLICK = 18
+ BUTTON_MENU = 8, // Start on F100 GP2X
+ BUTTON_SELECT = 9,
+ BUTTON_L = 10,
+ BUTTON_R = 11,
+ BUTTON_A = 12,
+ BUTTON_B = 13,
+ BUTTON_X = 14,
+ BUTTON_Y = 15,
+ BUTTON_VOLUP = 16,
+ BUTTON_VOLDOWN = 17,
+ BUTTON_CLICK = 18
};
enum {
/* Unused Joystick Buttons on the GP2X */
- BUTTON_HOME = 51,
- BUTTON_HOLD = 52,
- BUTTON_HELP = 53,
- BUTTON_HELP2 = 54
+ BUTTON_HOME = 51,
+ BUTTON_HOLD = 52,
+ BUTTON_HELP = 53,
+ BUTTON_HELP2 = 54
};
#endif
enum {
/* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
};
GPHEventSource::GPHEventSource()
- : _buttonStateL(false){
+ : _buttonStateL(false) {
}
-//void GPHEventSource::processMouseEvent(Common::Event &event, int x, int y) {
-// if (GPHGraphicsManager::_videoMode.mode == GFX_HALF && !GPHGraphicsManager::_overlayVisible){
-// event.mouse.x = x*2;
-// event.mouse.y = y*2;
-// } else {
-// event.mouse.x = x;
-// event.mouse.y = y;
-// }
-//
-// // Update the "keyboard mouse" coords
-// _km.x = x;
-// _km.y = y;
-//
-// // Adjust for the screen scaling
-// if (!_overlayVisible) {
-// event.mouse.x /= _videoMode.scaleFactor;
-// event.mouse.y /= _videoMode.scaleFactor;
-// if (_videoMode.aspectRatioCorrection)
-// event.mouse.y = aspect2Real(event.mouse.y);
-// }
-//}
-
void GPHEventSource::moveStick() {
bool stickBtn[32];
memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
- if ((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6]))
+ 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) {
+ 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) {
+ } else if ((stickBtn[5]) || (stickBtn[6]) || (stickBtn[7])) {
+ if (_km.x_down_count != 2) {
_km.x_vel = 1;
_km.x_down_count = 1;
} else
@@ -212,14 +186,14 @@ void GPHEventSource::moveStick() {
_km.x_down_count = 0;
}
- if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])) {
- if (_km.y_down_count!=2) {
+ 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) {
+ } else if ((stickBtn[3]) || (stickBtn[4]) || (stickBtn[5])) {
+ if (_km.y_down_count != 2) {
_km.y_vel = 1;
_km.y_down_count = 1;
} else
@@ -233,7 +207,7 @@ void GPHEventSource::moveStick() {
/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
bool GPHEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
- if (ev.button.button == SDL_BUTTON_LEFT){
+ if (ev.button.button == SDL_BUTTON_LEFT) {
if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
event.type = Common::EVENT_RBUTTONDOWN;
else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
@@ -244,8 +218,7 @@ bool GPHEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event)
event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
- }
- else if (ev.button.button == SDL_BUTTON_RIGHT)
+ } else if (ev.button.button == SDL_BUTTON_RIGHT)
event.type = Common::EVENT_RBUTTONDOWN;
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
else if (ev.button.button == SDL_BUTTON_WHEELUP)
@@ -266,7 +239,7 @@ bool GPHEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event)
}
bool GPHEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
- if (ev.button.button == SDL_BUTTON_LEFT){
+ if (ev.button.button == SDL_BUTTON_LEFT) {
if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
event.type = Common::EVENT_RBUTTONUP;
else if (GPH::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
@@ -277,8 +250,7 @@ bool GPHEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
- }
- else if (ev.button.button == SDL_BUTTON_RIGHT)
+ } else if (ev.button.button == SDL_BUTTON_RIGHT)
event.type = Common::EVENT_RBUTTONUP;
#if defined(SDL_BUTTON_MIDDLE)
else if (ev.button.button == SDL_BUTTON_MIDDLE)
@@ -354,8 +326,8 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
if (BUTTON_STATE_L == true) {
event.type = Common::EVENT_PREDICTIVE_DIALOG;
} else {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
}
break;
case BUTTON_Y:
@@ -500,7 +472,7 @@ bool GPHEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
return true;
}
-bool GPHEventSource::remapKey(SDL_Event &ev,Common::Event &event) {
+bool GPHEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
return false;
}
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index fe5f51425b..a0c1d9ad2b 100644
--- a/backends/graphics/gph/gph-graphics.cpp
+++ b/backends/graphics/gph/gph-graphics.cpp
@@ -36,7 +36,7 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
};
GPHGraphicsManager::GPHGraphicsManager(SdlEventSource *sdlEventSource)
- : SurfaceSdlGraphicsManager(sdlEventSource) {
+ : SurfaceSdlGraphicsManager(sdlEventSource) {
}
const OSystem::GraphicsMode *GPHGraphicsManager::getSupportedGraphicsModes() const {
@@ -138,7 +138,7 @@ void GPHGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *f
_videoMode.screenWidth = w;
_videoMode.screenHeight = h;
- if (w > 320 || h > 240){
+ if (w > 320 || h > 240) {
setGraphicsMode(GFX_HALF);
setGraphicsModeIntern();
_eventSource->toggleMouseGrab();
@@ -161,9 +161,9 @@ void GPHGraphicsManager::drawMouse() {
int width, height;
int hotX, hotY;
- if (_videoMode.mode == GFX_HALF && !_overlayVisible){
- dst.x = _mouseCurState.x/2;
- dst.y = _mouseCurState.y/2;
+ if (_videoMode.mode == GFX_HALF && !_overlayVisible) {
+ dst.x = _mouseCurState.x / 2;
+ dst.y = _mouseCurState.y / 2;
} else {
dst.x = _mouseCurState.x;
dst.y = _mouseCurState.y;
@@ -230,9 +230,9 @@ void GPHGraphicsManager::undrawMouse() {
if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight))
return;
- if (_mouseBackup.w != 0 && _mouseBackup.h != 0){
- if (_videoMode.mode == GFX_HALF && !_overlayVisible){
- addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2);
+ if (_mouseBackup.w != 0 && _mouseBackup.h != 0) {
+ if (_videoMode.mode == GFX_HALF && !_overlayVisible) {
+ addDirtyRect(x * 2, y * 2, _mouseBackup.w * 2, _mouseBackup.h * 2);
} else {
addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h);
}
@@ -252,8 +252,8 @@ void GPHGraphicsManager::internUpdateScreen() {
// If the shake position changed, fill the dirty area with blackness
if (_currentShakePos != _newShakePos ||
- (_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
- SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
+ (_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
+ SDL_Rect blackrect = {0, 0, _videoMode.screenWidth *_videoMode.scaleFactor, _newShakePos *_videoMode.scaleFactor};
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
@@ -269,8 +269,8 @@ void GPHGraphicsManager::internUpdateScreen() {
// screen surface accordingly.
if (_screen && _paletteDirtyEnd != 0) {
SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart,
- _paletteDirtyStart,
- _paletteDirtyEnd - _paletteDirtyStart);
+ _paletteDirtyStart,
+ _paletteDirtyEnd - _paletteDirtyStart);
_paletteDirtyEnd = 0;
@@ -340,8 +340,8 @@ void GPHGraphicsManager::internUpdateScreen() {
for (r = _dirtyRectList; r != lastRect; ++r) {
dst = *r;
- dst.x++; // Shift rect by one since 2xSai needs to access the data around
- dst.y++; // any pixel to scale it, and we want to avoid mem access crashes.
+ dst.x++; // Shift rect by one since 2xSai needs to access the data around
+ dst.y++; // any pixel to scale it, and we want to avoid mem access crashes.
if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
error("SDL_BlitSurface failed: %s", SDL_GetError());
@@ -377,11 +377,11 @@ void GPHGraphicsManager::internUpdateScreen() {
assert(scalerProc != NULL);
if ((_videoMode.mode == GFX_HALF) && (scalerProc == DownscaleAllByHalf)) {
- if (dst_x%2==1){
+ if (dst_x % 2 == 1) {
dst_x--;
dst_w++;
}
- if (dst_y%2==1){
+ if (dst_y % 2 == 1) {
dst_y--;
dst_h++;
}
@@ -391,14 +391,14 @@ void GPHGraphicsManager::internUpdateScreen() {
dst_y = dst_y / 2;
scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch,
- (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
+ (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
} else {
scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + r->x * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
}
}
- if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf){
+ if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf) {
r->w = r->w / 2;
r->h = dst_h / 2;
} else {
@@ -422,7 +422,7 @@ void GPHGraphicsManager::internUpdateScreen() {
// This is necessary if shaking is active.
if (_forceFull) {
_dirtyRectList[0].y = 0;
- _dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? effectiveScreenHeight()/2 : effectiveScreenHeight();
+ _dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? effectiveScreenHeight() / 2 : effectiveScreenHeight();
}
drawMouse();
@@ -442,7 +442,7 @@ void GPHGraphicsManager::internUpdateScreen() {
}
void GPHGraphicsManager::showOverlay() {
- if (_videoMode.mode == GFX_HALF){
+ if (_videoMode.mode == GFX_HALF) {
_mouseCurState.x = _mouseCurState.x / 2;
_mouseCurState.y = _mouseCurState.y / 2;
}
@@ -450,7 +450,7 @@ void GPHGraphicsManager::showOverlay() {
}
void GPHGraphicsManager::hideOverlay() {
- if (_videoMode.mode == GFX_HALF){
+ if (_videoMode.mode == GFX_HALF) {
_mouseCurState.x = _mouseCurState.x * 2;
_mouseCurState.y = _mouseCurState.y * 2;
}
@@ -497,10 +497,10 @@ bool GPHGraphicsManager::hasFeature(OSystem::Feature f) {
void GPHGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
switch (f) {
- case OSystem::kFeatureAspectRatioCorrection:
+ case OSystem::kFeatureAspectRatioCorrection:
setAspectRatioCorrection(enable);
break;
- case OSystem::kFeatureCursorPalette:
+ case OSystem::kFeatureCursorPalette:
_cursorPaletteDisabled = !enable;
blitCursor();
break;
@@ -513,9 +513,9 @@ bool GPHGraphicsManager::getFeatureState(OSystem::Feature f) {
assert(_transactionMode == kTransactionNone);
switch (f) {
- case OSystem::kFeatureAspectRatioCorrection:
+ case OSystem::kFeatureAspectRatioCorrection:
return _videoMode.aspectRatioCorrection;
- case OSystem::kFeatureCursorPalette:
+ case OSystem::kFeatureCursorPalette:
return !_cursorPaletteDisabled;
default:
return false;
@@ -532,7 +532,7 @@ SurfaceSdlGraphicsManager::VideoState *GPHGraphicsManager::getVideoMode() {
void GPHGraphicsManager::warpMouse(int x, int y) {
if (_mouseCurState.x != x || _mouseCurState.y != y) {
- if (_videoMode.mode == GFX_HALF && !_overlayVisible){
+ if (_videoMode.mode == GFX_HALF && !_overlayVisible) {
x = x / 2;
y = y / 2;
}
diff --git a/backends/graphics/gph/gph-graphics.h b/backends/graphics/gph/gph-graphics.h
index 0118fc7ecd..f1f3d18b41 100644
--- a/backends/graphics/gph/gph-graphics.h
+++ b/backends/graphics/gph/gph-graphics.h
@@ -24,7 +24,7 @@
#define BACKENDS_GRAPHICS_GPH_H
#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
-#include "graphics/scaler/aspect.h" // for aspect2Real
+#include "graphics/scaler/aspect.h" // for aspect2Real
#include "graphics/scaler/downscaler.h"
enum {
diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp
index 8ee84ed6c0..49a1edf411 100644
--- a/backends/platform/gph/gph-backend.cpp
+++ b/backends/platform/gph/gph-backend.cpp
@@ -50,7 +50,7 @@
#include <limits.h>
#include <errno.h>
#include <sys/stat.h>
-#include <time.h> // for getTimeAndDate()
+#include <time.h> // for getTimeAndDate()
/* Dump console info to files. */
#define DUMP_STDOUT
@@ -103,50 +103,50 @@ void OSystem_GPH::initBackend() {
_savefileManager = new DefaultSaveFileManager(savePath);
- #ifdef DUMP_STDOUT
- // The GPH devices have a serial console on the breakout board
- // but most users do not use this so we output all our STDOUT
- // and STDERR to files for debug purposes.
- char STDOUT_FILE[PATH_MAX+1];
- char STDERR_FILE[PATH_MAX+1];
-
- strcpy(STDOUT_FILE, workDirName);
- strcpy(STDERR_FILE, workDirName);
- strcat(STDOUT_FILE, "/scummvm.stdout.txt");
- strcat(STDERR_FILE, "/scummvm.stderr.txt");
-
- // Flush the output in case anything is queued
- fclose(stdout);
- fclose(stderr);
-
- // Redirect standard input and standard output
- FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
- if (newfp == NULL) {
- #if !defined(stdout)
- stdout = fopen(STDOUT_FILE, "w");
- #else
- newfp = fopen(STDOUT_FILE, "w");
- if (newfp) {
- *stdout = *newfp;
- }
- #endif
+#ifdef DUMP_STDOUT
+ // The GPH devices have a serial console on the breakout board
+ // but most users do not use this so we output all our STDOUT
+ // and STDERR to files for debug purposes.
+ char STDOUT_FILE[PATH_MAX+1];
+ char STDERR_FILE[PATH_MAX+1];
+
+ strcpy(STDOUT_FILE, workDirName);
+ strcpy(STDERR_FILE, workDirName);
+ strcat(STDOUT_FILE, "/scummvm.stdout.txt");
+ strcat(STDERR_FILE, "/scummvm.stderr.txt");
+
+ // Flush the output in case anything is queued
+ fclose(stdout);
+ fclose(stderr);
+
+ // Redirect standard input and standard output
+ FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
+ if (newfp == NULL) {
+#if !defined(stdout)
+ stdout = fopen(STDOUT_FILE, "w");
+#else
+ newfp = fopen(STDOUT_FILE, "w");
+ if (newfp) {
+ *stdout = *newfp;
}
+#endif
+ }
- newfp = freopen(STDERR_FILE, "w", stderr);
- if (newfp == NULL) {
- #if !defined(stderr)
- stderr = fopen(STDERR_FILE, "w");
- #else
- newfp = fopen(STDERR_FILE, "w");
- if (newfp) {
- *stderr = *newfp;
- }
- #endif
+ newfp = freopen(STDERR_FILE, "w", stderr);
+ if (newfp == NULL) {
+#if !defined(stderr)
+ stderr = fopen(STDERR_FILE, "w");
+#else
+ newfp = fopen(STDERR_FILE, "w");
+ if (newfp) {
+ *stderr = *newfp;
}
+#endif
+ }
- setbuf(stderr, NULL);
- printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
- #endif /* DUMP_STDOUT */
+ setbuf(stderr, NULL);
+ printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
+#endif /* DUMP_STDOUT */
/* Initialize any GP2X Wiz specific stuff we may want (Batt Status, scaler etc.) */
WIZ_HW::deviceInit();
@@ -214,11 +214,11 @@ void OSystem_GPH::quit() {
WIZ_HW::deviceDeinit();
- #ifdef DUMP_STDOUT
- printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
- fclose(stdout);
- fclose(stderr);
- #endif /* DUMP_STDOUT */
+#ifdef DUMP_STDOUT
+ printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
+ fclose(stdout);
+ fclose(stderr);
+#endif /* DUMP_STDOUT */
OSystem_POSIX::quit();
}
diff --git a/backends/platform/gph/gph-hw.cpp b/backends/platform/gph/gph-hw.cpp
index 2d70158001..cde50dc6b4 100644
--- a/backends/platform/gph/gph-hw.cpp
+++ b/backends/platform/gph/gph-hw.cpp
@@ -43,13 +43,13 @@
namespace WIZ_HW {
enum {
- VOLUME_NOCHG = 0,
- VOLUME_DOWN = 1,
- VOLUME_UP = 2,
- VOLUME_CHANGE_RATE = 8,
- VOLUME_MIN = 0,
- VOLUME_INITIAL = 60,
- VOLUME_MAX = 100
+ VOLUME_NOCHG = 0,
+ VOLUME_DOWN = 1,
+ VOLUME_UP = 2,
+ VOLUME_CHANGE_RATE = 8,
+ VOLUME_MIN = 0,
+ VOLUME_INITIAL = 60,
+ VOLUME_MAX = 100
};
int volumeLevel = VOLUME_INITIAL;
@@ -61,24 +61,24 @@ void deviceDeinit() {
}
void mixerMoveVolume(int direction) {
- if (volumeLevel <= 10) {
- if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2;
- if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;
- } else {
- if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
- if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
- }
-
- if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
- if (volumeLevel > VOLUME_MAX) volumeLevel = VOLUME_MAX;
-
- unsigned long soundDev = open("/dev/mixer", O_RDWR);
-
- if (soundDev) {
- int vol = ((volumeLevel << 8) | volumeLevel);
- ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
- close(soundDev);
- }
+ if (volumeLevel <= 10) {
+ if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE / 2;
+ if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE / 2;
+ } else {
+ if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
+ if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
+ }
+
+ if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
+ if (volumeLevel > VOLUME_MAX) volumeLevel = VOLUME_MAX;
+
+ unsigned long soundDev = open("/dev/mixer", O_RDWR);
+
+ if (soundDev) {
+ int vol = ((volumeLevel << 8) | volumeLevel);
+ ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
+ close(soundDev);
+ }
}
} /* namespace WIZ_HW */
@@ -87,9 +87,9 @@ namespace GPH {
enum {
/* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
+ TAPMODE_LEFT = 0,
+ TAPMODE_RIGHT = 1,
+ TAPMODE_HOVER = 2
};
int tapmodeLevel = TAPMODE_LEFT;
@@ -103,7 +103,7 @@ void ToggleTapMode() {
tapmodeLevel = TAPMODE_LEFT;
} else {
tapmodeLevel = TAPMODE_LEFT;
- }
+ }
}
} /* namespace GPH */
diff --git a/backends/platform/gph/gph-hw.h b/backends/platform/gph/gph-hw.h
index 0a1205156b..f9584ca37e 100644
--- a/backends/platform/gph/gph-hw.h
+++ b/backends/platform/gph/gph-hw.h
@@ -32,9 +32,9 @@ namespace WIZ_HW {
extern int volumeLevel;
-extern void deviceInit();
-extern void deviceDeinit();
-extern void mixerMoveVolume(int);
+extern void deviceInit();
+extern void deviceDeinit();
+extern void mixerMoveVolume(int);
} /* namespace WIZ_HW */
@@ -42,7 +42,7 @@ namespace GPH {
extern int tapmodeLevel;
-extern void ToggleTapMode();
+extern void ToggleTapMode();
} /* namespace GPH */
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index 4f290f71ed..2c43af151f 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
int res = scummvm_main(argc, argv);
// Free OSystem
- delete (OSystem_GPH *)g_system;
+ delete(OSystem_GPH *)g_system;
return res;
}
diff --git a/backends/platform/gph/gph.h b/backends/platform/gph/gph.h
index 8b943f98f3..80f43f0bab 100644
--- a/backends/platform/gph/gph.h
+++ b/backends/platform/gph/gph.h
@@ -34,7 +34,7 @@
#define __GP2XWIZ__
#ifndef PATH_MAX
- #define PATH_MAX 255
+#define PATH_MAX 255
#endif
class OSystem_GPH : public OSystem_POSIX {