diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 35f962aa1..5e5d792f4 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -131,7 +131,7 @@ EXPORT_C_(int) GSinit() return -1; } -#else +#endif if(!SDL_WasInit(SDL_INIT_VIDEO)) { @@ -141,8 +141,6 @@ EXPORT_C_(int) GSinit() } } -#endif - return 0; } @@ -154,6 +152,8 @@ EXPORT_C GSshutdown() s_renderer = -1; + SDL_Quit(); + #ifdef _WINDOWS if(SUCCEEDED(s_hr)) @@ -163,10 +163,6 @@ EXPORT_C GSshutdown() s_hr = E_FAIL; } -#else - - SDL_Quit(); - #endif } diff --git a/plugins/GSdx/GSDevice11.cpp b/plugins/GSdx/GSDevice11.cpp index c8b5c2a0b..9c9e7866f 100644 --- a/plugins/GSdx/GSDevice11.cpp +++ b/plugins/GSdx/GSDevice11.cpp @@ -278,7 +278,7 @@ bool GSDevice11::Create(GSWnd* wnd) if(m_wnd->IsManaged()) { - SetExclusive(!!theApp.GetConfig("windowed", 1)); + SetExclusive(!theApp.GetConfig("windowed", 1)); } return true; diff --git a/plugins/GSdx/GSDeviceSDL.cpp b/plugins/GSdx/GSDeviceSDL.cpp index 4e5f2404d..9adf76e58 100644 --- a/plugins/GSdx/GSDeviceSDL.cpp +++ b/plugins/GSdx/GSDeviceSDL.cpp @@ -23,7 +23,7 @@ #include "GSDeviceSDL.h" GSDeviceSDL::GSDeviceSDL() - : m_init(false) + : m_free_window(false) , m_window(NULL) , m_renderer(NULL) , m_texture(NULL) @@ -42,21 +42,25 @@ GSDeviceSDL::~GSDeviceSDL() SDL_DestroyRenderer(m_renderer); } - if(m_window != NULL) + if(m_window != NULL && m_free_window) { SDL_DestroyWindow(m_window); } - - if(m_init) - { - SDL_Quit(); - } } bool GSDeviceSDL::Create(GSWnd* wnd) { m_window = (SDL_Window*)wnd->GetHandle(); + if(m_window == wnd->GetDisplay()) + { + // HACK: no SDL window + + m_window = SDL_CreateWindowFrom(wnd->GetHandle()); + + m_free_window = true; + } + return GSDeviceSW::Create(wnd); } diff --git a/plugins/GSdx/GSDeviceSDL.h b/plugins/GSdx/GSDeviceSDL.h index 336319e40..324d41c2c 100644 --- a/plugins/GSdx/GSDeviceSDL.h +++ b/plugins/GSdx/GSDeviceSDL.h @@ -26,8 +26,7 @@ class GSDeviceSDL : public GSDeviceSW { - bool m_init; - + bool m_free_window; SDL_Window* m_window; SDL_Renderer* m_renderer; SDL_Texture* m_texture;