mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Added the StretchToFit option to the config menu in the OpenGL plugin. This fixes the blackness in SSBM. I also added a keep aspect ratio option, it will keep your aspect ratio at 4:3, but then SSBM will have the blackness problem again. You find the options under the Enhancements window in the OpenGL configuration.
I also added a wx debugging window for the OpenGL plugin. I connected it to the old console window that was in the plugin. Other than that it doesn't do anything at the moment but it could be useful to show all the current important information and parameter statuses and so on. Again there's a problem with wx windows collisions. Show() can't be used because then DLL_PROCESS_DETACH is called immediately after the window is opened, and if we open it with ShowModal() before we have loaded a game the main video window will be blocked. And we can't pass on any variables from a DllDebugger() that is called when Dolphin is started because the dll is reloaded and lose all variables sometime before a game is loaded. So we can't auto open the window that way. So I made the debugging window open as a game is loaded if it is enabled in the ini, the downside is that the ini setting will open the window even if we are not opening Dolphin with the -d flag. However, this will only affect people that have used the debugger at least once so in my opinion this is the most convenient solution. But feel free to come up with a better solution. Preferably some solution to how to use Show() and preventing DLL_PROCESS_DETACH to be called. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@812 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -34,9 +34,14 @@
|
||||
// Handles OpenGL and the window
|
||||
|
||||
|
||||
// screen offset
|
||||
int nBackbufferWidth, nBackbufferHeight;
|
||||
int nXoff, nYoff;
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// externals
|
||||
// -------------
|
||||
int gleft, gright, gtop, gbottom;
|
||||
int nBackbufferWidth, nBackbufferHeight; // screen width
|
||||
int nXoff, nYoff; // screen offset
|
||||
float AR; // aspect ratio
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
GLWindow GLWin;
|
||||
@ -112,6 +117,9 @@ void UpdateFPSDisplay(const char *text)
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Create window. Called from main.cpp
|
||||
// ----------------
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
|
||||
{
|
||||
int _twidth, _theight;
|
||||
@ -143,30 +151,42 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
EmuWindow::SetSize(_twidth, _theight);
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Control window size and picture scaling
|
||||
// ------------------
|
||||
// nBackbufferWidth and nBackbufferHeight = Screen resolution from ini, or 640x480
|
||||
// See OpenGL_Update() for documentation of the other variables
|
||||
// ------------------
|
||||
nBackbufferWidth = _twidth;
|
||||
nBackbufferHeight = _theight;
|
||||
|
||||
float FactorW = 640.0f / (float)nBackbufferWidth;
|
||||
float FactorH = 480.0f / (float)nBackbufferHeight;
|
||||
float FactorW = 640.0f / (float)nBackbufferWidth;
|
||||
float FactorH = 480.0f / (float)nBackbufferHeight;
|
||||
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
||||
|
||||
if(g_Config.bStretchToFit)
|
||||
{
|
||||
MValueX = 1.0f / FactorW;
|
||||
MValueY = 1.0f / FactorH;
|
||||
nXoff = 0;
|
||||
nYoff = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MValueX = 1.0f / Max;
|
||||
MValueY = 1.0f / Max;
|
||||
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
||||
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
||||
}
|
||||
|
||||
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
||||
if(g_Config.bStretchToFit)
|
||||
{
|
||||
MValueX = 1.0f / FactorW;
|
||||
MValueY = 1.0f / FactorH;
|
||||
nXoff = 0;
|
||||
nYoff = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MValueX = 1.0f / Max;
|
||||
MValueY = 1.0f / Max;
|
||||
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
||||
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
||||
}
|
||||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
|
||||
|
||||
//char buff[100];
|
||||
//sprintf(buff, "%i %i %d %d %d", nBackbufferWidth, nBackbufferHeight, Max, MValueX, MValueY);
|
||||
//MessageBox(0, buff, "", 0);
|
||||
|
||||
|
||||
#if USE_SDL
|
||||
//init sdl video
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
@ -482,6 +502,10 @@ bool OpenGL_MakeCurrent()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Update window width, size and etc. Called from Render.cpp
|
||||
// ----------------
|
||||
void OpenGL_Update()
|
||||
{
|
||||
#if USE_SDL
|
||||
@ -495,6 +519,11 @@ void OpenGL_Update()
|
||||
RECT rcWindow;
|
||||
GetWindowRect(EmuWindow::GetParentWnd(), &rcWindow);
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Get the new window width and height
|
||||
// ------------------
|
||||
// See below for documentation
|
||||
// ------------------
|
||||
int width = rcWindow.right - rcWindow.left;
|
||||
int height = rcWindow.bottom - rcWindow.top;
|
||||
|
||||
@ -567,15 +596,28 @@ void OpenGL_Update()
|
||||
return;
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Get the new window width and height
|
||||
// ------------------
|
||||
// nBackbufferWidth and nBackbufferHeight = now the actual screen size
|
||||
// Max = the highest of w and h
|
||||
// MValueX and MValueY = used for the picture resolution-change rescaling
|
||||
// nXoff and nYoff = controls the picture's position inside the Dolphin window
|
||||
// ------------------
|
||||
/* MValueX and MValueY will be used in
|
||||
TextureMngr and VertexShaderManager: Rescale textures on resolution changes
|
||||
BPStructs.cpp: Control glScissor()
|
||||
*/
|
||||
// ------------------
|
||||
float FactorW = 640.0f / (float)nBackbufferWidth;
|
||||
float FactorH = 480.0f / (float)nBackbufferHeight;
|
||||
|
||||
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
||||
AR = (float)nBackbufferWidth / (float)nBackbufferHeight;
|
||||
|
||||
if(g_Config.bStretchToFit)
|
||||
{
|
||||
MValueX = 1.0f / FactorW;
|
||||
MValueY = 1.0f / FactorH;
|
||||
MValueX = 1;
|
||||
MValueY = 1;
|
||||
nXoff = 0;
|
||||
nYoff = 0;
|
||||
}
|
||||
@ -586,9 +628,17 @@ void OpenGL_Update()
|
||||
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
||||
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
||||
}
|
||||
|
||||
// tell the debugger
|
||||
gleft = rcWindow.left; gright = rcWindow.right;
|
||||
gtop = rcWindow.top; gbottom = rcWindow.bottom;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Close plugin
|
||||
// ----------------
|
||||
void OpenGL_Shutdown()
|
||||
{
|
||||
#if USE_SDL
|
||||
|
Reference in New Issue
Block a user