diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 163e1cf061..d8e8ffecb4 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -47,7 +47,7 @@ #include "../../tasks/tasks_internal.h" #include "../../core_info.h" -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) #include #include @@ -262,18 +262,18 @@ typedef struct DISPLAYCONFIG_PATH_INFO_CUSTOM { typedef LONG (WINAPI *QUERYDISPLAYCONFIG)(UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO_CUSTOM*, UINT32*, DISPLAYCONFIG_MODE_INFO_CUSTOM*, DISPLAYCONFIG_TOPOLOGY_ID_CUSTOM*); typedef LONG (WINAPI *GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*); -static bool g_resized = false; -bool g_restore_desktop = false; +static bool g_win32_resized = false; +bool g_win32_restore_desktop = false; static bool doubleclick_on_titlebar = false; static bool g_taskbar_is_created = false; -bool g_inited = false; -static bool g_quit = false; +bool g_win32_inited = false; +static bool g_win32_quit = false; -static int g_pos_x = CW_USEDEFAULT; -static int g_pos_y = CW_USEDEFAULT; +static int g_win32_pos_x = CW_USEDEFAULT; +static int g_win32_pos_y = CW_USEDEFAULT; -unsigned g_resize_width = 0; -unsigned g_resize_height = 0; +unsigned g_win32_resize_width = 0; +unsigned g_win32_resize_height = 0; static unsigned g_taskbar_message = 0; static unsigned win32_monitor_count = 0; @@ -730,10 +730,10 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, GetWindowPlacement(main_window.hwnd, &placement); - g_pos_x = placement.rcNormalPosition.left; - g_pos_y = placement.rcNormalPosition.top; - g_quit = true; - *quit = true; + g_win32_pos_x = placement.rcNormalPosition.left; + g_win32_pos_y = placement.rcNormalPosition.top; + g_win32_quit = true; + *quit = true; } break; case WM_SIZE: @@ -741,9 +741,9 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, if ( wparam != SIZE_MAXHIDE && wparam != SIZE_MINIMIZED) { - g_resize_width = LOWORD(lparam); - g_resize_height = HIWORD(lparam); - g_resized = true; + g_win32_resize_width = LOWORD(lparam); + g_win32_resize_height = HIWORD(lparam); + g_win32_resized = true; } *quit = true; break; @@ -797,7 +797,7 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, ui_window_win32_t win32_window; LPCREATESTRUCT p_cs = (LPCREATESTRUCT)lparam; curD3D = p_cs->lpCreateParams; - g_inited = true; + g_win32_inited = true; win32_window.hwnd = hwnd; @@ -858,7 +858,7 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, ui_window_win32_t win32_window; win32_window.hwnd = hwnd; - create_graphics_context(hwnd, &g_quit); + create_graphics_context(hwnd, &g_win32_quit); win32_set_droppable(&win32_window, true); } @@ -956,7 +956,7 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, ui_window_win32_t win32_window; win32_window.hwnd = hwnd; - create_gdi_context(hwnd, &g_quit); + create_gdi_context(hwnd, &g_win32_quit); win32_set_droppable(&win32_window, true); } @@ -988,8 +988,8 @@ bool win32_window_create(void *data, unsigned style, main_window.hwnd = CreateWindowEx(0, "RetroArch", "RetroArch", style, - fullscreen ? mon_rect->left : g_pos_x, - fullscreen ? mon_rect->top : g_pos_y, + fullscreen ? mon_rect->left : g_win32_pos_x, + fullscreen ? mon_rect->top : g_win32_pos_y, width, height, NULL, NULL, NULL, data); if (!main_window.hwnd) @@ -1035,7 +1035,7 @@ bool win32_window_create(void *data, unsigned style, bool win32_get_metrics(void *data, enum display_metric_types type, float *value) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) HDC monitor = GetDC(NULL); int pixels_x = GetDeviceCaps(monitor, HORZRES); int pixels_y = GetDeviceCaps(monitor, VERTRES); @@ -1068,20 +1068,19 @@ bool win32_get_metrics(void *data, void win32_monitor_init(void) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) win32_monitor_count = 0; EnumDisplayMonitors(NULL, NULL, win32_monitor_enum_proc, 0); #endif - - g_quit = false; + g_win32_quit = false; } static bool win32_monitor_set_fullscreen( unsigned width, unsigned height, unsigned refresh, char *dev_name) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) DEVMODE devmode; memset(&devmode, 0, sizeof(devmode)); @@ -1102,7 +1101,7 @@ static bool win32_monitor_set_fullscreen( void win32_show_cursor(bool state) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) if (state) while (ShowCursor(TRUE) < 0); else @@ -1113,26 +1112,26 @@ void win32_show_cursor(bool state) void win32_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) const ui_application_t *application = ui_companion_driver_get_application_ptr(); if (application) application->process_events(); + *quit = g_win32_quit; #endif - *quit = g_quit; - if (g_resized) + if (g_win32_resized) { - *resize = true; - *width = g_resize_width; - *height = g_resize_height; - g_resized = false; + *resize = true; + *width = g_win32_resize_width; + *height = g_win32_resize_height; + g_win32_resized = false; } } bool win32_suppress_screensaver(void *data, bool enable) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) if (enable) { char tmp[PATH_MAX_LENGTH]; @@ -1203,7 +1202,7 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, RECT *rect, RECT *mon_rect, DWORD *style) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) if (fullscreen) { settings_t *settings = config_get_ptr(); @@ -1217,9 +1216,9 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, if (windowed_full) { - *style = WS_EX_TOPMOST | WS_POPUP; - g_resize_width = *width = mon_rect->right - mon_rect->left; - g_resize_height = *height = mon_rect->bottom - mon_rect->top; + *style = WS_EX_TOPMOST | WS_POPUP; + g_win32_resize_width = *width = mon_rect->right - mon_rect->left; + g_win32_resize_height = *height = mon_rect->bottom - mon_rect->top; } else { @@ -1241,8 +1240,8 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, AdjustWindowRect(rect, *style, FALSE); - g_resize_width = *width = rect->right - rect->left; - g_resize_height = *height = rect->bottom - rect->top; + g_win32_resize_width = *width = rect->right - rect->left; + g_win32_resize_height = *height = rect->bottom - rect->top; } #endif } @@ -1250,7 +1249,7 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, void win32_set_window(unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, void *rect_data) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) RECT *rect = (RECT*)rect_data; if (!fullscreen || windowed_full) @@ -1269,7 +1268,7 @@ void win32_set_window(unsigned *width, unsigned *height, SetMenu(main_window.hwnd, LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MENU))); SendMessage(main_window.hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc_temp); - g_resize_height = *height += rc_temp.top + rect->top; + g_win32_resize_height = *height += rc_temp.top + rect->top; SetWindowPos(main_window.hwnd, NULL, 0, 0, *width, *height, SWP_NOMOVE); } @@ -1289,7 +1288,7 @@ bool win32_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { -#if !defined(_XBOX) && !defined(__WINRT__) +#if !defined(_XBOX) DWORD style; MSG msg; RECT mon_rect; @@ -1308,11 +1307,11 @@ bool win32_set_video_mode(void *data, win32_monitor_info(¤t_mon, &hm_to_use, &mon_id); - mon_rect = current_mon.rcMonitor; - g_resize_width = width; - g_resize_height = height; + mon_rect = current_mon.rcMonitor; + g_win32_resize_width = width; + g_win32_resize_height = height; - windowed_full = settings->bools.video_windowed_fullscreen; + windowed_full = settings->bools.video_windowed_fullscreen; win32_set_style(¤t_mon, &hm_to_use, &width, &height, fullscreen, windowed_full, &rect, &mon_rect, &style); @@ -1326,7 +1325,7 @@ bool win32_set_video_mode(void *data, /* Wait until context is created (or failed to do so ...). * Please don't remove the (res = ) as GetMessage can return -1. */ - while (!g_inited && !g_quit + while (!g_win32_inited && !g_win32_quit && (res = GetMessage(&msg, main_window.hwnd, 0, 0)) != 0) { if (res == -1) @@ -1339,7 +1338,7 @@ bool win32_set_video_mode(void *data, DispatchMessage(&msg); } - if (g_quit) + if (g_win32_quit) return false; #endif @@ -1365,7 +1364,7 @@ BOOL IsIconic(HWND hwnd) bool win32_has_focus(void) { - if (g_inited) + if (g_win32_inited) { #ifdef _XBOX if (GetForegroundWindow() == main_window.hwnd) @@ -1392,8 +1391,8 @@ HWND win32_get_window(void) void win32_window_reset(void) { - g_quit = false; - g_restore_desktop = false; + g_win32_quit = false; + g_win32_restore_desktop = false; } void win32_destroy_window(void) diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index 30bf14669a..82d682be9f 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -45,11 +45,11 @@ RETRO_BEGIN_DECLS -#if !defined(_XBOX) && !defined(__WINRT__) -extern unsigned g_resize_width; -extern unsigned g_resize_height; -extern bool g_inited; -extern bool g_restore_desktop; +#if !defined(_XBOX) +extern unsigned g_win32_resize_width; +extern unsigned g_win32_resize_height; +extern bool g_win32_inited; +extern bool g_win32_restore_desktop; extern ui_window_win32_t main_window; void win32_monitor_get_info(void); diff --git a/gfx/drivers/d3d8.c b/gfx/drivers/d3d8.c index 50e8f1537a..da30e422c1 100644 --- a/gfx/drivers/d3d8.c +++ b/gfx/drivers/d3d8.c @@ -1208,9 +1208,9 @@ static bool d3d8_init_internal(d3d8_video_t *d3d, #ifdef HAVE_MONITOR win32_monitor_info(¤t_mon, &hm_to_use, &d3d->cur_mon_id); - mon_rect = current_mon.rcMonitor; - g_resize_width = info->width; - g_resize_height = info->height; + mon_rect = current_mon.rcMonitor; + g_win32_resize_width = info->width; + g_win32_resize_height = info->height; windowed_full = settings->bools.video_windowed_fullscreen; diff --git a/gfx/drivers/d3d9.c b/gfx/drivers/d3d9.c index a65fc54eef..1239c0c874 100644 --- a/gfx/drivers/d3d9.c +++ b/gfx/drivers/d3d9.c @@ -1167,15 +1167,15 @@ static bool d3d9_init_internal(d3d9_video_t *d3d, #ifdef HAVE_MONITOR win32_monitor_info(¤t_mon, &hm_to_use, &d3d->cur_mon_id); - mon_rect = current_mon.rcMonitor; - g_resize_width = info->width; - g_resize_height = info->height; + mon_rect = current_mon.rcMonitor; + g_win32_resize_width = info->width; + g_win32_resize_height = info->height; - windowed_full = settings->bools.video_windowed_fullscreen; + windowed_full = settings->bools.video_windowed_fullscreen; - full_x = (windowed_full || info->width == 0) ? + full_x = (windowed_full || info->width == 0) ? (mon_rect.right - mon_rect.left) : info->width; - full_y = (windowed_full || info->height == 0) ? + full_y = (windowed_full || info->height == 0) ? (mon_rect.bottom - mon_rect.top) : info->height; RARCH_LOG("[D3D]: Monitor size: %dx%d.\n", diff --git a/gfx/drivers_context/gdi_ctx.c b/gfx/drivers_context/gdi_ctx.c index d251d75cb9..84349f0da1 100644 --- a/gfx/drivers_context/gdi_ctx.c +++ b/gfx/drivers_context/gdi_ctx.c @@ -127,8 +127,8 @@ static void gfx_ctx_gdi_get_video_size(void *data, } else { - *width = g_resize_width; - *height = g_resize_height; + *width = g_win32_resize_width; + *height = g_win32_resize_height; } } @@ -141,7 +141,7 @@ static void *gfx_ctx_gdi_init( if (!gdi) return NULL; - if (g_inited) + if (g_win32_inited) goto error; win32_window_reset(); @@ -190,16 +190,16 @@ static void gfx_ctx_gdi_destroy(void *data) win32_destroy_window(); } - if (g_restore_desktop) + if (g_win32_restore_desktop) { win32_monitor_get_info(); - g_restore_desktop = false; + g_win32_restore_desktop = false; } if (gdi) free(gdi); - g_inited = false; + g_win32_inited = false; win32_gdi_major = 0; win32_gdi_minor = 0; } @@ -341,7 +341,7 @@ void create_gdi_context(HWND hwnd, bool *quit) setup_gdi_pixel_format(win32_gdi_hdc); - g_inited = true; + g_win32_inited = true; } const gfx_ctx_driver_t gfx_ctx_gdi = { diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c index 47c5ad5a55..d35387999b 100644 --- a/gfx/drivers_context/wgl_ctx.c +++ b/gfx/drivers_context/wgl_ctx.c @@ -191,9 +191,9 @@ static void create_gl_context(HWND hwnd, bool *quit) if (win32_hrc) { if (wglMakeCurrent(win32_hdc, win32_hrc)) - g_inited = true; + g_win32_inited = true; else - *quit = true; + *quit = true; } else { @@ -295,7 +295,7 @@ void create_graphics_context(HWND hwnd, bool *quit) width, height, win32_interval)) *quit = true; - g_inited = true; + g_win32_inited = true; #endif } break; @@ -458,8 +458,8 @@ static void gfx_ctx_wgl_get_video_size(void *data, } else { - *width = g_resize_width; - *height = g_resize_height; + *width = g_win32_resize_width; + *height = g_win32_resize_height; } } @@ -471,7 +471,7 @@ static void *gfx_ctx_wgl_init(video_frame_info_t *video_info, void *video_driver if (!wgl) return NULL; - if (g_inited) + if (g_win32_inited) goto error; #ifdef HAVE_DYNAMIC @@ -558,10 +558,10 @@ static void gfx_ctx_wgl_destroy(void *data) win32_destroy_window(); } - if (g_restore_desktop) + if (g_win32_restore_desktop) { win32_monitor_get_info(); - g_restore_desktop = false; + g_win32_restore_desktop = false; } #ifdef HAVE_DYNAMIC @@ -572,7 +572,7 @@ static void gfx_ctx_wgl_destroy(void *data) free(wgl); win32_core_hw_context_enable = false; - g_inited = false; + g_win32_inited = false; win32_major = 0; win32_minor = 0; p_swap_interval = NULL; diff --git a/gfx/font_driver.c b/gfx/font_driver.c index 28080b80a5..e385c8f678 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -824,7 +824,7 @@ void font_driver_render_msg( #ifdef HAVE_LANGEXTRA char *new_msg = font_driver_reshape_msg(msg); #else - char *new_msg = msg; + char *new_msg = (char*)msg; #endif font->renderer->render_msg(video_info, diff --git a/griffin/griffin.c b/griffin/griffin.c index 8f73ea6e0c..c28156f020 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -170,7 +170,7 @@ CHEATS /*============================================================ UI COMMON CONTEXT ============================================================ */ -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) #include "../gfx/common/win32_common.c" #endif @@ -179,7 +179,7 @@ VIDEO CONTEXT ============================================================ */ #include "../gfx/drivers_context/gfx_null_ctx.c" -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) #if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) #include "../gfx/drivers_context/wgl_ctx.c" @@ -439,7 +439,7 @@ VIDEO DRIVER #endif #include "../gfx/drivers/nullgfx.c" -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) #include "../gfx/drivers/gdi_gfx.c" #endif @@ -501,7 +501,7 @@ FONTS #include "../gfx/drivers_font/vga_font.c" #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) #include "../gfx/drivers_font/gdi_font.c" #endif @@ -539,7 +539,7 @@ INPUT #include "../input/common/x11_input_common.c" #endif -#if defined(_WIN32) && !defined(_XBOX) && _WIN32_WINNT >= 0x0501 +#if defined(_WIN32) && !defined(_XBOX) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__) /* winraw only available since XP */ #include "../input/drivers/winraw_input.c" #endif