diff options
author | D G Turner | 2017-12-27 11:47:39 +0000 |
---|---|---|
committer | rsn8887 | 2017-12-29 01:21:40 -0600 |
commit | a3d2c5268768bff0bed06aff00d97704c88bb337 (patch) | |
tree | cd2e967b8e8671581534a9491f76475a10b3ce90 /backends/platform/psp | |
parent | 45891aed916f5377c1a8fed8c02ce5ec32ea52e4 (diff) | |
download | scummvm-rg350-a3d2c5268768bff0bed06aff00d97704c88bb337.tar.gz scummvm-rg350-a3d2c5268768bff0bed06aff00d97704c88bb337.tar.bz2 scummvm-rg350-a3d2c5268768bff0bed06aff00d97704c88bb337.zip |
PSP: Fix bug #10239: PSP port incorrect 4:3 aspect ratio
This is based on a patch supplied by dam-soft. A new graphics mode is
added to the PSP port. The graphics mode is called '4:3 Aspect Ratio'
and fixes the incorrect AR. The older modes are also still present and
behave as before.
Diffstat (limited to 'backends/platform/psp')
-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 |