Moved default implementations for various OSystem methods into a new class BaseBackend
svn-id: r36135
This commit is contained in:
parent
1d097d9791
commit
c69ebfd798
20 changed files with 188 additions and 141 deletions
|
@ -25,8 +25,8 @@ MODULES += \
|
|||
gui \
|
||||
graphics \
|
||||
sound \
|
||||
common \
|
||||
engines \
|
||||
common \
|
||||
backends
|
||||
|
||||
ifdef USE_MT32EMU
|
||||
|
|
80
backends/base-backend.cpp
Normal file
80
backends/base-backend.cpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "backends/base-backend.h"
|
||||
#include "backends/events/default/default-events.h"
|
||||
#include "gui/message.h"
|
||||
|
||||
void BaseBackend::displayMessageOnOSD(const char *msg) {
|
||||
// Display the message for 1.5 seconds
|
||||
GUI::TimedMessageDialog dialog(msg, 1500);
|
||||
dialog.runModal();
|
||||
}
|
||||
|
||||
|
||||
static Common::EventManager *s_eventManager = 0;
|
||||
|
||||
Common::EventManager *BaseBackend::getEventManager() {
|
||||
// FIXME/TODO: Eventually this method should be turned into an abstract one,
|
||||
// to force backends to implement this conciously (even if they
|
||||
// end up returning the default event manager anyway).
|
||||
if (!s_eventManager)
|
||||
s_eventManager = new DefaultEventManager(this);
|
||||
return s_eventManager;
|
||||
}
|
||||
|
||||
void BaseBackend::clearScreen() {
|
||||
Graphics::Surface *screen = lockScreen();
|
||||
if (screen && screen->pixels)
|
||||
memset(screen->pixels, 0, screen->h * screen->pitch);
|
||||
unlockScreen();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FIXME: Maybe we should push the default config file loading/saving code below
|
||||
out to all the backends?
|
||||
*/
|
||||
|
||||
|
||||
#if defined(UNIX)
|
||||
#define DEFAULT_CONFIG_FILE ".scummvmrc"
|
||||
#else
|
||||
#define DEFAULT_CONFIG_FILE "scummvm.ini"
|
||||
#endif
|
||||
|
||||
Common::SeekableReadStream *BaseBackend::createConfigReadStream() {
|
||||
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||
return file.createReadStream();
|
||||
}
|
||||
|
||||
Common::WriteStream *BaseBackend::createConfigWriteStream() {
|
||||
#ifdef __DC__
|
||||
return 0;
|
||||
#else
|
||||
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||
return file.createWriteStream();
|
||||
#endif
|
||||
}
|
43
backends/base-backend.h
Normal file
43
backends/base-backend.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BACKENDS_BASE_BACKEND_H
|
||||
#define BACKENDS_BASE_BACKEND_H
|
||||
|
||||
#include "common/system.h"
|
||||
#include "backends/events/default/default-events.h"
|
||||
|
||||
class BaseBackend : public OSystem, EventProvider {
|
||||
public:
|
||||
virtual Common::EventManager *getEventManager();
|
||||
virtual void displayMessageOnOSD(const char *msg);
|
||||
virtual void clearScreen();
|
||||
|
||||
virtual Common::SeekableReadStream *createConfigReadStream();
|
||||
virtual Common::WriteStream *createConfigWriteStream();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -92,7 +92,7 @@ void writeRecord(Common::OutSaveFile *outFile, uint32 diff, Common::Event &event
|
|||
}
|
||||
}
|
||||
|
||||
DefaultEventManager::DefaultEventManager(OSystem *boss) :
|
||||
DefaultEventManager::DefaultEventManager(EventProvider *boss) :
|
||||
_boss(boss),
|
||||
_buttonState(0),
|
||||
_modifierState(0),
|
||||
|
@ -106,8 +106,8 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) :
|
|||
_recordTimeFile = NULL;
|
||||
_playbackFile = NULL;
|
||||
_playbackTimeFile = NULL;
|
||||
_timeMutex = _boss->createMutex();
|
||||
_recorderMutex = _boss->createMutex();
|
||||
_timeMutex = g_system->createMutex();
|
||||
_recorderMutex = g_system->createMutex();
|
||||
|
||||
_eventCount = 0;
|
||||
_lastEventCount = 0;
|
||||
|
@ -144,8 +144,8 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) :
|
|||
if (_recordMode == kRecorderRecord) {
|
||||
_recordCount = 0;
|
||||
_recordTimeCount = 0;
|
||||
_recordFile = _boss->getSavefileManager()->openForSaving(_recordTempFileName.c_str());
|
||||
_recordTimeFile = _boss->getSavefileManager()->openForSaving(_recordTimeFileName.c_str());
|
||||
_recordFile = g_system->getSavefileManager()->openForSaving(_recordTempFileName.c_str());
|
||||
_recordTimeFile = g_system->getSavefileManager()->openForSaving(_recordTimeFileName.c_str());
|
||||
_recordSubtitles = ConfMan.getBool("subtitles");
|
||||
}
|
||||
|
||||
|
@ -155,8 +155,8 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) :
|
|||
if (_recordMode == kRecorderPlayback) {
|
||||
_playbackCount = 0;
|
||||
_playbackTimeCount = 0;
|
||||
_playbackFile = _boss->getSavefileManager()->openForLoading(_recordFileName.c_str());
|
||||
_playbackTimeFile = _boss->getSavefileManager()->openForLoading(_recordTimeFileName.c_str());
|
||||
_playbackFile = g_system->getSavefileManager()->openForLoading(_recordFileName.c_str());
|
||||
_playbackTimeFile = g_system->getSavefileManager()->openForLoading(_recordTimeFileName.c_str());
|
||||
|
||||
if (!_playbackFile) {
|
||||
warning("Cannot open playback file %s. Playback was switched off", _recordFileName.c_str());
|
||||
|
@ -213,11 +213,11 @@ DefaultEventManager::~DefaultEventManager() {
|
|||
#ifdef ENABLE_VKEYBD
|
||||
delete _vk;
|
||||
#endif
|
||||
_boss->lockMutex(_timeMutex);
|
||||
_boss->lockMutex(_recorderMutex);
|
||||
g_system->lockMutex(_timeMutex);
|
||||
g_system->lockMutex(_recorderMutex);
|
||||
_recordMode = kPassthrough;
|
||||
_boss->unlockMutex(_timeMutex);
|
||||
_boss->unlockMutex(_recorderMutex);
|
||||
g_system->unlockMutex(_timeMutex);
|
||||
g_system->unlockMutex(_recorderMutex);
|
||||
|
||||
if (!artificialEventQueue.empty())
|
||||
artificialEventQueue.clear();
|
||||
|
@ -235,9 +235,9 @@ DefaultEventManager::~DefaultEventManager() {
|
|||
_recordTimeFile->finalize();
|
||||
delete _recordTimeFile;
|
||||
|
||||
_playbackFile = _boss->getSavefileManager()->openForLoading(_recordTempFileName.c_str());
|
||||
_playbackFile = g_system->getSavefileManager()->openForLoading(_recordTempFileName.c_str());
|
||||
|
||||
_recordFile = _boss->getSavefileManager()->openForSaving(_recordFileName.c_str());
|
||||
_recordFile = g_system->getSavefileManager()->openForSaving(_recordFileName.c_str());
|
||||
_recordFile->writeUint32LE(RECORD_SIGNATURE);
|
||||
_recordFile->writeUint32LE(RECORD_VERSION);
|
||||
|
||||
|
@ -267,8 +267,8 @@ DefaultEventManager::~DefaultEventManager() {
|
|||
|
||||
//TODO: remove recordTempFileName'ed file
|
||||
}
|
||||
_boss->deleteMutex(_timeMutex);
|
||||
_boss->deleteMutex(_recorderMutex);
|
||||
g_system->deleteMutex(_timeMutex);
|
||||
g_system->deleteMutex(_recorderMutex);
|
||||
}
|
||||
|
||||
void DefaultEventManager::init() {
|
||||
|
@ -301,7 +301,7 @@ bool DefaultEventManager::playback(Common::Event &event) {
|
|||
case Common::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
_boss->warpMouse(_playbackEvent.mouse.x, _playbackEvent.mouse.y);
|
||||
g_system->warpMouse(_playbackEvent.mouse.x, _playbackEvent.mouse.y);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -349,7 +349,7 @@ void DefaultEventManager::processMillis(uint32 &millis) {
|
|||
return;
|
||||
}
|
||||
|
||||
_boss->lockMutex(_timeMutex);
|
||||
g_system->lockMutex(_timeMutex);
|
||||
if (_recordMode == kRecorderRecord) {
|
||||
//Simple RLE compression
|
||||
d = millis - _lastMillis;
|
||||
|
@ -374,11 +374,11 @@ void DefaultEventManager::processMillis(uint32 &millis) {
|
|||
}
|
||||
|
||||
_lastMillis = millis;
|
||||
_boss->unlockMutex(_timeMutex);
|
||||
g_system->unlockMutex(_timeMutex);
|
||||
}
|
||||
|
||||
bool DefaultEventManager::pollEvent(Common::Event &event) {
|
||||
uint32 time = _boss->getMillis();
|
||||
uint32 time = g_system->getMillis();
|
||||
bool result;
|
||||
|
||||
if (!artificialEventQueue.empty()) {
|
||||
|
@ -405,7 +405,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
|
|||
|
||||
if (_recordMode != kPassthrough) {
|
||||
|
||||
_boss->lockMutex(_recorderMutex);
|
||||
g_system->lockMutex(_recorderMutex);
|
||||
_eventCount++;
|
||||
|
||||
if (_recordMode == kRecorderPlayback) {
|
||||
|
@ -419,7 +419,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
|
|||
}
|
||||
}
|
||||
}
|
||||
_boss->unlockMutex(_recorderMutex);
|
||||
g_system->unlockMutex(_recorderMutex);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include "common/mutex.h"
|
||||
#include "common/queue.h"
|
||||
|
||||
class OSystem;
|
||||
|
||||
namespace Common {
|
||||
#ifdef ENABLE_KEYMAPPER
|
||||
class Keymapper;
|
||||
|
@ -43,20 +41,20 @@ namespace Common {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
At some point we will remove pollEvent from OSystem and change
|
||||
DefaultEventManager to use a "boss" derived from this class:
|
||||
class EventProvider {
|
||||
public
|
||||
public:
|
||||
virtual ~EventProvider() {}
|
||||
/**
|
||||
* Get the next event in the event queue.
|
||||
* @param event point to an Common::Event struct, which will be filled with the event data.
|
||||
* @return true if an event was retrieved.
|
||||
*/
|
||||
virtual bool pollEvent(Common::Event &event) = 0;
|
||||
};
|
||||
|
||||
Backends which wish to use the DefaultEventManager then simply can
|
||||
use a subclass of EventProvider.
|
||||
*/
|
||||
|
||||
class DefaultEventManager : public Common::EventManager {
|
||||
OSystem *_boss;
|
||||
EventProvider *_boss;
|
||||
|
||||
#ifdef ENABLE_VKEYBD
|
||||
Common::VirtualKeyboard *_vk;
|
||||
|
@ -130,7 +128,7 @@ class DefaultEventManager : public Common::EventManager {
|
|||
void record(Common::Event &event);
|
||||
bool playback(Common::Event &event);
|
||||
public:
|
||||
DefaultEventManager(OSystem *boss);
|
||||
DefaultEventManager(EventProvider *boss);
|
||||
~DefaultEventManager();
|
||||
|
||||
virtual void init();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
MODULE := backends
|
||||
|
||||
MODULE_OBJS := \
|
||||
base-backend.o \
|
||||
events/default/default-events.o \
|
||||
fs/abstract-fs.o \
|
||||
fs/stdiostream.o \
|
||||
|
|
|
@ -31,8 +31,7 @@
|
|||
#include "PalmVersion.h"
|
||||
#include "globals.h"
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/system.h"
|
||||
#include "backends/base-backend.h"
|
||||
#include "common/events.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
|
@ -89,7 +88,7 @@ typedef struct {
|
|||
void *param;
|
||||
} SoundType, *SoundPtr;
|
||||
|
||||
class OSystem_PalmBase : public OSystem {
|
||||
class OSystem_PalmBase : public BaseBackend {
|
||||
private:
|
||||
virtual void int_initBackend() { }
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <common/system.h>
|
||||
#include "backends/base-backend.h"
|
||||
#include <graphics/surface.h>
|
||||
#include <graphics/colormasks.h>
|
||||
#include <ronin/soundcommon.h>
|
||||
|
@ -43,7 +43,7 @@ class Interactive
|
|||
|
||||
#include "softkbd.h"
|
||||
|
||||
class OSystem_Dreamcast : public OSystem, public FilesystemFactory {
|
||||
class OSystem_Dreamcast : public BaseBackend, public FilesystemFactory {
|
||||
|
||||
public:
|
||||
OSystem_Dreamcast();
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
#ifndef _OSYSTEM_DS_H_
|
||||
#define _OSYSTEM_DS_H_
|
||||
#include "common/system.h"
|
||||
|
||||
#include "backends/base-backend.h"
|
||||
#include "common/events.h"
|
||||
#include "nds.h"
|
||||
#include "ramsave.h"
|
||||
|
@ -34,7 +35,7 @@
|
|||
#include "graphics/surface.h"
|
||||
#include "graphics/colormasks.h"
|
||||
|
||||
class OSystem_DS : public OSystem {
|
||||
class OSystem_DS : public BaseBackend {
|
||||
protected:
|
||||
|
||||
int eventNum;
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
#define __GP2X__
|
||||
#define USE_OSD
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/system.h"
|
||||
#include "backends/base-backend.h"
|
||||
#include "graphics/scaler.h"
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -58,7 +57,7 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
class OSystem_GP2X : public OSystem {
|
||||
class OSystem_GP2X : public BaseBackend {
|
||||
public:
|
||||
OSystem_GP2X();
|
||||
virtual ~OSystem_GP2X();
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "graphics/surface.h"
|
||||
#include "iphone_common.h"
|
||||
#include "common/system.h"
|
||||
#include "backends/base-backend.h"
|
||||
#include "common/events.h"
|
||||
#include "sound/mixer_intern.h"
|
||||
#include "backends/fs/posix/posix-fs-factory.h"
|
||||
|
@ -52,7 +52,7 @@ typedef struct AQCallbackStruct {
|
|||
AudioStreamBasicDescription dataFormat;
|
||||
} AQCallbackStruct;
|
||||
|
||||
class OSystem_IPHONE : public OSystem {
|
||||
class OSystem_IPHONE : public BaseBackend {
|
||||
protected:
|
||||
|
||||
static const OSystem::GraphicsMode s_supportedGraphicsModes[];
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
#include "backends/base-backend.h"
|
||||
#include "base/main.h"
|
||||
|
||||
#if defined(USE_NULL_DRIVER)
|
||||
|
@ -51,7 +51,7 @@
|
|||
#include "backends/fs/windows/windows-fs-factory.h"
|
||||
#endif
|
||||
|
||||
class OSystem_NULL : public OSystem {
|
||||
class OSystem_NULL : public BaseBackend {
|
||||
protected:
|
||||
Common::SaveFileManager *_savefile;
|
||||
Audio::MixerImpl *_mixer;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef SYSTEMPS2_H
|
||||
#define SYSTEMPS2_H
|
||||
|
||||
#include "common/system.h"
|
||||
#include "backends/base-backend.h"
|
||||
|
||||
class DefaultTimerManager;
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace Audio {
|
|||
class MixerImpl;
|
||||
};
|
||||
|
||||
class OSystem_PS2 : public OSystem {
|
||||
class OSystem_PS2 : public BaseBackend {
|
||||
public:
|
||||
OSystem_PS2(const char *elfPath);
|
||||
virtual ~OSystem_PS2(void);
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/system.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "graphics/colormasks.h"
|
||||
#include "sound/mixer_intern.h"
|
||||
#include "backends/base-backend.h"
|
||||
#include "backends/fs/psp/psp-fs-factory.h"
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ enum GraphicModeID {
|
|||
CENTERED_362X272
|
||||
};
|
||||
|
||||
class OSystem_PSP : public OSystem {
|
||||
class OSystem_PSP : public BaseBackend {
|
||||
public:
|
||||
static const OSystem::GraphicsMode s_supportedGraphicsModes[];
|
||||
static OSystem *instance();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
#include "common/mutex.h"
|
||||
#include "common/util.h"
|
||||
#include "graphics/font.h"
|
||||
#include "graphics/fontman.h"
|
||||
|
|
|
@ -32,8 +32,7 @@
|
|||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/system.h"
|
||||
#include "backends/base-backend.h"
|
||||
#include "graphics/scaler.h"
|
||||
|
||||
|
||||
|
@ -72,7 +71,7 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
class OSystem_SDL : public OSystem {
|
||||
class OSystem_SDL : public BaseBackend {
|
||||
public:
|
||||
OSystem_SDL();
|
||||
virtual ~OSystem_SDL();
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
#define _WII_OSYSTEM_H_
|
||||
|
||||
#include "base/main.h"
|
||||
#include "common/system.h"
|
||||
#include "common/fs.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/events.h"
|
||||
|
||||
#include "backends/base-backend.h"
|
||||
#include "backends/saves/default/default-saves.h"
|
||||
#include "backends/timer/default/default-timer.h"
|
||||
#include "graphics/colormasks.h"
|
||||
|
@ -53,7 +53,7 @@ extern void wii_memstats(void);
|
|||
}
|
||||
#endif
|
||||
|
||||
class OSystem_Wii : public OSystem {
|
||||
class OSystem_Wii : public BaseBackend {
|
||||
private:
|
||||
s64 _startup_time;
|
||||
syswd_t _alarm;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#define COMMON_MUTEX_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/system.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
|
@ -35,7 +36,7 @@ class Mutex;
|
|||
/**
|
||||
* An pseudo-opaque mutex type. See OSystem::createMutex etc. for more details.
|
||||
*/
|
||||
typedef struct OpaqueMutex *MutexRef;
|
||||
typedef OSystem::MutexRef MutexRef;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "backends/events/default/default-events.h"
|
||||
#include "common/system.h"
|
||||
#include "gui/message.h"
|
||||
|
||||
OSystem *g_system = 0;
|
||||
|
||||
|
@ -56,13 +54,6 @@ bool OSystem::setGraphicsMode(const char *name) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void OSystem::displayMessageOnOSD(const char *msg) {
|
||||
// Display the message for 1.5 seconds
|
||||
GUI::TimedMessageDialog dialog(msg, 1500);
|
||||
dialog.runModal();
|
||||
}
|
||||
|
||||
|
||||
bool OSystem::openCD(int drive) {
|
||||
return false;
|
||||
}
|
||||
|
@ -70,57 +61,3 @@ bool OSystem::openCD(int drive) {
|
|||
bool OSystem::pollCD() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void OSystem::playCD(int track, int num_loops, int start_frame, int duration) {
|
||||
}
|
||||
|
||||
void OSystem::stopCD() {
|
||||
}
|
||||
|
||||
void OSystem::updateCD() {
|
||||
}
|
||||
|
||||
static Common::EventManager *s_eventManager = 0;
|
||||
|
||||
Common::EventManager *OSystem::getEventManager() {
|
||||
// FIXME/TODO: Eventually this method should be turned into an abstract one,
|
||||
// to force backends to implement this conciously (even if they
|
||||
// end up returning the default event manager anyway).
|
||||
if (!s_eventManager)
|
||||
s_eventManager = new DefaultEventManager(this);
|
||||
return s_eventManager;
|
||||
}
|
||||
|
||||
void OSystem::clearScreen() {
|
||||
Graphics::Surface *screen = lockScreen();
|
||||
if (screen && screen->pixels)
|
||||
memset(screen->pixels, 0, screen->h * screen->pitch);
|
||||
unlockScreen();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FIXME: Maybe we should push the default config file loading/saving code below
|
||||
out to all the backends?
|
||||
*/
|
||||
|
||||
|
||||
#if defined(UNIX)
|
||||
#define DEFAULT_CONFIG_FILE ".scummvmrc"
|
||||
#else
|
||||
#define DEFAULT_CONFIG_FILE "scummvm.ini"
|
||||
#endif
|
||||
|
||||
Common::SeekableReadStream *OSystem::createConfigReadStream() {
|
||||
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||
return file.createReadStream();
|
||||
}
|
||||
|
||||
Common::WriteStream *OSystem::createConfigWriteStream() {
|
||||
#ifdef __DC__
|
||||
return 0;
|
||||
#else
|
||||
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||
return file.createWriteStream();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#define COMMON_SYSTEM_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/mutex.h"
|
||||
#include "common/noncopyable.h"
|
||||
#include "common/rect.h"
|
||||
|
||||
|
@ -515,7 +514,7 @@ public:
|
|||
/**
|
||||
* Clear the screen to black.
|
||||
*/
|
||||
virtual void clearScreen();
|
||||
virtual void clearScreen() = 0;
|
||||
|
||||
/**
|
||||
* Flush the whole screen, that is render the current content of the screen
|
||||
|
@ -697,17 +696,6 @@ public:
|
|||
/** @name Events and Time */
|
||||
//@{
|
||||
|
||||
protected:
|
||||
friend class DefaultEventManager;
|
||||
|
||||
/**
|
||||
* Get the next event in the event queue.
|
||||
* @param event point to an Common::Event struct, which will be filled with the event data.
|
||||
* @return true if an event was retrieved.
|
||||
*/
|
||||
virtual bool pollEvent(Common::Event &event) = 0;
|
||||
|
||||
public:
|
||||
/** Get the number of milliseconds since the program was started. */
|
||||
virtual uint32 getMillis() = 0;
|
||||
|
||||
|
@ -731,7 +719,7 @@ public:
|
|||
* Return the event manager singleton. For more information, refer
|
||||
* to the EventManager documentation.
|
||||
*/
|
||||
virtual Common::EventManager *getEventManager();
|
||||
virtual Common::EventManager *getEventManager() = 0;
|
||||
|
||||
//@}
|
||||
|
||||
|
@ -754,7 +742,7 @@ public:
|
|||
*/
|
||||
//@{
|
||||
|
||||
typedef Common::MutexRef MutexRef;
|
||||
typedef struct OpaqueMutex *MutexRef;
|
||||
|
||||
/**
|
||||
* Create a new mutex.
|
||||
|
@ -831,17 +819,17 @@ public:
|
|||
* @param start_frame the frame at which playback should start (75 frames = 1 second).
|
||||
* @param duration the number of frames to play.
|
||||
*/
|
||||
virtual void playCD(int track, int num_loops, int start_frame, int duration);
|
||||
virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
|
||||
|
||||
/**
|
||||
* Stop audio CD playback.
|
||||
*/
|
||||
virtual void stopCD();
|
||||
virtual void stopCD() {}
|
||||
|
||||
/**
|
||||
* Update cdrom audio status.
|
||||
*/
|
||||
virtual void updateCD();
|
||||
virtual void updateCD() {}
|
||||
|
||||
//@}
|
||||
|
||||
|
@ -875,7 +863,7 @@ public:
|
|||
*
|
||||
* @param msg the message to display on screen
|
||||
*/
|
||||
virtual void displayMessageOnOSD(const char *msg);
|
||||
virtual void displayMessageOnOSD(const char *msg) = 0;
|
||||
|
||||
/**
|
||||
* Return the SaveFileManager, used to store and load savestates
|
||||
|
@ -908,7 +896,7 @@ public:
|
|||
* ReadStream instance. It is the callers responsiblity to delete
|
||||
* the stream after use.
|
||||
*/
|
||||
virtual Common::SeekableReadStream *createConfigReadStream();
|
||||
virtual Common::SeekableReadStream *createConfigReadStream() = 0;
|
||||
|
||||
/**
|
||||
* Open the default config file for writing, by returning a suitable
|
||||
|
@ -917,7 +905,7 @@ public:
|
|||
*
|
||||
* May return 0 to indicate that writing to config file is not possible.
|
||||
*/
|
||||
virtual Common::WriteStream *createConfigWriteStream();
|
||||
virtual Common::WriteStream *createConfigWriteStream() = 0;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue