mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
(UWP) Add broadFileSystemAccess support
This commit is contained in:
parent
b7cc124070
commit
9188cc1a73
@ -271,18 +271,39 @@ static int frontend_uwp_parse_drive_list(void *data, bool load_content)
|
||||
enum msg_hash_enums enum_idx = load_content ?
|
||||
MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR :
|
||||
MSG_UNKNOWN;
|
||||
/* TODO (krzys_h): UWP storage sandboxing */
|
||||
char *home_dir = (char*)malloc(
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
char drive[] = " :\\";
|
||||
char *home_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
bool have_any_drives = false;
|
||||
|
||||
fill_pathname_home_dir(home_dir,
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
fill_pathname_home_dir(home_dir, PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++)
|
||||
{
|
||||
if (path_is_valid(drive))
|
||||
{
|
||||
menu_entries_append_enum(list,
|
||||
drive,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
have_any_drives = true;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
home_dir,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
|
||||
if (!have_any_drives && string_is_equal(uwp_device_family, "Windows.Desktop"))
|
||||
{
|
||||
menu_entries_append_enum(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
}
|
||||
|
||||
free(home_dir);
|
||||
#endif
|
||||
|
@ -390,6 +390,11 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
snprintf(s, len,
|
||||
"Go back to the parent directory.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS:
|
||||
snprintf(s, len,
|
||||
"Open Windows permission settings to enable \n"
|
||||
"the broadFileSystemAccess capability.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET:
|
||||
snprintf(s, len,
|
||||
"Shader preset file.");
|
||||
|
@ -2044,6 +2044,14 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY,
|
||||
"Parent directory"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_FILE_BROWSER_OPEN_UWP_PERMISSIONS,
|
||||
"Enable external file access"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS,
|
||||
"Open Windows file access permissions settings"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO,
|
||||
"Pause when menu activated"
|
||||
|
@ -79,6 +79,10 @@
|
||||
|
||||
#include "../../record/record_driver.h"
|
||||
|
||||
#ifdef __WINRT__
|
||||
#include "../../uwp/uwp_func.h"
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
ACTION_OK_LOAD_PRESET = 0,
|
||||
@ -3965,6 +3969,17 @@ default_action_ok_func(action_ok_push_accounts_youtube_list, ACTION_OK_DL_ACCOUN
|
||||
default_action_ok_func(action_ok_push_accounts_twitch_list, ACTION_OK_DL_ACCOUNTS_TWITCH_LIST)
|
||||
default_action_ok_func(action_ok_open_archive, ACTION_OK_DL_OPEN_ARCHIVE)
|
||||
|
||||
static int action_ok_open_uwp_permission_settings(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#ifdef __WINRT__
|
||||
uwp_open_broadfilesystemaccess_settings();
|
||||
#else
|
||||
retro_assert(false);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_shader_pass(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -5465,6 +5480,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS:
|
||||
BIND_ACTION_OK(cbs, action_ok_menu_file_browser_list);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS:
|
||||
BIND_ACTION_OK(cbs, action_ok_open_uwp_permission_settings);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_RETRO_ACHIEVEMENTS_SETTINGS:
|
||||
BIND_ACTION_OK(cbs, action_ok_retro_achievements_list);
|
||||
break;
|
||||
|
@ -334,6 +334,7 @@ default_sublabel_macro(action_bind_sublabel_goto_images,
|
||||
default_sublabel_macro(action_bind_sublabel_goto_music, MENU_ENUM_SUBLABEL_GOTO_MUSIC)
|
||||
default_sublabel_macro(action_bind_sublabel_goto_video, MENU_ENUM_SUBLABEL_GOTO_VIDEO)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_filebrowser_settings, MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_filebrowser_open_uwp_permissions, MENU_ENUM_SUBLABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS)
|
||||
default_sublabel_macro(action_bind_sublabel_auto_remaps_enable, MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE)
|
||||
default_sublabel_macro(action_bind_sublabel_auto_overrides_enable, MENU_ENUM_SUBLABEL_AUTO_OVERRIDES_ENABLE)
|
||||
default_sublabel_macro(action_bind_sublabel_game_specific_options, MENU_ENUM_SUBLABEL_GAME_SPECIFIC_OPTIONS)
|
||||
@ -1379,6 +1380,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_filebrowser_settings);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_filebrowser_open_uwp_permissions);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_ADD_TO_FAVORITES:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_add_to_favorites);
|
||||
break;
|
||||
|
@ -823,6 +823,8 @@ enum msg_hash_enums
|
||||
|
||||
MENU_LABEL(PARENT_DIRECTORY),
|
||||
|
||||
MENU_LABEL(FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
|
||||
MENU_ENUM_LABEL_CONTENT_ACTIONS,
|
||||
|
||||
/* Menu settings */
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap mp rescap">
|
||||
<Identity Name="1e4cf179-f3c2-404f-b9f3-cb2070a5aad8" Publisher="CN=krzys" Version="1.0.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="1e4cf179-f3c2-404f-b9f3-cb2070a5aad8" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
@ -25,5 +25,6 @@
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
<Capability Name="internetClientServer" />
|
||||
<rescap:Capability Name="broadFileSystemAccess" />
|
||||
</Capabilities>
|
||||
</Package>
|
||||
|
@ -26,6 +26,8 @@ extern char uwp_dir_install[PATH_MAX_LENGTH];
|
||||
extern char uwp_dir_data[PATH_MAX_LENGTH];
|
||||
extern char uwp_device_family[128];
|
||||
|
||||
void uwp_open_broadfilesystemaccess_settings(void);
|
||||
|
||||
void* uwp_get_corewindow(void);
|
||||
|
||||
void uwp_input_next_frame(void);
|
||||
|
@ -627,4 +627,9 @@ extern "C" {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uwp_open_broadfilesystemaccess_settings(void)
|
||||
{
|
||||
Windows::System::Launcher::LaunchUriAsync(ref new Uri("ms-settings:privacy-broadfilesystemaccess"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user