From a3bbe68d561c4d25706fac8aa01d583ce82895df Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Tue, 26 May 2015 10:52:00 +0200 Subject: [PATCH] gsdx: throw an exception when we miss a mandatory gl feature Gracefully quits when driver is not supported (like nvidia legacy driver for GTX260) Please test the impact on windows --- plugins/GSdx/GS.cpp | 17 +++++++++++++---- plugins/GSdx/GSWndWGL.cpp | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 4a5e15a761..e1ea6662b8 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -400,14 +400,23 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) } } } +#endif +#ifdef _WINDOWS + try + { + s_gs->m_wnd->Attach(*dsp, false); + } + catch (GSDXRecoverableError) + { + s_gs->m_wnd->Detach(); + delete s_gs->m_wnd; + s_gs->m_wnd = NULL; + } +#endif if (s_gs->m_wnd == NULL) { return -1; } -#endif -#ifdef _WINDOWS - s_gs->m_wnd->Attach(*dsp, false); -#endif } if(!s_gs->CreateDevice(dev)) diff --git a/plugins/GSdx/GSWndWGL.cpp b/plugins/GSdx/GSWndWGL.cpp index bd788d72c7..7b8e4880a7 100644 --- a/plugins/GSdx/GSWndWGL.cpp +++ b/plugins/GSdx/GSWndWGL.cpp @@ -275,6 +275,8 @@ void* GSWndWGL::GetProcAddress(const char* name, bool opt) void* ptr = (void*)wglGetProcAddress(name); if (ptr == NULL) { fprintf(stderr, "Failed to find %s\n", name); + if (!opt) + throw GSDXRecoverableError(); } return ptr; }