diff --git a/AUTHORS.h b/AUTHORS.h index a94c292b12..4863d9b0fb 100644 --- a/AUTHORS.h +++ b/AUTHORS.h @@ -142,6 +142,7 @@ JuanVCS Justin Jacobs (dorkster) Justin Weiss (justinweiss) Ken Rossato (rossato) +Krzysztof Haładyn (krzys_h) kurumushi kwyxz l3iggs diff --git a/configuration.c b/configuration.c index 871a7cc7b6..7ab65f20d9 100644 --- a/configuration.c +++ b/configuration.c @@ -56,6 +56,10 @@ #include "record/record_driver.h" +#ifdef __WINRT__ +#include "uwp/uwp_func.h" +#endif + static const char* invalid_filename_chars[] = { /* https://support.microsoft.com/en-us/help/905231/information-about-the-characters-that-you-cannot-use-in-site-names--fo */ "~", "#", "%", "&", "*", "{", "}", "\\", ":", "[", "]", "?", "/", "|", "\'", "\"", @@ -319,6 +323,12 @@ static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_WII; static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_WIIU; #elif defined(XENON) static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_XENON360; +#elif defined(HAVE_D3D12) +static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D12; +#elif defined(HAVE_D3D11) +static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D11; +#elif defined(HAVE_D3D10) +static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D10; #elif defined(HAVE_D3D9) static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D9; #elif defined(HAVE_D3D8) @@ -2221,8 +2231,13 @@ static config_file_t *open_default_config_file(void) (void)path_size; -#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) - fill_pathname_application_path(app_path, path_size); +#if defined(_WIN32) && !defined(_XBOX) +#ifdef __WINRT__ + /* On UWP, the app install directory is not writable so use the writable LocalState dir instead */ + fill_pathname_home_dir(app_path, path_size); +#else + fill_pathname_application_dir(app_path, path_size); +#endif fill_pathname_resolve_relative(conf_path, app_path, file_path_str(FILE_PATH_MAIN_CONFIG), path_size); diff --git a/dynamic.c b/dynamic.c index 049aad7883..89bcc8f1c7 100644 --- a/dynamic.c +++ b/dynamic.c @@ -306,6 +306,7 @@ static void libretro_get_environment_info(void (*func)(retro_environment_t), static bool load_dynamic_core(void) { +#ifndef __WINRT__ /* Can't lookup symbols in itself on UWP */ function_t sym = dylib_proc(NULL, "retro_init"); if (sym) @@ -319,6 +320,7 @@ static bool load_dynamic_core(void) RARCH_ERR("Proceeding could cause a crash. Aborting ...\n"); retroarch_fail(1, "init_libretro_sym()"); } +#endif if (string_is_empty(path_get(RARCH_PATH_CORE))) { diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 59905c9884..c655a594c5 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -43,6 +43,11 @@ #include "../../verbosity.h" #include "../../ui/drivers/ui_win32.h" +#ifdef __WINRT__ +#include "../../uwp/uwp_func.h" +#endif + +#ifndef __WINRT__ /* We only load this library once, so we let it be * unloaded at application shutdown, since unloading * it early seems to cause issues on some systems. @@ -145,6 +150,7 @@ static void gfx_set_dwm(void) RARCH_ERR("Failed to set composition state ...\n"); dwm_composition_disabled = settings->bools.video_disable_composition; } +#endif static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor) { @@ -165,7 +171,9 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor) GetVersionEx((OSVERSIONINFO*)&vi); server = vi.wProductType != VER_NT_WORKSTATION; +#ifndef __WINRT__ serverR2 = GetSystemMetrics(SM_SERVERR2); +#endif switch (si.wProcessorArchitecture) { @@ -302,10 +310,19 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor) strlcat(s, " ", len); strlcat(s, vi.szCSDVersion, len); } + +#ifdef __WINRT__ + if (!string_is_empty(uwp_device_family)) + { + strlcat(s, " ", len); + strlcat(s, uwp_device_family, len); + } +#endif } static void frontend_win32_init(void *data) { +#ifndef __WINRT__ typedef BOOL (WINAPI *isProcessDPIAwareProc)(); typedef BOOL (WINAPI *setProcessDPIAwareProc)(); #ifdef HAVE_DYNAMIC @@ -324,6 +341,7 @@ static void frontend_win32_init(void *data) if (!isDPIAwareProc()) if (setDPIAwareProc) setDPIAwareProc(); +#endif } enum frontend_powerstate frontend_win32_get_powerstate(int *seconds, int *percent) @@ -385,13 +403,14 @@ enum frontend_architecture frontend_win32_get_architecture(void) static int frontend_win32_parse_drive_list(void *data, bool load_content) { #ifdef HAVE_MENU + file_list_t *list = (file_list_t*)data; + enum msg_hash_enums enum_idx = load_content ? + MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : + MSG_UNKNOWN; +#ifndef __WINRT__ size_t i = 0; unsigned drives = GetLogicalDrives(); char drive[] = " :\\"; - file_list_t *list = (file_list_t*)data; - enum msg_hash_enums enum_idx = load_content ? - MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : - MSG_UNKNOWN; for (i = 0; i < 32; i++) { @@ -403,6 +422,22 @@ static int frontend_win32_parse_drive_list(void *data, bool load_content) enum_idx, FILE_TYPE_DIRECTORY, 0, 0); } +#else + /* TODO (krzys_h): UWP storage sandboxing */ + + char *home_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + + fill_pathname_home_dir(home_dir, + PATH_MAX_LENGTH * sizeof(char)); + + menu_entries_append_enum(list, + home_dir, + msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), + enum_idx, + FILE_TYPE_DIRECTORY, 0, 0); + + free(home_dir); +#endif #endif return 0; @@ -411,6 +446,7 @@ static int frontend_win32_parse_drive_list(void *data, bool load_content) static void frontend_win32_environment_get(int *argc, char *argv[], void *args, void *params_data) { +#ifndef __WINRT__ gfx_set_dwm(); fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_ASSETS], @@ -459,6 +495,57 @@ static void frontend_win32_environment_get(int *argc, char *argv[], ":\\states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE])); fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SYSTEM], ":\\system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM])); +#else + /* On UWP, we have to use the writable directory instead of the install directory */ + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_ASSETS], + "~\\assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], + "~\\filters\\audio", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], + "~\\filters\\video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CHEATS], + "~\\cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_DATABASE], + "~\\database\\rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CURSOR], + "~\\database\\cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], + "~\\playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG], + "~\\config\\record", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT], + "~\\recordings", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], + "~\\config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_REMAP], + "~\\config\\remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS], + "~\\assets\\wallpapers", sizeof(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], + "~\\thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OVERLAY], + "~\\overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + /* This one is an exception: cores have to be loaded from the install directory, + * since this is the only place UWP apps can take .dlls from */ + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE], + ":\\cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], + "~\\info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], + "~\\autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SHADER], + "~\\shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], + "~\\downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], + "~\\screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SRAM], + "~\\saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], + "~\\states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SYSTEM], + "~\\system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM])); +#endif #ifdef HAVE_MENU #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) @@ -502,6 +589,7 @@ static uint64_t frontend_win32_get_mem_used(void) #endif } +#ifndef __WINRT__ static void frontend_win32_attach_console(void) { #ifdef _WIN32 @@ -560,6 +648,7 @@ static void frontend_win32_detach_console(void) #endif #endif } +#endif frontend_ctx_driver_t frontend_ctx_win32 = { frontend_win32_environment_get, @@ -583,8 +672,13 @@ frontend_ctx_driver_t frontend_ctx_win32 = { NULL, /* get_sighandler_state */ NULL, /* set_sighandler_state */ NULL, /* destroy_sighandler_state */ +#ifndef __WINRT__ frontend_win32_attach_console, /* attach_console */ frontend_win32_detach_console, /* detach_console */ +#else + NULL, + NULL, +#endif NULL, /* watch_path_for_changes */ NULL, /* check_for_path_changes */ NULL, /* set_sustained_performance_mode */ diff --git a/gfx/common/d3d10_common.c b/gfx/common/d3d10_common.c index 1b145015f7..16a35b9c57 100644 --- a/gfx/common/d3d10_common.c +++ b/gfx/common/d3d10_common.c @@ -20,7 +20,7 @@ #include "d3d10_common.h" #include "d3dcompiler_common.h" -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) #include typedef HRESULT(WINAPI* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN)( diff --git a/gfx/common/d3d11_common.c b/gfx/common/d3d11_common.c index 16b32151e1..dbb3b53c42 100644 --- a/gfx/common/d3d11_common.c +++ b/gfx/common/d3d11_common.c @@ -20,7 +20,7 @@ #include "d3d11_common.h" #include "d3dcompiler_common.h" -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) #include HRESULT WINAPI D3D11CreateDeviceAndSwapChain( diff --git a/gfx/common/d3d11_common.h b/gfx/common/d3d11_common.h index 69128cd07a..db6254e8c1 100644 --- a/gfx/common/d3d11_common.h +++ b/gfx/common/d3d11_common.h @@ -2159,6 +2159,7 @@ static INLINE HRESULT D3D11ValidateContextForDispatch(D3D11Debug debug, D3D11Dev { return debug->lpVtbl->ValidateContextForDispatch(debug, context); } +#ifndef __WINRT__ static INLINE BOOL D3D11SetUseRef(D3D11SwitchToRef switch_to_ref, BOOL use_ref) { return switch_to_ref->lpVtbl->SetUseRef(switch_to_ref, use_ref); @@ -2167,6 +2168,7 @@ static INLINE BOOL D3D11GetUseRef(D3D11SwitchToRef switch_to_ref) { return switch_to_ref->lpVtbl->GetUseRef(switch_to_ref); } +#endif static INLINE HRESULT D3D11SetShaderTrackingOptionsByType( D3D11TracingDevice tracing_device, UINT resource_type_flags, UINT options) { @@ -2188,6 +2190,7 @@ static INLINE void D3D11ClearStoredMessages(D3D11InfoQueue info_queue) { info_queue->lpVtbl->ClearStoredMessages(info_queue); } +#ifndef __WINRT__ static INLINE HRESULT D3D11GetMessageA( D3D11InfoQueue info_queue, UINT64 message_index, @@ -2196,6 +2199,7 @@ static INLINE HRESULT D3D11GetMessageA( { return info_queue->lpVtbl->GetMessageA(info_queue, message_index, message, message_byte_length); } +#endif static INLINE UINT64 D3D11GetNumMessagesAllowedByStorageFilter(D3D11InfoQueue info_queue) { return info_queue->lpVtbl->GetNumMessagesAllowedByStorageFilter(info_queue); diff --git a/gfx/common/d3d12_common.c b/gfx/common/d3d12_common.c index 1b8d9478c5..a405dc5e46 100644 --- a/gfx/common/d3d12_common.c +++ b/gfx/common/d3d12_common.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2018 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -65,7 +65,7 @@ DEFINE_GUIDW(IID_ID3D12DebugCommandList, 0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, /* clang-format on */ #endif -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) static dylib_t d3d12_dll; static const char* d3d12_dll_name = "d3d12.dll"; diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index c026c3c9f2..211e68939c 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -125,3 +125,28 @@ int32_t d3d_translate_filter(unsigned type) return (int32_t)D3D_TEXTURE_FILTER_POINT; } + +void d3d_input_driver(const char* input_name, const char* joypad_name, const input_driver_t** input, void** input_data) +{ +#if defined(_XBOX) || defined(__WINRT__) + void *xinput = input_xinput.init(joypad_name); + *input = xinput ? (const input_driver_t*)&input_xinput : NULL; + *input_data = xinput; +#else +#if _WIN32_WINNT >= 0x0501 + /* winraw only available since XP */ + if (string_is_equal(input_name, "raw")) + { + *input_data = input_winraw.init(joypad_name); + if (*input_data) + { + *input = &input_winraw; + return; + } + } +#endif + + *input_data = input_dinput.init(joypad_name); + *input = *input_data ? &input_dinput : NULL; +#endif +} diff --git a/gfx/common/d3d_common.h b/gfx/common/d3d_common.h index 69c9ae6526..14a724a3e7 100644 --- a/gfx/common/d3d_common.h +++ b/gfx/common/d3d_common.h @@ -20,7 +20,7 @@ #include "../../config.h" #endif -#ifndef _XBOX +#if !defined(_XBOX) && !defined(__WINRT__) #define HAVE_WINDOW #endif @@ -97,6 +97,8 @@ void *d3d_matrix_rotation_z(void *_pout, float angle); int32_t d3d_translate_filter(unsigned type); +void d3d_input_driver(const char* input_name, const char* joypad_name, const input_driver_t** input, void** input_data); + RETRO_END_DECLS #endif diff --git a/gfx/common/d3dcompiler_common.c b/gfx/common/d3dcompiler_common.c index 6da87c1ba4..22d17704a3 100644 --- a/gfx/common/d3dcompiler_common.c +++ b/gfx/common/d3dcompiler_common.c @@ -25,7 +25,7 @@ #include "d3dcompiler_common.h" #include "../../verbosity.h" -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) #include static dylib_t d3dcompiler_dll; diff --git a/gfx/common/dxgi_common.c b/gfx/common/dxgi_common.c index 3d935f41d2..86f4a7b987 100644 --- a/gfx/common/dxgi_common.c +++ b/gfx/common/dxgi_common.c @@ -30,7 +30,7 @@ #include "../video_driver.h" #include "win32_common.h" -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) #include HRESULT WINAPI CreateDXGIFactory1(REFIID riid, void** ppFactory) @@ -309,6 +309,7 @@ void dxgi_update_title(video_frame_info_t* video_info) if (settings->bools.video_memory_show) { +#ifndef __WINRT__ MEMORYSTATUS stat; char mem[128]; @@ -319,6 +320,7 @@ void dxgi_update_title(video_frame_info_t* video_info) mem, sizeof(mem), " || MEM: %.2f/%.2fMB", stat.dwAvailPhys / (1024.0f * 1024.0f), stat.dwTotalPhys / (1024.0f * 1024.0f)); strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text)); +#endif } if (window) @@ -329,32 +331,11 @@ void dxgi_update_title(video_frame_info_t* video_info) video_driver_get_window_title(title, sizeof(title)); +#ifndef __WINRT__ if (title[0]) window->set_title(&main_window, title); - } -} - -void dxgi_input_driver(const char* name, const input_driver_t** input, void** input_data) -{ -#ifndef __WINRT__ - settings_t* settings = config_get_ptr(); - -#if _WIN32_WINNT >= 0x0501 - /* winraw only available since XP */ - if (string_is_equal(settings->arrays.input_driver, "raw")) - { - *input_data = input_winraw.init(name); - if (*input_data) - { - *input = &input_winraw; - return; - } - } -#endif - - *input_data = input_dinput.init(name); - *input = *input_data ? &input_dinput : NULL; #endif + } } DXGI_FORMAT glslang_format_to_dxgi(glslang_format fmt) diff --git a/gfx/common/dxgi_common.h b/gfx/common/dxgi_common.h index 0323b5d839..0e5e15e88f 100644 --- a/gfx/common/dxgi_common.h +++ b/gfx/common/dxgi_common.h @@ -444,6 +444,7 @@ static INLINE HRESULT DXGIGetAdapterDesc1(DXGIAdapter adapter, DXGI_ADAPTER_DESC { return adapter->lpVtbl->GetDesc1(adapter, desc); } +#ifndef __WINRT__ static INLINE ULONG DXGIReleaseDisplayControl(DXGIDisplayControl display_control) { return display_control->lpVtbl->Release(display_control); @@ -612,6 +613,7 @@ static INLINE HRESULT DXGICheckPresentDurationSupport( swap_chain_media, desired_present_duration, closest_smaller_present_duration, closest_larger_present_duration); } +#endif static INLINE ULONG DXGIReleaseSwapChain(DXGISwapChain swap_chain) { return swap_chain->lpVtbl->Release(swap_chain); @@ -793,7 +795,6 @@ void dxgi_copy( void* dst_data); void dxgi_update_title(video_frame_info_t* video_info); -void dxgi_input_driver(const char* name, const input_driver_t** input, void** input_data); DXGI_FORMAT glslang_format_to_dxgi(glslang_format fmt); diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index b123cda661..69a38a61a8 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2018 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -35,6 +35,10 @@ #include "../../menu/menu_driver.h" #endif +#ifdef __WINRT__ +#error "UWP does not support D3D10" +#endif + #ifdef HAVE_OVERLAY static void d3d10_free_overlays(d3d10_video_t* d3d10) { @@ -556,8 +560,12 @@ static void d3d10_gfx_free(void* data) Release(d3d10->device); } +#ifdef HAVE_MONITOR win32_monitor_from_window(); +#endif +#ifdef HAVE_WINDOW win32_destroy_window(); +#endif free(d3d10); } @@ -566,31 +574,39 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { unsigned i; +#ifdef HAVE_MONITOR MONITORINFOEX current_mon; HMONITOR hm_to_use; WNDCLASSEX wndclass = { 0 }; +#endif settings_t* settings = config_get_ptr(); d3d10_video_t* d3d10 = (d3d10_video_t*)calloc(1, sizeof(*d3d10)); if (!d3d10) return NULL; +#ifdef HAVE_WINDOW win32_window_reset(); win32_monitor_init(); wndclass.lpfnWndProc = WndProcD3D; win32_window_init(&wndclass, true, NULL); +#endif +#ifdef HAVE_MONITOR win32_monitor_info(¤t_mon, &hm_to_use, &d3d10->cur_mon_id); +#endif d3d10->vp.full_width = video->width; d3d10->vp.full_height = video->height; +#ifdef HAVE_MONITOR if (!d3d10->vp.full_width) d3d10->vp.full_width = current_mon.rcMonitor.right - current_mon.rcMonitor.left; if (!d3d10->vp.full_height) d3d10->vp.full_height = current_mon.rcMonitor.bottom - current_mon.rcMonitor.top; +#endif if (!win32_set_video_mode(d3d10, d3d10->vp.full_width, d3d10->vp.full_height, video->fullscreen)) @@ -598,7 +614,7 @@ d3d10_gfx_init(const video_info_t* video, RARCH_ERR("[D3D10]: win32_set_video_mode failed.\n"); goto error; } - dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); + d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data); { UINT flags = 0; @@ -611,7 +627,9 @@ d3d10_gfx_init(const video_info_t* video, desc.BufferDesc.RefreshRate.Numerator = 60; desc.BufferDesc.RefreshRate.Denominator = 1; desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; +#if HAVE_WINDOW desc.OutputWindow = main_window.hwnd; +#endif desc.SampleDesc.Count = 1; desc.SampleDesc.Quality = 0; desc.Windowed = TRUE; @@ -1598,7 +1616,12 @@ static const video_poke_interface_t d3d10_poke_interface = { d3d10_gfx_load_texture, d3d10_gfx_unload_texture, NULL, /* set_video_mode */ +#ifndef __WINRT__ win32_get_refresh_rate, +#else + /* UWP does not expose this information easily */ + NULL, +#endif d3d10_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 137ad02525..8e0293be3e 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2018 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -41,6 +41,10 @@ #include "../drivers_shader/slang_process.h" #endif +#ifdef __WINRT__ +#include "../../uwp/uwp_func.h" +#endif + static D3D11Device cached_device_d3d11; static D3D_FEATURE_LEVEL cached_supportedFeatureLevel; static D3D11DeviceContext cached_context; @@ -566,8 +570,12 @@ static void d3d11_gfx_free(void* data) Release(d3d11->device); } +#ifdef HAVE_MONITOR win32_monitor_from_window(); +#endif +#ifdef HAVE_WINDOW win32_destroy_window(); +#endif free(d3d11); } @@ -575,29 +583,37 @@ static void d3d11_gfx_free(void* data) d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { unsigned i; +#ifdef HAVE_MONITOR MONITORINFOEX current_mon; HMONITOR hm_to_use; WNDCLASSEX wndclass = { 0 }; +#endif settings_t* settings = config_get_ptr(); d3d11_video_t* d3d11 = (d3d11_video_t*)calloc(1, sizeof(*d3d11)); if (!d3d11) return NULL; +#ifdef HAVE_WINDOW win32_window_reset(); win32_monitor_init(); wndclass.lpfnWndProc = WndProcD3D; win32_window_init(&wndclass, true, NULL); +#endif +#ifdef HAVE_MONITOR win32_monitor_info(¤t_mon, &hm_to_use, &d3d11->cur_mon_id); +#endif d3d11->vp.full_width = video->width; d3d11->vp.full_height = video->height; +#ifdef HAVE_MONITOR if (!d3d11->vp.full_width) d3d11->vp.full_width = current_mon.rcMonitor.right - current_mon.rcMonitor.left; if (!d3d11->vp.full_height) d3d11->vp.full_height = current_mon.rcMonitor.bottom - current_mon.rcMonitor.top; +#endif if (!win32_set_video_mode(d3d11, d3d11->vp.full_width, d3d11->vp.full_height, video->fullscreen)) { @@ -605,7 +621,7 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i goto error; } - dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); + d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data); { UINT flags = 0; @@ -617,26 +633,45 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3 }; +#ifdef __WINRT__ + /* UWP requires the use of newer version of the factory which requires newer version of this struct */ + DXGI_SWAP_CHAIN_DESC1 desc = { 0 }; +#else DXGI_SWAP_CHAIN_DESC desc = { 0 }; +#endif UINT number_feature_levels = ARRAY_SIZE(requested_feature_levels); - desc.BufferCount = 1; +#ifdef __WINRT__ + /* UWP forces us to do double-buffering */ + desc.BufferCount = 2; + desc.Width = d3d11->vp.full_width; + desc.Height = d3d11->vp.full_height; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; +#else + desc.BufferCount = 1; desc.BufferDesc.Width = d3d11->vp.full_width; desc.BufferDesc.Height = d3d11->vp.full_height; desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; desc.BufferDesc.RefreshRate.Numerator = 60; desc.BufferDesc.RefreshRate.Denominator = 1; +#endif desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; +#if HAVE_WINDOW desc.OutputWindow = main_window.hwnd; +#endif desc.SampleDesc.Count = 1; desc.SampleDesc.Quality = 0; #if 0 desc.Scaling = DXGI_SCALING_STRETCH; #endif +#if HAVE_WINDOW desc.Windowed = TRUE; +#endif #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) /* On phone, no swap effects are supported. */ desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; +#elif defined(__WINRT__) + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; #else desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; #endif @@ -646,37 +681,47 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i #endif if(cached_device_d3d11 && cached_context) { - IDXGIFactory* dxgiFactory = NULL; - IDXGIDevice* dxgiDevice = NULL; - IDXGIAdapter* adapter = NULL; - d3d11->device = cached_device_d3d11; d3d11->context = cached_context; d3d11->supportedFeatureLevel = cached_supportedFeatureLevel; - - d3d11->device->lpVtbl->QueryInterface( - d3d11->device, uuidof(IDXGIDevice), (void**)&dxgiDevice); - dxgiDevice->lpVtbl->GetAdapter(dxgiDevice, &adapter); - adapter->lpVtbl->GetParent( - adapter, uuidof(IDXGIFactory1), (void**)&dxgiFactory); - dxgiFactory->lpVtbl->CreateSwapChain( - dxgiFactory, (IUnknown*)d3d11->device, - &desc, (IDXGISwapChain**)&d3d11->swapChain); - - dxgiFactory->lpVtbl->Release(dxgiFactory); - adapter->lpVtbl->Release(adapter); - dxgiDevice->lpVtbl->Release(dxgiDevice); } else { - if (FAILED(D3D11CreateDeviceAndSwapChain( + if (FAILED(D3D11CreateDevice( NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, requested_feature_levels, number_feature_levels, - D3D11_SDK_VERSION, &desc, - (IDXGISwapChain**)&d3d11->swapChain, &d3d11->device, + D3D11_SDK_VERSION, &d3d11->device, &d3d11->supportedFeatureLevel, &d3d11->context))) goto error; } + + IDXGIDevice* dxgiDevice = NULL; + IDXGIAdapter* adapter = NULL; + + d3d11->device->lpVtbl->QueryInterface( + d3d11->device, uuidof(IDXGIDevice), (void**)&dxgiDevice); + dxgiDevice->lpVtbl->GetAdapter(dxgiDevice, &adapter); +#ifndef __WINRT__ + IDXGIFactory* dxgiFactory = NULL; + adapter->lpVtbl->GetParent( + adapter, uuidof(IDXGIFactory1), (void**)&dxgiFactory); + if (FAILED(dxgiFactory->lpVtbl->CreateSwapChain( + dxgiFactory, (IUnknown*)d3d11->device, + &desc, (IDXGISwapChain**)&d3d11->swapChain))) + goto error; +#else + IDXGIFactory2* dxgiFactory = NULL; + adapter->lpVtbl->GetParent( + adapter, uuidof(IDXGIFactory2), (void**)&dxgiFactory); + if (FAILED(dxgiFactory->lpVtbl->CreateSwapChainForCoreWindow( + dxgiFactory, (IUnknown*)d3d11->device, uwp_get_corewindow(), + &desc, NULL, (IDXGISwapChain1**)&d3d11->swapChain))) + goto error; +#endif + + dxgiFactory->lpVtbl->Release(dxgiFactory); + adapter->lpVtbl->Release(adapter); + dxgiDevice->lpVtbl->Release(dxgiDevice); } { @@ -1142,6 +1187,11 @@ static bool d3d11_gfx_frame( video_driver_set_size(&video_info->width, &video_info->height); } +#ifdef __WINRT__ + /* UWP requires double-buffering, so make sure we bind to the appropariate backbuffer */ + D3D11SetRenderTargets(context, 1, &d3d11->renderTargetView, NULL); +#endif + PERF_START(); #if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */ @@ -1622,7 +1672,12 @@ static const video_poke_interface_t d3d11_poke_interface = { d3d11_gfx_load_texture, d3d11_gfx_unload_texture, NULL, /* set_video_mode */ +#ifndef __WINRT__ win32_get_refresh_rate, +#else + /* UWP does not expose this information easily */ + NULL, +#endif d3d11_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index c4dab9fcc3..c89797c5db 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2018 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -35,6 +35,10 @@ #include "wiiu/wiiu_dbg.h" +#ifdef __WINRT__ +#error "TODO (krzys_h): DX12 could be doable on UWP?" +#endif + static void d3d12_gfx_sync(d3d12_video_t* d3d12) { if (D3D12GetCompletedValue(d3d12->queue.fence) < d3d12->queue.fenceValue) @@ -864,8 +868,12 @@ static void d3d12_gfx_free(void* data) Release(d3d12->device); Release(d3d12->adapter); +#ifdef HAVE_MONITOR win32_monitor_from_window(); +#endif +#ifdef HAVE_WINDOW win32_destroy_window(); +#endif free(d3d12); } @@ -882,20 +890,26 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i if (!d3d12) return NULL; +#ifdef HAVE_WINDOW win32_window_reset(); win32_monitor_init(); wndclass.lpfnWndProc = WndProcD3D; win32_window_init(&wndclass, true, NULL); +#endif +#ifdef HAVE_MONITOR win32_monitor_info(¤t_mon, &hm_to_use, &d3d12->cur_mon_id); +#endif d3d12->vp.full_width = video->width; d3d12->vp.full_height = video->height; +#ifdef HAVE_MONITOR if (!d3d12->vp.full_width) d3d12->vp.full_width = current_mon.rcMonitor.right - current_mon.rcMonitor.left; if (!d3d12->vp.full_height) d3d12->vp.full_height = current_mon.rcMonitor.bottom - current_mon.rcMonitor.top; +#endif if (!win32_set_video_mode(d3d12, d3d12->vp.full_width, d3d12->vp.full_height, video->fullscreen)) { @@ -903,7 +917,7 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i goto error; } - dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); + d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data); if (!d3d12_init_base(d3d12)) goto error; @@ -1764,7 +1778,12 @@ static const video_poke_interface_t d3d12_poke_interface = { d3d12_gfx_load_texture, d3d12_gfx_unload_texture, NULL, /* set_video_mode */ +#ifndef __WINRT__ win32_get_refresh_rate, +#else + /* UWP does not expose this information easily */ + NULL, +#endif d3d12_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/d3d8.c b/gfx/drivers/d3d8.c index a5dcf1b2a1..3c174fdd93 100644 --- a/gfx/drivers/d3d8.c +++ b/gfx/drivers/d3d8.c @@ -48,9 +48,11 @@ #ifdef _XBOX #define D3D8_PRESENTATIONINTERVAL D3DRS_PRESENTATIONINTERVAL #else +#ifndef __WINRT__ #define HAVE_MONITOR #define HAVE_WINDOW #endif +#endif #ifdef HAVE_MENU #include "../../menu/menu_driver.h" @@ -61,6 +63,10 @@ #include "../../core.h" #include "../../verbosity.h" +#ifdef __WINRT__ +#error "UWP does not support D3D8" +#endif + static LPDIRECT3D8 g_pD3D8; #ifdef _XBOX @@ -1137,37 +1143,6 @@ static void d3d8_set_osd_msg(void *data, d3d8_end_scene(d3d->dev); } -static void d3d8_input_driver( - const input_driver_t **input, void **input_data) -{ - settings_t *settings = config_get_ptr(); - const char *name = settings ? - settings->arrays.input_joypad_driver : NULL; -#ifdef _XBOX - void *xinput = input_xinput.init(name); - *input = xinput ? (const input_driver_t*)&input_xinput : NULL; - *input_data = xinput; -#else -#if _WIN32_WINNT >= 0x0501 - /* winraw only available since XP */ - if (string_is_equal(settings->arrays.input_driver, "raw")) - { - *input_data = input_winraw.init(name); - if (*input_data) - { - *input = &input_winraw; - dinput = NULL; - return; - } - } -#endif - - dinput = input_dinput.init(name); - *input = dinput ? &input_dinput : NULL; - *input_data = dinput; -#endif -} - static bool d3d8_init_internal(d3d8_video_t *d3d, const video_info_t *info, const input_driver_t **input, void **input_data) @@ -1255,7 +1230,7 @@ static bool d3d8_init_internal(d3d8_video_t *d3d, if (!d3d8_initialize(d3d, &d3d->video_info)) return false; - d3d8_input_driver(input, input_data); + d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data); RARCH_LOG("[D3D8]: Init complete.\n"); return true; @@ -1888,9 +1863,10 @@ static const video_poke_interface_t d3d_poke_interface = { d3d8_load_texture, d3d8_unload_texture, d3d8_set_video_mode, -#ifdef _XBOX +#if defined(_XBOX) || defined(__WINRT__) NULL, #else + /* UWP does not expose this information easily */ win32_get_refresh_rate, #endif NULL, diff --git a/gfx/drivers/d3d9.c b/gfx/drivers/d3d9.c index a383190b48..00917d4bbe 100644 --- a/gfx/drivers/d3d9.c +++ b/gfx/drivers/d3d9.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2014 - OV2 @@ -65,6 +65,10 @@ #include "../../verbosity.h" #include "../../retroarch.h" +#ifdef __WINRT__ +#error "UWP does not support D3D9" +#endif + static LPDIRECT3D9 g_pD3D9; void *dinput; @@ -1182,38 +1186,6 @@ static void d3d9_set_osd_msg(void *data, d3d9_end_scene(dev); } -static void d3d9_input_driver( - const input_driver_t **input, void **input_data) -{ - settings_t *settings = config_get_ptr(); - const char *name = settings ? - settings->arrays.input_joypad_driver : NULL; -#ifdef _XBOX - void *xinput = input_xinput.init(name); - *input = xinput ? (const input_driver_t*)&input_xinput : NULL; - *input_data = xinput; -#else - -#if _WIN32_WINNT >= 0x0501 - /* winraw only available since XP */ - if (string_is_equal(settings->arrays.input_driver, "raw")) - { - *input_data = input_winraw.init(name); - if (*input_data) - { - *input = &input_winraw; - dinput = NULL; - return; - } - } -#endif - - dinput = input_dinput.init(name); - *input = dinput ? &input_dinput : NULL; - *input_data = dinput; -#endif -} - static bool d3d9_init_internal(d3d9_video_t *d3d, const video_info_t *info, const input_driver_t **input, void **input_data) @@ -1325,7 +1297,7 @@ static bool d3d9_init_internal(d3d9_video_t *d3d, if (!d3d9_initialize(d3d, &d3d->video_info)) return false; - d3d9_input_driver(input, input_data); + d3d_input_driver(settings->arrays.input_joypad_driver, input, input_data); RARCH_LOG("[D3D9]: Init complete.\n"); return true; @@ -2054,9 +2026,10 @@ static const video_poke_interface_t d3d9_poke_interface = { d3d9_load_texture, d3d9_unload_texture, d3d9_set_video_mode, -#ifdef _XBOX +#if defined(_XBOX) || defined(__WINRT__) NULL, #else + /* UWP does not expose this information easily */ win32_get_refresh_rate, #endif NULL, diff --git a/gfx/font_driver.c b/gfx/font_driver.c index 07ce2dd93c..8eaf1d2447 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -278,7 +278,7 @@ static bool vga_font_init_first( } #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) static const font_renderer_t *gdi_font_backends[] = { &gdi_font, NULL, @@ -666,7 +666,7 @@ static bool font_init_first( return switch_font_init_first(font_driver, font_handle, video_data, font_path, font_size, is_threaded); #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) case FONT_DRIVER_RENDER_GDI: return gdi_font_init_first(font_driver, font_handle, video_data, font_path, font_size, is_threaded); diff --git a/gfx/video_display_server.c b/gfx/video_display_server.c index e4824a0a46..73dd8c92ca 100644 --- a/gfx/video_display_server.c +++ b/gfx/video_display_server.c @@ -39,7 +39,7 @@ void* video_display_server_init(void) switch (type) { case RARCH_DISPLAY_WIN32: -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) current_display_server = &dispserv_win32; #endif break; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 88ef1862ef..b00014fb0b 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -340,7 +340,7 @@ static const video_driver_t *video_drivers[] = { #ifdef HAVE_XSHM &video_xshm, #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &video_gdi, #endif #ifdef DJGPP @@ -416,7 +416,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { #if defined(HAVE_VULKAN) && defined(HAVE_VULKAN_DISPLAY) &gfx_ctx_khr_display, #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &gfx_ctx_gdi, #endif #ifdef HAVE_SIXEL diff --git a/griffin/griffin.c b/griffin/griffin.c index 4589cafc12..cbe29ef9e7 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -601,6 +601,8 @@ INPUT #elif defined(DJGPP) #include "../input/drivers/dos_input.c" #include "../input/drivers_joypad/dos_joypad.c" +#elif defined(__WINRT__) +#include "../input/drivers/xdk_xinput_input.c" #endif #ifdef HAVE_WAYLAND @@ -947,7 +949,7 @@ FRONTEND #include "../frontend/frontend_driver.c" -#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) +#if defined(_WIN32) && !defined(_XBOX) #include "../frontend/drivers/platform_win32.c" #endif @@ -1259,7 +1261,7 @@ MENU #include "../menu/drivers_display/menu_display_vga.c" #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) #include "../menu/drivers_display/menu_display_gdi.c" #endif diff --git a/input/drivers_joypad/xinput_joypad.c b/input/drivers_joypad/xinput_joypad.c index a7b5e639a8..1961b64262 100644 --- a/input/drivers_joypad/xinput_joypad.c +++ b/input/drivers_joypad/xinput_joypad.c @@ -42,12 +42,20 @@ #ifdef HAVE_DINPUT #include "dinput_joypad.h" +#else +int g_xinput_pad_indexes[MAX_USERS]; +bool g_xinput_block_pads; +#endif + +#if defined(__WINRT__) +#include #endif /* Check if the definitions do not already exist. * Official and mingw xinput headers have different include guards. + * Windows 10 API version doesn't have an include guard at all and just uses #pragma once instead */ -#if ((!_XINPUT_H_) && (!__WINE_XINPUT_H)) +#if ((!_XINPUT_H_) && (!__WINE_XINPUT_H)) && !defined(__WINRT__) #define XINPUT_GAMEPAD_DPAD_UP 0x0001 #define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 @@ -173,7 +181,7 @@ const char *xinput_joypad_name(unsigned pad) return XBOX_CONTROLLER_NAMES[xuser]; } -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) static bool load_xinput_dll(void) { const char *version = "1.4"; @@ -210,7 +218,7 @@ static bool xinput_joypad_init(void *data) unsigned i, j; XINPUT_STATE dummy_state; -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) if (!g_xinput_dll) if (!load_xinput_dll()) return false; @@ -219,6 +227,9 @@ static bool xinput_joypad_init(void *data) * First try to load ordinal 100 (XInputGetStateEx). */ g_XInputGetStateEx = (XInputGetStateEx_t)dylib_proc(g_xinput_dll, (const char*)100); +#elif defined(__WINRT__) + /* XInputGetStateEx is not available on WinRT */ + g_XInputGetStateEx = NULL; #else g_XInputGetStateEx = (XInputGetStateEx_t)XInputGetStateEx; #endif @@ -230,7 +241,7 @@ static bool xinput_joypad_init(void *data) * XInputGetState, at the cost of losing guide button support. */ g_xinput_guide_button_supported = false; -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) g_XInputGetStateEx = (XInputGetStateEx_t)dylib_proc(g_xinput_dll, "XInputGetState"); #else g_XInputGetStateEx = (XInputGetStateEx_t)XInputGetState; @@ -239,7 +250,7 @@ static bool xinput_joypad_init(void *data) if (!g_XInputGetStateEx) { RARCH_ERR("[XInput]: Failed to init: DLL is invalid or corrupt.\n"); -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) dylib_close(g_xinput_dll); #endif return false; /* DLL was loaded but did not contain the correct function. */ @@ -247,7 +258,7 @@ static bool xinput_joypad_init(void *data) RARCH_WARN("[XInput]: No guide button support.\n"); } -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) g_XInputSetState = (XInputSetState_t)dylib_proc(g_xinput_dll, "XInputSetState"); #else g_XInputSetState = (XInputSetState_t)XInputSetState; @@ -255,7 +266,7 @@ static bool xinput_joypad_init(void *data) if (!g_XInputSetState) { RARCH_ERR("[XInput]: Failed to init: DLL is invalid or corrupt.\n"); -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) dylib_close(g_xinput_dll); #endif return false; /* DLL was loaded but did not contain the correct function. */ @@ -277,7 +288,7 @@ static bool xinput_joypad_init(void *data) (!g_xinput_states[1].connected) && (!g_xinput_states[2].connected) && (!g_xinput_states[3].connected)) - return false; + return true; RARCH_LOG("[XInput]: Pads connected: %d\n", g_xinput_states[0].connected + g_xinput_states[1].connected + g_xinput_states[2].connected + g_xinput_states[3].connected); @@ -347,7 +358,7 @@ static void xinput_joypad_destroy(void) for (i = 0; i < 4; ++i) memset(&g_xinput_states[i], 0, sizeof(xinput_joypad_state)); -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) dylib_close(g_xinput_dll); g_xinput_dll = NULL; @@ -499,6 +510,7 @@ static void xinput_joypad_poll(void) for (i = 0; i < 4; ++i) { +#ifdef HAVE_DINPUT if (g_xinput_states[i].connected) { if (g_XInputGetStateEx && g_XInputGetStateEx(i, @@ -506,6 +518,28 @@ static void xinput_joypad_poll(void) == ERROR_DEVICE_NOT_CONNECTED) g_xinput_states[i].connected = false; } +#else + /* Normally, dinput handles device insertion/removal for us, but + * since dinput is not available on UWP we have to do it ourselves */ + /* Also note that on UWP, the controllers are not available on startup + * and are instead 'plugged in' a moment later because Microsoft reasons */ + // TODO: This may be bad for performance? + bool new_connected = g_XInputGetStateEx && g_XInputGetStateEx(i, &(g_xinput_states[i].xstate)) != ERROR_DEVICE_NOT_CONNECTED; + if (new_connected != g_xinput_states[i].connected) + { + if (new_connected) + { + /* This is kinda ugly, but it's the same thing that dinput does */ + xinput_joypad_destroy(); + xinput_joypad_init(NULL); + return; + } + else + { + g_xinput_states[i].connected = new_connected; + } + } +#endif } #ifdef HAVE_DINPUT diff --git a/input/input_driver.c b/input/input_driver.c index 3d9d60f683..5134c23e76 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -107,7 +107,7 @@ static const input_driver_t *input_drivers[] = { #ifdef XENON &input_xenon360, #endif -#if defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1) +#if defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1) || defined(__WINRT__) &input_xinput, #endif #ifdef GEKKO @@ -137,7 +137,7 @@ static const input_driver_t *input_drivers[] = { #ifdef DJGPP &input_dos, #endif -#if defined(_WIN32) && !defined(_XBOX) && _WIN32_WINNT >= 0x0501 +#if defined(_WIN32) && !defined(_XBOX) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__) /* winraw only available since XP */ &input_winraw, #endif diff --git a/input/input_keymaps.c b/input/input_keymaps.c index ff3817ad92..9ec77c755a 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -1423,7 +1423,7 @@ const struct rarch_key_map rarch_key_map_dos[] = { }; #endif -#if defined(_WIN32) && _WIN32_WINNT >= 0x0501 +#if defined(_WIN32) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__) const struct rarch_key_map rarch_key_map_winraw[] = { { VK_BACK, RETROK_BACKSPACE }, { VK_TAB, RETROK_TAB }, @@ -1539,6 +1539,11 @@ const struct rarch_key_map rarch_key_map_winraw[] = { }; #endif +#ifdef __WINRT__ +/* Refer to uwp_main.cpp - on WinRT these constants are defined as C++ enum classes + * so they can't be placed in a C source file */ +#endif + enum retro_key rarch_keysym_lut[RETROK_LAST]; /** diff --git a/libretro-common/dynamic/dylib.c b/libretro-common/dynamic/dylib.c index bc6be9fc40..1db756c734 100644 --- a/libretro-common/dynamic/dylib.c +++ b/libretro-common/dynamic/dylib.c @@ -74,17 +74,42 @@ static void set_dl_error(void) dylib_t dylib_load(const char *path) { #ifdef _WIN32 +#ifndef __WINRT__ int prevmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); -#ifdef LEGACY_WIN32 +#endif +#ifdef __WINRT__ + /* On UWP, you can only load DLLs inside your install directory, using a special function that takes a relative path */ + + if (!path_is_absolute(path)) + RARCH_WARN("Relative path in dylib_load! This is likely an attempt to load a system library that will fail\n"); + + char *relative_path_abbrev = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + fill_pathname_abbreviate_special(relative_path_abbrev, path, PATH_MAX_LENGTH * sizeof(char)); + + char *relative_path = relative_path_abbrev; + if (relative_path[0] != ':' || !path_char_is_slash(relative_path[1])) + RARCH_WARN("Path to dylib_load is not inside app install directory! Loading will probably fail\n"); + else + relative_path += 2; + + RARCH_LOG("Loading library using a relative path: '%s'\n", relative_path); + + wchar_t *pathW = utf8_to_utf16_string_alloc(relative_path); + dylib_t lib = LoadPackagedLibrary(pathW, 0); + free(pathW); + + free(relative_path_abbrev); +#elif defined(LEGACY_WIN32) dylib_t lib = LoadLibrary(path); #else wchar_t *pathW = utf8_to_utf16_string_alloc(path); dylib_t lib = LoadLibraryW(pathW); - free(pathW); #endif +#ifndef __WINRT__ SetErrorMode(prevmode); +#endif if (!lib) { @@ -114,8 +139,20 @@ function_t dylib_proc(dylib_t lib, const char *proc) function_t sym; #ifdef _WIN32 - sym = (function_t)GetProcAddress(lib ? - (HMODULE)lib : GetModuleHandle(NULL), proc); + HMODULE mod = (HMODULE)lib; +#ifndef __WINRT__ + if (!mod) + mod = GetModuleHandle(NULL); +#else + /* GetModuleHandle is not available on UWP */ + if (!mod) + { + RARCH_WARN("FIXME: It's not possible to look up symbols in current executable on UWP!\n"); + DebugBreak(); + return NULL; + } +#endif + sym = (function_t)GetProcAddress(mod, proc); if (!sym) { set_dl_error(); diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 1e910f4ec1..2e27217457 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -96,6 +96,12 @@ #include /* stat() is defined here */ #endif +#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL) +#ifdef __WINRT__ +#include +#endif +#endif + /* Assume W-functions do not work below Win2K and Xbox platforms */ #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) @@ -1005,17 +1011,36 @@ void fill_pathname_expand_special(char *out_path, const char *in_path, size_t size) { #if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL) - if (*in_path == '~') + if (in_path[0] == '~') { - const char *home = getenv("HOME"); - if (home) + char *home_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + + home_dir[0] = '\0'; + + fill_pathname_home_dir(home_dir, + PATH_MAX_LENGTH * sizeof(char)); + + if (*home_dir) { - size_t src_size = strlcpy(out_path, home, size); + size_t src_size = strlcpy(out_path, home_dir, size); retro_assert(src_size < size); out_path += src_size; size -= src_size; - in_path++; + + if ( + (in_path[1] == '/') +#ifdef _WIN32 + || (in_path[1] == '\\') +#endif + ) + { + in_path += 2; + } + else + { + in_path++; + } } } else if ((in_path[0] == ':') && @@ -1027,23 +1052,24 @@ void fill_pathname_expand_special(char *out_path, ) ) { - size_t src_size; char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); application_dir[0] = '\0'; - fill_pathname_application_path(application_dir, + fill_pathname_application_dir(application_dir, PATH_MAX_LENGTH * sizeof(char)); - path_basedir_wrapper(application_dir); - src_size = strlcpy(out_path, application_dir, size); - retro_assert(src_size < size); + if (*application_dir) + { + size_t src_size = strlcpy(out_path, application_dir, size); + retro_assert(src_size < size); - free(application_dir); + free(application_dir); - out_path += src_size; - size -= src_size; - in_path += 2; + out_path += src_size; + size -= src_size; + in_path += 2; + } } #endif @@ -1058,7 +1084,7 @@ void fill_pathname_abbreviate_special(char *out_path, const char *candidates[3]; const char *notations[3]; char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - const char *home = getenv("HOME"); + char *home_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); application_dir[0] = '\0'; @@ -1070,16 +1096,17 @@ void fill_pathname_abbreviate_special(char *out_path, /* ugly hack - use application_dir pointer * before filling it in. C89 reasons */ candidates[0] = application_dir; - candidates[1] = home; + candidates[1] = home_dir; candidates[2] = NULL; notations [0] = ":"; notations [1] = "~"; notations [2] = NULL; - fill_pathname_application_path(application_dir, + fill_pathname_application_dir(application_dir, + PATH_MAX_LENGTH * sizeof(char)); + fill_pathname_home_dir(home_dir, PATH_MAX_LENGTH * sizeof(char)); - path_basedir_wrapper(application_dir); for (i = 0; candidates[i]; i++) { @@ -1107,6 +1134,7 @@ void fill_pathname_abbreviate_special(char *out_path, } free(application_dir); + free(home_dir); #endif retro_assert(strlcpy(out_path, in_path, size) < size); @@ -1148,7 +1176,7 @@ void fill_pathname_application_path(char *s, size_t len) CFBundleRef bundle = CFBundleGetMainBundle(); #endif #ifdef _WIN32 - DWORD ret; + DWORD ret = 0; wchar_t wstr[PATH_MAX_LENGTH] = {0}; #endif #ifdef __HAIKU__ @@ -1160,11 +1188,11 @@ void fill_pathname_application_path(char *s, size_t len) if (!len) return; -#ifdef _WIN32 +#if defined(_WIN32) #ifdef LEGACY_WIN32 - ret = GetModuleFileNameA(GetModuleHandle(NULL), s, len); + ret = GetModuleFileNameA(NULL, s, len); #else - ret = GetModuleFileNameW(GetModuleHandle(NULL), wstr, ARRAY_SIZE(wstr)); + ret = GetModuleFileNameW(NULL, wstr, ARRAY_SIZE(wstr)); if (*wstr) { @@ -1233,4 +1261,27 @@ void fill_pathname_application_path(char *s, size_t len) } #endif } + +void fill_pathname_application_dir(char *s, size_t len) +{ +#ifdef __WINRT__ + strlcpy(s, uwp_dir_install, len); +#else + fill_pathname_application_path(s, len); + path_basedir_wrapper(s); +#endif +} + +void fill_pathname_home_dir(char *s, size_t len) +{ +#ifdef __WINRT__ + strlcpy(s, uwp_dir_data, len); +#else + const char *home = getenv("HOME"); + if (home) + strlcpy(s, home, len); + else + *s = 0; +#endif +} #endif diff --git a/libretro-common/file/nbio/nbio_intf.c b/libretro-common/file/nbio/nbio_intf.c index d6254ef08e..1ce6322bc9 100644 --- a/libretro-common/file/nbio/nbio_intf.c +++ b/libretro-common/file/nbio/nbio_intf.c @@ -38,7 +38,7 @@ extern nbio_intf_t nbio_stdio; static nbio_intf_t *internal_nbio = &nbio_linux; #elif defined(HAVE_MMAP) && defined(BSD) static nbio_intf_t *internal_nbio = &nbio_mmap_unix; -#elif defined(_WIN32) && !defined(_XBOX) +#elif defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) static nbio_intf_t *internal_nbio = &nbio_mmap_win32; #else static nbio_intf_t *internal_nbio = &nbio_stdio; diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index 026b4f7933..b6b533a6b9 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -462,6 +462,8 @@ void fill_pathname_slash(char *path, size_t size); #if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL) void fill_pathname_application_path(char *buf, size_t size); +void fill_pathname_application_dir(char *buf, size_t size); +void fill_pathname_home_dir(char *buf, size_t size); #endif /** diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 631cb9abe6..cc742f2ce6 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -359,12 +359,14 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) } } +#ifndef __WINRT__ if (settings->bools.menu_show_core_updater) menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_DELETE), msg_hash_to_str(MENU_ENUM_LABEL_CORE_DELETE), MENU_ENUM_LABEL_CORE_DELETE, MENU_SETTING_ACTION_CORE_DELETE, 0, 0); +#endif return 0; } @@ -3102,6 +3104,7 @@ static unsigned menu_displaylist_parse_options( MENU_SETTING_ACTION, 0, 0); count++; #elif defined(HAVE_NETWORKING) +#ifndef __WINRT__ if (settings->bools.menu_show_core_updater) { menu_entries_append_enum(info->list, @@ -3111,6 +3114,7 @@ static unsigned menu_displaylist_parse_options( MENU_SETTING_ACTION, 0, 0); count++; } +#endif menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST), @@ -4150,7 +4154,7 @@ bool menu_displaylist_process(menu_displaylist_info_t *info) if (info->need_sort) file_list_sort_on_alt(info->list); -#if defined(HAVE_NETWORKING) +#if defined(HAVE_NETWORKING) && !defined(__WINRT__) if (settings->bools.menu_show_core_updater && !settings->bools.kiosk_mode_enable) { if (info->download_core) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 5e193fca93..579e499ef9 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -148,7 +148,7 @@ static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = { #ifdef WIIU &menu_display_ctx_wiiu, #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &menu_display_ctx_gdi, #endif #ifdef DJGPP diff --git a/pkg/msvc/RetroArch-msvc2017-UWP.sln b/pkg/msvc/RetroArch-msvc2017-UWP.sln new file mode 100644 index 0000000000..30fad3eb7a --- /dev/null +++ b/pkg/msvc/RetroArch-msvc2017-UWP.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.168 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-msvc2017-UWP", "msvc-2017-UWP\RetroArch-msvc2017-UWP.vcxproj", "{F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM.ActiveCfg = Debug|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM.Build.0 = Debug|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM.Deploy.0 = Debug|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM64.Build.0 = Debug|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x64.ActiveCfg = Debug|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x64.Build.0 = Debug|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x64.Deploy.0 = Debug|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x86.ActiveCfg = Debug|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x86.Build.0 = Debug|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x86.Deploy.0 = Debug|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM.ActiveCfg = Release|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM.Build.0 = Release|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM.Deploy.0 = Release|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM64.ActiveCfg = Release|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM64.Build.0 = Release|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM64.Deploy.0 = Release|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x64.ActiveCfg = Release|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x64.Build.0 = Release|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x64.Deploy.0 = Release|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x86.ActiveCfg = Release|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x86.Build.0 = Release|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2A811B94-2232-4C4E-A88E-33B0CDF139A2} + EndGlobalSection +EndGlobal diff --git a/pkg/msvc/msvc-2017-UWP/Assets/LockScreenLogo.scale-200.png b/pkg/msvc/msvc-2017-UWP/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000..735f57adb5 Binary files /dev/null and b/pkg/msvc/msvc-2017-UWP/Assets/LockScreenLogo.scale-200.png differ diff --git a/pkg/msvc/msvc-2017-UWP/Assets/SplashScreen.scale-200.png b/pkg/msvc/msvc-2017-UWP/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000..023e7f1fed Binary files /dev/null and b/pkg/msvc/msvc-2017-UWP/Assets/SplashScreen.scale-200.png differ diff --git a/pkg/msvc/msvc-2017-UWP/Assets/Square150x150Logo.scale-200.png b/pkg/msvc/msvc-2017-UWP/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000..af49fec1a5 Binary files /dev/null and b/pkg/msvc/msvc-2017-UWP/Assets/Square150x150Logo.scale-200.png differ diff --git a/pkg/msvc/msvc-2017-UWP/Assets/Square44x44Logo.scale-200.png b/pkg/msvc/msvc-2017-UWP/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000..ce342a2ec8 Binary files /dev/null and b/pkg/msvc/msvc-2017-UWP/Assets/Square44x44Logo.scale-200.png differ diff --git a/pkg/msvc/msvc-2017-UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/pkg/msvc/msvc-2017-UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000000..f6c02ce97e Binary files /dev/null and b/pkg/msvc/msvc-2017-UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/pkg/msvc/msvc-2017-UWP/Assets/StoreLogo.png b/pkg/msvc/msvc-2017-UWP/Assets/StoreLogo.png new file mode 100644 index 0000000000..7385b56c0e Binary files /dev/null and b/pkg/msvc/msvc-2017-UWP/Assets/StoreLogo.png differ diff --git a/pkg/msvc/msvc-2017-UWP/Assets/Wide310x150Logo.scale-200.png b/pkg/msvc/msvc-2017-UWP/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000..288995b397 Binary files /dev/null and b/pkg/msvc/msvc-2017-UWP/Assets/Wide310x150Logo.scale-200.png differ diff --git a/pkg/msvc/msvc-2017-UWP/Package.appxmanifest b/pkg/msvc/msvc-2017-UWP/Package.appxmanifest new file mode 100644 index 0000000000..577bc8d30f --- /dev/null +++ b/pkg/msvc/msvc-2017-UWP/Package.appxmanifest @@ -0,0 +1,49 @@ + + + + + + + + + + msvc-2017-UWP + krzys + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pkg/msvc/msvc-2017-UWP/RetroArch-msvc2017-UWP.vcxproj b/pkg/msvc/msvc-2017-UWP/RetroArch-msvc2017-UWP.vcxproj new file mode 100644 index 0000000000..0836dbbee9 --- /dev/null +++ b/pkg/msvc/msvc-2017-UWP/RetroArch-msvc2017-UWP.vcxproj @@ -0,0 +1,506 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + + {f5e937b6-1ba0-4446-b94b-f3bbdef908f4} + DirectXApp + RetroArchUWP + pl-PL + 14.0 + true + Windows Store + 10.0.17763.0 + 10.0.15063.0 + 10.0 + + + + Application + true + v141 + + + Application + true + v141 + + + Application + true + v141 + true + + + Application + true + v141 + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + msvc-2017-UWP_TemporaryKey.pfx + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64 + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64 + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + ProgramDatabase + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + ProgramDatabase + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + + + + + + + + + Designer + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + + true + + + true + + + true + + + true + + + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/pkg/msvc/msvc-2017-UWP/RetroArch-msvc2017-UWP.vcxproj.filters b/pkg/msvc/msvc-2017-UWP/RetroArch-msvc2017-UWP.vcxproj.filters new file mode 100644 index 0000000000..a133f33c90 --- /dev/null +++ b/pkg/msvc/msvc-2017-UWP/RetroArch-msvc2017-UWP.vcxproj.filters @@ -0,0 +1,280 @@ + + + + + {1246fa09-e114-4a52-88c2-657b2f13d9fb} + + + {32de9679-6494-4933-afa2-430fd975e506} + + + {73676219-cf54-454f-b6fa-9b192c1454f8} + + + + + {bf1e643d-c518-4a77-a355-ae8a93efc18b} + + + {ba77ad30-f536-4bb8-ad9d-2870e8a9bd39} + + + + + assets + + + assets + + + assets + + + assets + + + assets + + + assets + + + assets + + + + + + + + + core_deps + + + cores + + + cores + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + core_deps + + + + + uwp + + + uwp + + + + + griffin + + + griffin + + + uwp + + + \ No newline at end of file diff --git a/pkg/msvc/msvc-2017-UWP/msvc-2017-UWP_TemporaryKey.pfx b/pkg/msvc/msvc-2017-UWP/msvc-2017-UWP_TemporaryKey.pfx new file mode 100644 index 0000000000..ff20a54c34 Binary files /dev/null and b/pkg/msvc/msvc-2017-UWP/msvc-2017-UWP_TemporaryKey.pfx differ diff --git a/ui/ui_companion_driver.c b/ui/ui_companion_driver.c index daeae6e1d3..204db1ebc8 100644 --- a/ui/ui_companion_driver.c +++ b/ui/ui_companion_driver.c @@ -27,7 +27,7 @@ #include "ui_companion_driver.h" static const ui_companion_driver_t *ui_companion_drivers[] = { -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &ui_companion_win32, #endif #if defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL) diff --git a/uwp/uwp_func.h b/uwp/uwp_func.h new file mode 100644 index 0000000000..7a3e98e60e --- /dev/null +++ b/uwp/uwp_func.h @@ -0,0 +1,35 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Krzysztof Haładyn + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef _UWP_FUNC_H +#define _UWP_FUNC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern char uwp_dir_install[PATH_MAX_LENGTH]; +extern char uwp_dir_data[PATH_MAX_LENGTH]; +extern char uwp_device_family[128]; + +void* uwp_get_corewindow(void); + +#ifdef __cplusplus +} +#endif + +#endif _UWP_FUNC_H diff --git a/uwp/uwp_main.cpp b/uwp/uwp_main.cpp new file mode 100644 index 0000000000..7e3f132228 --- /dev/null +++ b/uwp/uwp_main.cpp @@ -0,0 +1,479 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Krzysztof Haładyn + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "uwp_main.h" +#include +#include +#include +#include +#include +#include +#include +#include "uwp_func.h" + +#include + +using namespace RetroArchUWP; + +using namespace concurrency; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::UI::ViewManagement; +using namespace Windows::System; +using namespace Windows::System::Profile; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; + +char uwp_dir_install[PATH_MAX_LENGTH]; +char uwp_dir_data[PATH_MAX_LENGTH]; +char uwp_device_family[128]; + +// Some keys are unavailable in the VirtualKey enum (wtf) but the old-style constants work +const struct rarch_key_map rarch_key_map_uwp[] = { + { (unsigned int)VirtualKey::Back, RETROK_BACKSPACE }, + { (unsigned int)VirtualKey::Tab, RETROK_TAB }, + { (unsigned int)VirtualKey::Clear, RETROK_CLEAR }, + { (unsigned int)VirtualKey::Enter, RETROK_RETURN }, + { (unsigned int)VirtualKey::Pause, RETROK_PAUSE }, + { (unsigned int)VirtualKey::Escape, RETROK_ESCAPE }, + { (unsigned int)VirtualKey::ModeChange, RETROK_MODE }, + { (unsigned int)VirtualKey::Space, RETROK_SPACE }, + { (unsigned int)VirtualKey::PageUp, RETROK_PAGEUP }, + { (unsigned int)VirtualKey::PageDown, RETROK_PAGEDOWN }, + { (unsigned int)VirtualKey::End, RETROK_END }, + { (unsigned int)VirtualKey::Home, RETROK_HOME }, + { (unsigned int)VirtualKey::Left, RETROK_LEFT }, + { (unsigned int)VirtualKey::Up, RETROK_UP }, + { (unsigned int)VirtualKey::Right, RETROK_RIGHT }, + { (unsigned int)VirtualKey::Down, RETROK_DOWN }, + { (unsigned int)VirtualKey::Print, RETROK_PRINT }, + { (unsigned int)VirtualKey::Insert, RETROK_INSERT }, + { (unsigned int)VirtualKey::Delete, RETROK_DELETE }, + { (unsigned int)VirtualKey::Help, RETROK_HELP }, + { (unsigned int)VirtualKey::Number0, RETROK_0 }, + { (unsigned int)VirtualKey::Number1, RETROK_1 }, + { (unsigned int)VirtualKey::Number2, RETROK_2 }, + { (unsigned int)VirtualKey::Number3, RETROK_3 }, + { (unsigned int)VirtualKey::Number4, RETROK_4 }, + { (unsigned int)VirtualKey::Number5, RETROK_5 }, + { (unsigned int)VirtualKey::Number6, RETROK_6 }, + { (unsigned int)VirtualKey::Number7, RETROK_7 }, + { (unsigned int)VirtualKey::Number8, RETROK_8 }, + { (unsigned int)VirtualKey::Number9, RETROK_9 }, + { (unsigned int)VirtualKey::A, RETROK_a }, + { (unsigned int)VirtualKey::B, RETROK_b }, + { (unsigned int)VirtualKey::C, RETROK_c }, + { (unsigned int)VirtualKey::D, RETROK_d }, + { (unsigned int)VirtualKey::E, RETROK_e }, + { (unsigned int)VirtualKey::F, RETROK_f }, + { (unsigned int)VirtualKey::G, RETROK_g }, + { (unsigned int)VirtualKey::H, RETROK_h }, + { (unsigned int)VirtualKey::I, RETROK_i }, + { (unsigned int)VirtualKey::J, RETROK_j }, + { (unsigned int)VirtualKey::K, RETROK_k }, + { (unsigned int)VirtualKey::L, RETROK_l }, + { (unsigned int)VirtualKey::M, RETROK_m }, + { (unsigned int)VirtualKey::N, RETROK_n }, + { (unsigned int)VirtualKey::O, RETROK_o }, + { (unsigned int)VirtualKey::P, RETROK_p }, + { (unsigned int)VirtualKey::Q, RETROK_q }, + { (unsigned int)VirtualKey::R, RETROK_r }, + { (unsigned int)VirtualKey::S, RETROK_s }, + { (unsigned int)VirtualKey::T, RETROK_t }, + { (unsigned int)VirtualKey::U, RETROK_u }, + { (unsigned int)VirtualKey::V, RETROK_v }, + { (unsigned int)VirtualKey::W, RETROK_w }, + { (unsigned int)VirtualKey::X, RETROK_x }, + { (unsigned int)VirtualKey::Y, RETROK_y }, + { (unsigned int)VirtualKey::Z, RETROK_z }, + { (unsigned int)VirtualKey::LeftWindows, RETROK_LSUPER }, + { (unsigned int)VirtualKey::RightWindows, RETROK_RSUPER }, + { (unsigned int)VirtualKey::Application, RETROK_MENU }, + { (unsigned int)VirtualKey::NumberPad0, RETROK_KP0 }, + { (unsigned int)VirtualKey::NumberPad1, RETROK_KP1 }, + { (unsigned int)VirtualKey::NumberPad2, RETROK_KP2 }, + { (unsigned int)VirtualKey::NumberPad3, RETROK_KP3 }, + { (unsigned int)VirtualKey::NumberPad4, RETROK_KP4 }, + { (unsigned int)VirtualKey::NumberPad5, RETROK_KP5 }, + { (unsigned int)VirtualKey::NumberPad6, RETROK_KP6 }, + { (unsigned int)VirtualKey::NumberPad7, RETROK_KP7 }, + { (unsigned int)VirtualKey::NumberPad8, RETROK_KP8 }, + { (unsigned int)VirtualKey::NumberPad9, RETROK_KP9 }, + { (unsigned int)VirtualKey::Multiply, RETROK_KP_MULTIPLY }, + { (unsigned int)VirtualKey::Add, RETROK_KP_PLUS }, + { (unsigned int)VirtualKey::Subtract, RETROK_KP_MINUS }, + { (unsigned int)VirtualKey::Decimal, RETROK_KP_PERIOD }, + { (unsigned int)VirtualKey::Divide, RETROK_KP_DIVIDE }, + { (unsigned int)VirtualKey::F1, RETROK_F1 }, + { (unsigned int)VirtualKey::F2, RETROK_F2 }, + { (unsigned int)VirtualKey::F3, RETROK_F3 }, + { (unsigned int)VirtualKey::F4, RETROK_F4 }, + { (unsigned int)VirtualKey::F5, RETROK_F5 }, + { (unsigned int)VirtualKey::F6, RETROK_F6 }, + { (unsigned int)VirtualKey::F7, RETROK_F7 }, + { (unsigned int)VirtualKey::F8, RETROK_F8 }, + { (unsigned int)VirtualKey::F9, RETROK_F9 }, + { (unsigned int)VirtualKey::F10, RETROK_F10 }, + { (unsigned int)VirtualKey::F11, RETROK_F11 }, + { (unsigned int)VirtualKey::F12, RETROK_F12 }, + { (unsigned int)VirtualKey::F13, RETROK_F13 }, + { (unsigned int)VirtualKey::F14, RETROK_F14 }, + { (unsigned int)VirtualKey::F15, RETROK_F15 }, + { (unsigned int)VirtualKey::NumberKeyLock, RETROK_NUMLOCK }, + { (unsigned int)VirtualKey::Scroll, RETROK_SCROLLOCK }, + { (unsigned int)VirtualKey::LeftShift, RETROK_LSHIFT }, + { (unsigned int)VirtualKey::RightShift, RETROK_RSHIFT }, + { (unsigned int)VirtualKey::LeftControl, RETROK_LCTRL }, + { (unsigned int)VirtualKey::RightControl, RETROK_RCTRL }, + { (unsigned int)VirtualKey::LeftMenu, RETROK_LALT }, + { (unsigned int)VirtualKey::RightMenu, RETROK_RALT }, + { VK_RETURN, RETROK_KP_ENTER }, + { (unsigned int)VirtualKey::CapitalLock, RETROK_CAPSLOCK }, + { VK_OEM_1, RETROK_SEMICOLON }, + { VK_OEM_PLUS, RETROK_EQUALS }, + { VK_OEM_COMMA, RETROK_COMMA }, + { VK_OEM_MINUS, RETROK_MINUS }, + { VK_OEM_PERIOD, RETROK_PERIOD }, + { VK_OEM_2, RETROK_SLASH }, + { VK_OEM_3, RETROK_BACKQUOTE }, + { VK_OEM_4, RETROK_LEFTBRACKET }, + { VK_OEM_5, RETROK_BACKSLASH }, + { VK_OEM_6, RETROK_RIGHTBRACKET }, + { VK_OEM_7, RETROK_QUOTE }, + { 0, RETROK_UNKNOWN } +}; + +// The main function is only used to initialize our IFrameworkView class. +[Platform::MTAThread] +int main(Platform::Array^) +{ + Platform::String^ install_dir = Windows::ApplicationModel::Package::Current->InstalledLocation->Path + L"\\"; + wcstombs(uwp_dir_install, install_dir->Data(), PATH_MAX_LENGTH); + Platform::String^ data_dir = Windows::Storage::ApplicationData::Current->LocalFolder->Path + L"\\"; + wcstombs(uwp_dir_data, data_dir->Data(), PATH_MAX_LENGTH); + + wcstombs(uwp_device_family, AnalyticsInfo::VersionInfo->DeviceFamily->Data(), 128); + + RARCH_LOG("Data dir: %ls\n", data_dir->Data()); + RARCH_LOG("Install dir: %ls\n", install_dir->Data()); + + auto direct3DApplicationSource = ref new Direct3DApplicationSource(); + CoreApplication::Run(direct3DApplicationSource); + return 0; +} + +IFrameworkView^ Direct3DApplicationSource::CreateView() +{ + return ref new App(); +} + +App^ App::m_instance; + +App::App() : + m_initialized(false), + m_windowClosed(false), + m_windowVisible(true), + m_windowFocused(true), + m_windowResized(false) +{ + m_instance = this; +} + +// The first method called when the IFrameworkView is being created. +void App::Initialize(CoreApplicationView^ applicationView) +{ + // Register event handlers for app lifecycle. This example includes Activated, so that we + // can make the CoreWindow active and start rendering on the window. + applicationView->Activated += + ref new TypedEventHandler(this, &App::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &App::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &App::OnResuming); +} + +// Called when the CoreWindow object is created (or re-created). +void App::SetWindow(CoreWindow^ window) +{ + window->SizeChanged += + ref new TypedEventHandler(this, &App::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &App::OnVisibilityChanged); + + window->Activated += + ref new TypedEventHandler(this, &App::OnWindowActivated); + + window->Closed += + ref new TypedEventHandler(this, &App::OnWindowClosed); + + window->KeyDown += + ref new TypedEventHandler(this, &App::OnKeyDown); + + window->KeyUp += + ref new TypedEventHandler(this, &App::OnKeyUp); + + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &App::OnDpiChanged); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &App::OnOrientationChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(this, &App::OnDisplayContentsInvalidated); + + Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += + ref new EventHandler(this, &App::OnBackRequested); +} + +// Initializes scene resources, or loads a previously saved app state. +void App::Load(Platform::String^ entryPoint) +{ + int ret = rarch_main(NULL, NULL, NULL); + if (ret != 0) + { + RARCH_ERR("Init failed\n"); + CoreApplication::Exit(); + return; + } + input_keymaps_init_keyboard_lut(rarch_key_map_uwp); // TODO (krzys_h): move this to the input driver + m_initialized = true; +} + +// This method is called after the window becomes active. +void App::Run() +{ + if (!m_initialized) + { + RARCH_WARN("Initialization failed, so not running\n"); + return; + } + + bool x = false; + while (true) + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + + unsigned sleep_ms = 0; + int ret = runloop_iterate(&sleep_ms); + + if (ret == 1 && sleep_ms > 0) + retro_sleep(sleep_ms); + + task_queue_check(); + + if (!x) + { + /* HACK: I have no idea why is this necessary but it is required to get proper scaling on Xbox * + * Perhaps PreferredLaunchViewSize is broken and we need to wait until the app starts to call TryResizeView */ + m_windowResized = true; + x = true; + } + + if (ret == -1) + break; + } +} + +// Required for IFrameworkView. +// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView +// class is torn down while the app is in the foreground. +void App::Uninitialize() +{ + main_exit(NULL); +} + +// Application lifecycle event handlers. + +void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) +{ + // Run() won't start until the CoreWindow is activated. + CoreWindow::GetForCurrentThread()->Activate(); +} + +void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) +{ + // Save app state asynchronously after requesting a deferral. Holding a deferral + // indicates that the application is busy performing suspending operations. Be + // aware that a deferral may not be held indefinitely. After about five seconds, + // the app will be forced to exit. + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + + create_task([this, deferral]() + { + // TODO: Maybe creating a save state here would be a good idea? + + deferral->Complete(); + }); +} + +void App::OnResuming(Platform::Object^ sender, Platform::Object^ args) +{ + // Restore any data or state that was unloaded on suspend. By default, data + // and state are persisted when resuming from suspend. Note that this event + // does not occur if the app was previously terminated. +} + +void App::OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args) +{ + /* Prevent the B controller button on Xbox One from quitting the app */ + args->Handled = true; +} + +// Window event handlers. + +void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) +{ + m_windowResized = true; +} + +void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) +{ + m_windowVisible = args->Visible; +} + +void App::OnWindowActivated(CoreWindow^ sender, WindowActivatedEventArgs^ args) +{ + m_windowFocused = args->WindowActivationState != CoreWindowActivationState::Deactivated; +} + +void App::OnKeyDown(CoreWindow^ sender, KeyEventArgs^ args) +{ + OnKey(sender, args, true); +} + +void App::OnKeyUp(CoreWindow^ sender, KeyEventArgs^ args) +{ + OnKey(sender, args, false); +} + +void App::OnKey(CoreWindow^ sender, KeyEventArgs^ args, bool down) +{ + uint16_t mod = 0; + if ((sender->GetKeyState(VirtualKey::Shift) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_SHIFT; + if ((sender->GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_CTRL; + if ((sender->GetKeyState(VirtualKey::Menu) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_ALT; + if ((sender->GetKeyState(VirtualKey::CapitalLock) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_CAPSLOCK; + if ((sender->GetKeyState(VirtualKey::Scroll) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_SCROLLOCK; + if ((sender->GetKeyState(VirtualKey::LeftWindows) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked || + (sender->GetKeyState(VirtualKey::RightWindows) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_META; + + unsigned keycode = input_keymaps_translate_keysym_to_rk((unsigned)args->VirtualKey); + + input_keyboard_event(down, keycode, 0, mod, RETRO_DEVICE_KEYBOARD); +} + +void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) +{ + m_windowClosed = true; +} + +// DisplayInformation event handlers. + +void App::OnDpiChanged(DisplayInformation^ sender, Object^ args) +{ + m_windowResized = true; +} + +void App::OnOrientationChanged(DisplayInformation^ sender, Object^ args) +{ + m_windowResized = true; +} + +void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args) +{ + // Probably can be ignored? +} + +// Taken from DirectX UWP samples - on Xbox, everything is scaled 200% so getting the DPI calculation correct is crucial +static inline float ConvertDipsToPixels(float dips, float dpi) +{ + static const float dipsPerInch = 96.0f; + return floorf(dips * dpi / dipsPerInch + 0.5f); +} + +// Implement UWP equivalents of various win32_* functions +extern "C" { + + bool win32_has_focus(void) + { + return App::GetInstance()->IsWindowFocused(); + } + + bool win32_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) + { + if (App::GetInstance()->IsInitialized()) + { + if (fullscreen != ApplicationView::GetForCurrentView()->IsFullScreenMode) + { + if (fullscreen) + ApplicationView::GetForCurrentView()->TryEnterFullScreenMode(); + else + ApplicationView::GetForCurrentView()->ExitFullScreenMode(); + } + ApplicationView::GetForCurrentView()->TryResizeView(Size(width, height)); + } + else + { + /* In case the window is not activated yet, TryResizeView will fail and we have to set the initial parameters instead */ + /* Note that these are preserved after restarting the app and used for the UWP splash screen size (!), so they should be set only during init and not changed afterwards */ + ApplicationView::PreferredLaunchViewSize = Size(width, height); + ApplicationView::PreferredLaunchWindowingMode = fullscreen ? ApplicationViewWindowingMode::FullScreen : ApplicationViewWindowingMode::PreferredLaunchViewSize; + } + + /* Setting the window size may sometimes fail "because UWP" + * (i.e. we are on device with no windows, or Windows sandbox decides the window can't be that small) + * so in case resizing fails we just send a resized event back to RetroArch with old size + * (and report success because otherwise it bails out hard about failing to set video mode) + */ + App::GetInstance()->SetWindowResized(); + return true; + } + + void win32_show_cursor(bool state) + { + CoreWindow::GetForCurrentThread()->PointerCursor = state ? ref new CoreCursor(CoreCursorType::Arrow, 0) : nullptr; + } + + void win32_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height) + { + *quit = App::GetInstance()->IsWindowClosed(); + *resize = App::GetInstance()->CheckWindowResized(); + if (*resize) + { + float dpi = DisplayInformation::GetForCurrentView()->LogicalDpi; + *width = ConvertDipsToPixels(CoreWindow::GetForCurrentThread()->Bounds.Width, dpi); + *height = ConvertDipsToPixels(CoreWindow::GetForCurrentThread()->Bounds.Height, dpi); + } + } + + void* uwp_get_corewindow(void) + { + return (void*)CoreWindow::GetForCurrentThread(); + } +} diff --git a/uwp/uwp_main.h b/uwp/uwp_main.h new file mode 100644 index 0000000000..9d359e6e1a --- /dev/null +++ b/uwp/uwp_main.h @@ -0,0 +1,82 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Krzysztof Haładyn + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#pragma once + +#include "uwp_main.h" + +namespace RetroArchUWP +{ + // Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events. + ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView + { + public: + App(); + + // IFrameworkView methods. + virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView); + virtual void SetWindow(Windows::UI::Core::CoreWindow^ window); + virtual void Load(Platform::String^ entryPoint); + virtual void Run(); + virtual void Uninitialize(); + + protected: + // Application lifecycle event handlers. + void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); + void OnResuming(Platform::Object^ sender, Platform::Object^ args); + + void OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args); + + // Window event handlers. + void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); + void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); + void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); + void OnWindowActivated(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowActivatedEventArgs^ args); + void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); + void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); + + // DisplayInformation event handlers. + void OnDpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + + public: + bool IsInitialized() { return m_initialized; } + bool IsWindowClosed() { return m_windowClosed; } + bool IsWindowVisible() { return m_windowVisible; } + bool IsWindowFocused() { return m_windowFocused; } + bool CheckWindowResized() { bool resized = m_windowResized; m_windowResized = false; return resized; } + void SetWindowResized() { m_windowResized = true; } + static App^ GetInstance() { return m_instance; } + + private: + void OnKey(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args, bool down); + + private: + bool m_initialized; + bool m_windowClosed; + bool m_windowVisible; + bool m_windowFocused; + bool m_windowResized; + static App^ m_instance; + }; +} + +ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource +{ +public: + virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView(); +}; diff --git a/verbosity.c b/verbosity.c index 9db900e8e4..7a9cfccbd5 100644 --- a/verbosity.c +++ b/verbosity.c @@ -37,6 +37,11 @@ #include #endif +#if _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include #include #include @@ -60,7 +65,11 @@ * will write to this file. */ static FILE *log_file_fp = NULL; static void* log_file_buf = NULL; +#if _DEBUG +static bool main_verbosity = true; +#else static bool main_verbosity = false; +#endif static bool log_file_initialized = false; #ifdef NXLINK @@ -193,7 +202,7 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) #else { -#ifdef HAVE_QT +#if defined(HAVE_QT) || defined(__WINRT__) char buffer[1024]; #endif #ifdef HAVE_FILE_LOGGER @@ -202,7 +211,7 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) FILE *fp = stderr; #endif -#ifdef HAVE_QT +#if defined(HAVE_QT) || defined(__WINRT__) buffer[0] = '\0'; vsnprintf(buffer, sizeof(buffer), fmt, ap); @@ -212,7 +221,13 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) fflush(fp); } +#if defined(HAVE_QT) ui_companion_driver_log_msg(buffer); +#endif + +#if defined(__WINRT__) + OutputDebugStringA(buffer); +#endif #else #if defined(NXLINK) && !defined(HAVE_FILE_LOGGER) if (nxlink_connected)