Move Symbian main implementation from main.cpp to SymbianOS.cpp
svn-id: r45802
This commit is contained in:
parent
102cc9679b
commit
65136b9acf
2 changed files with 58 additions and 103 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue