diff --git a/.gitignore b/.gitignore index 485e7b46fe..e79b4a5556 100644 --- a/.gitignore +++ b/.gitignore @@ -223,3 +223,4 @@ param.sfo *.elf *.self *.vpk +/.vs diff --git a/libretro-common/vfs/vfs_implementation_uwp.cpp b/libretro-common/vfs/vfs_implementation_uwp.cpp index 7e8246af00..bf0d76c8db 100644 --- a/libretro-common/vfs/vfs_implementation_uwp.cpp +++ b/libretro-common/vfs/vfs_implementation_uwp.cpp @@ -31,6 +31,7 @@ #include #include #include +#include using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; @@ -388,7 +389,7 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl( OPEN_ALWAYS : CREATE_ALWAYS; } - file_handle = CreateFile2(path_str->Data(), desireAccess, FILE_SHARE_READ, creationDisposition, NULL); + file_handle = CreateFile2FromAppW(path_str->Data(), desireAccess, FILE_SHARE_READ, creationDisposition, NULL); if (file_handle != INVALID_HANDLE_VALUE) { @@ -744,7 +745,7 @@ int retro_vfs_file_remove_impl(const char *path) free(path_wide); /* Try Win32 first, this should work in AppData */ - result = DeleteFileW(path_str->Data()); + result = DeleteFileFromAppW(path_str->Data()); if (result) return 0; @@ -827,6 +828,7 @@ int retro_vfs_stat_impl(const char *path, int32_t *size) Platform::String^ path_str; IStorageItem^ item; DWORD file_info; + _WIN32_FILE_ATTRIBUTE_DATA attribdata; if (!path || !*path) return 0; @@ -837,21 +839,22 @@ int retro_vfs_stat_impl(const char *path, int32_t *size) free(path_wide); /* Try Win32 first, this should work in AppData */ - file_info = GetFileAttributesW(path_str->Data()); - if (file_info != INVALID_FILE_ATTRIBUTES) + if (GetFileAttributesExFromAppW(path_str->Data(), GetFileExInfoStandard, &attribdata)) { - HANDLE file_handle = CreateFile2(path_str->Data(), GENERIC_READ, FILE_SHARE_READ, OPEN_ALWAYS, NULL); - if (file_handle != INVALID_HANDLE_VALUE) - { - LARGE_INTEGER sz; - if (GetFileSizeEx(file_handle, &sz)) - { - if (size) - *size = sz.QuadPart; - } - CloseHandle(file_handle); - } - return (file_info & FILE_ATTRIBUTE_DIRECTORY) ? RETRO_VFS_STAT_IS_VALID | RETRO_VFS_STAT_IS_DIRECTORY : RETRO_VFS_STAT_IS_VALID; + file_info = attribdata.dwFileAttributes; + if (file_info != INVALID_FILE_ATTRIBUTES) + { + if (!(file_info & FILE_ATTRIBUTE_DIRECTORY)) + { + LARGE_INTEGER sz; + if (size) + { + sz.HighPart = attribdata.nFileSizeHigh; + sz.LowPart = attribdata.nFileSizeLow; + } + } + return (file_info & FILE_ATTRIBUTE_DIRECTORY) ? RETRO_VFS_STAT_IS_VALID | RETRO_VFS_STAT_IS_DIRECTORY : RETRO_VFS_STAT_IS_VALID; + } } if (GetLastError() == ERROR_FILE_NOT_FOUND) @@ -917,7 +920,7 @@ int retro_vfs_mkdir_impl(const char *dir) free(dir_local); /* Try Win32 first, this should work in AppData */ - result = CreateDirectoryW(dir_str->Data(), NULL); + result = CreateDirectoryFromAppW(dir_str->Data(), NULL); if (result) return 0; diff --git a/pkg/msvc-uwp/RetroArch-msvc2019-UWP/Package.appxmanifest b/pkg/msvc-uwp/RetroArch-msvc2019-UWP/Package.appxmanifest index f2bd299335..7c8afb0c3f 100755 --- a/pkg/msvc-uwp/RetroArch-msvc2019-UWP/Package.appxmanifest +++ b/pkg/msvc-uwp/RetroArch-msvc2019-UWP/Package.appxmanifest @@ -1,6 +1,6 @@  - + RetroArch diff --git a/pkg/msvc-uwp/RetroArch-msvc2019-UWP/RetroArch-msvc2019-UWP.vcxproj b/pkg/msvc-uwp/RetroArch-msvc2019-UWP/RetroArch-msvc2019-UWP.vcxproj index 2ceaa5c7e8..b92fe92a4d 100755 --- a/pkg/msvc-uwp/RetroArch-msvc2019-UWP/RetroArch-msvc2019-UWP.vcxproj +++ b/pkg/msvc-uwp/RetroArch-msvc2019-UWP/RetroArch-msvc2019-UWP.vcxproj @@ -232,11 +232,12 @@ 1 OnApplicationRun Always - B86DAF5EC706754FEBABD0B011B0C4C3C2F73251 + 261A18AB51F9C1DC1956AF9084285F82A2A7FD30 SHA256 True 0 True + RetroArch-msvc2019-UWP_TemporaryKey.pfx diff --git a/pkg/msvc-uwp/RetroArch-msvc2019-UWP/RetroArch-msvc2019-UWP_TemporaryKey.pfx b/pkg/msvc-uwp/RetroArch-msvc2019-UWP/RetroArch-msvc2019-UWP_TemporaryKey.pfx index ea119d5c2f..91256913f0 100755 Binary files a/pkg/msvc-uwp/RetroArch-msvc2019-UWP/RetroArch-msvc2019-UWP_TemporaryKey.pfx and b/pkg/msvc-uwp/RetroArch-msvc2019-UWP/RetroArch-msvc2019-UWP_TemporaryKey.pfx differ