aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/openpandora
diff options
context:
space:
mode:
authorDavid-John Willis2011-05-08 22:31:17 +0100
committerDavid-John Willis2011-06-11 17:07:21 +0100
commit4fcd65d885f14b88d3ef3cbdf1bbedd5884c72a7 (patch)
tree50a465813e2ec8b0c3a655fec034fcfe55c7fa23 /backends/platform/openpandora
parent7878c1ec4933dcedf20ab20e15a671a2209c4838 (diff)
downloadscummvm-rg350-4fcd65d885f14b88d3ef3cbdf1bbedd5884c72a7.tar.gz
scummvm-rg350-4fcd65d885f14b88d3ef3cbdf1bbedd5884c72a7.tar.bz2
scummvm-rg350-4fcd65d885f14b88d3ef3cbdf1bbedd5884c72a7.zip
OPENPANDORA: Start to cleanup the backend and move controls into remapkey.
* Work in progress.
Diffstat (limited to 'backends/platform/openpandora')
-rw-r--r--backends/platform/openpandora/op-backend.cpp71
-rw-r--r--backends/platform/openpandora/op-main.cpp4
-rw-r--r--backends/platform/openpandora/op-sdl.h16
3 files changed, 63 insertions, 28 deletions
diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp
index 6bac4ea7d7..5231e9790d 100644
--- a/backends/platform/openpandora/op-backend.cpp
+++ b/backends/platform/openpandora/op-backend.cpp
@@ -20,13 +20,16 @@
*
*/
+#if defined(OPENPANDORA)
+
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
-#include "backends/platform/openpandora/op-sdl.h"
-#include "base/main.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h"
+#include "backends/platform/openpandora/op-sdl.h"
+#include "backends/plugins/posix/posix-provider.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
@@ -35,6 +38,7 @@
#include "common/debug.h"
#include "common/events.h"
#include "common/file.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "audio/mixer_intern.h"
@@ -52,15 +56,29 @@
static SDL_Cursor *hiddenCursor;
-static Uint32 timer_handler(Uint32 interval, void *param) {
- ((DefaultTimerManager *)param)->handler();
- return interval;
+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;
//
@@ -76,12 +94,12 @@ void OSystem_OP::initBackend() {
//
// Create the mixer manager
- if (_mixer == 0) {
- _mixerManager = new DoubleBufferSDLMixerManager();
+// if (_mixer == 0) {
+// _mixerManager = new DoubleBufferSDLMixerManager();
// Setup and start mixer
- _mixerManager->init();
- }
+// _mixerManager->init();
+// }
/* Setup default save path to be workingdir/saves */
@@ -103,7 +121,7 @@ void OSystem_OP::initBackend() {
if (mkdir(savePath, 0755) != 0)
warning("mkdir for '%s' failed!", savePath);
-// _savefileManager = new DefaultSaveFileManager(savePath);
+ _savefileManager = new DefaultSaveFileManager(savePath);
#ifdef DUMP_STDOUT
// The OpenPandora has a serial console on the EXT connection but most users do not use this so we
@@ -161,22 +179,32 @@ void OSystem_OP::initBackend() {
/* 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 OPEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0)
- _graphicsManager = new OPGraphicsManager(_eventSource);
-
// _graphicsMutex = createMutex();
- // Invoke parent implementation of this method
+ /* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::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) {
@@ -219,13 +247,14 @@ void OSystem_OP::initSDL() {
// _videoMode.fullscreen = true;
_initedSDL = true;
+
+// OSystem_POSIX::initSDL();
}
}
void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
/* Setup default extra data paths for engine data files and plugins */
-
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
@@ -256,3 +285,5 @@ void OSystem_OP::quit() {
OSystem_POSIX::quit();
}
+
+#endif
diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp
index ab777fec8f..ae9d288e26 100644
--- a/backends/platform/openpandora/op-main.cpp
+++ b/backends/platform/openpandora/op-main.cpp
@@ -20,8 +20,6 @@
*
*/
-
-#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/openpandora/op-sdl.h"
#include "backends/plugins/posix/posix-provider.h"
#include "base/main.h"
@@ -35,7 +33,7 @@ int main(int argc, char *argv[]) {
assert(g_system);
// Pre initialize the backend
- //((OSystem_OP *)g_system)->init();
+ ((OSystem_OP *)g_system)->init();
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h
index 9d92472b17..d493c3957c 100644
--- a/backends/platform/openpandora/op-sdl.h
+++ b/backends/platform/openpandora/op-sdl.h
@@ -26,12 +26,12 @@
#if defined(OPENPANDORA)
#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/openpandora/op-events.h"
#include "backends/graphics/openpandora/op-graphics.h"
-#define __OPENPANDORA__
+//#define MIXER_DOUBLE_BUFFERING 1
#ifndef PATH_MAX
#define PATH_MAX 255
@@ -39,16 +39,22 @@
class OSystem_OP : public OSystem_POSIX {
public:
- OSystem_OP() {}
+ OSystem_OP();
/* Platform Setup Stuff */
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
- void initSDL();
void quit();
protected:
-
+ bool _inited;
+ bool _initedSDL;
+
+ /**
+ * Initialse the SDL library
+ * with an OpenPandora workaround.
+ */
+ virtual void initSDL();
};
#endif
#endif //OP_SDL_H