(WinRT) More compilation fixes

This commit is contained in:
twinaphex 2018-05-12 19:03:39 +02:00
parent 04a4578435
commit 542294900f
8 changed files with 88 additions and 89 deletions

View File

@ -47,7 +47,7 @@
#include "../../tasks/tasks_internal.h" #include "../../tasks/tasks_internal.h"
#include "../../core_info.h" #include "../../core_info.h"
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
#include <commdlg.h> #include <commdlg.h>
#include <dbt.h> #include <dbt.h>
@ -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 *QUERYDISPLAYCONFIG)(UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO_CUSTOM*, UINT32*, DISPLAYCONFIG_MODE_INFO_CUSTOM*, DISPLAYCONFIG_TOPOLOGY_ID_CUSTOM*);
typedef LONG (WINAPI *GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*); typedef LONG (WINAPI *GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*);
static bool g_resized = false; static bool g_win32_resized = false;
bool g_restore_desktop = false; bool g_win32_restore_desktop = false;
static bool doubleclick_on_titlebar = false; static bool doubleclick_on_titlebar = false;
static bool g_taskbar_is_created = false; static bool g_taskbar_is_created = false;
bool g_inited = false; bool g_win32_inited = false;
static bool g_quit = false; static bool g_win32_quit = false;
static int g_pos_x = CW_USEDEFAULT; static int g_win32_pos_x = CW_USEDEFAULT;
static int g_pos_y = CW_USEDEFAULT; static int g_win32_pos_y = CW_USEDEFAULT;
unsigned g_resize_width = 0; unsigned g_win32_resize_width = 0;
unsigned g_resize_height = 0; unsigned g_win32_resize_height = 0;
static unsigned g_taskbar_message = 0; static unsigned g_taskbar_message = 0;
static unsigned win32_monitor_count = 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); GetWindowPlacement(main_window.hwnd, &placement);
g_pos_x = placement.rcNormalPosition.left; g_win32_pos_x = placement.rcNormalPosition.left;
g_pos_y = placement.rcNormalPosition.top; g_win32_pos_y = placement.rcNormalPosition.top;
g_quit = true; g_win32_quit = true;
*quit = true; *quit = true;
} }
break; break;
case WM_SIZE: case WM_SIZE:
@ -741,9 +741,9 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message,
if ( wparam != SIZE_MAXHIDE && if ( wparam != SIZE_MAXHIDE &&
wparam != SIZE_MINIMIZED) wparam != SIZE_MINIMIZED)
{ {
g_resize_width = LOWORD(lparam); g_win32_resize_width = LOWORD(lparam);
g_resize_height = HIWORD(lparam); g_win32_resize_height = HIWORD(lparam);
g_resized = true; g_win32_resized = true;
} }
*quit = true; *quit = true;
break; break;
@ -797,7 +797,7 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message,
ui_window_win32_t win32_window; ui_window_win32_t win32_window;
LPCREATESTRUCT p_cs = (LPCREATESTRUCT)lparam; LPCREATESTRUCT p_cs = (LPCREATESTRUCT)lparam;
curD3D = p_cs->lpCreateParams; curD3D = p_cs->lpCreateParams;
g_inited = true; g_win32_inited = true;
win32_window.hwnd = hwnd; win32_window.hwnd = hwnd;
@ -858,7 +858,7 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message,
ui_window_win32_t win32_window; ui_window_win32_t win32_window;
win32_window.hwnd = hwnd; win32_window.hwnd = hwnd;
create_graphics_context(hwnd, &g_quit); create_graphics_context(hwnd, &g_win32_quit);
win32_set_droppable(&win32_window, true); win32_set_droppable(&win32_window, true);
} }
@ -956,7 +956,7 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
ui_window_win32_t win32_window; ui_window_win32_t win32_window;
win32_window.hwnd = hwnd; win32_window.hwnd = hwnd;
create_gdi_context(hwnd, &g_quit); create_gdi_context(hwnd, &g_win32_quit);
win32_set_droppable(&win32_window, true); win32_set_droppable(&win32_window, true);
} }
@ -988,8 +988,8 @@ bool win32_window_create(void *data, unsigned style,
main_window.hwnd = CreateWindowEx(0, main_window.hwnd = CreateWindowEx(0,
"RetroArch", "RetroArch", "RetroArch", "RetroArch",
style, style,
fullscreen ? mon_rect->left : g_pos_x, fullscreen ? mon_rect->left : g_win32_pos_x,
fullscreen ? mon_rect->top : g_pos_y, fullscreen ? mon_rect->top : g_win32_pos_y,
width, height, width, height,
NULL, NULL, NULL, data); NULL, NULL, NULL, data);
if (!main_window.hwnd) if (!main_window.hwnd)
@ -1035,7 +1035,7 @@ bool win32_window_create(void *data, unsigned style,
bool win32_get_metrics(void *data, bool win32_get_metrics(void *data,
enum display_metric_types type, float *value) enum display_metric_types type, float *value)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
HDC monitor = GetDC(NULL); HDC monitor = GetDC(NULL);
int pixels_x = GetDeviceCaps(monitor, HORZRES); int pixels_x = GetDeviceCaps(monitor, HORZRES);
int pixels_y = GetDeviceCaps(monitor, VERTRES); int pixels_y = GetDeviceCaps(monitor, VERTRES);
@ -1068,20 +1068,19 @@ bool win32_get_metrics(void *data,
void win32_monitor_init(void) void win32_monitor_init(void)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
win32_monitor_count = 0; win32_monitor_count = 0;
EnumDisplayMonitors(NULL, NULL, EnumDisplayMonitors(NULL, NULL,
win32_monitor_enum_proc, 0); win32_monitor_enum_proc, 0);
#endif #endif
g_win32_quit = false;
g_quit = false;
} }
static bool win32_monitor_set_fullscreen( static bool win32_monitor_set_fullscreen(
unsigned width, unsigned height, unsigned width, unsigned height,
unsigned refresh, char *dev_name) unsigned refresh, char *dev_name)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
DEVMODE devmode; DEVMODE devmode;
memset(&devmode, 0, sizeof(devmode)); memset(&devmode, 0, sizeof(devmode));
@ -1102,7 +1101,7 @@ static bool win32_monitor_set_fullscreen(
void win32_show_cursor(bool state) void win32_show_cursor(bool state)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
if (state) if (state)
while (ShowCursor(TRUE) < 0); while (ShowCursor(TRUE) < 0);
else else
@ -1113,26 +1112,26 @@ void win32_show_cursor(bool state)
void win32_check_window(bool *quit, bool *resize, void win32_check_window(bool *quit, bool *resize,
unsigned *width, unsigned *height) unsigned *width, unsigned *height)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
const ui_application_t *application = const ui_application_t *application =
ui_companion_driver_get_application_ptr(); ui_companion_driver_get_application_ptr();
if (application) if (application)
application->process_events(); application->process_events();
*quit = g_win32_quit;
#endif #endif
*quit = g_quit;
if (g_resized) if (g_win32_resized)
{ {
*resize = true; *resize = true;
*width = g_resize_width; *width = g_win32_resize_width;
*height = g_resize_height; *height = g_win32_resize_height;
g_resized = false; g_win32_resized = false;
} }
} }
bool win32_suppress_screensaver(void *data, bool enable) bool win32_suppress_screensaver(void *data, bool enable)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
if (enable) if (enable)
{ {
char tmp[PATH_MAX_LENGTH]; 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, unsigned *width, unsigned *height, bool fullscreen, bool windowed_full,
RECT *rect, RECT *mon_rect, DWORD *style) RECT *rect, RECT *mon_rect, DWORD *style)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
if (fullscreen) if (fullscreen)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -1217,9 +1216,9 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
if (windowed_full) if (windowed_full)
{ {
*style = WS_EX_TOPMOST | WS_POPUP; *style = WS_EX_TOPMOST | WS_POPUP;
g_resize_width = *width = mon_rect->right - mon_rect->left; g_win32_resize_width = *width = mon_rect->right - mon_rect->left;
g_resize_height = *height = mon_rect->bottom - mon_rect->top; g_win32_resize_height = *height = mon_rect->bottom - mon_rect->top;
} }
else else
{ {
@ -1241,8 +1240,8 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
AdjustWindowRect(rect, *style, FALSE); AdjustWindowRect(rect, *style, FALSE);
g_resize_width = *width = rect->right - rect->left; g_win32_resize_width = *width = rect->right - rect->left;
g_resize_height = *height = rect->bottom - rect->top; g_win32_resize_height = *height = rect->bottom - rect->top;
} }
#endif #endif
} }
@ -1250,7 +1249,7 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
void win32_set_window(unsigned *width, unsigned *height, void win32_set_window(unsigned *width, unsigned *height,
bool fullscreen, bool windowed_full, void *rect_data) bool fullscreen, bool windowed_full, void *rect_data)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
RECT *rect = (RECT*)rect_data; RECT *rect = (RECT*)rect_data;
if (!fullscreen || windowed_full) if (!fullscreen || windowed_full)
@ -1269,7 +1268,7 @@ void win32_set_window(unsigned *width, unsigned *height,
SetMenu(main_window.hwnd, SetMenu(main_window.hwnd,
LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MENU))); LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MENU)));
SendMessage(main_window.hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc_temp); 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); 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, unsigned width, unsigned height,
bool fullscreen) bool fullscreen)
{ {
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
DWORD style; DWORD style;
MSG msg; MSG msg;
RECT mon_rect; RECT mon_rect;
@ -1308,11 +1307,11 @@ bool win32_set_video_mode(void *data,
win32_monitor_info(&current_mon, &hm_to_use, &mon_id); win32_monitor_info(&current_mon, &hm_to_use, &mon_id);
mon_rect = current_mon.rcMonitor; mon_rect = current_mon.rcMonitor;
g_resize_width = width; g_win32_resize_width = width;
g_resize_height = height; g_win32_resize_height = height;
windowed_full = settings->bools.video_windowed_fullscreen; windowed_full = settings->bools.video_windowed_fullscreen;
win32_set_style(&current_mon, &hm_to_use, &width, &height, win32_set_style(&current_mon, &hm_to_use, &width, &height,
fullscreen, windowed_full, &rect, &mon_rect, &style); 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 ...). /* Wait until context is created (or failed to do so ...).
* Please don't remove the (res = ) as GetMessage can return -1. */ * 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) && (res = GetMessage(&msg, main_window.hwnd, 0, 0)) != 0)
{ {
if (res == -1) if (res == -1)
@ -1339,7 +1338,7 @@ bool win32_set_video_mode(void *data,
DispatchMessage(&msg); DispatchMessage(&msg);
} }
if (g_quit) if (g_win32_quit)
return false; return false;
#endif #endif
@ -1365,7 +1364,7 @@ BOOL IsIconic(HWND hwnd)
bool win32_has_focus(void) bool win32_has_focus(void)
{ {
if (g_inited) if (g_win32_inited)
{ {
#ifdef _XBOX #ifdef _XBOX
if (GetForegroundWindow() == main_window.hwnd) if (GetForegroundWindow() == main_window.hwnd)
@ -1392,8 +1391,8 @@ HWND win32_get_window(void)
void win32_window_reset(void) void win32_window_reset(void)
{ {
g_quit = false; g_win32_quit = false;
g_restore_desktop = false; g_win32_restore_desktop = false;
} }
void win32_destroy_window(void) void win32_destroy_window(void)

View File

@ -45,11 +45,11 @@
RETRO_BEGIN_DECLS RETRO_BEGIN_DECLS
#if !defined(_XBOX) && !defined(__WINRT__) #if !defined(_XBOX)
extern unsigned g_resize_width; extern unsigned g_win32_resize_width;
extern unsigned g_resize_height; extern unsigned g_win32_resize_height;
extern bool g_inited; extern bool g_win32_inited;
extern bool g_restore_desktop; extern bool g_win32_restore_desktop;
extern ui_window_win32_t main_window; extern ui_window_win32_t main_window;
void win32_monitor_get_info(void); void win32_monitor_get_info(void);

View File

@ -1208,9 +1208,9 @@ static bool d3d8_init_internal(d3d8_video_t *d3d,
#ifdef HAVE_MONITOR #ifdef HAVE_MONITOR
win32_monitor_info(&current_mon, &hm_to_use, &d3d->cur_mon_id); win32_monitor_info(&current_mon, &hm_to_use, &d3d->cur_mon_id);
mon_rect = current_mon.rcMonitor; mon_rect = current_mon.rcMonitor;
g_resize_width = info->width; g_win32_resize_width = info->width;
g_resize_height = info->height; g_win32_resize_height = info->height;
windowed_full = settings->bools.video_windowed_fullscreen; windowed_full = settings->bools.video_windowed_fullscreen;

View File

@ -1167,15 +1167,15 @@ static bool d3d9_init_internal(d3d9_video_t *d3d,
#ifdef HAVE_MONITOR #ifdef HAVE_MONITOR
win32_monitor_info(&current_mon, &hm_to_use, &d3d->cur_mon_id); win32_monitor_info(&current_mon, &hm_to_use, &d3d->cur_mon_id);
mon_rect = current_mon.rcMonitor; mon_rect = current_mon.rcMonitor;
g_resize_width = info->width; g_win32_resize_width = info->width;
g_resize_height = info->height; 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; (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; (mon_rect.bottom - mon_rect.top) : info->height;
RARCH_LOG("[D3D]: Monitor size: %dx%d.\n", RARCH_LOG("[D3D]: Monitor size: %dx%d.\n",

View File

@ -127,8 +127,8 @@ static void gfx_ctx_gdi_get_video_size(void *data,
} }
else else
{ {
*width = g_resize_width; *width = g_win32_resize_width;
*height = g_resize_height; *height = g_win32_resize_height;
} }
} }
@ -141,7 +141,7 @@ static void *gfx_ctx_gdi_init(
if (!gdi) if (!gdi)
return NULL; return NULL;
if (g_inited) if (g_win32_inited)
goto error; goto error;
win32_window_reset(); win32_window_reset();
@ -190,16 +190,16 @@ static void gfx_ctx_gdi_destroy(void *data)
win32_destroy_window(); win32_destroy_window();
} }
if (g_restore_desktop) if (g_win32_restore_desktop)
{ {
win32_monitor_get_info(); win32_monitor_get_info();
g_restore_desktop = false; g_win32_restore_desktop = false;
} }
if (gdi) if (gdi)
free(gdi); free(gdi);
g_inited = false; g_win32_inited = false;
win32_gdi_major = 0; win32_gdi_major = 0;
win32_gdi_minor = 0; win32_gdi_minor = 0;
} }
@ -341,7 +341,7 @@ void create_gdi_context(HWND hwnd, bool *quit)
setup_gdi_pixel_format(win32_gdi_hdc); setup_gdi_pixel_format(win32_gdi_hdc);
g_inited = true; g_win32_inited = true;
} }
const gfx_ctx_driver_t gfx_ctx_gdi = { const gfx_ctx_driver_t gfx_ctx_gdi = {

View File

@ -191,9 +191,9 @@ static void create_gl_context(HWND hwnd, bool *quit)
if (win32_hrc) if (win32_hrc)
{ {
if (wglMakeCurrent(win32_hdc, win32_hrc)) if (wglMakeCurrent(win32_hdc, win32_hrc))
g_inited = true; g_win32_inited = true;
else else
*quit = true; *quit = true;
} }
else else
{ {
@ -295,7 +295,7 @@ void create_graphics_context(HWND hwnd, bool *quit)
width, height, win32_interval)) width, height, win32_interval))
*quit = true; *quit = true;
g_inited = true; g_win32_inited = true;
#endif #endif
} }
break; break;
@ -458,8 +458,8 @@ static void gfx_ctx_wgl_get_video_size(void *data,
} }
else else
{ {
*width = g_resize_width; *width = g_win32_resize_width;
*height = g_resize_height; *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) if (!wgl)
return NULL; return NULL;
if (g_inited) if (g_win32_inited)
goto error; goto error;
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
@ -558,10 +558,10 @@ static void gfx_ctx_wgl_destroy(void *data)
win32_destroy_window(); win32_destroy_window();
} }
if (g_restore_desktop) if (g_win32_restore_desktop)
{ {
win32_monitor_get_info(); win32_monitor_get_info();
g_restore_desktop = false; g_win32_restore_desktop = false;
} }
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
@ -572,7 +572,7 @@ static void gfx_ctx_wgl_destroy(void *data)
free(wgl); free(wgl);
win32_core_hw_context_enable = false; win32_core_hw_context_enable = false;
g_inited = false; g_win32_inited = false;
win32_major = 0; win32_major = 0;
win32_minor = 0; win32_minor = 0;
p_swap_interval = NULL; p_swap_interval = NULL;

