diff options
-rw-r--r-- | backends/events/gph/gph-events.cpp | 1 | ||||
-rw-r--r-- | backends/graphics/gph/gph-graphics.cpp | 95 | ||||
-rw-r--r-- | backends/graphics/gph/gph-graphics.h | 4 | ||||
-rw-r--r-- | backends/platform/gph/gph-backend.cpp | 20 | ||||
-rw-r--r-- | backends/platform/gph/gph-main.cpp | 4 | ||||
-rw-r--r-- | backends/platform/gph/gph-sdl.h | 4 |
6 files changed, 99 insertions, 29 deletions
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp index 8bb3a3b183..b461f85fbb 100644 --- a/backends/events/gph/gph-events.cpp +++ b/backends/events/gph/gph-events.cpp @@ -187,7 +187,6 @@ GPHEventSource::GPHEventSource() // } //} - void GPHEventSource::moveStick() { bool stickBtn[32]; diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index b65028920f..eb748f2fc2 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -35,8 +35,8 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { {0, 0, 0} }; -GPHGraphicsManager::GPHGraphicsManager(SdlEventSource *boss) - : SdlGraphicsManager(boss) { +GPHGraphicsManager::GPHGraphicsManager(SdlEventSource *sdlEventSource) + : SdlGraphicsManager(sdlEventSource) { } const OSystem::GraphicsMode *GPHGraphicsManager::getSupportedGraphicsModes() const { @@ -110,21 +110,43 @@ void GPHGraphicsManager::setGraphicsModeIntern() { blitCursor(); } -void GPHGraphicsManager::initSize(uint w, uint h) { +void GPHGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) { assert(_transactionMode == kTransactionActive); +#ifdef USE_RGB_COLOR + // Avoid redundant format changes + Graphics::PixelFormat newFormat; + if (!format) + newFormat = Graphics::PixelFormat::createFormatCLUT8(); + else + newFormat = *format; + + assert(newFormat.bytesPerPixel > 0); + + if (newFormat != _videoMode.format) { + _videoMode.format = newFormat; + _transactionDetails.formatChanged = true; + _screenFormat = newFormat; + } +#endif + + // Avoid redundant res changes if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight) return; _videoMode.screenWidth = w; _videoMode.screenHeight = h; + if (w > 320 || h > 240){ setGraphicsMode(GFX_HALF); setGraphicsModeIntern(); _sdlEventSource->toggleMouseGrab(); } + _videoMode.overlayWidth = 320; + _videoMode.overlayHeight = 240; + _transactionDetails.sizeChanged = true; } @@ -433,26 +455,65 @@ void GPHGraphicsManager::hideOverlay() { } -bool GPHGraphicsManager::loadGFXMode() { - - /* Forcefully disable aspect ratio correction for games - that start with a native 240px height resolution - This corrects games with non-standard resolutions - such as MM Nes (256x240). - */ +//bool GPHGraphicsManager::loadGFXMode() { + + +// _videoMode.overlayWidth = 320; +// _videoMode.overlayHeight = 240; +// _videoMode.fullscreen = true; +// +// /* Forcefully disable aspect ratio correction for games +// that start with a native 240px height resolution +// This corrects games with non-standard resolutions +// such as MM Nes (256x240). +// */ +// if(_videoMode.screenHeight == 240) { +// _videoMode.aspectRatioCorrection = false; +// } + +// debug("Game ScreenMode = %d*%d", _videoMode.screenWidth, _videoMode.screenHeight); +// if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) { +// _videoMode.aspectRatioCorrection = false; +// setGraphicsMode(GFX_HALF); +// debug("GraphicsMode set to HALF"); +// } else { +// setGraphicsMode(GFX_NORMAL); +// debug("GraphicsMode set to NORMAL"); +// } + + +// if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) { +// //_videoMode.overlayWidth = _videoMode.screenWidth / 2; +// //_videoMode.overlayHeight = _videoMode.screenHeight / 2; +// _videoMode.overlayWidth = 320; +// _videoMode.overlayHeight = 240; +// _videoMode.fullscreen = true; +// } else { +// +// _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; +// _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; +// +// if (_videoMode.aspectRatioCorrection) +// _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); +// +// //_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; +// //_videoMode.hardwareHeight = effectiveScreenHeight(); +// _videoMode.hardwareWidth = 320; +// _videoMode.hardwareHeight = 240; +// +// } + +// return SdlGraphicsManager::loadGFXMode(); +//} - if(_videoMode.screenHeight == 240) { - _videoMode.aspectRatioCorrection = false; - } - - debug("Game ScreenMode = %d*%d", _videoMode.screenWidth, _videoMode.screenHeight); +bool GPHGraphicsManager::loadGFXMode() { if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) { _videoMode.aspectRatioCorrection = false; setGraphicsMode(GFX_HALF); - debug("GraphicsMode set to HALF"); +// printf("GFX_HALF\n"); } else { setGraphicsMode(GFX_NORMAL); - debug("GraphicsMode set to NORMAL"); +// printf("GFX_NORMAL\n"); } if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) { diff --git a/backends/graphics/gph/gph-graphics.h b/backends/graphics/gph/gph-graphics.h index 6ba2b344a6..fc3dc5730d 100644 --- a/backends/graphics/gph/gph-graphics.h +++ b/backends/graphics/gph/gph-graphics.h @@ -24,7 +24,7 @@ #define BACKENDS_GRAPHICS_GPH_H #include "backends/graphics/sdl/sdl-graphics.h" -#include "graphics/scaler/aspect.h" // for aspect2Real +#include "graphics/scaler/aspect.h" // for aspect2Real #include "graphics/scaler/downscaler.h" enum { @@ -40,7 +40,7 @@ public: bool getFeatureState(OSystem::Feature f); int getDefaultGraphicsMode() const; - void initSize(uint w, uint h); + void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL); const OSystem::GraphicsMode *getSupportedGraphicsModes() const; bool setGraphicsMode(const char *name); bool setGraphicsMode(int mode); diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp index cb52da441d..ae3466b836 100644 --- a/backends/platform/gph/gph-backend.cpp +++ b/backends/platform/gph/gph-backend.cpp @@ -56,8 +56,15 @@ /* Dump console info to files. */ #define DUMP_STDOUT +OSystem_GPH::OSystem_GPH() + : + OSystem_POSIX() { +} + void OSystem_GPH::initBackend() { + assert(!_inited); + // Create the events manager if (_eventSource == 0) _eventSource = new GPHEventSource(); @@ -81,7 +88,7 @@ void OSystem_GPH::initBackend() { char workDirName[PATH_MAX+1]; if (getcwd(workDirName, PATH_MAX) == NULL) { - error("Could not obtain current working directory"); + error("Could not obtain current working directory."); } else { printf("Current working directory: %s\n", workDirName); } @@ -155,7 +162,8 @@ void OSystem_GPH::initBackend() { /* Trigger autosave every 4 minutes - On low batts 5 mins is about your warning time. */ ConfMan.registerDefault("autosave_period", 4 * 60); - /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' is ;-). */ + /* Make sure that aspect ratio correction is enabled on the 1st run to stop + users asking me what the 'wasted space' at the bottom is ;-). */ ConfMan.registerDefault("aspect_ratio", true); /* Make sure SDL knows that we have a joystick we want to use. */ @@ -164,10 +172,10 @@ void OSystem_GPH::initBackend() { /* Now setup any device specific user options (Left handed mode, that sort of thing). */ // GPH::setOptions(); - printf("%s\n", "Passing to OSystem::SDL initBackend."); - /* Pass to POSIX method to do the heavy lifting */ OSystem_POSIX::initBackend(); + + _inited = true; } void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { @@ -176,7 +184,7 @@ void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) char workDirName[PATH_MAX+1]; if (getcwd(workDirName, PATH_MAX) == NULL) { - error("Error: Could not obtain current working directory"); + error("Error: Could not obtain current working directory."); } Common::FSNode workdirNode(workDirName); @@ -215,5 +223,5 @@ void OSystem_GPH::quit() { fclose(stderr); #endif /* DUMP_STDOUT */ - OSystem_SDL::quit(); + OSystem_POSIX::quit(); } diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp index f91ec8f478..1a8c6686ca 100644 --- a/backends/platform/gph/gph-main.cpp +++ b/backends/platform/gph/gph-main.cpp @@ -21,7 +21,7 @@ */ #include "backends/platform/gph/gph-sdl.h" -#include "backends/plugins/sdl/sdl-provider.h" +#include "backends/plugins/posix/posix-provider.h" #include "base/main.h" #if defined(GPH_DEVICE) @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { ((OSystem_GPH *)g_system)->init(); #ifdef DYNAMIC_MODULES - PluginManager::instance().addPluginProvider(new SDLPluginProvider()); + PluginManager::instance().addPluginProvider(new POSIXPluginProvider()); #endif // Invoke the actual ScummVM main entry point: diff --git a/backends/platform/gph/gph-sdl.h b/backends/platform/gph/gph-sdl.h index 68a641eed7..8b943f98f3 100644 --- a/backends/platform/gph/gph-sdl.h +++ b/backends/platform/gph/gph-sdl.h @@ -28,8 +28,8 @@ #include "backends/base-backend.h" #include "backends/platform/sdl/sdl.h" #include "backends/platform/sdl/posix/posix.h" -#include "backends/graphics/gph/gph-graphics.h" #include "backends/events/gph/gph-events.h" +#include "backends/graphics/gph/gph-graphics.h" #define __GP2XWIZ__ @@ -39,6 +39,8 @@ class OSystem_GPH : public OSystem_POSIX { public: + OSystem_GPH(); + /* Platform Setup Stuff */ void addSysArchivesToSearchSet(Common::SearchSet &s, int priority); void initBackend(); |