RetroArch/menu/cbs/menu_cbs_ok.c

4775 lines
167 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
2017-01-22 13:40:32 +01:00
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2017 - Brad Parker
2017-08-05 00:37:26 -05:00
* Copyright (C) 2015-2017 - Andrés Suárez
*
* 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 <http://www.gnu.org/licenses/>.
*/
2016-09-01 18:01:41 +02:00
#include <compat/strl.h>
#include <file/file_path.h>
2016-02-05 13:51:30 +01:00
#include <retro_assert.h>
#include <string/stdstring.h>
#include <streams/file_stream.h>
#include <lists/string_list.h>
2016-09-08 05:39:08 +02:00
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
2015-12-06 17:55:27 +01:00
#include "../menu_driver.h"
2015-06-26 15:28:01 +02:00
#include "../menu_cbs.h"
#include "../menu_setting.h"
#include "../menu_shader.h"
#include "../widgets/menu_dialog.h"
#include "../widgets/menu_filebrowser.h"
2016-09-15 19:23:32 +02:00
#include "../widgets/menu_input_dialog.h"
#include "../menu_networking.h"
#include "../menu_content.h"
2017-01-09 03:53:55 +01:00
#include "../menu_shader.h"
2016-09-06 06:11:44 +02:00
#include "../../core.h"
2016-09-01 18:01:41 +02:00
#include "../../configuration.h"
#include "../../core_info.h"
2016-02-05 19:00:30 +01:00
#include "../../frontend/frontend_driver.h"
2015-12-06 22:48:57 +01:00
#include "../../defaults.h"
#include "../../managers/cheat_manager.h"
#include "../../tasks/tasks_internal.h"
#include "../../input/input_remapping.h"
2016-09-17 13:40:25 +02:00
#include "../../paths.h"
2016-03-21 19:23:45 +01:00
#include "../../retroarch.h"
2016-09-01 18:01:41 +02:00
#include "../../verbosity.h"
2016-03-23 21:40:41 +07:00
#include "../../lakka.h"
2016-09-22 16:44:51 +02:00
#include "../../wifi/wifi_driver.h"
#include <net/net_http.h>
2016-09-29 21:07:10 +02:00
#ifdef HAVE_NETWORKING
#include "../../network/netplay/netplay.h"
2016-12-02 22:40:26 -05:00
#include "../../network/netplay/netplay_discovery.h"
#endif
enum
{
ACTION_OK_LOAD_PRESET = 0,
ACTION_OK_LOAD_SHADER_PASS,
ACTION_OK_LOAD_RECORD_CONFIGFILE,
ACTION_OK_LOAD_REMAPPING_FILE,
ACTION_OK_LOAD_CHEAT_FILE,
ACTION_OK_APPEND_DISK_IMAGE,
ACTION_OK_SUBSYSTEM_ADD,
ACTION_OK_LOAD_CONFIG_FILE,
ACTION_OK_LOAD_CORE,
ACTION_OK_LOAD_WALLPAPER,
ACTION_OK_SET_PATH,
ACTION_OK_SET_PATH_AUDIO_FILTER,
ACTION_OK_SET_PATH_VIDEO_FILTER,
ACTION_OK_SET_PATH_OVERLAY,
ACTION_OK_SET_DIRECTORY
};
2017-09-11 03:01:33 +02:00
enum
{
ACTION_OK_REMAP_FILE_SAVE_CORE = 0,
ACTION_OK_REMAP_FILE_SAVE_GAME,
ACTION_OK_REMAP_FILE_REMOVE_CORE,
ACTION_OK_REMAP_FILE_REMOVE_GAME
};
#ifndef BIND_ACTION_OK
#define BIND_ACTION_OK(cbs, name) \
2016-06-27 21:34:05 +02:00
do { \
cbs->action_ok = name; \
cbs->action_ok_ident = #name; \
} while(0)
#endif
2017-01-17 15:39:14 +01:00
#ifdef HAVE_NETWORKING
2016-11-16 07:11:00 +01:00
#ifdef HAVE_LAKKA
static char *lakka_get_project(void)
2016-11-15 10:18:21 +01:00
{
2016-11-16 07:17:04 +01:00
size_t len;
2017-09-11 03:03:33 +02:00
static char lakka_project[128];
2016-11-16 07:17:04 +01:00
FILE *command_file = popen("cat /etc/release | cut -d - -f 1", "r");
2016-11-15 10:18:21 +01:00
fgets(lakka_project, sizeof(lakka_project), command_file);
2016-11-16 07:17:04 +01:00
len = strlen(lakka_project);
2016-11-15 10:18:21 +01:00
if (len > 0 && lakka_project[len-1] == '\n')
lakka_project[--len] = '\0';
2016-11-16 07:17:04 +01:00
2016-11-15 10:18:21 +01:00
pclose(command_file);
return lakka_project;
}
2016-11-16 07:11:00 +01:00
#endif
#endif
2018-01-12 04:18:53 +01:00
#define action_ok_dl_lbl(a, b) \
info.directory_ptr = idx; \
info.type = type; \
info_path = path; \
info_label = msg_hash_to_str(a); \
info.enum_idx = a; \
dl_type = b;
2018-01-15 21:44:34 +01:00
static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
2018-01-12 04:18:53 +01:00
{
switch (lbl)
{
case ACTION_OK_DL_ACCOUNTS_LIST:
return MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_LIST;
case ACTION_OK_DL_INPUT_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_INPUT_SETTINGS_LIST;
case ACTION_OK_DL_DRIVER_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_DRIVER_SETTINGS_LIST;
case ACTION_OK_DL_CORE_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST;
case ACTION_OK_DL_VIDEO_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_VIDEO_SETTINGS_LIST;
case ACTION_OK_DL_CONFIGURATION_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_CONFIGURATION_SETTINGS_LIST;
case ACTION_OK_DL_SAVING_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_SAVING_SETTINGS_LIST;
case ACTION_OK_DL_LOGGING_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_LOGGING_SETTINGS_LIST;
case ACTION_OK_DL_FRAME_THROTTLE_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_FRAME_THROTTLE_SETTINGS_LIST;
case ACTION_OK_DL_REWIND_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_REWIND_SETTINGS_LIST;
case ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST;
case ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST;
2018-01-12 04:42:44 +01:00
case ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST;
case ACTION_OK_DL_MENU_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST;
case ACTION_OK_DL_MENU_VIEWS_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_MENU_VIEWS_SETTINGS_LIST;
case ACTION_OK_DL_QUICK_MENU_VIEWS_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_QUICK_MENU_VIEWS_SETTINGS_LIST;
case ACTION_OK_DL_USER_INTERFACE_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_USER_INTERFACE_SETTINGS_LIST;
case ACTION_OK_DL_MENU_FILE_BROWSER_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_MENU_FILE_BROWSER_SETTINGS_LIST;
case ACTION_OK_DL_RETRO_ACHIEVEMENTS_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST;
case ACTION_OK_DL_UPDATER_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST;
case ACTION_OK_DL_NETWORK_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST;
case ACTION_OK_DL_WIFI_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST;
case ACTION_OK_DL_NETPLAY:
return MENU_ENUM_LABEL_DEFERRED_NETPLAY;
case ACTION_OK_DL_NETPLAY_LAN_SCAN_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST;
case ACTION_OK_DL_LAKKA_SERVICES_LIST:
return MENU_ENUM_LABEL_DEFERRED_LAKKA_SERVICES_LIST;
case ACTION_OK_DL_USER_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_USER_SETTINGS_LIST;
case ACTION_OK_DL_DIRECTORY_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST;
case ACTION_OK_DL_PRIVACY_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_PRIVACY_SETTINGS_LIST;
case ACTION_OK_DL_AUDIO_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST;
case ACTION_OK_DL_INPUT_HOTKEY_BINDS_LIST:
return MENU_ENUM_LABEL_DEFERRED_INPUT_HOTKEY_BINDS_LIST;
2018-01-12 04:51:15 +01:00
case ACTION_OK_DL_RECORDING_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_RECORDING_SETTINGS_LIST;
case ACTION_OK_DL_PLAYLIST_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_PLAYLIST_SETTINGS_LIST;
case ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST:
return MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST;
case ACTION_OK_DL_PLAYLIST_COLLECTION:
return MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST;
case ACTION_OK_DL_FAVORITES_LIST:
return MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST;
case ACTION_OK_DL_BROWSE_URL_LIST:
return MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_LIST;
2018-01-12 05:27:09 +01:00
case ACTION_OK_DL_MUSIC_LIST:
return MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST;
case ACTION_OK_DL_IMAGES_LIST:
return MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST;
2018-01-12 04:18:53 +01:00
default:
break;
}
2018-01-15 21:44:34 +01:00
return MSG_UNKNOWN;
2018-01-12 04:18:53 +01:00
}
int generic_action_ok_displaylist_push(const char *path,
const char *new_path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
2015-09-04 13:08:15 +02:00
unsigned action_type)
{
2017-09-10 22:38:03 +02:00
menu_displaylist_info_t info;
2016-10-08 19:44:03 +02:00
char tmp[PATH_MAX_LENGTH];
2017-09-18 16:35:31 +02:00
char parent_dir[PATH_MAX_LENGTH];
2016-07-08 20:47:17 +02:00
enum menu_displaylist_ctl_state dl_type = DISPLAYLIST_NONE;
const char *menu_label = NULL;
const char *menu_path = NULL;
const char *content_path = NULL;
const char *info_label = NULL;
const char *info_path = NULL;
menu_handle_t *menu = NULL;
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
settings_t *settings = config_get_ptr();
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
2016-02-10 21:15:23 +01:00
2017-09-10 22:38:03 +02:00
menu_displaylist_info_init(&info);
2017-09-11 00:23:04 +02:00
info.list = menu_stack;
2017-02-24 02:21:18 +01:00
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
2017-09-11 00:23:04 +02:00
goto end;
2015-09-04 13:08:15 +02:00
2017-09-11 03:04:55 +02:00
tmp[0] = '\0';
2016-10-08 19:44:03 +02:00
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL);
2015-09-04 13:08:15 +02:00
switch (action_type)
{
2016-12-27 00:02:09 +01:00
case ACTION_OK_DL_BROWSE_URL_START:
info.type = type;
info.directory_ptr = idx;
2017-09-11 00:23:04 +02:00
info_path = NULL;
2016-12-27 00:02:09 +01:00
info_label = msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_START);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_START;
dl_type = DISPLAYLIST_GENERIC;
break;
case ACTION_OK_DL_VIDEO_LIST:
info.type = type;
info.directory_ptr = idx;
info_path = label;
info_label = msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST;
dl_type = DISPLAYLIST_GENERIC;
break;
case ACTION_OK_DL_USER_BINDS_LIST:
info.type = type;
info.directory_ptr = idx;
info_path = label;
info_label = msg_hash_to_str(
2016-06-16 12:56:10 +02:00
MENU_ENUM_LABEL_DEFERRED_USER_BINDS_LIST);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_USER_BINDS_LIST;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_GENERIC;
break;
case ACTION_OK_DL_MUSIC:
if (!string_is_empty(path))
strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf));
if (!string_is_empty(menu_path))
strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf));
info_label = msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_MUSIC);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_MUSIC;
info_path = path;
info.type = type;
info.directory_ptr = idx;
dl_type = DISPLAYLIST_GENERIC;
break;
2015-09-04 13:08:15 +02:00
case ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE:
if (menu)
{
2015-12-10 14:00:28 +01:00
menu_path = menu->scratch2_buf;
2015-09-04 13:08:15 +02:00
content_path = menu->scratch_buf;
}
if (content_path)
fill_pathname_join(menu->detect_content_path,
menu_path, content_path,
sizeof(menu->detect_content_path));
2015-09-04 13:08:15 +02:00
info_label = msg_hash_to_str(
2016-06-18 18:45:11 +02:00
MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE;
info_path = path;
info.type = type;
info.directory_ptr = idx;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_GENERIC;
2016-06-18 18:45:11 +02:00
break;
case ACTION_OK_DL_OPEN_ARCHIVE:
if (menu)
2015-09-04 13:08:15 +02:00
{
2016-06-18 18:45:11 +02:00
menu_path = menu->scratch2_buf;
content_path = menu->scratch_buf;
2015-09-04 13:08:15 +02:00
}
2016-06-18 18:45:11 +02:00
if (content_path)
fill_pathname_join(menu->detect_content_path,
menu_path, content_path,
sizeof(menu->detect_content_path));
2016-06-18 18:45:11 +02:00
info_label = msg_hash_to_str(
2016-06-18 18:45:11 +02:00
MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN;
2015-09-07 00:38:23 +02:00
info_path = path;
2015-09-04 13:08:15 +02:00
info.type = type;
info.directory_ptr = idx;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_HELP:
2016-09-04 22:58:54 +02:00
info_label = label;
2016-09-15 16:07:20 +02:00
menu_dialog_push_pending(true, (enum menu_dialog_type)type);
2015-09-04 13:08:15 +02:00
dl_type = DISPLAYLIST_HELP;
break;
case ACTION_OK_DL_RPL_ENTRY:
strlcpy(menu->deferred_path, label, sizeof(menu->deferred_path));
info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS;
info.directory_ptr = idx;
menu->rpl_entry_selection_ptr = (unsigned)idx;
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_AUDIO_DSP_PLUGIN:
filebrowser_clear_type();
2015-09-04 13:08:15 +02:00
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_audio_filter;
info_label = msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_SHADER_PASS:
filebrowser_clear_type();
2015-09-04 13:08:15 +02:00
info.type = type;
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_video_shader;
2015-09-07 00:38:23 +02:00
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_SHADER_PARAMETERS:
info.type = MENU_SETTING_ACTION;
info.directory_ptr = idx;
2016-06-17 23:47:23 +02:00
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_GENERIC:
if (path)
strlcpy(menu->deferred_path, path,
sizeof(menu->deferred_path));
info.type = type;
info.directory_ptr = idx;
2016-06-17 23:47:23 +02:00
info_label = label;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_FILE_BROWSER_SELECT_FILE:
if (path)
strlcpy(menu->deferred_path, path,
sizeof(menu->deferred_path));
info.type = type;
info.directory_ptr = idx;
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
break;
case ACTION_OK_DL_FILE_BROWSER_SELECT_DIR:
if (path)
strlcpy(menu->deferred_path, path,
sizeof(menu->deferred_path));
info.type = type;
info.directory_ptr = idx;
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_DIR;
break;
2015-09-04 13:08:15 +02:00
case ACTION_OK_DL_PUSH_DEFAULT:
info.type = type;
info.directory_ptr = idx;
info_path = label;
2016-06-17 23:47:23 +02:00
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_SHADER_PRESET:
filebrowser_clear_type();
2015-09-04 13:08:15 +02:00
info.type = type;
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_video_shader;
2016-06-17 23:47:23 +02:00
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_CONTENT_LIST:
2016-06-20 15:50:37 +02:00
info.type = FILE_TYPE_DIRECTORY;
2015-09-04 13:08:15 +02:00
info.directory_ptr = idx;
2016-07-09 18:12:35 +02:00
info_path = new_path;
2015-09-07 00:38:23 +02:00
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_SCAN_DIR_LIST:
filebrowser_set_type(FILEBROWSER_SCAN_DIR);
info.type = FILE_TYPE_DIRECTORY;
info.directory_ptr = idx;
info_path = new_path;
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SCAN_DIR;
break;
2015-09-04 13:08:15 +02:00
case ACTION_OK_DL_REMAP_FILE:
filebrowser_clear_type();
2015-09-04 13:08:15 +02:00
info.type = type;
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_input_remapping;
2015-09-07 00:38:23 +02:00
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_RECORD_CONFIGFILE:
filebrowser_clear_type();
{
global_t *global = global_get_ptr();
info.type = type;
info.directory_ptr = idx;
info_path = global->record.config_dir;
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
}
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_DISK_IMAGE_APPEND_LIST:
filebrowser_clear_type();
2015-09-04 13:08:15 +02:00
info.type = type;
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_menu_content;
2015-09-07 00:38:23 +02:00
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_SUBSYSTEM_ADD_LIST:
filebrowser_clear_type();
2018-02-11 10:00:08 -05:00
if (content_get_subsystem() != type - MENU_SETTINGS_SUBSYSTEM_ADD)
content_clear_subsystem();
content_set_subsystem(type - MENU_SETTINGS_SUBSYSTEM_ADD);
filebrowser_set_type(FILEBROWSER_SELECT_FILE_SUBSYSTEM);
info.type = type;
info.directory_ptr = idx;
info_path = settings->paths.directory_menu_content;
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
break;
2018-02-10 20:23:24 -05:00
case ACTION_OK_DL_SUBSYSTEM_LOAD:
2018-02-11 10:00:08 -05:00
{
content_ctx_info_t content_info = {0};
filebrowser_clear_type();
task_push_load_subsystem_with_core_from_menu(
NULL, &content_info,
CORE_TYPE_PLAIN, NULL, NULL);
}
2018-02-10 20:23:24 -05:00
break;
2015-09-04 13:08:15 +02:00
case ACTION_OK_DL_CHEAT_FILE:
filebrowser_clear_type();
2015-09-04 13:08:15 +02:00
info.type = type;
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.path_cheat_database;
2015-09-07 00:38:23 +02:00
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_CORE_LIST:
filebrowser_clear_type();
2015-09-04 13:08:15 +02:00
info.type = type;
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_libretro;
2015-09-07 00:38:23 +02:00
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_CORE;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_CONTENT_COLLECTION_LIST:
info.type = type;
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_playlist;
2015-09-07 00:38:23 +02:00
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_COLLECTION;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_RDB_ENTRY:
filebrowser_clear_type();
2016-01-25 18:18:00 +01:00
fill_pathname_join_delim(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL),
2015-09-07 00:32:01 +02:00
path, '|', sizeof(tmp));
2015-09-04 13:08:15 +02:00
2015-09-07 00:32:01 +02:00
info.directory_ptr = idx;
2015-09-07 00:38:23 +02:00
info_path = label;
info_label = tmp;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_RDB_ENTRY_SUBMENU:
info.directory_ptr = idx;
2015-09-07 00:38:23 +02:00
info_label = label;
info_path = path;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_CONFIGURATIONS_LIST:
2015-09-04 13:08:15 +02:00
info.type = type;
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
if (string_is_empty(settings->paths.directory_menu_config))
2015-09-07 00:38:23 +02:00
info_path = label;
else
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_menu_config;
2015-09-07 00:32:01 +02:00
info_label = label;
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH_DETECT_CORE:
2016-06-18 18:45:11 +02:00
info.type = type;
info.directory_ptr = idx;
info_path = path;
info_label = msg_hash_to_str(
2016-06-18 18:45:11 +02:00
MENU_ENUM_LABEL_DEFERRED_ARCHIVE_ACTION_DETECT_CORE);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_ARCHIVE_ACTION_DETECT_CORE;
if (!string_is_empty(path))
strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf));
if (!string_is_empty(menu_path))
strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf));
2016-07-10 02:26:20 +02:00
dl_type = DISPLAYLIST_GENERIC;
2016-06-18 18:45:11 +02:00
break;
2015-09-04 13:08:15 +02:00
case ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH:
info.type = type;
info.directory_ptr = idx;
2015-09-07 00:38:23 +02:00
info_path = path;
info_label = msg_hash_to_str(
2016-06-18 18:45:11 +02:00
MENU_ENUM_LABEL_DEFERRED_ARCHIVE_ACTION);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_ARCHIVE_ACTION;
2015-09-04 13:08:15 +02:00
if (!string_is_empty(path))
strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf));
if (!string_is_empty(menu_path))
strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf));
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
2015-10-25 08:31:55 +01:00
case ACTION_OK_DL_PARENT_DIRECTORY_PUSH:
2017-09-18 16:35:31 +02:00
parent_dir[0] = '\0';
2017-09-11 03:04:55 +02:00
2017-09-18 16:35:31 +02:00
if (path && menu_path)
fill_pathname_join(tmp,
menu_path, path, sizeof(tmp));
2015-10-25 08:31:55 +01:00
2017-09-18 16:35:31 +02:00
fill_pathname_parent_dir(parent_dir,
tmp, sizeof(parent_dir));
fill_pathname_parent_dir(parent_dir,
parent_dir, sizeof(parent_dir));
2017-09-11 00:23:04 +02:00
2017-09-18 16:35:31 +02:00
info.type = type;
info.directory_ptr = idx;
info_path = parent_dir;
info_label = menu_label;
dl_type = DISPLAYLIST_GENERIC;
2015-10-25 08:31:55 +01:00
break;
2015-09-04 13:08:15 +02:00
case ACTION_OK_DL_DIRECTORY_PUSH:
if (path && menu_path)
fill_pathname_join(tmp,
menu_path, path, sizeof(tmp));
2017-09-11 00:23:04 +02:00
info.type = type;
info.directory_ptr = idx;
info_path = tmp;
info_label = menu_label;
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_DATABASE_MANAGER_LIST:
2017-09-11 00:23:04 +02:00
{
char lpl_basename[PATH_MAX_LENGTH];
lpl_basename[0] = '\0';
filebrowser_clear_type();
fill_pathname_join(tmp,
settings->paths.path_content_database,
path, sizeof(tmp));
2015-09-04 13:08:15 +02:00
2017-09-11 00:23:04 +02:00
fill_pathname_base_noext(lpl_basename, path, sizeof(lpl_basename));
menu_driver_set_thumbnail_system(lpl_basename, sizeof(lpl_basename));
2017-09-11 00:23:04 +02:00
info.directory_ptr = idx;
info_path = tmp;
info_label = msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST;
dl_type = DISPLAYLIST_GENERIC;
}
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_CURSOR_MANAGER_LIST:
filebrowser_clear_type();
2017-04-29 00:39:29 +02:00
fill_pathname_join(tmp, settings->paths.directory_cursor,
2015-09-07 00:38:23 +02:00
path, sizeof(tmp));
2015-09-04 13:08:15 +02:00
2015-09-07 00:38:23 +02:00
info.directory_ptr = idx;
info_path = tmp;
info_label = msg_hash_to_str(
2016-06-16 12:56:10 +02:00
MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_CORE_UPDATER_LIST:
info.type = type;
info.directory_ptr = idx;
2015-09-07 00:38:23 +02:00
info_path = path;
info_label = msg_hash_to_str(
2016-06-16 12:56:10 +02:00
MENU_ENUM_LABEL_DEFERRED_CORE_UPDATER_LIST);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_UPDATER_LIST;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_PENDING_CLEAR;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_THUMBNAILS_UPDATER_LIST:
info.type = type;
info.directory_ptr = idx;
info_path = path;
info_label = msg_hash_to_str(
2016-06-16 12:56:10 +02:00
MENU_ENUM_LABEL_DEFERRED_THUMBNAILS_UPDATER_LIST);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_THUMBNAILS_UPDATER_LIST;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_PENDING_CLEAR;
break;
case ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST:
2017-09-11 03:07:04 +02:00
fill_pathname_join_delim(tmp, path, label, ';',
sizeof(tmp));
info.type = type;
info.directory_ptr = idx;
info_path = tmp;
info_label = msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST;
dl_type = DISPLAYLIST_GENERIC;
break;
2016-06-21 00:46:55 +02:00
case ACTION_OK_DL_CORE_CONTENT_DIRS_LIST:
info.type = type;
info.directory_ptr = idx;
info_path = path;
info_label = msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_PENDING_CLEAR;
2016-06-21 00:46:55 +02:00
break;
2015-09-04 13:08:15 +02:00
case ACTION_OK_DL_CORE_CONTENT_LIST:
info.type = type;
info.directory_ptr = idx;
2015-09-07 00:38:23 +02:00
info_path = path;
info_label = msg_hash_to_str(
2016-06-16 12:56:10 +02:00
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_LIST);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_LIST;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_PENDING_CLEAR;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_LAKKA_LIST:
info.type = type;
info.directory_ptr = idx;
info_path = path;
info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_LAKKA_LIST);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_LAKKA_LIST;
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_PENDING_CLEAR;
break;
2015-09-04 13:08:15 +02:00
case ACTION_OK_DL_DEFERRED_CORE_LIST:
info.directory_ptr = idx;
2017-04-29 00:39:29 +02:00
info_path = settings->paths.directory_libretro;
info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_LIST);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_LIST;
2016-10-08 15:05:31 +02:00
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_DEFERRED_CORE_LIST_SET:
info.directory_ptr = idx;
menu->rdb_entry_start_game_selection_ptr = (unsigned)idx;
info_path =
settings->paths.directory_libretro;
info_label = msg_hash_to_str(
2016-06-16 12:56:10 +02:00
MENU_ENUM_LABEL_DEFERRED_CORE_LIST_SET);
info.enum_idx =
MENU_ENUM_LABEL_DEFERRED_CORE_LIST_SET;
dl_type = DISPLAYLIST_GENERIC;
2015-09-04 13:08:15 +02:00
break;
case ACTION_OK_DL_ACCOUNTS_LIST:
case ACTION_OK_DL_INPUT_SETTINGS_LIST:
2016-06-16 21:40:13 +02:00
case ACTION_OK_DL_DRIVER_SETTINGS_LIST:
2016-06-18 22:17:39 +02:00
case ACTION_OK_DL_CORE_SETTINGS_LIST:
case ACTION_OK_DL_VIDEO_SETTINGS_LIST:
case ACTION_OK_DL_CONFIGURATION_SETTINGS_LIST:
case ACTION_OK_DL_SAVING_SETTINGS_LIST:
case ACTION_OK_DL_LOGGING_SETTINGS_LIST:
case ACTION_OK_DL_FRAME_THROTTLE_SETTINGS_LIST:
case ACTION_OK_DL_REWIND_SETTINGS_LIST:
case ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST:
2016-11-23 14:28:15 +01:00
case ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST:
case ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST:
2016-07-02 20:40:27 +02:00
case ACTION_OK_DL_MENU_SETTINGS_LIST:
2017-06-20 02:04:23 +02:00
case ACTION_OK_DL_MENU_VIEWS_SETTINGS_LIST:
case ACTION_OK_DL_QUICK_MENU_VIEWS_SETTINGS_LIST:
2016-07-02 20:40:27 +02:00
case ACTION_OK_DL_USER_INTERFACE_SETTINGS_LIST:
case ACTION_OK_DL_MENU_FILE_BROWSER_SETTINGS_LIST:
case ACTION_OK_DL_RETRO_ACHIEVEMENTS_SETTINGS_LIST:
case ACTION_OK_DL_UPDATER_SETTINGS_LIST:
case ACTION_OK_DL_NETWORK_SETTINGS_LIST:
2016-09-21 21:58:43 +02:00
case ACTION_OK_DL_WIFI_SETTINGS_LIST:
2017-06-08 00:19:43 +02:00
case ACTION_OK_DL_NETPLAY:
2016-12-02 22:40:26 -05:00
case ACTION_OK_DL_NETPLAY_LAN_SCAN_SETTINGS_LIST:
case ACTION_OK_DL_LAKKA_SERVICES_LIST:
2016-07-02 20:40:27 +02:00
case ACTION_OK_DL_USER_SETTINGS_LIST:
case ACTION_OK_DL_DIRECTORY_SETTINGS_LIST:
case ACTION_OK_DL_PRIVACY_SETTINGS_LIST:
case ACTION_OK_DL_AUDIO_SETTINGS_LIST:
case ACTION_OK_DL_INPUT_HOTKEY_BINDS_LIST:
2016-10-08 15:05:31 +02:00
case ACTION_OK_DL_RECORDING_SETTINGS_LIST:
2015-10-25 10:25:07 +01:00
case ACTION_OK_DL_PLAYLIST_SETTINGS_LIST:
2015-10-17 15:58:59 +02:00
case ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST:
2018-01-12 04:51:15 +01:00
case ACTION_OK_DL_PLAYLIST_COLLECTION:
case ACTION_OK_DL_FAVORITES_LIST:
case ACTION_OK_DL_BROWSE_URL_LIST:
2018-01-12 05:27:09 +01:00
case ACTION_OK_DL_MUSIC_LIST:
case ACTION_OK_DL_IMAGES_LIST:
2018-01-12 04:51:15 +01:00
action_ok_dl_lbl(action_ok_dl_to_enum(action_type), DISPLAYLIST_GENERIC);
2015-10-17 15:58:59 +02:00
break;
case ACTION_OK_DL_CONTENT_SETTINGS:
info.list = menu_entries_get_selection_buf_ptr(0);
info_path = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS);
info_label = msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_SETTINGS);
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS;
menu_entries_append_enum(menu_stack, info_path, info_label,
2016-06-15 14:59:49 +02:00
MENU_ENUM_LABEL_CONTENT_SETTINGS,
0, 0, 0);
2016-07-08 20:47:17 +02:00
dl_type = DISPLAYLIST_CONTENT_SETTINGS;
break;
2015-09-04 13:08:15 +02:00
}
2015-09-07 00:32:01 +02:00
if (info_label)
2017-09-28 02:45:03 +02:00
info.label = strdup(info_label);
2015-09-07 00:38:23 +02:00
if (info_path)
2017-09-28 03:06:54 +02:00
info.path = strdup(info_path);
2015-09-04 13:08:15 +02:00
2016-02-24 23:19:53 +01:00
if (menu_displaylist_ctl(dl_type, &info))
2017-09-11 00:23:04 +02:00
{
2017-05-26 20:12:52 +02:00
if (menu_displaylist_process(&info))
2017-09-11 00:23:04 +02:00
{
menu_displaylist_info_free(&info);
2016-02-24 23:19:53 +01:00
return 0;
2017-09-11 00:23:04 +02:00
}
}
2017-09-11 00:23:04 +02:00
end:
menu_displaylist_info_free(&info);
2016-02-24 23:19:53 +01:00
return menu_cbs_exit();
2015-09-04 13:08:15 +02:00
}
/**
* menu_content_load_from_playlist:
* @playlist : Playlist handle.
* @idx : Index in playlist.
*
* Initializes core and loads content based on playlist entry.
**/
2018-03-25 19:16:39 +02:00
static bool menu_content_playlist_load(playlist_t *playlist, size_t idx)
{
const char *path = NULL;
playlist_get_index(playlist,
2018-03-25 19:16:39 +02:00
idx, &path, NULL, NULL, NULL, NULL, NULL);
2018-03-25 19:16:39 +02:00
if (!string_is_empty(path))
{
unsigned i;
bool valid_path = false;
char *path_check = NULL;
char *path_tolower = strdup(path);
for (i = 0; i < strlen(path_tolower); ++i)
2017-08-08 12:21:48 +01:00
path_tolower[i] = tolower((unsigned char)path_tolower[i]);
if (strstr(path_tolower, file_path_str(FILE_PATH_ZIP_EXTENSION)))
strstr(path_tolower, file_path_str(FILE_PATH_ZIP_EXTENSION))[4] = '\0';
else if (strstr(path_tolower, file_path_str(FILE_PATH_7Z_EXTENSION)))
strstr(path_tolower, file_path_str(FILE_PATH_7Z_EXTENSION))[3] = '\0';
path_check = (char *)
calloc(strlen(path_tolower) + 1, sizeof(char));
strncpy(path_check, path, strlen(path_tolower));
valid_path = path_is_valid(path_check);
free(path_tolower);
free(path_check);
2018-03-25 19:16:39 +02:00
if (valid_path)
return true;
}
2018-03-25 19:16:39 +02:00
return false;
}
/**
* menu_content_find_first_core:
* @core_info : Core info list handle.
* @dir : Directory. Gets joined with @path.
* @path : Path. Gets joined with @dir.
* @menu_label : Label identifier of menu setting.
* @s : Deferred core path. Will be filled in
* by function.
* @len : Size of @s.
*
* Gets deferred core.
*
* Returns: false if there are multiple deferred cores and a
* selection needs to be made from a list, otherwise
* returns true and fills in @s with path to core.
**/
static bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info,
bool load_content_with_current_core,
char *new_core_path, size_t len)
{
const core_info_t *info = NULL;
size_t supported = 0;
core_info_list_t *core_info = (core_info_list_t*)def_info->data;
const char *default_info_dir = def_info->dir;
if (!string_is_empty(default_info_dir))
{
const char *default_info_path = def_info->path;
size_t default_info_length = def_info->len;
if (!string_is_empty(default_info_path))
fill_pathname_join(def_info->s,
default_info_dir, default_info_path,
default_info_length);
#ifdef HAVE_COMPRESSION
if (path_is_compressed_file(default_info_dir))
{
size_t len = strlen(default_info_dir);
/* In case of a compressed archive, we have to join with a hash */
/* We are going to write at the position of dir: */
retro_assert(len < strlen(def_info->s));
def_info->s[len] = '#';
}
#endif
}
if (core_info)
core_info_list_get_supported_cores(core_info,
def_info->s, &info,
&supported);
/* We started the menu with 'Load Content', we are
* going to use the current core to load this. */
if (load_content_with_current_core)
{
core_info_get_current_core((core_info_t**)&info);
if (info)
{
2017-08-17 18:53:55 +02:00
#if 0
RARCH_LOG("[lobby] use the current core (%s) to load this content...\n",
info->path);
2017-08-17 18:53:55 +02:00
#endif
supported = 1;
}
}
/* There are multiple deferred cores and a
* selection needs to be made from a list, return 0. */
if (supported != 1)
return false;
if (info)
strlcpy(new_core_path, info->path, len);
return true;
}
#ifdef HAVE_LIBRETRODB
void handle_dbscan_finished(void *task_data, void *user_data, const char *err);
#endif
static void content_add_to_playlist(const char *path)
{
#ifdef HAVE_LIBRETRODB
settings_t *settings = config_get_ptr();
if (!settings || !settings->bools.automatically_add_content_to_playlist)
return;
task_push_dbscan(
settings->paths.directory_playlist,
settings->paths.path_content_database,
path, false, handle_dbscan_finished);
#endif
}
static int file_load_with_detect_core_wrapper(
enum msg_hash_enums enum_label_idx,
enum msg_hash_enums enum_idx,
size_t idx, size_t entry_idx,
2016-01-25 05:58:45 +01:00
const char *path, const char *label,
unsigned type, bool is_carchive)
{
menu_content_ctx_defer_info_t def_info;
2016-06-03 04:59:12 +02:00
int ret = 0;
2017-09-18 16:22:27 +02:00
char *new_core_path = NULL;
2016-06-03 04:59:12 +02:00
const char *menu_path = NULL;
const char *menu_label = NULL;
menu_handle_t *menu = NULL;
core_info_list_t *list = NULL;
2016-02-10 21:15:23 +01:00
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
2017-09-12 05:08:56 +02:00
{
char *menu_path_new = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
2017-09-18 16:22:27 +02:00
new_core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
2017-09-12 05:08:56 +02:00
new_core_path[0] = menu_path_new[0] = '\0';
2017-09-12 05:08:56 +02:00
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL);
2017-09-12 05:08:56 +02:00
if (!string_is_empty(menu_path))
strlcpy(menu_path_new, menu_path, PATH_MAX_LENGTH * sizeof(char));
2015-12-11 13:51:17 +01:00
2017-09-12 05:08:56 +02:00
if (string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE)))
fill_pathname_join(menu_path_new, menu->scratch2_buf, menu->scratch_buf,
PATH_MAX_LENGTH * sizeof(char));
else if (string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN)))
fill_pathname_join(menu_path_new, menu->scratch2_buf, menu->scratch_buf,
PATH_MAX_LENGTH * sizeof(char));
2017-09-12 05:08:56 +02:00
core_info_get_list(&list);
2017-09-12 05:08:56 +02:00
def_info.data = list;
def_info.dir = menu_path_new;
def_info.path = path;
def_info.menu_label = menu_label;
def_info.s = menu->deferred_path;
def_info.len = sizeof(menu->deferred_path);
2017-09-11 06:31:44 +02:00
2017-09-12 05:08:56 +02:00
if (menu_content_find_first_core(&def_info, false, new_core_path,
PATH_MAX_LENGTH * sizeof(char)))
ret = -1;
2015-06-07 23:26:29 +02:00
2015-09-05 17:17:26 +02:00
2017-09-12 05:08:56 +02:00
if ( !is_carchive && !string_is_empty(path)
&& !string_is_empty(menu_path_new))
fill_pathname_join(menu->detect_content_path,
2017-09-12 05:08:56 +02:00
menu_path_new, path,
sizeof(menu->detect_content_path));
2017-04-27 01:23:04 +02:00
2017-09-12 05:08:56 +02:00
free(menu_path_new);
2017-09-12 05:08:56 +02:00
if (enum_label_idx == MENU_ENUM_LABEL_COLLECTION)
2017-09-18 15:57:05 +02:00
{
free(new_core_path);
2017-09-12 05:08:56 +02:00
return generic_action_ok_displaylist_push(path, NULL,
NULL, 0, idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST_SET);
2017-09-18 15:57:05 +02:00
}
2017-09-12 05:08:56 +02:00
switch (ret)
{
case -1:
{
content_ctx_info_t content_info;
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
if (!task_push_load_content_with_new_core_from_menu(
new_core_path, def_info.s,
&content_info,
CORE_TYPE_PLAIN,
NULL, NULL))
2017-09-12 05:09:56 +02:00
{
free(new_core_path);
2017-09-12 05:08:56 +02:00
return -1;
2017-09-12 05:09:56 +02:00
}
content_add_to_playlist(def_info.s);
2017-09-12 05:08:56 +02:00
2017-09-18 15:57:05 +02:00
ret = 0;
break;
2017-09-12 05:08:56 +02:00
}
case 0:
2017-09-18 15:57:05 +02:00
ret = generic_action_ok_displaylist_push(path, NULL, label, type,
2017-09-12 05:08:56 +02:00
idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST);
2017-09-18 15:57:05 +02:00
break;
2017-09-12 05:08:56 +02:00
default:
break;
}
}
2017-09-18 15:57:05 +02:00
free(new_core_path);
return ret;
}
static int action_ok_file_load_with_detect_core_carchive(
const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
fill_pathname_join_delim(menu->detect_content_path,
menu->detect_content_path, path,
'#', sizeof(menu->detect_content_path));
2016-01-25 05:58:45 +01:00
type = 0;
label = NULL;
return file_load_with_detect_core_wrapper(MSG_UNKNOWN,
MSG_UNKNOWN, idx, entry_idx,
path, label, type, true);
}
2015-06-08 18:35:14 +02:00
static int action_ok_file_load_with_detect_core(const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
2015-06-08 18:35:14 +02:00
{
2016-01-25 05:58:45 +01:00
type = 0;
label = NULL;
2017-08-13 07:14:10 +02:00
return file_load_with_detect_core_wrapper(
MSG_UNKNOWN,
MSG_UNKNOWN, idx, entry_idx,
path, label, type, false);
}
static int action_ok_file_load_with_detect_core_collection(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
type = 0;
label = NULL;
return file_load_with_detect_core_wrapper(
MENU_ENUM_LABEL_COLLECTION,
MSG_UNKNOWN, idx, entry_idx,
path, label, type, false);
}
2017-08-11 02:51:09 +02:00
static int set_path_generic(const char *label, const char *action_path)
{
2017-08-15 05:30:57 +02:00
rarch_setting_t *setting = menu_setting_find(label);
2017-08-11 02:51:09 +02:00
if (setting)
{
setting_set_with_string_representation(
setting, action_path);
return menu_setting_generic(setting, false);
}
return 0;
}
2017-11-26 06:35:53 +01:00
static int generic_action_ok_command(enum event_command cmd)
{
if (!command_event(cmd, NULL))
return menu_cbs_exit();
return 0;
}
static int generic_action_ok(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
unsigned id, enum msg_hash_enums flush_id)
{
char action_path[PATH_MAX_LENGTH];
unsigned flush_type = 0;
int ret = 0;
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
const char *menu_path = NULL;
const char *menu_label = NULL;
const char *flush_char = NULL;
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
goto error;
menu_entries_get_last_stack(&menu_path,
&menu_label, NULL, &enum_idx, NULL);
action_path[0] = '\0';
if (!string_is_empty(path))
fill_pathname_join(action_path,
menu_path, path, sizeof(action_path));
else
strlcpy(action_path, menu_path, sizeof(action_path));
switch (id)
{
case ACTION_OK_LOAD_WALLPAPER:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST);
if (filestream_exists(action_path))
{
settings_t *settings = config_get_ptr();
2017-04-29 00:39:29 +02:00
strlcpy(settings->paths.path_menu_wallpaper,
action_path, sizeof(settings->paths.path_menu_wallpaper));
if (filestream_exists(action_path))
task_push_image_load(action_path,
menu_display_handle_wallpaper_upload, NULL);
}
break;
case ACTION_OK_LOAD_CORE:
{
2017-04-27 01:23:04 +02:00
content_ctx_info_t content_info;
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
flush_type = MENU_SETTINGS;
2017-02-21 16:53:02 +01:00
if (!task_push_load_new_core(
action_path, NULL,
&content_info,
CORE_TYPE_PLAIN,
NULL, NULL))
{
#ifndef HAVE_DYNAMIC
ret = -1;
#endif
}
}
break;
case ACTION_OK_LOAD_CONFIG_FILE:
{
2017-01-24 18:08:26 +01:00
settings_t *settings = config_get_ptr();
flush_type = MENU_SETTINGS;
menu_display_set_msg_force(true);
2017-04-28 13:43:47 +02:00
if (config_replace(settings->bools.config_save_on_exit, action_path))
2017-01-24 18:08:26 +01:00
{
bool pending_push = false;
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
2017-01-24 18:08:26 +01:00
ret = -1;
}
}
break;
case ACTION_OK_LOAD_PRESET:
{
2017-01-09 03:53:55 +01:00
struct video_shader *shader = menu_shader_get();
flush_char = msg_hash_to_str(flush_id);
menu_shader_manager_set_preset(shader,
video_shader_parse_type(action_path, RARCH_SHADER_NONE),
action_path);
}
break;
case ACTION_OK_LOAD_SHADER_PASS:
{
2018-02-27 05:07:17 +01:00
struct video_shader *shader = menu_shader_get();
struct video_shader_pass *shader_pass = shader ? &shader->pass[(unsigned)menu->hack_shader_pass] : NULL;
2018-02-27 05:07:17 +01:00
flush_char = msg_hash_to_str((enum msg_hash_enums)flush_id);
2018-03-19 06:58:36 +01:00
if (shader_pass)
{
strlcpy(
shader_pass->source.path,
action_path,
sizeof(shader_pass->source.path));
video_shader_resolve_parameters(NULL, shader);
}
}
break;
case ACTION_OK_LOAD_RECORD_CONFIGFILE:
{
global_t *global = global_get_ptr();
2018-03-19 06:58:36 +01:00
flush_char = msg_hash_to_str(flush_id);
if (global)
strlcpy(global->record.config, action_path,
sizeof(global->record.config));
}
break;
case ACTION_OK_LOAD_REMAPPING_FILE:
{
config_file_t *conf = config_file_new(action_path);
2018-03-19 06:58:36 +01:00
flush_char = msg_hash_to_str(flush_id);
if (conf)
input_remapping_load_file(conf, action_path);
}
break;
case ACTION_OK_LOAD_CHEAT_FILE:
flush_char = msg_hash_to_str(flush_id);
cheat_manager_free();
if (!cheat_manager_load(action_path))
goto error;
break;
case ACTION_OK_APPEND_DISK_IMAGE:
flush_type = MENU_SETTINGS;
command_event(CMD_EVENT_DISK_APPEND_IMAGE, action_path);
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_RESUME);
break;
case ACTION_OK_SUBSYSTEM_ADD:
flush_type = MENU_SETTINGS;
content_add_subsystem(action_path);
break;
case ACTION_OK_SET_DIRECTORY:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST);
ret = set_path_generic(menu->filebrowser_label, action_path);
break;
case ACTION_OK_SET_PATH_VIDEO_FILTER:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_SETTINGS_LIST);
2018-01-18 06:15:39 +01:00
ret = set_path_generic(menu_label, action_path);
break;
case ACTION_OK_SET_PATH_AUDIO_FILTER:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST);
2018-01-18 06:15:39 +01:00
ret = set_path_generic(menu_label, action_path);
break;
case ACTION_OK_SET_PATH_OVERLAY:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST);
2018-01-18 06:15:39 +01:00
ret = set_path_generic(menu_label, action_path);
break;
case ACTION_OK_SET_PATH:
flush_type = MENU_SETTINGS;
2018-01-18 06:15:39 +01:00
ret = set_path_generic(menu_label, action_path);
break;
default:
flush_char = msg_hash_to_str(flush_id);
break;
}
menu_entries_flush_stack(flush_char, flush_type);
return ret;
error:
return menu_cbs_exit();
}
2017-11-26 07:29:19 +01:00
static int default_action_ok_load_content_with_core_from_menu(const char *_path, unsigned _type)
{
content_ctx_info_t content_info;
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
2018-01-18 06:15:39 +01:00
if (!task_push_load_content_with_core_from_menu(
_path, &content_info,
(enum rarch_core_type)_type, NULL, NULL))
2017-11-26 07:29:19 +01:00
return -1;
2017-11-27 07:23:43 +01:00
content_add_to_playlist(_path);
2017-11-26 07:29:19 +01:00
return 0;
}
2018-01-18 06:15:39 +01:00
static int default_action_ok_load_content_from_playlist_from_menu(const char *_path,
const char *path, const char *entry_label)
2017-11-26 07:35:06 +01:00
{
content_ctx_info_t content_info;
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
if (!task_push_load_content_from_playlist_from_menu(
_path, path, entry_label,
&content_info,
NULL, NULL))
return -1;
return 0;
}
2017-11-26 07:29:19 +01:00
2017-08-13 07:14:10 +02:00
#define default_action_ok_set(funcname, _id, _flush) \
static int (funcname)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
return generic_action_ok(path, label, type, idx, entry_idx, _id, _flush); \
}
2017-08-13 07:14:10 +02:00
default_action_ok_set(action_ok_set_path_audiofilter, ACTION_OK_SET_PATH_VIDEO_FILTER, MSG_UNKNOWN)
default_action_ok_set(action_ok_set_path_videofilter, ACTION_OK_SET_PATH_AUDIO_FILTER, MSG_UNKNOWN)
default_action_ok_set(action_ok_set_path_overlay, ACTION_OK_SET_PATH_OVERLAY, MSG_UNKNOWN)
default_action_ok_set(action_ok_set_path, ACTION_OK_SET_PATH, MSG_UNKNOWN)
default_action_ok_set(action_ok_load_core, ACTION_OK_LOAD_CORE, MSG_UNKNOWN)
default_action_ok_set(action_ok_config_load, ACTION_OK_LOAD_CONFIG_FILE, MSG_UNKNOWN)
default_action_ok_set(action_ok_disk_image_append, ACTION_OK_APPEND_DISK_IMAGE, MSG_UNKNOWN)
default_action_ok_set(action_ok_subsystem_add, ACTION_OK_SUBSYSTEM_ADD, MSG_UNKNOWN)
2017-08-13 07:14:10 +02:00
default_action_ok_set(action_ok_cheat_file_load, ACTION_OK_LOAD_CHEAT_FILE, MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS)
default_action_ok_set(action_ok_record_configfile_load, ACTION_OK_LOAD_RECORD_CONFIGFILE, MENU_ENUM_LABEL_RECORDING_SETTINGS)
default_action_ok_set(action_ok_remap_file_load, ACTION_OK_LOAD_REMAPPING_FILE, MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS )
default_action_ok_set(action_ok_shader_preset_load, ACTION_OK_LOAD_PRESET , MENU_ENUM_LABEL_SHADER_OPTIONS)
default_action_ok_set(action_ok_shader_pass_load, ACTION_OK_LOAD_SHADER_PASS, MENU_ENUM_LABEL_SHADER_OPTIONS)
static int action_ok_file_load(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char menu_path_new[PATH_MAX_LENGTH];
char full_path_new[PATH_MAX_LENGTH];
const char *menu_label = NULL;
const char *menu_path = NULL;
rarch_setting_t *setting = NULL;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
menu_path_new[0] = full_path_new[0] = '\0';
2018-02-17 12:23:15 +01:00
if (filebrowser_get_type() == FILEBROWSER_SELECT_FILE_SUBSYSTEM)
{
/* TODO/FIXME - this path is triggered when we try to load a
* file from an archive while inside the load subsystem
* action */
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
fill_pathname_join(menu_path_new,
menu->scratch2_buf, menu->scratch_buf,
sizeof(menu_path_new));
2018-02-17 12:23:15 +01:00
switch (type)
{
case FILE_TYPE_IN_CARCHIVE:
fill_pathname_join_delim(full_path_new, menu_path_new, path,
'#',sizeof(full_path_new));
break;
default:
fill_pathname_join(full_path_new, menu_path_new, path,
sizeof(full_path_new));
break;
}
content_add_subsystem(full_path_new);
menu_entries_flush_stack(NULL, MENU_SETTINGS);
return 0;
}
2017-10-01 17:20:01 +02:00
file_list_get_last(menu_stack, &menu_path, &menu_label, NULL, NULL);
2017-10-04 06:53:47 +02:00
if (!string_is_empty(menu_label))
setting = menu_setting_find(menu_label);
if (setting_get_type(setting) == ST_PATH)
return action_ok_set_path(path, label, type, idx, entry_idx);
2017-10-04 06:53:47 +02:00
if (!string_is_empty(menu_path))
strlcpy(menu_path_new, menu_path, sizeof(menu_path_new));
2017-10-04 06:53:47 +02:00
if (!string_is_empty(menu_label))
{
if (
string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE)) ||
string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN))
)
{
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
fill_pathname_join(menu_path_new,
menu->scratch2_buf, menu->scratch_buf,
sizeof(menu_path_new));
}
}
switch (type)
{
case FILE_TYPE_IN_CARCHIVE:
fill_pathname_join_delim(full_path_new, menu_path_new, path,
'#',sizeof(full_path_new));
break;
default:
fill_pathname_join(full_path_new, menu_path_new, path,
sizeof(full_path_new));
break;
}
2017-11-26 07:29:19 +01:00
return default_action_ok_load_content_with_core_from_menu(full_path_new,
CORE_TYPE_PLAIN);
2015-06-08 18:35:14 +02:00
}
2017-11-25 21:18:25 +01:00
static int action_ok_playlist_entry_collection(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-10-08 19:44:03 +02:00
char new_core_path[PATH_MAX_LENGTH];
2017-04-27 01:23:04 +02:00
size_t selection_ptr = 0;
bool playlist_initialized = false;
playlist_t *playlist = NULL;
const char *entry_path = NULL;
const char *entry_label = NULL;
const char *core_path = NULL;
const char *core_name = NULL;
playlist_t *tmp_playlist = NULL;
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
2016-10-08 19:44:03 +02:00
new_core_path[0] = '\0';
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);
if (!tmp_playlist)
{
tmp_playlist = playlist_init(
menu->db_playlist_file, COLLECTION_SIZE);
if (!tmp_playlist)
return menu_cbs_exit();
playlist_initialized = true;
}
2016-12-04 04:38:58 +01:00
playlist = tmp_playlist;
selection_ptr = entry_idx;
playlist_get_index(playlist, selection_ptr,
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
2016-12-18 16:01:00 +01:00
/* Is the core path / name of the playlist entry not yet filled in? */
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
2016-07-01 04:58:56 +02:00
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
{
core_info_ctx_find_t core_info;
const char *entry_path = NULL;
const char *path_base =
2016-07-01 05:42:53 +02:00
path_basename(menu->db_playlist_file);
bool found_associated_core =
2016-07-01 15:55:36 +02:00
menu_content_playlist_find_associated_core(
path_base, new_core_path, sizeof(new_core_path));
2016-12-04 04:38:58 +01:00
core_info.inf = NULL;
core_info.path = new_core_path;
2016-07-09 21:50:20 +02:00
if (!core_info_find(&core_info, new_core_path))
found_associated_core = false;
if (!found_associated_core)
{
2017-01-14 18:17:41 +01:00
/* TODO: figure out if this should refer to the inner or outer entry_path */
/* TODO: make sure there's only one entry_path in this function */
int ret = action_ok_file_load_with_detect_core_collection(entry_path,
label, type, selection_ptr, entry_idx);
if (playlist_initialized)
playlist_free(tmp_playlist);
return ret;
}
2017-11-25 21:52:30 +01:00
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);
2018-03-22 19:46:02 -04:00
command_playlist_update_write(
tmp_playlist,
selection_ptr,
NULL,
NULL,
new_core_path,
2017-11-25 21:51:32 +01:00
core_info.inf->display_name,
2017-01-14 18:17:41 +01:00
NULL,
NULL);
}
2016-07-09 22:15:24 +02:00
else
strlcpy(new_core_path, core_path, sizeof(new_core_path));
2018-03-25 19:16:39 +02:00
if (!playlist || !menu_content_playlist_load(playlist, selection_ptr))
2016-12-15 12:18:26 +01:00
{
2017-11-25 21:54:30 +01:00
runloop_msg_queue_push(
"File could not be loaded from playlist.\n",
1, 100, true);
2018-03-27 17:03:36 +02:00
if (playlist_initialized)
playlist_free(tmp_playlist);
return menu_cbs_exit();
2016-12-15 12:18:26 +01:00
}
playlist_get_index(playlist,
2018-03-25 19:16:39 +02:00
selection_ptr, &path, NULL, NULL, NULL, NULL, NULL);
2018-01-18 06:15:39 +01:00
return default_action_ok_load_content_from_playlist_from_menu(
new_core_path, path, entry_label);
}
static int action_ok_playlist_entry(const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char new_core_path[PATH_MAX_LENGTH];
2017-04-27 01:23:04 +02:00
size_t selection_ptr = 0;
playlist_t *playlist = g_defaults.content_history;
const char *entry_path = NULL;
const char *entry_label = NULL;
2017-04-27 01:23:04 +02:00
const char *core_path = NULL;
const char *core_name = NULL;
menu_handle_t *menu = NULL;
new_core_path[0] = '\0';
2016-02-10 21:15:23 +01:00
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
selection_ptr = entry_idx;
playlist_get_index(playlist, selection_ptr,
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
{
core_info_ctx_find_t core_info;
const char *entry_path = NULL;
2017-01-14 18:17:41 +01:00
const char *path_base =
path_basename(menu->db_playlist_file);
bool found_associated_core =
menu_content_playlist_find_associated_core(
path_base, new_core_path, sizeof(new_core_path));
core_info.inf = NULL;
core_info.path = new_core_path;
2015-06-06 15:28:16 +02:00
2016-07-09 21:50:20 +02:00
if (!core_info_find(&core_info, new_core_path))
found_associated_core = false;
2015-05-26 04:27:21 +02:00
if (!found_associated_core)
2017-01-14 18:17:41 +01:00
/* TODO: figure out if this should refer to the inner or outer entry_path */
/* TODO: make sure there's only one entry_path in this function */
return action_ok_file_load_with_detect_core(entry_path,
label, type, selection_ptr, entry_idx);
command_playlist_update_write(NULL,
2017-11-25 21:45:28 +01:00
selection_ptr,
NULL,
NULL,
new_core_path,
2017-11-25 21:51:32 +01:00
core_info.inf->display_name,
2017-01-14 18:17:41 +01:00
NULL,
NULL);
}
2017-12-06 14:25:41 +01:00
else if (!string_is_empty(core_path))
strlcpy(new_core_path, core_path, sizeof(new_core_path));
2018-03-25 19:16:39 +02:00
if (!playlist || !menu_content_playlist_load(playlist, selection_ptr))
2016-12-15 12:18:26 +01:00
{
2017-09-11 03:01:33 +02:00
runloop_msg_queue_push(
"File could not be loaded from playlist.\n",
1, 100, true);
return menu_cbs_exit();
2016-12-15 12:18:26 +01:00
}
playlist_get_index(playlist,
2018-03-25 19:16:39 +02:00
selection_ptr, &path, NULL, NULL, NULL,
2017-09-11 03:01:33 +02:00
NULL, NULL);
2017-12-06 14:25:41 +01:00
return default_action_ok_load_content_from_playlist_from_menu(
new_core_path, path, entry_label);
}
static int action_ok_playlist_entry_start_content(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2017-04-27 01:23:04 +02:00
size_t selection_ptr = 0;
bool playlist_initialized = false;
playlist_t *playlist = NULL;
const char *entry_path = NULL;
const char *entry_label = NULL;
2017-04-27 01:23:04 +02:00
const char *core_path = NULL;
const char *core_name = NULL;
playlist_t *tmp_playlist = NULL;
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);
if (!tmp_playlist)
2015-06-06 15:28:16 +02:00
{
tmp_playlist = playlist_init(
menu->db_playlist_file, COLLECTION_SIZE);
if (!tmp_playlist)
return menu_cbs_exit();
playlist_initialized = true;
2015-06-06 15:28:16 +02:00
}
playlist = tmp_playlist;
selection_ptr = menu->rdb_entry_start_game_selection_ptr;
2016-05-16 09:07:44 +02:00
playlist_get_index(playlist, selection_ptr,
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
2016-06-30 19:09:22 +02:00
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
{
2016-02-07 02:50:16 +01:00
core_info_ctx_find_t core_info;
2016-10-08 19:44:03 +02:00
char new_core_path[PATH_MAX_LENGTH];
const char *entry_path = NULL;
const char *path_base =
2016-07-01 05:17:04 +02:00
path_basename(menu->db_playlist_file);
2016-10-08 19:44:03 +02:00
bool found_associated_core = false;
2017-11-25 21:51:32 +01:00
new_core_path[0] = '\0';
2016-10-08 19:44:03 +02:00
found_associated_core =
2016-07-01 15:55:36 +02:00
menu_content_playlist_find_associated_core(
path_base, new_core_path, sizeof(new_core_path));
2016-07-01 05:17:04 +02:00
core_info.inf = NULL;
core_info.path = new_core_path;
2015-12-11 13:51:17 +01:00
2016-07-09 21:50:20 +02:00
if (!core_info_find(&core_info, new_core_path))
found_associated_core = false;
2016-01-25 18:11:26 +01:00
if (!found_associated_core)
{
2017-01-14 18:17:41 +01:00
/* TODO: figure out if this should refer to the inner or outer entry_path */
/* TODO: make sure there's only one entry_path in this function */
int ret = action_ok_file_load_with_detect_core(entry_path,
2016-01-25 18:18:00 +01:00
label, type, selection_ptr, entry_idx);
if (playlist_initialized)
playlist_free(tmp_playlist);
return ret;
}
2016-01-25 18:11:26 +01:00
2017-11-25 21:52:30 +01:00
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);
command_playlist_update_write(
2017-11-25 21:52:30 +01:00
tmp_playlist,
2016-01-25 18:11:26 +01:00
selection_ptr,
NULL,
NULL,
new_core_path,
2017-11-25 21:51:32 +01:00
core_info.inf->display_name,
2017-01-14 18:17:41 +01:00
NULL,
NULL);
}
2018-03-25 19:16:39 +02:00
if (!playlist || !menu_content_playlist_load(playlist, selection_ptr))
2016-12-15 12:18:26 +01:00
{
runloop_msg_queue_push("File could not be loaded from playlist.\n", 1, 100, true);
2018-03-27 17:03:36 +02:00
goto error;
2016-12-15 12:18:26 +01:00
}
playlist_get_index(playlist,
2018-03-25 19:16:39 +02:00
selection_ptr, &path, NULL, NULL, NULL, NULL, NULL);
2017-11-26 07:35:06 +01:00
return default_action_ok_load_content_from_playlist_from_menu(core_path, path, entry_label);
2018-03-27 17:03:36 +02:00
error:
if (playlist_initialized)
playlist_free(tmp_playlist);
return menu_cbs_exit();
}
static int action_ok_lookup_setting(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return menu_setting_set(type, label, MENU_ACTION_OK, false);
}
2015-09-02 18:38:45 +02:00
static int action_ok_audio_add_to_mixer(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
const char *entry_path = NULL;
playlist_t *tmp_playlist = NULL;
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);
if (!tmp_playlist)
return -1;
playlist_get_index(tmp_playlist, entry_idx,
&entry_path, NULL, NULL, NULL, NULL, NULL);
if (filestream_exists(entry_path))
task_push_audio_mixer_load(entry_path,
NULL, NULL);
return 0;
}
static int action_ok_audio_add_to_mixer_and_collection(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char combined_path[PATH_MAX_LENGTH];
menu_handle_t *menu = NULL;
2017-05-28 19:06:15 +02:00
combined_path[0] = '\0';
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
fill_pathname_join(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
2017-11-25 22:59:47 +01:00
command_playlist_push_write(
2017-11-25 21:40:29 +01:00
g_defaults.music_history,
combined_path,
NULL,
"builtin",
2017-11-25 22:59:47 +01:00
"musicplayer");
if (filestream_exists(combined_path))
task_push_audio_mixer_load(combined_path,
NULL, NULL);
return 0;
}
static int action_ok_menu_wallpaper(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
filebrowser_set_type(FILEBROWSER_SELECT_IMAGE);
return action_ok_lookup_setting(path, label, type, idx, entry_idx);
}
2015-09-04 23:11:04 +02:00
2017-05-19 04:44:10 +02:00
static int action_ok_menu_font(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
filebrowser_set_type(FILEBROWSER_SELECT_FONT);
return action_ok_lookup_setting(path, label, type, idx, entry_idx);
}
2015-09-04 22:48:20 +02:00
static int action_ok_menu_wallpaper_load(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
filebrowser_clear_type();
2017-04-28 21:03:04 +02:00
settings->uints.menu_xmb_shader_pipeline = XMB_SHADER_PIPELINE_WALLPAPER;
2015-09-04 22:48:20 +02:00
return generic_action_ok(path, label, type, idx, entry_idx,
ACTION_OK_LOAD_WALLPAPER, MSG_UNKNOWN);
2015-09-04 22:48:20 +02:00
}
2016-11-06 13:05:28 +01:00
int generic_action_ok_help(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
2016-09-15 16:07:20 +02:00
enum msg_hash_enums id, enum menu_dialog_type id2)
{
const char *lbl = msg_hash_to_str(id);
2016-02-10 21:15:23 +01:00
2016-09-04 22:58:54 +02:00
return generic_action_ok_displaylist_push(path, NULL, lbl, id2, idx,
entry_idx, ACTION_OK_DL_HELP);
}
2016-12-27 00:02:09 +01:00
2016-09-15 21:08:54 +02:00
static void menu_input_st_cheat_cb(void *userdata, const char *str)
{
(void)userdata;
if (str && *str)
{
unsigned cheat_index = menu_input_dialog_get_kb_type()
- MENU_SETTINGS_CHEAT_BEGIN;
cheat_manager_set_code(cheat_index, str);
}
menu_input_dialog_end();
}
2016-09-23 13:16:27 +02:00
static void menu_input_wifi_cb(void *userdata, const char *passphrase)
{
unsigned idx = menu_input_dialog_get_kb_idx();
driver_wifi_connect_ssid(idx, passphrase);
2016-09-23 13:16:27 +02:00
menu_input_dialog_end();
}
2017-08-14 20:07:43 +02:00
static void menu_input_st_string_cb_rename_entry(void *userdata,
const char *str)
{
if (str && *str)
{
const char *label = menu_input_dialog_get_buffer();
if (!string_is_empty(label))
command_playlist_update_write(NULL,
2017-11-25 21:45:28 +01:00
menu_input_dialog_get_kb_idx(),
2017-11-25 21:35:00 +01:00
NULL,
label,
NULL,
NULL,
NULL,
2017-11-25 21:35:00 +01:00
NULL);
2017-08-14 20:07:43 +02:00
}
2017-08-14 20:07:43 +02:00
menu_input_dialog_end();
}
static void menu_input_st_string_cb_disable_kiosk_mode(void *userdata,
const char *str)
{
if (str && *str)
{
const char *label = menu_input_dialog_get_buffer();
settings_t *settings = config_get_ptr();
if (string_is_equal(label, settings->paths.kiosk_mode_password))
{
settings->bools.kiosk_mode_enable = false;
runloop_msg_queue_push(
msg_hash_to_str(MSG_INPUT_KIOSK_MODE_PASSWORD_OK),
1, 100, true);
}
else
{
runloop_msg_queue_push(
msg_hash_to_str(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK),
1, 100, true);
}
}
menu_input_dialog_end();
}
static void menu_input_st_string_cb_enable_settings(void *userdata,
const char *str)
{
if (str && *str)
{
const char *label = menu_input_dialog_get_buffer();
settings_t *settings = config_get_ptr();
if (string_is_equal(label, settings->paths.menu_content_show_settings_password))
{
settings->bools.menu_content_show_settings = true;
runloop_msg_queue_push(
msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK),
1, 100, true);
}
else
{
runloop_msg_queue_push(
msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK),
1, 100, true);
}
}
menu_input_dialog_end();
}
2016-07-01 05:42:53 +02:00
static void menu_input_st_string_cb_save_preset(void *userdata,
const char *str)
{
if (str && *str)
{
2016-09-15 19:07:30 +02:00
rarch_setting_t *setting = NULL;
bool ret = false;
const char *label = menu_input_dialog_get_label_buffer();
if (!string_is_empty(label))
setting = menu_setting_find(label);
if (setting)
{
2016-08-29 03:07:20 +02:00
setting_set_with_string_representation(setting, str);
menu_setting_generic(setting, false);
}
else if (!string_is_empty(label))
2016-07-27 18:31:49 -05:00
ret = menu_shader_manager_save_preset(str, false, false);
if(ret)
runloop_msg_queue_push(
2016-07-27 18:31:49 -05:00
msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY),
1, 100, true);
else
runloop_msg_queue_push(
2016-07-27 18:31:49 -05:00
msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET),
1, 100, true);
}
menu_input_dialog_end();
}
2017-11-26 06:03:34 +01:00
static void menu_input_st_string_cb_cheat_file_save_as(
void *userdata, const char *str)
{
if (str && *str)
{
rarch_setting_t *setting = NULL;
settings_t *settings = config_get_ptr();
const char *label = menu_input_dialog_get_label_buffer();
if (!string_is_empty(label))
setting = menu_setting_find(label);
if (setting)
{
setting_set_with_string_representation(setting, str);
menu_setting_generic(setting, false);
}
else if (!string_is_empty(label))
cheat_manager_save(str, settings->paths.path_cheat_database);
}
menu_input_dialog_end();
}
2017-11-26 06:12:51 +01:00
#define default_action_dialog_start(funcname, _label_setting, _idx, _cb) \
static int (funcname)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
menu_input_ctx_line_t line; \
line.label = label; \
line.label_setting = _label_setting; \
line.type = type; \
line.idx = (_idx); \
line.cb = _cb; \
if (!menu_input_dialog_start(&line)) \
return -1; \
return 0; \
2017-11-26 06:03:34 +01:00
}
default_action_dialog_start(action_ok_shader_preset_save_as,
2017-11-26 06:12:51 +01:00
msg_hash_to_str(MSG_INPUT_PRESET_FILENAME),
(unsigned)idx,
menu_input_st_string_cb_save_preset)
default_action_dialog_start(action_ok_enable_settings,
msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD),
(unsigned)entry_idx,
menu_input_st_string_cb_enable_settings)
default_action_dialog_start(action_ok_wifi,
"Passphrase",
(unsigned)idx,
menu_input_wifi_cb)
default_action_dialog_start(action_ok_cheat_file_save_as,
msg_hash_to_str(MSG_INPUT_CHEAT_FILENAME),
(unsigned)idx,
menu_input_st_string_cb_cheat_file_save_as)
default_action_dialog_start(action_ok_cheat,
msg_hash_to_str(MSG_INPUT_CHEAT),
(unsigned)idx,
menu_input_st_cheat_cb)
default_action_dialog_start(action_ok_disable_kiosk_mode,
msg_hash_to_str(MSG_INPUT_KIOSK_MODE_PASSWORD),
(unsigned)entry_idx,
menu_input_st_string_cb_disable_kiosk_mode)
default_action_dialog_start(action_ok_rename_entry,
msg_hash_to_str(MSG_INPUT_RENAME_ENTRY),
(unsigned)entry_idx,
menu_input_st_string_cb_rename_entry)
2017-11-26 06:03:34 +01:00
enum
{
ACTION_OK_SHADER_PRESET_SAVE_CORE = 0,
ACTION_OK_SHADER_PRESET_SAVE_GAME,
ACTION_OK_SHADER_PRESET_SAVE_PARENT
};
static int generic_action_ok_shader_preset_save(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
unsigned action_type)
{
2016-10-08 19:47:26 +02:00
char directory[PATH_MAX_LENGTH];
char file[PATH_MAX_LENGTH];
char tmp[PATH_MAX_LENGTH];
2016-09-06 07:08:25 +02:00
settings_t *settings = config_get_ptr();
const char *core_name = NULL;
2017-04-23 16:41:26 +02:00
rarch_system_info_t *info = runloop_get_system_info();
2016-10-08 19:47:26 +02:00
directory[0] = file[0] = tmp[0] = '\0';
if (info)
core_name = info->info.library_name;
if (!string_is_empty(core_name))
{
fill_pathname_join(
tmp,
2017-04-29 00:39:29 +02:00
settings->paths.directory_video_shader,
"presets",
sizeof(tmp));
fill_pathname_join(
directory,
tmp,
core_name,
sizeof(directory));
}
if (!filestream_exists(directory))
path_mkdir(directory);
switch (action_type)
{
case ACTION_OK_SHADER_PRESET_SAVE_CORE:
if (!string_is_empty(core_name))
fill_pathname_join(file, directory, core_name, sizeof(file));
break;
case ACTION_OK_SHADER_PRESET_SAVE_GAME:
{
const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME));
fill_pathname_join(file, directory, game_name, sizeof(file));
}
break;
case ACTION_OK_SHADER_PRESET_SAVE_PARENT:
{
fill_pathname_parent_dir_name(tmp, path_get(RARCH_PATH_BASENAME), sizeof(tmp));
fill_pathname_join(file, directory, tmp, sizeof(file));
}
break;
}
if(menu_shader_manager_save_preset(file, false, true))
runloop_msg_queue_push(
2016-07-27 18:11:58 -05:00
msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY),
1, 100, true);
else
runloop_msg_queue_push(
2016-07-27 18:11:58 -05:00
msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET),
1, 100, true);
return 0;
}
static int action_ok_shader_preset_save_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_shader_preset_save(path, label, type,
idx, entry_idx, ACTION_OK_SHADER_PRESET_SAVE_CORE);
}
static int action_ok_shader_preset_save_game(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_shader_preset_save(path, label, type,
idx, entry_idx, ACTION_OK_SHADER_PRESET_SAVE_GAME);
}
static int action_ok_shader_preset_save_parent(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_shader_preset_save(path, label, type,
idx, entry_idx, ACTION_OK_SHADER_PRESET_SAVE_PARENT);
}
2017-08-05 00:37:26 -05:00
static int generic_action_ok_remap_file_operation(const char *path,
2015-09-04 21:59:04 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx,
unsigned action_type)
{
2016-10-08 19:47:26 +02:00
char directory[PATH_MAX_LENGTH];
char file[PATH_MAX_LENGTH];
2016-09-06 07:08:25 +02:00
settings_t *settings = config_get_ptr();
const char *core_name = NULL;
2017-04-23 16:41:26 +02:00
rarch_system_info_t *info = runloop_get_system_info();
2016-10-08 19:47:26 +02:00
directory[0] = file[0] = '\0';
if (info)
core_name = info->info.library_name;
2016-06-29 12:13:40 +02:00
if (!string_is_empty(core_name))
fill_pathname_join(
directory,
2017-04-29 00:39:29 +02:00
settings->paths.directory_input_remapping,
2016-06-29 12:13:40 +02:00
core_name,
sizeof(directory));
2015-09-04 21:59:04 +02:00
switch (action_type)
{
case ACTION_OK_REMAP_FILE_SAVE_CORE:
2017-08-05 00:37:26 -05:00
case ACTION_OK_REMAP_FILE_REMOVE_CORE:
2016-11-21 15:37:40 +01:00
if (!string_is_empty(core_name))
fill_pathname_join(file, core_name, core_name, sizeof(file));
2015-09-04 21:59:04 +02:00
break;
case ACTION_OK_REMAP_FILE_SAVE_GAME:
2017-08-05 00:37:26 -05:00
case ACTION_OK_REMAP_FILE_REMOVE_GAME:
2016-11-21 15:37:40 +01:00
if (!string_is_empty(core_name))
2016-09-23 02:04:25 +02:00
fill_pathname_join(file, core_name,
path_basename(path_get(RARCH_PATH_BASENAME)), sizeof(file));
2015-09-04 21:59:04 +02:00
break;
}
2015-04-07 22:51:31 -05:00
if (!filestream_exists(directory))
path_mkdir(directory);
2015-04-07 22:51:31 -05:00
2017-08-05 00:37:26 -05:00
if (action_type < ACTION_OK_REMAP_FILE_REMOVE_CORE)
{
if(input_remapping_save_file(file))
{
if (action_type == ACTION_OK_REMAP_FILE_SAVE_CORE)
rarch_ctl(RARCH_CTL_SET_REMAPS_CORE_ACTIVE, NULL);
2017-09-11 22:49:39 -05:00
else if (action_type == ACTION_OK_REMAP_FILE_SAVE_GAME)
2017-08-05 00:37:26 -05:00
rarch_ctl(RARCH_CTL_SET_REMAPS_GAME_ACTIVE, NULL);
runloop_msg_queue_push(
msg_hash_to_str(MSG_REMAP_FILE_SAVED_SUCCESSFULLY),
1, 100, true);
}
else
runloop_msg_queue_push(
msg_hash_to_str(MSG_ERROR_SAVING_REMAP_FILE),
1, 100, true);
}
2015-04-07 22:40:42 -05:00
else
2017-08-05 00:37:26 -05:00
{
if(input_remapping_remove_file(file))
{
if (action_type == ACTION_OK_REMAP_FILE_REMOVE_CORE &&
2017-09-11 22:49:39 -05:00
rarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL))
{
2017-08-05 00:37:26 -05:00
rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL);
2017-09-11 22:49:39 -05:00
input_remapping_set_defaults(true);
}
else if (action_type == ACTION_OK_REMAP_FILE_REMOVE_GAME &&
rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL))
{
2017-08-05 00:37:26 -05:00
rarch_ctl(RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE, NULL);
2017-09-11 22:49:39 -05:00
input_remapping_set_defaults(true);
}
2015-04-07 22:51:31 -05:00
2017-08-05 00:37:26 -05:00
runloop_msg_queue_push(
msg_hash_to_str(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY),
1, 100, true);
}
else
runloop_msg_queue_push(
msg_hash_to_str(MSG_ERROR_REMOVING_REMAP_FILE),
1, 100, true);
}
return 0;
}
2015-09-04 21:59:04 +02:00
static int action_ok_remap_file_save_core(const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2017-08-05 00:37:26 -05:00
return generic_action_ok_remap_file_operation(path, label, type,
2015-09-04 21:59:04 +02:00
idx, entry_idx, ACTION_OK_REMAP_FILE_SAVE_CORE);
}
2015-04-07 22:51:31 -05:00
2015-09-04 21:59:04 +02:00
static int action_ok_remap_file_save_game(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2017-08-05 00:37:26 -05:00
return generic_action_ok_remap_file_operation(path, label, type,
2015-09-04 21:59:04 +02:00
idx, entry_idx, ACTION_OK_REMAP_FILE_SAVE_GAME);
}
2017-08-05 00:37:26 -05:00
static int action_ok_remap_file_remove_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_remap_file_operation(path, label, type,
idx, entry_idx, ACTION_OK_REMAP_FILE_REMOVE_CORE);
}
static int action_ok_remap_file_remove_game(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_remap_file_operation(path, label, type,
idx, entry_idx, ACTION_OK_REMAP_FILE_REMOVE_GAME);
}
int action_ok_path_use_directory(const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
filebrowser_clear_type();
2016-06-17 15:33:42 +02:00
return generic_action_ok(NULL, label, type, idx, entry_idx,
ACTION_OK_SET_DIRECTORY, MSG_UNKNOWN);
}
2015-11-24 01:12:50 +01:00
#ifdef HAVE_LIBRETRODB
2015-07-04 02:07:18 +02:00
static int action_ok_scan_file(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return action_scan_file(path, label, type, idx);
}
2015-07-04 01:51:41 +02:00
static int action_ok_path_scan_directory(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return action_scan_directory(NULL, label, type, idx);
}
2015-11-24 01:12:50 +01:00
#endif
2015-07-04 01:51:41 +02:00
2018-03-22 19:46:02 -04:00
static int action_ok_core_deferred_set(const char *new_core_path,
const char *content_label, unsigned type, size_t idx, size_t entry_idx)
{
2017-11-25 21:35:00 +01:00
char core_display_name[PATH_MAX_LENGTH];
menu_handle_t *menu = NULL;
size_t selection = menu_navigation_get_selection();
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
2017-11-25 21:35:00 +01:00
core_display_name[0] = '\0';
core_info_get_name(new_core_path,
core_display_name, sizeof(core_display_name));
command_playlist_update_write(
NULL,
menu->rdb_entry_start_game_selection_ptr,
NULL,
2018-03-22 19:46:02 -04:00
content_label,
new_core_path,
core_display_name,
NULL,
NULL);
menu_entries_pop_stack(&selection, 0, 1);
menu_navigation_set_selection(selection);
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
}
2016-06-20 19:54:04 +02:00
static int action_ok_deferred_list_stub(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return 0;
}
2016-06-15 18:07:00 +02:00
static int action_ok_load_core_deferred(const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2017-04-27 01:23:04 +02:00
content_ctx_info_t content_info;
menu_handle_t *menu = NULL;
2017-04-27 01:23:04 +02:00
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
2016-02-10 21:15:23 +01:00
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
2017-02-21 18:36:38 +01:00
if (!task_push_load_content_with_new_core_from_menu(
path, menu->deferred_path,
&content_info,
CORE_TYPE_PLAIN,
NULL, NULL))
return -1;
2017-11-27 07:25:01 +01:00
content_add_to_playlist(path);
return 0;
}
2017-11-26 06:23:14 +01:00
#define default_action_ok_start_builtin_core(funcname, _id) \
static int (funcname)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
content_ctx_info_t content_info; \
content_info.argc = 0; \
content_info.argv = NULL; \
content_info.args = NULL; \
content_info.environ_get = NULL; \
if (!task_push_start_builtin_core(&content_info, _id, NULL, NULL)) \
return -1; \
return 0; \
}
2017-11-26 06:23:14 +01:00
default_action_ok_start_builtin_core(action_ok_start_net_retropad_core, CORE_TYPE_NETRETROPAD)
default_action_ok_start_builtin_core(action_ok_start_video_processor_core, CORE_TYPE_VIDEO_PROCESSOR)
2017-05-28 18:33:44 +02:00
#ifdef HAVE_FFMPEG
2016-06-20 19:54:04 +02:00
static int action_ok_file_load_ffmpeg(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char new_path[PATH_MAX_LENGTH];
const char *menu_path = NULL;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
2017-11-26 07:29:19 +01:00
2017-10-01 17:20:01 +02:00
file_list_get_last(menu_stack, &menu_path, NULL, NULL, NULL);
new_path[0] = '\0';
2017-10-04 06:53:47 +02:00
if (!string_is_empty(menu_path))
fill_pathname_join(new_path, menu_path, path,
sizeof(new_path));
2017-02-21 18:36:38 +01:00
2017-11-26 07:29:19 +01:00
return default_action_ok_load_content_with_core_from_menu(new_path, CORE_TYPE_FFMPEG);
}
2017-05-28 18:33:44 +02:00
#endif
static int action_ok_audio_run(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char combined_path[PATH_MAX_LENGTH];
menu_handle_t *menu = NULL;
2017-05-29 02:30:04 +02:00
combined_path[0] = '\0';
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
fill_pathname_join(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
2017-11-26 07:29:19 +01:00
return default_action_ok_load_content_with_core_from_menu(combined_path, CORE_TYPE_FFMPEG);
}
2015-06-28 17:21:32 +02:00
static int action_ok_file_load_imageviewer(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-10-26 06:23:05 +02:00
char fullpath[PATH_MAX_LENGTH];
2016-06-20 19:54:04 +02:00
const char *menu_path = NULL;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
2017-10-01 17:20:01 +02:00
file_list_get_last(menu_stack, &menu_path, NULL, NULL, NULL);
2016-06-20 19:54:04 +02:00
2016-10-26 06:23:05 +02:00
fullpath[0] = '\0';
2017-10-04 06:53:47 +02:00
if (!string_is_empty(menu_path))
fill_pathname_join(fullpath, menu_path, path,
sizeof(fullpath));
2017-02-21 18:36:38 +01:00
2017-11-26 07:29:19 +01:00
return default_action_ok_load_content_with_core_from_menu(fullpath, CORE_TYPE_IMAGEVIEWER);
2015-06-28 17:21:32 +02:00
}
static int action_ok_file_load_current_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
return default_action_ok_load_content_with_core_from_menu(
menu->detect_content_path, CORE_TYPE_PLAIN);
}
2016-06-20 19:54:04 +02:00
static int action_ok_file_load_detect_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2017-04-27 01:23:04 +02:00
content_ctx_info_t content_info;
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
2017-04-27 01:23:04 +02:00
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
2017-02-21 18:36:38 +01:00
if (!task_push_load_content_with_new_core_from_menu(
path, menu->detect_content_path,
&content_info,
CORE_TYPE_PLAIN,
NULL, NULL))
return -1;
content_add_to_playlist(menu->detect_content_path);
return 0;
2016-06-20 19:54:04 +02:00
}
static int action_ok_load_state(const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-05-09 20:51:53 +02:00
if (generic_action_ok_command(CMD_EVENT_LOAD_STATE) == -1)
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
2016-05-09 20:51:53 +02:00
return generic_action_ok_command(CMD_EVENT_RESUME);
}
2016-06-04 14:34:06 -05:00
static int action_ok_save_state(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
if (generic_action_ok_command(CMD_EVENT_SAVE_STATE) == -1)
return menu_cbs_exit();
return generic_action_ok_command(CMD_EVENT_RESUME);
}
static int action_ok_undo_load_state(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
if (generic_action_ok_command(CMD_EVENT_UNDO_LOAD_STATE) == -1)
return menu_cbs_exit();
return generic_action_ok_command(CMD_EVENT_RESUME);
}
2016-06-04 14:34:06 -05:00
static int action_ok_undo_save_state(const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-06-04 14:34:06 -05:00
if (generic_action_ok_command(CMD_EVENT_UNDO_SAVE_STATE) == -1)
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
2016-05-09 20:51:53 +02:00
return generic_action_ok_command(CMD_EVENT_RESUME);
}
2016-02-03 15:50:51 +01:00
#ifdef HAVE_NETWORKING
2016-10-30 03:27:43 +01:00
2016-05-11 21:22:45 +02:00
#ifdef HAVE_ZLIB
2016-02-03 15:50:51 +01:00
static void cb_decompressed(void *task_data, void *user_data, const char *err)
{
decompress_task_data_t *dec = (decompress_task_data_t*)task_data;
2016-02-03 15:50:51 +01:00
if (dec && !err)
2016-02-03 15:50:51 +01:00
{
unsigned type_hash = (unsigned)(uintptr_t)user_data;
2016-06-29 17:07:18 +02:00
switch (type_hash)
{
case CB_CORE_UPDATER_DOWNLOAD:
generic_action_ok_command(CMD_EVENT_CORE_INFO_INIT);
break;
case CB_UPDATE_ASSETS:
generic_action_ok_command(CMD_EVENT_REINIT);
break;
}
2016-02-03 15:50:51 +01:00
}
if (err)
RARCH_ERR("%s", err);
if (dec)
{
if (filestream_exists(dec->source_file))
filestream_delete(dec->source_file);
2016-02-03 15:50:51 +01:00
free(dec->source_file);
free(dec);
}
}
2016-05-11 21:22:45 +02:00
#endif
2016-02-03 15:50:51 +01:00
2016-06-21 04:09:13 +02:00
static int generic_action_ok_network(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
enum msg_hash_enums enum_idx)
{
2016-10-08 19:47:26 +02:00
char url_path[PATH_MAX_LENGTH];
2016-06-21 04:09:13 +02:00
settings_t *settings = config_get_ptr();
unsigned type_id2 = 0;
file_transfer_t *transf = NULL;
2016-06-21 04:09:13 +02:00
const char *url_label = NULL;
retro_task_callback_t callback = NULL;
bool refresh = true;
2016-07-12 05:22:24 +02:00
bool suppress_msg = false;
2016-06-21 04:09:13 +02:00
2016-10-08 19:47:26 +02:00
url_path[0] = '\0';
2016-06-21 04:09:13 +02:00
switch (enum_idx)
{
case MENU_ENUM_LABEL_CB_CORE_CONTENT_DIRS_LIST:
2017-04-29 00:39:29 +02:00
if (string_is_empty(settings->paths.network_buildbot_assets_url))
return menu_cbs_exit();
2017-04-29 00:39:29 +02:00
fill_pathname_join(url_path,
settings->paths.network_buildbot_assets_url,
2016-06-21 04:09:13 +02:00
"cores/.index-dirs", sizeof(url_path));
url_label = msg_hash_to_str(enum_idx);
type_id2 = ACTION_OK_DL_CORE_CONTENT_DIRS_LIST;
callback = cb_net_generic;
2016-07-12 05:22:24 +02:00
suppress_msg = true;
2016-06-21 04:09:13 +02:00
break;
case MENU_ENUM_LABEL_CB_CORE_CONTENT_LIST:
2016-06-21 05:13:43 +02:00
fill_pathname_join(url_path, path,
file_path_str(FILE_PATH_INDEX_URL), sizeof(url_path));
2016-06-21 04:09:13 +02:00
url_label = msg_hash_to_str(enum_idx);
type_id2 = ACTION_OK_DL_CORE_CONTENT_LIST;
callback = cb_net_generic;
2016-07-12 05:22:24 +02:00
suppress_msg = true;
2016-06-21 04:09:13 +02:00
break;
case MENU_ENUM_LABEL_CB_CORE_UPDATER_LIST:
2017-04-29 00:39:29 +02:00
if (string_is_empty(settings->paths.network_buildbot_url))
return menu_cbs_exit();
2017-04-29 00:39:29 +02:00
fill_pathname_join(url_path, settings->paths.network_buildbot_url,
2016-06-21 04:09:13 +02:00
file_path_str(FILE_PATH_INDEX_EXTENDED_URL), sizeof(url_path));
url_label = msg_hash_to_str(enum_idx);
type_id2 = ACTION_OK_DL_CORE_UPDATER_LIST;
callback = cb_net_generic;
break;
case MENU_ENUM_LABEL_CB_THUMBNAILS_UPDATER_LIST:
fill_pathname_join(url_path,
file_path_str(FILE_PATH_CORE_THUMBNAILS_URL),
file_path_str(FILE_PATH_INDEX_URL), sizeof(url_path));
url_label = msg_hash_to_str(enum_idx);
type_id2 = ACTION_OK_DL_THUMBNAILS_UPDATER_LIST;
callback = cb_net_generic;
break;
#ifdef HAVE_LAKKA
case MENU_ENUM_LABEL_CB_LAKKA_LIST:
/* TODO unhardcode this path */
fill_pathname_join(url_path,
2016-06-21 04:09:13 +02:00
file_path_str(FILE_PATH_LAKKA_URL),
2016-11-15 10:18:21 +01:00
lakka_get_project(), sizeof(url_path));
2016-06-21 04:09:13 +02:00
fill_pathname_join(url_path, url_path,
file_path_str(FILE_PATH_INDEX_URL),
sizeof(url_path));
url_label = msg_hash_to_str(enum_idx);
type_id2 = ACTION_OK_DL_LAKKA_LIST;
callback = cb_net_generic;
break;
#endif
default:
break;
}
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_NETWORK_INIT);
2016-06-21 04:09:13 +02:00
transf = (file_transfer_t*)calloc(1, sizeof(*transf));
2016-07-11 19:33:07 +02:00
strlcpy(transf->path, url_path, sizeof(transf->path));
2016-07-12 05:22:24 +02:00
task_push_http_transfer(url_path, suppress_msg, url_label, callback, transf);
2016-06-21 04:09:13 +02:00
return generic_action_ok_displaylist_push(path, NULL,
2016-06-21 04:09:13 +02:00
label, type, idx, entry_idx, type_id2);
}
2017-11-26 06:49:58 +01:00
#define default_action_ok_list(funcname, _id) \
static int (funcname)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
return generic_action_ok_network(path, label, type, idx, entry_idx, _id); \
2016-06-21 04:09:13 +02:00
}
2017-11-26 06:49:58 +01:00
default_action_ok_list(action_ok_core_content_list, MENU_ENUM_LABEL_CB_CORE_CONTENT_LIST)
default_action_ok_list(action_ok_core_content_dirs_list, MENU_ENUM_LABEL_CB_CORE_CONTENT_DIRS_LIST)
default_action_ok_list(action_ok_core_updater_list, MENU_ENUM_LABEL_CB_CORE_UPDATER_LIST)
default_action_ok_list(action_ok_thumbnails_updater_list, MENU_ENUM_LABEL_CB_THUMBNAILS_UPDATER_LIST)
default_action_ok_list(action_ok_lakka_list, MENU_ENUM_LABEL_CB_LAKKA_LIST)
2016-06-21 04:09:13 +02:00
static void cb_generic_dir_download(void *task_data,
void *user_data, const char *err)
{
file_transfer_t *transf = (file_transfer_t*)user_data;
2016-06-21 04:09:13 +02:00
2017-01-03 12:00:45 -05:00
if (transf)
{
generic_action_ok_network(transf->path, transf->path, 0, 0, 0,
MENU_ENUM_LABEL_CB_CORE_CONTENT_LIST);
free(transf);
}
2016-06-21 04:09:13 +02:00
}
/* expects http_transfer_t*, file_transfer_t* */
2016-02-03 15:50:51 +01:00
static void cb_generic_download(void *task_data,
void *user_data, const char *err)
{
2016-10-08 19:47:26 +02:00
char output_path[PATH_MAX_LENGTH];
2017-12-29 13:00:24 +01:00
#if defined(HAVE_COMPRESSION) && defined(HAVE_ZLIB)
bool extract = true;
#endif
2016-02-03 15:50:51 +01:00
const char *dir_path = NULL;
file_transfer_t *transf = (file_transfer_t*)user_data;
2016-02-03 15:50:51 +01:00
settings_t *settings = config_get_ptr();
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
if (!data || !data->data | !transf)
goto finish;
2016-10-08 19:47:26 +02:00
output_path[0] = '\0';
2016-02-03 15:50:51 +01:00
/* we have to determine dir_path at the time of writting or else
* we'd run into races when the user changes the setting during an
* http transfer. */
switch (transf->enum_idx)
2016-02-03 15:50:51 +01:00
{
case MENU_ENUM_LABEL_CB_CORE_THUMBNAILS_DOWNLOAD:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.directory_thumbnails;
break;
case MENU_ENUM_LABEL_CB_CORE_UPDATER_DOWNLOAD:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.directory_libretro;
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.directory_core_assets;
2017-12-29 13:00:24 +01:00
#if defined(HAVE_COMPRESSION) && defined(HAVE_ZLIB)
2017-04-28 13:43:47 +02:00
extract = settings->bools.network_buildbot_auto_extract_archive;
2017-12-29 13:00:24 +01:00
#endif
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_CORE_INFO_FILES:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.path_libretro_info;
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_ASSETS:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.directory_assets;
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_AUTOCONFIG_PROFILES:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.directory_autoconfig;
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_DATABASES:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.path_content_database;
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_OVERLAYS:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.directory_overlay;
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_CHEATS:
2017-04-29 00:39:29 +02:00
dir_path = settings->paths.path_cheat_database;
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_CG:
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_GLSL:
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_SLANG:
2016-12-14 16:33:54 +01:00
{
static char shaderdir[PATH_MAX_LENGTH] = {0};
const char *dirname = NULL;
if (transf->enum_idx == MENU_ENUM_LABEL_CB_UPDATE_SHADERS_CG)
dirname = "shaders_cg";
else if (transf->enum_idx == MENU_ENUM_LABEL_CB_UPDATE_SHADERS_GLSL)
dirname = "shaders_glsl";
else if (transf->enum_idx == MENU_ENUM_LABEL_CB_UPDATE_SHADERS_SLANG)
dirname = "shaders_slang";
fill_pathname_join(shaderdir,
2017-04-29 00:39:29 +02:00
settings->paths.directory_video_shader,
2016-12-14 16:33:54 +01:00
dirname,
sizeof(shaderdir));
if (!filestream_exists(shaderdir) && !path_mkdir(shaderdir))
2016-02-03 15:50:51 +01:00
goto finish;
2016-12-14 16:33:54 +01:00
dir_path = shaderdir;
}
2016-02-03 15:50:51 +01:00
break;
case MENU_ENUM_LABEL_CB_LAKKA_DOWNLOAD:
2016-03-23 21:40:41 +07:00
dir_path = LAKKA_UPDATE_DIR;
2016-02-03 15:50:51 +01:00
break;
default:
RARCH_WARN("Unknown transfer type '%s' bailing out.\n",
msg_hash_to_str(transf->enum_idx));
2016-02-03 15:50:51 +01:00
break;
}
2016-06-29 12:13:40 +02:00
if (!string_is_empty(dir_path))
fill_pathname_join(output_path, dir_path,
transf->path, sizeof(output_path));
2016-02-03 15:50:51 +01:00
/* Make sure the directory exists */
path_basedir_wrapper(output_path);
2016-06-29 12:13:40 +02:00
2016-02-03 15:50:51 +01:00
if (!path_mkdir(output_path))
{
2016-07-01 05:42:53 +02:00
err = msg_hash_to_str(MSG_FAILED_TO_CREATE_THE_DIRECTORY);
2016-02-03 15:50:51 +01:00
goto finish;
}
if (!string_is_empty(dir_path))
fill_pathname_join(output_path, dir_path,
transf->path, sizeof(output_path));
2016-02-03 15:50:51 +01:00
#ifdef HAVE_COMPRESSION
if (path_is_compressed_file(output_path))
{
2016-05-27 18:14:47 +02:00
if (task_check_decompress(output_path))
{
2016-07-01 05:42:53 +02:00
err = msg_hash_to_str(MSG_DECOMPRESSION_ALREADY_IN_PROGRESS);
goto finish;
}
}
#endif
2016-03-24 04:09:25 +01:00
if (!filestream_write_file(output_path, data->data, data->len))
2016-02-03 15:50:51 +01:00
{
err = "Write failed.";
goto finish;
}
2016-10-30 03:27:43 +01:00
#if defined(HAVE_COMPRESSION) && defined(HAVE_ZLIB)
if (!extract)
2016-02-03 15:50:51 +01:00
goto finish;
if (path_is_compressed_file(output_path))
2016-02-03 15:50:51 +01:00
{
2016-07-01 05:42:53 +02:00
if (!task_push_decompress(output_path, dir_path,
NULL, NULL, NULL,
cb_decompressed, (void*)(uintptr_t)
msg_hash_calculate(msg_hash_to_str(transf->enum_idx))))
{
2016-07-01 05:42:53 +02:00
err = msg_hash_to_str(MSG_DECOMPRESSION_FAILED);
goto finish;
}
2016-02-03 15:50:51 +01:00
}
#else
switch (transf->enum_idx)
{
case MENU_ENUM_LABEL_CB_CORE_UPDATER_DOWNLOAD:
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_CORE_INFO_INIT);
break;
default:
break;
}
2016-02-03 15:50:51 +01:00
#endif
finish:
if (err)
{
RARCH_ERR("Download of '%s' failed: %s\n",
(transf ? transf->path: "unknown"), err);
}
if (data)
{
if (data->data)
free(data->data);
free(data);
}
if (transf)
free(transf);
}
#endif
2015-06-24 15:56:49 +02:00
static int action_ok_download_generic(const char *path,
const char *label, const char *menu_label,
unsigned type, size_t idx, size_t entry_idx,
enum msg_hash_enums enum_idx)
2015-06-24 15:56:49 +02:00
{
2015-09-03 23:50:18 +02:00
#ifdef HAVE_NETWORKING
2016-10-08 19:47:26 +02:00
char s[PATH_MAX_LENGTH];
char s2[PATH_MAX_LENGTH];
2016-10-08 19:47:26 +02:00
char s3[PATH_MAX_LENGTH];
file_transfer_t *transf = NULL;
2016-01-25 18:19:19 +01:00
settings_t *settings = config_get_ptr();
bool suppress_msg = false;
2016-06-21 04:09:13 +02:00
retro_task_callback_t cb = cb_generic_download;
s[0] = s2[0] = s3[0] = '\0';
2016-10-08 19:47:26 +02:00
2016-07-01 05:17:04 +02:00
fill_pathname_join(s,
2017-04-29 00:39:29 +02:00
settings->paths.network_buildbot_assets_url,
2015-06-24 17:34:07 +02:00
"frontend", sizeof(s));
2016-06-18 18:23:09 +02:00
switch (enum_idx)
{
2016-06-21 01:40:55 +02:00
case MENU_ENUM_LABEL_CB_DOWNLOAD_URL:
suppress_msg = true;
2016-06-21 01:40:55 +02:00
fill_pathname_join(s, label,
path, sizeof(s));
2016-06-27 21:15:26 +02:00
path = s;
2016-06-21 04:09:13 +02:00
cb = cb_generic_dir_download;
break;
2016-06-18 18:23:09 +02:00
case MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD:
{
struct string_list *str_list = string_split(menu_label, ";");
strlcpy(s, str_list->elems[0].data, sizeof(s));
string_list_free(str_list);
}
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_LAKKA_DOWNLOAD:
#ifdef HAVE_LAKKA
2016-06-18 18:23:09 +02:00
/* TODO unhardcode this path*/
2016-06-20 21:03:54 +02:00
fill_pathname_join(s, file_path_str(FILE_PATH_LAKKA_URL),
2016-11-15 10:18:21 +01:00
lakka_get_project(), sizeof(s));
#endif
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_ASSETS:
2016-06-20 21:03:54 +02:00
path = file_path_str(FILE_PATH_ASSETS_ZIP);
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_AUTOCONFIG_PROFILES:
2016-06-20 21:03:54 +02:00
path = file_path_str(FILE_PATH_AUTOCONFIG_ZIP);
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_CORE_INFO_FILES:
2016-06-20 21:03:54 +02:00
path = file_path_str(FILE_PATH_CORE_INFO_ZIP);
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_CHEATS:
2016-06-20 21:03:54 +02:00
path = file_path_str(FILE_PATH_CHEATS_ZIP);
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_OVERLAYS:
2016-06-20 21:03:54 +02:00
path = file_path_str(FILE_PATH_OVERLAYS_ZIP);
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_DATABASES:
2016-06-20 21:03:54 +02:00
path = file_path_str(FILE_PATH_DATABASE_RDB_ZIP);
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_GLSL:
2016-06-20 21:03:54 +02:00
path = file_path_str(FILE_PATH_SHADERS_GLSL_ZIP);
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_SLANG:
path = file_path_str(FILE_PATH_SHADERS_SLANG_ZIP);
break;
2016-06-18 18:23:09 +02:00
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_CG:
2016-06-20 21:03:54 +02:00
path = file_path_str(FILE_PATH_SHADERS_CG_ZIP);
2016-06-18 18:23:09 +02:00
break;
case MENU_ENUM_LABEL_CB_CORE_THUMBNAILS_DOWNLOAD:
2016-06-20 21:03:54 +02:00
strlcpy(s, file_path_str(FILE_PATH_CORE_THUMBNAILS_URL), sizeof(s));
2016-06-18 18:23:09 +02:00
break;
default:
2017-04-29 00:39:29 +02:00
strlcpy(s, settings->paths.network_buildbot_url, sizeof(s));
2016-06-18 18:23:09 +02:00
break;
}
2015-06-24 17:34:07 +02:00
fill_pathname_join(s2, s, path, sizeof(s2));
transf = (file_transfer_t*)calloc(1, sizeof(*transf));
transf->enum_idx = enum_idx;
2015-11-23 11:13:26 -03:00
strlcpy(transf->path, path, sizeof(transf->path));
2015-06-24 16:17:29 +02:00
net_http_urlencode_full(s3, s2, sizeof(s));
task_push_http_transfer(s3, suppress_msg, msg_hash_to_str(enum_idx), cb, transf);
2015-09-03 23:50:18 +02:00
#endif
2015-06-24 15:56:49 +02:00
return 0;
}
2015-07-04 04:01:35 +02:00
static int action_ok_core_content_download(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
const char *menu_path = NULL;
const char *menu_label = NULL;
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL);
2016-07-01 05:17:04 +02:00
return action_ok_download_generic(path, label,
menu_path, type, idx, entry_idx,
2016-06-18 18:23:09 +02:00
MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD);
2015-07-04 04:01:35 +02:00
}
2017-11-26 07:04:05 +01:00
#define default_action_ok_download(funcname, _id) \
static int (funcname)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
return action_ok_download_generic(path, label, NULL, type, idx, entry_idx,_id); \
}
default_action_ok_download(action_ok_core_content_thumbnails, MENU_ENUM_LABEL_CB_CORE_THUMBNAILS_DOWNLOAD)
default_action_ok_download(action_ok_thumbnails_updater_download, MENU_ENUM_LABEL_CB_THUMBNAILS_UPDATER_DOWNLOAD)
default_action_ok_download(action_ok_download_url, MENU_ENUM_LABEL_CB_DOWNLOAD_URL)
default_action_ok_download(action_ok_core_updater_download, MENU_ENUM_LABEL_CB_CORE_UPDATER_DOWNLOAD)
default_action_ok_download(action_ok_lakka_download, MENU_ENUM_LABEL_CB_LAKKA_DOWNLOAD)
default_action_ok_download(action_ok_update_assets, MENU_ENUM_LABEL_CB_UPDATE_ASSETS)
default_action_ok_download(action_ok_update_core_info_files, MENU_ENUM_LABEL_CB_UPDATE_CORE_INFO_FILES)
default_action_ok_download(action_ok_update_overlays, MENU_ENUM_LABEL_CB_UPDATE_OVERLAYS)
default_action_ok_download(action_ok_update_shaders_cg, MENU_ENUM_LABEL_CB_UPDATE_SHADERS_CG)
default_action_ok_download(action_ok_update_shaders_glsl, MENU_ENUM_LABEL_CB_UPDATE_SHADERS_GLSL)
default_action_ok_download(action_ok_update_shaders_slang, MENU_ENUM_LABEL_CB_UPDATE_SHADERS_SLANG)
default_action_ok_download(action_ok_update_databases, MENU_ENUM_LABEL_CB_UPDATE_DATABASES)
default_action_ok_download(action_ok_update_cheats, MENU_ENUM_LABEL_CB_UPDATE_CHEATS)
default_action_ok_download(action_ok_update_autoconfig_profiles, MENU_ENUM_LABEL_CB_UPDATE_AUTOCONFIG_PROFILES)
2015-09-03 23:38:07 +02:00
2016-01-26 02:21:03 +01:00
/* creates folder and core options stub file for subsequent runs */
static int action_ok_option_create(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char game_path[PATH_MAX_LENGTH];
2016-06-03 04:59:12 +02:00
config_file_t *conf = NULL;
2016-01-26 02:21:03 +01:00
game_path[0] = '\0';
2016-05-09 07:09:26 +02:00
if (!retroarch_validate_game_options(game_path, sizeof(game_path), true))
2016-01-26 02:21:03 +01:00
{
runloop_msg_queue_push(
2016-07-01 05:42:53 +02:00
msg_hash_to_str(MSG_ERROR_SAVING_CORE_OPTIONS_FILE),
2016-01-25 18:14:14 +01:00
1, 100, true);
2016-01-26 02:21:03 +01:00
return 0;
}
conf = config_file_new(game_path);
if (!conf)
{
conf = config_file_new(NULL);
if (!conf)
return false;
}
if(config_file_write(conf, game_path))
{
runloop_msg_queue_push(
2016-07-01 05:42:53 +02:00
msg_hash_to_str(MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY),
2016-01-26 02:21:03 +01:00
1, 100, true);
2016-09-29 07:40:14 +02:00
path_set(RARCH_PATH_CORE_OPTIONS, game_path);
}
2016-01-31 02:16:55 -05:00
config_file_free(conf);
2016-01-26 02:21:03 +01:00
2015-11-15 22:09:39 -05:00
return 0;
}
int action_ok_close_content(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx)
{
/* This line resets the navigation pointer so the active entry will be "Run" */
menu_navigation_set_selection(0);
return generic_action_ok_command(CMD_EVENT_UNLOAD_CORE);
}
2017-08-13 06:57:32 +02:00
#define default_action_ok_cmd_func(func_name, cmd) \
int (func_name)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
return generic_action_ok_command(cmd); \
2015-09-04 13:08:15 +02:00
}
2015-09-04 00:27:55 +02:00
2017-11-26 07:17:31 +01:00
default_action_ok_cmd_func(action_ok_cheat_apply_changes,CMD_EVENT_CHEATS_APPLY)
2017-08-13 06:57:32 +02:00
default_action_ok_cmd_func(action_ok_quit, CMD_EVENT_QUIT)
default_action_ok_cmd_func(action_ok_save_new_config, CMD_EVENT_MENU_SAVE_CONFIG)
default_action_ok_cmd_func(action_ok_resume_content, CMD_EVENT_RESUME)
default_action_ok_cmd_func(action_ok_restart_content, CMD_EVENT_RESET)
default_action_ok_cmd_func(action_ok_screenshot, CMD_EVENT_TAKE_SCREENSHOT)
default_action_ok_cmd_func(action_ok_disk_cycle_tray_status, CMD_EVENT_DISK_EJECT_TOGGLE )
default_action_ok_cmd_func(action_ok_shader_apply_changes, CMD_EVENT_SHADERS_APPLY_CHANGES )
static int action_ok_reset_core_association(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
const char *tmp_path = NULL;
playlist_t *tmp_playlist = NULL;
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);
if (!tmp_playlist)
return 0;
playlist_get_index(tmp_playlist,
menu->rpl_entry_selection_ptr,
&tmp_path, NULL, NULL, NULL, NULL, NULL);
if (!command_event(CMD_EVENT_RESET_CORE_ASSOCIATION,
(void *)&menu->rpl_entry_selection_ptr))
return menu_cbs_exit();
return 0;
}
static int action_ok_add_to_favorites(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
void *new_path = (void*)path_get(RARCH_PATH_CONTENT);
if (!command_event(CMD_EVENT_ADD_TO_FAVORITES, new_path))
return menu_cbs_exit();
return 0;
}
static int action_ok_add_to_favorites_playlist(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
const char *tmp_path = NULL;
playlist_t *tmp_playlist = NULL;
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);
if (!tmp_playlist)
return 0;
playlist_get_index(tmp_playlist,
menu->rpl_entry_selection_ptr, &tmp_path,
NULL, NULL, NULL, NULL, NULL);
if (!command_event(CMD_EVENT_ADD_TO_FAVORITES, (void*)tmp_path))
return menu_cbs_exit();
return 0;
2015-09-04 00:27:55 +02:00
}
2017-08-14 20:07:43 +02:00
static int action_ok_delete_entry(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-08-29 17:09:45 +02:00
size_t new_selection_ptr;
2017-08-14 02:49:55 +02:00
playlist_t *playlist = NULL;
char *conf_path = NULL;
char *def_conf_path = NULL;
char *def_conf_music_path = NULL;
#ifdef HAVE_FFMPEG
2017-08-14 02:49:55 +02:00
char *def_conf_video_path = NULL;
#endif
#ifdef HAVE_IMAGEVIEWER
2017-08-14 02:49:55 +02:00
char *def_conf_img_path = NULL;
#endif
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist);
2017-08-14 02:49:55 +02:00
conf_path = playlist_get_conf_path(playlist);
def_conf_path = playlist_get_conf_path(g_defaults.content_history);
def_conf_music_path = playlist_get_conf_path(g_defaults.music_history);
#ifdef HAVE_FFMPEG
def_conf_video_path = playlist_get_conf_path(g_defaults.video_history);
#endif
#ifdef HAVE_IMAGEVIEWER
def_conf_img_path = playlist_get_conf_path(g_defaults.image_history);
#endif
if (string_is_equal(conf_path, def_conf_path))
2016-08-29 02:39:02 +02:00
playlist = g_defaults.content_history;
else if (string_is_equal(conf_path, def_conf_music_path))
playlist = g_defaults.music_history;
#ifdef HAVE_FFMPEG
else if (string_is_equal(conf_path, def_conf_video_path))
playlist = g_defaults.video_history;
2016-08-29 02:39:02 +02:00
#endif
#ifdef HAVE_IMAGEVIEWER
else if (string_is_equal(conf_path, def_conf_img_path))
playlist = g_defaults.image_history;
2016-08-29 02:39:02 +02:00
#endif
2017-11-25 23:39:31 +01:00
if (playlist)
{
playlist_delete_index(playlist, menu->rpl_entry_selection_ptr);
2017-11-25 23:39:31 +01:00
playlist_write_file(playlist);
}
new_selection_ptr = menu_navigation_get_selection();
menu_entries_pop_stack(&new_selection_ptr, 0, 1);
menu_navigation_set_selection(new_selection_ptr);
return 0;
}
2015-09-04 00:44:09 +02:00
static int action_ok_rdb_entry_submenu(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
union string_list_elem_attr attr;
2016-10-08 19:44:03 +02:00
char new_label[PATH_MAX_LENGTH];
char new_path[PATH_MAX_LENGTH];
2016-06-03 04:59:12 +02:00
int ret = -1;
2015-09-04 00:44:09 +02:00
char *rdb = NULL;
int len = 0;
struct string_list *str_list = NULL;
struct string_list *str_list2 = NULL;
if (!label)
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
2015-09-04 00:44:09 +02:00
2016-10-08 19:44:03 +02:00
new_label[0] = new_path[0] = '\0';
2015-09-04 00:44:09 +02:00
str_list = string_split(label, "|");
if (!str_list)
goto end;
str_list2 = string_list_new();
if (!str_list2)
goto end;
/* element 0 : label
* element 1 : value
* element 2 : database path
*/
attr.i = 0;
len += strlen(str_list->elems[1].data) + 1;
string_list_append(str_list2, str_list->elems[1].data, attr);
len += strlen(str_list->elems[2].data) + 1;
string_list_append(str_list2, str_list->elems[2].data, attr);
rdb = (char*)calloc(len, sizeof(char));
if (!rdb)
goto end;
string_list_join_concat(rdb, len, str_list2, "|");
strlcpy(new_path, rdb, sizeof(new_path));
fill_pathname_join_delim(new_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST),
2015-09-04 00:44:09 +02:00
str_list->elems[0].data, '_',
sizeof(new_label));
ret = generic_action_ok_displaylist_push(new_path, NULL,
2015-09-04 00:44:09 +02:00
new_label, type, idx, entry_idx,
ACTION_OK_DL_RDB_ENTRY_SUBMENU);
end:
2016-02-10 20:01:38 +01:00
if (rdb)
free(rdb);
2015-09-04 00:44:09 +02:00
if (str_list)
string_list_free(str_list);
if (str_list2)
string_list_free(str_list2);
return ret;
}
#define default_action_ok_func(func_name, lbl) \
int (func_name)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, lbl); \
}
default_action_ok_func(action_ok_browse_url_start, ACTION_OK_DL_BROWSE_URL_START)
default_action_ok_func(action_ok_goto_favorites, ACTION_OK_DL_FAVORITES_LIST)
default_action_ok_func(action_ok_goto_images, ACTION_OK_DL_IMAGES_LIST)
default_action_ok_func(action_ok_goto_video, ACTION_OK_DL_VIDEO_LIST)
default_action_ok_func(action_ok_goto_music, ACTION_OK_DL_MUSIC_LIST)
default_action_ok_func(action_ok_shader_parameters, ACTION_OK_DL_SHADER_PARAMETERS)
default_action_ok_func(action_ok_parent_directory_push, ACTION_OK_DL_PARENT_DIRECTORY_PUSH)
default_action_ok_func(action_ok_directory_push, ACTION_OK_DL_DIRECTORY_PUSH)
default_action_ok_func(action_ok_configurations_list, ACTION_OK_DL_CONFIGURATIONS_LIST)
default_action_ok_func(action_ok_saving_list, ACTION_OK_DL_SAVING_SETTINGS_LIST)
default_action_ok_func(action_ok_network_list, ACTION_OK_DL_NETWORK_SETTINGS_LIST)
default_action_ok_func(action_ok_database_manager_list, ACTION_OK_DL_DATABASE_MANAGER_LIST)
default_action_ok_func(action_ok_wifi_list, ACTION_OK_DL_WIFI_SETTINGS_LIST)
default_action_ok_func(action_ok_cursor_manager_list, ACTION_OK_DL_CURSOR_MANAGER_LIST)
default_action_ok_func(action_ok_compressed_archive_push, ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH)
default_action_ok_func(action_ok_compressed_archive_push_detect_core, ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH_DETECT_CORE)
default_action_ok_func(action_ok_logging_list, ACTION_OK_DL_LOGGING_SETTINGS_LIST)
default_action_ok_func(action_ok_frame_throttle_list, ACTION_OK_DL_FRAME_THROTTLE_SETTINGS_LIST)
default_action_ok_func(action_ok_rewind_list, ACTION_OK_DL_REWIND_SETTINGS_LIST)
default_action_ok_func(action_ok_onscreen_display_list, ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST)
default_action_ok_func(action_ok_onscreen_notifications_list, ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST)
default_action_ok_func(action_ok_onscreen_overlay_list, ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST)
default_action_ok_func(action_ok_menu_list, ACTION_OK_DL_MENU_SETTINGS_LIST)
default_action_ok_func(action_ok_menu_views_list, ACTION_OK_DL_MENU_VIEWS_SETTINGS_LIST)
default_action_ok_func(action_ok_quick_menu_views_list, ACTION_OK_DL_QUICK_MENU_VIEWS_SETTINGS_LIST)
default_action_ok_func(action_ok_user_interface_list, ACTION_OK_DL_USER_INTERFACE_SETTINGS_LIST)
default_action_ok_func(action_ok_menu_file_browser_list, ACTION_OK_DL_MENU_FILE_BROWSER_SETTINGS_LIST)
default_action_ok_func(action_ok_retro_achievements_list, ACTION_OK_DL_RETRO_ACHIEVEMENTS_SETTINGS_LIST)
default_action_ok_func(action_ok_updater_list, ACTION_OK_DL_UPDATER_SETTINGS_LIST)
2017-08-13 06:49:51 +02:00
default_action_ok_func(action_ok_lakka_services, ACTION_OK_DL_LAKKA_SERVICES_LIST)
default_action_ok_func(action_ok_user_list, ACTION_OK_DL_USER_SETTINGS_LIST)
default_action_ok_func(action_ok_netplay_sublist, ACTION_OK_DL_NETPLAY)
default_action_ok_func(action_ok_directory_list, ACTION_OK_DL_DIRECTORY_SETTINGS_LIST)
default_action_ok_func(action_ok_privacy_list, ACTION_OK_DL_PRIVACY_SETTINGS_LIST)
default_action_ok_func(action_ok_rdb_entry, ACTION_OK_DL_RDB_ENTRY)
default_action_ok_func(action_ok_browse_url_list, ACTION_OK_DL_BROWSE_URL_LIST)
default_action_ok_func(action_ok_core_list, ACTION_OK_DL_CORE_LIST)
default_action_ok_func(action_ok_cheat_file, ACTION_OK_DL_CHEAT_FILE)
default_action_ok_func(action_ok_playlist_collection, ACTION_OK_DL_PLAYLIST_COLLECTION)
default_action_ok_func(action_ok_disk_image_append_list, ACTION_OK_DL_DISK_IMAGE_APPEND_LIST)
default_action_ok_func(action_ok_subsystem_add_list, ACTION_OK_DL_SUBSYSTEM_ADD_LIST)
2018-02-10 20:23:24 -05:00
default_action_ok_func(action_ok_subsystem_add_load, ACTION_OK_DL_SUBSYSTEM_LOAD)
2017-08-13 06:49:51 +02:00
default_action_ok_func(action_ok_record_configfile, ACTION_OK_DL_RECORD_CONFIGFILE)
default_action_ok_func(action_ok_remap_file, ACTION_OK_DL_REMAP_FILE)
default_action_ok_func(action_ok_shader_preset, ACTION_OK_DL_SHADER_PRESET)
default_action_ok_func(action_ok_push_generic_list, ACTION_OK_DL_GENERIC)
default_action_ok_func(action_ok_audio_dsp_plugin, ACTION_OK_DL_AUDIO_DSP_PLUGIN)
default_action_ok_func(action_ok_rpl_entry, ACTION_OK_DL_RPL_ENTRY)
default_action_ok_func(action_ok_open_archive_detect_core, ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE)
default_action_ok_func(action_ok_file_load_music, ACTION_OK_DL_MUSIC)
default_action_ok_func(action_ok_push_accounts_list, ACTION_OK_DL_ACCOUNTS_LIST)
default_action_ok_func(action_ok_push_driver_settings_list, ACTION_OK_DL_DRIVER_SETTINGS_LIST)
default_action_ok_func(action_ok_push_video_settings_list, ACTION_OK_DL_VIDEO_SETTINGS_LIST)
default_action_ok_func(action_ok_push_configuration_settings_list, ACTION_OK_DL_CONFIGURATION_SETTINGS_LIST)
default_action_ok_func(action_ok_push_core_settings_list, ACTION_OK_DL_CORE_SETTINGS_LIST)
default_action_ok_func(action_ok_push_audio_settings_list, ACTION_OK_DL_AUDIO_SETTINGS_LIST)
default_action_ok_func(action_ok_push_input_settings_list, ACTION_OK_DL_INPUT_SETTINGS_LIST)
default_action_ok_func(action_ok_push_recording_settings_list, ACTION_OK_DL_RECORDING_SETTINGS_LIST)
default_action_ok_func(action_ok_push_playlist_settings_list, ACTION_OK_DL_PLAYLIST_SETTINGS_LIST)
default_action_ok_func(action_ok_push_input_hotkey_binds_list, ACTION_OK_DL_INPUT_HOTKEY_BINDS_LIST)
default_action_ok_func(action_ok_push_user_binds_list, ACTION_OK_DL_USER_BINDS_LIST)
default_action_ok_func(action_ok_push_accounts_cheevos_list, ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST)
default_action_ok_func(action_ok_open_archive, ACTION_OK_DL_OPEN_ARCHIVE)
2016-12-27 00:02:09 +01:00
static int action_ok_shader_pass(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
menu->hack_shader_pass = type - MENU_SETTINGS_SHADER_PASS_0;
return generic_action_ok_displaylist_push(path, NULL, label, type, idx,
entry_idx, ACTION_OK_DL_SHADER_PASS);
}
2017-01-19 23:44:10 -05:00
static int action_ok_netplay_connect_room(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
#ifdef HAVE_NETWORKING
char tmp_hostname[4115];
2017-01-22 21:19:39 +01:00
tmp_hostname[0] = '\0';
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_NETPLAY_DEINIT);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
if (netplay_room_list[idx - 3].host_method == NETPLAY_HOST_METHOD_MITM)
{
snprintf(tmp_hostname,
sizeof(tmp_hostname),
2017-05-21 22:48:30 -05:00
"%s|%d",
netplay_room_list[idx - 3].mitm_address,
netplay_room_list[idx - 3].mitm_port);
}
else
{
snprintf(tmp_hostname,
sizeof(tmp_hostname),
2017-05-21 22:48:30 -05:00
"%s|%d",
netplay_room_list[idx - 3].address,
netplay_room_list[idx - 3].port);
}
2017-01-22 21:19:39 +01:00
2017-08-17 18:53:55 +02:00
#if 0
RARCH_LOG("[lobby] connecting to: %s with game: %s/%08x\n",
2017-01-23 19:58:25 -05:00
tmp_hostname,
netplay_room_list[idx - 3].gamename,
netplay_room_list[idx - 3].gamecrc);
2017-08-17 18:53:55 +02:00
#endif
2017-01-22 21:19:39 +01:00
task_push_netplay_crc_scan(netplay_room_list[idx - 3].gamecrc,
netplay_room_list[idx - 3].gamename,
tmp_hostname, netplay_room_list[idx - 3].corename);
#else
return -1;
#endif
2017-01-19 23:44:10 -05:00
return 0;
}
2016-09-22 16:44:51 +02:00
2016-12-02 22:40:26 -05:00
static int action_ok_netplay_lan_scan(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
#ifdef HAVE_NETWORKING
2017-01-22 21:19:39 +01:00
struct netplay_host_list *hosts = NULL;
struct netplay_host *host = NULL;
2016-12-02 22:40:26 -05:00
/* Figure out what host we're connecting to */
if (!netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES, &hosts))
return -1;
if (entry_idx >= hosts->size)
return -1;
host = &hosts->hosts[entry_idx];
/* Enable Netplay client mode */
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_NETPLAY_DEINIT);
2016-12-02 22:40:26 -05:00
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
/* Enable Netplay */
2017-08-13 00:55:47 +02:00
if (command_event(CMD_EVENT_NETPLAY_INIT_DIRECT, (void *) host))
return generic_action_ok_command(CMD_EVENT_RESUME);
#endif
2017-08-13 00:55:47 +02:00
return -1;
2016-12-26 06:39:12 +01:00
}
2017-11-26 07:10:18 +01:00
#define default_action_ok_dl_push(funcname, _fbid, _id, _path) \
static int (funcname)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
settings_t *settings = config_get_ptr(); \
(void)settings; \
filebrowser_set_type(_fbid); \
return generic_action_ok_displaylist_push(path, _path, label, type, idx, entry_idx, _id); \
}
2017-11-26 07:10:18 +01:00
default_action_ok_dl_push(action_ok_content_collection_list, FILEBROWSER_SELECT_COLLECTION, ACTION_OK_DL_CONTENT_COLLECTION_LIST, NULL)
default_action_ok_dl_push(action_ok_push_content_list, FILEBROWSER_SELECT_FILE, ACTION_OK_DL_CONTENT_LIST, settings->paths.directory_menu_content)
default_action_ok_dl_push(action_ok_push_scan_file, FILEBROWSER_SCAN_FILE, ACTION_OK_DL_CONTENT_LIST, settings->paths.directory_menu_content)
2017-01-22 21:19:39 +01:00
#ifdef HAVE_NETWORKING
struct netplay_host_list *lan_hosts;
int lan_room_count;
void netplay_refresh_rooms_menu(file_list_t *list)
{
char s[4115];
int i = 0;
2017-05-16 00:34:28 -05:00
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list);
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
{
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT),
MENU_ENUM_LABEL_NETPLAY_DISCONNECT,
MENU_SETTING_ACTION, 0, 0);
}
else if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_CONNECTED, NULL))
{
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT),
MENU_ENUM_LABEL_NETPLAY_DISCONNECT,
MENU_SETTING_ACTION, 0, 0);
}
else
{
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST),
MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST,
MENU_SETTING_ACTION, 0, 0);
2017-05-16 00:34:28 -05:00
}
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT),
MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT,
MENU_SETTING_ACTION, 0, 0);
2017-05-16 00:34:28 -05:00
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS),
MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS,
MENU_SETTING_ACTION, 0, 0);
if (netplay_room_count != 0)
{
for (i = 0; i < netplay_room_count; i++)
{
char country[PATH_MAX_LENGTH] = {0};
if (*netplay_room_list[i].country)
2018-02-01 11:16:13 +01:00
string_add_between_pairs(country, netplay_room_list[i].country,
sizeof(country));
/* Uncomment this to debug mismatched room parameters*/
#if 0
RARCH_LOG("[lobby] room Data: %d\n"
"Nickname: %s\n"
"Address: %s\n"
"Port: %d\n"
"Core: %s\n"
"Core Version: %s\n"
"Game: %s\n"
"Game CRC: %08x\n"
"Timestamp: %d\n", room_data->elems[j + 6].data,
netplay_room_list[i].nickname,
netplay_room_list[i].address,
netplay_room_list[i].port,
netplay_room_list[i].corename,
netplay_room_list[i].coreversion,
netplay_room_list[i].gamename,
netplay_room_list[i].gamecrc,
netplay_room_list[i].timestamp);
#endif
snprintf(s, sizeof(s), "%s: %s%s",
netplay_room_list[i].lan ? "Local" :
(netplay_room_list[i].host_method == NETPLAY_HOST_METHOD_MITM ?
2017-07-24 20:52:27 -05:00
"Internet (relay)" : "Internet (direct)"),
netplay_room_list[i].nickname, country);
menu_entries_append_enum(list,
s,
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM),
MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM,
MENU_SETTINGS_NETPLAY_ROOMS_START + i, 0, 0);
}
netplay_rooms_free();
}
}
2017-05-17 07:23:16 +02:00
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
2017-01-19 00:52:53 -05:00
static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const char *err)
{
const char *path = NULL;
const char *label = NULL;
unsigned menu_type = 0;
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
2017-01-19 00:52:53 -05:00
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
menu_entries_get_last_stack(&path, &label, &menu_type, &enum_idx, NULL);
/* Don't push the results if we left the netplay menu */
if (!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB))
&& !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY)))
return;
2017-01-19 00:52:53 -05:00
if (!data || err)
goto finish;
2017-05-26 07:05:52 +01:00
data->data = (char*)realloc(data->data, data->len + 1);
data->data[data->len] = '\0';
2017-01-19 00:52:53 -05:00
if (!strstr(data->data, file_path_str(FILE_PATH_NETPLAY_ROOM_LIST_URL)))
2017-01-19 00:52:53 -05:00
{
if (string_is_empty(data->data))
2017-01-19 08:56:56 -05:00
netplay_room_count = 0;
2017-01-19 00:52:53 -05:00
else
{
2017-01-22 21:24:57 +01:00
char s[PATH_MAX_LENGTH];
Fix lan rooms Squashed commit of the following: commit 6e1fea3b16bb330ed2862eb00d2e911221c48a34 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 22:16:02 2017 -0500 use the baked in address instead of sockaddr commit 84f2d389fd6352b3037f48c18d133d2f1063d461 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 22:05:57 2017 -0500 send replies commit c6733009cc5a25e58391c5fc693b277ea27404b3 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:53:12 2017 -0500 send replies commit a6816c9481f7ea89a3c97597233e54c6354716e7 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:46:55 2017 -0500 send replies commit c2453b73ccafbd53192507affbc11d5f279c2e7c Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:26:34 2017 -0500 look for common interfaces commit fb42e6470242689f5e6160149ef91f0f0abf068d Author: radius <andres.430@gmail.com> Date: Sat Nov 18 20:06:50 2017 -0500 send broadcasts in all interfaces commit b7730596df9775fb815007689e9c7cc06b317b03 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 20:00:17 2017 -0500 send broadcasts in all interfaces commit b620a78052d1b95e81d346f3e5efb233e0547793 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 14:30:31 2017 -0500 add more logging commit c016c7d559cd631172a58f99cd3e1a1365965b8e Author: radius <andres.430@gmail.com> Date: Sat Nov 18 14:12:03 2017 -0500 update log messages commit 0a49ba61f56f2ca483fa76c7a04f0709c68b95ad Author: radius <andres.430@gmail.com> Date: Sat Nov 18 13:50:47 2017 -0500 fix lan room listing for rooms > 1, allow connecting in arbitrary ports
2017-11-18 22:43:47 -05:00
unsigned i = 0;
unsigned j = 0;
2017-11-20 17:54:13 +01:00
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
2017-11-19 15:50:01 -05:00
lan_room_count = 0;
2017-02-27 19:00:43 -05:00
2017-11-19 15:50:01 -05:00
#ifndef RARCH_CONSOLE
2017-02-28 09:52:33 +01:00
netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES, &lan_hosts);
if (lan_hosts)
lan_room_count = (int)lan_hosts->size;
2017-11-19 15:50:01 -05:00
#endif
2017-01-22 21:19:39 +01:00
netplay_rooms_parse(data->data);
2017-01-19 00:52:53 -05:00
if (netplay_room_list)
free(netplay_room_list);
2017-02-28 10:28:49 +01:00
/* TODO/FIXME - right now, a LAN and non-LAN netplay session might appear
* in the same list. If both entries are available, we want to show only
* the LAN one. */
2017-03-04 01:31:24 -05:00
netplay_room_count = netplay_rooms_get_count();
2017-02-28 10:16:36 +01:00
netplay_room_list = (struct netplay_room*)
calloc(netplay_room_count + lan_room_count,
sizeof(struct netplay_room));
2017-01-19 00:52:53 -05:00
2017-11-26 22:43:58 +01:00
for (i = 0; i < (unsigned)netplay_room_count; i++)
memcpy(&netplay_room_list[i], netplay_room_get(i), sizeof(netplay_room_list[i]));
2017-02-27 19:00:43 -05:00
2017-02-27 21:44:11 -05:00
if (lan_room_count != 0)
2017-02-27 19:00:43 -05:00
{
2017-11-26 22:43:58 +01:00
for (i = netplay_room_count; i < (unsigned)(netplay_room_count + lan_room_count); i++)
{
2017-11-25 05:53:56 +01:00
struct netplay_host *host = &lan_hosts->hosts[j++];
2017-02-28 09:52:33 +01:00
strlcpy(netplay_room_list[i].nickname,
host->nick,
sizeof(netplay_room_list[i].nickname));
2017-02-28 09:52:33 +01:00
Fix lan rooms Squashed commit of the following: commit 6e1fea3b16bb330ed2862eb00d2e911221c48a34 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 22:16:02 2017 -0500 use the baked in address instead of sockaddr commit 84f2d389fd6352b3037f48c18d133d2f1063d461 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 22:05:57 2017 -0500 send replies commit c6733009cc5a25e58391c5fc693b277ea27404b3 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:53:12 2017 -0500 send replies commit a6816c9481f7ea89a3c97597233e54c6354716e7 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:46:55 2017 -0500 send replies commit c2453b73ccafbd53192507affbc11d5f279c2e7c Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:26:34 2017 -0500 look for common interfaces commit fb42e6470242689f5e6160149ef91f0f0abf068d Author: radius <andres.430@gmail.com> Date: Sat Nov 18 20:06:50 2017 -0500 send broadcasts in all interfaces commit b7730596df9775fb815007689e9c7cc06b317b03 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 20:00:17 2017 -0500 send broadcasts in all interfaces commit b620a78052d1b95e81d346f3e5efb233e0547793 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 14:30:31 2017 -0500 add more logging commit c016c7d559cd631172a58f99cd3e1a1365965b8e Author: radius <andres.430@gmail.com> Date: Sat Nov 18 14:12:03 2017 -0500 update log messages commit 0a49ba61f56f2ca483fa76c7a04f0709c68b95ad Author: radius <andres.430@gmail.com> Date: Sat Nov 18 13:50:47 2017 -0500 fix lan room listing for rooms > 1, allow connecting in arbitrary ports
2017-11-18 22:43:47 -05:00
strlcpy(netplay_room_list[i].address, host->address, INET6_ADDRSTRLEN);
2017-02-28 09:52:33 +01:00
strlcpy(netplay_room_list[i].corename,
host->core,
sizeof(netplay_room_list[i].corename));
strlcpy(netplay_room_list[i].retroarch_version,
host->retroarch_version,
sizeof(netplay_room_list[i].retroarch_version));
strlcpy(netplay_room_list[i].coreversion,
host->core_version,
sizeof(netplay_room_list[i].coreversion));
strlcpy(netplay_room_list[i].gamename,
host->content,
2017-04-29 22:07:01 +02:00
sizeof(netplay_room_list[i].gamename));
strlcpy(netplay_room_list[i].frontend,
host->frontend,
sizeof(netplay_room_list[i].frontend));
Fix lan rooms Squashed commit of the following: commit 6e1fea3b16bb330ed2862eb00d2e911221c48a34 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 22:16:02 2017 -0500 use the baked in address instead of sockaddr commit 84f2d389fd6352b3037f48c18d133d2f1063d461 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 22:05:57 2017 -0500 send replies commit c6733009cc5a25e58391c5fc693b277ea27404b3 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:53:12 2017 -0500 send replies commit a6816c9481f7ea89a3c97597233e54c6354716e7 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:46:55 2017 -0500 send replies commit c2453b73ccafbd53192507affbc11d5f279c2e7c Author: radius <andres.430@gmail.com> Date: Sat Nov 18 21:26:34 2017 -0500 look for common interfaces commit fb42e6470242689f5e6160149ef91f0f0abf068d Author: radius <andres.430@gmail.com> Date: Sat Nov 18 20:06:50 2017 -0500 send broadcasts in all interfaces commit b7730596df9775fb815007689e9c7cc06b317b03 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 20:00:17 2017 -0500 send broadcasts in all interfaces commit b620a78052d1b95e81d346f3e5efb233e0547793 Author: radius <andres.430@gmail.com> Date: Sat Nov 18 14:30:31 2017 -0500 add more logging commit c016c7d559cd631172a58f99cd3e1a1365965b8e Author: radius <andres.430@gmail.com> Date: Sat Nov 18 14:12:03 2017 -0500 update log messages commit 0a49ba61f56f2ca483fa76c7a04f0709c68b95ad Author: radius <andres.430@gmail.com> Date: Sat Nov 18 13:50:47 2017 -0500 fix lan room listing for rooms > 1, allow connecting in arbitrary ports
2017-11-18 22:43:47 -05:00
netplay_room_list[i].port = host->port;
2017-02-28 09:52:33 +01:00
netplay_room_list[i].gamecrc = host->content_crc;
netplay_room_list[i].timestamp = 0;
netplay_room_list[i].lan = true;
2017-02-28 09:52:33 +01:00
snprintf(s, sizeof(s),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME),
netplay_room_list[i].nickname);
}
netplay_room_count += lan_room_count;
2017-02-27 19:00:43 -05:00
}
2017-11-20 17:54:13 +01:00
netplay_refresh_rooms_menu(list);
2017-01-19 00:52:53 -05:00
}
}
finish:
2017-01-19 00:52:53 -05:00
if (err)
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
if (data)
{
if (data->data)
free(data->data);
free(data);
}
if (user_data)
free(user_data);
}
2017-05-27 00:50:14 +02:00
static void netplay_lan_scan_callback(void *task_data,
void *user_data, const char *error)
{
struct netplay_host_list *netplay_hosts = NULL;
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
unsigned menu_type = 0;
const char *label = NULL;
const char *path = NULL;
menu_entries_get_last_stack(&path, &label, &menu_type, &enum_idx, NULL);
/* Don't push the results if we left the LAN scan menu */
if (!string_is_equal(label,
msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST)))
return;
if (!netplay_discovery_driver_ctl(
RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES,
(void *) &netplay_hosts))
return;
if (netplay_hosts->size > 0)
{
unsigned i;
file_list_t *file_list = menu_entries_get_selection_buf_ptr(0);
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, file_list);
for (i = 0; i < netplay_hosts->size; i++)
{
struct netplay_host *host = &netplay_hosts->hosts[i];
menu_entries_append_enum(file_list,
host->nick,
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_CONNECT_TO),
MENU_ENUM_LABEL_NETPLAY_CONNECT_TO,
MENU_NETPLAY_LAN_SCAN, 0, 0);
}
}
}
2017-01-19 00:52:53 -05:00
static int action_ok_push_netplay_refresh_rooms(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2017-03-04 01:31:24 -05:00
char url [2048] = "http://newlobby.libretro.com/list/";
2017-11-19 15:50:01 -05:00
#ifndef RARCH_CONSOLE
task_push_netplay_lan_scan(netplay_lan_scan_callback);
2017-11-19 15:50:01 -05:00
#endif
2017-01-19 00:52:53 -05:00
task_push_http_transfer(url, true, NULL, netplay_refresh_rooms_cb, NULL);
return 0;
}
2017-01-22 21:19:39 +01:00
#endif
2017-01-19 00:52:53 -05:00
static int action_ok_scan_directory_list(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
filebrowser_clear_type();
return generic_action_ok_displaylist_push(path,
2017-04-29 00:39:29 +02:00
settings->paths.directory_menu_content, label, type, idx,
entry_idx, ACTION_OK_DL_SCAN_DIR_LIST);
}
static int action_ok_push_random_dir(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_displaylist_push(path, path,
2016-12-13 01:06:28 +01:00
msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES),
type, idx,
entry_idx, ACTION_OK_DL_CONTENT_LIST);
}
static int action_ok_push_downloads_dir(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-07-09 18:12:35 +02:00
settings_t *settings = config_get_ptr();
filebrowser_set_type(FILEBROWSER_SELECT_FILE);
2017-11-26 07:17:31 +01:00
return generic_action_ok_displaylist_push(path,
settings->paths.directory_core_assets,
2016-12-13 01:06:28 +01:00
msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES),
2016-07-09 18:12:35 +02:00
type, idx,
entry_idx, ACTION_OK_DL_CONTENT_LIST);
}
int action_ok_push_filebrowser_list_dir_select(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
2017-05-19 02:39:33 +02:00
filebrowser_set_type(FILEBROWSER_SELECT_DIR);
strlcpy(menu->filebrowser_label, label, sizeof(menu->filebrowser_label));
return generic_action_ok_displaylist_push(path, NULL, label, type, idx,
entry_idx, ACTION_OK_DL_FILE_BROWSER_SELECT_DIR);
}
int action_ok_push_filebrowser_list_file_select(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
filebrowser_set_type(FILEBROWSER_SELECT_FILE);
strlcpy(menu->filebrowser_label, label, sizeof(menu->filebrowser_label));
return generic_action_ok_displaylist_push(path, NULL, label, type, idx,
entry_idx, ACTION_OK_DL_FILE_BROWSER_SELECT_DIR);
}
2015-09-03 23:14:50 +02:00
static int action_ok_push_default(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
filebrowser_clear_type();
return generic_action_ok_displaylist_push(path, NULL, label, type, idx,
2015-09-03 23:14:50 +02:00
entry_idx, ACTION_OK_DL_PUSH_DEFAULT);
}
2016-01-24 01:51:05 +01:00
static int action_ok_start_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2017-04-27 01:23:04 +02:00
content_ctx_info_t content_info;
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
2017-11-26 18:33:05 -05:00
path_clear(RARCH_PATH_BASENAME);
2017-02-21 16:50:39 +01:00
if (!task_push_start_current_core(&content_info))
return -1;
return 0;
}
2016-05-27 19:18:46 +02:00
static int action_ok_load_archive(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = NULL;
const char *menu_path = NULL;
const char *content_path = NULL;
2016-02-10 21:15:23 +01:00
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
2016-02-10 21:15:23 +01:00
menu_path = menu->scratch2_buf;
content_path = menu->scratch_buf;
fill_pathname_join(menu->detect_content_path,
menu_path, content_path,
sizeof(menu->detect_content_path));
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_LOAD_CORE);
2017-11-26 07:29:19 +01:00
return default_action_ok_load_content_with_core_from_menu(
menu->detect_content_path,
2017-11-26 07:29:19 +01:00
CORE_TYPE_PLAIN);
}
static int action_ok_load_archive_detect_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_content_ctx_defer_info_t def_info;
2016-06-15 18:52:27 +02:00
int ret = 0;
core_info_list_t *list = NULL;
menu_handle_t *menu = NULL;
const char *menu_path = NULL;
const char *content_path = NULL;
2018-02-04 19:05:43 +01:00
char *new_core_path = NULL;
2016-10-08 19:47:26 +02:00
2016-02-10 21:15:23 +01:00
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
2016-02-10 21:42:18 +01:00
return menu_cbs_exit();
menu_path = menu->scratch2_buf;
content_path = menu->scratch_buf;
2016-02-10 21:15:23 +01:00
2016-05-09 18:11:17 +02:00
core_info_get_list(&list);
2015-12-11 13:51:17 +01:00
def_info.data = list;
def_info.dir = menu_path;
def_info.path = content_path;
def_info.menu_label = label;
def_info.s = menu->deferred_path;
def_info.len = sizeof(menu->deferred_path);
2018-02-04 19:05:43 +01:00
new_core_path = (char*)
malloc(PATH_MAX_LENGTH * sizeof(char));
new_core_path[0] = '\0';
2016-07-01 05:17:04 +02:00
if (menu_content_find_first_core(&def_info, false,
2018-02-04 19:05:43 +01:00
new_core_path, PATH_MAX_LENGTH * sizeof(char)))
ret = -1;
fill_pathname_join(menu->detect_content_path, menu_path, content_path,
sizeof(menu->detect_content_path));
switch (ret)
{
case -1:
{
2017-04-27 01:23:04 +02:00
content_ctx_info_t content_info;
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
2018-02-04 19:05:43 +01:00
ret = 0;
2017-02-21 18:36:38 +01:00
if (!task_push_load_content_with_new_core_from_menu(
new_core_path, def_info.s,
&content_info,
CORE_TYPE_PLAIN,
NULL, NULL))
2018-02-04 19:05:43 +01:00
ret = -1;
}
2017-09-09 22:10:19 +02:00
break;
case 0:
2017-08-13 00:55:47 +02:00
idx = menu_navigation_get_selection();
2017-09-09 22:10:19 +02:00
ret = generic_action_ok_displaylist_push(path, NULL,
2017-08-13 00:55:47 +02:00
label, type,
idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST);
2017-09-09 22:10:19 +02:00
break;
2015-09-07 02:46:47 +02:00
default:
break;
}
2017-09-09 22:10:19 +02:00
free(new_core_path);
return ret;
}
2017-11-26 06:57:05 +01:00
#define default_action_ok_help(funcname, _id, _id2) \
static int (funcname)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) \
{ \
return generic_action_ok_help(path, label, type, idx, entry_idx, _id, _id2); \
2015-07-18 14:01:37 +02:00
}
2017-11-26 06:57:05 +01:00
default_action_ok_help(action_ok_help_audio_video_troubleshooting, MENU_ENUM_LABEL_HELP_AUDIO_VIDEO_TROUBLESHOOTING, MENU_DIALOG_HELP_AUDIO_VIDEO_TROUBLESHOOTING)
default_action_ok_help(action_ok_help, MENU_ENUM_LABEL_HELP, MENU_DIALOG_WELCOME)
default_action_ok_help(action_ok_help_controls, MENU_ENUM_LABEL_HELP_CONTROLS, MENU_DIALOG_HELP_CONTROLS)
default_action_ok_help(action_ok_help_what_is_a_core, MENU_ENUM_LABEL_HELP_WHAT_IS_A_CORE, MENU_DIALOG_HELP_WHAT_IS_A_CORE)
default_action_ok_help(action_ok_help_scanning_content, MENU_ENUM_LABEL_HELP_SCANNING_CONTENT, MENU_DIALOG_HELP_SCANNING_CONTENT)
default_action_ok_help(action_ok_help_change_virtual_gamepad, MENU_ENUM_LABEL_HELP_CHANGE_VIRTUAL_GAMEPAD, MENU_DIALOG_HELP_CHANGE_VIRTUAL_GAMEPAD)
default_action_ok_help(action_ok_help_load_content, MENU_ENUM_LABEL_HELP_LOADING_CONTENT, MENU_DIALOG_HELP_LOADING_CONTENT)
static int action_ok_video_resolution(const char *path,
2015-06-10 23:11:40 +02:00
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2015-09-05 17:17:26 +02:00
unsigned width = 0;
unsigned height = 0;
if (video_driver_get_video_output_size(&width, &height))
2015-07-06 00:29:51 -05:00
{
2016-10-08 19:47:26 +02:00
char msg[PATH_MAX_LENGTH];
msg[0] = '\0';
#if defined(__CELLOS_LV2__) || defined(_WIN32)
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_REINIT);
#endif
video_driver_set_video_mode(width, height, true);
#ifdef GEKKO
if (width == 0 || height == 0)
strlcpy(msg, "Applying: DEFAULT", sizeof(msg));
else
#endif
2016-07-01 05:51:27 +02:00
snprintf(msg, sizeof(msg),
"Applying: %dx%d\n START to reset",
2016-07-01 05:51:27 +02:00
width, height);
runloop_msg_queue_push(msg, 1, 100, true);
2015-07-06 00:29:51 -05:00
}
2015-03-03 21:57:09 +01:00
return 0;
}
static int action_ok_netplay_enable_host(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-09-29 21:07:10 +02:00
#ifdef HAVE_NETWORKING
2018-02-04 19:05:43 +01:00
bool contentless = false;
bool is_inited = false;
2017-12-17 12:16:34 -05:00
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
content_get_status(&contentless, &is_inited);
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_NETPLAY_DEINIT);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL);
2017-12-17 12:16:34 -05:00
netplay_refresh_rooms_menu(list);
/* If we haven't yet started, this will load on its own */
if (!is_inited)
{
runloop_msg_queue_push(
2016-12-25 00:38:18 -05:00
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true);
return 0;
}
/* Enable Netplay itself */
2017-08-13 00:55:47 +02:00
if (command_event(CMD_EVENT_NETPLAY_INIT, NULL))
return generic_action_ok_command(CMD_EVENT_RESUME);
#endif
2017-08-13 00:55:47 +02:00
return -1;
}
#ifdef HAVE_NETWORKING
static void action_ok_netplay_enable_client_hostname_cb(
void *ignore, const char *hostname)
{
if (hostname && hostname[0])
{
2017-09-11 03:01:33 +02:00
bool contentless = false;
bool is_inited = false;
char *tmp_hostname = strdup(hostname);
content_get_status(&contentless, &is_inited);
if (!is_inited)
{
2017-09-11 03:01:33 +02:00
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED,
(void*)tmp_hostname);
runloop_msg_queue_push(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true);
}
else
{
2017-09-11 03:01:33 +02:00
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT,
(void*)tmp_hostname);
generic_action_ok_command(CMD_EVENT_RESUME);
}
2017-09-11 03:01:33 +02:00
free(tmp_hostname);
}
else
{
menu_input_dialog_end();
return;
}
menu_input_dialog_end();
rarch_menu_running_finished();
}
#endif
static int action_ok_netplay_enable_client(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-09-29 21:07:10 +02:00
#ifdef HAVE_NETWORKING
2017-06-10 12:52:45 +02:00
menu_input_ctx_line_t line;
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_NETPLAY_DEINIT);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
2017-11-26 06:03:34 +01:00
line.label = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS);
line.label_setting = "no_setting";
2017-11-26 06:03:34 +01:00
line.type = 0;
line.idx = 0;
line.cb = action_ok_netplay_enable_client_hostname_cb;
2017-08-13 00:55:47 +02:00
if (menu_input_dialog_start(&line))
return 0;
#endif
2017-08-13 00:55:47 +02:00
return -1;
}
static int action_ok_netplay_disconnect(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2016-09-29 21:07:10 +02:00
#ifdef HAVE_NETWORKING
2017-08-06 14:03:09 +02:00
settings_t *settings = config_get_ptr();
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISCONNECT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISABLE, NULL);
/* Re-enable rewind if it was enabled
TODO: Add a setting for these tweaks */
if (settings->bools.rewind_enable)
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_REWIND_INIT);
if (settings->uints.autosave_interval != 0)
2017-11-26 06:35:53 +01:00
generic_action_ok_command(CMD_EVENT_AUTOSAVE_INIT);
return generic_action_ok_command(CMD_EVENT_RESUME);
#else
return -1;
#endif
}
static int action_ok_core_delete(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
2017-11-26 07:17:31 +01:00
const char *path_core = path_get(RARCH_PATH_CORE);
char *core_path = !string_is_empty(path_core)
2017-11-26 07:17:31 +01:00
? strdup(path_core) : NULL;
if (!core_path)
return 0;
generic_action_ok_command(CMD_EVENT_UNLOAD_CORE);
menu_entries_flush_stack(0, 0);
if (filestream_delete(core_path) != 0) { }
free(core_path);
return 0;
}
2016-07-01 19:01:25 +02:00
static int is_rdb_entry(enum msg_hash_enums enum_idx)
{
2016-07-01 19:01:25 +02:00
switch (enum_idx)
{
2016-07-01 19:01:25 +02:00
case MENU_ENUM_LABEL_RDB_ENTRY_PUBLISHER:
case MENU_ENUM_LABEL_RDB_ENTRY_DEVELOPER:
case MENU_ENUM_LABEL_RDB_ENTRY_ORIGIN:
case MENU_ENUM_LABEL_RDB_ENTRY_FRANCHISE:
case MENU_ENUM_LABEL_RDB_ENTRY_ENHANCEMENT_HW:
case MENU_ENUM_LABEL_RDB_ENTRY_ESRB_RATING:
case MENU_ENUM_LABEL_RDB_ENTRY_BBFC_RATING:
case MENU_ENUM_LABEL_RDB_ENTRY_ELSPA_RATING:
case MENU_ENUM_LABEL_RDB_ENTRY_PEGI_RATING:
case MENU_ENUM_LABEL_RDB_ENTRY_CERO_RATING:
case MENU_ENUM_LABEL_RDB_ENTRY_EDGE_MAGAZINE_RATING:
case MENU_ENUM_LABEL_RDB_ENTRY_EDGE_MAGAZINE_ISSUE:
case MENU_ENUM_LABEL_RDB_ENTRY_FAMITSU_MAGAZINE_RATING:
case MENU_ENUM_LABEL_RDB_ENTRY_RELEASE_MONTH:
case MENU_ENUM_LABEL_RDB_ENTRY_RELEASE_YEAR:
case MENU_ENUM_LABEL_RDB_ENTRY_MAX_USERS:
break;
default:
return -1;
}
return 0;
}
static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t hash)
{
2016-07-01 19:01:25 +02:00
if (cbs->enum_idx != MSG_UNKNOWN && is_rdb_entry(cbs->enum_idx) == 0)
2015-06-07 18:14:48 +02:00
{
BIND_ACTION_OK(cbs, action_ok_rdb_entry_submenu);
2015-06-07 18:14:48 +02:00
return 0;
}
2016-07-01 20:18:51 +02:00
if (cbs->enum_idx != MSG_UNKNOWN)
{
2017-08-13 00:39:11 +02:00
const char *str = msg_hash_to_str(cbs->enum_idx);
2016-07-01 20:18:51 +02:00
2017-08-13 00:39:11 +02:00
if (str && strstr(str, "input_binds_list"))
2016-07-01 20:18:51 +02:00
{
2017-08-13 00:39:11 +02:00
unsigned i;
2016-12-14 16:33:54 +01:00
2017-08-13 00:39:11 +02:00
for (i = 0; i < MAX_USERS; i++)
{
unsigned first_char = atoi(&str[0]);
2016-12-14 16:33:54 +01:00
2017-08-13 00:39:11 +02:00
if (first_char != ((i+1)))
continue;
2016-12-14 16:33:54 +01:00
2017-08-13 00:39:11 +02:00
BIND_ACTION_OK(cbs, action_ok_push_user_binds_list);
return 0;
}
2016-07-01 20:18:51 +02:00
}
}
if (menu_setting_get_browser_selection_type(cbs->setting) == ST_DIR)
2015-06-07 18:14:48 +02:00
{
BIND_ACTION_OK(cbs, action_ok_push_filebrowser_list_dir_select);
2015-06-07 18:14:48 +02:00
return 0;
}
if (cbs->enum_idx != MSG_UNKNOWN)
{
switch (cbs->enum_idx)
{
case MENU_ENUM_LABEL_RUN_MUSIC:
BIND_ACTION_OK(cbs, action_ok_audio_run);
break;
case MENU_ENUM_LABEL_ADD_TO_MIXER_AND_COLLECTION:
BIND_ACTION_OK(cbs, action_ok_audio_add_to_mixer_and_collection);
break;
case MENU_ENUM_LABEL_ADD_TO_MIXER:
BIND_ACTION_OK(cbs, action_ok_audio_add_to_mixer);
break;
case MENU_ENUM_LABEL_MENU_WALLPAPER:
BIND_ACTION_OK(cbs, action_ok_menu_wallpaper);
break;
2017-05-19 04:44:10 +02:00
case MENU_ENUM_LABEL_VIDEO_FONT_PATH:
BIND_ACTION_OK(cbs, action_ok_menu_font);
break;
case MENU_ENUM_LABEL_GOTO_FAVORITES:
BIND_ACTION_OK(cbs, action_ok_goto_favorites);
break;
case MENU_ENUM_LABEL_GOTO_MUSIC:
BIND_ACTION_OK(cbs, action_ok_goto_music);
break;
case MENU_ENUM_LABEL_GOTO_IMAGES:
BIND_ACTION_OK(cbs, action_ok_goto_images);
break;
case MENU_ENUM_LABEL_GOTO_VIDEO:
BIND_ACTION_OK(cbs, action_ok_goto_video);
break;
2016-12-27 00:02:09 +01:00
case MENU_ENUM_LABEL_BROWSE_START:
BIND_ACTION_OK(cbs, action_ok_browse_url_start);
break;
2016-07-26 12:08:04 +02:00
case MENU_ENUM_LABEL_FILE_BROWSER_CORE:
BIND_ACTION_OK(cbs, action_ok_load_core);
break;
case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION:
case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE:
2017-11-26 06:23:14 +01:00
BIND_ACTION_OK(cbs, action_ok_core_deferred_set);
break;
case MENU_ENUM_LABEL_START_CORE:
BIND_ACTION_OK(cbs, action_ok_start_core);
break;
case MENU_ENUM_LABEL_START_NET_RETROPAD:
BIND_ACTION_OK(cbs, action_ok_start_net_retropad_core);
break;
2016-07-28 20:35:05 +02:00
case MENU_ENUM_LABEL_START_VIDEO_PROCESSOR:
BIND_ACTION_OK(cbs, action_ok_start_video_processor_core);
break;
case MENU_ENUM_LABEL_OPEN_ARCHIVE_DETECT_CORE:
BIND_ACTION_OK(cbs, action_ok_open_archive_detect_core);
break;
case MENU_ENUM_LABEL_OPEN_ARCHIVE:
BIND_ACTION_OK(cbs, action_ok_open_archive);
break;
case MENU_ENUM_LABEL_LOAD_ARCHIVE_DETECT_CORE:
BIND_ACTION_OK(cbs, action_ok_load_archive_detect_core);
break;
case MENU_ENUM_LABEL_LOAD_ARCHIVE:
BIND_ACTION_OK(cbs, action_ok_load_archive);
break;
case MENU_ENUM_LABEL_CUSTOM_BIND_ALL:
BIND_ACTION_OK(cbs, action_ok_lookup_setting);
break;
2016-06-17 22:36:13 +02:00
case MENU_ENUM_LABEL_SAVE_STATE:
BIND_ACTION_OK(cbs, action_ok_save_state);
break;
2016-06-17 22:36:13 +02:00
case MENU_ENUM_LABEL_LOAD_STATE:
BIND_ACTION_OK(cbs, action_ok_load_state);
break;
2016-06-17 22:36:13 +02:00
case MENU_ENUM_LABEL_UNDO_LOAD_STATE:
BIND_ACTION_OK(cbs, action_ok_undo_load_state);
break;
2016-06-17 22:36:13 +02:00
case MENU_ENUM_LABEL_UNDO_SAVE_STATE:
BIND_ACTION_OK(cbs, action_ok_undo_save_state);
break;
case MENU_ENUM_LABEL_RESUME_CONTENT:
BIND_ACTION_OK(cbs, action_ok_resume_content);
break;
case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST:
BIND_ACTION_OK(cbs, action_ok_add_to_favorites_playlist);
break;
case MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION:
BIND_ACTION_OK(cbs, action_ok_reset_core_association);
break;
case MENU_ENUM_LABEL_ADD_TO_FAVORITES:
BIND_ACTION_OK(cbs, action_ok_add_to_favorites);
break;
case MENU_ENUM_LABEL_RESTART_CONTENT:
BIND_ACTION_OK(cbs, action_ok_restart_content);
break;
case MENU_ENUM_LABEL_TAKE_SCREENSHOT:
BIND_ACTION_OK(cbs, action_ok_screenshot);
break;
case MENU_ENUM_LABEL_RENAME_ENTRY:
2017-08-14 20:07:43 +02:00
BIND_ACTION_OK(cbs, action_ok_rename_entry);
break;
case MENU_ENUM_LABEL_DELETE_ENTRY:
BIND_ACTION_OK(cbs, action_ok_delete_entry);
break;
case MENU_ENUM_LABEL_MENU_DISABLE_KIOSK_MODE:
BIND_ACTION_OK(cbs, action_ok_disable_kiosk_mode);
break;
case MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_enable_settings);
break;
case MENU_ENUM_LABEL_QUIT_RETROARCH:
BIND_ACTION_OK(cbs, action_ok_quit);
break;
case MENU_ENUM_LABEL_CLOSE_CONTENT:
BIND_ACTION_OK(cbs, action_ok_close_content);
break;
case MENU_ENUM_LABEL_SAVE_NEW_CONFIG:
BIND_ACTION_OK(cbs, action_ok_save_new_config);
break;
case MENU_ENUM_LABEL_HELP:
BIND_ACTION_OK(cbs, action_ok_help);
break;
case MENU_ENUM_LABEL_HELP_CONTROLS:
BIND_ACTION_OK(cbs, action_ok_help_controls);
break;
case MENU_ENUM_LABEL_HELP_WHAT_IS_A_CORE:
BIND_ACTION_OK(cbs, action_ok_help_what_is_a_core);
break;
case MENU_ENUM_LABEL_HELP_CHANGE_VIRTUAL_GAMEPAD:
BIND_ACTION_OK(cbs, action_ok_help_change_virtual_gamepad);
break;
case MENU_ENUM_LABEL_HELP_AUDIO_VIDEO_TROUBLESHOOTING:
BIND_ACTION_OK(cbs, action_ok_help_audio_video_troubleshooting);
break;
case MENU_ENUM_LABEL_HELP_SCANNING_CONTENT:
BIND_ACTION_OK(cbs, action_ok_help_scanning_content);
break;
case MENU_ENUM_LABEL_HELP_LOADING_CONTENT:
BIND_ACTION_OK(cbs, action_ok_help_load_content);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PASS:
BIND_ACTION_OK(cbs, action_ok_shader_pass);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET:
BIND_ACTION_OK(cbs, action_ok_shader_preset);
break;
case MENU_ENUM_LABEL_CHEAT_FILE_LOAD:
BIND_ACTION_OK(cbs, action_ok_cheat_file);
break;
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN:
BIND_ACTION_OK(cbs, action_ok_audio_dsp_plugin);
break;
case MENU_ENUM_LABEL_REMAP_FILE_LOAD:
BIND_ACTION_OK(cbs, action_ok_remap_file);
break;
case MENU_ENUM_LABEL_RECORD_CONFIG:
BIND_ACTION_OK(cbs, action_ok_record_configfile);
break;
2015-09-04 20:11:46 +02:00
#ifdef HAVE_NETWORKING
case MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT:
BIND_ACTION_OK(cbs, action_ok_core_content_list);
break;
case MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT_DIRS:
BIND_ACTION_OK(cbs, action_ok_core_content_dirs_list);
break;
2016-06-18 03:12:32 +02:00
case MENU_ENUM_LABEL_CORE_UPDATER_LIST:
BIND_ACTION_OK(cbs, action_ok_core_updater_list);
break;
case MENU_ENUM_LABEL_THUMBNAILS_UPDATER_LIST:
BIND_ACTION_OK(cbs, action_ok_thumbnails_updater_list);
break;
case MENU_ENUM_LABEL_UPDATE_LAKKA:
BIND_ACTION_OK(cbs, action_ok_lakka_list);
break;
2015-09-04 20:11:46 +02:00
#endif
case MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS:
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS:
BIND_ACTION_OK(cbs, action_ok_shader_parameters);
break;
case MENU_ENUM_LABEL_ACCOUNTS_LIST:
BIND_ACTION_OK(cbs, action_ok_push_accounts_list);
break;
case MENU_ENUM_LABEL_INPUT_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_input_settings_list);
break;
2016-06-16 21:40:13 +02:00
case MENU_ENUM_LABEL_DRIVER_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_driver_settings_list);
break;
case MENU_ENUM_LABEL_VIDEO_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_video_settings_list);
break;
case MENU_ENUM_LABEL_AUDIO_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_audio_settings_list);
break;
2016-06-18 22:17:39 +02:00
case MENU_ENUM_LABEL_CORE_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_core_settings_list);
break;
case MENU_ENUM_LABEL_CONFIGURATION_SETTINGS:
2016-07-02 10:17:09 +02:00
BIND_ACTION_OK(cbs, action_ok_push_configuration_settings_list);
break;
case MENU_ENUM_LABEL_PLAYLIST_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_playlist_settings_list);
break;
2016-10-08 15:05:31 +02:00
case MENU_ENUM_LABEL_RECORDING_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_recording_settings_list);
break;
case MENU_ENUM_LABEL_INPUT_HOTKEY_BINDS:
BIND_ACTION_OK(cbs, action_ok_push_input_hotkey_binds_list);
break;
case MENU_ENUM_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS:
BIND_ACTION_OK(cbs, action_ok_push_accounts_cheevos_list);
break;
case MENU_ENUM_LABEL_SHADER_OPTIONS:
case MENU_ENUM_LABEL_CORE_OPTIONS:
case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS:
case MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS:
case MENU_ENUM_LABEL_CORE_INFORMATION:
case MENU_ENUM_LABEL_SYSTEM_INFORMATION:
case MENU_ENUM_LABEL_NETWORK_INFORMATION:
case MENU_ENUM_LABEL_ACHIEVEMENT_LIST:
2016-11-05 16:55:57 -05:00
case MENU_ENUM_LABEL_ACHIEVEMENT_LIST_HARDCORE:
case MENU_ENUM_LABEL_DISK_OPTIONS:
case MENU_ENUM_LABEL_SETTINGS:
case MENU_ENUM_LABEL_FRONTEND_COUNTERS:
case MENU_ENUM_LABEL_CORE_COUNTERS:
case MENU_ENUM_LABEL_MANAGEMENT:
case MENU_ENUM_LABEL_ONLINE_UPDATER:
case MENU_ENUM_LABEL_NETPLAY:
case MENU_ENUM_LABEL_LOAD_CONTENT_LIST:
case MENU_ENUM_LABEL_ADD_CONTENT_LIST:
case MENU_ENUM_LABEL_CONFIGURATIONS_LIST:
case MENU_ENUM_LABEL_HELP_LIST:
case MENU_ENUM_LABEL_INFORMATION_LIST:
case MENU_ENUM_LABEL_CONTENT_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_default);
break;
case MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL:
BIND_ACTION_OK(cbs, action_ok_push_filebrowser_list_file_select);
break;
case MENU_ENUM_LABEL_SCAN_DIRECTORY:
BIND_ACTION_OK(cbs, action_ok_scan_directory_list);
break;
case MENU_ENUM_LABEL_SCAN_FILE:
BIND_ACTION_OK(cbs, action_ok_push_scan_file);
break;
2017-01-22 21:27:36 +01:00
#ifdef HAVE_NETWORKING
2017-01-19 00:52:53 -05:00
case MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS:
BIND_ACTION_OK(cbs, action_ok_push_netplay_refresh_rooms);
break;
2017-01-22 21:27:36 +01:00
#endif
2016-12-13 01:06:28 +01:00
case MENU_ENUM_LABEL_FAVORITES:
BIND_ACTION_OK(cbs, action_ok_push_content_list);
break;
case MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR:
BIND_ACTION_OK(cbs, action_ok_push_random_dir);
break;
case MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST:
BIND_ACTION_OK(cbs, action_ok_push_downloads_dir);
break;
case MENU_ENUM_LABEL_DETECT_CORE_LIST_OK:
BIND_ACTION_OK(cbs, action_ok_file_load_detect_core);
break;
case MENU_ENUM_LABEL_DETECT_CORE_LIST_OK_CURRENT_CORE:
BIND_ACTION_OK(cbs, action_ok_file_load_current_core);
break;
case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY:
case MENU_ENUM_LABEL_CURSOR_MANAGER_LIST:
case MENU_ENUM_LABEL_DATABASE_MANAGER_LIST:
BIND_ACTION_OK(cbs, action_ok_push_generic_list);
break;
case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES:
BIND_ACTION_OK(cbs, action_ok_shader_apply_changes);
break;
case MENU_ENUM_LABEL_CHEAT_APPLY_CHANGES:
BIND_ACTION_OK(cbs, action_ok_cheat_apply_changes);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_AS:
BIND_ACTION_OK(cbs, action_ok_shader_preset_save_as);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_GAME:
BIND_ACTION_OK(cbs, action_ok_shader_preset_save_game);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE:
BIND_ACTION_OK(cbs, action_ok_shader_preset_save_core);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT:
BIND_ACTION_OK(cbs, action_ok_shader_preset_save_parent);
break;
case MENU_ENUM_LABEL_CHEAT_FILE_SAVE_AS:
BIND_ACTION_OK(cbs, action_ok_cheat_file_save_as);
break;
case MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE:
BIND_ACTION_OK(cbs, action_ok_remap_file_save_core);
break;
case MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME:
BIND_ACTION_OK(cbs, action_ok_remap_file_save_game);
break;
2017-08-05 00:37:26 -05:00
case MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CORE:
BIND_ACTION_OK(cbs, action_ok_remap_file_remove_core);
break;
case MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME:
BIND_ACTION_OK(cbs, action_ok_remap_file_remove_game);
break;
case MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST:
BIND_ACTION_OK(cbs, action_ok_content_collection_list);
break;
2016-12-26 06:39:12 +01:00
case MENU_ENUM_LABEL_BROWSE_URL_LIST:
BIND_ACTION_OK(cbs, action_ok_browse_url_list);
break;
case MENU_ENUM_LABEL_CORE_LIST:
BIND_ACTION_OK(cbs, action_ok_core_list);
break;
case MENU_ENUM_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_OK(cbs, action_ok_disk_image_append_list);
break;
case MENU_ENUM_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add_list);
break;
2018-02-10 20:23:24 -05:00
case MENU_ENUM_LABEL_SUBSYSTEM_LOAD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add_load);
break;
case MENU_ENUM_LABEL_CONFIGURATIONS:
BIND_ACTION_OK(cbs, action_ok_configurations_list);
break;
case MENU_ENUM_LABEL_SAVING_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_saving_list);
break;
case MENU_ENUM_LABEL_LOGGING_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_logging_list);
break;
case MENU_ENUM_LABEL_FRAME_THROTTLE_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_frame_throttle_list);
break;
case MENU_ENUM_LABEL_REWIND_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_rewind_list);
break;
case MENU_ENUM_LABEL_ONSCREEN_DISPLAY_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_onscreen_display_list);
break;
2016-11-23 14:28:15 +01:00
case MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_onscreen_notifications_list);
break;
case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_onscreen_overlay_list);
break;
2016-07-02 20:40:27 +02:00
case MENU_ENUM_LABEL_MENU_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_menu_list);
break;
2017-06-20 02:04:23 +02:00
case MENU_ENUM_LABEL_MENU_VIEWS_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_menu_views_list);
break;
case MENU_ENUM_LABEL_QUICK_MENU_VIEWS_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_quick_menu_views_list);
break;
2016-07-02 20:40:27 +02:00
case MENU_ENUM_LABEL_USER_INTERFACE_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_user_interface_list);
break;
case MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_menu_file_browser_list);
break;
case MENU_ENUM_LABEL_RETRO_ACHIEVEMENTS_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_retro_achievements_list);
break;
case MENU_ENUM_LABEL_UPDATER_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_updater_list);
break;
2016-09-21 21:58:43 +02:00
case MENU_ENUM_LABEL_WIFI_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_wifi_list);
break;
2016-07-02 20:40:27 +02:00
case MENU_ENUM_LABEL_NETWORK_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_network_list);
break;
2017-01-19 23:44:10 -05:00
case MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM:
BIND_ACTION_OK(cbs, action_ok_netplay_connect_room);
break;
case MENU_ENUM_LABEL_LAKKA_SERVICES:
BIND_ACTION_OK(cbs, action_ok_lakka_services);
break;
2017-06-08 00:19:43 +02:00
case MENU_ENUM_LABEL_NETPLAY_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_netplay_sublist);
break;
2016-07-02 20:40:27 +02:00
case MENU_ENUM_LABEL_USER_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_user_list);
break;
case MENU_ENUM_LABEL_DIRECTORY_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_directory_list);
break;
case MENU_ENUM_LABEL_PRIVACY_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_privacy_list);
break;
case MENU_ENUM_LABEL_SCREEN_RESOLUTION:
BIND_ACTION_OK(cbs, action_ok_video_resolution);
break;
case MENU_ENUM_LABEL_UPDATE_ASSETS:
BIND_ACTION_OK(cbs, action_ok_update_assets);
break;
case MENU_ENUM_LABEL_UPDATE_CORE_INFO_FILES:
BIND_ACTION_OK(cbs, action_ok_update_core_info_files);
break;
case MENU_ENUM_LABEL_UPDATE_OVERLAYS:
BIND_ACTION_OK(cbs, action_ok_update_overlays);
break;
case MENU_ENUM_LABEL_UPDATE_DATABASES:
BIND_ACTION_OK(cbs, action_ok_update_databases);
break;
case MENU_ENUM_LABEL_UPDATE_GLSL_SHADERS:
BIND_ACTION_OK(cbs, action_ok_update_shaders_glsl);
break;
case MENU_ENUM_LABEL_UPDATE_CG_SHADERS:
BIND_ACTION_OK(cbs, action_ok_update_shaders_cg);
break;
case MENU_ENUM_LABEL_UPDATE_SLANG_SHADERS:
BIND_ACTION_OK(cbs, action_ok_update_shaders_slang);
break;
case MENU_ENUM_LABEL_UPDATE_CHEATS:
BIND_ACTION_OK(cbs, action_ok_update_cheats);
break;
case MENU_ENUM_LABEL_UPDATE_AUTOCONFIG_PROFILES:
BIND_ACTION_OK(cbs, action_ok_update_autoconfig_profiles);
break;
case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST:
BIND_ACTION_OK(cbs, action_ok_netplay_enable_host);
break;
case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT:
BIND_ACTION_OK(cbs, action_ok_netplay_enable_client);
break;
case MENU_ENUM_LABEL_NETPLAY_DISCONNECT:
BIND_ACTION_OK(cbs, action_ok_netplay_disconnect);
break;
case MENU_ENUM_LABEL_CORE_DELETE:
BIND_ACTION_OK(cbs, action_ok_core_delete);
break;
default:
return -1;
}
}
else
{
switch (hash)
{
case MENU_LABEL_OPEN_ARCHIVE_DETECT_CORE:
BIND_ACTION_OK(cbs, action_ok_open_archive_detect_core);
break;
case MENU_LABEL_OPEN_ARCHIVE:
BIND_ACTION_OK(cbs, action_ok_open_archive);
break;
case MENU_LABEL_LOAD_ARCHIVE_DETECT_CORE:
BIND_ACTION_OK(cbs, action_ok_load_archive_detect_core);
break;
case MENU_LABEL_LOAD_ARCHIVE:
BIND_ACTION_OK(cbs, action_ok_load_archive);
break;
case MENU_LABEL_VIDEO_SHADER_PASS:
BIND_ACTION_OK(cbs, action_ok_shader_pass);
break;
case MENU_LABEL_VIDEO_SHADER_PRESET:
BIND_ACTION_OK(cbs, action_ok_shader_preset);
break;
case MENU_LABEL_CHEAT_FILE_LOAD:
BIND_ACTION_OK(cbs, action_ok_cheat_file);
break;
case MENU_LABEL_AUDIO_DSP_PLUGIN:
BIND_ACTION_OK(cbs, action_ok_audio_dsp_plugin);
break;
case MENU_LABEL_REMAP_FILE_LOAD:
BIND_ACTION_OK(cbs, action_ok_remap_file);
break;
case MENU_LABEL_RECORD_CONFIG:
BIND_ACTION_OK(cbs, action_ok_record_configfile);
break;
#ifdef HAVE_NETWORKING
case MENU_LABEL_UPDATE_LAKKA:
BIND_ACTION_OK(cbs, action_ok_lakka_list);
break;
#endif
case MENU_LABEL_VIDEO_SHADER_PARAMETERS:
case MENU_LABEL_VIDEO_SHADER_PRESET_PARAMETERS:
BIND_ACTION_OK(cbs, action_ok_shader_parameters);
break;
case MENU_LABEL_ACCOUNTS_LIST:
BIND_ACTION_OK(cbs, action_ok_push_accounts_list);
break;
case MENU_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS:
BIND_ACTION_OK(cbs, action_ok_push_accounts_cheevos_list);
break;
case MENU_LABEL_FAVORITES:
BIND_ACTION_OK(cbs, action_ok_push_content_list);
break;
case MENU_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST:
BIND_ACTION_OK(cbs, action_ok_push_downloads_dir);
break;
case MENU_LABEL_DETECT_CORE_LIST_OK:
BIND_ACTION_OK(cbs, action_ok_file_load_detect_core);
break;
case MENU_LABEL_SHADER_APPLY_CHANGES:
BIND_ACTION_OK(cbs, action_ok_shader_apply_changes);
break;
case MENU_LABEL_CHEAT_APPLY_CHANGES:
BIND_ACTION_OK(cbs, action_ok_cheat_apply_changes);
break;
case MENU_LABEL_VIDEO_SHADER_PRESET_SAVE_AS:
BIND_ACTION_OK(cbs, action_ok_shader_preset_save_as);
break;
case MENU_LABEL_CHEAT_FILE_SAVE_AS:
BIND_ACTION_OK(cbs, action_ok_cheat_file_save_as);
break;
case MENU_LABEL_REMAP_FILE_SAVE_CORE:
BIND_ACTION_OK(cbs, action_ok_remap_file_save_core);
break;
case MENU_LABEL_REMAP_FILE_SAVE_GAME:
BIND_ACTION_OK(cbs, action_ok_remap_file_save_game);
break;
case MENU_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_OK(cbs, action_ok_disk_image_append_list);
break;
case MENU_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add_list);
break;
case MENU_LABEL_SCREEN_RESOLUTION:
BIND_ACTION_OK(cbs, action_ok_video_resolution);
break;
default:
return -1;
}
}
return 0;
2015-06-05 11:48:25 +02:00
}
static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
uint32_t label_hash, uint32_t menu_label_hash, unsigned type)
2015-06-05 11:48:25 +02:00
{
2015-06-07 17:16:21 +02:00
if (type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD ||
type == MENU_SETTINGS_CUSTOM_BIND)
{
BIND_ACTION_OK(cbs, action_ok_lookup_setting);
}
2015-06-07 17:16:21 +02:00
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
{
BIND_ACTION_OK(cbs, NULL);
}
2015-06-07 17:16:21 +02:00
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
{
BIND_ACTION_OK(cbs, NULL);
}
2015-06-07 17:16:21 +02:00
else if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
{
BIND_ACTION_OK(cbs, action_ok_cheat);
}
2015-06-07 17:16:21 +02:00
else
{
2015-06-07 17:16:21 +02:00
switch (type)
{
2015-06-25 09:15:34 +02:00
case MENU_SETTING_ACTION_CORE_DISK_OPTIONS:
BIND_ACTION_OK(cbs, action_ok_push_default);
2015-06-25 09:15:34 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_PLAYLIST_ENTRY:
if (label_hash == MENU_LABEL_COLLECTION)
{
BIND_ACTION_OK(cbs, action_ok_playlist_entry_collection);
}
else if (label_hash == MENU_LABEL_RDB_ENTRY_START_CONTENT)
{
BIND_ACTION_OK(cbs, action_ok_playlist_entry_start_content);
}
else
{
BIND_ACTION_OK(cbs, action_ok_playlist_entry);
}
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_RPL_ENTRY:
BIND_ACTION_OK(cbs, action_ok_rpl_entry);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_PLAYLIST_COLLECTION:
BIND_ACTION_OK(cbs, action_ok_playlist_collection);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_CONTENTLIST_ENTRY:
BIND_ACTION_OK(cbs, action_ok_push_generic_list);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_CHEAT:
BIND_ACTION_OK(cbs, action_ok_cheat_file_load);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_RECORD_CONFIG:
BIND_ACTION_OK(cbs, action_ok_record_configfile_load);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_REMAP:
BIND_ACTION_OK(cbs, action_ok_remap_file_load);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_SHADER_PRESET:
/* TODO/FIXME - handle scan case */
BIND_ACTION_OK(cbs, action_ok_shader_preset_load);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_SHADER:
/* TODO/FIXME - handle scan case */
BIND_ACTION_OK(cbs, action_ok_shader_pass_load);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_IMAGE:
/* TODO/FIXME - handle scan case */
BIND_ACTION_OK(cbs, action_ok_menu_wallpaper_load);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_USE_DIRECTORY:
BIND_ACTION_OK(cbs, action_ok_path_use_directory);
2015-06-07 17:16:21 +02:00
break;
2015-11-24 01:12:50 +01:00
#ifdef HAVE_LIBRETRODB
2016-06-20 15:50:37 +02:00
case FILE_TYPE_SCAN_DIRECTORY:
BIND_ACTION_OK(cbs, action_ok_path_scan_directory);
2015-07-04 01:51:41 +02:00
break;
2015-11-24 01:12:50 +01:00
#endif
2016-06-20 15:50:37 +02:00
case FILE_TYPE_CONFIG:
BIND_ACTION_OK(cbs, action_ok_config_load);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_PARENT_DIRECTORY:
2015-10-25 08:31:55 +01:00
BIND_ACTION_OK(cbs, action_ok_parent_directory_push);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_DIRECTORY:
BIND_ACTION_OK(cbs, action_ok_directory_push);
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_CARCHIVE:
2017-08-17 18:53:55 +02:00
if (filebrowser_get_type() == FILEBROWSER_SCAN_FILE)
2015-07-04 01:51:41 +02:00
{
#ifdef HAVE_LIBRETRODB
2017-08-17 18:53:55 +02:00
BIND_ACTION_OK(cbs, action_ok_scan_file);
#endif
2017-08-17 18:53:55 +02:00
}
else
{
switch (menu_label_hash)
{
case MENU_LABEL_FAVORITES:
BIND_ACTION_OK(cbs, action_ok_compressed_archive_push_detect_core);
break;
default:
BIND_ACTION_OK(cbs, action_ok_compressed_archive_push);
break;
}
2015-07-04 01:51:41 +02:00
}
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_CORE:
2016-06-27 21:34:05 +02:00
if (cbs->enum_idx != MSG_UNKNOWN)
2015-06-07 17:16:21 +02:00
{
2016-06-18 19:07:51 +02:00
switch (cbs->enum_idx)
{
case MENU_ENUM_LABEL_CORE_UPDATER_LIST:
BIND_ACTION_OK(cbs, action_ok_deferred_list_stub);
break;
case MSG_UNKNOWN:
2016-06-18 19:07:51 +02:00
default:
break;
}
}
else
2018-02-06 21:55:49 +01:00
{
switch (menu_label_hash)
{
case MENU_LABEL_DEFERRED_CORE_LIST:
BIND_ACTION_OK(cbs, action_ok_load_core_deferred);
break;
case MENU_LABEL_DEFERRED_CORE_LIST_SET:
BIND_ACTION_OK(cbs, action_ok_core_deferred_set);
break;
case MENU_LABEL_CORE_LIST:
BIND_ACTION_OK(cbs, action_ok_load_core);
break;
}
2015-06-07 17:16:21 +02:00
}
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_DOWNLOAD_CORE_CONTENT:
BIND_ACTION_OK(cbs, action_ok_core_content_download);
2015-07-04 04:01:35 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_DOWNLOAD_THUMBNAIL_CONTENT:
BIND_ACTION_OK(cbs, action_ok_core_content_thumbnails);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_DOWNLOAD_CORE:
BIND_ACTION_OK(cbs, action_ok_core_updater_download);
2015-06-07 17:16:21 +02:00
break;
2016-06-21 01:40:55 +02:00
case FILE_TYPE_DOWNLOAD_URL:
BIND_ACTION_OK(cbs, action_ok_download_url);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_DOWNLOAD_THUMBNAIL:
BIND_ACTION_OK(cbs, action_ok_thumbnails_updater_download);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_DOWNLOAD_LAKKA:
BIND_ACTION_OK(cbs, action_ok_lakka_download);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_DOWNLOAD_CORE_INFO:
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_RDB:
switch (menu_label_hash)
{
case MENU_LABEL_DEFERRED_DATABASE_MANAGER_LIST:
BIND_ACTION_OK(cbs, action_ok_deferred_list_stub);
break;
case MENU_LABEL_DATABASE_MANAGER_LIST:
case MENU_VALUE_HORIZONTAL_MENU:
BIND_ACTION_OK(cbs, action_ok_database_manager_list);
break;
2015-06-07 17:16:21 +02:00
}
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_RDB_ENTRY:
BIND_ACTION_OK(cbs, action_ok_rdb_entry);
2015-06-07 17:16:21 +02:00
break;
2016-09-22 16:44:51 +02:00
case MENU_WIFI:
BIND_ACTION_OK(cbs, action_ok_wifi);
break;
2016-12-02 22:40:26 -05:00
case MENU_NETPLAY_LAN_SCAN:
BIND_ACTION_OK(cbs, action_ok_netplay_lan_scan);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_CURSOR:
switch (menu_label_hash)
2015-06-07 17:16:21 +02:00
{
case MENU_LABEL_DEFERRED_DATABASE_MANAGER_LIST:
BIND_ACTION_OK(cbs, action_ok_deferred_list_stub);
break;
case MENU_LABEL_CURSOR_MANAGER_LIST:
BIND_ACTION_OK(cbs, action_ok_cursor_manager_list);
break;
}
2015-06-07 17:16:21 +02:00
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_VIDEOFILTER:
BIND_ACTION_OK(cbs, action_ok_set_path_videofilter);
break;
case FILE_TYPE_FONT:
BIND_ACTION_OK(cbs, action_ok_set_path);
2015-06-07 17:16:21 +02:00
break;
case FILE_TYPE_OVERLAY:
BIND_ACTION_OK(cbs, action_ok_set_path_overlay);
break;
case FILE_TYPE_AUDIOFILTER:
BIND_ACTION_OK(cbs, action_ok_set_path_audiofilter);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_IN_CARCHIVE:
case FILE_TYPE_PLAIN:
2017-08-17 18:53:55 +02:00
if (filebrowser_get_type() == FILEBROWSER_SCAN_FILE)
2015-06-07 17:16:21 +02:00
{
2015-11-24 01:18:00 +01:00
#ifdef HAVE_LIBRETRODB
2017-08-17 18:53:55 +02:00
BIND_ACTION_OK(cbs, action_ok_scan_file);
2015-11-24 01:12:50 +01:00
#endif
2017-08-17 18:53:55 +02:00
}
else if (cbs->enum_idx != MSG_UNKNOWN)
{
switch (cbs->enum_idx)
{
case MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST:
2016-12-13 01:06:28 +01:00
case MENU_ENUM_LABEL_FAVORITES:
case MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE:
#ifdef HAVE_COMPRESSION
if (type == FILE_TYPE_IN_CARCHIVE)
{
BIND_ACTION_OK(cbs, action_ok_file_load_with_detect_core_carchive);
}
else
#endif
{
BIND_ACTION_OK(cbs, action_ok_file_load_with_detect_core);
}
break;
case MENU_ENUM_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_OK(cbs, action_ok_disk_image_append);
break;
case MENU_ENUM_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add);
break;
default:
BIND_ACTION_OK(cbs, action_ok_file_load);
break;
}
}
else
{
switch (menu_label_hash)
2018-02-07 22:28:44 +01:00
{
case MENU_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST:
case MENU_LABEL_FAVORITES:
case MENU_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE:
#ifdef HAVE_COMPRESSION
if (type == FILE_TYPE_IN_CARCHIVE)
{
BIND_ACTION_OK(cbs, action_ok_file_load_with_detect_core_carchive);
}
else
2018-02-07 22:28:44 +01:00
#endif
{
BIND_ACTION_OK(cbs, action_ok_file_load_with_detect_core);
}
break;
case MENU_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_OK(cbs, action_ok_disk_image_append);
break;
case MENU_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add);
break;
default:
BIND_ACTION_OK(cbs, action_ok_file_load);
break;
}
2015-06-07 17:16:21 +02:00
}
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_MOVIE:
#ifdef HAVE_FFMPEG
/* TODO/FIXME - handle scan case */
BIND_ACTION_OK(cbs, action_ok_file_load_ffmpeg);
#endif
break;
case FILE_TYPE_MUSIC:
BIND_ACTION_OK(cbs, action_ok_file_load_music);
break;
2016-06-20 15:50:37 +02:00
case FILE_TYPE_IMAGEVIEWER:
/* TODO/FIXME - handle scan case */
BIND_ACTION_OK(cbs, action_ok_file_load_imageviewer);
2015-06-28 17:21:32 +02:00
break;
case FILE_TYPE_DIRECT_LOAD:
BIND_ACTION_OK(cbs, action_ok_file_load);
break;
2015-06-07 17:16:21 +02:00
case MENU_SETTINGS:
case MENU_SETTING_GROUP:
case MENU_SETTING_SUBGROUP:
BIND_ACTION_OK(cbs, action_ok_push_default);
2015-06-07 17:16:21 +02:00
break;
case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_CYCLE_TRAY_STATUS:
BIND_ACTION_OK(cbs, action_ok_disk_cycle_tray_status);
2015-06-07 17:16:21 +02:00
break;
2015-11-15 22:09:39 -05:00
case MENU_SETTINGS_CORE_OPTION_CREATE:
BIND_ACTION_OK(cbs, action_ok_option_create);
break;
2015-06-07 17:16:21 +02:00
default:
return -1;
}
2015-06-05 11:48:25 +02:00
}
return 0;
}
int menu_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
uint32_t label_hash, uint32_t menu_label_hash)
2015-06-05 11:48:25 +02:00
{
2015-06-07 18:36:10 +02:00
if (!cbs)
return -1;
2015-06-05 11:48:25 +02:00
BIND_ACTION_OK(cbs, action_ok_lookup_setting);
2015-06-05 11:48:25 +02:00
if (menu_cbs_init_bind_ok_compare_label(cbs, label, label_hash) == 0)
2015-06-07 18:36:10 +02:00
return 0;
2015-06-05 11:48:25 +02:00
if (menu_cbs_init_bind_ok_compare_type(cbs, label_hash, menu_label_hash, type) == 0)
2015-06-07 18:36:10 +02:00
return 0;
return -1;
}