aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMax Horn2006-04-02 14:16:31 +0000
committerMax Horn2006-04-02 14:16:31 +0000
commit9217472f0e4e801659c0a448dcbf57c28fd36ee2 (patch)
treeb880dfbd4a18f93f78931749004c3a4e128f2f59 /backends
parent72f4a1c76cb8aedf6f953e57090134320d7291b8 (diff)
downloadscummvm-rg350-9217472f0e4e801659c0a448dcbf57c28fd36ee2.tar.gz
scummvm-rg350-9217472f0e4e801659c0a448dcbf57c28fd36ee2.tar.bz2
scummvm-rg350-9217472f0e4e801659c0a448dcbf57c28fd36ee2.zip
With this change, backends are now responsible for instantiating their OSystem class before calling scummvm_main (Note: PalmOS and Symbian are not yet converted, and won't work currently)
svn-id: r21557
Diffstat (limited to 'backends')
-rw-r--r--backends/dc/dc.h3
-rw-r--r--backends/dc/dcmain.cpp11
-rw-r--r--backends/gp32/gp32_main.cpp3
-rw-r--r--backends/intern.h18
-rw-r--r--backends/maemo/main.cpp5
-rw-r--r--backends/morphos/morphos_start.cpp3
-rw-r--r--backends/null/null.cpp2
-rw-r--r--backends/ps2/systemps2.cpp11
-rw-r--r--backends/psp/psp_main.cpp3
-rw-r--r--backends/sdl/sdl.cpp6
-rw-r--r--backends/wince/wince-sdl.cpp2
-rw-r--r--backends/x11/x11.cpp7
12 files changed, 29 insertions, 45 deletions
diff --git a/backends/dc/dc.h b/backends/dc/dc.h
index bc74906766..dd390c7f2d 100644
--- a/backends/dc/dc.h
+++ b/backends/dc/dc.h
@@ -188,9 +188,6 @@ class OSystem_Dreamcast : public OSystem {
void mouseToSoftKbd(int x, int y, int &rx, int &ry) const;
- static OSystem *create();
-
-
private:
SoftKeyboard _softkbd;
diff --git a/backends/dc/dcmain.cpp b/backends/dc/dcmain.cpp
index d622c35019..5e59f80813 100644
--- a/backends/dc/dcmain.cpp
+++ b/backends/dc/dcmain.cpp
@@ -36,14 +36,6 @@
Icon icon;
const char *gGameName;
-OSystem *OSystem_Dreamcast_create() {
- return OSystem_Dreamcast::create();
-}
-
-OSystem *OSystem_Dreamcast::create() {
- OSystem_Dreamcast *syst = new OSystem_Dreamcast();
- return syst;
-}
OSystem_Dreamcast::OSystem_Dreamcast()
: _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this),
@@ -211,6 +203,9 @@ int main()
dc_init_hardware();
initSound();
+ g_system = new OSystem_Dreamcast();
+ assert(g_system);
+
scummvm_main(argc, argv);
exit(0);
diff --git a/backends/gp32/gp32_main.cpp b/backends/gp32/gp32_main.cpp
index 8abdb4a7ce..3fb32aa9b2 100644
--- a/backends/gp32/gp32_main.cpp
+++ b/backends/gp32/gp32_main.cpp
@@ -71,5 +71,8 @@ void GpMain(void *arg) {
//scummvm_main(argc, argv);
+ g_system = new OSystem_GP32_create();
+ assert(g_system);
+
scummvm_main(1, NULL);
}
diff --git a/backends/intern.h b/backends/intern.h
index 079107140f..f6304fb7b5 100644
--- a/backends/intern.h
+++ b/backends/intern.h
@@ -25,24 +25,6 @@
#include "common/system.h"
-/* Factory functions. This means we don't have to include the headers for
- * all backends.
- */
-extern OSystem *OSystem_SDL_create();
-extern OSystem *OSystem_NULL_create();
-extern OSystem *OSystem_MorphOS_create();
-extern OSystem *OSystem_Dreamcast_create();
-extern OSystem *OSystem_WINCE3_create();
-extern OSystem *OSystem_X11_create();
-extern OSystem *OSystem_GP32_create();
-extern OSystem *OSystem_PALMOS_create();
-extern OSystem *OSystem_PS2_create();
-extern OSystem *OSystem_PSP_create();
-extern OSystem *OSystem_SymbianOS_create();
-
-extern OSystem *OSystem_PalmOS5_create();
-extern OSystem *OSystem_PalmZodiac_create();
-
#ifdef _WIN32_WCE
#define SAMPLES_PER_SEC 22050
#define SAMPLES_PER_SEC_OLD 11025
diff --git a/backends/maemo/main.cpp b/backends/maemo/main.cpp
index 231f319158..3d155cc625 100644
--- a/backends/maemo/main.cpp
+++ b/backends/maemo/main.cpp
@@ -28,6 +28,7 @@
#include <SDL/SDL.h>
#include <SDL/SDL_syswm.h>
+#include "backends/sdl/sdl-common.h"
#include "base/main.h"
#include <hildon-widgets/hildon-app.h>
#include <gtk/gtk.h>
@@ -63,6 +64,10 @@ int main(int argc, char *argv[]) {
setpriority(PRIO_PROCESS, 0, 0);
set_doubling(0);
+
+ g_system = new OSystem_SDL();
+ assert(g_system);
+
scummvm_main(argc, argv);
/* Deinitialize OSSO */
diff --git a/backends/morphos/morphos_start.cpp b/backends/morphos/morphos_start.cpp
index f7ec56f224..6a8299d2cd 100644
--- a/backends/morphos/morphos_start.cpp
+++ b/backends/morphos/morphos_start.cpp
@@ -434,6 +434,9 @@ int main()
if (ScummStory)
argv[argc++] = ScummStory;
+ g_system = OSystem_MorphOS_create();
+ assert(g_system);
+
return scummvm_main(argc, argv);
}
diff --git a/backends/null/null.cpp b/backends/null/null.cpp
index d60206f4f4..03939896b1 100644
--- a/backends/null/null.cpp
+++ b/backends/null/null.cpp
@@ -108,6 +108,8 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
int main(int argc, char *argv[]) {
// Invoke the actual ScummVM main entry point:
+ g_system = OSystem_NULL_create();
+ assert(g_system);
return scummvm_main(argc, argv);
}
diff --git a/backends/ps2/systemps2.cpp b/backends/ps2/systemps2.cpp
index d0154ab590..f277648c27 100644
--- a/backends/ps2/systemps2.cpp
+++ b/backends/ps2/systemps2.cpp
@@ -72,8 +72,6 @@ static int g_MainWaitSema = -1, g_TimerWaitSema = -1;
static volatile int32 g_MainWakeUp = 0, g_TimerWakeUp = 0;
static volatile uint32 msecCount = 0;
-OSystem_PS2 *g_systemPs2 = NULL;
-
int gBitFormat = 555;
#define FOREVER 2147483647
@@ -93,12 +91,6 @@ void sioprintf(const char *zFormat, ...) {
sio_puts(resStr);
}
-OSystem *OSystem_PS2_create(void) {
- if (!g_systemPs2)
- g_systemPs2 = new OSystem_PS2();
- return g_systemPs2;
-}
-
extern "C" int main(int argc, char *argv[]) {
SifInitRpc(0);
#ifndef USE_PS2LINK // reset the IOP if this is a CD build
@@ -137,7 +129,8 @@ extern "C" int main(int argc, char *argv[]) {
sioprintf("Creating system");
/* The OSystem has to be created before we enter ScummVM's main.
It sets up the memory card, etc. */
- OSystem_PS2_create();
+ g_system = new OSystem_PS2();
+ assert(g_system);
sioprintf("init done. starting ScummVM.");
return scummvm_main(argc, argv);
diff --git a/backends/psp/psp_main.cpp b/backends/psp/psp_main.cpp
index d981c314dc..cbdaad68e0 100644
--- a/backends/psp/psp_main.cpp
+++ b/backends/psp/psp_main.cpp
@@ -144,6 +144,9 @@ int main(void)
static char *argv[] = { "scummvm", "--force-1x-overlay", NULL };
static int argc = sizeof(argv)/sizeof(char *)-1;
+ g_system = OSystem_PSP_create();
+ assert(g_system);
+
scummvm_main(argc, argv);
sceKernelSleepThread();
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index 4fa64e75d2..2d567ea769 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -92,14 +92,14 @@ int main(int argc, char *argv[]) {
#endif // defined(__SYMBIAN32__)
+ g_system = new OSystem_SDL();
+ assert(g_system);
+
// Invoke the actual ScummVM main entry point:
return scummvm_main(argc, argv);
}
#endif
-OSystem *OSystem_SDL_create() {
- return new OSystem_SDL();
-}
void OSystem_SDL::initBackend() {
assert(!_inited);
diff --git a/backends/wince/wince-sdl.cpp b/backends/wince/wince-sdl.cpp
index 46c95f9ed5..e08cc965ff 100644
--- a/backends/wince/wince-sdl.cpp
+++ b/backends/wince/wince-sdl.cpp
@@ -147,6 +147,8 @@ int SDL_main(int argc, char **argv) {
GUI::Actions::init(_gameDetector);
__try {
+ g_system = OSystem_WINCE3_create();
+ assert(g_system);
return scummvm_main(_gameDetector, argc, argv);
}
__except (handleException(GetExceptionInformation())) {
diff --git a/backends/x11/x11.cpp b/backends/x11/x11.cpp
index f52f5fdad5..778028b031 100644
--- a/backends/x11/x11.cpp
+++ b/backends/x11/x11.cpp
@@ -59,14 +59,13 @@
#include <backends/x11/x11.h>
int main(int argc, char *argv[]) {
+ g_system = OSystem_X11::create(0, 0);
+ assert(g_system);
+
// Invoke the actual ScummVM main entry point:
return scummvm_main(argc, argv);
}
-OSystem *OSystem_X11_create() {
- return OSystem_X11::create(0, 0);
-}
-
OSystem *OSystem_X11::create(int gfx_mode, bool full_screen) {
OSystem_X11 *syst = new OSystem_X11();
return syst;