mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-22 10:17:22 +00:00
GPH: Clean up initialisation code and start event manager after log files are setup (if needed).
This commit is contained in:
parent
e58724a180
commit
3b6398cd40
@ -20,6 +20,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(GPH_DEVICE)
|
||||
|
||||
// Disable symbol overrides so that we can use system headers.
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
|
||||
@ -32,8 +34,6 @@
|
||||
#include "backends/saves/default/default-saves.h"
|
||||
#include "backends/timer/default/default-timer.h"
|
||||
|
||||
#include "base/main.h"
|
||||
|
||||
#include "common/archive.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/debug.h"
|
||||
@ -64,23 +64,6 @@ void OSystem_GPH::initBackend() {
|
||||
|
||||
assert(!_inited);
|
||||
|
||||
// Create the events manager
|
||||
if (_eventSource == 0)
|
||||
_eventSource = new GPHEventSource();
|
||||
|
||||
// Create the graphics manager
|
||||
if (_graphicsManager == 0) {
|
||||
_graphicsManager = new GPHGraphicsManager(_eventSource);
|
||||
}
|
||||
|
||||
// Create the mixer manager
|
||||
if (_mixer == 0) {
|
||||
_mixerManager = new DoubleBufferSDLMixerManager();
|
||||
|
||||
// Setup and start mixer
|
||||
_mixerManager->init();
|
||||
}
|
||||
|
||||
/* Setup default save path to be workingdir/saves */
|
||||
|
||||
char savePath[PATH_MAX+1];
|
||||
@ -165,16 +148,42 @@ void OSystem_GPH::initBackend() {
|
||||
/* Make sure that aspect ratio correction is enabled on the 1st run to stop
|
||||
users asking me what the 'wasted space' at the bottom is ;-). */
|
||||
ConfMan.registerDefault("aspect_ratio", true);
|
||||
ConfMan.registerDefault("fullscreen", true);
|
||||
|
||||
/* Make sure SDL knows that we have a joystick we want to use. */
|
||||
ConfMan.setInt("joystick_num", 0);
|
||||
|
||||
// Create the events manager
|
||||
if (_eventSource == 0)
|
||||
_eventSource = new GPHEventSource();
|
||||
|
||||
// Create the graphics manager
|
||||
if (_graphicsManager == 0) {
|
||||
_graphicsManager = new GPHGraphicsManager(_eventSource);
|
||||
}
|
||||
|
||||
/* Pass to POSIX method to do the heavy lifting */
|
||||
OSystem_POSIX::initBackend();
|
||||
|
||||
_inited = true;
|
||||
}
|
||||
|
||||
void OSystem_GPH::initSDL() {
|
||||
// Check if SDL has not been initialized
|
||||
if (!_initedSDL) {
|
||||
|
||||
uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
|
||||
if (ConfMan.hasKey("disable_sdl_parachute"))
|
||||
sdlFlags |= SDL_INIT_NOPARACHUTE;
|
||||
|
||||
// Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
|
||||
if (SDL_Init(sdlFlags) == -1)
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
|
||||
_initedSDL = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
|
||||
|
||||
/* Setup default extra data paths for engine data files and plugins */
|
||||
@ -222,3 +231,5 @@ void OSystem_GPH::quit() {
|
||||
|
||||
OSystem_POSIX::quit();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -26,13 +26,11 @@
|
||||
#if defined(GPH_DEVICE)
|
||||
|
||||
#include "backends/base-backend.h"
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
#include "backends/platform/sdl/sdl-sys.h"
|
||||
#include "backends/platform/sdl/posix/posix.h"
|
||||
#include "backends/events/gph/gph-events.h"
|
||||
#include "backends/graphics/gph/gph-graphics.h"
|
||||
|
||||
#define __GP2XWIZ__
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 255
|
||||
#endif
|
||||
@ -45,6 +43,11 @@ public:
|
||||
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
|
||||
void initBackend();
|
||||
void quit();
|
||||
|
||||
protected:
|
||||
bool _inited;
|
||||
bool _initedSDL;
|
||||
virtual void initSDL();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user