diff options
Diffstat (limited to 'backends/platform/gph')
-rw-r--r-- | backends/platform/gph/gph-backend.cpp | 92 | ||||
-rw-r--r-- | backends/platform/gph/gph-hw.cpp | 58 | ||||
-rw-r--r-- | backends/platform/gph/gph-hw.h | 8 | ||||
-rw-r--r-- | backends/platform/gph/gph-main.cpp | 2 | ||||
-rw-r--r-- | backends/platform/gph/gph.h | 2 |
5 files changed, 81 insertions, 81 deletions
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 { |