aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorMarcus Comstedt2009-03-20 22:55:42 +0000
committerMarcus Comstedt2009-03-20 22:55:42 +0000
commit9890b343903e91faee39038df452f854bc6bccb7 (patch)
treebc6d590020d21c710ac90e493e42800f0112dd3c /backends/platform
parenta591d65cc7db9aff5323e3ea73f76ae8e69667c5 (diff)
downloadscummvm-rg350-9890b343903e91faee39038df452f854bc6bccb7.tar.gz
scummvm-rg350-9890b343903e91faee39038df452f854bc6bccb7.tar.bz2
scummvm-rg350-9890b343903e91faee39038df452f854bc6bccb7.zip
Moved hardware initialization to a constructor, to make it run really early.
svn-id: r39577
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/dc/dc.h9
-rw-r--r--backends/platform/dc/dcmain.cpp11
2 files changed, 13 insertions, 7 deletions
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index 9d5e6fcace..0ccd69593e 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -43,7 +43,14 @@ class Interactive
#include "softkbd.h"
-class OSystem_Dreamcast : public BaseBackend, public FilesystemFactory {
+class DCHardware {
+ private:
+ static void dc_init_hardware();
+ protected:
+ DCHardware() { dc_init_hardware(); }
+};
+
+class OSystem_Dreamcast : private DCHardware, public BaseBackend, public FilesystemFactory {
public:
OSystem_Dreamcast();
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index c99b24c435..bdec7f41f1 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -199,7 +199,7 @@ void OSystem_Dreamcast::getTimeAndDate(struct tm &t) const {
t = *localtime(&curTime);
}
-void dc_init_hardware()
+void DCHardware::dc_init_hardware()
{
#ifndef NOSERIAL
serial_init(57600);
@@ -213,18 +213,17 @@ void dc_init_hardware()
init_arm();
}
+static OSystem_Dreamcast osys_dc;
+
int main()
{
static char *argv[] = { "scummvm", NULL, };
static int argc = 1;
- dc_init_hardware();
-
- g_system = new OSystem_Dreamcast();
- assert(g_system);
+ g_system = &osys_dc;
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new DCPluginProvider());
+ PluginManager::instance().addPluginProvider(new DCPluginProvider());
#endif
int res = scummvm_main(argc, argv);