Add option to stretch to display (turns off the black bars fixing the aspect ratio).

This commit is contained in:
Henrik Rydgard 2013-02-13 18:21:21 +01:00
parent 3faeeea2f9
commit 36f49706e0
8 changed files with 32 additions and 2 deletions

View File

@ -75,6 +75,7 @@ void CConfig::Load(const char *iniFileName)
graphics->Get("DisableG3DLog", &bDisableG3DLog, false);
graphics->Get("VertexCache", &bVertexCache, true);
graphics->Get("FullScreen", &bFullScreen, false);
graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Get("Enable", &bEnableSound, true);
@ -132,6 +133,7 @@ void CConfig::Save()
graphics->Set("DisableG3DLog", bDisableG3DLog);
graphics->Set("VertexCache", bVertexCache);
graphics->Set("FullScreen", bFullScreen);
graphics->Set("StretchToDisplay", bStretchToDisplay);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Set("Enable", bEnableSound);

View File

@ -57,6 +57,8 @@ public:
bool bDrawWireframe;
bool bLinearFiltering;
bool bUseVBO;
bool bStretchToDisplay;
int iWindowZoom; // for Windows
bool SSAntiAliasing; //for Windows, too
bool bDisableG3DLog;

View File

@ -67,6 +67,15 @@ static bool MaskedEqual(u32 addr1, u32 addr2) {
static void CenterRect(float *x, float *y, float *w, float *h,
float origW, float origH, float frameW, float frameH)
{
if (g_Config.bStretchToDisplay)
{
*x = 0;
*y = 0;
*w = frameW;
*h = frameH;
return;
}
float origRatio = origW/origH;
float frameRatio = frameW/frameH;
@ -398,6 +407,10 @@ void FramebufferManager::CopyDisplayToOutput() {
fbo_bind_color_as_texture(vfb->fbo, 0);
if (resized_) {
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
// These are in the output display coordinates
float x, y, w, h;
CenterRect(&x, &y, &w, &h, 480.0f, 272.0f, (float)PSP_CoreParameter().pixelWidth, (float)PSP_CoreParameter().pixelHeight);

View File

@ -249,7 +249,7 @@ void LinkedShader::updateUniforms() {
SetColorUniform3(u_texenv, gstate.texenvcolor);
}
if (u_alphacolorref != -1 && (dirtyUniforms & DIRTY_ALPHACOLORREF)) {
SetColorUniform3Alpha(u_alphacolorref, gstate.colortest, (gstate.alphatest >> 8) & 0xFF);
SetColorUniform3Alpha(u_alphacolorref, gstate.colorref, (gstate.alphatest >> 8) & 0xFF);
}
if (u_fogcolor != -1 && (dirtyUniforms & DIRTY_FOGCOLOR)) {
SetColorUniform3(u_fogcolor, gstate.fogcolor);

View File

@ -441,6 +441,12 @@ namespace MainWindow
UpdateMenus();
break;
case ID_OPTIONS_STRETCHDISPLAY:
g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay;
UpdateMenus();
gpu->Resized(); // easy way to force a clear...
break;
case ID_FILE_EXIT:
DestroyWindow(hWnd);
break;
@ -705,6 +711,7 @@ namespace MainWindow
CHECKITEM(ID_OPTIONS_FASTMEMORY, g_Config.bFastMemory);
CHECKITEM(ID_OPTIONS_LINEARFILTERING, g_Config.bLinearFiltering);
CHECKITEM(ID_OPTIONS_SIMPLE2XSSAA, g_Config.SSAntiAliasing);
CHECKITEM(ID_OPTIONS_STRETCHDISPLAY, g_Config.bStretchToDisplay);
CHECKITEM(ID_EMULATION_RUNONLOAD, g_Config.bAutoRun);
CHECKITEM(ID_OPTIONS_USEVBO, g_Config.bUseVBO);
CHECKITEM(ID_OPTIONS_DISABLEG3DLOG, g_Config.bDisableG3DLog);

View File

@ -253,6 +253,7 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "&Toggle Full Screen\tF12", ID_OPTIONS_FULLSCREEN
MENUITEM "&Buffered Rendering\tF5", ID_OPTIONS_BUFFEREDRENDERING
MENUITEM "&Stretch to display", ID_OPTIONS_STRETCHDISPLAY
MENUITEM "&Hardware Transform\tF6", ID_OPTIONS_HARDWARETRANSFORM
MENUITEM "&Linear Filtering", ID_OPTIONS_LINEARFILTERING
MENUITEM "Si&mple 2x SSAA", ID_OPTIONS_SIMPLE2XSSAA

View File

@ -259,6 +259,7 @@
#define ID_OPTIONS_DISABLEG3DLOG 40135
#define ID_OPTIONS_VERTEXCACHE 40136
#define ID_OPTIONS_SHOWFPS 40137
#define ID_OPTIONS_STRETCHDISPLAY 40138
#define IDC_STATIC -1
// Next default values for new objects
@ -266,7 +267,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 233
#define _APS_NEXT_COMMAND_VALUE 40138
#define _APS_NEXT_COMMAND_VALUE 40139
#define _APS_NEXT_CONTROL_VALUE 1163
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -246,6 +246,10 @@ void InGameMenuScreen::render() {
int y = 50;
UICheckBox(GEN_ID, x, y += 50, "Show Debug Statistics", ALIGN_TOPLEFT, &g_Config.bShowDebugStats);
UICheckBox(GEN_ID, x, y += 50, "Show FPS", ALIGN_TOPLEFT, &g_Config.bShowFPSCounter);
// TODO: Maybe shouldn't show this if the screen ratios are very close...
UICheckBox(GEN_ID, x, y += 50, "Stretch to display", ALIGN_TOPLEFT, &g_Config.bStretchToDisplay);
UICheckBox(GEN_ID, x, y += 50, "Hardware Transform", ALIGN_TOPLEFT, &g_Config.bHardwareTransform);
// TODO: Add UI for more than one slot.