View File

@ -824,7 +824,7 @@ void font_driver_render_msg(
#ifdef HAVE_LANGEXTRA #ifdef HAVE_LANGEXTRA
char *new_msg = font_driver_reshape_msg(msg); char *new_msg = font_driver_reshape_msg(msg);
#else #else
char *new_msg = msg; char *new_msg = (char*)msg;
#endif #endif
font->renderer->render_msg(video_info, font->renderer->render_msg(video_info,

View File

@ -170,7 +170,7 @@ CHEATS
/*============================================================ /*============================================================
UI COMMON CONTEXT UI COMMON CONTEXT
============================================================ */ ============================================================ */
#if defined(_WIN32) && !defined(_XBOX) #if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
#include "../gfx/common/win32_common.c" #include "../gfx/common/win32_common.c"
#endif #endif
@ -179,7 +179,7 @@ VIDEO CONTEXT
============================================================ */ ============================================================ */
#include "../gfx/drivers_context/gfx_null_ctx.c" #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) #if defined(HAVE_OPENGL) || defined(HAVE_VULKAN)
#include "../gfx/drivers_context/wgl_ctx.c" #include "../gfx/drivers_context/wgl_ctx.c"
@ -439,7 +439,7 @@ VIDEO DRIVER
#endif #endif
#include "../gfx/drivers/nullgfx.c" #include "../gfx/drivers/nullgfx.c"
#if defined(_WIN32) && !defined(_XBOX) #if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
#include "../gfx/drivers/gdi_gfx.c" #include "../gfx/drivers/gdi_gfx.c"
#endif #endif
@ -501,7 +501,7 @@ FONTS
#include "../gfx/drivers_font/vga_font.c" #include "../gfx/drivers_font/vga_font.c"
#endif #endif
#if defined(_WIN32) && !defined(_XBOX) #if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
#include "../gfx/drivers_font/gdi_font.c" #include "../gfx/drivers_font/gdi_font.c"
#endif #endif
@ -539,7 +539,7 @@ INPUT
#include "../input/common/x11_input_common.c" #include "../input/common/x11_input_common.c"
#endif #endif
#if defined(_WIN32) && !defined(_XBOX) && _WIN32_WINNT >= 0x0501 #if defined(_WIN32) && !defined(_XBOX) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__)
/* winraw only available since XP */ /* winraw only available since XP */
#include "../input/drivers/winraw_input.c" #include "../input/drivers/winraw_input.c"
#endif #endif