diff --git a/audio/mididrv.cpp b/audio/mididrv.cpp index 829bc3cd553..6817791c6bb 100644 --- a/audio/mididrv.cpp +++ b/audio/mididrv.cpp @@ -59,17 +59,17 @@ static const struct { uint32 type; const char *guio; } GUIOMapping[] = { - { MT_PCSPK, GUIO_MIDIPCSPK, }, - { MT_CMS, GUIO_MIDICMS, }, - { MT_PCJR, GUIO_MIDIPCJR, }, - { MT_ADLIB, GUIO_MIDIADLIB, }, - { MT_C64, GUIO_MIDIC64, }, - { MT_AMIGA, GUIO_MIDIAMIGA, }, - { MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS, }, - { MT_TOWNS, GUIO_MIDITOWNS, }, - { MT_PC98, GUIO_MIDIPC98, }, - { MT_GM, GUIO_MIDIGM, }, - { MT_MT32, GUIO_MIDIMT32, }, + { MT_PCSPK, GUIO_MIDIPCSPK }, + { MT_CMS, GUIO_MIDICMS }, + { MT_PCJR, GUIO_MIDIPCJR }, + { MT_ADLIB, GUIO_MIDIADLIB }, + { MT_C64, GUIO_MIDIC64 }, + { MT_AMIGA, GUIO_MIDIAMIGA }, + { MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS }, + { MT_TOWNS, GUIO_MIDITOWNS }, + { MT_PC98, GUIO_MIDIPC98 }, + { MT_GM, GUIO_MIDIGM }, + { MT_MT32, GUIO_MIDIMT32 }, { 0, 0 }, }; diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 2ff8ea025c6..21fb2de8e66 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -44,7 +44,7 @@ #include "graphics/fontman.h" #include "graphics/surface.h" #include "graphics/pixelformat.h" -//#include "graphics/palette.h" +#include "graphics/palette.h" #include "graphics/font.h" class MidiChannel_MT32 : public MidiChannel_MPU401 { @@ -99,8 +99,8 @@ static int eatSystemEvents() { } static void drawProgress(float progress) { - // TODO implement in ResidualVM - /*const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kOSDFont)); + return; // TODO implement in ResidualVM + const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kGUIFont)); Graphics::Surface *screen = g_system->lockScreen(); assert(screen); @@ -136,12 +136,11 @@ static void drawProgress(float progress) { g_system->unlockScreen(); g_system->updateScreen(); - */ } static void drawMessage(int offset, const Common::String &text) { - // TODO implement in ResidualVM - /* const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kOSDFont)); + return; // TODO implement in ResidualVM + const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kGUIFont)); Graphics::Surface *screen = g_system->lockScreen(); assert(screen); @@ -171,7 +170,6 @@ static void drawMessage(int offset, const Common::String &text) { g_system->unlockScreen(); g_system->updateScreen(); - */ } static Common::File *MT32_OpenFile(void *userData, const char *filename) { @@ -281,8 +279,7 @@ int MidiDriver_MT32::open() { _synth = new MT32Emu::Synth(); - // TODO implement in ResidualVM - Graphics::PixelFormat screenFormat; /*= g_system->getScreenFormat();*/ + Graphics::PixelFormat screenFormat = g_system->getScreenFormat(); if (screenFormat.bytesPerPixel == 1) { const byte dummy_palette[] = { @@ -291,8 +288,7 @@ int MidiDriver_MT32::open() { 171, 0, 0 // fill }; - // TODO implement in ResidualVM - //g_system->setPalette(dummy_palette, 0, 3); + g_system->getPaletteManager()->setPalette(dummy_palette, 0, 3); } _initializing = true; @@ -306,13 +302,12 @@ int MidiDriver_MT32::open() { _initializing = false; - // TODO implement in ResidualVM -/* if (screenFormat.bytesPerPixel > 1) + if (screenFormat.bytesPerPixel > 1) g_system->fillScreen(screenFormat.RGBToColor(0, 0, 0)); else g_system->fillScreen(0); - g_system->updateScreen();*/ + g_system->updateScreen(); _mixer->playStream(Audio::Mixer::kSFXSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); diff --git a/audio/softsynth/opl/dbopl.cpp b/audio/softsynth/opl/dbopl.cpp index 2c46cfee758..dacf1d88cc8 100644 --- a/audio/softsynth/opl/dbopl.cpp +++ b/audio/softsynth/opl/dbopl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * 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 @@ -572,7 +572,7 @@ INLINE Bits Operator::GetWave( Bitu index, Bitu vol ) { return (waveBase[ index & waveMask ] * MulTable[ vol >> ENV_EXTRA ]) >> MUL_SH; #elif ( DBOPL_WAVE == WAVE_TABLELOG ) Bit32s wave = waveBase[ index & waveMask ]; - Bit32u total = ( wave & 0x7fff ) + ( vol << ( 3 - ENV_EXTRA ) ); + Bit32u total = ( wave & 0x7fff ) + vol << ( 3 - ENV_EXTRA ); Bit32s sig = ExpTable[ total & 0xff ]; Bit32u exp = total >> 8; Bit32s neg = wave >> 16; @@ -1131,14 +1131,14 @@ void Chip::WriteBD( Bit8u val ) { #define REGOP( _FUNC_ ) \ index = ( ( reg >> 3) & 0x20 ) | ( reg & 0x1f ); \ if ( OpOffsetTable[ index ] ) { \ - Operator* regOp = (Operator*)( ((char *)this ) + OpOffsetTable[ index ] ); \ + Operator* regOp = (Operator *)( ((char *)this ) + OpOffsetTable[ index ] ); \ regOp->_FUNC_( this, val ); \ } #define REGCHAN( _FUNC_ ) \ index = ( ( reg >> 4) & 0x10 ) | ( reg & 0xf ); \ if ( ChanOffsetTable[ index ] ) { \ - Channel* regChan = (Channel*)( ((char *)this ) + ChanOffsetTable[ index ] ); \ + Channel* regChan = (Channel *)( ((char *)this ) + ChanOffsetTable[ index ] ); \ regChan->_FUNC_( this, val ); \ } @@ -1236,7 +1236,7 @@ void Chip::GenerateBlock2( Bitu total, Bit32s* output ) { void Chip::GenerateBlock3( Bitu total, Bit32s* output ) { while ( total > 0 ) { Bit32u samples = ForwardLFO( total ); - memset(output, 0, sizeof(Bit32s) * 2 * samples); + memset(output, 0, sizeof(Bit32s) * samples * 2); int count = 0; for( Channel* ch = chan; ch < chan + 18; ) { count++; diff --git a/audio/softsynth/opl/dbopl.h b/audio/softsynth/opl/dbopl.h index 87d1045fab0..99234ebf884 100644 --- a/audio/softsynth/opl/dbopl.h +++ b/audio/softsynth/opl/dbopl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * 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 @@ -16,10 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// Last synch with DOSBox SVN trunk r3556 +// Last synch with DOSBox SVN trunk r3752 -#ifndef SOUND_SOFTSYNTH_OPL_DBOPL_H -#define SOUND_SOFTSYNTH_OPL_DBOPL_H +#ifndef AUDIO_SOFTSYNTH_OPL_DBOPL_H +#define AUDIO_SOFTSYNTH_OPL_DBOPL_H #include "common/scummsys.h" diff --git a/audio/softsynth/opl/dosbox.h b/audio/softsynth/opl/dosbox.h index 125dde8aecb..3adfe988524 100644 --- a/audio/softsynth/opl/dosbox.h +++ b/audio/softsynth/opl/dosbox.h @@ -26,8 +26,8 @@ * http://www.dosbox.com */ -#ifndef SOUND_SOFTSYNTH_OPL_DOSBOX_H -#define SOUND_SOFTSYNTH_OPL_DOSBOX_H +#ifndef AUDIO_SOFTSYNTH_OPL_DOSBOX_H +#define AUDIO_SOFTSYNTH_OPL_DOSBOX_H #ifndef DISABLE_DOSBOX_OPL @@ -104,4 +104,3 @@ public: #endif // !DISABLE_DOSBOX_OPL #endif - diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp index 15e869ba33f..dd3c3540456 100644 --- a/audio/softsynth/opl/mame.cpp +++ b/audio/softsynth/opl/mame.cpp @@ -1245,4 +1245,3 @@ FM_OPL *makeAdLibOPL(int rate) { } // End of namespace MAME } // End of namespace OPL - diff --git a/audio/softsynth/opl/mame.h b/audio/softsynth/opl/mame.h index 803ca897e7b..3714fa4e0ac 100644 --- a/audio/softsynth/opl/mame.h +++ b/audio/softsynth/opl/mame.h @@ -23,8 +23,8 @@ */ -#ifndef SOUND_SOFTSYNTH_OPL_MAME_H -#define SOUND_SOFTSYNTH_OPL_MAME_H +#ifndef AUDIO_SOFTSYNTH_OPL_MAME_H +#define AUDIO_SOFTSYNTH_OPL_MAME_H #include "common/scummsys.h" #include "common/random.h" diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp index fd7ea351b91..0a070e19824 100644 --- a/backends/base-backend.cpp +++ b/backends/base-backend.cpp @@ -35,9 +35,9 @@ void BaseBackend::displayMessageOnOSD(const char *msg) { // Display the message for 1.5 seconds - /* ResidualVM: OSD not iplemented + return;// ResidualVM: OSD not iplemented GUI::TimedMessageDialog dialog(msg, 1500); - dialog.runModal();*/ + dialog.runModal(); } void BaseBackend::initBackend() { @@ -57,9 +57,9 @@ void BaseBackend::initBackend() { } void BaseBackend::fillScreen(uint32 col) { - /* ResidualVM: disabled + return;// ResidualVM: not used Graphics::Surface *screen = lockScreen(); if (screen && screen->pixels) memset(screen->pixels, col, screen->h * screen->pitch); - unlockScreen();*/ + unlockScreen(); } diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp index 7e66c1f2827..755a3876883 100644 --- a/backends/events/sdl/sdl-events.cpp +++ b/backends/events/sdl/sdl-events.cpp @@ -347,14 +347,14 @@ Common::KeyCode SdlEventSource::SDLToOSystemKeycode(const SDLKey key) { bool SdlEventSource::pollEvent(Common::Event &event) { handleKbdMouse(); -/* ResidualVM doesn't support this + // If the screen changed, send an Common::EVENT_SCREEN_CHANGED int screenID = ((OSystem_SDL *)g_system)->getGraphicsManager()->getScreenChangeID(); if (screenID != _lastScreenID) { _lastScreenID = screenID; event.type = Common::EVENT_SCREEN_CHANGED; return true; - }*/ + } SDL_Event ev; while (SDL_PollEvent(&ev)) { diff --git a/backends/graphics/default-palette.h b/backends/graphics/default-palette.h new file mode 100644 index 00000000000..8f3fcb2db1f --- /dev/null +++ b/backends/graphics/default-palette.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef BACKENDS_GRAPHICS_DEFAULT_PALETTE_H +#define BACKENDS_GRAPHICS_DEFAULT_PALETTE_H + +#include "graphics/palette.h" + +/** + * This is a default implementation of the PaletteManager interface + * which ensures that grabPalette works as specified. Of course + * it is still necessary to provide code that actually updates + * the (possibly emulated) "hardware" palette of the backend. + * For this purpose, implement the abstract setPaletteIntern + * method. + */ +class DefaultPaletteManager : public PaletteManager { +protected: + byte _palette[3 * 256]; + + /** + * Subclasses should only implement this method and none of the others. + * Its semantics are like that of setPalette, only that it does not need + * to worry about making it possible to query the palette values once they + * have been set. + */ + virtual void setPaletteIntern(const byte *colors, uint start, uint num) = 0; + +public: + void setPalette(const byte *colors, uint start, uint num) { + assert(start + num <= 256); + memcpy(_palette + 3 * start, colors, 3 * num); + setPaletteIntern(colors, start, num); + } + void grabPalette(byte *colors, uint start, uint num) { + assert(start + num <= 256); + memcpy(colors, _palette + 3 * start, 3 * num); + } +}; + +#endif diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h index 2ba6c03f8c6..9d6f0213891 100644 --- a/backends/graphics/graphics.h +++ b/backends/graphics/graphics.h @@ -27,14 +27,13 @@ #include "common/noncopyable.h" #include "common/keyboard.h" -//#include "graphics/palette.h" +#include "graphics/palette.h" /** * Abstract class for graphics manager. Subclasses * implement the real functionality. */ - // ResidualVM specific method -class GraphicsManager : Common::NonCopyable { +class GraphicsManager : public PaletteManager { public: virtual ~GraphicsManager() {} @@ -42,15 +41,38 @@ public: virtual void setFeatureState(OSystem::Feature f, bool enable) = 0; virtual bool getFeatureState(OSystem::Feature f) = 0; + virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const = 0; + virtual int getDefaultGraphicsMode() const = 0; + virtual bool setGraphicsMode(int mode) = 0; + virtual void resetGraphicsScale() = 0; + virtual int getGraphicsMode() const = 0; +#ifdef USE_RGB_COLOR + virtual Graphics::PixelFormat getScreenFormat() const = 0; + virtual Common::List getSupportedFormats() const = 0; +#endif + virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) = 0; + virtual int getScreenChangeID() const = 0; + + virtual void beginGFXTransaction() = 0; + virtual OSystem::TransactionError endGFXTransaction() = 0; + // ResidualVM specific method virtual void launcherInitSize(uint w, uint h) = 0; // ResidualVM specific method virtual Graphics::PixelBuffer setupScreen(int screenW, int screenH, bool fullscreen, bool accel3d) = 0; - virtual int getScreenChangeID() const = 0; + virtual int16 getHeight() = 0; virtual int16 getWidth() = 0; - virtual void updateScreen() = 0; + virtual void setPalette(const byte *colors, uint start, uint num) = 0; + virtual void grabPalette(byte *colors, uint start, uint num) = 0; + virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0; + virtual Graphics::Surface *lockScreen() = 0; + virtual void unlockScreen() = 0; virtual void fillScreen(uint32 col) = 0; + virtual void updateScreen() = 0; + virtual void setShakePos(int shakeOffset) = 0; + virtual void setFocusRectangle(const Common::Rect& rect) = 0; + virtual void clearFocusRectangle() = 0; virtual void showOverlay() = 0; virtual void hideOverlay() = 0; @@ -64,6 +86,7 @@ public: virtual bool showMouse(bool visible) = 0; virtual void warpMouse(int x, int y) = 0; virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0; + virtual void setCursorPalette(const byte *colors, uint start, uint num) = 0; // ResidualVM specific method virtual bool lockMouse(bool lock) = 0; diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 1427f93ee50..ce7c4df6153 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -40,6 +40,9 @@ #include "graphics/scaler.h" #include "graphics/surface.h" #include "graphics/pixelbuffer.h" +static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { + {0, 0, 0} +}; SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource) : @@ -63,12 +66,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou // may reset it. SDL_EnableUNICODE(1); -#ifdef _WIN32_WCE - if (ConfMan.hasKey("use_GDI") && ConfMan.getBool("use_GDI")) { - SDL_VideoInit("windib", 0); - sdlFlags ^= SDL_INIT_VIDEO; - } -#endif + SDL_ShowCursor(SDL_DISABLE); } SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() { @@ -84,6 +82,10 @@ void SurfaceSdlGraphicsManager::initEventObserver() { g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false); } +void SurfaceSdlGraphicsManager::resetGraphicsScale() { + setGraphicsMode(0); +} + bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) { return (f == OSystem::kFeatureFullscreenMode) || @@ -96,11 +98,11 @@ bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) { void SurfaceSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { switch (f) { - case OSystem::kFeatureFullscreenMode: - _fullscreen = enable; - break; - default: - break; + case OSystem::kFeatureFullscreenMode: + _fullscreen = enable; + break; + default: + break; } } @@ -113,8 +115,46 @@ bool SurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) { } } -void SurfaceSdlGraphicsManager::fillScreen(uint32 col) { - // dummy +const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::supportedGraphicsModes() { + return s_supportedGraphicsModes; +} + +const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::getSupportedGraphicsModes() const { + return s_supportedGraphicsModes; +} + +int SurfaceSdlGraphicsManager::getDefaultGraphicsMode() const { + return 0;// ResidualVM: not use it +} + +void SurfaceSdlGraphicsManager::beginGFXTransaction() { + // ResidualVM: not use it +} + +OSystem::TransactionError SurfaceSdlGraphicsManager::endGFXTransaction() { + // ResidualVM: not use it + return OSystem::kTransactionSuccess; +} + +#ifdef USE_RGB_COLOR +Common::List SurfaceSdlGraphicsManager::getSupportedFormats() const { + // ResidualVM: not use it + return _supportedFormats; +} +#endif + +bool SurfaceSdlGraphicsManager::setGraphicsMode(int mode) { + // ResidualVM: not use it + return true; +} + +int SurfaceSdlGraphicsManager::getGraphicsMode() const { + // ResidualVM: not use it + return 0; +} + +void SurfaceSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) { + // ResidualVM: not use it } void SurfaceSdlGraphicsManager::launcherInitSize(uint w, uint h) { @@ -391,14 +431,55 @@ void SurfaceSdlGraphicsManager::updateScreen() { } } +void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) { + // ResidualVM: not use it +} + +Graphics::Surface *SurfaceSdlGraphicsManager::lockScreen() { + return NULL; // ResidualVM: not use it +} + +void SurfaceSdlGraphicsManager::unlockScreen() { + // ResidualVM: not use it +} + +void SurfaceSdlGraphicsManager::fillScreen(uint32 col) { + // ResidualVM: not use it +} + int16 SurfaceSdlGraphicsManager::getHeight() { + // ResidualVM specific return _screen->h; } int16 SurfaceSdlGraphicsManager::getWidth() { + // ResidualVM specific return _screen->w; } +void SurfaceSdlGraphicsManager::setPalette(const byte *colors, uint start, uint num) { + // ResidualVM: not use it +} + +void SurfaceSdlGraphicsManager::grabPalette(byte *colors, uint start, uint num) { + // ResidualVM: not use it +} + +void SurfaceSdlGraphicsManager::setCursorPalette(const byte *colors, uint start, uint num) { + // ResidualVM: not use it +} + +void SurfaceSdlGraphicsManager::setShakePos(int shake_pos) { + // ResidualVM: not use it +} + +void SurfaceSdlGraphicsManager::setFocusRectangle(const Common::Rect &rect) { + // ResidualVM: not use it +} + +void SurfaceSdlGraphicsManager::clearFocusRectangle() { + // ResidualVM: not use it +} #pragma mark - #pragma mark --- Overlays --- @@ -566,10 +647,26 @@ bool SurfaceSdlGraphicsManager::lockMouse(bool lock) { } void SurfaceSdlGraphicsManager::warpMouse(int x, int y) { + //ResidualVM specific SDL_WarpMouse(x, y); } +void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { + // ResidualVM: not use it +} + +#pragma mark - +#pragma mark --- On Screen Display --- +#pragma mark - + +#ifdef USE_OSD +void SurfaceSdlGraphicsManager::displayMessageOnOSD(const char *msg) { + // ResidualVM: not use it +} +#endif + bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) { + //ResidualVM specific return false; } @@ -591,14 +688,17 @@ void SurfaceSdlGraphicsManager::setAntialiasing(bool enable) { void SurfaceSdlGraphicsManager::notifyVideoExpose() { _forceFull = true; + //ResidualVM specific: updateScreen(); } void SurfaceSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) { + return; // ResidualVM: not use it } void SurfaceSdlGraphicsManager::notifyMousePos(Common::Point mouse) { transformMouseCoordinates(mouse); + // ResidualVM: not use that: //setMousePos(mouse.x, mouse.y); } diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index cbd55fdbbbf..b0499f7efe9 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -20,8 +20,8 @@ * */ -#ifndef BACKENDS_GRAPHICS_SDL_H -#define BACKENDS_GRAPHICS_SDL_H +#ifndef BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H +#define BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H #ifdef USE_OPENGL #include @@ -58,15 +58,41 @@ public: virtual void setFeatureState(OSystem::Feature f, bool enable); virtual bool getFeatureState(OSystem::Feature f); + static const OSystem::GraphicsMode *supportedGraphicsModes(); + virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const; + virtual int getDefaultGraphicsMode() const; + virtual bool setGraphicsMode(int mode); + virtual int getGraphicsMode() const; + virtual void resetGraphicsScale(); +#ifdef USE_RGB_COLOR + virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; } + virtual Common::List getSupportedFormats() const; +#endif + virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL); virtual void launcherInitSize(uint w, uint h); Graphics::PixelBuffer setupScreen(int screenW, int screenH, bool fullscreen, bool accel3d); virtual int getScreenChangeID() const { return _screenChangeCount; } + + virtual void beginGFXTransaction(); + virtual OSystem::TransactionError endGFXTransaction(); + virtual int16 getHeight(); virtual int16 getWidth(); +protected: + // PaletteManager API + virtual void setPalette(const byte *colors, uint start, uint num); + virtual void grabPalette(byte *colors, uint start, uint num); + public: + virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual Graphics::Surface *lockScreen(); + virtual void unlockScreen(); virtual void fillScreen(uint32 col); virtual void updateScreen(); + virtual void setShakePos(int shakeOffset); + virtual void setFocusRectangle(const Common::Rect& rect); + virtual void clearFocusRectangle(); virtual void showOverlay(); virtual void hideOverlay(); @@ -74,14 +100,15 @@ public: virtual void clearOverlay(); virtual void grabOverlay(OverlayColor *buf, int pitch); virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + //ResidualVM specific implemention: virtual int16 getOverlayHeight() { return _overlayHeight; } virtual int16 getOverlayWidth() { return _overlayWidth; } void closeOverlay(); virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) {} - + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL); + virtual void setCursorPalette(const byte *colors, uint start, uint num); // ResidualVM specific method virtual bool lockMouse(bool lock); @@ -101,7 +128,10 @@ protected: SDL_Surface *_screen; +#ifdef USE_RGB_COLOR Graphics::PixelFormat _screenFormat; + Common::List _supportedFormats; +#endif #ifdef USE_OPENGL bool _opengl; diff --git a/backends/log/log.cpp b/backends/log/log.cpp index fe0db0b70a2..693399bae5b 100644 --- a/backends/log/log.cpp +++ b/backends/log/log.cpp @@ -44,9 +44,9 @@ void Log::open(Common::WriteStream *stream) { // Output information about the ScummVM version at the start of the log // file - print(gResidualVMFullVersion); + print(gScummVMFullVersion); print("\n"); - print(gResidualVMFeatures); + print(gScummVMFeatures); print("\n"); print("--- Log opened.\n"); _startOfLine = true; diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index bf79b79df61..893a11ecd1c 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -66,6 +66,38 @@ GraphicsManager *ModularBackend::getGraphicsManager() { return (GraphicsManager *)_graphicsManager; } +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(); +} + +void ModularBackend::resetGraphicsScale() { + _graphicsManager->resetGraphicsScale(); +} + +#ifdef USE_RGB_COLOR + +Graphics::PixelFormat ModularBackend::getScreenFormat() const { + return _graphicsManager->getScreenFormat(); +} + +Common::List ModularBackend::getSupportedFormats() const { + return _graphicsManager->getSupportedFormats(); +} + +#endif + // ResidualVM specific method void ModularBackend::launcherInitSize(uint w, uint h) { _graphicsManager->launcherInitSize(w, h); @@ -76,10 +108,22 @@ Graphics::PixelBuffer ModularBackend::setupScreen(int screenW, int screenH, bool return _graphicsManager->setupScreen(screenW, screenH, fullscreen, accel3d); } +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(); +} + int16 ModularBackend::getHeight() { return _graphicsManager->getHeight(); } @@ -88,6 +132,21 @@ int16 ModularBackend::getWidth() { return _graphicsManager->getWidth(); } +PaletteManager *ModularBackend::getPaletteManager() { + return _graphicsManager; +} + +void ModularBackend::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { + _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); @@ -97,6 +156,17 @@ void ModularBackend::updateScreen() { _graphicsManager->updateScreen(); } +void ModularBackend::setShakePos(int shakeOffset) { + _graphicsManager->setShakePos(shakeOffset); +} +void ModularBackend::setFocusRectangle(const Common::Rect& rect) { + _graphicsManager->setFocusRectangle(rect); +} + +void ModularBackend::clearFocusRectangle() { + _graphicsManager->clearFocusRectangle(); +} + void ModularBackend::showOverlay() { _graphicsManager->showOverlay(); } @@ -146,6 +216,10 @@ void ModularBackend::setMouseCursor(const byte *buf, uint w, uint h, int hotspot _graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format); } +void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num) { + _graphicsManager->setCursorPalette(colors, start, num); +} + OSystem::MutexRef ModularBackend::createMutex() { assert(_mutexManager); return _mutexManager->createMutex(); diff --git a/backends/modular-backend.h b/backends/modular-backend.h index 3bc1b1158db..2aa222f51aa 100644 --- a/backends/modular-backend.h +++ b/backends/modular-backend.h @@ -62,16 +62,37 @@ public: //@{ virtual GraphicsManager *getGraphicsManager(); + virtual const GraphicsMode *getSupportedGraphicsModes() const; + virtual int getDefaultGraphicsMode() const; + virtual bool setGraphicsMode(int mode); + virtual int getGraphicsMode() const; + virtual void resetGraphicsScale(); +#ifdef USE_RGB_COLOR + virtual Graphics::PixelFormat getScreenFormat() const; + virtual Common::List getSupportedFormats() const; +#endif + virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL); + // ResidualVM specific method virtual void launcherInitSize(uint w, uint h); // ResidualVM specific method virtual Graphics::PixelBuffer setupScreen(int screenW, int screenH, bool fullscreen, bool accel3d); virtual int getScreenChangeID() const; + virtual void beginGFXTransaction(); + virtual OSystem::TransactionError endGFXTransaction(); + virtual int16 getHeight(); virtual int16 getWidth(); + virtual PaletteManager *getPaletteManager(); + virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual Graphics::Surface *lockScreen(); + virtual void unlockScreen(); virtual void fillScreen(uint32 col); virtual void updateScreen(); + virtual void setShakePos(int shakeOffset); + virtual void setFocusRectangle(const Common::Rect& rect); + virtual void clearFocusRectangle(); virtual void showOverlay(); virtual void hideOverlay(); @@ -85,6 +106,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL); + virtual void setCursorPalette(const byte *colors, uint start, uint num); // ResidualVM specific method virtual bool lockMouse(bool lock); diff --git a/backends/platform/sdl/amigaos/amigaos-main.cpp b/backends/platform/sdl/amigaos/amigaos-main.cpp index ab05d1c6c2f..da83756a40b 100644 --- a/backends/platform/sdl/amigaos/amigaos-main.cpp +++ b/backends/platform/sdl/amigaos/amigaos-main.cpp @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { #endif // Invoke the actual ScummVM main entry point: - int res = residualvm_main(argc, argv); + int res = scummvm_main(argc, argv); // Free OSystem delete (OSystem_AmigaOS *)g_system; diff --git a/backends/platform/sdl/macosx/macosx-main.cpp b/backends/platform/sdl/macosx/macosx-main.cpp index abf1a2739f2..b89264f9e92 100644 --- a/backends/platform/sdl/macosx/macosx-main.cpp +++ b/backends/platform/sdl/macosx/macosx-main.cpp @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { #endif // Invoke the actual ScummVM main entry point: - int res = residualvm_main(argc, argv); + int res = scummvm_main(argc, argv); // Free OSystem delete (OSystem_MacOSX *)g_system; diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp index f0580fbb6e5..040028079de 100644 --- a/backends/platform/sdl/main.cpp +++ b/backends/platform/sdl/main.cpp @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) { #endif // Invoke the actual ScummVM main entry point: - int res = residualvm_main(argc, argv); + int res = scummvm_main(argc, argv); // Free OSystem delete (OSystem_SDL *)g_system; diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp index be3949c737b..5f0914e04f3 100644 --- a/backends/platform/sdl/posix/posix-main.cpp +++ b/backends/platform/sdl/posix/posix-main.cpp @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { #endif // Invoke the actual ScummVM main entry point: - int res = residualvm_main(argc, argv); + int res = scummvm_main(argc, argv); // Free OSystem delete (OSystem_POSIX *)g_system; diff --git a/backends/platform/sdl/win32/win32-main.cpp b/backends/platform/sdl/win32/win32-main.cpp index aa890f2b38d..2b3e18e9f09 100644 --- a/backends/platform/sdl/win32/win32-main.cpp +++ b/backends/platform/sdl/win32/win32-main.cpp @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { #endif // Invoke the actual ScummVM main entry point: - int res = residualvm_main(argc, argv); + int res = scummvm_main(argc, argv); // Free OSystem delete (OSystem_Win32 *)g_system; diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 571b6e67d94..30fbf68f963 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -877,8 +877,8 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo listAudioDevices(); return true; } else if (command == "version") { - printf("%s\n", gResidualVMFullVersion); - printf("Features compiled in: %s\n", gResidualVMFeatures); + printf("%s\n", gScummVMFullVersion); + printf("Features compiled in: %s\n", gScummVMFeatures); return true; } else if (command == "help") { printf(HELP_STRING, s_appName); diff --git a/base/internal_revision.h.in b/base/internal_revision.h.in index d72be44da98..63f58a4b770 100644 --- a/base/internal_revision.h.in +++ b/base/internal_revision.h.in @@ -1,6 +1,6 @@ -#ifndef RESIDUALVM_INTERNAL_REVISION_H -#define RESIDUALVM_INTERNAL_REVISION_H +#ifndef SCUMMVM_INTERNAL_REVISION_H +#define SCUMMVM_INTERNAL_REVISION_H -#define RESIDUALVM_REVISION "@REVISION@" +#define SCUMMVM_REVISION "@REVISION@" #endif diff --git a/base/internal_version.h b/base/internal_version.h index 6178e95d0a8..1e67b49fbfd 100644 --- a/base/internal_version.h +++ b/base/internal_version.h @@ -4,16 +4,16 @@ // Reads revision number from file // (this is used when building with Visual Studio) -#ifdef RESIDUALVM_INTERNAL_REVISION +#ifdef SCUMMVM_INTERNAL_REVISION #include "internal_revision.h" #endif #ifdef RELEASE_BUILD -#undef RESIDUALVM_REVISION +#undef SCUMMVM_REVISION #endif -#ifndef RESIDUALVM_REVISION -#define RESIDUALVM_REVISION +#ifndef SCUMMVM_REVISION +#define SCUMMVM_REVISION #endif -#define RESIDUALVM_VERSION "0.0.8git" RESIDUALVM_REVISION +#define SCUMMVM_VERSION "0.0.8git" SCUMMVM_REVISION diff --git a/base/internal_version.h.in b/base/internal_version.h.in index 5271a336b24..e2b46f54cec 100644 --- a/base/internal_version.h.in +++ b/base/internal_version.h.in @@ -4,16 +4,16 @@ // Reads revision number from file // (this is used when building with Visual Studio) -#ifdef RESIDUALVM_INTERNAL_REVISION +#ifdef SCUMMVM_INTERNAL_REVISION #include "internal_revision.h" #endif #ifdef RELEASE_BUILD -#undef RESIDUALVM_REVISION +#undef SCUMMVM_REVISION #endif -#ifndef RESIDUALVM_REVISION -#define RESIDUALVM_REVISION +#ifndef SCUMMVM_REVISION +#define SCUMMVM_REVISION #endif -#define RESIDUALVM_VERSION "@VERSION@" RESIDUALVM_REVISION +#define SCUMMVM_VERSION "@VERSION@" SCUMMVM_REVISION diff --git a/base/main.cpp b/base/main.cpp index 80623a8c61c..0975844809d 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -232,9 +232,19 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const } static void setupGraphics(OSystem &system) { - system.launcherInitSize(640, 400); + + system.beginGFXTransaction(); + // Set the user specified graphics mode (if any). + system.setGraphicsMode(ConfMan.get("gfx_mode").c_str()); + + system.initSize(320, 200); + system.launcherInitSize(640, 400);//ResidualVM specific + + if (ConfMan.hasKey("aspect_ratio")) + system.setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio")); if (ConfMan.hasKey("fullscreen")) system.setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); + system.endGFXTransaction(); // When starting up launcher for the first time, the user might have specified // a --gui-theme option, to allow that option to be working, we need to initialize @@ -243,14 +253,13 @@ static void setupGraphics(OSystem &system) { GUI::GuiManager::instance(); // Set initial window caption - system.setWindowCaption(gResidualVMFullVersion); + system.setWindowCaption(gScummVMFullVersion); // Clear the main screen - //system.fillScreen(0); + system.fillScreen(0); } static void setupKeymapper(OSystem &system) { - #ifdef ENABLE_KEYMAPPER using namespace Common; @@ -303,7 +312,7 @@ static void setupKeymapper(OSystem &system) { } -extern "C" int residualvm_main(int argc, const char * const argv[]) { +extern "C" int scummvm_main(int argc, const char * const argv[]) { Common::String specialDebug; Common::String command; @@ -327,7 +336,7 @@ extern "C" int residualvm_main(int argc, const char * const argv[]) { } // Update the config file - ConfMan.set("versioninfo", gResidualVMVersion, Common::ConfigManager::kApplicationDomain); + ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain); // Load and setup the debuglevel and the debug flags. We do this at the // soonest possible moment to ensure debug output starts early on, if @@ -372,6 +381,25 @@ extern "C" int residualvm_main(int argc, const char * const argv[]) { // the command line params) was read. system.initBackend(); + // If we received an invalid graphics mode parameter via command line + // we check this here. We can't do it until after the backend is inited, + // or there won't be a graphics manager to ask for the supported modes. + + if (settings.contains("gfx-mode")) { + const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes(); + Common::String option = settings["gfx-mode"]; + bool isValid = false; + + while (gm->name && !isValid) { + isValid = !scumm_stricmp(gm->name, option.c_str()); + gm++; + } + if (!isValid) { + warning("Unrecognized graphics mode '%s'. Switching to default mode", option.c_str()); + settings["gfx-mode"] = "default"; + } + } + setupGraphics(system); // Init the different managers that are used by the engines. diff --git a/base/main.h b/base/main.h index 634f1672547..3d75931454c 100644 --- a/base/main.h +++ b/base/main.h @@ -28,6 +28,6 @@ // // The scummvm main entry point, to be invoked by ports // -extern "C" int residualvm_main(int argc, const char *const argv[]); +extern "C" int scummvm_main(int argc, const char * const argv[]); #endif diff --git a/base/plugins.h b/base/plugins.h index 92e3748d2af..d0add65c25b 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -92,7 +92,7 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX]; #ifdef USE_ELF_LOADER #define PLUGIN_DYNAMIC_BUILD_DATE \ - PLUGIN_EXPORT const char *PLUGIN_getBuildDate() { return gResidualVMPluginBuildDate; } + PLUGIN_EXPORT const char *PLUGIN_getBuildDate() { return gScummVMPluginBuildDate; } #else #define PLUGIN_DYNAMIC_BUILD_DATE #endif diff --git a/base/version.cpp b/base/version.cpp index 377f0b19c5f..7d85c27bbae 100644 --- a/base/version.cpp +++ b/base/version.cpp @@ -55,11 +55,11 @@ * I don't know VC enough to be sure). And of course it must be robust enough * to properly work in exports (i.e. release tar balls etc.). */ -const char *gResidualVMVersion = RESIDUALVM_VERSION; -const char *gResidualVMBuildDate = __DATE__ " " __TIME__; -const char *gResidualVMVersionDate = RESIDUALVM_VERSION " (" __DATE__ " " __TIME__ ")"; -const char *gResidualVMFullVersion = "ResidualVM " RESIDUALVM_VERSION " (" __DATE__ " " __TIME__ ")"; -const char *gResidualVMFeatures = "" +const char *gScummVMVersion = SCUMMVM_VERSION; +const char *gScummVMBuildDate = __DATE__ " " __TIME__; +const char *gScummVMVersionDate = SCUMMVM_VERSION " (" __DATE__ " " __TIME__ ")"; +const char *gScummVMFullVersion = "ResidualVM " SCUMMVM_VERSION " (" __DATE__ " " __TIME__ ")"; +const char *gScummVMFeatures = "" #ifdef TAINTED_BUILD // TAINTED means the build contains engines/subengines not enabled by default "TAINTED " diff --git a/base/version.h b/base/version.h index 78f3562fdce..a5c25c03f4d 100644 --- a/base/version.h +++ b/base/version.h @@ -22,10 +22,10 @@ #ifndef BASE_VERSION_H #define BASE_VERSION_H -extern const char *gResidualVMVersion; // e.g. "0.0.6" -extern const char *gResidualVMBuildDate; // e.g. "2008-06-15" -extern const char *gResidualVMVersionDate; // e.g. "0.0.6 (2008-06-15)" -extern const char *gResidualVMFullVersion; // e.g. "Residual 0.0.6 (2008-06-15)" -extern const char *gResidualVMFeatures; // e.g. "ALSA MPEG2 zLib" +extern const char *gScummVMVersion; // e.g. "0.4.1" +extern const char *gScummVMBuildDate; // e.g. "2003-06-24" +extern const char *gScummVMVersionDate; // e.g. "0.4.1 (2003-06-24)" +extern const char *gScummVMFullVersion; // e.g. "ScummVM 0.4.1 (2003-06-24)" +extern const char *gScummVMFeatures; // e.g. "ALSA MPEG2 zLib" #endif diff --git a/common/endian.h b/common/endian.h index 30c80fc0cbe..5fc54e97b83 100644 --- a/common/endian.h +++ b/common/endian.h @@ -396,6 +396,7 @@ inline uint32 READ_BE_UINT24(const void *ptr) { return (b[0] << 16) | (b[1] << 8) | (b[2]); } +// ResidualVM specific: #if defined(SCUMM_BIG_ENDIAN) inline float get_float(const char *data) { diff --git a/common/system.cpp b/common/system.cpp index 468f5d27e85..7e08f8af179 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -100,6 +100,28 @@ void OSystem::initBackend() { // error("Backend failed to instantiate fs factory"); } +bool OSystem::setGraphicsMode(const char *name) { + return true; //ResidualVM not use it + if (!name) + return false; + + // Special case for the 'default' filter + if (!scumm_stricmp(name, "normal") || !scumm_stricmp(name, "default")) { + return setGraphicsMode(getDefaultGraphicsMode()); + } + + const GraphicsMode *gm = getSupportedGraphicsModes(); + + while (gm->name) { + if (!scumm_stricmp(gm->name, name)) { + return setGraphicsMode(gm->id); + } + gm++; + } + + return false; +} + void OSystem::fatalError() { quit(); exit(1); diff --git a/common/system.h b/common/system.h index 3e2a890bc45..79804db6cb7 100644 --- a/common/system.h +++ b/common/system.h @@ -241,20 +241,59 @@ public: */ kFeatureFullscreenMode, + /** + * Control aspect ratio correction. Aspect ratio correction is used to + * correct games running at 320x200 (i.e with an aspect ratio of 8:5), + * but which on their original hardware were displayed with the + * standard 4:3 ratio (that is, the original graphics used non-square + * pixels). When the backend support this, then games running at + * 320x200 pixels should be scaled up to 320x240 pixels. For all other + * resolutions, ignore this feature flag. + * @note Backend implementors can find utility functions in common/scaler.h + * which can be used to implement aspect ratio correction. In + * stretch200To240() can stretch a rect, including (very fast) + * particular, interpolation, and works in-place. + */ + kFeatureAspectRatioCorrection, + /** * Determine whether a virtual keyboard is too be shown or not. * This would mostly be implemented by backends for hand held devices, * like PocketPC, Palms, Symbian phones like the P800, Zaurus, etc. */ kFeatureVirtualKeyboard, - kFeatureOpenGL, + /** + * Backends supporting this feature allow specifying a custom palette + * for the cursor. The custom palette is used if the feature state + * is set to true by the client code via setFeatureState(). + * + * It is currently used only by some Macintosh versions of Humongous + * Entertainment games. If the backend doesn't implement this feature + * then the engine switches to b/w versions of cursors. + * The GUI also relies on this feature for mouse cursors. + */ + kFeatureCursorPalette, + + /** + * A backend have this feature if its overlay pixel format has an alpha + * channel which offers at least 3-4 bits of accuracy (as opposed to + * just a single alpha bit). + * + * This feature has no associated state. + */ kFeatureOverlaySupportsAlpha, /** - * This feature, set to true, is a hint toward the backend to disable all - * key filtering/mapping, in cases where it would be beneficial to do so. - * As an example case, this is used in the agi engine's predictive dialog. + * Client code can set the state of this feature to true in order to + * iconify the application window. + */ + kFeatureIconifyWindow, + + /** + * Setting the state of this feature to true tells the backend to disable + * all key filtering/mapping, in cases where it would be beneficial to do so. + * As an example case, this is used in the AGI engine's predictive dialog. * When the dialog is displayed this feature is set so that backends with * phone-like keypad temporarily unmap all user actions which leads to * comfortable word entry. Conversely, when the dialog exits the feature @@ -270,6 +309,9 @@ public: */ kFeatureDisableKeyFiltering, + //ResidualVM specific + kFeatureOpenGL, + /** * The presence of this feature indicates whether the displayLogFile() * call is supported. @@ -308,9 +350,244 @@ public: * an efficient manner. The downside of this is that it may be * rather complicated for backend authors to fully understand and * implement the semantics of the OSystem interface. + * + * !!! Below description not apply for ResidualVM !!! + * + * The graphics visible to the user in the end are actually + * composed in three layers: the game graphics, the overlay + * graphics, and the mouse. + * + * First, there are the game graphics. The methods in this section + * deal with them exclusively. In particular, the size of the game + * graphics is defined by a call to initSize(), and + * copyRectToScreen() blits the data in the current pixel format + * into the game layer. Let W and H denote the width and height of + * the game graphics. + * + * Before the user sees these graphics, the backend may apply some + * transformations to it; for example, the may be scaled to better + * fit on the visible screen; or aspect ratio correction may be + * performed (see kFeatureAspectRatioCorrection). As a result of + * this, a pixel of the game graphics may occupy a region bigger + * than a single pixel on the screen. We define p_w and p_h to be + * the width resp. height of a game pixel on the screen. + * + * In addition, there is a vertical "shake offset" (as defined by + * setShakePos) which is used in some games to provide a shaking + * effect. Note that shaking is applied to all three layers, i.e. + * also to the overlay and the mouse. We denote the shake offset + * by S. + * + * Putting this together, a pixel (x,y) of the game graphics is + * transformed to a rectangle of height p_h and width p_w + * appearing at position (p_w * x, p_hw * (y + S)) on the real + * screen (in addition, a backend may choose to offset + * everything, e.g. to center the graphics on the screen). + * + * + * The next layer is the overlay. It is composed over the game + * graphics. By default, it has exactly the same size and + * resolution as the game graphics. However, client code can + * specify an overlay scale (as an additional parameter to + * initSize()). This is meant to increase the resolution of the + * overlay while keeping its size the same as that of the game + * graphics. For example, if the overlay scale is 2, and the game + * graphics have a resolution of 320x200; then the overlay shall + * have a resolution of 640x400, but it still has the same + * physical size as the game graphics. + * The overlay usually uses 16bpp, but on some ports, only 8bpp + * are availble, so that is supported, too, via a compile time + * switch (see also the OverlayColor typedef in scummsys.h). + * + * + * Finally, there is the mouse layer. This layer doesn't have to + * actually exist within the backend -- it all depends on how a + * backend chooses to implement mouse cursors, but in the default + * SDL backend, it really is a separate layer. The mouse can + * have a palette of its own, if the backend supports it. + * The scale of the mouse cursor is called 'cursorTargetScale'. + * This is meant as a hint to the backend. For example, let us + * assume the overlay is not visible, and the game graphics are + * displayed using a 2x scaler. If a mouse cursor with a + * cursorTargetScale of 1 is set, then it should be scaled by + * factor 2x, too, just like the game graphics. But if it has a + * cursorTargetScale of 2, then it shouldn't be scaled again by + * the game graphics scaler. + * + * On a note for OSystem users here. We do not require our graphics + * to be thread safe and in fact most/all backends using OpenGL are + * not. So do *not* try to call any of these functions from a timer + * and/or audio callback (like readBuffer of AudioStreams). */ //@{ + /** + * !!! Not used in ResidualVM !!! + * + * Description of a graphics mode. + */ + struct GraphicsMode { + /** + * The 'name' of the graphics mode. This name is matched when selecting + * a mode via the command line, or via the config file. + * Examples: "1x", "advmame2x", "hq3x" + */ + const char *name; + /** + * Human readable description of the scaler. + * Examples: "Normal (no scaling)", "AdvMAME2x", "HQ3x" + */ + const char *description; + /** + * ID of the graphics mode. How to use this is completely up to the + * backend. This value will be passed to the setGraphicsMode(int) + * method by client code. + */ + int id; + }; + + /** + * !!! Not used in ResidualVM !!! + * + * Retrieve a list of all graphics modes supported by this backend. + * This can be both video modes as well as graphic filters/scalers; + * it is completely up to the backend maintainer to decide what is + * appropriate here and what not. + * The list is terminated by an all-zero entry. + * @return a list of supported graphics modes + */ + virtual const GraphicsMode *getSupportedGraphicsModes() const = 0; + + /** + * !!! Not used in ResidualVM !!! + * + * Return the ID of the 'default' graphics mode. What exactly this means + * is up to the backend. This mode is set by the client code when no user + * overrides are present (i.e. if no custom graphics mode is selected via + * the command line or a config file). + * + * @return the ID of the 'default' graphics mode + */ + virtual int getDefaultGraphicsMode() const = 0; + + /** + * !!! Not used in ResidualVM !!! + * + * Switch to the specified graphics mode. If switching to the new mode + * failed, this method returns false. + * + * @param mode the ID of the new graphics mode + * @return true if the switch was successful, false otherwise + */ + virtual bool setGraphicsMode(int mode) = 0; + + /** + * !!! Not used in ResidualVM !!! + * + * Switch to the graphics mode with the given name. If 'name' is unknown, + * or if switching to the new mode failed, this method returns false. + * + * @param name the name of the new graphics mode + * @return true if the switch was successful, false otherwise + * @note This is implemented via the setGraphicsMode(int) method, as well + * as getSupportedGraphicsModes() and getDefaultGraphicsMode(). + * In particular, backends do not have to overload this! + */ + bool setGraphicsMode(const char *name); + + /** + * !!! Not used in ResidualVM !!! + * + * Determine which graphics mode is currently active. + * @return the ID of the active graphics mode + */ + virtual int getGraphicsMode() const = 0; + + /** + * !!! Not used in ResidualVM !!! + * + * Sets the graphics scale factor to x1. Games with large screen sizes + * reset the scale to x1 so the screen will not be too big when starting + * the game. + */ + virtual void resetGraphicsScale() {} + +#ifdef USE_RGB_COLOR + /** + * !!! Not used in ResidualVM !!! + * + * Determine the pixel format currently in use for screen rendering. + * @return the active screen pixel format. + * @see Graphics::PixelFormat + */ + virtual Graphics::PixelFormat getScreenFormat() const = 0; + + /** + * !!! Not used in ResidualVM !!! + * + * Returns a list of all pixel formats supported by the backend. + * The first item in the list must be directly supported by hardware, + * and provide the largest color space of those formats with direct + * hardware support. It is also strongly recommended that remaining + * formats should be placed in order of descending preference for the + * backend to use. + * + * EG: a backend that supports 32-bit ABGR and 16-bit 555 BGR in hardware + * and provides conversion from equivalent RGB(A) modes should order its list + * 1) Graphics::PixelFormat(4, 0, 0, 0, 0, 0, 8, 16, 24) + * 2) Graphics::PixelFormat(2, 3, 3, 3, 8, 0, 5, 10, 0) + * 3) Graphics::PixelFormat(4, 0, 0, 0, 0, 24, 16, 8, 0) + * 4) Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0) + * 5) Graphics::PixelFormat::createFormatCLUT8() + * + * @see Graphics::PixelFormat + * + * @note Backends supporting RGB color should accept game data in RGB color + * order, even if hardware uses BGR or some other color order. + */ + virtual Common::List getSupportedFormats() const = 0; +#else + inline Graphics::PixelFormat getScreenFormat() const { + return Graphics::PixelFormat::createFormatCLUT8(); + }; + + inline Common::List getSupportedFormats() const { + Common::List list; + list.push_back(Graphics::PixelFormat::createFormatCLUT8()); + return list; + }; +#endif + + /** + * !!! Not used in ResidualVM !!! + * + * Set the size and color format of the virtual screen. Typical sizes include: + * - 320x200 (e.g. for most SCUMM games, and Simon) + * - 320x240 (e.g. for FM-TOWN SCUMM games) + * - 640x480 (e.g. for Curse of Monkey Island) + * + * This is the resolution for which the client code generates data; + * this is not necessarily equal to the actual display size. For example, + * a backend may magnify the graphics to fit on screen (see also the + * GraphicsMode); stretch the data to perform aspect ratio correction; + * or shrink it to fit on small screens (in cell phones). + * + * Typical formats include: + * CLUT8 (e.g. 256 color, for most games) + * RGB555 (e.g. 16-bit color, for later SCUMM HE games) + * RGB565 (e.g. 16-bit color, for Urban Runner) + * + * This is the pixel format for which the client code generates data; + * this is not necessarily equal to the hardware pixel format. For example, + * a backend may perform color lookup of 8-bit graphics before pushing + * a screen to hardware, or correct the ARGB color order. + * + * @param width the new virtual screen width + * @param height the new virtual screen height + * @param format the new virtual screen pixel format + */ + virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) = 0; + /** * !!! ResidualVM specific method !!! * Set the size of the launcher virtual screen. @@ -320,18 +597,82 @@ public: */ virtual void launcherInitSize(uint width, uint height) = 0; + /** + * !!! Not used in ResidualVM !!! + * + * Return an int value which is changed whenever any screen + * parameters (like the resolution) change. That is, whenever a + * EVENT_SCREEN_CHANGED would be sent. You can track this value + * in your code to detect screen changes in case you do not have + * full control over the event loop(s) being used (like the GUI + * code). + * + * @return an integer which can be used to track screen changes + * + * @note Backends which generate EVENT_SCREEN_CHANGED events MUST + * overload this method appropriately. + */ virtual int getScreenChangeID() const { return 0; } /** - * Set the size of the screen. + * !!! Not used in ResidualVM !!! + * + * Begin a new GFX transaction, which is a sequence of GFX mode changes. + * The idea behind GFX transactions is to make it possible to activate + * several different GFX changes at once as a "batch" operation. For + * example, assume we are running in 320x200 with a 2x scaler (thus using + * 640x400 pixels in total). Now, we want to switch to 640x400 with the 1x + * scaler. Without transactions, we have to choose whether we want to first + * switch the scaler mode, or first to 640x400 mode. In either case, + * depending on the backend implementation, some ugliness may result. + * E.g. the window might briefly switch to 320x200 or 1280x800. + * Using transactions, this can be avoided. + * + * @note Transaction support is optional, and the default implementations + * of the relevant methods simply do nothing. + * @see endGFXTransaction + */ + virtual void beginGFXTransaction() {} + /** + * !!! Not used in ResidualVM !!! + * + * This type is able to save the different errors which can happen while + * changing GFX config values inside GFX transactions. + * + * endGFXTransaction returns a ORed combination of the '*Failed' values + * if any problem occures, on success 0. + * + * @see endGFXTransaction + */ + enum TransactionError { + kTransactionSuccess = 0, /**< Everything fine (use EQUAL check for this one!) */ + kTransactionAspectRatioFailed = (1 << 0), /**< Failed switching aspect ratio correction mode */ + kTransactionFullscreenFailed = (1 << 1), /**< Failed switching fullscreen mode */ + kTransactionModeSwitchFailed = (1 << 2), /**< Failed switching the GFX graphics mode (setGraphicsMode) */ + kTransactionSizeChangeFailed = (1 << 3), /**< Failed switching the screen dimensions (initSize) */ + kTransactionFormatNotSupported = (1 << 4) /**< Failed setting the color format */ + }; + + /** + * !!! Not used in ResidualVM !!! + * + * End (and thereby commit) the current GFX transaction. + * @see beginGFXTransaction + * @see kTransactionError + * @return returns a ORed combination of TransactionError values or 0 on success + */ + virtual TransactionError endGFXTransaction() { return kTransactionSuccess; } + + /** + * Set the size of the screen. + * !!! ResidualVM specific method: !!! * * @param width the new screen width * @param height the new screen height * @param fullscreen the new screen will be displayed in fullscreeen mode */ - // !!! ResidualVM specific method: !!! virtual Graphics::PixelBuffer setupScreen(int screenW, int screenH, bool fullscreen, bool accel3d) = 0; /** @@ -349,6 +690,70 @@ public: virtual int16 getWidth() = 0; /** + * !!! Not used in ResidualVM !!! + * + * Return the palette manager singleton. For more information, refer + * to the PaletteManager documentation. + */ + virtual PaletteManager *getPaletteManager() = 0; + + /** + * !!! Not used in ResidualVM !!! + * + * Blit a bitmap to the virtual screen. + * The real screen will not immediately be updated to reflect the changes. + * Client code has to to call updateScreen to ensure any changes are + * visible to the user. This can be used to optimize drawing and reduce + * flicker. + * If the current pixel format has one byte per pixel, the graphics data + * uses 8 bits per pixel, using the palette specified via setPalette. + * If more than one byte per pixel is in use, the graphics data uses the + * pixel format returned by getScreenFormat. + * + * @param buf the buffer containing the graphics data source + * @param pitch the pitch of the buffer (number of bytes in a scanline) + * @param x the x coordinate of the destination rectangle + * @param y the y coordinate of the destination rectangle + * @param w the width of the destination rectangle + * @param h the height of the destination rectangle + * + * @note The specified destination rectangle must be completly contained + * in the visible screen space, and must be non-empty. If not, a + * backend may or may not perform clipping, trigger an assert or + * silently corrupt memory. + * + * @see updateScreen + * @see getScreenFormat + */ + virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0; + + /** + * !!! Not used in ResidualVM !!! + * + * Lock the active screen framebuffer and return a Graphics::Surface + * representing it. The caller can then perform arbitrary graphics + * transformations on the framebuffer (blitting, scrolling, etc.). + * Must be followed by matching call to unlockScreen(). Calling code + * should make sure to only lock the framebuffer for the briefest + * periods of time possible, as the whole system is potentially stalled + * while the lock is active. + * Returns 0 if an error occurred. Otherwise a surface with the pixel + * format described by getScreenFormat is returned. + * + * The returned surface must *not* be deleted by the client code. + * + * @see getScreenFormat + */ + virtual Graphics::Surface *lockScreen() = 0; + + /** + * Unlock the screen framebuffer, and mark it as dirty (i.e. during the + * next updateScreen() call, the whole screen will be updated. + */ + virtual void unlockScreen() = 0; + + /** + * Fills the screen with a given color value. * !!! Not used in ResidualVM !!! * * @note We are using uint32 here even though currently @@ -368,6 +773,46 @@ public: */ virtual void updateScreen() = 0; + /** + * !!! Not used in ResidualVM !!! + * + * Set current shake position, a feature needed for some SCUMM screen + * effects. The effect causes the displayed graphics to be shifted upwards + * by the specified (always positive) offset. The area at the bottom of the + * screen which is moved into view by this is filled with black. This does + * not cause any graphic data to be lost - that is, to restore the original + * view, the game engine only has to call this method again with offset + * equal to zero. No calls to copyRectToScreen are necessary. + * @param shakeOffset the shake offset + * + * @note This is currently used in the SCUMM, QUEEN and KYRA engines. + */ + virtual void setShakePos(int shakeOffset) = 0; + + /** + * !!! Not used in ResidualVM !!! + * + * Sets the area of the screen that has the focus. For example, when a character + * is speaking, they will have the focus. Allows for pan-and-scan style views + * where the backend could follow the speaking character or area of interest on + * the screen. + * + * The backend is responsible for clipping the rectangle and deciding how best to + * zoom the screen to show any shape and size rectangle the engine provides. + * + * @param rect A rectangle on the screen to be focused on + * @see clearFocusRectangle + */ + virtual void setFocusRectangle(const Common::Rect& rect) {} + + /** + * Clears the focus set by a call to setFocusRectangle(). This allows the engine + * to clear the focus during times when no particular area of the screen has the + * focus. + * @see setFocusRectangle + */ + virtual void clearFocusRectangle() {} + //@} @@ -376,7 +821,7 @@ public: * @name Overlay * In order to be able to display dialogs atop the game graphics, backends * must provide an overlay mode. - * !!! Not valid below for ResidualVM !!! + * !!! Not valid for ResidualVM !!! * The overlay can be 8 or 16 bpp. Depending on which it is, OverlayColor * is 8 or 16 bit. * @@ -499,6 +944,8 @@ public: virtual void warpMouse(int x, int y) = 0; /** + * !!! Not used in ResidualVM !!! + * * Set the bitmap used for drawing the cursor. * * @param buf the pixmap data to be used @@ -514,6 +961,20 @@ public: */ virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0; + /** + * !!! Not used in ResidualVM !!! + * + * Replace the specified range of cursor the palette with new colors. + * The palette entries from 'start' till (start+num-1) will be replaced - so + * a full palette update is accomplished via start=0, num=256. + * + * Backends which implement it should have kFeatureCursorPalette flag set + * + * @see setPalette + * @see kFeatureCursorPalette + */ + virtual void setCursorPalette(const byte *colors, uint start, uint num) {} + //@} @@ -696,6 +1157,8 @@ public: virtual void setWindowCaption(const char *caption) {} /** + * !!! Not used in ResidualVM !!! + * * Display a message in an 'on screen display'. That is, display it in a * fashion where it is visible on or near the screen (e.g. in a transparent * rectangle over the regular screen content; or in a message box beneath diff --git a/common/util.cpp b/common/util.cpp index d8eba8e6c2c..4ba22aa95c5 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -220,6 +220,7 @@ const PlatformDescription g_platforms[] = { { "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD }, { "windows", "win", "win", "Windows", kPlatformWindows }, { "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX }, + //ResidualVM: playstation2 { "playstation2", "ps2", "ps2", "Sony PlayStation 2", kPlatformPS2 }, { "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi }, { "ios", "ios", "ios", "Apple iOS", kPlatformIOS }, diff --git a/common/util.h b/common/util.h index 0502902072b..8352912c6f1 100644 --- a/common/util.h +++ b/common/util.h @@ -78,11 +78,6 @@ template inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; } # define SCUMMVM_CURRENT_FUNCTION "" #endif -//ResidualVM specific -#ifndef round -#define round(x) ((x > 0.0) ? floor((x) + 0.5) : ceil((x) - 0.5)) -#endif - #define GUIO_NONE "\000" #define GUIO_NOSUBTITLES "\001" #define GUIO_NOMUSIC "\002" @@ -284,6 +279,7 @@ enum Platform { kPlatformPC98, kPlatformWii, kPlatformPSX, + //ResidualVM: playstation2 kPlatformPS2, kPlatformCDi, kPlatformIOS, diff --git a/devtools/credits.pl b/devtools/credits.pl index 4f345d5ba77..ac4c6482fac 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # # This tools is kind of a hack to be able to maintain the credits list of -# ResidualVM in a single central location. We then generate the various versions +# ScummVM in a single central location. We then generate the various versions # of the credits in other places from this source. In particular: # - The AUTHORS file # - The gui/credits.h header file diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index 801db0fb5c2..b659c361559 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -78,7 +78,7 @@ MainMenuDialog::MainMenuDialog(Engine *engine) title->setAlign(Graphics::kTextAlignCenter); #endif - GUI::StaticTextWidget *version = new GUI::StaticTextWidget(this, "GlobalMenu.Version", gResidualVMVersionDate); + GUI::StaticTextWidget *version = new GUI::StaticTextWidget(this, "GlobalMenu.Version", gScummVMVersionDate); version->setAlign(Graphics::kTextAlignCenter); new GUI::ButtonWidget(this, "GlobalMenu.Resume", _("~R~esume"), 0, kPlayCmd, 'P'); diff --git a/engines/engine.cpp b/engines/engine.cpp index 17405392a2b..5b02f5d57f9 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -154,13 +154,157 @@ Engine::~Engine() { CursorMan.popCursorPalette(); } +void initCommonGFX(bool defaultTo1XScaler) { + const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain); + const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain(); + + assert(transientDomain); + + const bool useDefaultGraphicsMode = + (!transientDomain->contains("gfx_mode") || + !scumm_stricmp(transientDomain->getVal("gfx_mode").c_str(), "normal") || + !scumm_stricmp(transientDomain->getVal("gfx_mode").c_str(), "default") + ) + && + ( + !gameDomain || + !gameDomain->contains("gfx_mode") || + !scumm_stricmp(gameDomain->getVal("gfx_mode").c_str(), "normal") || + !scumm_stricmp(gameDomain->getVal("gfx_mode").c_str(), "default") + ); + + // See if the game should default to 1x scaler + if (useDefaultGraphicsMode && defaultTo1XScaler) { + g_system->resetGraphicsScale(); + } else { + // Override global scaler with any game-specific define + if (ConfMan.hasKey("gfx_mode")) { + g_system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); + } + } + + // Note: The following code deals with the fullscreen / ASR settings. This + // is a bit tricky, because there are three ways the user can affect these + // settings: Via the config file, via the command line, and via in-game + // hotkeys. + // Any global or command line settings already have been applied at the time + // we get here. Hence we only do something + + // (De)activate aspect-ratio correction as determined by the config settings + if (gameDomain && gameDomain->contains("aspect_ratio")) + g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio")); + + // (De)activate fullscreen mode as determined by the config settings + if (gameDomain && gameDomain->contains("fullscreen")) + g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); +} + +void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format) { + + g_system->beginGFXTransaction(); + + initCommonGFX(defaultTo1xScaler); +#ifdef USE_RGB_COLOR + if (format) + g_system->initSize(width, height, format); + else { + Graphics::PixelFormat bestFormat = g_system->getSupportedFormats().front(); + g_system->initSize(width, height, &bestFormat); + } +#else + g_system->initSize(width, height); +#endif + + OSystem::TransactionError gfxError = g_system->endGFXTransaction(); + + if (gfxError == OSystem::kTransactionSuccess) + return; + + // Error out on size switch failure + if (gfxError & OSystem::kTransactionSizeChangeFailed) { + Common::String message; + message = Common::String::format("Could not switch to resolution: '%dx%d'.", width, height); + + GUIErrorMessage(message); + error("%s", message.c_str()); + } + + // Just show warnings then these occur: +#ifdef USE_RGB_COLOR + if (gfxError & OSystem::kTransactionFormatNotSupported) { + Common::String message = _("Could not initialize color format."); + + GUI::MessageDialog dialog(message); + dialog.runModal(); + } +#endif + + if (gfxError & OSystem::kTransactionModeSwitchFailed) { + Common::String message = _("Could not switch to video mode: '"); + message += ConfMan.get("gfx_mode"); + message += "'."; + + GUI::MessageDialog dialog(message); + dialog.runModal(); + } + + if (gfxError & OSystem::kTransactionAspectRatioFailed) { + GUI::MessageDialog dialog(_("Could not apply aspect ratio setting.")); + dialog.runModal(); + } + + if (gfxError & OSystem::kTransactionFullscreenFailed) { + GUI::MessageDialog dialog(_("Could not apply fullscreen setting.")); + dialog.runModal(); + } +} + + +using Graphics::PixelFormat; + +/** + * Determines the first matching format between two lists. + * + * @param backend The higher priority list, meant to be a list of formats supported by the backend + * @param frontend The lower priority list, meant to be a list of formats supported by the engine + * @return The first item on the backend list that also occurs on the frontend list + * or PixelFormat::createFormatCLUT8() if no matching formats were found. + */ +inline PixelFormat findCompatibleFormat(Common::List backend, Common::List frontend) { +#ifdef USE_RGB_COLOR + for (Common::List::iterator i = backend.begin(); i != backend.end(); ++i) { + for (Common::List::iterator j = frontend.begin(); j != frontend.end(); ++j) { + if (*i == *j) + return *i; + } + } +#endif + return PixelFormat::createFormatCLUT8(); +} + + +void initGraphics(int width, int height, bool defaultTo1xScaler, const Common::List &formatList) { + Graphics::PixelFormat format = findCompatibleFormat(g_system->getSupportedFormats(), formatList); + initGraphics(width, height, defaultTo1xScaler, &format); +} + +void initGraphics(int width, int height, bool defaultTo1xScaler) { + Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8(); + initGraphics(width, height, defaultTo1xScaler, &format); +} void GUIErrorMessage(const Common::String &msg) { g_system->setWindowCaption("Error"); - g_system->launcherInitSize(640, 400); - GUI::MessageDialog dialog(msg); - dialog.runModal(); - error("%s", msg.c_str()); + g_system->beginGFXTransaction(); + initCommonGFX(false); + g_system->initSize(320, 200); + g_system->launcherInitSize(640, 400);//ResidualVM specific + if (g_system->endGFXTransaction() == OSystem::kTransactionSuccess) { + GUI::MessageDialog dialog(msg); + dialog.runModal(); + } else { + error("%s", msg.c_str()); + } } void Engine::checkCD() { diff --git a/engines/grim/grim.h b/engines/grim/grim.h index daf21116435..f66ea25c9ee 100644 --- a/engines/grim/grim.h +++ b/engines/grim/grim.h @@ -297,4 +297,9 @@ extern const ControlDescriptor controls[]; } // end of namespace Grim +#ifndef round +#define round(x) ((x > 0.0) ? floor((x) + 0.5) : ceil((x) - 0.5)) +#endif + + #endif diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index cab3d14bad4..1d4e482bf49 100644 --- a/graphics/cursorman.cpp +++ b/graphics/cursorman.cpp @@ -88,6 +88,13 @@ void CursorManager::popAllCursors() { delete cur; } + if (g_system->hasFeature(OSystem::kFeatureCursorPalette)) { + while (!_cursorPaletteStack.empty()) { + Palette *pal = _cursorPaletteStack.pop(); + delete pal; + } + } + g_system->showMouse(isVisible()); } @@ -136,23 +143,86 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, } bool CursorManager::supportsCursorPalettes() { - return false; //ResidualVM: not supported + return g_system->hasFeature(OSystem::kFeatureCursorPalette); } void CursorManager::disableCursorPalette(bool disable) { - return; //ResidualVM: not supported + if (!g_system->hasFeature(OSystem::kFeatureCursorPalette)) + return; + + if (_cursorPaletteStack.empty()) + return; + + Palette *pal = _cursorPaletteStack.top(); + pal->_disabled = disable; + + g_system->setFeatureState(OSystem::kFeatureCursorPalette, !disable); } void CursorManager::pushCursorPalette(const byte *colors, uint start, uint num) { - return; //ResidualVM: not supported + if (!g_system->hasFeature(OSystem::kFeatureCursorPalette)) + return; + + Palette *pal = new Palette(colors, start, num); + _cursorPaletteStack.push(pal); + + if (num) + g_system->setCursorPalette(colors, start, num); + else + g_system->setFeatureState(OSystem::kFeatureCursorPalette, false); } void CursorManager::popCursorPalette() { - return; //ResidualVM: not supported + if (!g_system->hasFeature(OSystem::kFeatureCursorPalette)) + return; + + if (_cursorPaletteStack.empty()) + return; + + Palette *pal = _cursorPaletteStack.pop(); + delete pal; + + if (_cursorPaletteStack.empty()) { + g_system->setFeatureState(OSystem::kFeatureCursorPalette, false); + return; + } + + pal = _cursorPaletteStack.top(); + + if (pal->_num && !pal->_disabled) + g_system->setCursorPalette(pal->_data, pal->_start, pal->_num); + else + g_system->setFeatureState(OSystem::kFeatureCursorPalette, false); } void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint num) { - return; //ResidualVM: not supported + if (!g_system->hasFeature(OSystem::kFeatureCursorPalette)) + return; + + if (_cursorPaletteStack.empty()) { + pushCursorPalette(colors, start, num); + return; + } + + Palette *pal = _cursorPaletteStack.top(); + uint size = 3 * num; + + if (pal->_size < size) { + // Could not re-use the old buffer. Create a new one. + delete[] pal->_data; + pal->_data = new byte[size]; + pal->_size = size; + } + + pal->_start = start; + pal->_num = num; + + if (num) { + memcpy(pal->_data, colors, size); + g_system->setCursorPalette(pal->_data, pal->_start, pal->_num); + } else { + g_system->setFeatureState(OSystem::kFeatureCursorPalette, false); + } } CursorManager::Cursor::Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) { diff --git a/graphics/palette.h b/graphics/palette.h new file mode 100644 index 00000000000..77891c3fdc0 --- /dev/null +++ b/graphics/palette.h @@ -0,0 +1,102 @@ +/* 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. + * + */ + +#ifndef GRAPHICS_PALETTE_H +#define GRAPHICS_PALETTE_H + +#include "common/scummsys.h" +#include "common/noncopyable.h" + +/** + * The PaletteManager is part of the OSystem backend API and responsible + * for handling the (possibly emulated) "hardware" palette needed for + * many old games (e.g. in EGA and VGA mode). + * + * By itself it is a pure abstract class, i.e. an "interface"; you can + * use the OSystem::getPaletteManager() method to obtain an instance + * that you can use to perform actual palette modifications. + */ +class PaletteManager : Common::NonCopyable { +public: + virtual ~PaletteManager() {} + + /** + * Replace the specified range of the palette with new colors. + * The palette entries from 'start' till (start+num-1) will be replaced - so + * a full palette update is accomplished via start=0, num=256. + * + * The palette data is specified in interleaved RGB format. That is, the + * first byte of the memory block 'colors' points at is the red component + * of the first new color; the second byte the green component of the first + * new color; the third byte the blue component, the last byte to the alpha + * (transparency) value. Then the second color starts, and so on. So memory + * looks like this: R1-G1-B1-R2-G2-B2-R3-... + * + * @param colors the new palette data, in interleaved RGB format + * @param start the first palette entry to be updated + * @param num the number of palette entries to be updated + * + * @note It is an error if start+num exceeds 256, behavior is undefined + * in that case (the backend may ignore it silently or assert). + * @note It is an error if this function gets called when the pixel format + * in use (the return value of getScreenFormat) has more than one + * byte per pixel. + * + * @see getScreenFormat + */ + virtual void setPalette(const byte *colors, uint start, uint num) = 0; + + /** + * Grabs a specified part of the currently active palette. + * The format is the same as for setPalette. + * + * This should return exactly the same RGB data as was setup via previous + * setPalette calls. + * + * For example, for every valid value of start and num of the following + * code: + * + * byte origPal[num*3]; + * // Setup origPal's data however you like + * g_system->setPalette(origPal, start, num); + * byte obtainedPal[num*3]; + * g_system->grabPalette(obtainedPal, start, num); + * + * the following should be true: + * + * memcmp(origPal, obtainedPal, num*3) == 0 + * + * @see setPalette + * @param colors the palette data, in interleaved RGB format + * @param start the first platte entry to be read + * @param num the number of palette entries to be read + * + * @note It is an error if this function gets called when the pixel format + * in use (the return value of getScreenFormat) has more than one + * byte per pixel. + * + * @see getScreenFormat + */ + virtual void grabPalette(byte *colors, uint start, uint num) = 0; +}; + +#endif diff --git a/graphics/scaler.h b/graphics/scaler.h index 61a3d4f6322..242d2924346 100644 --- a/graphics/scaler.h +++ b/graphics/scaler.h @@ -76,8 +76,8 @@ enum { * @param surf a surface (will always have 16 bpp after this for now) * @return false if a error occurred */ -//ResidualVM: not supported -//extern bool createThumbnailFromScreen(Graphics::Surface *surf); +//ResidualVM specific: +inline bool createThumbnailFromScreen(Graphics::Surface *surf) { return true; } /** * Creates a thumbnail from a buffer. @@ -88,7 +88,6 @@ enum { * @param h height * @param palette palette in RGB format */ -//ResidualVM: not supported -//extern bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, const uint8 *palette); +extern bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, const uint8 *palette); #endif diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp index 02324e767a8..db61d828d2c 100644 --- a/graphics/thumbnail.cpp +++ b/graphics/thumbnail.cpp @@ -126,11 +126,10 @@ Graphics::Surface *loadThumbnail(Common::SeekableReadStream &in) { bool saveThumbnail(Common::WriteStream &out) { Graphics::Surface thumb; -//ResidualVM: not supported -// if (!createThumbnailFromScreen(&thumb)) { -// warning("Couldn't create thumbnail from screen, aborting thumbnail save"); + if (!createThumbnailFromScreen(&thumb)) { + warning("Couldn't create thumbnail from screen, aborting thumbnail save"); return false; -// } + } bool success = saveThumbnail(out, thumb); thumb.free(); diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index f51ac6c8b18..ba77629b295 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1277,7 +1277,8 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) { } bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale) { - return true; // ResidualVM doesn's support cursor palette mode + if (!_system->hasFeature(OSystem::kFeatureCursorPalette)) + return true; // Try to locate the specified file among all loaded bitmaps const Graphics::Surface *cursor = _bitmaps[filename]; @@ -1526,7 +1527,7 @@ bool ThemeEngine::themeConfigParseHeader(Common::String header, Common::String & Common::StringTokenizer tok(header, ":"); - if (tok.nextToken() != RESIDUALVM_THEME_VERSION_STR) + if (tok.nextToken() != SCUMMVM_THEME_VERSION_STR) return false; themeName = tok.nextToken(); diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 3bbe81ad4db..f041f85ab99 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -35,7 +35,7 @@ #include "graphics/pixelformat.h" -#define RESIDUALVM_THEME_VERSION_STR "SCUMMVM_STX0.8.8" +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.8" class OSystem; diff --git a/gui/about.cpp b/gui/about.cpp index 10a9506e5d0..3280646f329 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -85,10 +85,10 @@ AboutDialog::AboutDialog() _lines.push_back(""); Common::String version("C0""ResidualVM "); - version += gResidualVMVersion; + version += gScummVMVersion; _lines.push_back(version); - Common::String date = Common::String::format(_("(built on %s)"), gResidualVMBuildDate); + Common::String date = Common::String::format(_("(built on %s)"), gScummVMBuildDate); _lines.push_back("C2" + date); for (i = 0; i < ARRAYSIZE(copyright_text); i++) @@ -98,7 +98,7 @@ AboutDialog::AboutDialog() features += _("Features compiled in:"); addLine(features.c_str()); Common::String featureList("C0"); - featureList += gResidualVMFeatures; + featureList += gScummVMFeatures; addLine(featureList.c_str()); _lines.push_back(""); diff --git a/gui/browser_osx.mm b/gui/browser_osx.mm index 5728fef55a1..b8aa7c50ee1 100644 --- a/gui/browser_osx.mm +++ b/gui/browser_osx.mm @@ -47,6 +47,14 @@ BrowserDialog::~BrowserDialog() { int BrowserDialog::runModal() { bool choiceMade = false; + // If in fullscreen mode, switch to windowed mode + bool wasFullscreen = g_system->getFeatureState(OSystem::kFeatureFullscreenMode); + if (wasFullscreen) { + g_system->beginGFXTransaction(); + g_system->setFeatureState(OSystem::kFeatureFullscreenMode, false); + g_system->endGFXTransaction(); + } + // Temporarily show the real mouse CGDisplayShowCursor(kCGDirectMainDisplay); @@ -59,6 +67,14 @@ int BrowserDialog::runModal() { choiceMade = true; } + + // If we were in fullscreen mode, switch back + if (wasFullscreen) { + g_system->beginGFXTransaction(); + g_system->setFeatureState(OSystem::kFeatureFullscreenMode, true); + g_system->endGFXTransaction(); + } + return choiceMade; } diff --git a/gui/console.cpp b/gui/console.cpp index 454941c1e4d..49e2fccd987 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -86,7 +86,7 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent) _history[i][0] = '\0'; // Display greetings & prompt - print(gResidualVMFullVersion); + print(gScummVMFullVersion); print("\nConsole is ready\n"); } diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 7086701ea57..4b8b9d0bf1f 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -112,19 +112,21 @@ void GuiManager::initKeymap() { Action *act; Keymap *guiMap = new Keymap(kGuiKeymapName); - act = new Action(guiMap, "CLOS", _("Close"), kGenericActionType, kStartKeyType); + act = new Action(guiMap, "CLOS", _("Close")); act->addKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE, 0)); act = new Action(guiMap, "CLIK", _("Mouse click")); act->addLeftClickEvent(); - act = new Action(guiMap, "VIRT", _("Display keyboard"), kVirtualKeyboardActionType); - act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0)); +#ifdef ENABLE_VKEYBD + act = new Action(guiMap, "VIRT", _("Display keyboard")); + act->addEvent(EVENT_VIRTUAL_KEYBOARD); +#endif - act = new Action(guiMap, "REMP", _("Remap keys"), kKeyRemapActionType); - act->addKeyEvent(KeyState(KEYCODE_F8, ASCII_F8, 0)); + act = new Action(guiMap, "REMP", _("Remap keys")); + act->addEvent(EVENT_KEYMAPPER_REMAP); - act = new Action(guiMap, "FULS", _("Toggle FullScreen"), kKeyRemapActionType); + act = new Action(guiMap, "FULS", _("Toggle FullScreen")); act->addKeyEvent(KeyState(KEYCODE_RETURN, ASCII_RETURN, KBD_ALT)); mapper->addGlobalKeymap(guiMap); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 148142fb0bf..542b7662d2e 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -245,7 +245,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _c("Override global volume settings", "lowres"), 0, kCmdGlobalVolumeOverride); addVolumeControls(tab, "GameOptions_Volume."); -/* ResidualVM: do nt enable midi +/* ResidualVM: do not enable midi // // 5) The MIDI tab // @@ -551,7 +551,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat #pragma mark - LauncherDialog::LauncherDialog() - : Dialog(0, 0, 640, 400) { + : Dialog(0, 0, 640, 400) {//ResidualVM specific _backgroundType = GUI::ThemeEngine::kDialogBackgroundMain; const int screenW = g_system->getOverlayWidth(); @@ -567,12 +567,12 @@ LauncherDialog::LauncherDialog() _logo->useThemeTransparency(true); _logo->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageLogo)); - new StaticTextWidget(this, "Launcher.Version", gResidualVMVersionDate); + new StaticTextWidget(this, "Launcher.Version", gScummVMVersionDate); } else - new StaticTextWidget(this, "Launcher.Version", gResidualVMFullVersion); + new StaticTextWidget(this, "Launcher.Version", gScummVMFullVersion); #else // Show ScummVM version - new StaticTextWidget(this, "Launcher.Version", gResidualVMFullVersion); + new StaticTextWidget(this, "Launcher.Version", gScummVMFullVersion); #endif new ButtonWidget(this, "Launcher.QuitButton", _("~Q~uit"), _("Quit ResidualVM"), kQuitCmd); @@ -1084,10 +1084,10 @@ void LauncherDialog::updateButtons() { void LauncherDialog::reflowLayout() { #ifndef DISABLE_FANCY_THEMES if (g_gui.xmlEval()->getVar("Globals.ShowLauncherLogo") == 1 && g_gui.theme()->supportsImages()) { - StaticTextWidget *ver = (StaticTextWidget*)findWidget("Launcher.Version"); + StaticTextWidget *ver = (StaticTextWidget *)findWidget("Launcher.Version"); if (ver) { ver->setAlign((Graphics::TextAlign)g_gui.xmlEval()->getVar("Launcher.Version.Align", Graphics::kTextAlignCenter)); - ver->setLabel(gResidualVMVersionDate); + ver->setLabel(gScummVMVersionDate); } if (!_logo) @@ -1095,10 +1095,10 @@ void LauncherDialog::reflowLayout() { _logo->useThemeTransparency(true); _logo->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageLogo)); } else { - StaticTextWidget *ver = (StaticTextWidget*)findWidget("Launcher.Version"); + StaticTextWidget *ver = (StaticTextWidget *)findWidget("Launcher.Version"); if (ver) { ver->setAlign((Graphics::TextAlign)g_gui.xmlEval()->getVar("Launcher.Version.Align", Graphics::kTextAlignCenter)); - ver->setLabel(gResidualVMFullVersion); + ver->setLabel(gScummVMFullVersion); } if (_logo) { diff --git a/gui/options.cpp b/gui/options.cpp index dda67d9f4d9..b8276d0a372 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -294,8 +294,15 @@ void OptionsDialog::close() { // Setup graphics again if needed if (_domain == Common::ConfigManager::kApplicationDomain && graphicsModeChanged) { + g_system->beginGFXTransaction(); + g_system->setGraphicsMode(ConfMan.get("gfx_mode", _domain).c_str()); + + if (ConfMan.hasKey("aspect_ratio")) + g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio", _domain)); if (ConfMan.hasKey("fullscreen")) g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen", _domain)); + OSystem::TransactionError gfxError = g_system->endGFXTransaction(); + // Since this might change the screen resolution we need to give // the GUI a chance to update it's internal state. Otherwise we might // get a crash when the GUI tries to grab the overlay. @@ -307,6 +314,40 @@ void OptionsDialog::close() { // Dialog::close) is called, to prevent crashes caused by invalid // widgets being referenced or similar errors. g_gui.checkScreenChange(); + + if (gfxError != OSystem::kTransactionSuccess) { + // Revert ConfMan to what OSystem is using. + Common::String message = _("Failed to apply some of the graphic options changes:"); + + if (gfxError & OSystem::kTransactionModeSwitchFailed) { + const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes(); + while (gm->name) { + if (gm->id == g_system->getGraphicsMode()) { + ConfMan.set("gfx_mode", gm->name, _domain); + break; + } + gm++; + } + message += "\n"; + message += _("the video mode could not be changed."); + } + + if (gfxError & OSystem::kTransactionAspectRatioFailed) { + ConfMan.setBool("aspect_ratio", g_system->getFeatureState(OSystem::kFeatureAspectRatioCorrection), _domain); + message += "\n"; + message += _("the fullscreen setting could not be changed"); + } + + if (gfxError & OSystem::kTransactionFullscreenFailed) { + ConfMan.setBool("fullscreen", g_system->getFeatureState(OSystem::kFeatureFullscreenMode), _domain); + message += "\n"; + message += _("the aspect ratio setting could not be changed"); + } + + // And display the error + GUI::MessageDialog dialog(message); + dialog.runModal(); + } } // Volume options @@ -890,6 +931,30 @@ void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String se ConfMan.removeKey(setting, _domain); } +Common::String OptionsDialog::renderType2GUIO(uint32 renderType) { + static const struct { + Common::RenderMode type; + const char *guio; + } renderGUIOMapping[] = { + { Common::kRenderHercG, GUIO_RENDERHERCGREEN }, + { Common::kRenderHercA, GUIO_RENDERHERCAMBER }, + { Common::kRenderCGA, GUIO_RENDERCGA }, + { Common::kRenderEGA, GUIO_RENDEREGA }, + { Common::kRenderVGA, GUIO_RENDERVGA }, + { Common::kRenderAmiga, GUIO_RENDERAMIGA }, + { Common::kRenderFMTowns, GUIO_RENDERFMTOWNS }, + { Common::kRenderPC98, GUIO_RENDERPC98 } + }; + Common::String res; + + for (int i = 0; i < ARRAYSIZE(renderGUIOMapping); i++) { + if (renderType == renderGUIOMapping[i].type || renderType == (uint32)-1) + res += renderGUIOMapping[i].guio; + } + + return res; +} + int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) { if (_guioptions.contains(GUIO_NOSUBTITLES)) return kSubtitlesSpeech; // Speech only diff --git a/gui/options.h b/gui/options.h index 357be62d7e2..f8434b6f1a6 100644 --- a/gui/options.h +++ b/gui/options.h @@ -85,6 +85,8 @@ protected: bool loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicType preferredType = MT_AUTO); void saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting); + Common::String renderType2GUIO(uint32 renderType); + TabWidget *_tabWidget; int _graphicsTabId; diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp index e96d32a801e..e1122132a8f 100644 --- a/video/video_decoder.cpp +++ b/video/video_decoder.cpp @@ -26,8 +26,7 @@ #include "common/file.h" #include "common/system.h" -//ResidualVM: not include -//#include "graphics/palette.h" +#include "graphics/palette.h" namespace Video { @@ -51,8 +50,7 @@ uint32 VideoDecoder::getElapsedTime() const { } void VideoDecoder::setSystemPalette() { -//ResidualVM: not exist -// g_system->getPaletteManager()->setPalette(getPalette(), 0, 256); + g_system->getPaletteManager()->setPalette(getPalette(), 0, 256); } bool VideoDecoder::needsUpdate() const {