Unbreak the D3D plugin in case of bad/old resolution settings in the .ini file.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4275 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-09-15 18:00:16 +00:00
parent 1619433ae7
commit adbfea0a09
1 changed files with 10 additions and 5 deletions

View File

@ -88,10 +88,12 @@ void TeardownDeviceObjects()
bool Renderer::Init() bool Renderer::Init()
{ {
UpdateActiveConfig(); UpdateActiveConfig();
int fullScreenRes, int fullScreenRes, w_temp, h_temp;
w_temp,
h_temp;
sscanf(g_Config.cInternalRes, "%dx%d", &w_temp, &h_temp); sscanf(g_Config.cInternalRes, "%dx%d", &w_temp, &h_temp);
if (w_temp <= 0 || h_temp <= 0) {
w_temp = 640;
h_temp = 480;
}
EmuWindow::SetSize(w_temp, h_temp); EmuWindow::SetSize(w_temp, h_temp);
int backbuffer_ms_mode = 0; // g_ActiveConfig.iMultisampleMode; int backbuffer_ms_mode = 0; // g_ActiveConfig.iMultisampleMode;
@ -316,8 +318,11 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
RECT rcWindow; RECT rcWindow;
GetClientRect(EmuWindow::GetWnd(), &rcWindow); GetClientRect(EmuWindow::GetWnd(), &rcWindow);
if (rcWindow.right - rcWindow.left != s_backbuffer_width || int client_width = rcWindow.right - rcWindow.left;
rcWindow.bottom - rcWindow.top != s_backbuffer_height) int client_height = rcWindow.bottom - rcWindow.top;
if ((client_width != s_backbuffer_width ||
client_height != s_backbuffer_height) &&
client_width >= 4 && client_height >= 4)
{ {
TeardownDeviceObjects(); TeardownDeviceObjects();