From 9890b343903e91faee39038df452f854bc6bccb7 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Fri, 20 Mar 2009 22:55:42 +0000 Subject: Moved hardware initialization to a constructor, to make it run really early. svn-id: r39577 --- backends/platform/dc/dc.h | 9 ++++++++- backends/platform/dc/dcmain.cpp | 11 +++++------ 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'backends/platform') 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); -- cgit v1.2.3