aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMax Horn2005-04-19 20:22:50 +0000
committerMax Horn2005-04-19 20:22:50 +0000
commit2cfb9322e2e2b59fa2ab311491445ef801d4979a (patch)
treeda6657a42de0b43c7af4d96dfb76d8bd484a5496 /backends
parent167d43d9244aa5961fafbc3760dddbc1c04cc028 (diff)
downloadscummvm-rg350-2cfb9322e2e2b59fa2ab311491445ef801d4979a.tar.gz
scummvm-rg350-2cfb9322e2e2b59fa2ab311491445ef801d4979a.tar.bz2
scummvm-rg350-2cfb9322e2e2b59fa2ab311491445ef801d4979a.zip
Added new (optional) OSystem::initBackend() method; this (and its usage) fixes bugs #1160977 and #1184664
svn-id: r17694
Diffstat (limited to 'backends')
-rw-r--r--backends/sdl/graphics.cpp1
-rw-r--r--backends/sdl/sdl-common.h4
-rw-r--r--backends/sdl/sdl.cpp7
3 files changed, 9 insertions, 3 deletions
diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp
index 11b4e21fb2..0f000befdc 100644
--- a/backends/sdl/graphics.cpp
+++ b/backends/sdl/graphics.cpp
@@ -301,6 +301,7 @@ void OSystem_SDL::initSize(uint w, uint h, int overlayScale) {
}
void OSystem_SDL::loadGFXMode() {
+ assert(_inited);
_forceFull = true;
_modeFlags |= DF_UPDATE_EXPAND_1_PIXEL;
diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h
index fa8959f001..2d3337e0d5 100644
--- a/backends/sdl/sdl-common.h
+++ b/backends/sdl/sdl-common.h
@@ -69,6 +69,8 @@ public:
OSystem_SDL();
virtual ~OSystem_SDL();
+ virtual void initBackend();
+
void beginGFXTransaction(void);
void endGFXTransaction(void);
@@ -188,7 +190,7 @@ public:
#endif
protected:
- void initIntern();
+ bool _inited;
#ifdef USE_OSD
SDL_Surface *_osdSurface;
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index ef40f2bd5f..69b767dd0d 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -35,7 +35,8 @@ OSystem *OSystem_SDL_create() {
return new OSystem_SDL();
}
-void OSystem_SDL::initIntern() {
+void OSystem_SDL::initBackend() {
+ assert(!_inited);
int joystick_num = ConfMan.getInt("joystick_num");
uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
@@ -89,6 +90,8 @@ void OSystem_SDL::initIntern() {
printf("Using joystick: %s\n", SDL_JoystickName(0));
_joystick = SDL_JoystickOpen(joystick_num);
}
+
+ _inited = true;
}
OSystem_SDL::OSystem_SDL()
@@ -120,7 +123,7 @@ OSystem_SDL::OSystem_SDL()
memset(&_km, 0, sizeof(_km));
memset(&_mouseCurState, 0, sizeof(_mouseCurState));
- initIntern();
+ _inited = false;
}
OSystem_SDL::~OSystem_SDL() {