@ -1,9 +1,11 @@
|
||||
# 1.7.8 (future)
|
||||
- ANDROID: Implemented multi-touch touchscreen support.
|
||||
- BLISS-BOX: Add 4 new pad types from firmware 3.0.
|
||||
- COMMON: Add optional 'on demand' thumbnail downloads.
|
||||
- COMMON: Add new playlist-based thumbnail downloader. Hide the legacy thumbnail pack version by default.
|
||||
- COMMON: Show license per core (if available) inside 'Load Core'.
|
||||
- COMMON: Add option to load content from (and dump) CD-ROM discs.
|
||||
- COMMON: New core options interface, allows for localization, sublabels and more.
|
||||
- GAMECUBE: Add default video/audio filter directories.
|
||||
- GL1: Ignore alpha in core video, fixes XRGB8888 rendering in some cores.
|
||||
- GLCORE: Don't hardcode shader cross compilation target version but poll it. glcore would always only use the minimum target shader version, i.e. GLSL ES 3.00 for OpenGL ES 3.0+ or GLSL 1.50 for OpenGL 3.2+.
|
||||
@ -12,6 +14,7 @@
|
||||
- GLCORE/SLANG: Added "FrameDirection" slang semantic.
|
||||
- INPUT: Menu toggle hotkey can now be bound to another keyboard key and it will toggle properly.
|
||||
- IOS: Correctly centers screen on iPhone X landscape.
|
||||
- IOS: Implemented multi-touch touchscreen support.
|
||||
- LOCALIZATION: Update Korean translation.
|
||||
- LOCALIZATION: Update Japanese translation.
|
||||
- LOCALIZATION: Update Portuguese Brazilian Translation.
|
||||
@ -38,8 +41,10 @@
|
||||
- VULKAN: Add option to select which GPU to render with.
|
||||
- WII: Add default video/audio filter directories.
|
||||
- WII: Fix RGUI display corruption.
|
||||
- WII: Fix HID joypad drivers.
|
||||
- WIIU/SLANG: Added "FrameDirection" slang semantic.
|
||||
- X11: Add non-evdev keycodes to fix keyboard input on non-Linux systems with X11.
|
||||
- X11/UDEV: Mouse pointer should work now in X11 environment with no Display.
|
||||
|
||||
# 1.7.7
|
||||
- 3DS: Add unique IDs to prevent cores overwriting each other.
|
||||
|
@ -156,14 +156,8 @@ endif
|
||||
DEFINES += -DHAVE_DR_MP3
|
||||
DEF_FLAGS += -DHAVE_DR_MP3
|
||||
|
||||
OBJ += frontend/frontend.o \
|
||||
frontend/frontend_driver.o \
|
||||
OBJ += frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
ui/drivers/ui_null.o \
|
||||
ui/drivers/null/ui_null_window.o \
|
||||
ui/drivers/null/ui_null_browser_window.o \
|
||||
ui/drivers/null/ui_null_msg_window.o \
|
||||
ui/drivers/null/ui_null_application.o \
|
||||
retroarch.o \
|
||||
paths.o \
|
||||
command.o \
|
||||
@ -188,6 +182,7 @@ OBJ += frontend/frontend.o \
|
||||
$(LIBRETRO_COMM_DIR)/streams/interface_stream.o \
|
||||
$(LIBRETRO_COMM_DIR)/streams/memory_stream.o \
|
||||
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.o \
|
||||
$(LIBRETRO_COMM_DIR)/media/media_detect_cd.o \
|
||||
$(LIBRETRO_COMM_DIR)/lists/string_list.o \
|
||||
$(LIBRETRO_COMM_DIR)/string/stdstring.o \
|
||||
$(LIBRETRO_COMM_DIR)/memmap/memalign.o \
|
||||
@ -280,8 +275,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_RUNAHEAD), 1)
|
||||
DEFINES += -DHAVE_RUNAHEAD
|
||||
OBJ += runahead/copy_load_info.o \
|
||||
runahead/mem_util.o \
|
||||
OBJ += runahead/mem_util.o \
|
||||
runahead/mylist.o
|
||||
endif
|
||||
|
||||
|
@ -184,6 +184,7 @@ else ifeq ($(libogc_platform), 1)
|
||||
|
||||
CFLAGS += -DGEKKO -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
|
||||
|
||||
HAVE_AUDIOMIXER := 1
|
||||
HAVE_RUNAHEAD := 1
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_THREADS := 1
|
||||
@ -201,7 +202,8 @@ else ifeq ($(libogc_platform), 1)
|
||||
RARCH_CONSOLE = 1
|
||||
|
||||
ifeq ($(platform), wii)
|
||||
#HAVE_LANGEXTRA := 1
|
||||
HAVE_AUDIOMIXER := 1
|
||||
#HAVE_LANGEXTRA := 1
|
||||
HAVE_WIIUSB_HID := 1
|
||||
HAVE_RARCH_EXEC := 1
|
||||
HAVE_RSOUND := 1
|
||||
|
@ -47,6 +47,7 @@ else
|
||||
HAVE_LIBRETRODB := 1
|
||||
HAVE_CC_RESAMPLER := 1
|
||||
HAVE_CHEEVOS := 1
|
||||
HAVE_RUNAHEAD := 1
|
||||
RARCH_CONSOLE := 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
|
@ -2257,7 +2257,7 @@ static void * tinyalsa_init(const char *devicestr, unsigned rate,
|
||||
RARCH_LOG("[TINYALSA]: Can pause: %s.\n", tinyalsa->can_pause ? "yes" : "no");
|
||||
RARCH_LOG("[TINYALSA]: Audio rate: %uHz.\n", config.rate);
|
||||
RARCH_LOG("[TINYALSA]: Buffer size: %u frames.\n", buffer_size);
|
||||
RARCH_LOG("[TINYALSA]: Buffer size: %u bytes.\n", tinyalsa->buffer_size);
|
||||
RARCH_LOG("[TINYALSA]: Buffer size: %u bytes.\n", (unsigned int)tinyalsa->buffer_size);
|
||||
RARCH_LOG("[TINYALSA]: Frame size: %u bytes.\n", tinyalsa->frame_bits / 8);
|
||||
RARCH_LOG("[TINYALSA]: Latency: %ums.\n", buffer_size * 1000 / (rate * 4));
|
||||
|
||||
|
46
config.def.h
@ -341,38 +341,38 @@ static unsigned menu_ticker_type = TICKER_TYPE_BOUNCE;
|
||||
static float menu_ticker_speed = 1.0f;
|
||||
|
||||
#if defined(HAVE_THREADS)
|
||||
static bool menu_savestate_resume = true;
|
||||
static bool menu_savestate_resume = true;
|
||||
#else
|
||||
static bool menu_savestate_resume = false;
|
||||
static bool menu_savestate_resume = false;
|
||||
#endif
|
||||
|
||||
static bool content_show_settings = true;
|
||||
static bool content_show_favorites = true;
|
||||
static bool content_show_settings = true;
|
||||
static bool content_show_favorites = true;
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
static bool content_show_images = true;
|
||||
static bool content_show_images = true;
|
||||
#endif
|
||||
static bool content_show_music = true;
|
||||
static bool content_show_music = true;
|
||||
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
|
||||
static bool content_show_video = true;
|
||||
static bool content_show_video = true;
|
||||
#endif
|
||||
#ifdef HAVE_NETWORKING
|
||||
static bool content_show_netplay = true;
|
||||
static bool content_show_netplay = true;
|
||||
#endif
|
||||
static bool content_show_history = true;
|
||||
static bool content_show_history = true;
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
static bool content_show_add = true;
|
||||
static bool content_show_add = true;
|
||||
#endif
|
||||
static bool content_show_playlists = true;
|
||||
static bool content_show_playlists = true;
|
||||
|
||||
#ifdef HAVE_XMB
|
||||
static unsigned xmb_scale_factor = 100;
|
||||
static unsigned xmb_alpha_factor = 75;
|
||||
static unsigned menu_font_color_red = 255;
|
||||
static unsigned xmb_scale_factor = 100;
|
||||
static unsigned xmb_alpha_factor = 75;
|
||||
static unsigned menu_font_color_red = 255;
|
||||
static unsigned menu_font_color_green = 255;
|
||||
static unsigned menu_font_color_blue = 255;
|
||||
static unsigned xmb_menu_layout = 0;
|
||||
static unsigned xmb_icon_theme = XMB_ICON_THEME_MONOCHROME;
|
||||
static unsigned xmb_theme = XMB_THEME_ELECTRIC_BLUE;
|
||||
static unsigned menu_font_color_blue = 255;
|
||||
static unsigned xmb_menu_layout = 0;
|
||||
static unsigned xmb_icon_theme = XMB_ICON_THEME_MONOCHROME;
|
||||
static unsigned xmb_theme = XMB_THEME_ELECTRIC_BLUE;
|
||||
|
||||
#if defined(HAVE_LAKKA) || defined(__arm__) || defined(__PPC64__) || defined(__ppc64__) || defined(__powerpc64__) || defined(__powerpc__) || defined(__ppc__) || defined(__POWERPC__)
|
||||
#define DEFAULT_XMB_SHADOWS_ENABLE false
|
||||
@ -796,15 +796,15 @@ static const unsigned libretro_log_level = 1;
|
||||
|
||||
/* Axis threshold (between 0.0 and 1.0)
|
||||
* How far an axis must be tilted to result in a button press. */
|
||||
static const float axis_threshold = 0.5f;
|
||||
static const float axis_threshold = 0.5f;
|
||||
|
||||
static const float analog_deadzone = 0.0f;
|
||||
static const float analog_deadzone = 0.0f;
|
||||
|
||||
static const float analog_sensitivity = 1.0f;
|
||||
static const float analog_sensitivity = 1.0f;
|
||||
|
||||
/* Describes speed of which turbo-enabled buttons toggle. */
|
||||
static const unsigned turbo_period = 6;
|
||||
static const unsigned turbo_duty_cycle = 3;
|
||||
static const unsigned turbo_period = 6;
|
||||
static const unsigned turbo_duty_cycle = 3;
|
||||
|
||||
/* Enable input auto-detection. Will attempt to autoconfigure
|
||||
* gamepads, plug-and-play style. */
|
||||
|
@ -2391,11 +2391,10 @@ static config_file_t *open_default_config_file(void)
|
||||
config_file_t *conf = NULL;
|
||||
|
||||
(void)has_application_data;
|
||||
(void)path_size;
|
||||
|
||||
application_data[0] = conf_path[0] = app_path[0] = '\0';
|
||||
|
||||
(void)path_size;
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
/* On UWP, the app install directory is not writable so use the writable LocalState dir instead */
|
||||
@ -2424,7 +2423,7 @@ static config_file_t *open_default_config_file(void)
|
||||
bool saved = false;
|
||||
|
||||
/* Try to create a new config file. */
|
||||
conf = config_file_new(NULL);
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
if (conf)
|
||||
{
|
||||
@ -2463,7 +2462,7 @@ static config_file_t *open_default_config_file(void)
|
||||
if (!conf)
|
||||
{
|
||||
bool saved = false;
|
||||
conf = config_file_new(NULL);
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
if (conf)
|
||||
{
|
||||
@ -2505,9 +2504,10 @@ static config_file_t *open_default_config_file(void)
|
||||
|
||||
if (!conf && has_application_data)
|
||||
{
|
||||
char *basedir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
bool dir_created = false;
|
||||
char *basedir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
basedir[0] = '\0';
|
||||
basedir[0] = '\0';
|
||||
|
||||
/* Try to create a new config file. */
|
||||
|
||||
@ -2518,16 +2518,18 @@ static config_file_t *open_default_config_file(void)
|
||||
fill_pathname_join(conf_path, conf_path,
|
||||
file_path_str(FILE_PATH_MAIN_CONFIG), path_size);
|
||||
|
||||
if (path_mkdir(basedir))
|
||||
dir_created = path_mkdir(basedir);
|
||||
free(basedir);
|
||||
|
||||
if (dir_created)
|
||||
{
|
||||
char *skeleton_conf = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
bool saved = false;
|
||||
|
||||
skeleton_conf[0] = '\0';
|
||||
|
||||
free(basedir);
|
||||
|
||||
/* Build a retroarch.cfg path from the global config directory (/etc). */
|
||||
/* Build a retroarch.cfg path from the
|
||||
* global config directory (/etc). */
|
||||
fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR,
|
||||
file_path_str(FILE_PATH_MAIN_CONFIG), path_size);
|
||||
|
||||
@ -2535,13 +2537,14 @@ static config_file_t *open_default_config_file(void)
|
||||
if (conf)
|
||||
RARCH_WARN("Config: using skeleton config \"%s\" as base for a new config file.\n", skeleton_conf);
|
||||
else
|
||||
conf = config_file_new(NULL);
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
free(skeleton_conf);
|
||||
|
||||
if (conf)
|
||||
{
|
||||
/* Since this is a clean config file, we can safely use config_save_on_exit. */
|
||||
/* Since this is a clean config file, we can
|
||||
* safely use config_save_on_exit. */
|
||||
config_set_bool(conf, "config_save_on_exit", true);
|
||||
saved = config_file_write(conf, conf_path, true);
|
||||
}
|
||||
@ -2555,10 +2558,6 @@ static config_file_t *open_default_config_file(void)
|
||||
|
||||
RARCH_WARN("Config: Created new config file in: \"%s\".\n", conf_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(basedir);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -3639,7 +3638,7 @@ bool config_save_autoconf_profile(const char *path, unsigned user)
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
conf = config_file_new(NULL);
|
||||
conf = config_file_new_alloc();
|
||||
if (!conf)
|
||||
{
|
||||
free(autoconf_file);
|
||||
@ -3710,7 +3709,7 @@ bool config_save_file(const char *path)
|
||||
int path_settings_size = sizeof(settings->paths) / sizeof(settings->paths.placeholder);
|
||||
|
||||
if (!conf)
|
||||
conf = config_file_new(NULL);
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
if (!conf || rarch_ctl(RARCH_CTL_IS_OVERRIDES_ACTIVE, NULL))
|
||||
{
|
||||
@ -3993,7 +3992,7 @@ bool config_save_overrides(int override_type)
|
||||
path_size);
|
||||
|
||||
if (!conf)
|
||||
conf = config_file_new(NULL);
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
/* Load the original config file in memory */
|
||||
config_load_file(path_get(RARCH_PATH_CONFIG), settings);
|
||||
|
6
core.h
@ -167,7 +167,7 @@ bool core_set_netplay_callbacks(void);
|
||||
bool core_unset_netplay_callbacks(void);
|
||||
#endif
|
||||
|
||||
bool core_set_poll_type(unsigned *type);
|
||||
bool core_set_poll_type(unsigned type);
|
||||
|
||||
/* Runs the core for one frame. */
|
||||
bool core_run(void);
|
||||
@ -216,10 +216,6 @@ bool core_has_set_input_descriptor(void);
|
||||
|
||||
void core_uninit_symbols(void);
|
||||
|
||||
bool core_is_symbols_inited(void);
|
||||
|
||||
bool core_is_inited(void);
|
||||
|
||||
void core_free_retro_game_info(struct retro_game_info *dest);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
23
core_info.c
@ -225,7 +225,16 @@ static config_file_t *core_info_list_iterate(
|
||||
info_path_base = NULL;
|
||||
|
||||
if (path_is_valid(info_path))
|
||||
conf = config_file_new(info_path);
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
if (filestream_read_file(info_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
}
|
||||
free(info_path);
|
||||
|
||||
return conf;
|
||||
@ -914,8 +923,16 @@ bool core_info_list_get_display_name(core_info_list_t *core_info_list,
|
||||
|
||||
bool core_info_get_display_name(const char *path, char *s, size_t len)
|
||||
{
|
||||
char *tmp = NULL;
|
||||
config_file_t *conf = config_file_new(path);
|
||||
int64_t length = 0;
|
||||
char *tmp = NULL;
|
||||
config_file_t *conf = NULL;
|
||||
uint8_t *ret_buf = NULL;
|
||||
if (filestream_read_file(path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
|
||||
if (!conf)
|
||||
return false;
|
||||
|
6
deps/mbedtls/mbedtls/config.h
vendored
@ -906,7 +906,9 @@
|
||||
* Disable if you run into name conflicts and want to really remove the
|
||||
* mbedtls_strerror()
|
||||
*/
|
||||
#if 0
|
||||
#define MBEDTLS_ERROR_STRERROR_DUMMY
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_GENPRIME
|
||||
@ -1077,7 +1079,9 @@
|
||||
*
|
||||
* Enable the checkup functions (*_self_test).
|
||||
*/
|
||||
#if 0
|
||||
#define MBEDTLS_SELF_TEST
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SHA256_SMALLER
|
||||
@ -1469,7 +1473,9 @@
|
||||
*
|
||||
* Comment this to disable run-time checking and save ROM space
|
||||
*/
|
||||
#if 0
|
||||
#define MBEDTLS_VERSION_FEATURES
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
|
||||
|
@ -65,8 +65,6 @@ static bool discord_ready = false;
|
||||
static bool discord_avatar_ready = false;
|
||||
static unsigned discord_status = 0;
|
||||
|
||||
struct netplay_room *room;
|
||||
|
||||
/* The discord API specifies these variables:
|
||||
- userId --------- char[24] - the userId of the player asking to join
|
||||
- username ------- char[344] - the username of the player asking to join
|
||||
@ -76,7 +74,6 @@ struct netplay_room *room;
|
||||
- partyId - char[128] - the party you would be joining
|
||||
*/
|
||||
|
||||
static char user_id[24];
|
||||
static char user_name[344];
|
||||
static char self_party_id[128];
|
||||
static char peer_party_id[128];
|
||||
@ -206,8 +203,10 @@ static void handle_discord_join_cb(retro_task_t *task,
|
||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
|
||||
|
||||
snprintf(join_hostname, sizeof(join_hostname), "%s|%d",
|
||||
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_address : room->address,
|
||||
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_port : room->port);
|
||||
room->host_method == NETPLAY_HOST_METHOD_MITM
|
||||
? room->mitm_address : room->address,
|
||||
room->host_method == NETPLAY_HOST_METHOD_MITM
|
||||
? room->mitm_port : room->port);
|
||||
|
||||
RARCH_LOG("[discord] joining lobby at: %s\n", join_hostname);
|
||||
task_push_netplay_crc_scan(room->gamecrc,
|
||||
@ -399,25 +398,34 @@ void discord_update(enum discord_presence presence)
|
||||
}
|
||||
break;
|
||||
case DISCORD_PRESENCE_NETPLAY_HOSTING:
|
||||
room = netplay_get_host_room();
|
||||
if (room->id == 0)
|
||||
return;
|
||||
|
||||
RARCH_LOG("[discord] netplay room details: id=%d, nick=%s IP=%s port=%d\n",
|
||||
room->id, room->nickname,
|
||||
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_address : room->address,
|
||||
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_port : room->port);
|
||||
|
||||
{
|
||||
char join_secret[128];
|
||||
struct netplay_room *room = netplay_get_host_room();
|
||||
if (room->id == 0)
|
||||
return;
|
||||
|
||||
snprintf(self_party_id, sizeof(self_party_id), "%d", room->id);
|
||||
snprintf(join_secret, sizeof(join_secret), "%d|%" PRId64, room->id, cpu_features_get_time_usec());
|
||||
discord_presence.joinSecret = strdup(join_secret);
|
||||
/* discord_presence.spectateSecret = "SPECSPECSPEC"; */
|
||||
discord_presence.partyId = strdup(self_party_id);
|
||||
discord_presence.partyMax = 2;
|
||||
discord_presence.partySize = 1;
|
||||
RARCH_LOG("[discord] netplay room details: id=%d"
|
||||
", nick=%s IP=%s port=%d\n",
|
||||
room->id, room->nickname,
|
||||
room->host_method == NETPLAY_HOST_METHOD_MITM
|
||||
? room->mitm_address : room->address,
|
||||
room->host_method == NETPLAY_HOST_METHOD_MITM
|
||||
? room->mitm_port : room->port);
|
||||
|
||||
|
||||
snprintf(self_party_id,
|
||||
sizeof(self_party_id), "%d", room->id);
|
||||
snprintf(join_secret,
|
||||
sizeof(join_secret), "%d|%" PRId64,
|
||||
room->id, cpu_features_get_time_usec());
|
||||
|
||||
discord_presence.joinSecret = strdup(join_secret);
|
||||
#if 0
|
||||
discord_presence.spectateSecret = "SPECSPECSPEC";
|
||||
#endif
|
||||
discord_presence.partyId = strdup(self_party_id);
|
||||
discord_presence.partyMax = 2;
|
||||
discord_presence.partySize = 1;
|
||||
|
||||
RARCH_LOG("[discord] join secret: %s\n", join_secret);
|
||||
RARCH_LOG("[discord] party id: %s\n", self_party_id);
|
||||
@ -485,10 +493,12 @@ void discord_init(void)
|
||||
else
|
||||
{
|
||||
path_basedir(full_path);
|
||||
snprintf(command, sizeof(command), "%s%s", full_path, get_retroarch_launch_arguments());
|
||||
snprintf(command, sizeof(command), "%s%s",
|
||||
full_path, get_retroarch_launch_arguments());
|
||||
}
|
||||
#else
|
||||
snprintf(command, sizeof(command), "sh -c %s", get_retroarch_launch_arguments());
|
||||
snprintf(command, sizeof(command), "sh -c %s",
|
||||
get_retroarch_launch_arguments());
|
||||
#endif
|
||||
RARCH_LOG("[discord] registering startup command: %s\n", command);
|
||||
Discord_Register(settings->arrays.discord_app_id, command);
|
||||
|
@ -358,6 +358,13 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
resolved_home_dir_buf,
|
||||
sizeof(home_dir_buf)) < sizeof(home_dir_buf));
|
||||
}
|
||||
char resolved_bundle_dir_buf[PATH_MAX_LENGTH] = {0};
|
||||
if (realpath(bundle_path_buf, resolved_bundle_dir_buf))
|
||||
{
|
||||
retro_assert(strlcpy(bundle_path_buf,
|
||||
resolved_bundle_dir_buf,
|
||||
sizeof(bundle_path_buf)) < sizeof(bundle_path_buf));
|
||||
}
|
||||
#endif
|
||||
|
||||
strlcat(home_dir_buf, "/RetroArch", sizeof(home_dir_buf));
|
||||
|
@ -1,192 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2012-2015 - Michael Lelli
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <retro_timers.h>
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../menu/menu_driver.h"
|
||||
#endif
|
||||
|
||||
#include "frontend.h"
|
||||
#include "frontend_driver.h"
|
||||
#include "../configuration.h"
|
||||
#include "../ui/ui_companion_driver.h"
|
||||
#include "../tasks/task_content.h"
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../paths.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
#include <objbase.h>
|
||||
#endif
|
||||
|
||||
/* Griffin hack */
|
||||
#ifdef HAVE_QT
|
||||
#ifndef HAVE_MAIN
|
||||
#define HAVE_MAIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* main_exit:
|
||||
*
|
||||
* Cleanly exit RetroArch.
|
||||
*
|
||||
* Also saves configuration files to disk,
|
||||
* and (optionally) autosave state.
|
||||
**/
|
||||
void main_exit(void *args)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings->bools.config_save_on_exit)
|
||||
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* Do not want menu context to live any more. */
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UNSET_OWN_DRIVER, NULL);
|
||||
#endif
|
||||
rarch_ctl(RARCH_CTL_MAIN_DEINIT, NULL);
|
||||
|
||||
command_event(CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG, NULL);
|
||||
|
||||
#if defined(HAVE_LOGGER) && !defined(ANDROID)
|
||||
logger_shutdown();
|
||||
#endif
|
||||
|
||||
frontend_driver_deinit(args);
|
||||
frontend_driver_exitspawn(
|
||||
path_get_ptr(RARCH_PATH_CORE),
|
||||
path_get_realsize(RARCH_PATH_CORE));
|
||||
|
||||
rarch_ctl(RARCH_CTL_DESTROY, NULL);
|
||||
|
||||
ui_companion_driver_deinit();
|
||||
|
||||
frontend_driver_shutdown(false);
|
||||
|
||||
driver_ctl(RARCH_DRIVER_CTL_DEINIT, NULL);
|
||||
ui_companion_driver_free();
|
||||
frontend_driver_free();
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
CoUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* main_entry:
|
||||
*
|
||||
* Main function of RetroArch.
|
||||
*
|
||||
* If HAVE_MAIN is not defined, will contain main loop and will not
|
||||
* be exited from until we exit the program. Otherwise, will
|
||||
* just do initialization.
|
||||
*
|
||||
* Returns: varies per platform.
|
||||
**/
|
||||
int rarch_main(int argc, char *argv[], void *data)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
if (FAILED(CoInitialize(NULL)))
|
||||
{
|
||||
RARCH_ERR("FATAL: Failed to initialize the COM interface\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
rarch_ctl(RARCH_CTL_PREINIT, NULL);
|
||||
frontend_driver_init_first(data);
|
||||
rarch_ctl(RARCH_CTL_INIT, NULL);
|
||||
|
||||
if (frontend_driver_is_inited())
|
||||
{
|
||||
content_ctx_info_t info;
|
||||
|
||||
info.argc = argc;
|
||||
info.argv = argv;
|
||||
info.args = data;
|
||||
info.environ_get = frontend_driver_environment_get_ptr();
|
||||
|
||||
if (!task_push_load_content_from_cli(
|
||||
NULL,
|
||||
NULL,
|
||||
&info,
|
||||
CORE_TYPE_PLAIN,
|
||||
NULL,
|
||||
NULL))
|
||||
return 1;
|
||||
}
|
||||
|
||||
ui_companion_driver_init_first();
|
||||
|
||||
#if !defined(HAVE_MAIN) || defined(HAVE_QT)
|
||||
do
|
||||
{
|
||||
int ret;
|
||||
bool app_exit = false;
|
||||
unsigned sleep_ms = 0;
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
ui_companion_win32.application->process_events();
|
||||
#endif
|
||||
#ifdef HAVE_QT
|
||||
ui_companion_qt.application->process_events();
|
||||
#endif
|
||||
ret = runloop_iterate(&sleep_ms);
|
||||
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
|
||||
task_queue_check();
|
||||
|
||||
#ifdef HAVE_QT
|
||||
app_exit = ui_companion_qt.application->exiting;
|
||||
#endif
|
||||
|
||||
if (ret == -1 || app_exit)
|
||||
{
|
||||
#ifdef HAVE_QT
|
||||
ui_companion_qt.application->quit();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}while(1);
|
||||
|
||||
main_exit(data);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef HAVE_MAIN
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return rarch_main(argc, argv, NULL);
|
||||
}
|
||||
#endif
|
@ -156,7 +156,7 @@ static void salamander_init(char *s, size_t len)
|
||||
|
||||
if (!config_exists)
|
||||
{
|
||||
config_file_t *conf = (config_file_t*)config_file_new(NULL);
|
||||
config_file_t *conf = (config_file_t*)config_file_new_alloc();
|
||||
|
||||
if (conf)
|
||||
{
|
||||
|
@ -180,6 +180,7 @@ static bool x11_display_server_set_resolution(void *data,
|
||||
int vbp = 0;
|
||||
int hmax = 0;
|
||||
int vmax = 0;
|
||||
int x_offset = center;
|
||||
int pdefault = 8;
|
||||
int pwidth = 0;
|
||||
float roundw = 0.0f;
|
||||
@ -198,35 +199,17 @@ static bool x11_display_server_set_resolution(void *data,
|
||||
video_monitor_set_refresh_rate(hz);
|
||||
|
||||
/* following code is the mode line generator */
|
||||
pwidth = width;
|
||||
|
||||
if (height < 400 && width > 400)
|
||||
pwidth = width / 2;
|
||||
|
||||
roundw = roundf((float)pwidth / (float)height * 100) / 100;
|
||||
|
||||
if (height > width)
|
||||
roundw = roundf((float)height / (float)width * 100) / 100;
|
||||
|
||||
if (roundw > 1.35)
|
||||
roundw = 1.25;
|
||||
|
||||
if (roundw < 1.20)
|
||||
roundw = 1.34;
|
||||
|
||||
if (width < 700)
|
||||
{
|
||||
hfp = width * 1.055;
|
||||
hbp = width * roundw - 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
hfp = (width * 1.055) + (width / 40);
|
||||
hbp = (width * roundw) + (width /24);
|
||||
hfp = (width * 1.033);
|
||||
hbp = width * 1.225;
|
||||
}else {
|
||||
hfp = (width * 1.033) + (width / 112);
|
||||
hbp = (width * 1.225) + (width /58);
|
||||
xoffset = xoffset*2;
|
||||
}
|
||||
|
||||
hsp = (width * 1.140) - (xoffset*4);
|
||||
|
||||
hsp = (width * 1.117) - (xoffset*4);
|
||||
|
||||
hmax = hbp;
|
||||
|
||||
|
@ -247,12 +247,12 @@ int crt_compute_dynamic_width(int width)
|
||||
#if defined(HAVE_VIDEOCORE)
|
||||
p_clock = 32000000;
|
||||
#else
|
||||
p_clock = 15000000;
|
||||
p_clock = 21000000;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
dynamic_width = (width*1.5)*i;
|
||||
dynamic_width = width*i;
|
||||
if ((dynamic_width * min_height * ra_core_hz) > p_clock)
|
||||
break;
|
||||
|
||||
|
@ -909,6 +909,8 @@ bool video_shader_is_supported(enum rarch_shader_type type)
|
||||
gfx_ctx_flags_t flags;
|
||||
enum display_flags testflag;
|
||||
|
||||
flags.flags = 0;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RARCH_SHADER_SLANG:
|
||||
|
@ -970,6 +970,7 @@ FILE
|
||||
#ifdef HAVE_CDROM
|
||||
#include "../libretro-common/cdrom/cdrom.c"
|
||||
#include "../libretro-common/vfs/vfs_implementation_cdrom.c"
|
||||
#include "../libretro-common/media/media_detect_cd.c"
|
||||
#endif
|
||||
|
||||
#include "../list_special.c"
|
||||
@ -1057,12 +1058,6 @@ FRONTEND
|
||||
/*============================================================
|
||||
UI
|
||||
============================================================ */
|
||||
#include "../ui/drivers/ui_null.c"
|
||||
#include "../ui/drivers/null/ui_null_window.c"
|
||||
#include "../ui/drivers/null/ui_null_browser_window.c"
|
||||
#include "../ui/drivers/null/ui_null_msg_window.c"
|
||||
#include "../ui/drivers/null/ui_null_application.c"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
#include "../ui/drivers/ui_win32.c"
|
||||
#include "../ui/drivers/win32/ui_win32_window.c"
|
||||
@ -1071,11 +1066,6 @@ UI
|
||||
#include "../ui/drivers/win32/ui_win32_application.c"
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
MAIN
|
||||
============================================================ */
|
||||
#include "../frontend/frontend.c"
|
||||
|
||||
/*============================================================
|
||||
GIT
|
||||
============================================================ */
|
||||
@ -1384,7 +1374,6 @@ MENU
|
||||
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
#include "../runahead/mem_util.c"
|
||||
#include "../runahead/copy_load_info.c"
|
||||
#include "../runahead/mylist.c"
|
||||
#endif
|
||||
|
||||
|
@ -136,12 +136,8 @@ static void hidpad_ps3_get_buttons(void *data, input_bits_t *state)
|
||||
struct hidpad_ps3_data *device = (struct hidpad_ps3_data*)data;
|
||||
if ( device )
|
||||
{
|
||||
/*copy first 16 bits - standard RetroPad controls*/
|
||||
BITS_COPY16_PTR(state, device->buttons);
|
||||
|
||||
/*PS button?*/
|
||||
if (device->buttons & 0x10000)
|
||||
BIT256_SET_PTR(state, RARCH_MENU_TOGGLE);
|
||||
/* copy 32 bits : needed for PS button? */
|
||||
BITS_COPY32_PTR(state, device->buttons);
|
||||
}
|
||||
else
|
||||
BIT256_CLEAR_ALL_PTR(state);
|
||||
|
@ -25,24 +25,31 @@
|
||||
#include <retro_endianness.h>
|
||||
#include "../input_driver.h"
|
||||
|
||||
/* Wii have PID/VID already swapped by USB_GetDescriptors from libogc */
|
||||
#ifdef GEKKO
|
||||
#define SWAP_IF_BIG(val) (val)
|
||||
#else
|
||||
#define SWAP_IF_BIG(val) swap_if_big16(val)
|
||||
#endif
|
||||
|
||||
#define VID_NONE 0x0000
|
||||
#define VID_NINTENDO swap_if_big16(0x057e)
|
||||
#define VID_SONY swap_if_big16(0x054c)
|
||||
#define VID_MICRONTEK swap_if_big16(0x0079)
|
||||
#define VID_PCS swap_if_big16(0x0810)
|
||||
#define VID_PS3_CLONE swap_if_big16(0x0313)
|
||||
#define VID_SNES_CLONE swap_if_big16(0x081f)
|
||||
#define VID_NINTENDO SWAP_IF_BIG(0x057e)
|
||||
#define VID_SONY SWAP_IF_BIG(0x054c)
|
||||
#define VID_MICRONTEK SWAP_IF_BIG(0x0079)
|
||||
#define VID_PCS SWAP_IF_BIG(0x0810)
|
||||
#define VID_PS3_CLONE SWAP_IF_BIG(0x0313)
|
||||
#define VID_SNES_CLONE SWAP_IF_BIG(0x081f)
|
||||
|
||||
#define PID_NONE 0x0000
|
||||
#define PID_NINTENDO_PRO swap_if_big16(0x0330)
|
||||
#define PID_SONY_DS3 swap_if_big16(0x0268)
|
||||
#define PID_SONY_DS4 swap_if_big16(0x05c4)
|
||||
#define PID_DS3_CLONE swap_if_big16(0x20d6)
|
||||
#define PID_SNES_CLONE swap_if_big16(0xe401)
|
||||
#define PID_MICRONTEK_NES swap_if_big16(0x0011)
|
||||
#define PID_NINTENDO_GCA swap_if_big16(0x0337)
|
||||
#define PID_PCS_PS2PSX swap_if_big16(0x0001)
|
||||
#define PID_PCS_PSX2PS3 swap_if_big16(0x0003)
|
||||
#define PID_NINTENDO_PRO SWAP_IF_BIG(0x0330)
|
||||
#define PID_SONY_DS3 SWAP_IF_BIG(0x0268)
|
||||
#define PID_SONY_DS4 SWAP_IF_BIG(0x05c4)
|
||||
#define PID_DS3_CLONE SWAP_IF_BIG(0x20d6)
|
||||
#define PID_SNES_CLONE SWAP_IF_BIG(0xe401)
|
||||
#define PID_MICRONTEK_NES SWAP_IF_BIG(0x0011)
|
||||
#define PID_NINTENDO_GCA SWAP_IF_BIG(0x0337)
|
||||
#define PID_PCS_PS2PSX SWAP_IF_BIG(0x0001)
|
||||
#define PID_PCS_PSX2PS3 SWAP_IF_BIG(0x0003)
|
||||
|
||||
struct joypad_connection
|
||||
{
|
||||
|
@ -1244,16 +1244,13 @@ static void handle_hotplug(android_input_t *android,
|
||||
if (*port < 0)
|
||||
*port = android->pads_connected;
|
||||
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
name_buf,
|
||||
NULL,
|
||||
android_joypad.ident,
|
||||
*port,
|
||||
vendorId,
|
||||
productId))
|
||||
input_config_set_device_name(*port, name_buf);
|
||||
|
||||
input_config_set_device_name(*port, name_buf);
|
||||
productId);
|
||||
|
||||
android->pad_states[android->pads_connected].id = id;
|
||||
android->pad_states[android->pads_connected].port = *port;
|
||||
|
@ -78,20 +78,31 @@ static void *linuxraw_input_init(const char *joypad_driver)
|
||||
static int16_t linuxraw_analog_pressed(linuxraw_input_t *linuxraw,
|
||||
const struct retro_keybind *binds, unsigned idx, unsigned id)
|
||||
{
|
||||
const struct retro_keybind *bind_minus, *bind_plus;
|
||||
int16_t pressed_minus = 0, pressed_plus = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
if ((id_minus < RARCH_BIND_LIST_END) && binds->valid &&
|
||||
linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[id_minus].key]]
|
||||
)
|
||||
pressed_minus = -0x7fff;
|
||||
if ((id_plus < RARCH_BIND_LIST_END) && binds->valid &&
|
||||
linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[id_plus].key]]
|
||||
)
|
||||
pressed_plus = 0x7fff;
|
||||
bind_minus = &binds[id_minus];
|
||||
bind_plus = &binds[id_plus];
|
||||
|
||||
if (!bind_minus->valid || !bind_plus->valid)
|
||||
return 0;
|
||||
|
||||
if (bind_minus->key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)bind_minus->key];
|
||||
if (linuxraw->state[sym] & 0x80)
|
||||
pressed_minus = -0x7fff;
|
||||
}
|
||||
if (bind_plus->key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)bind_minus->key];
|
||||
if (linuxraw->state[sym] & 0x80)
|
||||
pressed_plus = 0x7fff;
|
||||
}
|
||||
|
||||
return pressed_plus + pressed_minus;
|
||||
}
|
||||
|
@ -217,7 +217,8 @@ static void udev_input_kb_free(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static udev_input_mouse_t *udev_get_mouse(struct udev_input *udev, unsigned port)
|
||||
static udev_input_mouse_t *udev_get_mouse(
|
||||
struct udev_input *udev, unsigned port)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned mouse_index = 0;
|
||||
@ -654,13 +655,52 @@ end:
|
||||
#ifdef HAVE_X11
|
||||
static void udev_input_get_pointer_position(int *x, int *y)
|
||||
{
|
||||
Window w;
|
||||
int p;
|
||||
unsigned m;
|
||||
Display *display = (Display*)video_driver_display_get();
|
||||
Window window = (Window)video_driver_window_get();
|
||||
if (video_driver_display_type_get() == RARCH_DISPLAY_X11)
|
||||
{
|
||||
Window w;
|
||||
int p;
|
||||
unsigned m;
|
||||
Display *display = (Display*)video_driver_display_get();
|
||||
Window window = (Window)video_driver_window_get();
|
||||
|
||||
XQueryPointer(display, window, &w, &w, &p, &p, x, y, &m);
|
||||
XQueryPointer(display, window, &w, &w, &p, &p, x, y, &m);
|
||||
}
|
||||
}
|
||||
|
||||
static void udev_input_adopt_rel_pointer_position_from_mouse(
|
||||
int *x, int *y, udev_input_mouse_t *mouse)
|
||||
{
|
||||
static int noX11DispX = 0;
|
||||
static int noX11DispY = 0;
|
||||
|
||||
struct video_viewport view;
|
||||
bool r = video_driver_get_viewport_info(&view);
|
||||
int dx = udev_mouse_get_x(mouse);
|
||||
int dy = udev_mouse_get_y(mouse);
|
||||
if (r && (dx || dy) &&
|
||||
video_driver_display_type_get() != RARCH_DISPLAY_X11)
|
||||
{
|
||||
int minX = view.x;
|
||||
int maxX = view.x + view.width;
|
||||
int minY = view.y;
|
||||
int maxY = view.y + view.height;
|
||||
|
||||
/* Not running in a window. */
|
||||
noX11DispX = noX11DispX + dx;
|
||||
if (noX11DispX < minX)
|
||||
noX11DispX = minX;
|
||||
if (noX11DispX > maxX)
|
||||
noX11DispX = maxX;
|
||||
noX11DispY = noX11DispY + dy;
|
||||
if (noX11DispY < minY)
|
||||
noX11DispY = minY;
|
||||
if (noX11DispY > maxY)
|
||||
noX11DispY = maxY;
|
||||
*x = noX11DispX;
|
||||
*y = noX11DispY;
|
||||
}
|
||||
mouse->x_rel = 0;
|
||||
mouse->y_rel = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -687,8 +727,7 @@ static void udev_input_poll(void *data)
|
||||
udev_input_t *udev = (udev_input_t*)data;
|
||||
|
||||
#ifdef HAVE_X11
|
||||
if (video_driver_display_type_get() == RARCH_DISPLAY_X11)
|
||||
udev_input_get_pointer_position(&udev->pointer_x, &udev->pointer_y);
|
||||
udev_input_get_pointer_position(&udev->pointer_x, &udev->pointer_y);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < udev->num_devices; ++i)
|
||||
@ -697,9 +736,13 @@ static void udev_input_poll(void *data)
|
||||
continue;
|
||||
|
||||
mouse = &udev->devices[i]->mouse;
|
||||
|
||||
#ifdef HAVE_X11
|
||||
udev_input_adopt_rel_pointer_position_from_mouse(
|
||||
&udev->pointer_x, &udev->pointer_y, mouse);
|
||||
#else
|
||||
mouse->x_rel = 0;
|
||||
mouse->y_rel = 0;
|
||||
#endif
|
||||
mouse->wu = false;
|
||||
mouse->wd = false;
|
||||
mouse->whu = false;
|
||||
@ -759,7 +802,6 @@ static bool udev_pointer_is_off_window(const udev_input_t *udev)
|
||||
udev->pointer_x >= view.x + view.width ||
|
||||
udev->pointer_y < view.y ||
|
||||
udev->pointer_y >= view.y + view.height;
|
||||
|
||||
return r;
|
||||
#else
|
||||
return false;
|
||||
|
@ -549,15 +549,14 @@ static void iohidmanager_hid_device_add_autodetect(unsigned idx,
|
||||
const char *device_name, const char *driver_name,
|
||||
uint16_t dev_vid, uint16_t dev_pid)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
device_name,
|
||||
NULL,
|
||||
driver_name,
|
||||
idx,
|
||||
dev_vid,
|
||||
dev_pid
|
||||
))
|
||||
input_config_set_device_name(idx, device_name);
|
||||
);
|
||||
|
||||
RARCH_LOG("Port %d: %s.\n", idx, device_name);
|
||||
}
|
||||
|
@ -148,15 +148,14 @@ static void libusb_hid_device_add_autodetect(unsigned idx,
|
||||
const char *device_name, const char *driver_name,
|
||||
uint16_t dev_vid, uint16_t dev_pid)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
device_name,
|
||||
NULL,
|
||||
driver_name,
|
||||
idx,
|
||||
dev_vid,
|
||||
dev_pid
|
||||
))
|
||||
input_config_set_device_name(idx, device_name);
|
||||
);
|
||||
}
|
||||
|
||||
static void libusb_get_description(struct libusb_device *device,
|
||||
|
@ -143,14 +143,13 @@ static void wiiusb_hid_device_add_autodetect(unsigned idx,
|
||||
const char *device_name, const char *driver_name,
|
||||
uint16_t dev_vid, uint16_t dev_pid)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
device_name,
|
||||
NULL,
|
||||
driver_name,
|
||||
idx,
|
||||
dev_vid,
|
||||
dev_pid))
|
||||
input_config_set_device_name(idx, device_name);
|
||||
dev_pid);
|
||||
}
|
||||
|
||||
static void wiiusb_get_description(usb_device_entry *device,
|
||||
|
@ -42,15 +42,14 @@ static const char *ctr_joypad_name(unsigned pad)
|
||||
|
||||
static void ctr_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
ctr_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
ctr_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, ctr_joypad_name(autoconf_pad));
|
||||
input_autoconfigure_connect(
|
||||
ctr_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
ctr_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static bool ctr_joypad_init(void *data)
|
||||
|
@ -376,14 +376,13 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
if (!is_xinput_pad)
|
||||
#endif
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
dinput_joypad_name(g_joypad_cnt),
|
||||
dinput_joypad_friendly_name(g_joypad_cnt),
|
||||
dinput_joypad.ident,
|
||||
g_joypad_cnt,
|
||||
dinput_joypad_vid(g_joypad_cnt),
|
||||
dinput_joypad_pid(g_joypad_cnt)))
|
||||
input_config_set_device_name(g_joypad_cnt, dinput_joypad_name(g_joypad_cnt));
|
||||
input_autoconfigure_connect(
|
||||
dinput_joypad_name(g_joypad_cnt),
|
||||
dinput_joypad_friendly_name(g_joypad_cnt),
|
||||
dinput_joypad.ident,
|
||||
g_joypad_cnt,
|
||||
dinput_joypad_vid(g_joypad_cnt),
|
||||
dinput_joypad_pid(g_joypad_cnt));
|
||||
}
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
|
@ -151,15 +151,14 @@ static const char *dos_joypad_name(unsigned pad)
|
||||
|
||||
static void dos_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
dos_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
dos_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, dos_joypad_name(autoconf_pad));
|
||||
);
|
||||
}
|
||||
|
||||
static bool dos_joypad_init(void *data)
|
||||
|
@ -142,17 +142,14 @@ static void handle_hotplug(unsigned port, uint32_t ptype)
|
||||
pad_type[port] = ptype;
|
||||
|
||||
if (ptype != WPAD_EXP_NOCONTROLLER)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
gx_joypad_name(port),
|
||||
NULL,
|
||||
gx_joypad.ident,
|
||||
port,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(port, gx_joypad_name(port));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
static bool gx_joypad_button(unsigned port, uint16_t key)
|
||||
|
@ -191,14 +191,13 @@ retry:
|
||||
linuxraw_pads[idx].fd = -1;
|
||||
*linuxraw_pads[idx].ident = '\0';
|
||||
|
||||
if (!input_autoconfigure_connect(
|
||||
NULL,
|
||||
NULL,
|
||||
linuxraw_joypad_name(idx),
|
||||
idx,
|
||||
0,
|
||||
0))
|
||||
input_config_set_device_name(idx, NULL);
|
||||
input_autoconfigure_connect(
|
||||
NULL,
|
||||
NULL,
|
||||
linuxraw_joypad_name(idx),
|
||||
idx,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
/* Sometimes, device will be created before
|
||||
@ -213,17 +212,13 @@ retry:
|
||||
|
||||
if ( !string_is_empty(linuxraw_pads[idx].ident)
|
||||
&& linuxraw_joypad_init_pad(path, &linuxraw_pads[idx]))
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
linuxraw_pads[idx].ident,
|
||||
NULL,
|
||||
linuxraw_joypad.ident,
|
||||
idx,
|
||||
0,
|
||||
0))
|
||||
input_config_set_device_name(idx,
|
||||
linuxraw_joypad_name(idx));
|
||||
}
|
||||
input_autoconfigure_connect(
|
||||
linuxraw_pads[idx].ident,
|
||||
NULL,
|
||||
linuxraw_joypad.ident,
|
||||
idx,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,14 +250,13 @@ static bool linuxraw_joypad_init(void *data)
|
||||
|
||||
snprintf(path, sizeof(path), "/dev/input/js%u", i);
|
||||
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
pad->ident,
|
||||
NULL,
|
||||
"linuxraw",
|
||||
i,
|
||||
0,
|
||||
0))
|
||||
input_config_set_device_name(i, pad->ident);
|
||||
0);
|
||||
|
||||
if (linuxraw_joypad_init_pad(path, pad))
|
||||
linuxraw_poll_pad(pad);
|
||||
|
@ -65,11 +65,14 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller)
|
||||
buttons = &mfi_buttons[slot];
|
||||
|
||||
/* retain the values from the paused controller handler and pass them through */
|
||||
if (@available(iOS 13, *)) {
|
||||
if (@available(iOS 13, *))
|
||||
{
|
||||
// The menu button can be pressed/unpressed like any other button in iOS 13
|
||||
// so no need to passthrough anything
|
||||
*buttons = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the paused controller handler for iOS versions below 13
|
||||
pause = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_START);
|
||||
select = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT);
|
||||
@ -103,7 +106,8 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller)
|
||||
#endif
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 || __TV_OS_VERSION_MAX_ALLOWED >= 130000
|
||||
if (@available(iOS 13, *)) {
|
||||
if (@available(iOS 13, *))
|
||||
{
|
||||
// Support "Options" button present in PS4 / XBox One controllers
|
||||
*buttons |= gp.buttonOptions.pressed ? (1 << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0;
|
||||
|
||||
@ -291,9 +295,7 @@ static void apple_gamecontroller_joypad_disconnect(GCController* controller)
|
||||
|
||||
static void mfi_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
if ( !input_autoconfigure_connect("mFi Controller", NULL, mfi_joypad.ident, autoconf_pad, 0, 0) ) {
|
||||
input_config_set_device(autoconf_pad, "mFi Controller");
|
||||
}
|
||||
input_autoconfigure_connect("mFi Controller", NULL, mfi_joypad.ident, autoconf_pad, 0, 0);
|
||||
}
|
||||
|
||||
bool apple_gamecontroller_joypad_init(void *data)
|
||||
|
@ -305,15 +305,14 @@ static bool parport_joypad_init(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
"Generic Parallel Port device",
|
||||
NULL,
|
||||
"parport",
|
||||
i,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(i, "Generic Parallel Port device");
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -44,9 +44,8 @@ static bool is_analog_enabled(struct padButtonStatus buttons)
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
if (buttons.ljoy_h || buttons.ljoy_v || buttons.rjoy_h || buttons.rjoy_v) {
|
||||
if (buttons.ljoy_h || buttons.ljoy_v || buttons.rjoy_h || buttons.rjoy_v)
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
@ -67,18 +66,16 @@ static bool ps2_joypad_init(void *data)
|
||||
|
||||
for (port = 0; port < PS2_MAX_PADS; port++)
|
||||
{
|
||||
bool auto_configure = input_autoconfigure_connect( ps2_joypad_name(port),
|
||||
NULL,
|
||||
ps2_joypad.ident,
|
||||
port,
|
||||
0,
|
||||
0);
|
||||
if (!auto_configure) {
|
||||
input_config_set_device_name(port, ps2_joypad_name(port));
|
||||
}
|
||||
input_autoconfigure_connect( ps2_joypad_name(port),
|
||||
NULL,
|
||||
ps2_joypad.ident,
|
||||
port,
|
||||
0,
|
||||
0);
|
||||
|
||||
/* Port 0 -> Connector 1, Port 1 -> Connector 2 */
|
||||
if((ret = padPortOpen(port, PS2_PAD_SLOT, padBuf[port])) == 0) {
|
||||
if((ret = padPortOpen(port, PS2_PAD_SLOT, padBuf[port])) == 0)
|
||||
{
|
||||
printf("padOpenPort failed: %d\n", ret);
|
||||
init = false;
|
||||
break;
|
||||
@ -151,11 +148,14 @@ static void ps2_joypad_poll(void)
|
||||
unsigned player;
|
||||
struct padButtonStatus buttons;
|
||||
|
||||
for (player = 0; player < PS2_MAX_PADS; player++) {
|
||||
for (player = 0; player < PS2_MAX_PADS; player++)
|
||||
{
|
||||
int state = padGetState(player, PS2_PAD_SLOT);
|
||||
if (state == PAD_STATE_STABLE) {
|
||||
if (state == PAD_STATE_STABLE)
|
||||
{
|
||||
int ret = padRead(player, PS2_PAD_SLOT, &buttons); /* port, slot, buttons */
|
||||
if (ret != 0) {
|
||||
if (ret != 0)
|
||||
{
|
||||
int32_t state_tmp = 0xffff ^ buttons.btns;
|
||||
pad_state[player] = 0;
|
||||
|
||||
@ -177,7 +177,8 @@ static void ps2_joypad_poll(void)
|
||||
pad_state[player] |= (state_tmp & PAD_L3) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L3) : 0;
|
||||
|
||||
/* Analog */
|
||||
if (is_analog_enabled(buttons)) {
|
||||
if (is_analog_enabled(buttons))
|
||||
{
|
||||
analog_state[player][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = convert_u8_to_s16(buttons.ljoy_h);
|
||||
analog_state[player][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = convert_u8_to_s16(buttons.ljoy_v);;
|
||||
analog_state[player][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = convert_u8_to_s16(buttons.rjoy_h);;
|
||||
@ -204,9 +205,8 @@ static bool ps2_joypad_rumble(unsigned pad,
|
||||
static void ps2_joypad_destroy(void)
|
||||
{
|
||||
unsigned port;
|
||||
for (port = 0; port < PS2_MAX_PADS; port++) {
|
||||
for (port = 0; port < PS2_MAX_PADS; port++)
|
||||
padPortClose(port, PS2_PAD_SLOT);
|
||||
}
|
||||
}
|
||||
|
||||
input_device_driver_t ps2_joypad = {
|
||||
|
@ -40,15 +40,14 @@ static const char *ps3_joypad_name(unsigned pad)
|
||||
|
||||
static void ps3_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
ps3_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
ps3_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, ps3_joypad_name(autoconf_pad));
|
||||
input_autoconfigure_connect(
|
||||
ps3_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
ps3_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static bool ps3_joypad_init(void *data)
|
||||
|
@ -96,7 +96,8 @@ static bool ps4_joypad_init(void *data)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
while(index < num_players){
|
||||
while (index < num_players)
|
||||
{
|
||||
ds_joypad_states[index].userId = userId;
|
||||
index++;
|
||||
}
|
||||
@ -105,22 +106,21 @@ static bool ps4_joypad_init(void *data)
|
||||
{
|
||||
ds_joypad_states[num_players].handle = scePadOpen(userId, 0, 0, NULL);
|
||||
RARCH_LOG("USER %x HANDLE %x\n", userId, ds_joypad_states[num_players].handle);
|
||||
if (ds_joypad_states[num_players].handle > 0){
|
||||
if (ds_joypad_states[num_players].handle > 0)
|
||||
{
|
||||
ds_joypad_states[num_players].connected = true;
|
||||
ds_joypad_states[num_players].userId = userId;
|
||||
RARCH_LOG("NEW PAD: num_players %x \n", num_players);
|
||||
|
||||
bool auto_configure = input_autoconfigure_connect( ps4_joypad_name(num_players),
|
||||
NULL,
|
||||
ps4_joypad.ident,
|
||||
num_players,
|
||||
0,
|
||||
0);
|
||||
if (!auto_configure) {
|
||||
input_config_set_device_name(num_players, ps4_joypad_name(num_players));
|
||||
}
|
||||
input_autoconfigure_connect(
|
||||
ps4_joypad_name(num_players),
|
||||
NULL,
|
||||
ps4_joypad.ident,
|
||||
num_players,
|
||||
0,
|
||||
0);
|
||||
num_players++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,8 +164,8 @@ static void ps4_joypad_poll(void)
|
||||
unsigned j, k;
|
||||
unsigned i = player;
|
||||
unsigned p = player;
|
||||
int ret = scePadReadState(ds_joypad_states[player].handle,&buttons);
|
||||
|
||||
int ret = scePadReadState(ds_joypad_states[player].handle,&buttons);
|
||||
if (ret == 0)
|
||||
{
|
||||
int32_t state_tmp = buttons.buttons;
|
||||
|
@ -101,17 +101,14 @@ static bool psp_joypad_init(void *data)
|
||||
#endif
|
||||
|
||||
for (i = 0; i < players_count; i++)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
psp_joypad_name(i),
|
||||
NULL,
|
||||
psp_joypad.ident,
|
||||
i,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(i, psp_joypad_name(i));
|
||||
}
|
||||
input_autoconfigure_connect(
|
||||
psp_joypad_name(i),
|
||||
NULL,
|
||||
psp_joypad.ident,
|
||||
i,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -211,17 +208,14 @@ static void psp_joypad_poll(void)
|
||||
|
||||
if (old_ctrl_info.port[player + 1] == SCE_CTRL_TYPE_UNPAIRED &&
|
||||
curr_ctrl_info.port[player + 1] != SCE_CTRL_TYPE_UNPAIRED)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
psp_joypad_name(player),
|
||||
NULL,
|
||||
psp_joypad.ident,
|
||||
player,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(player, psp_joypad_name(player));
|
||||
}
|
||||
input_autoconfigure_connect(
|
||||
psp_joypad_name(player),
|
||||
NULL,
|
||||
psp_joypad.ident,
|
||||
player,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
memcpy(&old_ctrl_info, &curr_ctrl_info, sizeof(SceCtrlPortInfo));
|
||||
}
|
||||
|
@ -30,36 +30,32 @@ static bool qnx_joypad_init(void *data)
|
||||
(void)data;
|
||||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_USERS; autoconf_pad++)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
qnx_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
qnx_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, qnx_joypad_name(autoconf_pad));
|
||||
}
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool qnx_joypad_button(unsigned port_num, uint16_t joykey)
|
||||
{
|
||||
qnx_input_t *qnx = (qnx_input_t*)input_driver_get_data();
|
||||
if (!qnx || port_num >= MAX_PADS)
|
||||
return 0;
|
||||
qnx_input_device_t* controller = NULL;
|
||||
qnx_input_t *qnx = (qnx_input_t*)input_driver_get_data();
|
||||
|
||||
qnx_input_device_t* controller = NULL;
|
||||
controller = (qnx_input_device_t*)&qnx->devices[port_num];
|
||||
if (!qnx || port_num >= MAX_PADS)
|
||||
return 0;
|
||||
|
||||
if(port_num < MAX_USERS && joykey <= 19)
|
||||
{
|
||||
return (controller->buttons & (1 << joykey)) != 0;
|
||||
}
|
||||
controller = (qnx_input_device_t*)&qnx->devices[port_num];
|
||||
|
||||
return false;
|
||||
if(port_num < MAX_USERS && joykey <= 19)
|
||||
return (controller->buttons & (1 << joykey)) != 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t qnx_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||
|
@ -48,22 +48,16 @@ static EM_BOOL rwebpad_gamepad_cb(int event_type,
|
||||
}
|
||||
|
||||
if (event_type == EMSCRIPTEN_EVENT_GAMEPADCONNECTED)
|
||||
{
|
||||
if(!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
gamepad_event->id, /* name */
|
||||
NULL, /* display name */
|
||||
rwebpad_joypad.ident, /* driver */
|
||||
gamepad_event->index, /* idx */
|
||||
vid, /* vid */
|
||||
pid)) /* pid */
|
||||
input_config_set_device_name(gamepad_event->index,
|
||||
gamepad_event->id);
|
||||
}
|
||||
pid); /* pid */
|
||||
else if (event_type == EMSCRIPTEN_EVENT_GAMEPADDISCONNECTED)
|
||||
{
|
||||
input_autoconfigure_disconnect(gamepad_event->index,
|
||||
rwebpad_joypad.ident);
|
||||
}
|
||||
|
||||
return EM_TRUE;
|
||||
}
|
||||
@ -105,22 +99,18 @@ static bool rwebpad_joypad_init(void *data)
|
||||
static const char *rwebpad_joypad_name(unsigned pad)
|
||||
{
|
||||
static EmscriptenGamepadEvent gamepad_state;
|
||||
EMSCRIPTEN_RESULT r;
|
||||
|
||||
r = emscripten_get_gamepad_status(pad, &gamepad_state);
|
||||
EMSCRIPTEN_RESULT r = emscripten_get_gamepad_status(pad, &gamepad_state);
|
||||
|
||||
if (r == EMSCRIPTEN_RESULT_SUCCESS)
|
||||
return gamepad_state.id;
|
||||
else
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
|
||||
static bool rwebpad_joypad_button(unsigned port_num, uint16_t joykey)
|
||||
{
|
||||
EmscriptenGamepadEvent gamepad_state;
|
||||
EMSCRIPTEN_RESULT r;
|
||||
|
||||
r = emscripten_get_gamepad_status(port_num, &gamepad_state);
|
||||
EMSCRIPTEN_RESULT r = emscripten_get_gamepad_status(
|
||||
port_num, &gamepad_state);
|
||||
|
||||
if (r == EMSCRIPTEN_RESULT_SUCCESS)
|
||||
if (joykey < gamepad_state.numButtons)
|
||||
@ -137,7 +127,7 @@ static void rwebpad_joypad_get_buttons(unsigned port_num, input_bits_t *state)
|
||||
|
||||
if (r == EMSCRIPTEN_RESULT_SUCCESS)
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < gamepad_state.numButtons; i++)
|
||||
{
|
||||
@ -188,9 +178,7 @@ static void rwebpad_joypad_poll(void)
|
||||
static bool rwebpad_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
EmscriptenGamepadEvent gamepad_state;
|
||||
EMSCRIPTEN_RESULT r;
|
||||
|
||||
r = emscripten_get_gamepad_status(pad, &gamepad_state);
|
||||
EMSCRIPTEN_RESULT r = emscripten_get_gamepad_status(pad, &gamepad_state);
|
||||
|
||||
if (r == EMSCRIPTEN_RESULT_SUCCESS)
|
||||
return gamepad_state.connected == EM_TRUE;
|
||||
|
@ -105,7 +105,7 @@ static void sdl_pad_connect(unsigned id)
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
SDL_JoystickGUID guid;
|
||||
uint16_t *guid_ptr;
|
||||
uint16_t *guid_ptr = NULL;
|
||||
|
||||
if (SDL_IsGameController(id))
|
||||
{
|
||||
@ -145,14 +145,13 @@ static void sdl_pad_connect(unsigned id)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
sdl_joypad_name(id),
|
||||
NULL,
|
||||
sdl_joypad.ident,
|
||||
id,
|
||||
vendor,
|
||||
product))
|
||||
input_config_set_device_name(id, sdl_joypad_name(id));
|
||||
product);
|
||||
|
||||
RARCH_LOG("[SDL]: Device #%u (%04x:%04x) connected: %s.\n", id, vendor,
|
||||
product, sdl_joypad_name(id));
|
||||
|
@ -49,14 +49,13 @@ static const char *switch_joypad_name(unsigned pad)
|
||||
|
||||
static void switch_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
if(!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
switch_joypad_name(autoconf_pad), /* name */
|
||||
NULL, /* display name */
|
||||
switch_joypad.ident, /* driver */
|
||||
autoconf_pad, /* idx */
|
||||
0, /* vid */
|
||||
0)) /* pid */
|
||||
input_config_set_device_name(autoconf_pad, switch_joypad_name(autoconf_pad));
|
||||
0); /* pid */
|
||||
}
|
||||
|
||||
static bool switch_joypad_init(void *data)
|
||||
@ -65,7 +64,8 @@ static bool switch_joypad_init(void *data)
|
||||
unsigned i;
|
||||
hidScanInput();
|
||||
|
||||
// Switch like stop behavior with muted band channels and frequencies set to default.
|
||||
/* Switch like stop behavior with muted band channels
|
||||
* and frequencies set to default. */
|
||||
vibration_stop.amp_low = 0.0f;
|
||||
vibration_stop.freq_low = 160.0f;
|
||||
vibration_stop.amp_high = 0.0f;
|
||||
@ -90,7 +90,7 @@ static bool switch_joypad_init(void *data)
|
||||
|
||||
static bool switch_joypad_button(unsigned port_num, uint16_t key)
|
||||
{
|
||||
if(port_num >= MAX_PADS)
|
||||
if (port_num >= MAX_PADS)
|
||||
return false;
|
||||
|
||||
#if 0
|
||||
@ -102,7 +102,7 @@ static bool switch_joypad_button(unsigned port_num, uint16_t key)
|
||||
|
||||
static void switch_joypad_get_buttons(unsigned port_num, input_bits_t *state)
|
||||
{
|
||||
if(port_num < MAX_PADS)
|
||||
if (port_num < MAX_PADS)
|
||||
{
|
||||
BITS_COPY16_PTR(state, pad_state[port_num]);
|
||||
}
|
||||
@ -114,22 +114,22 @@ static void switch_joypad_get_buttons(unsigned port_num, input_bits_t *state)
|
||||
|
||||
static int16_t switch_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||
{
|
||||
int val = 0;
|
||||
int axis = -1;
|
||||
int val = 0;
|
||||
int axis = -1;
|
||||
bool is_neg = false;
|
||||
bool is_pos = false;
|
||||
|
||||
if(joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
||||
{
|
||||
/* TODO/FIXME - implement */
|
||||
}
|
||||
#if 0
|
||||
/* TODO/FIXME - implement */
|
||||
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS) { }
|
||||
#endif
|
||||
|
||||
if(AXIS_NEG_GET(joyaxis) < 4)
|
||||
if (AXIS_NEG_GET(joyaxis) < 4)
|
||||
{
|
||||
axis = AXIS_NEG_GET(joyaxis);
|
||||
is_neg = true;
|
||||
}
|
||||
else if(AXIS_POS_GET(joyaxis) < 4)
|
||||
else if (AXIS_POS_GET(joyaxis) < 4)
|
||||
{
|
||||
axis = AXIS_POS_GET(joyaxis);
|
||||
is_pos = true;
|
||||
@ -151,9 +151,9 @@ static int16_t switch_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||
break;
|
||||
}
|
||||
|
||||
if(is_neg && val > 0)
|
||||
if (is_neg && val > 0)
|
||||
val = 0;
|
||||
else if(is_pos && val < 0)
|
||||
else if (is_pos && val < 0)
|
||||
val = 0;
|
||||
|
||||
return val;
|
||||
@ -170,8 +170,10 @@ static void switch_joypad_destroy(void)
|
||||
unsigned i;
|
||||
for (i = 0; i < MAX_PADS; i++)
|
||||
{
|
||||
memcpy(&vibration_values[i][0], &vibration_stop, sizeof(HidVibrationValue));
|
||||
memcpy(&vibration_values[i][1], &vibration_stop, sizeof(HidVibrationValue));
|
||||
memcpy(&vibration_values[i][0],
|
||||
&vibration_stop, sizeof(HidVibrationValue));
|
||||
memcpy(&vibration_values[i][1],
|
||||
&vibration_stop, sizeof(HidVibrationValue));
|
||||
hidSendVibrationValues(vibration_handles[i], vibration_values[i], 2);
|
||||
}
|
||||
hidSendVibrationValues(vibration_handleheld, vibration_values[0], 2);
|
||||
@ -181,7 +183,7 @@ static void switch_joypad_destroy(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
int lastMode = 0; // 0 = handheld, 1 = whatever
|
||||
int lastMode = 0; /* 0 = handheld, 1 = whatever */
|
||||
static void switch_joypad_poll(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -192,9 +194,11 @@ static void switch_joypad_poll(void)
|
||||
{
|
||||
if (lastMode != 1)
|
||||
{
|
||||
int i = 0;
|
||||
for(i = 0; i < MAX_USERS; i += 2){
|
||||
if(settings->uints.input_split_joycon[i]) // CONTROLLER_PLAYER_X, X == i++
|
||||
unsigned i = 0;
|
||||
for(i = 0; i < MAX_USERS; i += 2)
|
||||
{
|
||||
/* CONTROLLER_PLAYER_X, X == i++ */
|
||||
if (settings->uints.input_split_joycon[i])
|
||||
{
|
||||
hidSetNpadJoyAssignmentModeSingleByDefault(i);
|
||||
hidSetNpadJoyAssignmentModeSingleByDefault(i + 1);
|
||||
@ -209,8 +213,10 @@ static void switch_joypad_poll(void)
|
||||
if (lastMode != 0)
|
||||
{
|
||||
int i = 0;
|
||||
for(i = 0; i < MAX_USERS; i += 2){
|
||||
if(settings->uints.input_split_joycon[i]) // CONTROLLER_PLAYER_X, X == i++
|
||||
for(i = 0; i < MAX_USERS; i += 2)
|
||||
{
|
||||
/* CONTROLLER_PLAYER_X, X == i++ */
|
||||
if (settings->uints.input_split_joycon[i])
|
||||
{
|
||||
hidSetNpadJoyAssignmentModeDual(i);
|
||||
hidSetNpadJoyAssignmentModeDual(i + 1);
|
||||
@ -281,7 +287,7 @@ bool switch_joypad_set_rumble(unsigned pad,
|
||||
return false;
|
||||
|
||||
amp = (float)strength / 65535.0f;
|
||||
amp *= 0.5f; // Max strength is too strong
|
||||
amp *= 0.5f; /* Max strength is too strong */
|
||||
if (type == RETRO_RUMBLE_STRONG)
|
||||
{
|
||||
vibration_values[pad][0].amp_low = amp;
|
||||
|
@ -239,14 +239,13 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char
|
||||
|
||||
if (!string_is_empty(pad->ident))
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
pad->ident,
|
||||
NULL,
|
||||
udev_joypad.ident,
|
||||
p,
|
||||
pad->vid,
|
||||
pad->pid))
|
||||
input_config_set_device_name(p, pad->ident);
|
||||
pad->pid);
|
||||
|
||||
ret = 1;
|
||||
}
|
||||
|
@ -46,14 +46,13 @@ static const char *xdk_joypad_name(unsigned pad)
|
||||
|
||||
static void xdk_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
xdk_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
xdk_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0))
|
||||
input_config_set_device_name(autoconf_pad, xdk_joypad_name(autoconf_pad));
|
||||
0);
|
||||
}
|
||||
|
||||
static bool xdk_joypad_init(void *data)
|
||||
|
@ -342,14 +342,13 @@ static bool xinput_joypad_init(void *data)
|
||||
vid, pid, dinput_index, xinput_joypad_name(j), j);
|
||||
#endif
|
||||
|
||||
if (!input_autoconfigure_connect(
|
||||
input_autoconfigure_connect(
|
||||
xinput_joypad_name(j),
|
||||
NULL,
|
||||
xinput_joypad.ident,
|
||||
j,
|
||||
vid,
|
||||
pid))
|
||||
input_config_set_device_name(j, xinput_joypad_name(j));
|
||||
pid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,8 +170,7 @@ bool input_remapping_save_file(const char *path)
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
conf = config_file_new(NULL);
|
||||
if (!conf)
|
||||
if (!(conf = config_file_new_alloc()))
|
||||
{
|
||||
free(remap_file);
|
||||
return false;
|
||||
|
@ -3654,20 +3654,16 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WIDGETS_ENABLE,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADERS_ENABLE,
|
||||
"Video Shaders")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_WITHOUT_CORE_MATCH,
|
||||
"Scan without core match")
|
||||
"Scansione senza core principale")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_WITHOUT_CORE_MATCH,
|
||||
"When disabled, content is only added to playlists if you have a core installed that supports its extension. By enabling this, it will add to playlist regardless. This way, you can install the core you need later on after scanning.")
|
||||
"Se disabilitato, il contenuto viene aggiunto alle playlist solo se hai un core installato che supporta la sua estensione. Abilitando questo, verrà aggiunto alla playlist indipendentemente. In questo modo, è possibile installare il core di cui si ha bisogno in seguito dopo la scansione.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_XMB_ANIMATION_HORIZONTAL_HIGHLIGHT,
|
||||
"Animation Horizontal Icon Highlight")
|
||||
"Evidenziazione dell'icona orizzontale dell'animazione")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_XMB_ANIMATION_MOVE_UP_DOWN,
|
||||
"Animation Move Up/Down")
|
||||
"Sposta Animazione su/giù")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_XMB_ANIMATION_OPENING_MAIN_MENU,
|
||||
"Animation Main Menu Opens/Closes")
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_DISC_INFORMATION,
|
||||
"Disc Information"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_DISC_INFORMATION,
|
||||
"View information about inserted media discs."
|
||||
)
|
||||
"Menu principale Animazione Apri/Chiudi")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_DISC_INFORMATION,
|
||||
"Informazioni sul disco")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_DISC_INFORMATION,
|
||||
"Visualizza le informazioni sui dischi multimediali inseriti.")
|
||||
|
@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(ANDROID)
|
||||
#include <stropts.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <scsi/sg.h>
|
||||
#endif
|
||||
|
||||
@ -397,9 +397,9 @@ retry:
|
||||
{
|
||||
cdrom_print_sense_data(sense, sizeof(sense));
|
||||
|
||||
/* INQUIRY/TEST should never fail, don't retry. */
|
||||
/* INQUIRY/TEST/SENSE should never fail, don't retry. */
|
||||
/* READ ATIP seems to fail outright on some drives (BW-16D1HT) with pressed discs, skip retries. */
|
||||
if (cmd[0] != 0x0 && cmd[0] != 0x12 && !(cmd[0] == 0x43 && cmd[2] == 0x4))
|
||||
if (cmd[0] != 0x0 && cmd[0] != 0x12 && cmd[0] != 0x5A && !(cmd[0] == 0x43 && cmd[2] == 0x4))
|
||||
{
|
||||
unsigned char key = sense[2] & 0xF;
|
||||
|
||||
@ -838,7 +838,6 @@ static int cdrom_read_track_info(libretro_vfs_implementation_file *stream, unsig
|
||||
/* MMC Command: READ TRACK INFORMATION */
|
||||
unsigned char cdb[] = {0x52, 0x1, 0, 0, 0, 0, 0, 0x1, 0x80, 0};
|
||||
unsigned char buf[384] = {0};
|
||||
unsigned char mode = 0;
|
||||
unsigned lba = 0;
|
||||
unsigned track_size = 0;
|
||||
int rv;
|
||||
@ -869,7 +868,7 @@ static int cdrom_read_track_info(libretro_vfs_implementation_file *stream, unsig
|
||||
#ifdef CDROM_DEBUG
|
||||
printf("[CDROM] Track %d Info: ", track);
|
||||
printf("[CDROM] Copy: %d ", (buf[5] & 0x10) > 0);
|
||||
printf("[CDROM] Data Mode: %d ", mode);
|
||||
printf("[CDROM] Data Mode: %d ", toc->track[track - 1].mode);
|
||||
printf("[CDROM] LBA Start: %d (%d) ", lba, toc->track[track - 1].lba);
|
||||
printf("[CDROM] Track Size: %d\n", track_size);
|
||||
fflush(stdout);
|
||||
@ -1097,7 +1096,7 @@ int cdrom_read(libretro_vfs_implementation_file *stream, cdrom_group_timeouts_t
|
||||
double frames = (len + skip) / 2352.0;
|
||||
unsigned frame_end = cdrom_msf_to_lba(min, sec, frame) + ceil(frames);
|
||||
|
||||
if (timeouts->g1_timeout && frames > timeouts->g1_timeout)
|
||||
if (timeouts->g1_timeout && (frames / 75) > timeouts->g1_timeout)
|
||||
{
|
||||
printf("[CDROM] multi-frame read of %d seconds is longer than group 1 timeout of %d seconds\n", (int)frames, timeouts->g1_timeout);
|
||||
fflush(stdout);
|
||||
@ -1482,7 +1481,7 @@ bool cdrom_set_read_cache(const libretro_vfs_implementation_file *stream, bool e
|
||||
bool cdrom_get_timeouts(libretro_vfs_implementation_file *stream, cdrom_group_timeouts_t *timeouts)
|
||||
{
|
||||
/* MMC Command: MODE SENSE (10) */
|
||||
int rv, i;
|
||||
int rv;
|
||||
unsigned char cdb[] = {0x5A, 0, 0x1D, 0, 0, 0, 0, 0, 0x14, 0};
|
||||
unsigned char buf[20] = {0};
|
||||
unsigned short g1 = 0;
|
||||
@ -1507,20 +1506,24 @@ bool cdrom_get_timeouts(libretro_vfs_implementation_file *stream, cdrom_group_ti
|
||||
g3 = buf[18] << 8 | buf[19];
|
||||
|
||||
#ifdef CDROM_DEBUG
|
||||
printf("Mode sense data for timeout groups: ");
|
||||
|
||||
for (i = 0; i < (int)sizeof(buf); i++)
|
||||
{
|
||||
printf("%02X ", buf[i]);
|
||||
int i;
|
||||
|
||||
printf("Mode sense data for timeout groups: ");
|
||||
|
||||
for (i = 0; i < (int)sizeof(buf); i++)
|
||||
{
|
||||
printf("%02X ", buf[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("Group 1 Timeout: %d\n", g1);
|
||||
printf("Group 2 Timeout: %d\n", g2);
|
||||
printf("Group 3 Timeout: %d\n", g3);
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("Group 1 Timeout: %d\n", g1);
|
||||
printf("Group 2 Timeout: %d\n", g2);
|
||||
printf("Group 3 Timeout: %d\n", g3);
|
||||
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
timeouts->g1_timeout = g1;
|
||||
|
@ -36,9 +36,7 @@
|
||||
|
||||
void *fopen_utf8(const char * filename, const char * mode)
|
||||
{
|
||||
#if defined(_XBOX)
|
||||
return fopen(filename, mode);
|
||||
#elif defined(LEGACY_WIN32)
|
||||
#if defined(LEGACY_WIN32)
|
||||
FILE *ret = NULL;
|
||||
char * filename_local = utf8_to_local_string_alloc(filename);
|
||||
|
||||
|
@ -339,8 +339,8 @@ static bool parse_line(config_file_t *conf,
|
||||
comment++;
|
||||
if (strstr(comment, "include ") == comment)
|
||||
{
|
||||
char *line = comment + STRLEN_CONST("include ");
|
||||
char *path = extract_value(line, false);
|
||||
char *include_line = comment + STRLEN_CONST("include ");
|
||||
char *path = extract_value(include_line, false);
|
||||
|
||||
if (!path)
|
||||
return false;
|
||||
@ -396,17 +396,7 @@ static config_file_t *config_file_new_internal(
|
||||
const char *path, unsigned depth, config_file_cb_t *cb)
|
||||
{
|
||||
RFILE *file = NULL;
|
||||
struct config_file *conf = (struct config_file*)malloc(sizeof(*conf));
|
||||
if (!conf)
|
||||
return NULL;
|
||||
|
||||
conf->path = NULL;
|
||||
conf->entries = NULL;
|
||||
conf->tail = NULL;
|
||||
conf->last = NULL;
|
||||
conf->includes = NULL;
|
||||
conf->include_depth = 0;
|
||||
conf->guaranteed_no_duplicates = false ;
|
||||
struct config_file *conf = config_file_new_alloc();
|
||||
|
||||
if (!path || !*path)
|
||||
return conf;
|
||||
@ -510,10 +500,12 @@ void config_file_free(config_file_t *conf)
|
||||
while (inc_tmp)
|
||||
{
|
||||
struct config_include_list *hold = NULL;
|
||||
free(inc_tmp->path);
|
||||
if (inc_tmp->path)
|
||||
free(inc_tmp->path);
|
||||
hold = (struct config_include_list*)inc_tmp;
|
||||
inc_tmp = inc_tmp->next;
|
||||
free(hold);
|
||||
if (hold)
|
||||
free(hold);
|
||||
}
|
||||
|
||||
if (conf->path)
|
||||
@ -612,6 +604,23 @@ config_file_t *config_file_new(const char *path)
|
||||
return config_file_new_internal(path, 0, NULL);
|
||||
}
|
||||
|
||||
config_file_t *config_file_new_alloc(void)
|
||||
{
|
||||
struct config_file *conf = (struct config_file*)malloc(sizeof(*conf));
|
||||
if (!conf)
|
||||
return NULL;
|
||||
|
||||
conf->path = NULL;
|
||||
conf->entries = NULL;
|
||||
conf->tail = NULL;
|
||||
conf->last = NULL;
|
||||
conf->includes = NULL;
|
||||
conf->include_depth = 0;
|
||||
conf->guaranteed_no_duplicates = false ;
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
static struct config_entry_list *config_get_entry(
|
||||
const config_file_t *conf,
|
||||
const char *key, struct config_entry_list **prev)
|
||||
@ -841,7 +850,8 @@ void config_set_string(config_file_t *conf, const char *key, const char *val)
|
||||
|
||||
if (entry && !entry->readonly)
|
||||
{
|
||||
free(entry->value);
|
||||
if (entry->value)
|
||||
free(entry->value);
|
||||
entry->value = strdup(val);
|
||||
return;
|
||||
}
|
||||
@ -971,7 +981,6 @@ bool config_file_write(config_file_t *conf, const char *path, bool sort)
|
||||
{
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
void* buf = NULL;
|
||||
#ifdef ORBIS
|
||||
int fd = orbisOpen(path,O_RDWR|O_CREAT,0644);
|
||||
if (fd < 0)
|
||||
@ -979,6 +988,7 @@ bool config_file_write(config_file_t *conf, const char *path, bool sort)
|
||||
config_file_dump_orbis(conf,fd);
|
||||
orbisClose(fd);
|
||||
#else
|
||||
void* buf = NULL;
|
||||
FILE *file = (FILE*)fopen_utf8(path, "wb");
|
||||
if (!file)
|
||||
return false;
|
||||
@ -993,7 +1003,8 @@ bool config_file_write(config_file_t *conf, const char *path, bool sort)
|
||||
|
||||
if (file != stdout)
|
||||
fclose(file);
|
||||
free(buf);
|
||||
if (buf)
|
||||
free(buf);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -1197,10 +1197,23 @@ void fill_pathname_application_path(char *s, size_t len)
|
||||
CFURLRef bundle_url = CFBundleCopyBundleURL(bundle);
|
||||
CFStringRef bundle_path = CFURLCopyPath(bundle_url);
|
||||
CFStringGetCString(bundle_path, s, len, kCFStringEncodingUTF8);
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
// This needs to be done so that the path becomes /private/var/... and this
|
||||
// is used consistently throughout for the iOS bundle path
|
||||
char resolved_bundle_dir_buf[PATH_MAX_LENGTH] = {0};
|
||||
if (realpath(s, resolved_bundle_dir_buf))
|
||||
{
|
||||
strlcpy(s,resolved_bundle_dir_buf, len);
|
||||
strlcat(s,"/",len);
|
||||
}
|
||||
#endif
|
||||
|
||||
CFRelease(bundle_path);
|
||||
CFRelease(bundle_url);
|
||||
|
||||
#ifndef HAVE_COCOATOUCH
|
||||
// Not sure what this does but it breaks stuff for iOS so skipping
|
||||
retro_assert(strlcat(s, "nobin", len) < len);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#elif defined(__HAIKU__)
|
||||
|
@ -222,7 +222,7 @@ static uint8_t *rtga__tga_load(rtga__context *s,
|
||||
(void)tga_y_origin;
|
||||
|
||||
/* do a tiny bit of precessing */
|
||||
if ( tga_image_type >= 8 )
|
||||
if (tga_image_type >= 8)
|
||||
{
|
||||
tga_image_type -= 8;
|
||||
tga_is_RLE = 1;
|
||||
@ -243,28 +243,29 @@ static uint8_t *rtga__tga_load(rtga__context *s,
|
||||
return NULL; /* we don't report this as a bad TGA because we don't even know if it's TGA */
|
||||
|
||||
/* If paletted, then we will use the number of bits from the palette */
|
||||
if ( tga_indexed )
|
||||
if (tga_indexed)
|
||||
tga_comp = tga_palette_bits / 8;
|
||||
|
||||
/* TGA info */
|
||||
*x = tga_width;
|
||||
*y = tga_height;
|
||||
if (comp) *comp = tga_comp;
|
||||
if (comp)
|
||||
*comp = tga_comp;
|
||||
|
||||
tga_data = (unsigned char*)malloc( (size_t)tga_width * tga_height * tga_comp );
|
||||
tga_data = (unsigned char*)malloc((size_t)tga_width * tga_height * tga_comp);
|
||||
if (!tga_data)
|
||||
return NULL;
|
||||
|
||||
/* skip to the data's starting position (offset usually = 0) */
|
||||
rtga__skip(s, tga_offset );
|
||||
|
||||
if ( !tga_indexed && !tga_is_RLE)
|
||||
if (!tga_indexed && !tga_is_RLE)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < tga_height; ++i)
|
||||
{
|
||||
int y = tga_inverted ? tga_height -i - 1 : i;
|
||||
uint8_t *tga_row = tga_data + y*tga_width*tga_comp;
|
||||
int _y = tga_inverted ? (tga_height -i - 1) : i;
|
||||
uint8_t *tga_row = tga_data + _y * tga_width * tga_comp;
|
||||
rtga__getn(s, tga_row, tga_width * tga_comp);
|
||||
}
|
||||
}
|
||||
@ -278,12 +279,12 @@ static uint8_t *rtga__tga_load(rtga__context *s,
|
||||
unsigned char *tga_palette = NULL;
|
||||
|
||||
/* Do I need to load a palette? */
|
||||
if ( tga_indexed)
|
||||
if (tga_indexed)
|
||||
{
|
||||
/* any data to skip? (offset usually = 0) */
|
||||
rtga__skip(s, tga_palette_start );
|
||||
/* load the palette */
|
||||
tga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 );
|
||||
tga_palette = (unsigned char*)malloc(tga_palette_len * tga_palette_bits / 8);
|
||||
|
||||
if (!tga_palette)
|
||||
{
|
||||
@ -303,9 +304,9 @@ static uint8_t *rtga__tga_load(rtga__context *s,
|
||||
for (i=0; i < tga_width * tga_height; ++i)
|
||||
{
|
||||
/* if I'm in RLE mode, do I need to get a RLE rtga__pngchunk? */
|
||||
if ( tga_is_RLE )
|
||||
if (tga_is_RLE)
|
||||
{
|
||||
if ( RLE_count == 0 )
|
||||
if (RLE_count == 0)
|
||||
{
|
||||
/* yep, get the next byte as a RLE command */
|
||||
int RLE_cmd = rtga__get8(s);
|
||||
@ -313,21 +314,21 @@ static uint8_t *rtga__tga_load(rtga__context *s,
|
||||
RLE_repeating = RLE_cmd >> 7;
|
||||
read_next_pixel = 1;
|
||||
}
|
||||
else if ( !RLE_repeating )
|
||||
else if (!RLE_repeating)
|
||||
read_next_pixel = 1;
|
||||
}
|
||||
else
|
||||
read_next_pixel = 1;
|
||||
|
||||
/* OK, if I need to read a pixel, do it now */
|
||||
if ( read_next_pixel )
|
||||
if (read_next_pixel)
|
||||
{
|
||||
/* load however much data we did have */
|
||||
if ( tga_indexed )
|
||||
if (tga_indexed)
|
||||
{
|
||||
/* read in 1 byte, then perform the lookup */
|
||||
int pal_idx = rtga__get8(s);
|
||||
if ( pal_idx >= tga_palette_len ) /* invalid index */
|
||||
if (pal_idx >= tga_palette_len) /* invalid index */
|
||||
pal_idx = 0;
|
||||
pal_idx *= tga_bits_per_pixel / 8;
|
||||
for (j = 0; j*8 < tga_bits_per_pixel; ++j)
|
||||
@ -353,7 +354,7 @@ static uint8_t *rtga__tga_load(rtga__context *s,
|
||||
}
|
||||
|
||||
/* do I need to invert the image? */
|
||||
if ( tga_inverted )
|
||||
if (tga_inverted)
|
||||
{
|
||||
for (j = 0; j*2 < tga_height; ++j)
|
||||
{
|
||||
@ -372,8 +373,8 @@ static uint8_t *rtga__tga_load(rtga__context *s,
|
||||
}
|
||||
|
||||
/* Clear my palette, if I had one */
|
||||
if ( tga_palette != NULL )
|
||||
free( tga_palette );
|
||||
if (tga_palette)
|
||||
free(tga_palette);
|
||||
}
|
||||
|
||||
/* swap RGB */
|
||||
|
@ -86,6 +86,8 @@ typedef struct config_file_cb config_file_cb_t ;
|
||||
* NULL path will create an empty config file. */
|
||||
config_file_t *config_file_new(const char *path);
|
||||
|
||||
config_file_t *config_file_new_alloc(void);
|
||||
|
||||
/* Loads a config file. Returns NULL if file doesn't exist.
|
||||
* NULL path will create an empty config file.
|
||||
* Includes cb callbacks to run custom code during config file processing.*/
|
||||
|
@ -614,7 +614,7 @@ enum retro_mod
|
||||
* Afterward it may be called again for the core to communicate
|
||||
* updated options to the frontend, but the number of core
|
||||
* options must not change from the number in the initial call.
|
||||
*
|
||||
*
|
||||
* 'data' points to an array of retro_variable structs
|
||||
* terminated by a { NULL, NULL } element.
|
||||
* retro_variable::key should be namespaced to not collide
|
||||
@ -1106,6 +1106,148 @@ enum retro_mod
|
||||
* It will return a bitmask of all the digital buttons.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION 52
|
||||
/* unsigned * --
|
||||
* Unsigned value is the API version number of the core options
|
||||
* interface supported by the frontend. If callback return false,
|
||||
* API version is assumed to be 0.
|
||||
*
|
||||
* In legacy code, core options are set by passing an array of
|
||||
* retro_variable structs to RETRO_ENVIRONMENT_SET_VARIABLES.
|
||||
* This may be still be done regardless of the core options
|
||||
* interface version.
|
||||
*
|
||||
* If version is 1 however, core options may instead be set by
|
||||
* passing an array of retro_core_option_definition structs to
|
||||
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS, or a 2D array of
|
||||
* retro_core_option_definition structs to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL.
|
||||
* This allows the core to additionally set option sublabel information
|
||||
* and/or provide localisation support.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS 53
|
||||
/* const struct retro_core_option_definition ** --
|
||||
* Allows an implementation to signal the environment
|
||||
* which variables it might want to check for later using
|
||||
* GET_VARIABLE.
|
||||
* This allows the frontend to present these variables to
|
||||
* a user dynamically.
|
||||
* This should only be called if RETRO_ENVIRONMENT_GET_ENHANCED_CORE_OPTIONS
|
||||
* returns an API version of 1.
|
||||
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
|
||||
* This should be called the first time as early as
|
||||
* possible (ideally in retro_set_environment).
|
||||
* Afterwards it may be called again for the core to communicate
|
||||
* updated options to the frontend, but the number of core
|
||||
* options must not change from the number in the initial call.
|
||||
*
|
||||
* 'data' points to an array of retro_core_option_definition structs
|
||||
* terminated by a { NULL, NULL, NULL, {{0}}, NULL } element.
|
||||
* retro_core_option_definition::key should be namespaced to not collide
|
||||
* with other implementations' keys. e.g. A core called
|
||||
* 'foo' should use keys named as 'foo_option'.
|
||||
* retro_core_option_definition::desc should contain a human readable
|
||||
* description of the key.
|
||||
* retro_core_option_definition::info should contain any additional human
|
||||
* readable information text that a typical user may need to
|
||||
* understand the functionality of the option.
|
||||
* retro_core_option_definition::values is an array of retro_core_option_value
|
||||
* structs terminated by a { NULL, NULL } element.
|
||||
* > retro_core_option_definition::values[index].value is an expected option
|
||||
* value.
|
||||
* > retro_core_option_definition::values[index].label is a human readable
|
||||
* label used when displaying the value on screen. If NULL,
|
||||
* the value itself is used.
|
||||
* retro_core_option_definition::default_value is the default core option
|
||||
* setting. It must match one of the expected option values in the
|
||||
* retro_core_option_definition::values array. If it does not, or the
|
||||
* default value is NULL, the first entry in the
|
||||
* retro_core_option_definition::values array is treated as the default.
|
||||
*
|
||||
* The number of possible options should be very limited,
|
||||
* and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX.
|
||||
* i.e. it should be feasible to cycle through options
|
||||
* without a keyboard.
|
||||
*
|
||||
* First entry should be treated as a default.
|
||||
*
|
||||
* Example entry:
|
||||
* {
|
||||
* "foo_option",
|
||||
* "Speed hack coprocessor X",
|
||||
* "Provides increased performance at the expense of reduced accuracy",
|
||||
* {
|
||||
* { "false", NULL },
|
||||
* { "true", NULL },
|
||||
* { "unstable", "Turbo (Unstable)" },
|
||||
* { NULL, NULL },
|
||||
* },
|
||||
* "false"
|
||||
* }
|
||||
*
|
||||
* Only strings are operated on. The possible values will
|
||||
* generally be displayed and stored as-is by the frontend.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL 54
|
||||
/* const struct retro_core_options_intl * --
|
||||
* Allows an implementation to signal the environment
|
||||
* which variables it might want to check for later using
|
||||
* GET_VARIABLE.
|
||||
* This allows the frontend to present these variables to
|
||||
* a user dynamically.
|
||||
* This should only be called if RETRO_ENVIRONMENT_GET_ENHANCED_CORE_OPTIONS
|
||||
* returns an API version of 1.
|
||||
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
|
||||
* This should be called the first time as early as
|
||||
* possible (ideally in retro_set_environment).
|
||||
* Afterwards it may be called again for the core to communicate
|
||||
* updated options to the frontend, but the number of core
|
||||
* options must not change from the number in the initial call.
|
||||
*
|
||||
* This is fundamentally the same as RETRO_ENVIRONMENT_SET_CORE_OPTIONS,
|
||||
* with the addition of localisation support. The description of the
|
||||
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS callback should be consulted
|
||||
* for further details.
|
||||
*
|
||||
* 'data' points to a retro_core_options_intl struct.
|
||||
*
|
||||
* retro_core_options_intl::us is a pointer to an array of
|
||||
* retro_core_option_definition structs defining the US English
|
||||
* core options implementation. It must point to a valid array.
|
||||
*
|
||||
* retro_core_options_intl::local is a pointer to an array of
|
||||
* retro_core_option_definition structs defining core options for
|
||||
* the current frontend language. It may be NULL (in which case
|
||||
* retro_core_options_intl::us is used by the frontend). Any items
|
||||
* missing from this array will be read from retro_core_options_intl::us
|
||||
* instead.
|
||||
*
|
||||
* NOTE: Default core option values are always taken from the
|
||||
* retro_core_options_intl::us array. Any default values in
|
||||
* retro_core_options_intl::local array will be ignored.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY 55
|
||||
/* struct retro_core_option_display * --
|
||||
*
|
||||
* Allows an implementation to signal the environment to show
|
||||
* or hide a variable when displaying core options. This is
|
||||
* considered a *suggestion*. The frontend is free to ignore
|
||||
* this callback, and its implementation not considered mandatory.
|
||||
*
|
||||
* 'data' points to a retro_core_option_display struct
|
||||
*
|
||||
* retro_core_option_display::key is a variable identifier
|
||||
* which has already been set by SET_VARIABLES/SET_CORE_OPTIONS.
|
||||
*
|
||||
* retro_core_option_display::visible is a boolean, specifying
|
||||
* whether variable should be displayed
|
||||
*
|
||||
* Note that all core option variables will be set visible by
|
||||
* default when calling SET_VARIABLES/SET_CORE_OPTIONS.
|
||||
*/
|
||||
|
||||
/* VFS functionality */
|
||||
|
||||
/* File paths:
|
||||
@ -2351,6 +2493,64 @@ struct retro_variable
|
||||
const char *value;
|
||||
};
|
||||
|
||||
struct retro_core_option_display
|
||||
{
|
||||
/* Variable to configure in RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY */
|
||||
const char *key;
|
||||
|
||||
/* Specifies whether variable should be displayed
|
||||
* when presenting core options to the user */
|
||||
bool visible;
|
||||
};
|
||||
|
||||
/* Maximum number of values permitted for a core option
|
||||
* NOTE: This may be increased on a core-by-core basis
|
||||
* if required (doing so has no effect on the frontend) */
|
||||
#define RETRO_NUM_CORE_OPTION_VALUES_MAX 128
|
||||
|
||||
struct retro_core_option_value
|
||||
{
|
||||
/* Expected option value */
|
||||
const char *value;
|
||||
|
||||
/* Human-readable value label. If NULL, value itself
|
||||
* will be displayed by the frontend */
|
||||
const char *label;
|
||||
};
|
||||
|
||||
struct retro_core_option_definition
|
||||
{
|
||||
/* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. */
|
||||
const char *key;
|
||||
|
||||
/* Human-readable core option description (used as menu label) */
|
||||
const char *desc;
|
||||
|
||||
/* Human-readable core option information (used as menu sublabel) */
|
||||
const char *info;
|
||||
|
||||
/* Array of retro_core_option_value structs, terminated by NULL */
|
||||
struct retro_core_option_value values[RETRO_NUM_CORE_OPTION_VALUES_MAX];
|
||||
|
||||
/* Default core option value. Must match one of the values
|
||||
* in the retro_core_option_value array, otherwise will be
|
||||
* ignored */
|
||||
const char *default_value;
|
||||
};
|
||||
|
||||
struct retro_core_options_intl
|
||||
{
|
||||
/* Pointer to an array of retro_core_option_definition structs
|
||||
* - US English implementation
|
||||
* - Must point to a valid array */
|
||||
struct retro_core_option_definition *us;
|
||||
|
||||
/* Pointer to an array of retro_core_option_definition structs
|
||||
* - Implementation for current frontend language
|
||||
* - May be NULL */
|
||||
struct retro_core_option_definition *local;
|
||||
};
|
||||
|
||||
struct retro_game_info
|
||||
{
|
||||
const char *path; /* Path to game, UTF-8 encoded.
|
||||
|
56
libretro-common/include/media/media_detect_cd.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* Copyright (C) 2010-2019 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (media_detect_cd.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_SDK_MEDIA_DETECT_CD_H
|
||||
#define __LIBRETRO_SDK_MEDIA_DETECT_CD_H
|
||||
|
||||
#include <retro_common_api.h>
|
||||
#include <boolean.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
enum media_detect_cd_system
|
||||
{
|
||||
MEDIA_CD_SYSTEM_MEGA_CD,
|
||||
MEDIA_CD_SYSTEM_SATURN,
|
||||
MEDIA_CD_SYSTEM_DREAMCAST,
|
||||
MEDIA_CD_SYSTEM_PSX,
|
||||
MEDIA_CD_SYSTEM_3DO
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char title[256];
|
||||
char system[128];
|
||||
char region[128];
|
||||
char serial[64];
|
||||
char maker[64];
|
||||
char version[32];
|
||||
char release_date[32];
|
||||
enum media_detect_cd_system system_id;
|
||||
} media_detect_cd_info_t;
|
||||
|
||||
bool media_detect_cd_info(const char *path, media_detect_cd_info_t *info);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
@ -131,6 +131,15 @@ void slock_free(slock_t *lock);
|
||||
**/
|
||||
void slock_lock(slock_t *lock);
|
||||
|
||||
/**
|
||||
* slock_try_lock:
|
||||
* @lock : pointer to mutex object
|
||||
*
|
||||
* Attempts to lock a mutex. If a mutex is already locked by
|
||||
* another thread, return false. If the lock is acquired, return true.
|
||||
**/
|
||||
bool slock_try_lock(slock_t *lock);
|
||||
|
||||
/**
|
||||
* slock_unlock:
|
||||
* @lock : pointer to mutex object
|
||||
|
276
libretro-common/media/media_detect_cd.c
Normal file
@ -0,0 +1,276 @@
|
||||
/* Copyright (C) 2010-2019 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (media_detect_cd.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <media/media_detect_cd.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
static void media_zero_trailing_spaces(char *buf, size_t len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = len - 1; i >= 0; i--)
|
||||
{
|
||||
if (buf[i] == ' ')
|
||||
buf[i] = '\0';
|
||||
else if (buf[i] != '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool media_skip_spaces(const char **buf, size_t len)
|
||||
{
|
||||
bool found = false;
|
||||
int i;
|
||||
|
||||
if (!buf || !*buf)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if ((*buf)[i] == ' ')
|
||||
continue;
|
||||
|
||||
*buf += i;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool media_detect_cd_info(const char *path, media_detect_cd_info_t *info)
|
||||
{
|
||||
RFILE *file;
|
||||
|
||||
if (string_is_empty(path) || !info)
|
||||
return false;
|
||||
|
||||
file = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, 0);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
printf("[MEDIA] Could not open path for reading: %s\n", path);
|
||||
fflush(stdout);
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
unsigned offset = 0;
|
||||
unsigned sector_size = 0;
|
||||
unsigned buf_size = 17 * 2352;
|
||||
char *buf = (char*)calloc(1, buf_size);
|
||||
int64_t read_bytes = 0;
|
||||
|
||||
if (!buf)
|
||||
return false;
|
||||
|
||||
read_bytes = filestream_read(file, buf, buf_size);
|
||||
|
||||
if (read_bytes != buf_size)
|
||||
{
|
||||
printf("[MEDIA] Could not read from media.\n");
|
||||
fflush(stdout);
|
||||
filestream_close(file);
|
||||
free(buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 12-byte sync field at the start of every sector, common to both mode1 and mode2 data tracks
|
||||
* (when at least sync data is requested). This is a CD-ROM standard feature and not specific to any game devices,
|
||||
* and as such should not be part of any system-specific detection or "magic" bytes.
|
||||
* Depending on what parts of a sector were requested from the disc, the user data might start at
|
||||
* byte offset 0, 4, 8, 12, 16 or 24. Cue sheets only specify the total number of bytes requested from the sectors
|
||||
* of a track (like 2048 or 2352) and it is then assumed based on the size/mode as to what fields are present. */
|
||||
if (!memcmp(buf, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00", 12))
|
||||
{
|
||||
/* Assume track data contains all fields. */
|
||||
sector_size = 2352;
|
||||
|
||||
if (buf[15] == 2)
|
||||
{
|
||||
/* assume Mode 2 formed (formless is rarely used) */
|
||||
offset = 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* assume Mode 1 */
|
||||
offset = 16;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Assume sectors only contain user data instead. */
|
||||
offset = 0;
|
||||
sector_size = 2048;
|
||||
}
|
||||
|
||||
if (!memcmp(buf + offset, "SEGADISCSYSTEM", strlen("SEGADISCSYSTEM")))
|
||||
{
|
||||
const char *title_pos;
|
||||
const char *serial_pos;
|
||||
bool title_found = false;
|
||||
|
||||
/* All discs currently in Redump for MCD start with SEGADISCSYSTEM. There are other strings mentioned elsewhere online,
|
||||
* but I have not seen any real examples of them. */
|
||||
info->system_id = MEDIA_CD_SYSTEM_MEGA_CD;
|
||||
|
||||
strlcpy(info->system, "Sega CD / Mega CD", sizeof(info->system));
|
||||
|
||||
title_pos = buf + offset + 0x150;
|
||||
|
||||
if (media_skip_spaces(&title_pos, 48))
|
||||
{
|
||||
memcpy(info->title, title_pos, 48 - (title_pos - (buf + offset + 0x150)));
|
||||
media_zero_trailing_spaces(info->title, sizeof(info->title));
|
||||
}
|
||||
else
|
||||
strlcpy(info->title, "N/A", sizeof(info->title));
|
||||
|
||||
serial_pos = buf + offset + 0x183;
|
||||
|
||||
if (media_skip_spaces(&serial_pos, 8))
|
||||
memcpy(info->serial, serial_pos, 8 - (serial_pos - (buf + offset + 0x183)));
|
||||
else
|
||||
strlcpy(info->serial, "N/A", sizeof(info->title));
|
||||
}
|
||||
else if (!memcmp(buf + offset, "SEGA SEGASATURN", strlen("SEGA SEGASATURN")))
|
||||
{
|
||||
const char *title_pos;
|
||||
const char *serial_pos;
|
||||
const char *version_pos;
|
||||
const char *release_date_pos;
|
||||
bool title_found = false;
|
||||
|
||||
info->system_id = MEDIA_CD_SYSTEM_SATURN;
|
||||
|
||||
strlcpy(info->system, "Sega Saturn", sizeof(info->system));
|
||||
|
||||
title_pos = buf + offset + 0x60;
|
||||
|
||||
if (media_skip_spaces(&title_pos, 112))
|
||||
{
|
||||
memcpy(info->title, title_pos, 112 - (title_pos - (buf + offset + 0x60)));
|
||||
media_zero_trailing_spaces(info->title, sizeof(info->title));
|
||||
}
|
||||
else
|
||||
strlcpy(info->title, "N/A", sizeof(info->title));
|
||||
|
||||
serial_pos = buf + offset + 0x20;
|
||||
|
||||
if (media_skip_spaces(&serial_pos, 10))
|
||||
memcpy(info->serial, serial_pos, 10 - (serial_pos - (buf + offset + 0x20)));
|
||||
else
|
||||
strlcpy(info->serial, "N/A", sizeof(info->title));
|
||||
|
||||
version_pos = buf + offset + 0x2a;
|
||||
|
||||
if (media_skip_spaces(&version_pos, 6))
|
||||
memcpy(info->version, version_pos, 6 - (version_pos - (buf + offset + 0x2a)));
|
||||
else
|
||||
strlcpy(info->version, "N/A", sizeof(info->title));
|
||||
|
||||
release_date_pos = buf + offset + 0x30;
|
||||
|
||||
if (media_skip_spaces(&release_date_pos, 8))
|
||||
memcpy(info->release_date, release_date_pos, 8 - (release_date_pos - (buf + offset + 0x30)));
|
||||
else
|
||||
strlcpy(info->release_date, "N/A", sizeof(info->title));
|
||||
}
|
||||
else if (!memcmp(buf + offset, "SEGA SEGAKATANA", strlen("SEGA SEGAKATANA")))
|
||||
{
|
||||
const char *title_pos;
|
||||
const char *serial_pos;
|
||||
const char *version_pos;
|
||||
const char *release_date_pos;
|
||||
bool title_found = false;
|
||||
|
||||
info->system_id = MEDIA_CD_SYSTEM_DREAMCAST;
|
||||
|
||||
strlcpy(info->system, "Sega Dreamcast", sizeof(info->system));
|
||||
|
||||
title_pos = buf + offset + 0x80;
|
||||
|
||||
if (media_skip_spaces(&title_pos, 96))
|
||||
{
|
||||
memcpy(info->title, title_pos, 96 - (title_pos - (buf + offset + 0x80)));
|
||||
media_zero_trailing_spaces(info->title, sizeof(info->title));
|
||||
}
|
||||
else
|
||||
strlcpy(info->title, "N/A", sizeof(info->title));
|
||||
|
||||
serial_pos = buf + offset + 0x40;
|
||||
|
||||
if (media_skip_spaces(&serial_pos, 10))
|
||||
memcpy(info->serial, serial_pos, 10 - (serial_pos - (buf + offset + 0x40)));
|
||||
else
|
||||
strlcpy(info->serial, "N/A", sizeof(info->title));
|
||||
|
||||
version_pos = buf + offset + 0x4a;
|
||||
|
||||
if (media_skip_spaces(&version_pos, 6))
|
||||
memcpy(info->version, version_pos, 6 - (version_pos - (buf + offset + 0x4a)));
|
||||
else
|
||||
strlcpy(info->version, "N/A", sizeof(info->title));
|
||||
|
||||
release_date_pos = buf + offset + 0x50;
|
||||
|
||||
if (media_skip_spaces(&release_date_pos, 8))
|
||||
memcpy(info->release_date, release_date_pos, 8 - (release_date_pos - (buf + offset + 0x50)));
|
||||
else
|
||||
strlcpy(info->release_date, "N/A", sizeof(info->title));
|
||||
}
|
||||
/* Primary Volume Descriptor fields of ISO9660 */
|
||||
else if (!memcmp(buf + offset + (16 * sector_size), "\1CD001\1\0PLAYSTATION", 19))
|
||||
{
|
||||
const char *title_pos;
|
||||
const char *serial_pos;
|
||||
bool title_found = false;
|
||||
|
||||
info->system_id = MEDIA_CD_SYSTEM_PSX;
|
||||
|
||||
strlcpy(info->system, "Sony PlayStation", sizeof(info->system));
|
||||
|
||||
title_pos = buf + offset + (16 * sector_size) + 40;
|
||||
|
||||
if (media_skip_spaces(&title_pos, 32))
|
||||
memcpy(info->title, title_pos, 32 - (title_pos - (buf + offset + (16 * sector_size) + 40)));
|
||||
else
|
||||
strlcpy(info->title, "N/A", sizeof(info->title));
|
||||
}
|
||||
else if (!memcmp(buf + offset, "\x01\x5a\x5a\x5a\x5a\x5a\x01\x00\x00\x00\x00\x00", 12))
|
||||
{
|
||||
info->system_id = MEDIA_CD_SYSTEM_3DO;
|
||||
|
||||
strlcpy(info->system, "3DO", sizeof(info->system));
|
||||
}
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
filestream_close(file);
|
||||
|
||||
return true;
|
||||
}
|
@ -385,6 +385,24 @@ void slock_lock(slock_t *lock)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* slock_try_lock:
|
||||
* @lock : pointer to mutex object
|
||||
*
|
||||
* Attempts to lock a mutex. If a mutex is already locked by
|
||||
* another thread, return false. If the lock is acquired, return true.
|
||||
**/
|
||||
bool slock_try_lock(slock_t *lock)
|
||||
{
|
||||
if (!lock)
|
||||
return false;
|
||||
#ifdef USE_WIN32_THREADS
|
||||
return TryEnterCriticalSection(&lock->lock);
|
||||
#else
|
||||
return pthread_mutex_trylock(&lock->lock)==0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* slock_unlock:
|
||||
* @lock : pointer to mutex object
|
||||
|
@ -204,9 +204,9 @@ int filestream_getc(RFILE *stream)
|
||||
{
|
||||
char c = 0;
|
||||
if (!stream)
|
||||
return 0;
|
||||
if(filestream_read(stream, &c, 1) == 1)
|
||||
return (int)c;
|
||||
return EOF;
|
||||
if (filestream_read(stream, &c, 1) == 1)
|
||||
return (int)(unsigned char)c;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
@ -427,7 +427,7 @@ int filestream_putc(RFILE *stream, int c)
|
||||
char c_char = (char)c;
|
||||
if (!stream)
|
||||
return EOF;
|
||||
return filestream_write(stream, &c_char, 1)==1 ? c : EOF;
|
||||
return filestream_write(stream, &c_char, 1)==1 ? (int)(unsigned char)c : EOF;
|
||||
}
|
||||
|
||||
int filestream_vprintf(RFILE *stream, const char* format, va_list args)
|
||||
|
@ -99,7 +99,7 @@ int64_t rfseek(RFILE* stream, int64_t offset, int origin)
|
||||
int64_t rfread(void* buffer,
|
||||
size_t elem_size, size_t elem_count, RFILE* stream)
|
||||
{
|
||||
return filestream_read(stream, buffer, elem_size * elem_count);
|
||||
return (filestream_read(stream, buffer, elem_size * elem_count) / elem_size);
|
||||
}
|
||||
|
||||
char *rfgets(char *buffer, int maxCount, RFILE* stream)
|
||||
|
@ -198,29 +198,32 @@ int64_t retro_vfs_file_seek_internal(libretro_vfs_implementation_file *stream, i
|
||||
|
||||
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
||||
{
|
||||
#ifdef HAVE_CDROM
|
||||
if (stream->scheme == VFS_SCHEME_CDROM)
|
||||
return retro_vfs_file_seek_cdrom(stream, offset, whence);
|
||||
#endif
|
||||
/* VC2005 and up have a special 64-bit fseek */
|
||||
#ifdef ATLEAST_VC2005
|
||||
return _fseeki64(stream->fp, offset, whence);
|
||||
#elif defined(__CELLOS_LV2__) || defined(_MSC_VER) && _MSC_VER <= 1310
|
||||
return fseek(stream->fp, (long)offset, whence);
|
||||
#elif defined(PS2)
|
||||
int64_t ret = fileXioLseek(fileno(stream->fp), (off_t)offset, whence);
|
||||
/* fileXioLseek could return positive numbers */
|
||||
if (ret > 0)
|
||||
return 0;
|
||||
return ret;
|
||||
{
|
||||
int64_t ret = fileXioLseek(fileno(stream->fp), (off_t)offset, whence);
|
||||
/* fileXioLseek could return positive numbers */
|
||||
if (ret > 0)
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
#elif defined(ORBIS)
|
||||
int ret = orbisLseek(stream->fd, offset, whence);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
{
|
||||
int ret = orbisLseek(stream->fd, offset, whence);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#ifdef HAVE_CDROM
|
||||
if (stream->scheme == VFS_SCHEME_CDROM)
|
||||
return retro_vfs_file_seek_cdrom(stream, offset, whence);
|
||||
else
|
||||
#endif
|
||||
return fseeko(stream->fp, (off_t)offset, whence);
|
||||
return fseeko(stream->fp, (off_t)offset, whence);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_MMAP
|
||||
@ -571,15 +574,16 @@ end:
|
||||
|
||||
int retro_vfs_file_error_impl(libretro_vfs_implementation_file *stream)
|
||||
{
|
||||
#ifdef ORBIS
|
||||
/* TODO/FIXME - implement this? */
|
||||
return 0;
|
||||
#endif
|
||||
#ifdef HAVE_CDROM
|
||||
if (stream->scheme == VFS_SCHEME_CDROM)
|
||||
return retro_vfs_file_error_cdrom(stream);
|
||||
#endif
|
||||
#ifdef ORBIS
|
||||
/* TODO/FIXME - implement this? */
|
||||
return 0;
|
||||
#else
|
||||
return ferror(stream->fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t retro_vfs_file_size_impl(libretro_vfs_implementation_file *stream)
|
||||
@ -617,16 +621,18 @@ int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream)
|
||||
return retro_vfs_file_tell_cdrom(stream);
|
||||
#endif
|
||||
#ifdef ORBIS
|
||||
int64_t ret = orbisLseek(stream->fd, 0, SEEK_CUR);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return ret;
|
||||
{
|
||||
int64_t ret = orbisLseek(stream->fd, 0, SEEK_CUR);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
/* VC2005 and up have a special 64-bit ftell */
|
||||
/* VC2005 and up have a special 64-bit ftell */
|
||||
#ifdef ATLEAST_VC2005
|
||||
return _ftelli64(stream->fp);
|
||||
#else
|
||||
return ftell(stream->fp);
|
||||
return ftell(stream->fp);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -670,17 +676,16 @@ int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream,
|
||||
|
||||
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
||||
{
|
||||
#ifdef HAVE_CDROM
|
||||
if (stream->scheme == VFS_SCHEME_CDROM)
|
||||
return retro_vfs_file_read_cdrom(stream, s, len);
|
||||
#endif
|
||||
#ifdef ORBIS
|
||||
if (orbisRead(stream->fd, s, (size_t)len) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
#else
|
||||
#ifdef HAVE_CDROM
|
||||
if (stream->scheme == VFS_SCHEME_CDROM)
|
||||
return retro_vfs_file_read_cdrom(stream, s, len);
|
||||
else
|
||||
#endif
|
||||
return fread(s, 1, (size_t)len, stream->fp);
|
||||
return fread(s, 1, (size_t)len, stream->fp);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_MMAP
|
||||
|
@ -168,10 +168,8 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw
|
||||
conf = config_file_new(cheats_file);
|
||||
|
||||
if (!conf)
|
||||
conf = config_file_new(NULL);
|
||||
|
||||
if (!conf)
|
||||
return false;
|
||||
if (!(conf = config_file_new_alloc()))
|
||||
return false;
|
||||
|
||||
conf->guaranteed_no_duplicates = true;
|
||||
|
||||
@ -303,11 +301,9 @@ static void cheat_manager_new(unsigned size)
|
||||
cheat_manager_state.cheats[i].repeat_add_to_value = 0;
|
||||
cheat_manager_state.cheats[i].repeat_add_to_address = 1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void cheat_manager_load_cb_first_pass(char *key, char *value)
|
||||
static void cheat_manager_load_cb_first_pass(char *key, char *value)
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
@ -320,7 +316,7 @@ void cheat_manager_load_cb_first_pass(char *key, char *value)
|
||||
}
|
||||
}
|
||||
|
||||
void cheat_manager_load_cb_second_pass(char *key, char *value)
|
||||
static void cheat_manager_load_cb_second_pass(char *key, char *value)
|
||||
{
|
||||
char cheat_num_str[20];
|
||||
unsigned cheat_num;
|
||||
@ -391,7 +387,6 @@ void cheat_manager_load_cb_second_pass(char *key, char *value)
|
||||
cheat_manager_state.cheats[cheat_idx].rumble_value = (unsigned)strtoul(value, NULL, 0);
|
||||
else if (string_is_equal(key, "value"))
|
||||
cheat_manager_state.cheats[cheat_idx].value = (unsigned)strtoul(value, NULL, 0);
|
||||
|
||||
}
|
||||
|
||||
bool cheat_manager_load(const char *path, bool append)
|
||||
@ -602,7 +597,6 @@ void cheat_manager_toggle_index(unsigned i)
|
||||
|
||||
void cheat_manager_toggle(void)
|
||||
{
|
||||
|
||||
if (!cheat_manager_state.cheats || cheat_manager_state.size == 0)
|
||||
return;
|
||||
|
||||
@ -1213,38 +1207,38 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu
|
||||
|
||||
switch (cheat->rumble_type)
|
||||
{
|
||||
case RUMBLE_TYPE_DISABLED:
|
||||
return;
|
||||
case RUMBLE_TYPE_CHANGES:
|
||||
rumble = (curr_value != cheat->rumble_prev_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_DOES_NOT_CHANGE:
|
||||
rumble = (curr_value == cheat->rumble_prev_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_INCREASE:
|
||||
rumble = (curr_value > cheat->rumble_prev_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_DECREASE:
|
||||
rumble = (curr_value < cheat->rumble_prev_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_EQ_VALUE:
|
||||
rumble = (curr_value == cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_NEQ_VALUE:
|
||||
rumble = (curr_value != cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_LT_VALUE:
|
||||
rumble = (curr_value < cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_GT_VALUE:
|
||||
rumble = (curr_value > cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_INCREASE_BY_VALUE:
|
||||
rumble = (curr_value == cheat->rumble_prev_value + cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_DECREASE_BY_VALUE:
|
||||
rumble = (curr_value == cheat->rumble_prev_value - cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_DISABLED:
|
||||
return;
|
||||
case RUMBLE_TYPE_CHANGES:
|
||||
rumble = (curr_value != cheat->rumble_prev_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_DOES_NOT_CHANGE:
|
||||
rumble = (curr_value == cheat->rumble_prev_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_INCREASE:
|
||||
rumble = (curr_value > cheat->rumble_prev_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_DECREASE:
|
||||
rumble = (curr_value < cheat->rumble_prev_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_EQ_VALUE:
|
||||
rumble = (curr_value == cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_NEQ_VALUE:
|
||||
rumble = (curr_value != cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_LT_VALUE:
|
||||
rumble = (curr_value < cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_GT_VALUE:
|
||||
rumble = (curr_value > cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_INCREASE_BY_VALUE:
|
||||
rumble = (curr_value == cheat->rumble_prev_value + cheat->rumble_value);
|
||||
break;
|
||||
case RUMBLE_TYPE_DECREASE_BY_VALUE:
|
||||
rumble = (curr_value == cheat->rumble_prev_value - cheat->rumble_value);
|
||||
break;
|
||||
}
|
||||
|
||||
cheat->rumble_prev_value = curr_value;
|
||||
|
@ -29,20 +29,24 @@ RETRO_BEGIN_DECLS
|
||||
|
||||
struct core_option
|
||||
{
|
||||
char *desc;
|
||||
char *key;
|
||||
struct string_list *vals;
|
||||
size_t index;
|
||||
char *desc;
|
||||
char *info;
|
||||
char *key;
|
||||
struct string_list *vals;
|
||||
struct string_list *val_labels;
|
||||
size_t default_index;
|
||||
size_t index;
|
||||
bool visible;
|
||||
};
|
||||
|
||||
struct core_option_manager
|
||||
{
|
||||
config_file_t *conf;
|
||||
char conf_path[PATH_MAX_LENGTH];
|
||||
config_file_t *conf;
|
||||
char conf_path[PATH_MAX_LENGTH];
|
||||
|
||||
struct core_option *opts;
|
||||
size_t size;
|
||||
bool updated;
|
||||
struct core_option *opts;
|
||||
size_t size;
|
||||
bool updated;
|
||||
};
|
||||
|
||||
typedef struct core_option_manager core_option_manager_t;
|
||||
@ -68,6 +72,18 @@ void core_option_manager_set_default(core_option_manager_t *opt, size_t idx);
|
||||
const char *core_option_manager_get_desc(core_option_manager_t *opt,
|
||||
size_t idx);
|
||||
|
||||
/**
|
||||
* core_option_manager_get_info:
|
||||
* @opt : options manager handle
|
||||
* @idx : idx identifier of the option
|
||||
*
|
||||
* Gets information text for an option.
|
||||
*
|
||||
* Returns: Information text for an option.
|
||||
**/
|
||||
const char *core_option_manager_get_info(core_option_manager_t *opt,
|
||||
size_t idx);
|
||||
|
||||
/**
|
||||
* core_option_manager_get_val:
|
||||
* @opt : options manager handle
|
||||
@ -80,6 +96,31 @@ const char *core_option_manager_get_desc(core_option_manager_t *opt,
|
||||
const char *core_option_manager_get_val(core_option_manager_t *opt,
|
||||
size_t idx);
|
||||
|
||||
/**
|
||||
* core_option_manager_get_val_label:
|
||||
* @opt : options manager handle
|
||||
* @idx : idx identifier of the option
|
||||
*
|
||||
* Gets value label for an option.
|
||||
*
|
||||
* Returns: Value label for an option.
|
||||
**/
|
||||
const char *core_option_manager_get_val_label(core_option_manager_t *opt,
|
||||
size_t idx);
|
||||
|
||||
/**
|
||||
* core_option_manager_get_visible:
|
||||
* @opt : options manager handle
|
||||
* @idx : idx identifier of the option
|
||||
*
|
||||
* Gets whether option should be visible when displaying
|
||||
* core options in the frontend
|
||||
*
|
||||
* Returns: 'true' if option should be displayed by the frontend.
|
||||
**/
|
||||
bool core_option_manager_get_visible(core_option_manager_t *opt,
|
||||
size_t idx);
|
||||
|
||||
void core_option_manager_set_val(core_option_manager_t *opt,
|
||||
size_t idx, size_t val_idx);
|
||||
|
||||
|
@ -36,14 +36,8 @@ int action_cancel_pop_default(const char *path,
|
||||
{
|
||||
size_t new_selection_ptr;
|
||||
const char *menu_label = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)path;
|
||||
(void)label;
|
||||
(void)type;
|
||||
(void)idx;
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (settings->bools.audio_enable_menu && settings->bools.audio_enable_menu_cancel)
|
||||
audio_driver_mixer_play_menu_sound(AUDIO_MIXER_SYSTEM_SLOT_CANCEL);
|
||||
#endif
|
||||
|
@ -1109,13 +1109,19 @@ static void menu_action_setting_disp_set_label_core_options(file_list_t* list,
|
||||
|
||||
if (rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts))
|
||||
{
|
||||
core_opt = core_option_manager_get_val(coreopts,
|
||||
core_opt = core_option_manager_get_val_label(coreopts,
|
||||
type - MENU_SETTINGS_CORE_OPTION_START);
|
||||
|
||||
strlcpy(s, "", len);
|
||||
|
||||
if (core_opt)
|
||||
{
|
||||
if (string_is_equal(core_opt, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)))
|
||||
core_opt = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON);
|
||||
else if (string_is_equal(core_opt, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)))
|
||||
core_opt = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF);
|
||||
strlcpy(s, core_opt, len);
|
||||
}
|
||||
}
|
||||
|
||||
strlcpy(s2, path, len2);
|
||||
|
@ -37,7 +37,9 @@ static int action_info_default(unsigned type, const char *label)
|
||||
menu_displaylist_info_t info;
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
settings_t *settings = config_get_ptr();
|
||||
#endif
|
||||
|
||||
menu_displaylist_info_init(&info);
|
||||
|
||||
|
@ -958,8 +958,11 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
case ACTION_OK_DL_LOAD_DISC_LIST:
|
||||
case ACTION_OK_DL_DUMP_DISC_LIST:
|
||||
case ACTION_OK_DL_CDROM_INFO_LIST:
|
||||
action_ok_dl_lbl(action_ok_dl_to_enum(action_type), DISPLAYLIST_GENERIC);
|
||||
break;
|
||||
case ACTION_OK_DL_CDROM_INFO_DETAIL_LIST:
|
||||
action_ok_dl_lbl(action_ok_dl_to_enum(action_type), DISPLAYLIST_GENERIC);
|
||||
info_path = label;
|
||||
break;
|
||||
case ACTION_OK_DL_CONTENT_SETTINGS:
|
||||
info.list = menu_entries_get_selection_buf_ptr(0);
|
||||
@ -1017,11 +1020,20 @@ static bool menu_content_playlist_load(playlist_t *playlist, size_t idx)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
char expanded_path[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
|
||||
playlist_get_index(playlist, idx, &entry);
|
||||
|
||||
path = entry->path;
|
||||
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
expanded_path[0] = '\0';
|
||||
fill_pathname_expand_special(expanded_path, entry->path, sizeof(expanded_path));
|
||||
path = expanded_path;
|
||||
#endif
|
||||
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
unsigned i;
|
||||
@ -1314,9 +1326,9 @@ static int set_path_generic(const char *label, const char *action_path)
|
||||
|
||||
static int generic_action_ok_command(enum event_command cmd)
|
||||
{
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (settings->bools.audio_enable_menu && settings->bools.audio_enable_menu_ok)
|
||||
audio_driver_mixer_play_menu_sound(AUDIO_MIXER_SYSTEM_SLOT_OK);
|
||||
#endif
|
||||
@ -1392,9 +1404,9 @@ static int generic_action_ok(const char *path,
|
||||
const char *menu_label = NULL;
|
||||
const char *flush_char = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (settings->bools.audio_enable_menu && settings->bools.audio_enable_menu_ok)
|
||||
audio_driver_mixer_play_menu_sound(AUDIO_MIXER_SYSTEM_SLOT_OK);
|
||||
#endif
|
||||
@ -1583,6 +1595,15 @@ static int generic_action_ok(const char *path,
|
||||
break;
|
||||
case ACTION_OK_SET_DIRECTORY:
|
||||
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST);
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
// For iOS, set the path using realpath because the path name
|
||||
// can start with /private and this ensures the path starts with it.
|
||||
// This will allow the path to be properly substituted when fill_pathname_expand_special
|
||||
// is called.
|
||||
char real_action_path[PATH_MAX_LENGTH] = {0};
|
||||
realpath(action_path, real_action_path);
|
||||
strlcpy(action_path, real_action_path, sizeof(action_path));
|
||||
#endif
|
||||
ret = set_path_generic(menu->filebrowser_label, action_path);
|
||||
break;
|
||||
case ACTION_OK_SET_PATH_VIDEO_FILTER:
|
||||
@ -1777,12 +1798,22 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
const struct playlist_entry *entry = NULL;
|
||||
unsigned i = 0;
|
||||
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
char expanded_path[PATH_MAX_LENGTH];
|
||||
char expanded_core_path[PATH_MAX_LENGTH] = {0};
|
||||
#endif
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
|
||||
new_core_path[0] = '\0';
|
||||
tmp_playlist = playlist_get_cached();
|
||||
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
expanded_path[0] = '\0';
|
||||
expanded_core_path[0] = '\0';
|
||||
#endif
|
||||
|
||||
if (!tmp_playlist)
|
||||
{
|
||||
tmp_playlist = playlist_init(
|
||||
@ -1875,7 +1906,13 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(new_core_path, entry->core_path, sizeof(new_core_path));
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
fill_pathname_expand_special(expanded_core_path, new_core_path, sizeof(expanded_core_path));
|
||||
strlcpy(new_core_path, expanded_core_path, sizeof(new_core_path));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!playlist || !menu_content_playlist_load(playlist, selection_ptr))
|
||||
{
|
||||
@ -1890,8 +1927,14 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
|
||||
playlist_get_index(playlist, selection_ptr, &entry);
|
||||
|
||||
return default_action_ok_load_content_from_playlist_from_menu(
|
||||
new_core_path, entry->path, entry->label);
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
fill_pathname_expand_special(expanded_path, entry->path, sizeof(expanded_path));
|
||||
return default_action_ok_load_content_from_playlist_from_menu(
|
||||
new_core_path, expanded_path, entry->label);
|
||||
#else
|
||||
return default_action_ok_load_content_from_playlist_from_menu(
|
||||
new_core_path, entry->path, entry->label);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int action_ok_playlist_entry(const char *path,
|
||||
@ -1906,6 +1949,11 @@ static int action_ok_playlist_entry(const char *path,
|
||||
|
||||
new_core_path[0] = '\0';
|
||||
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
char expanded_core_path[PATH_MAX_LENGTH];
|
||||
expanded_core_path[0] = '\0';
|
||||
#endif
|
||||
|
||||
if (!playlist ||
|
||||
!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
@ -1954,8 +2002,13 @@ static int action_ok_playlist_entry(const char *path,
|
||||
}
|
||||
|
||||
}
|
||||
else if (!string_is_empty(entry->core_path))
|
||||
strlcpy(new_core_path, entry->core_path, sizeof(new_core_path));
|
||||
else if (!string_is_empty(entry->core_path)) {
|
||||
strlcpy(new_core_path, entry->core_path, sizeof(new_core_path));
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
fill_pathname_expand_special(expanded_core_path, new_core_path, sizeof(expanded_core_path));
|
||||
strlcpy(new_core_path, expanded_core_path, sizeof(new_core_path));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!playlist || !menu_content_playlist_load(playlist, selection_ptr))
|
||||
{
|
||||
@ -3984,11 +4037,8 @@ static int action_ok_option_create(const char *path,
|
||||
conf = config_file_new(game_path);
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
conf = config_file_new(NULL);
|
||||
if (!conf)
|
||||
if (!(conf = config_file_new_alloc()))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (config_file_write(conf, game_path, true))
|
||||
{
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "../menu_cbs.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../../managers/core_option_manager.h"
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "../../cheevos-new/cheevos.h"
|
||||
@ -1014,6 +1015,26 @@ static int action_bind_sublabel_playlist_entry(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_bind_sublabel_core_option(
|
||||
file_list_t *list,
|
||||
unsigned type, unsigned i,
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
core_option_manager_t *opt = NULL;
|
||||
const char *info = NULL;
|
||||
|
||||
if (!rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &opt))
|
||||
return 0;
|
||||
|
||||
info = core_option_manager_get_info(opt, type - MENU_SETTINGS_CORE_OPTION_START);
|
||||
|
||||
if (!string_is_empty(info))
|
||||
strlcpy(s, info, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_bind_sublabel_generic(
|
||||
file_list_t *list,
|
||||
unsigned type, unsigned i,
|
||||
@ -1102,6 +1123,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (type >= MENU_SETTINGS_CORE_OPTION_START)
|
||||
{
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_option);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cbs->enum_idx != MSG_UNKNOWN)
|
||||
{
|
||||
settings_t *settings; /* config_get_ptr is called only when needed */
|
||||
|
@ -61,7 +61,8 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CDROM
|
||||
#include <cdrom/cdrom.h>
|
||||
#include <vfs/vfs_implementation_cdrom.h>
|
||||
#include <media/media_detect_cd.h>
|
||||
#endif
|
||||
|
||||
#include "menu_cbs.h"
|
||||
@ -2169,9 +2170,10 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int menu_displaylist_parse_information_list(
|
||||
static unsigned menu_displaylist_parse_information_list(
|
||||
menu_displaylist_info_t *info)
|
||||
{
|
||||
unsigned count = 0;
|
||||
core_info_t *core_info = NULL;
|
||||
struct retro_system_info *system = runloop_get_libretro_system_info();
|
||||
|
||||
@ -2184,63 +2186,73 @@ static int menu_displaylist_parse_information_list(
|
||||
)
|
||||
&& core_info && core_info->config_data
|
||||
)
|
||||
menu_entries_append_enum(info->list,
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFORMATION),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CORE_INFORMATION),
|
||||
MENU_ENUM_LABEL_CORE_INFORMATION,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
#ifdef HAVE_CDROM
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISC_INFORMATION),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_DISC_INFORMATION),
|
||||
MENU_ENUM_LABEL_DISC_INFORMATION,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
#ifndef HAVE_SOCKET_LEGACY
|
||||
menu_entries_append_enum(info->list,
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NETWORK_INFORMATION),
|
||||
MENU_ENUM_LABEL_NETWORK_INFORMATION,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFORMATION),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_SYSTEM_INFORMATION),
|
||||
MENU_ENUM_LABEL_SYSTEM_INFORMATION,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
menu_entries_append_enum(info->list,
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DATABASE_MANAGER),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_DATABASE_MANAGER_LIST),
|
||||
MENU_ENUM_LABEL_DATABASE_MANAGER_LIST,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
menu_entries_append_enum(info->list,
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CURSOR_MANAGER),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CURSOR_MANAGER_LIST),
|
||||
MENU_ENUM_LABEL_CURSOR_MANAGER_LIST,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
#endif
|
||||
|
||||
if (rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL))
|
||||
{
|
||||
menu_entries_append_enum(info->list,
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FRONTEND_COUNTERS),
|
||||
MENU_ENUM_LABEL_FRONTEND_COUNTERS,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_COUNTERS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CORE_COUNTERS),
|
||||
MENU_ENUM_LABEL_CORE_COUNTERS,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
static unsigned menu_displaylist_parse_playlists(
|
||||
@ -4940,8 +4952,224 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
#ifdef HAVE_CDROM
|
||||
case DISPLAYLIST_CDROM_DETAIL_INFO:
|
||||
{
|
||||
media_detect_cd_info_t cd_info = {0};
|
||||
char file_path[PATH_MAX_LENGTH];
|
||||
RFILE *file;
|
||||
char drive = info->path[0];
|
||||
bool atip = false;
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
count = 0;
|
||||
file_path[0] = '\0';
|
||||
|
||||
if (cdrom_drive_has_media(drive))
|
||||
{
|
||||
cdrom_device_fillpath(file_path, sizeof(file_path), drive, 0, true);
|
||||
|
||||
/* opening the cue triggers storing of TOC info internally */
|
||||
file = filestream_open(file_path, RETRO_VFS_FILE_ACCESS_READ, 0);
|
||||
|
||||
if (file)
|
||||
{
|
||||
const cdrom_toc_t *toc = retro_vfs_file_get_cdrom_toc();
|
||||
|
||||
atip = cdrom_has_atip(filestream_get_vfs_handle(file));
|
||||
|
||||
filestream_close(file);
|
||||
|
||||
/* open first track */
|
||||
cdrom_device_fillpath(file_path, sizeof(file_path), drive, 1, false);
|
||||
|
||||
if (media_detect_cd_info(file_path, &cd_info))
|
||||
{
|
||||
if (!string_is_empty(cd_info.title))
|
||||
{
|
||||
char title[256];
|
||||
|
||||
count++;
|
||||
|
||||
title[0] = '\0';
|
||||
|
||||
strlcpy(title, "Title: ", sizeof(title));
|
||||
strlcat(title, cd_info.title, sizeof(title));
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
title,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
}
|
||||
|
||||
if (!string_is_empty(cd_info.system))
|
||||
{
|
||||
char system[256];
|
||||
|
||||
count++;
|
||||
|
||||
system[0] = '\0';
|
||||
|
||||
strlcpy(system, "System: ", sizeof(system));
|
||||
strlcat(system, cd_info.system, sizeof(system));
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
system,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
}
|
||||
|
||||
if (!string_is_empty(cd_info.serial))
|
||||
{
|
||||
char serial[256];
|
||||
|
||||
count++;
|
||||
|
||||
serial[0] = '\0';
|
||||
|
||||
strlcpy(serial, "Serial#: ", sizeof(serial));
|
||||
strlcat(serial, cd_info.serial, sizeof(serial));
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
serial,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
}
|
||||
|
||||
if (!string_is_empty(cd_info.version))
|
||||
{
|
||||
char version[256];
|
||||
|
||||
count++;
|
||||
|
||||
version[0] = '\0';
|
||||
|
||||
strlcpy(version, "Version: ", sizeof(version));
|
||||
strlcat(version, cd_info.version, sizeof(version));
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
version,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
}
|
||||
|
||||
if (!string_is_empty(cd_info.release_date))
|
||||
{
|
||||
char release_date[256];
|
||||
|
||||
count++;
|
||||
|
||||
release_date[0] = '\0';
|
||||
|
||||
strlcpy(release_date, "Release Date: ", sizeof(release_date));
|
||||
strlcat(release_date, cd_info.release_date, sizeof(release_date));
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
release_date,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
}
|
||||
|
||||
{
|
||||
char atip_string[32] = {"Genuine Disc: "};
|
||||
|
||||
if (atip)
|
||||
strlcat(atip_string, "No", sizeof(atip_string));
|
||||
else
|
||||
strlcat(atip_string, "Yes", sizeof(atip_string));
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
atip_string,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
}
|
||||
|
||||
{
|
||||
char tracks_string[32] = {"Number of tracks: "};
|
||||
|
||||
snprintf(tracks_string + strlen(tracks_string), sizeof(tracks_string) - strlen(tracks_string), "%d", toc->num_tracks);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
tracks_string,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
}
|
||||
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < toc->num_tracks; i++)
|
||||
{
|
||||
char track_string[16] = {"Track "};
|
||||
char mode_string[16] = {" - Mode: "};
|
||||
char size_string[32] = {" - Size: "};
|
||||
char length_string[32] = {" - Length: "};
|
||||
|
||||
snprintf(track_string + strlen(track_string), sizeof(track_string) - strlen(track_string), "%d:", i + 1);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
track_string,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
|
||||
if (toc->track[i].audio)
|
||||
snprintf(mode_string + strlen(mode_string), sizeof(mode_string) - strlen(mode_string), "Audio");
|
||||
else
|
||||
snprintf(mode_string + strlen(mode_string), sizeof(mode_string) - strlen(mode_string), "Mode %d", toc->track[i].mode);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
mode_string,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
|
||||
snprintf(size_string + strlen(size_string), sizeof(size_string) - strlen(size_string), "%.1f MB", toc->track[i].track_bytes / 1000.0 / 1000.0);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
size_string,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
|
||||
{
|
||||
unsigned char min = 0;
|
||||
unsigned char sec = 0;
|
||||
unsigned char frame = 0;
|
||||
|
||||
cdrom_lba_to_msf(toc->track[i].track_size, &min, &sec, &frame);
|
||||
|
||||
snprintf(length_string + strlen(length_string), sizeof(length_string) - strlen(length_string), "%02d:%02d.%02d", min, sec, frame);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
length_string,
|
||||
"",
|
||||
MSG_UNKNOWN,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
RARCH_ERR("[CDROM]: Could not detect any disc info.\n");
|
||||
}
|
||||
else
|
||||
RARCH_ERR("[CDROM]: Error opening file for reading: %s\n", file_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n");
|
||||
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_NO_DISC_INSERTED),
|
||||
1, 100, true,
|
||||
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
menu_entries_append_enum(info->list,
|
||||
@ -4954,6 +5182,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
info->need_refresh = true;
|
||||
info->need_clear = true;
|
||||
break;
|
||||
}
|
||||
case DISPLAYLIST_DISC_INFO:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
count = menu_displaylist_parse_disc_info(info,
|
||||
@ -6068,63 +6297,86 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_CORE_OPTIONS:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
if (rarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL))
|
||||
{
|
||||
size_t opts = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
/* Number of displayed options is dynamic. If user opens
|
||||
* 'Quick Menu > Core Options', toggles something
|
||||
* that changes the number of displayed items, then
|
||||
* toggles the Quick Menu off and on again (returning
|
||||
* to the Core Options menu) the menu must be refreshed
|
||||
* (or undefined behaviour occurs).
|
||||
* The only way to check whether the number of visible
|
||||
* options has changed is to cache the last set menu size,
|
||||
* and compare this with the new size after processing
|
||||
* the current core_option_manager_t struct */
|
||||
size_t prev_count = info->list->size;
|
||||
|
||||
rarch_ctl(RARCH_CTL_GET_CORE_OPTION_SIZE, &opts);
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
if (settings->bools.game_specific_options)
|
||||
if (rarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL))
|
||||
{
|
||||
if (!rarch_ctl(RARCH_CTL_IS_GAME_OPTIONS_ACTIVE, NULL))
|
||||
size_t opts = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
rarch_ctl(RARCH_CTL_GET_CORE_OPTION_SIZE, &opts);
|
||||
|
||||
if (settings->bools.game_specific_options)
|
||||
{
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE),
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_CREATE),
|
||||
MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_CREATE,
|
||||
MENU_SETTINGS_CORE_OPTION_CREATE, 0, 0))
|
||||
count++;
|
||||
if (!rarch_ctl(RARCH_CTL_IS_GAME_OPTIONS_ACTIVE, NULL))
|
||||
{
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE),
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_CREATE),
|
||||
MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_CREATE,
|
||||
MENU_SETTINGS_CORE_OPTION_CREATE, 0, 0))
|
||||
count++;
|
||||
}
|
||||
else
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE),
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_IN_USE),
|
||||
MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_IN_USE,
|
||||
MENU_SETTINGS_CORE_OPTION_CREATE, 0, 0))
|
||||
count++;
|
||||
}
|
||||
else
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE),
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_IN_USE),
|
||||
MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_IN_USE,
|
||||
MENU_SETTINGS_CORE_OPTION_CREATE, 0, 0))
|
||||
count++;
|
||||
}
|
||||
|
||||
if (opts != 0)
|
||||
{
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
|
||||
rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts);
|
||||
|
||||
for (i = 0; i < opts; i++)
|
||||
if (opts != 0)
|
||||
{
|
||||
menu_entries_append_enum(info->list,
|
||||
core_option_manager_get_desc(coreopts, i), "",
|
||||
MENU_ENUM_LABEL_CORE_OPTION_ENTRY,
|
||||
(unsigned)(MENU_SETTINGS_CORE_OPTION_START + i), 0, 0);
|
||||
count++;
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
|
||||
rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts);
|
||||
|
||||
for (i = 0; i < opts; i++)
|
||||
{
|
||||
if (core_option_manager_get_visible(coreopts, i))
|
||||
{
|
||||
menu_entries_append_enum(info->list,
|
||||
core_option_manager_get_desc(coreopts, i), "",
|
||||
MENU_ENUM_LABEL_CORE_OPTION_ENTRY,
|
||||
(unsigned)(MENU_SETTINGS_CORE_OPTION_START + i), 0, 0);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE_OPTIONS_AVAILABLE),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NO_CORE_OPTIONS_AVAILABLE),
|
||||
MENU_ENUM_LABEL_NO_CORE_OPTIONS_AVAILABLE,
|
||||
MENU_SETTINGS_CORE_OPTION_NONE, 0, 0);
|
||||
|
||||
if (count != prev_count)
|
||||
{
|
||||
info->need_refresh = true;
|
||||
info->need_navigation_clear = true;
|
||||
}
|
||||
info->need_push = true;
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE_OPTIONS_AVAILABLE),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NO_CORE_OPTIONS_AVAILABLE),
|
||||
MENU_ENUM_LABEL_NO_CORE_OPTIONS_AVAILABLE,
|
||||
MENU_SETTINGS_CORE_OPTION_NONE, 0, 0);
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_ARCHIVE_ACTION:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
@ -6562,7 +6814,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
}
|
||||
case DISPLAYLIST_AUDIO_MIXER_SETTINGS_LIST:
|
||||
{
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
unsigned i;
|
||||
#endif
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
@ -6809,7 +7063,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
break;
|
||||
case DISPLAYLIST_INFORMATION_LIST:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
ret = menu_displaylist_parse_information_list(info);
|
||||
count = menu_displaylist_parse_information_list(info);
|
||||
|
||||
if (count == 0)
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY),
|
||||
MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
|
||||
ret = 0;
|
||||
|
||||
info->need_push = true;
|
||||
info->need_refresh = true;
|
||||
@ -8045,39 +8308,68 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
unsigned i = atoi(tmp_str_list->elems[size-1].data);
|
||||
unsigned menu_index = atoi(tmp_str_list->elems[size-1].data);
|
||||
unsigned visible_index = 0;
|
||||
unsigned option_index = 0;
|
||||
bool option_found = false;
|
||||
struct core_option *option = NULL;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
unsigned i;
|
||||
|
||||
/* Note: Although we display value labels here,
|
||||
* most logic is performed using values. This seems
|
||||
* more appropriate somehow... */
|
||||
|
||||
/* Convert menu index to option index */
|
||||
if (settings->bools.game_specific_options)
|
||||
{
|
||||
val = core_option_manager_get_val(coreopts, i-1);
|
||||
i--;
|
||||
}
|
||||
else
|
||||
val = core_option_manager_get_val(coreopts, i);
|
||||
menu_index--;
|
||||
|
||||
option = (struct core_option*)&coreopts->opts[i];
|
||||
for (i = 0; i < coreopts->size; i++)
|
||||
{
|
||||
if (core_option_manager_get_visible(coreopts, i))
|
||||
{
|
||||
if (visible_index == menu_index)
|
||||
{
|
||||
option_found = true;
|
||||
option_index = i;
|
||||
break;
|
||||
}
|
||||
visible_index++;
|
||||
}
|
||||
}
|
||||
|
||||
if (option_found)
|
||||
{
|
||||
val = core_option_manager_get_val(coreopts, option_index);
|
||||
option = (struct core_option*)&coreopts->opts[option_index];
|
||||
}
|
||||
|
||||
if (option)
|
||||
{
|
||||
unsigned k;
|
||||
for (k = 0; k < option->vals->size; k++)
|
||||
{
|
||||
const char *str = option->vals->elems[k].data;
|
||||
const char *val_str = option->vals->elems[k].data;
|
||||
const char *val_label_str = option->val_labels->elems[k].data;
|
||||
|
||||
if (!string_is_empty(str))
|
||||
if (!string_is_empty(val_label_str))
|
||||
{
|
||||
char val_d[256];
|
||||
snprintf(val_d, sizeof(val_d), "%d", i);
|
||||
snprintf(val_d, sizeof(val_d), "%d", option_index);
|
||||
|
||||
if (string_is_equal(val_label_str, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)))
|
||||
val_label_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON);
|
||||
else if (string_is_equal(val_label_str, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)))
|
||||
val_label_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
str,
|
||||
val_label_str,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM, k, 0);
|
||||
|
||||
if (!checked_found && string_is_equal(str, val))
|
||||
if (!checked_found && string_is_equal(val_str, val))
|
||||
{
|
||||
checked = k;
|
||||
checked_found = true;
|
||||
@ -8093,6 +8385,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -8135,6 +8429,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
}
|
||||
break;
|
||||
case ST_INT:
|
||||
@ -8361,41 +8658,74 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
{
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
const char *val = NULL;
|
||||
|
||||
rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts);
|
||||
|
||||
if (coreopts)
|
||||
{
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
unsigned i = atoi(tmp_str_list->elems[size-1].data);
|
||||
unsigned menu_index = atoi(tmp_str_list->elems[size-1].data);
|
||||
unsigned visible_index = 0;
|
||||
unsigned option_index = 0;
|
||||
bool option_found = false;
|
||||
struct core_option *option = NULL;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
const char *val = core_option_manager_get_val(coreopts, i-1);
|
||||
unsigned i;
|
||||
|
||||
i--;
|
||||
/* Note: Although we display value labels here,
|
||||
* most logic is performed using values. This seems
|
||||
* more appropriate somehow... */
|
||||
|
||||
option = (struct core_option*)&coreopts->opts[i];
|
||||
/* Convert menu index to option index */
|
||||
menu_index--;
|
||||
|
||||
for (i = 0; i < coreopts->size; i++)
|
||||
{
|
||||
if (core_option_manager_get_visible(coreopts, i))
|
||||
{
|
||||
if (visible_index == menu_index)
|
||||
{
|
||||
option_found = true;
|
||||
option_index = i;
|
||||
break;
|
||||
}
|
||||
visible_index++;
|
||||
}
|
||||
}
|
||||
|
||||
if (option_found)
|
||||
{
|
||||
val = core_option_manager_get_val(coreopts, option_index);
|
||||
option = (struct core_option*)&coreopts->opts[option_index];
|
||||
}
|
||||
|
||||
if (option)
|
||||
{
|
||||
unsigned k;
|
||||
for (k = 0; k < option->vals->size; k++)
|
||||
{
|
||||
const char *str = option->vals->elems[k].data;
|
||||
const char *val_str = option->vals->elems[k].data;
|
||||
const char *val_label_str = option->val_labels->elems[k].data;
|
||||
|
||||
if (!string_is_empty(str))
|
||||
if (!string_is_empty(val_label_str))
|
||||
{
|
||||
char val_d[256];
|
||||
snprintf(val_d, sizeof(val_d), "%d", i);
|
||||
|
||||
snprintf(val_d, sizeof(val_d), "%d", option_index);
|
||||
|
||||
if (string_is_equal(val_label_str, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)))
|
||||
val_label_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON);
|
||||
else if (string_is_equal(val_label_str, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)))
|
||||
val_label_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
str,
|
||||
val_label_str,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM_SPECIAL, k, 0);
|
||||
|
||||
if (!checked_found && string_is_equal(str, val))
|
||||
if (!checked_found && string_is_equal(val_str, val))
|
||||
{
|
||||
checked = k;
|
||||
checked_found = true;
|
||||
@ -8409,6 +8739,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -8450,6 +8782,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
}
|
||||
break;
|
||||
case ST_INT:
|
||||
|
@ -4166,10 +4166,10 @@ static int setting_uint_action_left_custom_viewport_height(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(RARCH_CONSOLE)
|
||||
static int setting_string_action_left_audio_device(
|
||||
rarch_setting_t *setting, bool wraparound)
|
||||
{
|
||||
#if !defined(RARCH_CONSOLE)
|
||||
int audio_device_index;
|
||||
struct string_list *ptr = NULL;
|
||||
|
||||
@ -4189,10 +4189,10 @@ static int setting_string_action_left_audio_device(
|
||||
audio_device_index = (int)(ptr->size - 1);
|
||||
|
||||
strlcpy(setting->value.target.string, ptr->elems[audio_device_index].data, setting->size);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int setting_string_action_left_driver(rarch_setting_t *setting,
|
||||
bool wraparound)
|
||||
@ -5717,7 +5717,7 @@ void general_write_handler(rarch_setting_t *setting)
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR:
|
||||
core_set_poll_type((unsigned int*)setting->value.target.integer);
|
||||
core_set_poll_type(*setting->value.target.integer);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER:
|
||||
{
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <retro_assert.h>
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
@ -77,7 +78,20 @@ bool menu_shader_manager_init(void)
|
||||
|
||||
if (is_preset)
|
||||
{
|
||||
conf = config_file_new(path_shader);
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
|
||||
if (path_is_valid(path_shader))
|
||||
{
|
||||
if (filestream_read_file(path_shader, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
if ((conf = config_file_new_from_string((const char*)ret_buf)))
|
||||
conf->path = strdup(path_shader);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
}
|
||||
|
||||
new_path = strdup(path_shader);
|
||||
}
|
||||
else
|
||||
@ -99,23 +113,62 @@ bool menu_shader_manager_init(void)
|
||||
|
||||
preset_path[0] = '\0';
|
||||
|
||||
#ifdef HAVE_GLSL
|
||||
fill_pathname_join(preset_path, shader_dir,
|
||||
"menu.glslp", sizeof(preset_path));
|
||||
conf = config_file_new(preset_path);
|
||||
|
||||
if (path_is_valid(preset_path))
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
if (filestream_read_file(preset_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CG
|
||||
if (!conf)
|
||||
{
|
||||
fill_pathname_join(preset_path, shader_dir,
|
||||
"menu.cgp", sizeof(preset_path));
|
||||
conf = config_file_new(preset_path);
|
||||
}
|
||||
|
||||
if (path_is_valid(preset_path))
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
if (filestream_read_file(preset_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
if (!conf)
|
||||
{
|
||||
fill_pathname_join(preset_path, shader_dir,
|
||||
"menu.slangp", sizeof(preset_path));
|
||||
conf = config_file_new(preset_path);
|
||||
|
||||
if (path_is_valid(preset_path))
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
if (filestream_read_file(preset_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
new_path = strdup(preset_path);
|
||||
}
|
||||
@ -149,6 +202,8 @@ bool menu_shader_manager_init(void)
|
||||
bool menu_shader_manager_set_preset(void *data,
|
||||
enum rarch_shader_type type, const char *preset_path)
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
struct video_shader *shader = (struct video_shader*)data;
|
||||
config_file_t *conf = NULL;
|
||||
bool refresh = false;
|
||||
@ -174,11 +229,17 @@ bool menu_shader_manager_set_preset(void *data,
|
||||
* Used when a preset is directly loaded.
|
||||
* No point in updating when the Preset was
|
||||
* created from the menu itself. */
|
||||
conf = config_file_new(preset_path);
|
||||
if (filestream_read_file(preset_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
|
||||
if (!conf)
|
||||
return false;
|
||||
|
||||
conf->path = strdup(preset_path);
|
||||
RARCH_LOG("Setting Menu shader: %s.\n", preset_path);
|
||||
|
||||
if (video_shader_read_conf_preset(conf, shader))
|
||||
@ -296,9 +357,7 @@ bool menu_shader_manager_save_preset(
|
||||
dirs[2] = config_directory;
|
||||
}
|
||||
|
||||
conf = (config_file_t*)config_file_new(NULL);
|
||||
|
||||
if (!conf)
|
||||
if (!(conf = (config_file_t*)config_file_new_alloc()))
|
||||
return false;
|
||||
|
||||
if (fullpath)
|
||||
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 563 B After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 552 B After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 642 B After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 416 B After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 961 B After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 9.4 KiB |