OPENPANDORA: Cleanup the format of code a little to match our Code Formatting Conventions.

* No functional changes.
* Automated astyle pass.
This commit is contained in:
David-John Willis 2011-10-10 21:18:07 +01:00
parent a4cc70c5e1
commit a27c2b401c
7 changed files with 70 additions and 72 deletions

View file

@ -38,23 +38,23 @@
#include "common/events.h" #include "common/events.h"
/* Quick default button states for modifiers. */ /* Quick default button states for modifiers. */
int BUTTON_STATE_L = false; int BUTTON_STATE_L = false;
enum { enum {
/* Touchscreen TapMode */ /* Touchscreen TapMode */
TAPMODE_LEFT = 0, TAPMODE_LEFT = 0,
TAPMODE_RIGHT = 1, TAPMODE_RIGHT = 1,
TAPMODE_HOVER = 2 TAPMODE_HOVER = 2
}; };
OPEventSource::OPEventSource() OPEventSource::OPEventSource()
: _buttonStateL(false){ : _buttonStateL(false) {
} }
/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */ /* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) { bool OPEventSource::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 */ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
event.type = Common::EVENT_RBUTTONDOWN; event.type = Common::EVENT_RBUTTONDOWN;
else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
@ -65,8 +65,7 @@ bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_MOUSEMOVE; event.type = Common::EVENT_MOUSEMOVE;
else else
event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */ 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; event.type = Common::EVENT_RBUTTONDOWN;
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN) #if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
else if (ev.button.button == SDL_BUTTON_WHEELUP) else if (ev.button.button == SDL_BUTTON_WHEELUP)
@ -87,7 +86,7 @@ bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
} }
bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) { bool OPEventSource::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 */ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
event.type = Common::EVENT_RBUTTONUP; event.type = Common::EVENT_RBUTTONUP;
else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */ else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
@ -98,8 +97,7 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_MOUSEMOVE; event.type = Common::EVENT_MOUSEMOVE;
else else
event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */ 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; event.type = Common::EVENT_RBUTTONUP;
#if defined(SDL_BUTTON_MIDDLE) #if defined(SDL_BUTTON_MIDDLE)
else if (ev.button.button == SDL_BUTTON_MIDDLE) else if (ev.button.button == SDL_BUTTON_MIDDLE)

View file

@ -24,7 +24,7 @@
#define BACKENDS_GRAPHICS_OP_H #define BACKENDS_GRAPHICS_OP_H
#include "backends/graphics/surfacesdl/surfacesdl-graphics.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" #include "graphics/scaler/downscaler.h"
enum { enum {

View file

@ -49,7 +49,7 @@
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> // for getTimeAndDate() #include <time.h> // for getTimeAndDate()
/* Dump console info to files. */ /* Dump console info to files. */
#define DUMP_STDOUT #define DUMP_STDOUT
@ -97,7 +97,7 @@ void OSystem_OP::initBackend() {
// if (_mixer == 0) { // if (_mixer == 0) {
// _mixerManager = new DoubleBufferSDLMixerManager(); // _mixerManager = new DoubleBufferSDLMixerManager();
// Setup and start mixer // Setup and start mixer
// _mixerManager->init(); // _mixerManager->init();
// } // }
@ -123,49 +123,49 @@ void OSystem_OP::initBackend() {
_savefileManager = new DefaultSaveFileManager(savePath); _savefileManager = new DefaultSaveFileManager(savePath);
#ifdef DUMP_STDOUT #ifdef DUMP_STDOUT
// The OpenPandora has a serial console on the EXT connection but most users do not use this so we // The OpenPandora has a serial console on the EXT connection but most users do not use this so we
// output all our STDOUT and STDERR to files for debug purposes. // output all our STDOUT and STDERR to files for debug purposes.
char STDOUT_FILE[PATH_MAX+1]; char STDOUT_FILE[PATH_MAX+1];
char STDERR_FILE[PATH_MAX+1]; char STDERR_FILE[PATH_MAX+1];
strcpy(STDOUT_FILE, workDirName); strcpy(STDOUT_FILE, workDirName);
strcpy(STDERR_FILE, workDirName); strcpy(STDERR_FILE, workDirName);
strcat(STDOUT_FILE, "/scummvm.stdout.txt"); strcat(STDOUT_FILE, "/scummvm.stdout.txt");
strcat(STDERR_FILE, "/scummvm.stderr.txt"); strcat(STDERR_FILE, "/scummvm.stderr.txt");
// Flush the output in case anything is queued // Flush the output in case anything is queued
fclose(stdout); fclose(stdout);
fclose(stderr); fclose(stderr);
// Redirect standard input and standard output // Redirect standard input and standard output
FILE *newfp = freopen(STDOUT_FILE, "w", stdout); FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
if (newfp == NULL) { if (newfp == NULL) {
#if !defined(stdout) #if !defined(stdout)
stdout = fopen(STDOUT_FILE, "w"); stdout = fopen(STDOUT_FILE, "w");
#else #else
newfp = fopen(STDOUT_FILE, "w"); newfp = fopen(STDOUT_FILE, "w");
if (newfp) { if (newfp) {
*stdout = *newfp; *stdout = *newfp;
}
#endif
} }
#endif
}
newfp = freopen(STDERR_FILE, "w", stderr); newfp = freopen(STDERR_FILE, "w", stderr);
if (newfp == NULL) { if (newfp == NULL) {
#if !defined(stderr) #if !defined(stderr)
stderr = fopen(STDERR_FILE, "w"); stderr = fopen(STDERR_FILE, "w");
#else #else
newfp = fopen(STDERR_FILE, "w"); newfp = fopen(STDERR_FILE, "w");
if (newfp) { if (newfp) {
*stderr = *newfp; *stderr = *newfp;
}
#endif
} }
#endif
}
setbuf(stderr, NULL); setbuf(stderr, NULL);
printf("%s\n", "Debug: STDOUT and STDERR redirected to text files."); printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
#endif /* DUMP_STDOUT */ #endif /* DUMP_STDOUT */
/* Trigger autosave every 4 minutes. */ /* Trigger autosave every 4 minutes. */
ConfMan.registerDefault("autosave_period", 4 * 60); ConfMan.registerDefault("autosave_period", 4 * 60);
@ -187,7 +187,7 @@ void OSystem_OP::initBackend() {
_inited = true; _inited = true;
} }
// enable joystick // enable joystick
// if (joystick_num > -1 && SDL_NumJoysticks() > 0) { // if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
// printf("Using joystick: %s\n", SDL_JoystickName(0)); // printf("Using joystick: %s\n", SDL_JoystickName(0));
// _joystick = SDL_JoystickOpen(joystick_num); // _joystick = SDL_JoystickOpen(joystick_num);
@ -195,13 +195,13 @@ void OSystem_OP::initBackend() {
// //
// setupMixer(); // setupMixer();
// Note: We could implement a custom SDLTimerManager by using // Note: We could implement a custom SDLTimerManager by using
// SDL_AddTimer. That might yield better timer resolution, but it would // SDL_AddTimer. That might yield better timer resolution, but it would
// also change the semantics of a timer: Right now, ScummVM timers // also change the semantics of a timer: Right now, ScummVM timers
// *never* run in parallel, due to the way they are implemented. If we // *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. // 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 // 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. // switch. Still, it's a potential future change to keep in mind.
// _timer = new DefaultTimerManager(); // _timer = new DefaultTimerManager();
// _timerID = SDL_AddTimer(10, &timer_handler, _timer); // _timerID = SDL_AddTimer(10, &timer_handler, _timer);
@ -217,9 +217,9 @@ void OSystem_OP::initSDL() {
if (SDL_Init(sdlFlags) == -1) if (SDL_Init(sdlFlags) == -1)
error("Could not initialize SDL: %s", SDL_GetError()); error("Could not initialize SDL: %s", SDL_GetError());
uint8_t hiddenCursorData = 0; uint8_t hiddenCursorData = 0;
hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0); hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
/* On the OpenPandora we need to work around an SDL assumption that /* On the OpenPandora we need to work around an SDL assumption that
returns relative mouse coordinates when you get to the screen returns relative mouse coordinates when you get to the screen
@ -277,11 +277,11 @@ void OSystem_OP::quit() {
SDL_FreeCursor(hiddenCursor); SDL_FreeCursor(hiddenCursor);
#ifdef DUMP_STDOUT #ifdef DUMP_STDOUT
printf("%s\n", "Debug: STDOUT and STDERR text files closed."); printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
fclose(stdout); fclose(stdout);
fclose(stderr); fclose(stderr);
#endif /* DUMP_STDOUT */ #endif /* DUMP_STDOUT */
OSystem_POSIX::quit(); OSystem_POSIX::quit();
} }

View file

@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
int res = scummvm_main(argc, argv); int res = scummvm_main(argc, argv);
// Free OSystem // Free OSystem
delete (OSystem_OP *)g_system; delete(OSystem_OP *)g_system;
return res; return res;
} }

View file

@ -31,9 +31,9 @@ namespace OP {
enum { enum {
/* Touchscreen TapMode */ /* Touchscreen TapMode */
TAPMODE_LEFT = 0, TAPMODE_LEFT = 0,
TAPMODE_RIGHT = 1, TAPMODE_RIGHT = 1,
TAPMODE_HOVER = 2 TAPMODE_HOVER = 2
}; };
int tapmodeLevel = TAPMODE_LEFT; int tapmodeLevel = TAPMODE_LEFT;
@ -47,7 +47,7 @@ void ToggleTapMode() {
tapmodeLevel = TAPMODE_LEFT; tapmodeLevel = TAPMODE_LEFT;
} else { } else {
tapmodeLevel = TAPMODE_LEFT; tapmodeLevel = TAPMODE_LEFT;
} }
} }
} /* namespace OP */ } /* namespace OP */

View file

@ -32,7 +32,7 @@ namespace OP {
extern int tapmodeLevel; extern int tapmodeLevel;
extern void ToggleTapMode(); extern void ToggleTapMode();
} /* namespace OP */ } /* namespace OP */

View file

@ -34,7 +34,7 @@
//#define MIXER_DOUBLE_BUFFERING 1 //#define MIXER_DOUBLE_BUFFERING 1
#ifndef PATH_MAX #ifndef PATH_MAX
#define PATH_MAX 255 #define PATH_MAX 255
#endif #endif
class OSystem_OP : public OSystem_POSIX { class OSystem_OP : public OSystem_POSIX {