From 9528738a094097d97ceebf08822b0de286d5ad9d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 17 Nov 2015 10:12:23 +0100 Subject: [PATCH] Set g_quit outside of wgl_ctx.cpp --- gfx/common/win32_common.cpp | 5 ++++- gfx/common/win32_common.h | 2 +- gfx/drivers_context/wgl_ctx.cpp | 17 ++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index 658d18e9e4..2846a963b1 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -192,7 +192,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, case WM_CREATE: if (!strcmp(video_driver, "gl")) - create_gl_context(hwnd); + { + if (create_gl_context(hwnd)) + g_quit = true; + } else if (!strcmp(video_driver, "d3d")) { LPCREATESTRUCT p_cs = (LPCREATESTRUCT)lparam; diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index 2da2530c29..806daedb40 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -49,7 +49,7 @@ void win32_monitor_get_info(void); void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id); -void create_gl_context(HWND hwnd); +bool create_gl_context(HWND hwnd); #endif void win32_monitor_init(void); diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index b8f0c5c712..b85743b9d7 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -100,8 +100,9 @@ static void setup_pixel_format(HDC hdc) SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd); } -void create_gl_context(HWND hwnd) +bool create_gl_context(HWND hwnd) { + bool quit; bool core_context; const struct retro_hw_render_callback *hw_render = (const struct retro_hw_render_callback*)video_driver_callback(); @@ -138,11 +139,11 @@ void create_gl_context(HWND hwnd) if (!wglShareLists(g_hrc, g_hw_hrc)) { RARCH_LOG("[WGL]: Failed to share contexts.\n"); - g_quit = true; + quit = true; } } else - g_quit = true; + quit = true; } } @@ -151,11 +152,11 @@ void create_gl_context(HWND hwnd) if (wglMakeCurrent(g_hdc, g_hrc)) g_inited = true; else - g_quit = true; + quit = true; } else { - g_quit = true; + quit = true; return; } @@ -204,7 +205,7 @@ void create_gl_context(HWND hwnd) wglDeleteContext(g_hrc); g_hrc = context; if (!wglMakeCurrent(g_hdc, g_hrc)) - g_quit = true; + quit = true; } else RARCH_ERR("[WGL]: Failed to create core context. Falling back to legacy context.\n"); @@ -215,13 +216,15 @@ void create_gl_context(HWND hwnd) if (!g_hw_hrc) { RARCH_ERR("[WGL]: Failed to create shared context.\n"); - g_quit = true; + quit = true; } } } else RARCH_ERR("[WGL]: wglCreateContextAttribsARB not supported.\n"); } + + return quit; } void *dinput_wgl;