diff options
-rw-r--r-- | backends/platform/psp/display_manager.cpp | 29 | ||||
-rw-r--r-- | backends/platform/psp/display_manager.h | 3 |
2 files changed, 23 insertions, 9 deletions
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index 2e995c809e..f8be51e4e9 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -55,7 +55,8 @@ uint32 __attribute__((aligned(16))) MasterGuRenderer::_displayList[2048]; const OSystem::GraphicsMode DisplayManager::_supportedModes[] = { { "Original Resolution", "Original Resolution", ORIGINAL_RESOLUTION }, { "Keep Aspect Ratio", "Keep Aspect Ratio", KEEP_ASPECT_RATIO }, - { "Full Screen", "Full Screen", STRETCHED_FULL_SCREEN }, + { "4:3 Aspect Ratio", "4:3 Aspect Ratio", ASPECT_RATIO_CORRECTION }, + { "Stretched Full Screen", "Stretched Full Screen", STRETCHED_FULL_SCREEN }, {0, 0, 0} }; @@ -358,23 +359,35 @@ void DisplayManager::calculateScaleParams() { switch (_graphicsMode) { case ORIGINAL_RESOLUTION: // check if we can fit the original resolution inside the screen - if ((_displayParams.screenSource.width < PSP_SCREEN_WIDTH) && - (_displayParams.screenSource.height < PSP_SCREEN_HEIGHT)) { + if ((_displayParams.screenSource.width <= PSP_SCREEN_WIDTH) && + (_displayParams.screenSource.height <= PSP_SCREEN_HEIGHT)) { _displayParams.screenOutput.width = _displayParams.screenSource.width; _displayParams.screenOutput.height = _displayParams.screenSource.height; - } else { // revert to stretch to fit - _displayParams.screenOutput.width = PSP_SCREEN_WIDTH; - _displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; + break; } - break; + // else revert to keep aspect ratio case KEEP_ASPECT_RATIO: { // maximize the height while keeping aspect ratio float aspectRatio = (float)_displayParams.screenSource.width / (float)_displayParams.screenSource.height; _displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height _displayParams.screenOutput.width = (uint32)(PSP_SCREEN_HEIGHT * aspectRatio); - if (_displayParams.screenOutput.width > PSP_SCREEN_WIDTH) // we can't have wider than the screen + if (_displayParams.screenOutput.width > PSP_SCREEN_WIDTH) { // shrink if wider than screen + _displayParams.screenOutput.height = (uint32) (((float) PSP_SCREEN_HEIGHT * (float) PSP_SCREEN_WIDTH) / (float) _displayParams.screenOutput.width); + _displayParams.screenOutput.width = PSP_SCREEN_WIDTH; + } + } + break; + case ASPECT_RATIO_CORRECTION: { // maximize the height while forcing 4:3 aspect ratio + float aspectRatio = 4.0f / 3.0f; + + _displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height + _displayParams.screenOutput.width = (uint32)(PSP_SCREEN_HEIGHT * aspectRatio); + + if (_displayParams.screenOutput.width > PSP_SCREEN_WIDTH) { // // shrink if wider than screen + _displayParams.screenOutput.height = (uint32) (((float) PSP_SCREEN_HEIGHT * (float) PSP_SCREEN_WIDTH) / (float) _displayParams.screenOutput.width); _displayParams.screenOutput.width = PSP_SCREEN_WIDTH; + } } break; case STRETCHED_FULL_SCREEN: // we simply stretch to the whole screen diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h index b1b748a68c..ba11963f8c 100644 --- a/backends/platform/psp/display_manager.h +++ b/backends/platform/psp/display_manager.h @@ -106,6 +106,7 @@ public: enum GraphicsModeID { ///> Possible output formats onscreen ORIGINAL_RESOLUTION, KEEP_ASPECT_RATIO, + ASPECT_RATIO_CORRECTION, STRETCHED_FULL_SCREEN }; DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0), @@ -118,7 +119,7 @@ public: bool setGraphicsMode(int mode); bool setGraphicsMode(const char *name); int getGraphicsMode() const { return _graphicsMode; } - uint32 getDefaultGraphicsMode() const { return STRETCHED_FULL_SCREEN; } + uint32 getDefaultGraphicsMode() const { return KEEP_ASPECT_RATIO; } const OSystem::GraphicsMode* getSupportedGraphicsModes() const { return _supportedModes; } // Setters for pointers |