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.
This commit is contained in:
parent
45891aed91
commit
a3d2c52687
2 changed files with 23 additions and 9 deletions
|
@ -55,7 +55,8 @@ uint32 __attribute__((aligned(16))) MasterGuRenderer::_displayList[2048];
|
||||||
const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
|
const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
|
||||||
{ "Original Resolution", "Original Resolution", ORIGINAL_RESOLUTION },
|
{ "Original Resolution", "Original Resolution", ORIGINAL_RESOLUTION },
|
||||||
{ "Keep Aspect Ratio", "Keep Aspect Ratio", KEEP_ASPECT_RATIO },
|
{ "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}
|
{0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -358,24 +359,36 @@ void DisplayManager::calculateScaleParams() {
|
||||||
switch (_graphicsMode) {
|
switch (_graphicsMode) {
|
||||||
case ORIGINAL_RESOLUTION:
|
case ORIGINAL_RESOLUTION:
|
||||||
// check if we can fit the original resolution inside the screen
|
// check if we can fit the original resolution inside the screen
|
||||||
if ((_displayParams.screenSource.width < PSP_SCREEN_WIDTH) &&
|
if ((_displayParams.screenSource.width <= PSP_SCREEN_WIDTH) &&
|
||||||
(_displayParams.screenSource.height < PSP_SCREEN_HEIGHT)) {
|
(_displayParams.screenSource.height <= PSP_SCREEN_HEIGHT)) {
|
||||||
_displayParams.screenOutput.width = _displayParams.screenSource.width;
|
_displayParams.screenOutput.width = _displayParams.screenSource.width;
|
||||||
_displayParams.screenOutput.height = _displayParams.screenSource.height;
|
_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
|
case KEEP_ASPECT_RATIO: { // maximize the height while keeping aspect ratio
|
||||||
float aspectRatio = (float)_displayParams.screenSource.width / (float)_displayParams.screenSource.height;
|
float aspectRatio = (float)_displayParams.screenSource.width / (float)_displayParams.screenSource.height;
|
||||||
|
|
||||||
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height
|
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height
|
||||||
_displayParams.screenOutput.width = (uint32)(PSP_SCREEN_HEIGHT * aspectRatio);
|
_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;
|
_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;
|
break;
|
||||||
case STRETCHED_FULL_SCREEN: // we simply stretch to the whole screen
|
case STRETCHED_FULL_SCREEN: // we simply stretch to the whole screen
|
||||||
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
|
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
|
||||||
|
|
|
@ -106,6 +106,7 @@ public:
|
||||||
enum GraphicsModeID { ///> Possible output formats onscreen
|
enum GraphicsModeID { ///> Possible output formats onscreen
|
||||||
ORIGINAL_RESOLUTION,
|
ORIGINAL_RESOLUTION,
|
||||||
KEEP_ASPECT_RATIO,
|
KEEP_ASPECT_RATIO,
|
||||||
|
ASPECT_RATIO_CORRECTION,
|
||||||
STRETCHED_FULL_SCREEN
|
STRETCHED_FULL_SCREEN
|
||||||
};
|
};
|
||||||
DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
|
DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
|
||||||
|
@ -118,7 +119,7 @@ public:
|
||||||
bool setGraphicsMode(int mode);
|
bool setGraphicsMode(int mode);
|
||||||
bool setGraphicsMode(const char *name);
|
bool setGraphicsMode(const char *name);
|
||||||
int getGraphicsMode() const { return _graphicsMode; }
|
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; }
|
const OSystem::GraphicsMode* getSupportedGraphicsModes() const { return _supportedModes; }
|
||||||
|
|
||||||
// Setters for pointers
|
// Setters for pointers
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue