2010-06-10 20:31:08 +00:00
|
|
|
/* 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.
|
2014-02-18 01:34:18 +00:00
|
|
|
*
|
2010-06-10 20:31:08 +00:00
|
|
|
* 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.
|
2014-02-18 01:34:18 +00:00
|
|
|
*
|
2010-06-10 20:31:08 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-05-23 17:20:56 +00:00
|
|
|
#define FORBIDDEN_SYMBOL_EXCEPTION_exit
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
#include "backends/modular-backend.h"
|
2011-02-07 17:53:15 +00:00
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "backends/graphics/graphics.h"
|
|
|
|
#include "backends/mutex/mutex.h"
|
2013-05-16 21:18:09 +00:00
|
|
|
#include "gui/EventRecorder.h"
|
2011-02-07 17:53:15 +00:00
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "audio/mixer.h"
|
|
|
|
#include "graphics/pixelformat.h"
|
2010-06-10 20:31:08 +00:00
|
|
|
|
|
|
|
ModularBackend::ModularBackend()
|
|
|
|
:
|
|
|
|
_mutexManager(0),
|
|
|
|
_graphicsManager(0),
|
2011-06-06 13:02:33 +00:00
|
|
|
_mixer(0) {
|
2010-06-10 20:31:08 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ModularBackend::~ModularBackend() {
|
2010-10-13 17:58:48 +00:00
|
|
|
delete _graphicsManager;
|
2010-11-29 18:22:31 +00:00
|
|
|
_graphicsManager = 0;
|
2010-10-13 17:58:48 +00:00
|
|
|
delete _mixer;
|
2010-11-29 18:22:31 +00:00
|
|
|
_mixer = 0;
|
2010-10-13 17:58:48 +00:00
|
|
|
delete _mutexManager;
|
2010-11-29 18:22:31 +00:00
|
|
|
_mutexManager = 0;
|
2010-06-10 20:31:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ModularBackend::hasFeature(Feature f) {
|
|
|
|
return _graphicsManager->hasFeature(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::setFeatureState(Feature f, bool enable) {
|
2013-06-25 11:08:55 +00:00
|
|
|
_graphicsManager->setFeatureState(f, enable);
|
2010-06-10 20:31:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ModularBackend::getFeatureState(Feature f) {
|
|
|
|
return _graphicsManager->getFeatureState(f);
|
|
|
|
}
|
|
|
|
|
2010-07-11 04:32:24 +00:00
|
|
|
GraphicsManager *ModularBackend::getGraphicsManager() {
|
|
|
|
assert(_graphicsManager);
|
|
|
|
return (GraphicsManager *)_graphicsManager;
|
|
|
|
}
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
const OSystem::GraphicsMode *ModularBackend::getSupportedGraphicsModes() const {
|
|
|
|
return _graphicsManager->getSupportedGraphicsModes();
|
|
|
|
}
|
|
|
|
|
|
|
|
int ModularBackend::getDefaultGraphicsMode() const {
|
|
|
|
return _graphicsManager->getDefaultGraphicsMode();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ModularBackend::setGraphicsMode(int mode) {
|
|
|
|
return _graphicsManager->setGraphicsMode(mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
int ModularBackend::getGraphicsMode() const {
|
|
|
|
return _graphicsManager->getGraphicsMode();
|
|
|
|
}
|
|
|
|
|
2010-07-30 03:06:57 +00:00
|
|
|
void ModularBackend::resetGraphicsScale() {
|
|
|
|
_graphicsManager->resetGraphicsScale();
|
|
|
|
}
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
#ifdef USE_RGB_COLOR
|
2010-07-13 04:31:15 +00:00
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
Graphics::PixelFormat ModularBackend::getScreenFormat() const {
|
|
|
|
return _graphicsManager->getScreenFormat();
|
|
|
|
}
|
|
|
|
|
2010-07-13 04:31:15 +00:00
|
|
|
Common::List<Graphics::PixelFormat> ModularBackend::getSupportedFormats() const {
|
2010-06-10 20:31:08 +00:00
|
|
|
return _graphicsManager->getSupportedFormats();
|
|
|
|
}
|
2010-07-13 04:31:15 +00:00
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void ModularBackend::initSize(uint w, uint h, const Graphics::PixelFormat *format ) {
|
|
|
|
_graphicsManager->initSize(w, h, format);
|
|
|
|
}
|
|
|
|
|
|
|
|
int ModularBackend::getScreenChangeID() const {
|
|
|
|
return _graphicsManager->getScreenChangeID();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::beginGFXTransaction() {
|
|
|
|
_graphicsManager->beginGFXTransaction();
|
|
|
|
}
|
|
|
|
|
|
|
|
OSystem::TransactionError ModularBackend::endGFXTransaction() {
|
|
|
|
return _graphicsManager->endGFXTransaction();
|
2010-06-11 01:55:59 +00:00
|
|
|
}
|
2010-06-10 20:31:08 +00:00
|
|
|
|
|
|
|
int16 ModularBackend::getHeight() {
|
|
|
|
return _graphicsManager->getHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 ModularBackend::getWidth() {
|
|
|
|
return _graphicsManager->getWidth();
|
|
|
|
}
|
|
|
|
|
2011-02-07 17:52:38 +00:00
|
|
|
PaletteManager *ModularBackend::getPaletteManager() {
|
|
|
|
return _graphicsManager;
|
2010-06-10 20:31:08 +00:00
|
|
|
}
|
|
|
|
|
2012-06-16 00:18:01 +00:00
|
|
|
void ModularBackend::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
|
2010-06-10 20:31:08 +00:00
|
|
|
_graphicsManager->copyRectToScreen(buf, pitch, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
Graphics::Surface *ModularBackend::lockScreen() {
|
|
|
|
return _graphicsManager->lockScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::unlockScreen() {
|
|
|
|
_graphicsManager->unlockScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::fillScreen(uint32 col) {
|
|
|
|
_graphicsManager->fillScreen(col);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::updateScreen() {
|
2013-07-07 03:54:45 +00:00
|
|
|
#ifdef ENABLE_EVENTRECORDER
|
2013-05-16 21:18:09 +00:00
|
|
|
g_eventRec.preDrawOverlayGui();
|
2013-07-07 03:54:45 +00:00
|
|
|
#endif
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
_graphicsManager->updateScreen();
|
2013-07-07 03:54:45 +00:00
|
|
|
|
|
|
|
#ifdef ENABLE_EVENTRECORDER
|
2013-05-16 21:18:09 +00:00
|
|
|
g_eventRec.postDrawOverlayGui();
|
2013-07-07 03:54:45 +00:00
|
|
|
#endif
|
2010-06-10 20:31:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::setShakePos(int shakeOffset) {
|
|
|
|
_graphicsManager->setShakePos(shakeOffset);
|
|
|
|
}
|
|
|
|
void ModularBackend::setFocusRectangle(const Common::Rect& rect) {
|
|
|
|
_graphicsManager->setFocusRectangle(rect);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::clearFocusRectangle() {
|
|
|
|
_graphicsManager->clearFocusRectangle();
|
2010-06-11 01:55:59 +00:00
|
|
|
}
|
2010-06-10 20:31:08 +00:00
|
|
|
|
|
|
|
void ModularBackend::showOverlay() {
|
|
|
|
_graphicsManager->showOverlay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::hideOverlay() {
|
|
|
|
_graphicsManager->hideOverlay();
|
|
|
|
}
|
|
|
|
|
|
|
|
Graphics::PixelFormat ModularBackend::getOverlayFormat() const {
|
|
|
|
return _graphicsManager->getOverlayFormat();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::clearOverlay() {
|
|
|
|
_graphicsManager->clearOverlay();
|
|
|
|
}
|
|
|
|
|
2012-06-16 02:17:14 +00:00
|
|
|
void ModularBackend::grabOverlay(void *buf, int pitch) {
|
2010-06-10 20:31:08 +00:00
|
|
|
_graphicsManager->grabOverlay(buf, pitch);
|
|
|
|
}
|
|
|
|
|
2012-06-16 02:17:14 +00:00
|
|
|
void ModularBackend::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
|
2010-06-10 20:31:08 +00:00
|
|
|
_graphicsManager->copyRectToOverlay(buf, pitch, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 ModularBackend::getOverlayHeight() {
|
|
|
|
return _graphicsManager->getOverlayHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 ModularBackend::getOverlayWidth() {
|
|
|
|
return _graphicsManager->getOverlayWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ModularBackend::showMouse(bool visible) {
|
|
|
|
return _graphicsManager->showMouse(visible);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::warpMouse(int x, int y) {
|
|
|
|
_graphicsManager->warpMouse(x, y);
|
|
|
|
}
|
|
|
|
|
2012-06-16 01:10:43 +00:00
|
|
|
void ModularBackend::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
|
2012-06-03 00:02:57 +00:00
|
|
|
_graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
|
2010-06-10 20:31:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num) {
|
|
|
|
_graphicsManager->setCursorPalette(colors, start, num);
|
|
|
|
}
|
|
|
|
|
|
|
|
OSystem::MutexRef ModularBackend::createMutex() {
|
|
|
|
assert(_mutexManager);
|
|
|
|
return _mutexManager->createMutex();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::lockMutex(MutexRef mutex) {
|
|
|
|
assert(_mutexManager);
|
|
|
|
_mutexManager->lockMutex(mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::unlockMutex(MutexRef mutex) {
|
|
|
|
assert(_mutexManager);
|
|
|
|
_mutexManager->unlockMutex(mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::deleteMutex(MutexRef mutex) {
|
|
|
|
assert(_mutexManager);
|
|
|
|
_mutexManager->deleteMutex(mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
Audio::Mixer *ModularBackend::getMixer() {
|
|
|
|
assert(_mixer);
|
|
|
|
return (Audio::Mixer *)_mixer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModularBackend::displayMessageOnOSD(const char *msg) {
|
|
|
|
_graphicsManager->displayMessageOnOSD(msg);
|
|
|
|
}
|
|
|
|
|
2011-05-23 17:20:56 +00:00
|
|
|
void ModularBackend::quit() {
|
|
|
|
exit(0);
|
|
|
|
}
|