mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-01 14:31:54 +00:00
settings Cleanups
This commit is contained in:
parent
50c3673dfc
commit
0ef1b342e4
@ -802,11 +802,13 @@ static void gfx_ctx_wgl_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#if _WIN32_WINNT >= 0x0501
|
||||
const char *input_driver = settings->arrays.input_driver;
|
||||
|
||||
/* winraw only available since XP */
|
||||
if (string_is_equal(settings->arrays.input_driver, "raw"))
|
||||
if (string_is_equal(input_driver, "raw"))
|
||||
{
|
||||
*input_data = input_winraw.init(joypad_name);
|
||||
if (*input_data)
|
||||
|
@ -1120,11 +1120,12 @@ static void gfx_ctx_x_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
input_driver_t **input, void **input_data)
|
||||
{
|
||||
void *x_input = NULL;
|
||||
void *x_input = NULL;
|
||||
#ifdef HAVE_UDEV
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *input_driver = settings->arrays.input_driver;
|
||||
|
||||
if (string_is_equal(settings->arrays.input_driver, "udev"))
|
||||
if (string_is_equal(input_driver, "udev"))
|
||||
{
|
||||
*input_data = input_udev.init(joypad_name);
|
||||
if (*input_data)
|
||||
|
@ -35,10 +35,13 @@ int action_cancel_pop_default(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
size_t new_selection_ptr;
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_label = NULL;
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (settings->bools.audio_enable_menu && settings->bools.audio_enable_menu_cancel)
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool audio_enable_menu = settings->bools.audio_enable_menu;
|
||||
bool audio_enable_menu_cancel = settings->bools.audio_enable_menu_cancel;
|
||||
|
||||
if (audio_enable_menu && audio_enable_menu_cancel)
|
||||
audio_driver_mixer_play_menu_sound(AUDIO_MIXER_SYSTEM_SLOT_CANCEL);
|
||||
#endif
|
||||
|
||||
|
@ -261,11 +261,16 @@ static int deferred_push_cursor_manager_list_deferred(
|
||||
rdb_path[0] = '\0';
|
||||
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (settings)
|
||||
{
|
||||
const char *path_content_database =
|
||||
settings->paths.path_content_database;
|
||||
|
||||
fill_pathname_join(rdb_path,
|
||||
settings->paths.path_content_database,
|
||||
path_content_database,
|
||||
rdb, sizeof(rdb_path));
|
||||
}
|
||||
}
|
||||
|
||||
if (!string_is_empty(info->path_b))
|
||||
@ -392,10 +397,14 @@ end:
|
||||
static int general_push(menu_displaylist_info_t *info,
|
||||
unsigned id, enum menu_displaylist_ctl_state state)
|
||||
{
|
||||
char *newstring2 = NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
char *newstring2 = NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
bool
|
||||
multimedia_builtin_mediaplayer_enable = settings->bools.multimedia_builtin_mediaplayer_enable;
|
||||
bool multimedia_builtin_imageviewer_enable = settings->bools.multimedia_builtin_imageviewer_enable;
|
||||
bool filter_by_current_core = settings->bools.filter_by_current_core;
|
||||
|
||||
if (!menu)
|
||||
return menu_cbs_exit();
|
||||
@ -542,16 +551,18 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
}
|
||||
}
|
||||
|
||||
if (!settings->bools.filter_by_current_core)
|
||||
if (!filter_by_current_core)
|
||||
{
|
||||
if (list && !string_is_empty(list->all_ext))
|
||||
{
|
||||
unsigned x;
|
||||
struct string_list *str_list = string_split(list->all_ext, "|");
|
||||
struct string_list *str_list = string_split(
|
||||
list->all_ext, "|");
|
||||
|
||||
for (x = 0; x < str_list->size; x++)
|
||||
{
|
||||
if (!string_list_find_elem(str_list2, str_list->elems[x].data))
|
||||
if (!string_list_find_elem(str_list2,
|
||||
str_list->elems[x].data))
|
||||
{
|
||||
const char *elem = str_list->elems[x].data;
|
||||
string_list_append(str_list2, elem, attr);
|
||||
@ -587,14 +598,14 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
break;
|
||||
}
|
||||
|
||||
if (settings->bools.multimedia_builtin_mediaplayer_enable ||
|
||||
settings->bools.multimedia_builtin_imageviewer_enable)
|
||||
if (multimedia_builtin_mediaplayer_enable ||
|
||||
multimedia_builtin_imageviewer_enable)
|
||||
{
|
||||
struct retro_system_info sysinfo = {0};
|
||||
|
||||
(void)sysinfo;
|
||||
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
|
||||
if (settings->bools.multimedia_builtin_mediaplayer_enable)
|
||||
if (multimedia_builtin_mediaplayer_enable)
|
||||
{
|
||||
#if defined(HAVE_FFMPEG)
|
||||
libretro_ffmpeg_retro_get_system_info(&sysinfo);
|
||||
@ -607,7 +618,7 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
if (settings->bools.multimedia_builtin_imageviewer_enable)
|
||||
if (multimedia_builtin_imageviewer_enable)
|
||||
{
|
||||
libretro_imageviewer_retro_get_system_info(&sysinfo);
|
||||
strlcat(newstring2, "|", PATH_MAX_LENGTH * sizeof(char));
|
||||
|
@ -245,7 +245,7 @@ static void menu_action_setting_disp_set_label_shader_watch_for_changes(
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool shader_watch_files = settings ? settings->bools.video_shader_watch_files: false;
|
||||
bool shader_watch_files = settings->bools.video_shader_watch_files;
|
||||
|
||||
*s = '\0';
|
||||
*w = 19;
|
||||
@ -307,6 +307,7 @@ static void menu_action_setting_disp_set_label_shader_default_filter(
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool video_smooth = false;
|
||||
|
||||
*s = '\0';
|
||||
*w = 19;
|
||||
@ -314,7 +315,9 @@ static void menu_action_setting_disp_set_label_shader_default_filter(
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
if (settings->bools.video_smooth)
|
||||
video_smooth = settings->bools.video_smooth;
|
||||
|
||||
if (video_smooth)
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LINEAR), len);
|
||||
else
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NEAREST), len);
|
||||
|
@ -35,10 +35,12 @@
|
||||
static int action_info_default(unsigned type, const char *label)
|
||||
{
|
||||
menu_displaylist_info_t info;
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool audio_enable_menu = settings->bools.audio_enable_menu;
|
||||
bool audio_enable_menu_notice = settings->bools.audio_enable_menu_notice;
|
||||
#endif
|
||||
|
||||
menu_displaylist_info_init(&info);
|
||||
@ -53,7 +55,7 @@ static int action_info_default(unsigned type, const char *label)
|
||||
goto error;
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (settings->bools.audio_enable_menu && settings->bools.audio_enable_menu_notice)
|
||||
if (audio_enable_menu && audio_enable_menu_notice)
|
||||
audio_driver_mixer_play_menu_sound(AUDIO_MIXER_SYSTEM_SLOT_NOTICE);
|
||||
#endif
|
||||
|
||||
|
@ -3339,8 +3339,8 @@ static int action_ok_set_switch_cpu_profile(const char *path,
|
||||
system(command);
|
||||
snprintf(command, sizeof(command), "Current profile set to %s", profile_name);
|
||||
#else
|
||||
unsigned profile_clock = SWITCH_CPU_SPEEDS_VALUES[entry_idx];
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned profile_clock = SWITCH_CPU_SPEEDS_VALUES[entry_idx];
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
settings->uints.libnx_overclock = entry_idx;
|
||||
|
||||
@ -4153,7 +4153,7 @@ void cb_generic_download(retro_task_t *task,
|
||||
case MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD:
|
||||
dir_path = settings->paths.directory_core_assets;
|
||||
#if defined(HAVE_COMPRESSION) && defined(HAVE_ZLIB)
|
||||
extract = settings->bools.network_buildbot_auto_extract_archive;
|
||||
extract = settings->bools.network_buildbot_auto_extract_archive;
|
||||
#endif
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CB_UPDATE_CORE_INFO_FILES:
|
||||
|
@ -730,20 +730,20 @@ static void handle_play_spectate(netplay_t *netplay, uint32_t client_num,
|
||||
case NETPLAY_CMD_PLAY:
|
||||
{
|
||||
uint32_t mode, devices = 0, device;
|
||||
uint8_t share_mode;
|
||||
bool slave = false;
|
||||
uint8_t share_mode = 0;
|
||||
bool slave = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (cmd_size != sizeof(uint32_t) || !in_payload)
|
||||
return;
|
||||
mode = ntohl(in_payload[0]);
|
||||
mode = ntohl(in_payload[0]);
|
||||
|
||||
/* Check the requested mode */
|
||||
slave = (mode&NETPLAY_CMD_PLAY_BIT_SLAVE)?true:false;
|
||||
share_mode = (mode>>16)&0xFF;
|
||||
slave = (mode & NETPLAY_CMD_PLAY_BIT_SLAVE)?true:false;
|
||||
share_mode = (mode>>16) & 0xFF;
|
||||
|
||||
/* And the requested devices */
|
||||
devices = mode&0xFFFF;
|
||||
devices = mode & 0xFFFF;
|
||||
|
||||
/* Check if their slave mode request corresponds with what we allow */
|
||||
if (connection)
|
||||
@ -964,8 +964,8 @@ static bool netplay_get_cmd(netplay_t *netplay,
|
||||
return false;
|
||||
RECV(&client_num, sizeof(client_num))
|
||||
return false;
|
||||
frame_num = ntohl(frame_num);
|
||||
client_num = ntohl(client_num);
|
||||
frame_num = ntohl(frame_num);
|
||||
client_num = ntohl(client_num);
|
||||
client_num &= 0xFFFF;
|
||||
|
||||
if (netplay->is_server)
|
||||
@ -1246,8 +1246,9 @@ static bool netplay_get_cmd(netplay_t *netplay,
|
||||
if (frame < netplay->self_frame_count)
|
||||
netplay->force_rewind = true;
|
||||
|
||||
mode = ntohl(payload[1]);
|
||||
mode = ntohl(payload[1]);
|
||||
client_num = mode & 0xFFFF;
|
||||
|
||||
if (client_num >= MAX_CLIENTS)
|
||||
{
|
||||
RARCH_ERR("Received NETPLAY_CMD_MODE for a higher player number than we support.\n");
|
||||
|
@ -1532,11 +1532,13 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *sys_info = runloop_get_system_info();
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
bool check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
|
||||
if (!content_info)
|
||||
return false;
|
||||
|
||||
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
content_ctx.check_firmware_before_loading = check_firmware_before_loading;
|
||||
content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL);
|
||||
content_ctx.is_bps_pref = rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL);
|
||||
content_ctx.is_ups_pref = rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL);
|
||||
@ -1565,8 +1567,8 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
|
||||
content_ctx.name_ups = strdup(global->name.ups);
|
||||
}
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_system))
|
||||
content_ctx.directory_system = strdup(settings->paths.directory_system);
|
||||
if (!string_is_empty(path_dir_system))
|
||||
content_ctx.directory_system = strdup(path_dir_system);
|
||||
|
||||
if (!content_info->environ_get)
|
||||
content_info->environ_get = menu_content_environment_get;
|
||||
@ -1625,6 +1627,7 @@ bool task_push_load_content_from_playlist_from_menu(
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *sys_info = runloop_get_system_info();
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
|
||||
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL);
|
||||
@ -1659,8 +1662,8 @@ bool task_push_load_content_from_playlist_from_menu(
|
||||
global->name.label[0] = '\0';
|
||||
}
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_system))
|
||||
content_ctx.directory_system = strdup(settings->paths.directory_system);
|
||||
if (!string_is_empty(path_dir_system))
|
||||
content_ctx.directory_system = strdup(path_dir_system);
|
||||
|
||||
path_set(RARCH_PATH_CORE, core_path);
|
||||
|
||||
@ -1723,11 +1726,13 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
|
||||
char *error_string = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
bool check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
|
||||
if (!content_info)
|
||||
return false;
|
||||
|
||||
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
content_ctx.check_firmware_before_loading = check_firmware_before_loading;
|
||||
content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL);
|
||||
content_ctx.is_bps_pref = rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL);
|
||||
content_ctx.is_ups_pref = rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL);
|
||||
@ -1756,8 +1761,8 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
|
||||
content_ctx.name_ups = strdup(global->name.ups);
|
||||
}
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_system))
|
||||
content_ctx.directory_system = strdup(settings->paths.directory_system);
|
||||
if (!string_is_empty(path_dir_system))
|
||||
content_ctx.directory_system = strdup(path_dir_system);
|
||||
|
||||
if (!content_info->environ_get)
|
||||
content_info->environ_get = menu_content_environment_get;
|
||||
@ -1850,8 +1855,10 @@ bool task_push_load_content_with_new_core_from_menu(
|
||||
char *error_string = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
|
||||
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
content_ctx.check_firmware_before_loading = check_firmware_before_loading;
|
||||
content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL);
|
||||
content_ctx.is_bps_pref = rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL);
|
||||
content_ctx.is_ups_pref = rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL);
|
||||
@ -1882,8 +1889,8 @@ bool task_push_load_content_with_new_core_from_menu(
|
||||
global->name.label[0] = '\0';
|
||||
}
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_system))
|
||||
content_ctx.directory_system = strdup(settings->paths.directory_system);
|
||||
if (!string_is_empty(path_dir_system))
|
||||
content_ctx.directory_system = strdup(path_dir_system);
|
||||
|
||||
path_set(RARCH_PATH_CONTENT, fullpath);
|
||||
path_set(RARCH_PATH_CORE, core_path);
|
||||
@ -1950,10 +1957,14 @@ static bool task_load_content_callback(content_ctx_info_t *content_info,
|
||||
bool ret = false;
|
||||
char *error_string = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *sys_info = runloop_get_system_info();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
bool set_supports_no_game_enable = settings->bools.set_supports_no_game_enable;
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
const char *path_dir_cache = settings->paths.directory_cache;
|
||||
|
||||
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
content_ctx.check_firmware_before_loading = check_firmware_before_loading;
|
||||
content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL);
|
||||
content_ctx.is_bps_pref = rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL);
|
||||
content_ctx.is_ups_pref = rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL);
|
||||
@ -1976,12 +1987,12 @@ static bool task_load_content_callback(content_ctx_info_t *content_info,
|
||||
{
|
||||
struct retro_system_info *system = runloop_get_libretro_system_info();
|
||||
|
||||
content_ctx.set_supports_no_game_enable = settings->bools.set_supports_no_game_enable;
|
||||
content_ctx.set_supports_no_game_enable = set_supports_no_game_enable;
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_system))
|
||||
content_ctx.directory_system = strdup(settings->paths.directory_system);
|
||||
if (!string_is_empty(settings->paths.directory_cache))
|
||||
content_ctx.directory_cache = strdup(settings->paths.directory_cache);
|
||||
if (!string_is_empty(path_dir_system))
|
||||
content_ctx.directory_system = strdup(path_dir_system);
|
||||
if (!string_is_empty(path_dir_cache))
|
||||
content_ctx.directory_cache = strdup(path_dir_cache);
|
||||
if (!string_is_empty(system->valid_extensions))
|
||||
content_ctx.valid_extensions = strdup(system->valid_extensions);
|
||||
|
||||
@ -2002,8 +2013,8 @@ static bool task_load_content_callback(content_ctx_info_t *content_info,
|
||||
content_ctx.name_ups = strdup(global->name.ups);
|
||||
}
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_system))
|
||||
content_ctx.directory_system = strdup(settings->paths.directory_system);
|
||||
if (!string_is_empty(path_dir_system))
|
||||
content_ctx.directory_system = strdup(path_dir_system);
|
||||
|
||||
if (!content_info->environ_get)
|
||||
content_info->environ_get = menu_content_environment_get;
|
||||
@ -2424,12 +2435,16 @@ bool content_init(void)
|
||||
char *error_string = NULL;
|
||||
struct string_list *content = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *sys_info = runloop_get_system_info();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
bool set_supports_no_game_enable = settings->bools.set_supports_no_game_enable;
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
const char *path_dir_cache = settings->paths.directory_cache;
|
||||
|
||||
temporary_content = string_list_new();
|
||||
|
||||
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
content_ctx.check_firmware_before_loading = check_firmware_before_loading;
|
||||
content_ctx.patch_is_blocked = rarch_ctl(RARCH_CTL_IS_PATCH_BLOCKED, NULL);
|
||||
content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL);
|
||||
content_ctx.is_bps_pref = rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL);
|
||||
@ -2462,12 +2477,12 @@ bool content_init(void)
|
||||
{
|
||||
struct retro_system_info *system = runloop_get_libretro_system_info();
|
||||
|
||||
content_ctx.set_supports_no_game_enable = settings->bools.set_supports_no_game_enable;
|
||||
content_ctx.set_supports_no_game_enable = set_supports_no_game_enable;
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_system))
|
||||
content_ctx.directory_system = strdup(settings->paths.directory_system);
|
||||
if (!string_is_empty(settings->paths.directory_cache))
|
||||
content_ctx.directory_cache = strdup(settings->paths.directory_cache);
|
||||
if (!string_is_empty(path_dir_system))
|
||||
content_ctx.directory_system = strdup(path_dir_system);
|
||||
if (!string_is_empty(path_dir_cache))
|
||||
content_ctx.directory_cache = strdup(path_dir_cache);
|
||||
if (!string_is_empty(system->valid_extensions))
|
||||
content_ctx.valid_extensions = strdup(system->valid_extensions);
|
||||
|
||||
|
@ -567,11 +567,14 @@ static void cb_task_pl_entry_thumbnail_refresh_menu(
|
||||
playlist_t *current_playlist = playlist_get_cached();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *menu_driver = NULL;
|
||||
|
||||
if (!task || !settings)
|
||||
return;
|
||||
|
||||
pl_thumb = (pl_thumb_handle_t*)task->state;
|
||||
|
||||
menu_driver = settings->arrays.menu_driver;
|
||||
pl_thumb = (pl_thumb_handle_t*)task->state;
|
||||
|
||||
if (!pl_thumb || !pl_thumb->thumbnail_path_data)
|
||||
return;
|
||||
|
||||
@ -592,7 +595,7 @@ static void cb_task_pl_entry_thumbnail_refresh_menu(
|
||||
return;
|
||||
|
||||
#ifdef HAVE_MATERIALUI
|
||||
if (string_is_equal(settings->arrays.menu_driver, "glui"))
|
||||
if (string_is_equal(menu_driver, "glui"))
|
||||
{
|
||||
if (!string_is_equal(pl_thumb->playlist_path,
|
||||
playlist_get_conf_path(current_playlist)))
|
||||
@ -802,13 +805,16 @@ bool task_push_pl_entry_thumbnail_download(
|
||||
pl_thumb_handle_t *pl_thumb = (pl_thumb_handle_t*)calloc(1, sizeof(pl_thumb_handle_t));
|
||||
pl_entry_id_t *entry_id = (pl_entry_id_t*)calloc(1, sizeof(pl_entry_id_t));
|
||||
char *playlist_path = NULL;
|
||||
const char *dir_thumbnails = NULL;
|
||||
|
||||
/* Sanity check */
|
||||
if (!settings || !task || !pl_thumb || !playlist || !entry_id)
|
||||
goto error;
|
||||
|
||||
dir_thumbnails = settings->paths.directory_thumbnails;
|
||||
|
||||
if (string_is_empty(system) ||
|
||||
string_is_empty(settings->paths.directory_thumbnails) ||
|
||||
string_is_empty(dir_thumbnails) ||
|
||||
string_is_empty(playlist_get_conf_path(playlist)))
|
||||
goto error;
|
||||
|
||||
@ -852,7 +858,7 @@ bool task_push_pl_entry_thumbnail_download(
|
||||
/* Configure handle */
|
||||
pl_thumb->system = strdup(system);
|
||||
pl_thumb->playlist_path = playlist_path;
|
||||
pl_thumb->dir_thumbnails = strdup(settings->paths.directory_thumbnails);
|
||||
pl_thumb->dir_thumbnails = strdup(dir_thumbnails);
|
||||
pl_thumb->playlist = playlist;
|
||||
pl_thumb->thumbnail_path_data = NULL;
|
||||
pl_thumb->http_task = NULL;
|
||||
|
@ -384,6 +384,7 @@ bool content_undo_load_state(void)
|
||||
void* temp_data = NULL;
|
||||
struct sram_block *blocks = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool block_sram_overwrite = settings->bools.block_sram_overwrite;
|
||||
|
||||
RARCH_LOG("%s: \"%s\".\n",
|
||||
msg_hash_to_str(MSG_LOADING_STATE),
|
||||
@ -398,7 +399,7 @@ bool content_undo_load_state(void)
|
||||
* the backing up of it and
|
||||
* its flushing could all be in their
|
||||
* own functions... */
|
||||
if (settings->bools.block_sram_overwrite && task_save_files
|
||||
if (block_sram_overwrite && task_save_files
|
||||
&& task_save_files->size)
|
||||
{
|
||||
RARCH_LOG("%s.\n",
|
||||
@ -904,6 +905,7 @@ static void content_load_state_cb(retro_task_t *task,
|
||||
void *buf = load_data->data;
|
||||
struct sram_block *blocks = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool block_sram_overwrite = settings->bools.block_sram_overwrite;
|
||||
|
||||
RARCH_LOG("%s: \"%s\".\n",
|
||||
msg_hash_to_str(MSG_LOADING_STATE),
|
||||
@ -917,8 +919,9 @@ static void content_load_state_cb(retro_task_t *task,
|
||||
(unsigned)size,
|
||||
msg_hash_to_str(MSG_BYTES));
|
||||
|
||||
/* This means we're backing up the file in memory, so content_undo_save_state()
|
||||
can restore it */
|
||||
/* This means we're backing up the file in memory,
|
||||
* so content_undo_save_state()
|
||||
* can restore it */
|
||||
if (load_data->load_to_backup_buffer)
|
||||
{
|
||||
/* If we were previously backing up a file, let go of it first */
|
||||
@ -941,7 +944,7 @@ static void content_load_state_cb(retro_task_t *task,
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings->bools.block_sram_overwrite && task_save_files
|
||||
if (block_sram_overwrite && task_save_files
|
||||
&& task_save_files->size)
|
||||
{
|
||||
RARCH_LOG("%s.\n",
|
||||
@ -1045,12 +1048,13 @@ static void save_state_cb(retro_task_t *task,
|
||||
void *task_data,
|
||||
void *user_data, const char *error)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
save_task_state_t *state = (save_task_state_t*)task_data;
|
||||
char *path = strdup(state->path);
|
||||
save_task_state_t *state = (save_task_state_t*)task_data;
|
||||
char *path = strdup(state->path);
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *dir_screenshot = settings->paths.directory_screenshot;
|
||||
|
||||
if (state->thumbnail_enable)
|
||||
take_screenshot(settings->paths.directory_screenshot,
|
||||
take_screenshot(dir_screenshot,
|
||||
path, true, state->has_valid_framebuffer, false, true);
|
||||
|
||||
free(path);
|
||||
@ -1067,20 +1071,22 @@ static void save_state_cb(retro_task_t *task,
|
||||
**/
|
||||
static void task_push_save_state(const char *path, void *data, size_t size, bool autosave)
|
||||
{
|
||||
retro_task_t *task = task_init();
|
||||
save_task_state_t *state = (save_task_state_t*)calloc(1, sizeof(*state));
|
||||
settings_t *settings = config_get_ptr();
|
||||
retro_task_t *task = task_init();
|
||||
save_task_state_t *state = (save_task_state_t*)calloc(1, sizeof(*state));
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool savestate_thumbnail_enable = settings->bools.savestate_thumbnail_enable;
|
||||
int state_slot = settings->ints.state_slot;
|
||||
|
||||
if (!task || !state)
|
||||
goto error;
|
||||
|
||||
strlcpy(state->path, path, sizeof(state->path));
|
||||
state->data = data;
|
||||
state->size = size;
|
||||
state->autosave = autosave;
|
||||
state->mute = autosave; /* don't show OSD messages if we are auto-saving */
|
||||
state->thumbnail_enable = settings->bools.savestate_thumbnail_enable;
|
||||
state->state_slot = settings->ints.state_slot;
|
||||
state->data = data;
|
||||
state->size = size;
|
||||
state->autosave = autosave;
|
||||
state->mute = autosave; /* don't show OSD messages if we are auto-saving */
|
||||
state->thumbnail_enable = savestate_thumbnail_enable;
|
||||
state->state_slot = state_slot;
|
||||
state->has_valid_framebuffer = video_driver_cached_frame_has_valid_framebuffer();
|
||||
|
||||
task->type = TASK_TYPE_BLOCKING;
|
||||
@ -1153,7 +1159,8 @@ static void task_push_load_and_save_state(const char *path, void *data,
|
||||
size_t size, bool load_to_backup_buffer, bool autosave)
|
||||
{
|
||||
retro_task_t *task = NULL;
|
||||
settings_t *settings = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
int state_slot = settings->ints.state_slot;
|
||||
save_task_state_t *state = (save_task_state_t*)
|
||||
calloc(1, sizeof(*state));
|
||||
|
||||
@ -1168,7 +1175,6 @@ static void task_push_load_and_save_state(const char *path, void *data,
|
||||
return;
|
||||
}
|
||||
|
||||
settings = config_get_ptr();
|
||||
|
||||
strlcpy(state->path, path, sizeof(state->path));
|
||||
state->load_to_backup_buffer = load_to_backup_buffer;
|
||||
@ -1179,7 +1185,7 @@ static void task_push_load_and_save_state(const char *path, void *data,
|
||||
are auto-saving */
|
||||
if (load_to_backup_buffer)
|
||||
state->mute = true;
|
||||
state->state_slot = settings->ints.state_slot;
|
||||
state->state_slot = state_slot;
|
||||
state->has_valid_framebuffer =
|
||||
video_driver_cached_frame_has_valid_framebuffer();
|
||||
|
||||
@ -1311,6 +1317,7 @@ bool content_load_state(const char *path,
|
||||
retro_task_t *task = task_init();
|
||||
save_task_state_t *state = (save_task_state_t*)calloc(1, sizeof(*state));
|
||||
settings_t *settings = config_get_ptr();
|
||||
int state_slot = settings->ints.state_slot;
|
||||
|
||||
if (!task || !state)
|
||||
goto error;
|
||||
@ -1318,7 +1325,7 @@ bool content_load_state(const char *path,
|
||||
strlcpy(state->path, path, sizeof(state->path));
|
||||
state->load_to_backup_buffer = load_to_backup_buffer;
|
||||
state->autoload = autoload;
|
||||
state->state_slot = settings->ints.state_slot;
|
||||
state->state_slot = state_slot;
|
||||
state->has_valid_framebuffer =
|
||||
video_driver_cached_frame_has_valid_framebuffer();
|
||||
|
||||
@ -1556,10 +1563,11 @@ bool content_save_ram_file(unsigned slot)
|
||||
bool event_save_files(bool is_sram_used)
|
||||
{
|
||||
unsigned i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_cheat_database = settings->paths.path_cheat_database;
|
||||
|
||||
cheat_manager_save_game_specific_cheats(
|
||||
settings->paths.path_cheat_database);
|
||||
path_cheat_database);
|
||||
if (!task_save_files || !is_sram_used)
|
||||
return false;
|
||||
|
||||
|
@ -669,6 +669,7 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UIBarButtonItem *item = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_core_enable = settings->bools.menu_core_enable;
|
||||
|
||||
[self reloadData];
|
||||
|
||||
@ -678,7 +679,7 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
item = [[UIBarButtonItem alloc] initWithCustomView:self.osdmessage];
|
||||
[self setToolbarItems: [NSArray arrayWithObject:item]];
|
||||
|
||||
if (settings->bools.menu_core_enable)
|
||||
if (menu_core_enable)
|
||||
{
|
||||
char title_msg[256];
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
@ -693,8 +694,9 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
RAMainMenu* __weak weakSelf = NULL;
|
||||
NSMutableArray *everything = [NSMutableArray array];
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_core_enable = settings->bools.menu_core_enable;
|
||||
|
||||
if (settings->bools.menu_core_enable)
|
||||
if (menu_core_enable)
|
||||
{
|
||||
char title_msg[256];
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
|
@ -229,7 +229,8 @@ AspectRatioGroup::AspectRatioGroup(const QString &title, QWidget *parent) :
|
||||
|
||||
void AspectRatioGroup::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
unsigned value = config_get_ptr()->uints.video_aspect_ratio_idx;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned value = settings->uints.video_aspect_ratio_idx;
|
||||
|
||||
if (ASPECT_RATIO_4_3 >= value || value <= ASPECT_RATIO_32_9)
|
||||
{
|
||||
@ -295,8 +296,11 @@ void VideoPage::onResolutionComboIndexChanged(const QString &text)
|
||||
|
||||
void CrtSwitchresPage::onCrtSuperResolutionComboIndexChanged(int index)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
Q_UNUSED(index)
|
||||
config_get_ptr()->uints.crt_switch_resolution_super = m_crtSuperResolutionCombo->currentData().value<unsigned>();
|
||||
|
||||
settings->uints.crt_switch_resolution_super =
|
||||
m_crtSuperResolutionCombo->currentData().value<unsigned>();
|
||||
}
|
||||
|
||||
AspectRatioRadioButton::AspectRatioRadioButton(unsigned min, unsigned max, QWidget *parent) :
|
||||
|
@ -29,9 +29,10 @@
|
||||
|
||||
static bool ui_browser_window_win32_core(ui_browser_window_state_t *state, bool save)
|
||||
{
|
||||
bool okay = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
OPENFILENAME ofn;
|
||||
bool okay = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool video_fullscreen = settings->bools.video_fullscreen;
|
||||
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = (HWND)state->window;
|
||||
@ -60,10 +61,8 @@ static bool ui_browser_window_win32_core(ui_browser_window_state_t *state, bool
|
||||
#endif
|
||||
|
||||
/* Full Screen: Show mouse for the file dialog */
|
||||
if (settings->bools.video_fullscreen)
|
||||
{
|
||||
if (video_fullscreen)
|
||||
video_driver_show_mouse();
|
||||
}
|
||||
|
||||
okay = true;
|
||||
if (!save && !GetOpenFileName(&ofn))
|
||||
@ -72,10 +71,8 @@ static bool ui_browser_window_win32_core(ui_browser_window_state_t *state, bool
|
||||
okay = false;
|
||||
|
||||
/* Full screen: Hide mouse after the file dialog */
|
||||
if (settings->bools.video_fullscreen)
|
||||
{
|
||||
if (video_fullscreen)
|
||||
video_driver_hide_mouse();
|
||||
}
|
||||
|
||||
return okay;
|
||||
}
|
||||
|
172
uwp/uwp_main.cpp
172
uwp/uwp_main.cpp
@ -241,11 +241,11 @@ App::App() :
|
||||
m_instance = this;
|
||||
}
|
||||
|
||||
// The first method called when the IFrameworkView is being created.
|
||||
/* 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.
|
||||
/* 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<CoreApplicationView^, IActivatedEventArgs^>(this, &App::OnActivated);
|
||||
|
||||
@ -256,7 +256,7 @@ void App::Initialize(CoreApplicationView^ applicationView)
|
||||
ref new EventHandler<Platform::Object^>(this, &App::OnResuming);
|
||||
}
|
||||
|
||||
// Called when the CoreWindow object is created (or re-created).
|
||||
/* Called when the CoreWindow object is created (or re-created). */
|
||||
void App::SetWindow(CoreWindow^ window)
|
||||
{
|
||||
window->SizeChanged +=
|
||||
@ -304,7 +304,7 @@ void App::SetWindow(CoreWindow^ window)
|
||||
ref new EventHandler<Windows::UI::Core::BackRequestedEventArgs^>(this, &App::OnBackRequested);
|
||||
}
|
||||
|
||||
// Initializes scene resources, or loads a previously saved app state.
|
||||
/* Initializes scene resources, or loads a previously saved app state. */
|
||||
void App::Load(Platform::String^ entryPoint)
|
||||
{
|
||||
int ret = rarch_main(NULL, NULL, NULL);
|
||||
@ -322,7 +322,7 @@ void App::Load(Platform::String^ entryPoint)
|
||||
ref new TypedEventHandler<PackageCatalog^, PackageInstallingEventArgs^>(this, &App::OnPackageInstalling);
|
||||
}
|
||||
|
||||
// This method is called after the window becomes active.
|
||||
/* This method is called after the window becomes active. */
|
||||
void App::Run()
|
||||
{
|
||||
bool x = false;
|
||||
@ -344,8 +344,10 @@ void App::Run()
|
||||
|
||||
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 */
|
||||
/* 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;
|
||||
}
|
||||
@ -355,53 +357,62 @@ void App::Run()
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
/* 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.
|
||||
/* Application lifecycle event handlers. */
|
||||
|
||||
void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
|
||||
{
|
||||
// Run() won't start until the CoreWindow is activated.
|
||||
/* 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.
|
||||
/* 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();
|
||||
auto app = this;
|
||||
auto app = this;
|
||||
|
||||
create_task([app, deferral]()
|
||||
{
|
||||
// TODO: Maybe creating a save state here would be a good idea?
|
||||
settings_t* settings = config_get_ptr();
|
||||
if (settings->bools.config_save_on_exit) {
|
||||
/* TODO: Maybe creating a save state here would be a good idea? */
|
||||
settings_t* settings = config_get_ptr();
|
||||
bool config_save_on_exit = settings->bools.config_save_on_exit;
|
||||
|
||||
if (config_save_on_exit)
|
||||
{
|
||||
if (!path_is_empty(RARCH_PATH_CONFIG))
|
||||
{
|
||||
const char* config_path = path_get(RARCH_PATH_CONFIG);
|
||||
bool path_exists = !string_is_empty(config_path);
|
||||
bool path_exists = !string_is_empty(config_path);
|
||||
|
||||
if (path_exists)
|
||||
{
|
||||
if (config_save_file(config_path))
|
||||
{
|
||||
RARCH_LOG("[config] %s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO),
|
||||
config_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_ERR("[config] %s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO),
|
||||
config_path);
|
||||
}
|
||||
}
|
||||
|
||||
if (path_exists && config_save_file(config_path))
|
||||
{
|
||||
RARCH_LOG("[config] %s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO),
|
||||
config_path);
|
||||
}
|
||||
else if (path_exists)
|
||||
{
|
||||
RARCH_ERR("[config] %s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO),
|
||||
config_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,9 +422,10 @@ void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
|
||||
|
||||
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.
|
||||
/* 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)
|
||||
@ -422,7 +434,7 @@ void App::OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackReque
|
||||
args->Handled = true;
|
||||
}
|
||||
|
||||
// Window event handlers.
|
||||
/* Window event handlers. */
|
||||
|
||||
void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
|
||||
{
|
||||
@ -539,7 +551,7 @@ void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
|
||||
m_windowClosed = true;
|
||||
}
|
||||
|
||||
// DisplayInformation event handlers.
|
||||
/* DisplayInformation event handlers. */
|
||||
|
||||
void App::OnDpiChanged(DisplayInformation^ sender, Object^ args)
|
||||
{
|
||||
@ -553,7 +565,7 @@ void App::OnOrientationChanged(DisplayInformation^ sender, Object^ args)
|
||||
|
||||
void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args)
|
||||
{
|
||||
// Probably can be ignored?
|
||||
/* Probably can be ignored? */
|
||||
}
|
||||
|
||||
void App::OnPackageInstalling(PackageCatalog^ sender, PackageInstallingEventArgs^ args)
|
||||
@ -567,7 +579,7 @@ void App::OnPackageInstalling(PackageCatalog^ sender, PackageInstallingEventArgs
|
||||
}
|
||||
}
|
||||
|
||||
// Implement UWP equivalents of various win32_* functions
|
||||
/* Implement UWP equivalents of various win32_* functions */
|
||||
extern "C" {
|
||||
|
||||
bool win32_has_focus(void *data)
|
||||
@ -687,18 +699,20 @@ extern "C" {
|
||||
}
|
||||
|
||||
bool uwp_keyboard_pressed(unsigned key)
|
||||
{
|
||||
VirtualKey sym = (VirtualKey)rarch_keysym_lut[(enum retro_key)key];
|
||||
if (sym == VirtualKey::None) return false;
|
||||
CoreWindow^ window = CoreWindow::GetForCurrentThread();
|
||||
if (!window)
|
||||
{
|
||||
// At times CoreWindow will return NULL while running Dolphin core
|
||||
// Dolphin core runs on its own CPU thread separate from the UI-thread and so we must do a check for this.
|
||||
return false;
|
||||
}
|
||||
return (window->GetKeyState(sym) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down;
|
||||
}
|
||||
{
|
||||
VirtualKey sym = (VirtualKey)rarch_keysym_lut[(enum retro_key)key];
|
||||
|
||||
if (sym == VirtualKey::None)
|
||||
return false;
|
||||
|
||||
CoreWindow^ window = CoreWindow::GetForCurrentThread();
|
||||
|
||||
/* At times CoreWindow will return NULL while running Dolphin core
|
||||
* Dolphin core runs on its own CPU thread separate from the UI-thread and so we must do a check for this. */
|
||||
if (!window)
|
||||
return false;
|
||||
return (window->GetKeyState(sym) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down;
|
||||
}
|
||||
|
||||
int16_t uwp_mouse_state(unsigned port, unsigned id, bool screen)
|
||||
{
|
||||
@ -707,9 +721,13 @@ extern "C" {
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_MOUSE_X:
|
||||
return screen ? uwp_current_input.mouse_screen_x : uwp_current_input.mouse_rel_x;
|
||||
return screen
|
||||
? uwp_current_input.mouse_screen_x
|
||||
: uwp_current_input.mouse_rel_x;
|
||||
case RETRO_DEVICE_ID_MOUSE_Y:
|
||||
return screen ? uwp_current_input.mouse_screen_y : uwp_current_input.mouse_rel_y;
|
||||
return screen
|
||||
? uwp_current_input.mouse_screen_y
|
||||
: uwp_current_input.mouse_rel_y;
|
||||
case RETRO_DEVICE_ID_MOUSE_LEFT:
|
||||
return uwp_current_input.mouse_left;
|
||||
case RETRO_DEVICE_ID_MOUSE_RIGHT:
|
||||
@ -736,18 +754,22 @@ extern "C" {
|
||||
int16_t uwp_pointer_state(unsigned idx, unsigned id, bool screen)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_POINTER_X:
|
||||
return screen ? uwp_current_input.touch[idx].full_x : uwp_current_input.touch[idx].x;
|
||||
case RETRO_DEVICE_ID_POINTER_Y:
|
||||
return screen ? uwp_current_input.touch[idx].full_y : uwp_current_input.touch[idx].y;
|
||||
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
||||
return uwp_current_input.touch[idx].isInContact;
|
||||
case RETRO_DEVICE_ID_POINTER_COUNT:
|
||||
return uwp_current_input.touch_count;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
{
|
||||
case RETRO_DEVICE_ID_POINTER_X:
|
||||
return screen
|
||||
? uwp_current_input.touch[idx].full_x
|
||||
: uwp_current_input.touch[idx].x;
|
||||
case RETRO_DEVICE_ID_POINTER_Y:
|
||||
return screen
|
||||
? uwp_current_input.touch[idx].full_y
|
||||
: uwp_current_input.touch[idx].y;
|
||||
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
||||
return uwp_current_input.touch[idx].isInContact;
|
||||
case RETRO_DEVICE_ID_POINTER_COUNT:
|
||||
return uwp_current_input.touch_count;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -757,7 +779,7 @@ extern "C" {
|
||||
Windows::System::Launcher::LaunchUriAsync(ref new Uri("ms-settings:privacy-broadfilesystemaccess"));
|
||||
}
|
||||
|
||||
enum retro_language uwp_get_language()
|
||||
enum retro_language uwp_get_language(void)
|
||||
{
|
||||
string_list* split = NULL;
|
||||
auto lang = Windows::System::UserProfile::GlobalizationPreferences::Languages->GetAt(0);
|
||||
@ -781,7 +803,7 @@ extern "C" {
|
||||
return rarch_get_language_from_iso(lang_iso);
|
||||
}
|
||||
|
||||
const char *uwp_get_cpu_model_name()
|
||||
const char *uwp_get_cpu_model_name(void)
|
||||
{
|
||||
Platform::String^ cpu_id = nullptr;
|
||||
Platform::String^ cpu_name = nullptr;
|
||||
@ -817,12 +839,10 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
if (cpu_name)
|
||||
{
|
||||
wcstombs(win32_cpu_model_name, cpu_name->Data(), 128);
|
||||
return win32_cpu_model_name;
|
||||
}
|
||||
else
|
||||
return "Unknown";
|
||||
if (!cpu_name)
|
||||
return "Unknown";
|
||||
|
||||
wcstombs(win32_cpu_model_name, cpu_name->Data(), 128);
|
||||
return win32_cpu_model_name;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user