From adbfea0a09ce6689d5c4592f5fcb1629b1589650 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Tue, 15 Sep 2009 18:00:16 +0000 Subject: [PATCH] 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 --- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index ac887f2593..da65ae36a3 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -88,10 +88,12 @@ void TeardownDeviceObjects() bool Renderer::Init() { UpdateActiveConfig(); - int fullScreenRes, - w_temp, - h_temp; + int fullScreenRes, 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); 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; GetClientRect(EmuWindow::GetWnd(), &rcWindow); - if (rcWindow.right - rcWindow.left != s_backbuffer_width || - rcWindow.bottom - rcWindow.top != s_backbuffer_height) + int client_width = rcWindow.right - rcWindow.left; + 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();