PSP: Use aspect correction checkbox instead of extra graphics modes
This commit is contained in:
parent
50d79c5f26
commit
231407206d
4 changed files with 23 additions and 25 deletions
|
@ -35,6 +35,8 @@
|
|||
#include "backends/platform/psp/pspkeyboard.h"
|
||||
#include "backends/platform/psp/image_viewer.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
|
||||
#define USE_DISPLAY_CALLBACK // to use callback for finishing the render
|
||||
#include "backends/platform/psp/display_manager.h"
|
||||
|
||||
|
@ -54,9 +56,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 },
|
||||
{ "4:3 Aspect Ratio", "4:3 Aspect Ratio", ASPECT_RATIO_CORRECTION },
|
||||
{ "Stretched Full Screen", "Stretched Full Screen", STRETCHED_FULL_SCREEN },
|
||||
{ "Fit to Screen", "Fit to Screen", FIT_TO_SCREEN },
|
||||
{ "Stretch to Screen", "Stretch to Screen", STRETCH_TO_SCREEN },
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -365,32 +366,26 @@ void DisplayManager::calculateScaleParams() {
|
|||
_displayParams.screenOutput.height = _displayParams.screenSource.height;
|
||||
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;
|
||||
// else revert to fit to screen
|
||||
case FIT_TO_SCREEN: { // maximize the height while keeping aspect ratio
|
||||
float aspectRatio;
|
||||
|
||||
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height
|
||||
if (ConfMan.getBool("aspect_ratio")) {
|
||||
aspectRatio = 4.0f / 3.0f;
|
||||
} else {
|
||||
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) { // shrink if wider than screen
|
||||
_displayParams.screenOutput.height = (uint32) (((float) PSP_SCREEN_HEIGHT * (float) PSP_SCREEN_WIDTH) / (float) _displayParams.screenOutput.width);
|
||||
_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
|
||||
case STRETCH_TO_SCREEN: // we simply stretch to the whole screen
|
||||
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
|
||||
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT;
|
||||
break;
|
||||
|
|
|
@ -105,9 +105,8 @@ class DisplayManager {
|
|||
public:
|
||||
enum GraphicsModeID { ///> Possible output formats onscreen
|
||||
ORIGINAL_RESOLUTION,
|
||||
KEEP_ASPECT_RATIO,
|
||||
ASPECT_RATIO_CORRECTION,
|
||||
STRETCHED_FULL_SCREEN
|
||||
FIT_TO_SCREEN,
|
||||
STRETCH_TO_SCREEN
|
||||
};
|
||||
DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
|
||||
_imageViewer(0), _lastUpdateTime(0), _graphicsMode(0) {}
|
||||
|
@ -119,7 +118,7 @@ public:
|
|||
bool setGraphicsMode(int mode);
|
||||
bool setGraphicsMode(const char *name);
|
||||
int getGraphicsMode() const { return _graphicsMode; }
|
||||
uint32 getDefaultGraphicsMode() const { return KEEP_ASPECT_RATIO; }
|
||||
uint32 getDefaultGraphicsMode() const { return FIT_TO_SCREEN; }
|
||||
const OSystem::GraphicsMode* getSupportedGraphicsModes() const { return _supportedModes; }
|
||||
|
||||
// Setters for pointers
|
||||
|
|
|
@ -64,6 +64,9 @@ OSystem_PSP::~OSystem_PSP() {}
|
|||
void OSystem_PSP::initBackend() {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
ConfMan.registerDefault("aspect_ratio", false);
|
||||
ConfMan.registerDefault("gfx_mode", "Fit to Screen");
|
||||
|
||||
// Instantiate real time clock
|
||||
PspRtc::instance();
|
||||
|
||||
|
|
1
configure
vendored
1
configure
vendored
|
@ -3231,6 +3231,7 @@ if test -n "$_host"; then
|
|||
_port_mk="backends/platform/sdl/psp2/psp2.mk"
|
||||
;;
|
||||
psp)
|
||||
append_var DEFINES "-DGUI_ONLY_FULLSCREEN"
|
||||
_backend="psp"
|
||||
_build_scalers=no
|
||||
_mt32emu=no
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue