diff options
author | Lars Persson | 2009-11-10 08:01:48 +0000 |
---|---|---|
committer | Lars Persson | 2009-11-10 08:01:48 +0000 |
commit | 65136b9acfe034a0065b216644866238fe01259f (patch) | |
tree | 86c33228ff27e3ae3f03f8f584df7494da6e8202 /backends | |
parent | 102cc9679b4780d72fa8cb96be4a471a5414dfe5 (diff) | |
download | scummvm-rg350-65136b9acfe034a0065b216644866238fe01259f.tar.gz scummvm-rg350-65136b9acfe034a0065b216644866238fe01259f.tar.bz2 scummvm-rg350-65136b9acfe034a0065b216644866238fe01259f.zip |
Move Symbian main implementation from main.cpp to SymbianOS.cpp
svn-id: r45802
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/sdl/main.cpp | 74 | ||||
-rw-r--r-- | backends/platform/symbian/src/SymbianOS.cpp | 87 |
2 files changed, 58 insertions, 103 deletions
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp index 939cfb4048..7140a69cea 100644 --- a/backends/platform/sdl/main.cpp +++ b/backends/platform/sdl/main.cpp @@ -27,17 +27,14 @@ // Several SDL based ports use a custom main, and hence do not want to compile // of this file. The following "#if" ensures that. -#if !defined(__MAEMO__) && !defined(_WIN32_WCE) && !defined(GP2XWIZ)&& !defined(LINUXMOTO) +#if !defined(__MAEMO__) && !defined(_WIN32_WCE) && !defined(GP2XWIZ)&& !defined(LINUXMOTO) && !defined(__SYMBIAN32__) #include "backends/platform/sdl/sdl.h" #include "backends/plugins/sdl/sdl-provider.h" #include "base/main.h" -#if defined(__SYMBIAN32__) -#include "SymbianOs.h" - -#elif defined(WIN32) +#if defined(WIN32) #include <windows.h> // winnt.h defines ARRAYSIZE, but we want our own one... @@ -49,70 +46,6 @@ int __stdcall WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpC } #endif - -#if defined(__SYMBIAN32__) - -// TODO: Move this symbian specific code to a separate source file in the "symbian" directory tree. - -int main(int argc, char *argv[]) { - // - // Set up redirects for stdout/stderr under Windows and Symbian. - // Code copied from SDL_main. - // - - // Symbian does not like any output to the console through any *print* function - char STDOUT_FILE[256], STDERR_FILE[256]; // shhh, don't tell anybody :) - strcpy(STDOUT_FILE, Symbian::GetExecutablePath()); - strcpy(STDERR_FILE, Symbian::GetExecutablePath()); - 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) { /* This happens on NT */ -#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) { /* This happens on NT */ -#if !defined(stderr) - stderr = fopen(STDERR_FILE, "w"); -#else - newfp = fopen(STDERR_FILE, "w"); - if (newfp) { - *stderr = *newfp; - } -#endif - } - setbuf(stderr, NULL); /* No buffering */ - - - // Create our OSystem instance - g_system = new OSystem_SDL_Symbian(); - assert(g_system); - -#ifdef DYNAMIC_MODULES - PluginManager::instance().addPluginProvider(new SDLPluginProvider()); -#endif - - // Invoke the actual ScummVM main entry point: - int res = scummvm_main(argc, argv); - g_system->quit(); // TODO: Consider removing / replacing this! - return res; -} - -#else // defined(__SYMBIAN32__) - int main(int argc, char *argv[]) { // Create our OSystem instance @@ -129,7 +62,4 @@ int main(int argc, char *argv[]) { return res; } - -#endif // defined(__SYMBIAN32__) - #endif diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index f92813457a..aaa2c87158 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -30,14 +30,15 @@ #include "backends/platform/symbian/src/SymbianOS.h" #include "backends/platform/symbian/src/SymbianActions.h" #include "backends/saves/default/default-saves.h" + +#include "base/main.h" + #include "common/config-manager.h" -#include "common/events.h" -#include "common/file.h" -#include "gui/Actions.h" -#include "gui/Key.h" +#include "common/scummsys.h" + #include "gui/message.h" + #include "sound/mixer_intern.h" -#include "..\..\sdl\main.cpp" #ifdef SAMPLES_PER_SEC_8000 // the GreanSymbianMMP format cannot handle values for defines :( #define SAMPLES_PER_SEC 8000 @@ -45,17 +46,12 @@ #define SAMPLES_PER_SEC 16000 #endif - #define DEFAULT_CONFIG_FILE "scummvm.ini" #define DEFAULT_SAVE_PATH "Savegames" -#define FILE void - ////////// extern "C" /////////////////////////////////////////////////// namespace Symbian { - - // Show a simple Symbian Info win with Msg & exit void FatalError(const char *msg) { TPtrC8 msgPtr((const TUint8 *)msg); @@ -531,31 +527,60 @@ extern "C" #include "vsnprintf.h" } -/** Vibration support */ -#ifdef USE_VIBRA_SE_PXXX -void OSystem_SDL_Symbian::initializeVibration() { -#ifdef UIQ3 +// Symbian SDL_Main implementation +// Redirects standard io, creates Symbian specific SDL backend (inherited from main SDL) +int main(int argc, char *argv[]) { + // + // Set up redirects for stdout/stderr under Symbian. + // Code copied from SDL_main. + // + + // Symbian does not like any output to the console through any *print* function + char STDOUT_FILE[256], STDERR_FILE[256]; // shhh, don't tell anybody :) + strcpy(STDOUT_FILE, Symbian::GetExecutablePath()); + strcpy(STDERR_FILE, Symbian::GetExecutablePath()); + 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) { /* This happens on NT */ +#if !defined(stdout) + stdout = fopen(STDOUT_FILE, "w"); #else + newfp = fopen(STDOUT_FILE, "w"); + if (newfp) { + *stdout = *newfp; + } #endif -} - -void OSystem_SDL_Symbian::vibrationOn(int vibraLength) { -#ifdef UIQ3 - // initialize? - if (!_vibrationApi) _vibrationApi = SonyEricsson::CVibration::NewL(); - // do it! - _vibrationApi->VibrationOn(1, 1, vibraLength); + } + newfp = freopen(STDERR_FILE, "w", stderr); + if (newfp == NULL) { /* This happens on NT */ +#if !defined(stderr) + stderr = fopen(STDERR_FILE, "w"); #else - + newfp = fopen(STDERR_FILE, "w"); + if (newfp) { + *stderr = *newfp; + } #endif -} + } + setbuf(stderr, NULL); /* No buffering */ -void OSystem_SDL_Symbian::vibrationOff() { -#ifdef UIQ3 -#else - _vibrationApi->VibrationOff(); -#endif -} + // Create our OSystem instance + g_system = new OSystem_SDL_Symbian(); + assert(g_system); -#endif // USE_SE_PXX_VIBRA +#ifdef DYNAMIC_MODULES + PluginManager::instance().addPluginProvider(new SDLPluginProvider()); +#endif + // Invoke the actual ScummVM main entry point: + int res = scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! + return res; +} |