diff --git a/CHANGES.md b/CHANGES.md
index 22b3f03a5f..0c3a004e34 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -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.
diff --git a/Makefile.common b/Makefile.common
index 4b42ae2dc7..0cff7dcd58 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -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
diff --git a/Makefile.griffin b/Makefile.griffin
index 02bb895bc1..989b171faa 100644
--- a/Makefile.griffin
+++ b/Makefile.griffin
@@ -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
diff --git a/Makefile.vita b/Makefile.vita
index 2caf4600cf..3ef57a58db 100644
--- a/Makefile.vita
+++ b/Makefile.vita
@@ -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
diff --git a/audio/drivers/tinyalsa.c b/audio/drivers/tinyalsa.c
index 8625bbd58b..1aea14ceaf 100644
--- a/audio/drivers/tinyalsa.c
+++ b/audio/drivers/tinyalsa.c
@@ -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));
diff --git a/command.c b/command.c
old mode 100755
new mode 100644
diff --git a/config.def.h b/config.def.h
index 84b0c02b5d..86ceb1d755 100644
--- a/config.def.h
+++ b/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. */
diff --git a/configuration.c b/configuration.c
index ce1f7113d4..8cc3afce25 100644
--- a/configuration.c
+++ b/configuration.c
@@ -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);
diff --git a/core.h b/core.h
index db50d33d68..70dccebaf6 100644
--- a/core.h
+++ b/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
diff --git a/core_info.c b/core_info.c
index 13cea324d5..5dcd179e99 100644
--- a/core_info.c
+++ b/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;
diff --git a/deps/mbedtls/mbedtls/config.h b/deps/mbedtls/mbedtls/config.h
index 67622c384a..6ea52a9b32 100644
--- a/deps/mbedtls/mbedtls/config.h
+++ b/deps/mbedtls/mbedtls/config.h
@@ -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
diff --git a/discord/discord.c b/discord/discord.c
index bb00ca4dd6..b24fe6e09a 100644
--- a/discord/discord.c
+++ b/discord/discord.c
@@ -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);
diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m
index 03eb8354a0..8325ae87b8 100644
--- a/frontend/drivers/platform_darwin.m
+++ b/frontend/drivers/platform_darwin.m
@@ -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));
diff --git a/frontend/frontend.c b/frontend/frontend.c
deleted file mode 100644
index 72cfe3c1dd..0000000000
--- a/frontend/frontend.c
+++ /dev/null
@@ -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 .
- */
-
-#include
-#include
-
-#ifdef HAVE_CONFIG_H
-#include "../config.h"
-#endif
-
-#include
-
-#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
-#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
diff --git a/frontend/frontend_salamander.c b/frontend/frontend_salamander.c
index 1c13fa4b67..105f778e44 100644
--- a/frontend/frontend_salamander.c
+++ b/frontend/frontend_salamander.c
@@ -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)
{
diff --git a/gfx/display_servers/dispserv_x11.c b/gfx/display_servers/dispserv_x11.c
index 85741ddd1a..253a14254c 100644
--- a/gfx/display_servers/dispserv_x11.c
+++ b/gfx/display_servers/dispserv_x11.c
@@ -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;
diff --git a/gfx/video_crt_switch.c b/gfx/video_crt_switch.c
index 635c863904..37986b7156 100644
--- a/gfx/video_crt_switch.c
+++ b/gfx/video_crt_switch.c
@@ -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;
diff --git a/gfx/video_shader_parse.c b/gfx/video_shader_parse.c
index 12a274fd95..6b99d8d6b9 100644
--- a/gfx/video_shader_parse.c
+++ b/gfx/video_shader_parse.c
@@ -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:
diff --git a/griffin/griffin.c b/griffin/griffin.c
index c2f655366c..9fddb7982e 100644
--- a/griffin/griffin.c
+++ b/griffin/griffin.c
@@ -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
diff --git a/input/connect/connect_ps3.c b/input/connect/connect_ps3.c
index 52d0032ecd..1cc955b655 100644
--- a/input/connect/connect_ps3.c
+++ b/input/connect/connect_ps3.c
@@ -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);
diff --git a/input/connect/joypad_connection.h b/input/connect/joypad_connection.h
index 62a454609a..cdb1e25ae4 100644
--- a/input/connect/joypad_connection.h
+++ b/input/connect/joypad_connection.h
@@ -25,24 +25,31 @@
#include
#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
{
diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c
index 20b85aa5cf..88e559059d 100644
--- a/input/drivers/android_input.c
+++ b/input/drivers/android_input.c
@@ -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;
diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c
index 50e958bf8e..37918ba922 100644
--- a/input/drivers/linuxraw_input.c
+++ b/input/drivers/linuxraw_input.c
@@ -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;
}
diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c
index 7ec4fe2fe3..e79992f3e3 100644
--- a/input/drivers/udev_input.c
+++ b/input/drivers/udev_input.c
@@ -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;
diff --git a/input/drivers_hid/iohidmanager_hid.c b/input/drivers_hid/iohidmanager_hid.c
index 9898f99d5a..57b9fd4733 100644
--- a/input/drivers_hid/iohidmanager_hid.c
+++ b/input/drivers_hid/iohidmanager_hid.c
@@ -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);
}
diff --git a/input/drivers_hid/libusb_hid.c b/input/drivers_hid/libusb_hid.c
index 4f564df244..e55cf9961a 100644
--- a/input/drivers_hid/libusb_hid.c
+++ b/input/drivers_hid/libusb_hid.c
@@ -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,
diff --git a/input/drivers_hid/wiiusb_hid.c b/input/drivers_hid/wiiusb_hid.c
index ce6f6c234d..30fc6a1e8b 100644
--- a/input/drivers_hid/wiiusb_hid.c
+++ b/input/drivers_hid/wiiusb_hid.c
@@ -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,
diff --git a/input/drivers_joypad/ctr_joypad.c b/input/drivers_joypad/ctr_joypad.c
index 6bf24ab9cc..8f60c9d6fd 100644
--- a/input/drivers_joypad/ctr_joypad.c
+++ b/input/drivers_joypad/ctr_joypad.c
@@ -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)
diff --git a/input/drivers_joypad/dinput_joypad.c b/input/drivers_joypad/dinput_joypad.c
index f9e46fcfea..c22fdcb791 100644
--- a/input/drivers_joypad/dinput_joypad.c
+++ b/input/drivers_joypad/dinput_joypad.c
@@ -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
diff --git a/input/drivers_joypad/dos_joypad.c b/input/drivers_joypad/dos_joypad.c
index 5d6c322258..4d4dc455c1 100644
--- a/input/drivers_joypad/dos_joypad.c
+++ b/input/drivers_joypad/dos_joypad.c
@@ -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)
diff --git a/input/drivers_joypad/gx_joypad.c b/input/drivers_joypad/gx_joypad.c
index 1e4c0b9a4b..f58301f941 100644
--- a/input/drivers_joypad/gx_joypad.c
+++ b/input/drivers_joypad/gx_joypad.c
@@ -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)
diff --git a/input/drivers_joypad/linuxraw_joypad.c b/input/drivers_joypad/linuxraw_joypad.c
index 09237b88ec..aef2d48967 100644
--- a/input/drivers_joypad/linuxraw_joypad.c
+++ b/input/drivers_joypad/linuxraw_joypad.c
@@ -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);
diff --git a/input/drivers_joypad/mfi_joypad.m b/input/drivers_joypad/mfi_joypad.m
index 25fb57dccc..528a6d5bc5 100644
--- a/input/drivers_joypad/mfi_joypad.m
+++ b/input/drivers_joypad/mfi_joypad.m
@@ -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)
diff --git a/input/drivers_joypad/parport_joypad.c b/input/drivers_joypad/parport_joypad.c
index 2449c8c115..f3f1d908c8 100644
--- a/input/drivers_joypad/parport_joypad.c
+++ b/input/drivers_joypad/parport_joypad.c
@@ -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;
diff --git a/input/drivers_joypad/ps2_joypad.c b/input/drivers_joypad/ps2_joypad.c
index 7e663a76db..dc40b6d787 100644
--- a/input/drivers_joypad/ps2_joypad.c
+++ b/input/drivers_joypad/ps2_joypad.c
@@ -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 = {
diff --git a/input/drivers_joypad/ps3_joypad.c b/input/drivers_joypad/ps3_joypad.c
index 79d8748776..cee170603e 100644
--- a/input/drivers_joypad/ps3_joypad.c
+++ b/input/drivers_joypad/ps3_joypad.c
@@ -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)
diff --git a/input/drivers_joypad/ps4_joypad.c b/input/drivers_joypad/ps4_joypad.c
index aeb49062b1..71b2791a0a 100644
--- a/input/drivers_joypad/ps4_joypad.c
+++ b/input/drivers_joypad/ps4_joypad.c
@@ -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;
diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c
index 6bba2eba92..40cade7047 100644
--- a/input/drivers_joypad/psp_joypad.c
+++ b/input/drivers_joypad/psp_joypad.c
@@ -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));
}
diff --git a/input/drivers_joypad/qnx_joypad.c b/input/drivers_joypad/qnx_joypad.c
index ece4871971..8f516f12f1 100644
--- a/input/drivers_joypad/qnx_joypad.c
+++ b/input/drivers_joypad/qnx_joypad.c
@@ -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)
diff --git a/input/drivers_joypad/rwebpad_joypad.c b/input/drivers_joypad/rwebpad_joypad.c
index 3159bf69a5..65f163ce1b 100644
--- a/input/drivers_joypad/rwebpad_joypad.c
+++ b/input/drivers_joypad/rwebpad_joypad.c
@@ -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;
diff --git a/input/drivers_joypad/sdl_joypad.c b/input/drivers_joypad/sdl_joypad.c
index 8a3c224ab6..2a0930995b 100644
--- a/input/drivers_joypad/sdl_joypad.c
+++ b/input/drivers_joypad/sdl_joypad.c
@@ -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));
diff --git a/input/drivers_joypad/switch_joypad.c b/input/drivers_joypad/switch_joypad.c
index 81b971294d..8e3c8282fe 100644
--- a/input/drivers_joypad/switch_joypad.c
+++ b/input/drivers_joypad/switch_joypad.c
@@ -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;
diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c
index 182fc034a0..abb664c66b 100644
--- a/input/drivers_joypad/udev_joypad.c
+++ b/input/drivers_joypad/udev_joypad.c
@@ -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;
}
diff --git a/input/drivers_joypad/xdk_joypad.c b/input/drivers_joypad/xdk_joypad.c
index 000540b4e1..9e36268437 100644
--- a/input/drivers_joypad/xdk_joypad.c
+++ b/input/drivers_joypad/xdk_joypad.c
@@ -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)
diff --git a/input/drivers_joypad/xinput_joypad.c b/input/drivers_joypad/xinput_joypad.c
index a77e9c9bc6..14c37e0b24 100644
--- a/input/drivers_joypad/xinput_joypad.c
+++ b/input/drivers_joypad/xinput_joypad.c
@@ -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);
}
}
diff --git a/input/input_remapping.c b/input/input_remapping.c
index 2f0859260d..25857ba935 100644
--- a/input/input_remapping.c
+++ b/input/input_remapping.c
@@ -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;
diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h
index 877fc250c8..392e6dc05c 100644
--- a/intl/msg_hash_it.h
+++ b/intl/msg_hash_it.h
@@ -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.")
diff --git a/libretro-common/cdrom/cdrom.c b/libretro-common/cdrom/cdrom.c
index b3fab7607a..23dfa89b3b 100644
--- a/libretro-common/cdrom/cdrom.c
+++ b/libretro-common/cdrom/cdrom.c
@@ -47,7 +47,7 @@
#endif
#if defined(__linux__) && !defined(ANDROID)
-#include
+#include
#include
#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;
diff --git a/libretro-common/compat/fopen_utf8.c b/libretro-common/compat/fopen_utf8.c
index 52b481e7e7..893afb83ea 100644
--- a/libretro-common/compat/fopen_utf8.c
+++ b/libretro-common/compat/fopen_utf8.c
@@ -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);
diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c
index f729b4051f..cb55f363bb 100644
--- a/libretro-common/file/config_file.c
+++ b/libretro-common/file/config_file.c
@@ -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
diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c
index 9b85d76855..d478f2842e 100644
--- a/libretro-common/file/file_path.c
+++ b/libretro-common/file/file_path.c
@@ -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__)
diff --git a/libretro-common/formats/tga/rtga.c b/libretro-common/formats/tga/rtga.c
index d39ea57bc0..4b61cc166e 100644
--- a/libretro-common/formats/tga/rtga.c
+++ b/libretro-common/formats/tga/rtga.c
@@ -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 */
diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h
index e4e7eb585d..ed3124265a 100644
--- a/libretro-common/include/file/config_file.h
+++ b/libretro-common/include/file/config_file.h
@@ -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.*/
diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h
index 8daec83601..1fd2f5b79c 100644
--- a/libretro-common/include/libretro.h
+++ b/libretro-common/include/libretro.h
@@ -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.
diff --git a/libretro-common/include/media/media_detect_cd.h b/libretro-common/include/media/media_detect_cd.h
new file mode 100644
index 0000000000..66181061c5
--- /dev/null
+++ b/libretro-common/include/media/media_detect_cd.h
@@ -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
+#include
+
+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
diff --git a/libretro-common/include/rthreads/rthreads.h b/libretro-common/include/rthreads/rthreads.h
index 93fc16195d..946c3492b5 100644
--- a/libretro-common/include/rthreads/rthreads.h
+++ b/libretro-common/include/rthreads/rthreads.h
@@ -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
diff --git a/libretro-common/media/media_detect_cd.c b/libretro-common/media/media_detect_cd.c
new file mode 100644
index 0000000000..7fd3c8a082
--- /dev/null
+++ b/libretro-common/media/media_detect_cd.c
@@ -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
+#include
+#include
+
+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;
+}
diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c
index 24df8ad5c4..c36e32ff07 100644
--- a/libretro-common/rthreads/rthreads.c
+++ b/libretro-common/rthreads/rthreads.c
@@ -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
diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c
index ce189f981c..1579c15068 100644
--- a/libretro-common/streams/file_stream.c
+++ b/libretro-common/streams/file_stream.c
@@ -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)
diff --git a/libretro-common/streams/file_stream_transforms.c b/libretro-common/streams/file_stream_transforms.c
index 330b9e18af..0a0cd54045 100644
--- a/libretro-common/streams/file_stream_transforms.c
+++ b/libretro-common/streams/file_stream_transforms.c
@@ -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)
diff --git a/libretro-common/vfs/vfs_implementation.c b/libretro-common/vfs/vfs_implementation.c
index 3842007a90..f0782c5c3e 100644
--- a/libretro-common/vfs/vfs_implementation.c
+++ b/libretro-common/vfs/vfs_implementation.c
@@ -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
diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c
index 0242782736..df66bd382d 100644
--- a/managers/cheat_manager.c
+++ b/managers/cheat_manager.c
@@ -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;
diff --git a/managers/core_option_manager.h b/managers/core_option_manager.h
index 82c7a49122..2116714e3c 100644
--- a/managers/core_option_manager.h
+++ b/managers/core_option_manager.h
@@ -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);
diff --git a/menu/cbs/menu_cbs_cancel.c b/menu/cbs/menu_cbs_cancel.c
index 8470677431..6fa4c04e03 100644
--- a/menu/cbs/menu_cbs_cancel.c
+++ b/menu/cbs/menu_cbs_cancel.c
@@ -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
diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c
index f33f010f60..1233df65ac 100644
--- a/menu/cbs/menu_cbs_get_value.c
+++ b/menu/cbs/menu_cbs_get_value.c
@@ -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);
diff --git a/menu/cbs/menu_cbs_info.c b/menu/cbs/menu_cbs_info.c
index ac3d407862..7ef42ade91 100644
--- a/menu/cbs/menu_cbs_info.c
+++ b/menu/cbs/menu_cbs_info.c
@@ -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);
diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c
index 44ef9f9287..db13b7c906 100644
--- a/menu/cbs/menu_cbs_ok.c
+++ b/menu/cbs/menu_cbs_ok.c
@@ -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))
{
diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c
index d94ec570d5..70032bbbc7 100644
--- a/menu/cbs/menu_cbs_sublabel.c
+++ b/menu/cbs/menu_cbs_sublabel.c
@@ -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 */
diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c
index 2fd28c3f96..babb92abcd 100644
--- a/menu/menu_displaylist.c
+++ b/menu/menu_displaylist.c
@@ -61,7 +61,8 @@
#endif
#ifdef HAVE_CDROM
-#include
+#include
+#include
#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:
diff --git a/menu/menu_setting.c b/menu/menu_setting.c
index e0f98aa69d..b4aada538c 100644
--- a/menu/menu_setting.c
+++ b/menu/menu_setting.c
@@ -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:
{
diff --git a/menu/menu_shader.c b/menu/menu_shader.c
index da82c043ea..ae4df7e23c 100644
--- a/menu/menu_shader.c
+++ b/menu/menu_shader.c
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
#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)
diff --git a/pkg/ctr/assets/2048_banner.png b/pkg/ctr/assets/2048_banner.png
index c110b894e6..f5ab7eaed3 100644
Binary files a/pkg/ctr/assets/2048_banner.png and b/pkg/ctr/assets/2048_banner.png differ
diff --git a/pkg/ctr/assets/4do.png b/pkg/ctr/assets/4do.png
index 7eab685bfb..2e2599ef4a 100644
Binary files a/pkg/ctr/assets/4do.png and b/pkg/ctr/assets/4do.png differ
diff --git a/pkg/ctr/assets/4do_banner.png b/pkg/ctr/assets/4do_banner.png
index c0fcbae420..ef2d124092 100644
Binary files a/pkg/ctr/assets/4do_banner.png and b/pkg/ctr/assets/4do_banner.png differ
diff --git a/pkg/ctr/assets/81.png b/pkg/ctr/assets/81.png
index 691add6e27..fbb4c39fde 100644
Binary files a/pkg/ctr/assets/81.png and b/pkg/ctr/assets/81.png differ
diff --git a/pkg/ctr/assets/81_banner.png b/pkg/ctr/assets/81_banner.png
index 8896cc5973..ae9a809b53 100644
Binary files a/pkg/ctr/assets/81_banner.png and b/pkg/ctr/assets/81_banner.png differ
diff --git a/pkg/ctr/assets/atari800.png b/pkg/ctr/assets/atari800.png
index 501edde06b..d0c240977f 100644
Binary files a/pkg/ctr/assets/atari800.png and b/pkg/ctr/assets/atari800.png differ
diff --git a/pkg/ctr/assets/atari800_banner.png b/pkg/ctr/assets/atari800_banner.png
index 4f93af10e3..1830e64163 100644
Binary files a/pkg/ctr/assets/atari800_banner.png and b/pkg/ctr/assets/atari800_banner.png differ
diff --git a/pkg/ctr/assets/dosbox_banner.png b/pkg/ctr/assets/dosbox_banner.png
index 905f917d56..c065232afe 100644
Binary files a/pkg/ctr/assets/dosbox_banner.png and b/pkg/ctr/assets/dosbox_banner.png differ
diff --git a/pkg/ctr/assets/fmsx.png b/pkg/ctr/assets/fmsx.png
index 6b62bc3285..eb76df16b0 100644
Binary files a/pkg/ctr/assets/fmsx.png and b/pkg/ctr/assets/fmsx.png differ
diff --git a/pkg/ctr/assets/fmsx_banner.png b/pkg/ctr/assets/fmsx_banner.png
index 0463689a6a..86aa4c2e16 100644
Binary files a/pkg/ctr/assets/fmsx_banner.png and b/pkg/ctr/assets/fmsx_banner.png differ
diff --git a/pkg/ctr/assets/freeintv.png b/pkg/ctr/assets/freeintv.png
index 3df7222f04..b5fb269c1a 100644
Binary files a/pkg/ctr/assets/freeintv.png and b/pkg/ctr/assets/freeintv.png differ
diff --git a/pkg/ctr/assets/freeintv_banner.png b/pkg/ctr/assets/freeintv_banner.png
index a3e13504c4..3cb419e3b0 100644
Binary files a/pkg/ctr/assets/freeintv_banner.png and b/pkg/ctr/assets/freeintv_banner.png differ
diff --git a/pkg/ctr/assets/fuse.png b/pkg/ctr/assets/fuse.png
index 93ddeebbd8..a56ad05f27 100644
Binary files a/pkg/ctr/assets/fuse.png and b/pkg/ctr/assets/fuse.png differ
diff --git a/pkg/ctr/assets/fuse_banner.png b/pkg/ctr/assets/fuse_banner.png
index 66f402b8f1..02278a65b3 100644
Binary files a/pkg/ctr/assets/fuse_banner.png and b/pkg/ctr/assets/fuse_banner.png differ
diff --git a/pkg/ctr/assets/gw.png b/pkg/ctr/assets/gw.png
index 94036488c2..dc039c782f 100644
Binary files a/pkg/ctr/assets/gw.png and b/pkg/ctr/assets/gw.png differ
diff --git a/pkg/ctr/assets/gw_banner.png b/pkg/ctr/assets/gw_banner.png
index c13466cf54..8c97d14512 100644
Binary files a/pkg/ctr/assets/gw_banner.png and b/pkg/ctr/assets/gw_banner.png differ
diff --git a/pkg/ctr/assets/handy.png b/pkg/ctr/assets/handy.png
index fe1f44e42b..aef0ffc934 100644
Binary files a/pkg/ctr/assets/handy.png and b/pkg/ctr/assets/handy.png differ
diff --git a/pkg/ctr/assets/handy_banner.png b/pkg/ctr/assets/handy_banner.png
index d8576a5cd3..2b6a21946e 100644
Binary files a/pkg/ctr/assets/handy_banner.png and b/pkg/ctr/assets/handy_banner.png differ
diff --git a/pkg/ctr/assets/mednafen_ngp.png b/pkg/ctr/assets/mednafen_ngp.png
index 70cdd30f09..364f3a79a6 100644
Binary files a/pkg/ctr/assets/mednafen_ngp.png and b/pkg/ctr/assets/mednafen_ngp.png differ
diff --git a/pkg/ctr/assets/mednafen_ngp_banner.png b/pkg/ctr/assets/mednafen_ngp_banner.png
index ce15124f2e..16572fe45b 100644
Binary files a/pkg/ctr/assets/mednafen_ngp_banner.png and b/pkg/ctr/assets/mednafen_ngp_banner.png differ
diff --git a/pkg/ctr/assets/mednafen_pce_fast.png b/pkg/ctr/assets/mednafen_pce_fast.png
index 5e280792be..5dc63c7ba2 100644
Binary files a/pkg/ctr/assets/mednafen_pce_fast.png and b/pkg/ctr/assets/mednafen_pce_fast.png differ
diff --git a/pkg/ctr/assets/mednafen_pce_fast_banner.png b/pkg/ctr/assets/mednafen_pce_fast_banner.png
index e86d4b38b0..690eda46ae 100644
Binary files a/pkg/ctr/assets/mednafen_pce_fast_banner.png and b/pkg/ctr/assets/mednafen_pce_fast_banner.png differ
diff --git a/pkg/ctr/assets/mednafen_vb.png b/pkg/ctr/assets/mednafen_vb.png
index ada5e8b68a..bee704a1ce 100644
Binary files a/pkg/ctr/assets/mednafen_vb.png and b/pkg/ctr/assets/mednafen_vb.png differ
diff --git a/pkg/ctr/assets/mednafen_vb_banner.png b/pkg/ctr/assets/mednafen_vb_banner.png
index 7349c53e38..e4bb717f8c 100644
Binary files a/pkg/ctr/assets/mednafen_vb_banner.png and b/pkg/ctr/assets/mednafen_vb_banner.png differ
diff --git a/pkg/ctr/assets/mednafen_wswan_banner.png b/pkg/ctr/assets/mednafen_wswan_banner.png
index 9b307d1f29..0ebf29767e 100644
Binary files a/pkg/ctr/assets/mednafen_wswan_banner.png and b/pkg/ctr/assets/mednafen_wswan_banner.png differ
diff --git a/pkg/ctr/assets/mgba.png b/pkg/ctr/assets/mgba.png
index 2e497b4635..99fe4216f7 100644
Binary files a/pkg/ctr/assets/mgba.png and b/pkg/ctr/assets/mgba.png differ
diff --git a/pkg/ctr/assets/mgba_banner.png b/pkg/ctr/assets/mgba_banner.png
index 46be827979..28c21b7af5 100644
Binary files a/pkg/ctr/assets/mgba_banner.png and b/pkg/ctr/assets/mgba_banner.png differ
diff --git a/pkg/ctr/assets/nekop2.png b/pkg/ctr/assets/nekop2.png
index 3114361c91..a856d1a533 100644
Binary files a/pkg/ctr/assets/nekop2.png and b/pkg/ctr/assets/nekop2.png differ
diff --git a/pkg/ctr/assets/nekop2_banner.png b/pkg/ctr/assets/nekop2_banner.png
index 13be556cf4..3339b9d315 100644
Binary files a/pkg/ctr/assets/nekop2_banner.png and b/pkg/ctr/assets/nekop2_banner.png differ
diff --git a/pkg/ctr/assets/np2kai.png b/pkg/ctr/assets/np2kai.png
index 3114361c91..63b415f1fe 100644
Binary files a/pkg/ctr/assets/np2kai.png and b/pkg/ctr/assets/np2kai.png differ
diff --git a/pkg/ctr/assets/np2kai_banner.png b/pkg/ctr/assets/np2kai_banner.png
index 1321318099..c431c7a801 100644
Binary files a/pkg/ctr/assets/np2kai_banner.png and b/pkg/ctr/assets/np2kai_banner.png differ
diff --git a/pkg/ctr/assets/nxengine_banner.png b/pkg/ctr/assets/nxengine_banner.png
index ab7c613e7f..63c32bf229 100644
Binary files a/pkg/ctr/assets/nxengine_banner.png and b/pkg/ctr/assets/nxengine_banner.png differ
diff --git a/pkg/ctr/assets/o2em.png b/pkg/ctr/assets/o2em.png
index db0595c3d3..dc8b780abe 100644
Binary files a/pkg/ctr/assets/o2em.png and b/pkg/ctr/assets/o2em.png differ
diff --git a/pkg/ctr/assets/o2em_banner.png b/pkg/ctr/assets/o2em_banner.png
index 86123b74c5..8e7d1f86cd 100644
Binary files a/pkg/ctr/assets/o2em_banner.png and b/pkg/ctr/assets/o2em_banner.png differ
diff --git a/pkg/ctr/assets/pcsx_rearmed.png b/pkg/ctr/assets/pcsx_rearmed.png
index d06c555ea5..3bcba35c0c 100644
Binary files a/pkg/ctr/assets/pcsx_rearmed.png and b/pkg/ctr/assets/pcsx_rearmed.png differ
diff --git a/pkg/ctr/assets/pcsx_rearmed_banner.png b/pkg/ctr/assets/pcsx_rearmed_banner.png
index be38d0c041..ac27604c81 100644
Binary files a/pkg/ctr/assets/pcsx_rearmed_banner.png and b/pkg/ctr/assets/pcsx_rearmed_banner.png differ
diff --git a/pkg/ctr/assets/prosystem.png b/pkg/ctr/assets/prosystem.png
index 018dc17e70..61ef4b0513 100644
Binary files a/pkg/ctr/assets/prosystem.png and b/pkg/ctr/assets/prosystem.png differ
diff --git a/pkg/ctr/assets/prosystem_banner.png b/pkg/ctr/assets/prosystem_banner.png
index 87308ad553..1d1ec4866e 100644
Binary files a/pkg/ctr/assets/prosystem_banner.png and b/pkg/ctr/assets/prosystem_banner.png differ
diff --git a/pkg/ctr/assets/snes9x2005_plus.png b/pkg/ctr/assets/snes9x2005_plus.png
index b415a6644e..a409b01682 100644
Binary files a/pkg/ctr/assets/snes9x2005_plus.png and b/pkg/ctr/assets/snes9x2005_plus.png differ
diff --git a/pkg/ctr/assets/snes9x2005_plus_banner.png b/pkg/ctr/assets/snes9x2005_plus_banner.png
index 41c98ddb78..b2244be37f 100644
Binary files a/pkg/ctr/assets/snes9x2005_plus_banner.png and b/pkg/ctr/assets/snes9x2005_plus_banner.png differ
diff --git a/pkg/ctr/assets/stella.png b/pkg/ctr/assets/stella.png
index c4a2c1e291..dc867aa9d5 100644
Binary files a/pkg/ctr/assets/stella.png and b/pkg/ctr/assets/stella.png differ
diff --git a/pkg/ctr/assets/stella_banner.png b/pkg/ctr/assets/stella_banner.png
index e9cc2e51a4..41d780518b 100644
Binary files a/pkg/ctr/assets/stella_banner.png and b/pkg/ctr/assets/stella_banner.png differ
diff --git a/pkg/ctr/assets/vecx.png b/pkg/ctr/assets/vecx.png
index 65d0e8fb4b..7105812675 100644
Binary files a/pkg/ctr/assets/vecx.png and b/pkg/ctr/assets/vecx.png differ
diff --git a/pkg/ctr/assets/vecx_banner.png b/pkg/ctr/assets/vecx_banner.png
index ad120c78eb..20c8bc352a 100644
Binary files a/pkg/ctr/assets/vecx_banner.png and b/pkg/ctr/assets/vecx_banner.png differ
diff --git a/pkg/ctr/assets/virtualjaguar.png b/pkg/ctr/assets/virtualjaguar.png
index 87856c2670..c34da76d3f 100644
Binary files a/pkg/ctr/assets/virtualjaguar.png and b/pkg/ctr/assets/virtualjaguar.png differ
diff --git a/pkg/ctr/assets/virtualjaguar_banner.png b/pkg/ctr/assets/virtualjaguar_banner.png
index 1c8fab5cb0..e114b2d7da 100644
Binary files a/pkg/ctr/assets/virtualjaguar_banner.png and b/pkg/ctr/assets/virtualjaguar_banner.png differ
diff --git a/pkg/ctr/assets/yabause.png b/pkg/ctr/assets/yabause.png
index a363fd4ef2..5427a33967 100644
Binary files a/pkg/ctr/assets/yabause.png and b/pkg/ctr/assets/yabause.png differ
diff --git a/pkg/ctr/assets/yabause_banner.png b/pkg/ctr/assets/yabause_banner.png
index ed72ed8cd6..1f6a2fd3b0 100644
Binary files a/pkg/ctr/assets/yabause_banner.png and b/pkg/ctr/assets/yabause_banner.png differ
diff --git a/playlist.c b/playlist.c
index 20fbe20075..166c6591d4 100644
--- a/playlist.c
+++ b/playlist.c
@@ -639,9 +639,19 @@ bool playlist_push(playlist_t *playlist,
const char *core_name = entry->core_name;
bool entry_updated = false;
+#ifdef HAVE_COCOATOUCH
+ char abbreviated_path[PATH_MAX_LENGTH];
+ char abbreviated_core_path[PATH_MAX_LENGTH];
+#endif
+
real_path[0] = '\0';
real_core_path[0] = '\0';
+#ifdef HAVE_COCOATOUCH
+ abbreviated_path[0] = '\0';
+ abbreviated_core_path[0] = '\0';
+#endif
+
if (!playlist || !entry)
return false;
@@ -656,6 +666,11 @@ bool playlist_push(playlist_t *playlist,
{
strlcpy(real_path, entry->path, sizeof(real_path));
path_resolve_realpath(real_path, sizeof(real_path));
+#ifdef HAVE_COCOATOUCH
+ strlcpy(abbreviated_path, real_path, sizeof(abbreviated_path));
+ fill_pathname_abbreviate_special(abbreviated_path, real_path, sizeof(abbreviated_path));
+ strlcpy(real_path, abbreviated_path, sizeof(real_path));
+#endif
}
/* Get 'real' core path */
@@ -668,6 +683,11 @@ bool playlist_push(playlist_t *playlist,
RARCH_ERR("cannot push NULL or empty core path into the playlist.\n");
return false;
}
+#ifdef HAVE_COCOATOUCH
+ strlcpy(abbreviated_core_path, real_core_path, sizeof(abbreviated_core_path));
+ fill_pathname_abbreviate_special(abbreviated_core_path, real_core_path, sizeof(abbreviated_core_path));
+ strlcpy(real_core_path, abbreviated_core_path, sizeof(real_core_path));
+#endif
if (string_is_empty(core_name))
{
@@ -797,10 +817,11 @@ bool playlist_push(playlist_t *playlist,
if (playlist->size == playlist->cap)
{
- struct playlist_entry *entry = &playlist->entries[playlist->cap - 1];
+ struct playlist_entry *last_entry =
+ &playlist->entries[playlist->cap - 1];
- if (entry)
- playlist_free_entry(entry);
+ if (last_entry)
+ playlist_free_entry(last_entry);
playlist->size--;
}
diff --git a/qb/config.libs.sh b/qb/config.libs.sh
index 40684f3310..d43768018d 100644
--- a/qb/config.libs.sh
+++ b/qb/config.libs.sh
@@ -137,12 +137,12 @@ check_lib '' THREADS "$PTHREADLIB" pthread_create
check_enabled THREADS THREAD_STORAGE 'Thread Local Storage' 'Threads are' false
check_lib '' THREAD_STORAGE "$PTHREADLIB" pthread_key_create
-if [ "$HAVE_NO_CDROM" = "" ]; then
- if [ "$OS" = 'Win32' ] || [ "$OS" = 'Linux' ]; then
- HAVE_CDROM=yes
- fi
+if [ "$OS" = 'Linux' ]; then
+ check_header CDROM sys/ioctl.h scsi/sg.h
fi
+check_platform 'Linux Win32' CDROM 'CD-ROM is' user
+
if [ "$OS" = 'Win32' ]; then
HAVE_DYLIB=yes
else
diff --git a/qb/config.params.sh b/qb/config.params.sh
index c867312d1e..439727e673 100644
--- a/qb/config.params.sh
+++ b/qb/config.params.sh
@@ -144,4 +144,4 @@ HAVE_VIDEOPROCESSOR=auto # Enable video processor core
HAVE_VIDEOCORE=auto # Broadcom Videocore 4 support
HAVE_DRMINGW=no # DrMingw exception handler
HAVE_EASTEREGG=yes # Easter egg
-HAVE_CDROM=no
+HAVE_CDROM=auto # CD-ROM support
diff --git a/qb/qb.init.sh b/qb/qb.init.sh
index 405340e25c..e883248f66 100644
--- a/qb/qb.init.sh
+++ b/qb/qb.init.sh
@@ -41,3 +41,19 @@ exists()
done
return $v
}
+
+# match:
+# Compares a variable against a list of variables
+# $1 = variable
+# $@ = list of variables
+match()
+{
+ var="$1"
+ shift
+ for string do
+ case "$string" in
+ "$var" ) return 0 ;;
+ esac
+ done
+ return 1
+}
diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh
index 74c193a92c..9f5135f8ec 100644
--- a/qb/qb.libs.sh
+++ b/qb/qb.libs.sh
@@ -82,30 +82,45 @@ check_enabled()
}
# check_platform:
-# $1 = OS
+# $1 = OS ['OS' or 'OS OS2 OS3', $1 = name]
# $2 = HAVE_$2
# $3 = feature
-# $4 = enable feature when true [checked only if non-empty]
+# $4 = enable feature when 'true', disable errors with 'user' [checked only if non-empty]
check_platform()
{ tmpval="$(eval "printf %s \"\$HAVE_$2\"")"
[ "$tmpval" = 'no' ] && return 0
+ error=
+ newval=
setval="$(eval "printf %s \"\$USER_$2\"")"
- if [ "$setval" = 'yes' ]; then
- if { [ "$1" != "$OS" ] && [ "${4:-}" = 'true' ]; } ||
- { [ "$1" = "$OS" ] &&
- [ "${4:-}" != 'true' ]; }; then
- die 1 "Error: $3 not supported for $OS."
+ for platform in $(printf %s "$1"); do
+ if [ "$setval" = 'yes' ]; then
+ if [ "$error" != 'no' ] && [ "${4:-}" != 'user' ] &&
+ { { [ "$platform" != "$OS" ] &&
+ match "${4:-}" true user; } ||
+ { [ "$platform" = "$OS" ] &&
+ ! match "${4:-}" true user; }; }; then
+ error='yes'
+ elif match "${4:-}" true user; then
+ error='no'
+ fi
+ elif [ "$platform" = "$OS" ]; then
+ if match "${4:-}" true user; then
+ newval=yes
+ break
+ else
+ newval=no
+ fi
+ elif match "${4:-}" true user; then
+ newval=auto
fi
- elif [ "$1" = "$OS" ]; then
- if [ "${4:-}" = 'true' ]; then
- eval "HAVE_$2=yes"
- else
- eval "HAVE_$2=no"
- fi
- elif [ "${4:-}" = 'true' ]; then
- eval "HAVE_$2="
+ done
+
+ if [ "${error}" = 'yes' ]; then
+ die 1 "Error: $3 not supported for $OS."
+ else
+ eval "HAVE_$2=\"${newval:-$tmpval}\""
fi
}
diff --git a/retroarch.c b/retroarch.c
index 70a895e65d..3ba5294b40 100644
--- a/retroarch.c
+++ b/retroarch.c
@@ -35,6 +35,9 @@
#endif
#endif
+#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
+#include
+#endif
#include
#include
@@ -183,7 +186,6 @@
#include "retroarch.h"
#ifdef HAVE_RUNAHEAD
-#include "runahead/copy_load_info.h"
#include "runahead/mylist.h"
#include "runahead/mem_util.h"
#endif
@@ -645,7 +647,6 @@ static const ui_companion_driver_t *ui_companion_drivers[] = {
#ifdef HAVE_COCOATOUCH
&ui_companion_cocoatouch,
#endif
- &ui_companion_null,
NULL
};
@@ -1357,7 +1358,9 @@ typedef struct input_remote_state
uint64_t buttons[MAX_USERS];
} input_remote_state_t;
+#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD)
static input_remote_state_t remote_st_ptr;
+#endif
/* INPUT OVERLAY GLOBAL VARIABLES */
#ifdef HAVE_OVERLAY
@@ -1421,21 +1424,6 @@ struct input_bind_map
uint8_t retro_key;
};
-static const uint8_t buttons[] = {
- RETRO_DEVICE_ID_JOYPAD_R,
- RETRO_DEVICE_ID_JOYPAD_L,
- RETRO_DEVICE_ID_JOYPAD_X,
- RETRO_DEVICE_ID_JOYPAD_A,
- RETRO_DEVICE_ID_JOYPAD_RIGHT,
- RETRO_DEVICE_ID_JOYPAD_LEFT,
- RETRO_DEVICE_ID_JOYPAD_DOWN,
- RETRO_DEVICE_ID_JOYPAD_UP,
- RETRO_DEVICE_ID_JOYPAD_START,
- RETRO_DEVICE_ID_JOYPAD_SELECT,
- RETRO_DEVICE_ID_JOYPAD_Y,
- RETRO_DEVICE_ID_JOYPAD_B,
-};
-
static pad_connection_listener_t *pad_connection_listener = NULL;
static uint16_t input_config_vid[MAX_USERS];
@@ -1602,16 +1590,15 @@ static const void *hid_data = NULL;
#endif
#if defined(HAVE_RUNAHEAD)
-#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
+static enum rarch_core_type last_core_type;
+static retro_ctx_load_content_info_t *load_content_info;
+#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
/* Forward declarations */
static bool secondary_core_create(void);
static int16_t input_state_get_last(unsigned port,
unsigned device, unsigned index, unsigned id);
-extern retro_ctx_load_content_info_t *load_content_info;
-extern enum rarch_core_type last_core_type;
-
/* RUNAHEAD - SECONDARY CORE GLOBAL VARIABLES */
static int port_map[16];
@@ -1623,6 +1610,12 @@ static char *secondary_library_path = NULL;
#endif
/* Forward declarations */
+static bool driver_location_get_position(double *lat, double *lon,
+ double *horiz_accuracy, double *vert_accuracy);
+static void driver_location_set_interval(unsigned interval_msecs,
+ unsigned interval_distance);
+static void driver_location_stop(void);
+static bool driver_location_start(void);
static void driver_camera_stop(void);
static bool driver_camera_start(void);
static retro_proc_address_t video_driver_get_proc_address(const char *sym);
@@ -1680,6 +1673,156 @@ void *video_driver_get_ptr(bool force_nonthreaded_data)
return video_driver_get_ptr_internal(force_nonthreaded_data);
}
+/* FRONTEND */
+
+/* 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 = configuration_settings;
+
+ 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
+
/* CORE OPTIONS */
static bool core_option_manager_parse_variable(
core_option_manager_t *opt, size_t idx,
@@ -1691,6 +1834,9 @@ static bool core_option_manager_parse_variable(
char *config_val = NULL;
struct core_option *option = (struct core_option*)&opt->opts[idx];
+ /* All options are visible by default */
+ option->visible = true;
+
if (!string_is_empty(var->key))
option->key = strdup(var->key);
if (!string_is_empty(var->value))
@@ -1713,6 +1859,18 @@ static bool core_option_manager_parse_variable(
if (!option->vals)
goto error;
+ /* Legacy core option interface has no concept of
+ * value labels - use actual values for display purposes */
+ option->val_labels = string_list_clone(option->vals);
+
+ if (!option->val_labels)
+ goto error;
+
+ /* Legacy core option interface always uses first
+ * defined value as the default */
+ option->default_index = 0;
+ option->index = 0;
+
if (config_get_string(opt->conf, option->key, &config_val))
{
size_t i;
@@ -1738,6 +1896,94 @@ error:
return false;
}
+static bool core_option_manager_parse_option(
+ core_option_manager_t *opt, size_t idx,
+ const struct retro_core_option_definition *option_def)
+{
+ size_t i;
+ union string_list_elem_attr attr;
+ size_t num_vals = 0;
+ char *config_val = NULL;
+ struct core_option *option = (struct core_option*)&opt->opts[idx];
+ const struct retro_core_option_value *values = option_def->values;
+
+ /* All options are visible by default */
+ option->visible = true;
+
+ if (!string_is_empty(option_def->key))
+ option->key = strdup(option_def->key);
+
+ if (!string_is_empty(option_def->desc))
+ option->desc = strdup(option_def->desc);
+
+ if (!string_is_empty(option_def->info))
+ option->info = strdup(option_def->info);
+
+ /* Get number of values */
+ while (true)
+ {
+ if (!string_is_empty(values[num_vals].value))
+ num_vals++;
+ else
+ break;
+ }
+
+ if (num_vals < 1)
+ return false;
+
+ /* Initialise string lists */
+ attr.i = 0;
+ option->vals = string_list_new();
+ option->val_labels = string_list_new();
+
+ if (!option->vals || !option->val_labels)
+ return false;
+
+ /* Initialse default value */
+ option->default_index = 0;
+ option->index = 0;
+
+ /* Extract value/label pairs */
+ for (i = 0; i < num_vals; i++)
+ {
+ /* We know that 'value' is valid */
+ string_list_append(option->vals, values[i].value, attr);
+
+ /* Value 'label' may be NULL */
+ if (!string_is_empty(values[i].label))
+ string_list_append(option->val_labels, values[i].label, attr);
+ else
+ string_list_append(option->val_labels, values[i].value, attr);
+
+ /* Check whether this value is the default setting */
+ if (!string_is_empty(option_def->default_value))
+ {
+ if (string_is_equal(option_def->default_value, values[i].value))
+ {
+ option->default_index = i;
+ option->index = i;
+ }
+ }
+ }
+
+ /* Set current config value */
+ if (config_get_string(opt->conf, option->key, &config_val))
+ {
+ for (i = 0; i < option->vals->size; i++)
+ {
+ if (string_is_equal(option->vals->elems[i].data, config_val))
+ {
+ option->index = i;
+ break;
+ }
+ }
+
+ free(config_val);
+ }
+
+ return true;
+}
+
/**
* core_option_manager_free:
* @opt : options manager handle
@@ -1755,13 +2001,18 @@ static void core_option_manager_free(core_option_manager_t *opt)
{
if (opt->opts[i].desc)
free(opt->opts[i].desc);
+ if (opt->opts[i].info)
+ free(opt->opts[i].info);
if (opt->opts[i].key)
free(opt->opts[i].key);
if (opt->opts[i].vals)
string_list_free(opt->opts[i].vals);
+ if (opt->opts[i].val_labels)
+ string_list_free(opt->opts[i].val_labels);
opt->opts[i].desc = NULL;
+ opt->opts[i].info = NULL;
opt->opts[i].key = NULL;
opt->opts[i].vals = NULL;
}
@@ -1800,15 +2051,16 @@ static void core_option_manager_get(core_option_manager_t *opt,
}
/**
- * core_option_manager_new:
+ * core_option_manager_new_vars:
* @conf_path : Filesystem path to write core option config file to.
* @vars : Pointer to variable array handle.
*
+ * Legacy version of core_option_manager_new().
* Creates and initializes a core manager handle.
*
* Returns: handle to new core manager handle, otherwise NULL.
**/
-static core_option_manager_t *core_option_manager_new(const char *conf_path,
+static core_option_manager_t *core_option_manager_new_vars(const char *conf_path,
const struct retro_variable *vars)
{
const struct retro_variable *var;
@@ -1820,15 +2072,25 @@ static core_option_manager_t *core_option_manager_new(const char *conf_path,
return NULL;
if (!string_is_empty(conf_path))
- opt->conf = config_file_new(conf_path);
+ {
+ int64_t length = 0;
+ uint8_t *ret_buf = NULL;
+
+ if (filestream_read_file(conf_path, (void**)&ret_buf, &length))
+ {
+ if (length >= 0)
+ if ((opt->conf = config_file_new_from_string((const char*)ret_buf)))
+ opt->conf->path = strdup(conf_path);
+ free((void*)ret_buf);
+ }
+ }
+
if (!opt->conf)
- opt->conf = config_file_new(NULL);
+ if (!(opt->conf = config_file_new_alloc()))
+ goto error;
strlcpy(opt->conf_path, conf_path, sizeof(opt->conf_path));
- if (!opt->conf)
- goto error;
-
for (var = vars; var->key && var->value; var++)
size++;
@@ -1855,6 +2117,78 @@ error:
return NULL;
}
+/**
+ * core_option_manager_new:
+ * @conf_path : Filesystem path to write core option config file to.
+ * @option_defs : Pointer to variable array handle.
+ *
+ * Creates and initializes a core manager handle.
+ *
+ * Returns: handle to new core manager handle, otherwise NULL.
+ **/
+static core_option_manager_t *core_option_manager_new(const char *conf_path,
+ const struct retro_core_option_definition *option_defs)
+{
+ const struct retro_core_option_definition *option_def;
+ size_t size = 0;
+ core_option_manager_t *opt = (core_option_manager_t*)
+ calloc(1, sizeof(*opt));
+
+ if (!opt)
+ return NULL;
+
+ if (!string_is_empty(conf_path))
+ {
+ int64_t length = 0;
+ uint8_t *ret_buf = NULL;
+
+ if (filestream_read_file(conf_path, (void**)&ret_buf, &length))
+ {
+ if (length >= 0)
+ if ((opt->conf = config_file_new_from_string((const char*)ret_buf)))
+ opt->conf->path = strdup(conf_path);
+ free((void*)ret_buf);
+ }
+ }
+
+ if (!opt->conf)
+ if (!(opt->conf = config_file_new_alloc()))
+ goto error;
+
+ strlcpy(opt->conf_path, conf_path, sizeof(opt->conf_path));
+
+ /* Note: 'option_def->info == NULL' is valid */
+ for (option_def = option_defs;
+ option_def->key && option_def->desc && option_def->values[0].value;
+ option_def++)
+ size++;
+
+ if (size == 0)
+ goto error;
+
+ opt->opts = (struct core_option*)calloc(size, sizeof(*opt->opts));
+ if (!opt->opts)
+ goto error;
+
+ opt->size = size;
+ size = 0;
+
+ /* Note: 'option_def->info == NULL' is valid */
+ for (option_def = option_defs;
+ option_def->key && option_def->desc && option_def->values[0].value;
+ size++, option_def++)
+ {
+ if (!core_option_manager_parse_option(opt, size, option_def))
+ goto error;
+ }
+
+ return opt;
+
+error:
+ core_option_manager_free(opt);
+ return NULL;
+}
+
/**
* core_option_manager_flush:
* @opt : options manager handle
@@ -1921,9 +2255,30 @@ const char *core_option_manager_get_desc(
{
if (!opt)
return NULL;
+ if (idx >= opt->size)
+ return NULL;
return opt->opts[idx].desc;
}
+/**
+ * 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)
+{
+ if (!opt)
+ return NULL;
+ if (idx >= opt->size)
+ return NULL;
+ return opt->opts[idx].info;
+}
+
/**
* core_option_manager_get_val:
* @opt : options manager handle
@@ -1938,10 +2293,52 @@ const char *core_option_manager_get_val(core_option_manager_t *opt, size_t idx)
struct core_option *option = NULL;
if (!opt)
return NULL;
+ if (idx >= opt->size)
+ return NULL;
option = (struct core_option*)&opt->opts[idx];
return option->vals->elems[option->index].data;
}
+/**
+ * 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)
+{
+ struct core_option *option = NULL;
+ if (!opt)
+ return NULL;
+ if (idx >= opt->size)
+ return NULL;
+ option = (struct core_option*)&opt->opts[idx];
+ return option->val_labels->elems[option->index].data;
+}
+
+/**
+ * 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)
+{
+ if (!opt)
+ return false;
+ if (idx >= opt->size)
+ return false;
+ return opt->opts[idx].visible;
+}
+
void core_option_manager_set_val(core_option_manager_t *opt,
size_t idx, size_t val_idx)
{
@@ -1949,6 +2346,8 @@ void core_option_manager_set_val(core_option_manager_t *opt,
if (!opt)
return;
+ if (idx >= opt->size)
+ return;
option = (struct core_option*)&opt->opts[idx];
option->index = val_idx % option->vals->size;
@@ -1967,11 +2366,171 @@ void core_option_manager_set_default(core_option_manager_t *opt, size_t idx)
{
if (!opt)
return;
+ if (idx >= opt->size)
+ return;
- opt->opts[idx].index = 0;
+ opt->opts[idx].index = opt->opts[idx].default_index;
opt->updated = true;
}
+static struct retro_core_option_definition *core_option_manager_get_definitions(
+ const struct retro_core_options_intl *core_options_intl)
+{
+ size_t i;
+ size_t num_options = 0;
+ struct retro_core_option_definition *option_defs_us = NULL;
+ struct retro_core_option_definition *option_defs_local = NULL;
+ struct retro_core_option_definition *option_defs = NULL;
+
+ if (!core_options_intl)
+ return NULL;
+
+ option_defs_us = core_options_intl->us;
+ option_defs_local = core_options_intl->local;
+
+ if (!option_defs_us)
+ return NULL;
+
+ /* Determine number of options */
+ while (true)
+ {
+ if (!string_is_empty(option_defs_us[num_options].key))
+ num_options++;
+ else
+ break;
+ }
+
+ if (num_options < 1)
+ return NULL;
+
+ /* Allocate output option_defs array
+ * > One extra entry required for terminating NULL entry
+ * > Note that calloc() sets terminating NULL entry and
+ * correctly 'nullifies' each values array */
+ option_defs = (struct retro_core_option_definition *)calloc(
+ num_options + 1, sizeof(struct retro_core_option_definition));
+
+ if (!option_defs)
+ return NULL;
+
+ /* Loop through options... */
+ for (i = 0; i < num_options; i++)
+ {
+ size_t j;
+ size_t num_values = 0;
+ const char *key = option_defs_us[i].key;
+ const char *local_desc = NULL;
+ const char *local_info = NULL;
+ struct retro_core_option_value *local_values = NULL;
+
+ /* Key is always taken from us english defs */
+ option_defs[i].key = key;
+
+ /* Default value is always taken from us english defs */
+ option_defs[i].default_value = option_defs_us[i].default_value;
+
+ /* Try to find corresponding entry in local defs array */
+ if (option_defs_local)
+ {
+ size_t index = 0;
+
+ while (true)
+ {
+ const char *local_key = option_defs_local[index].key;
+
+ if (!string_is_empty(local_key))
+ {
+ if (string_is_equal(key, local_key))
+ {
+ local_desc = option_defs_local[index].desc;
+ local_info = option_defs_local[index].info;
+ local_values = option_defs_local[index].values;
+ break;
+ }
+ else
+ index++;
+ }
+ else
+ break;
+ }
+ }
+
+ /* Set desc and info strings */
+ option_defs[i].desc = string_is_empty(local_desc) ? option_defs_us[i].desc : local_desc;
+ option_defs[i].info = string_is_empty(local_info) ? option_defs_us[i].info : local_info;
+
+ /* Determine number of values
+ * (always taken from us english defs) */
+ while (true)
+ {
+ if (!string_is_empty(option_defs_us[i].values[num_values].value))
+ num_values++;
+ else
+ break;
+ }
+
+ /* Copy values */
+ for (j = 0; j < num_values; j++)
+ {
+ const char *value = option_defs_us[i].values[j].value;
+ const char *local_label = NULL;
+
+ /* Value string is always taken from us english defs */
+ option_defs[i].values[j].value = value;
+
+ /* Try to find corresponding entry in local defs values array */
+ if (local_values)
+ {
+ size_t value_index = 0;
+
+ while (true)
+ {
+ const char *local_value = local_values[value_index].value;
+
+ if (!string_is_empty(local_value))
+ {
+ if (string_is_equal(value, local_value))
+ {
+ local_label = local_values[value_index].label;
+ break;
+ }
+ else
+ value_index++;
+ }
+ else
+ break;
+ }
+ }
+
+ /* Set value label string */
+ option_defs[i].values[j].label = string_is_empty(local_label) ?
+ option_defs_us[i].values[j].label : local_label;
+ }
+ }
+
+ return option_defs;
+}
+
+static void core_option_manager_set_display(core_option_manager_t *opt,
+ const char *key, bool visible)
+{
+ size_t i;
+
+ if (!opt || string_is_empty(key))
+ return;
+
+ for (i = 0; i < opt->size; i++)
+ {
+ if (string_is_empty(opt->opts[i].key))
+ continue;
+
+ if (string_is_equal(opt->opts[i].key, key))
+ {
+ opt->opts[i].visible = visible;
+ return;
+ }
+ }
+}
/* DYNAMIC LIBRETRO CORE */
@@ -2377,7 +2936,7 @@ static void rarch_log_libretro(enum retro_log_level level,
static void core_performance_counter_start(struct retro_perf_counter *perf)
{
- if (rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL))
+ if (runloop_perfcnt_enable)
{
perf->call_cnt++;
perf->start = cpu_features_get_perf_counter();
@@ -2386,7 +2945,7 @@ static void core_performance_counter_start(struct retro_perf_counter *perf)
static void core_performance_counter_stop(struct retro_perf_counter *perf)
{
- if (rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL))
+ if (runloop_perfcnt_enable)
perf->total += cpu_features_get_perf_counter() - perf->start;
}
@@ -2569,14 +3128,38 @@ bool rarch_environment_cb(unsigned cmd, void *data)
*(bool*)data = false;
break;
+ /* SET_VARIABLES: Legacy path */
case RETRO_ENVIRONMENT_SET_VARIABLES:
RARCH_LOG("Environ SET_VARIABLES.\n");
+ rarch_ctl(RARCH_CTL_CORE_OPTIONS_DEINIT, NULL);
+ rarch_ctl(RARCH_CTL_CORE_VARIABLES_INIT, data);
+
+ break;
+
+ case RETRO_ENVIRONMENT_SET_CORE_OPTIONS:
+ RARCH_LOG("Environ SET_CORE_OPTIONS.\n");
+
rarch_ctl(RARCH_CTL_CORE_OPTIONS_DEINIT, NULL);
rarch_ctl(RARCH_CTL_CORE_OPTIONS_INIT, data);
break;
+ case RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL:
+ RARCH_LOG("Environ RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL.\n");
+
+ rarch_ctl(RARCH_CTL_CORE_OPTIONS_DEINIT, NULL);
+ rarch_ctl(RARCH_CTL_CORE_OPTIONS_INTL_INIT, data);
+
+ break;
+
+ case RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY:
+ RARCH_LOG("Environ RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY.\n");
+
+ rarch_ctl(RARCH_CTL_CORE_OPTIONS_DISPLAY, data);
+
+ break;
+
case RETRO_ENVIRONMENT_SET_MESSAGE:
{
const struct retro_message *msg = (const struct retro_message*)data;
@@ -2961,8 +3544,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
RARCH_LOG("Environ GET_INPUT_DEVICE_CAPABILITIES.\n");
if (!current_input->get_capabilities || !current_input_data)
return false;
- else
- *mask = input_driver_get_capabilities();
+ *mask = input_driver_get_capabilities();
break;
}
@@ -2985,12 +3567,12 @@ bool rarch_environment_cb(unsigned cmd, void *data)
cb->start = driver_camera_start;
cb->stop = driver_camera_stop;
- rarch_ctl(RARCH_CTL_CAMERA_SET_CB, cb);
+ camera_cb = *cb;
if (cb->caps != 0)
- rarch_ctl(RARCH_CTL_CAMERA_SET_ACTIVE, NULL);
+ camera_driver_active = true;
else
- rarch_ctl(RARCH_CTL_CAMERA_UNSET_ACTIVE, NULL);
+ camera_driver_active = false;
break;
}
@@ -3008,7 +3590,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
if (system)
system->location_cb = *cb;
- rarch_ctl(RARCH_CTL_LOCATION_UNSET_ACTIVE, NULL);
+ location_driver_active = false;
break;
}
@@ -3396,7 +3978,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
result |= 4;
#endif
- if (data != NULL)
+ if (data)
{
int* result_p = (int*)data;
*result_p = result;
@@ -3432,6 +4014,11 @@ bool rarch_environment_cb(unsigned cmd, void *data)
/* Just falldown, the function will return true */
break;
+ case RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION:
+ /* Current API version is 1 */
+ *(unsigned *)data = 1;
+ break;
+
case RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE:
{
/* Try to use the polled refresh rate first. */
@@ -3771,7 +4358,7 @@ static bool init_libretro_symbols(enum rarch_core_type type, struct retro_core_t
#ifdef HAVE_RUNAHEAD
/* remember last core type created, so creating a
* secondary core will know what core type to use. */
- set_last_core_type(type);
+ last_core_type = type;
#endif
return true;
}
@@ -3805,14 +4392,95 @@ static void uninit_libretro_symbols(struct retro_core_t *current_core)
rarch_ctl(RARCH_CTL_CORE_OPTIONS_DEINIT, NULL);
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
rarch_ctl(RARCH_CTL_FRAME_TIME_FREE, NULL);
- rarch_ctl(RARCH_CTL_CAMERA_UNSET_ACTIVE, NULL);
- rarch_ctl(RARCH_CTL_LOCATION_UNSET_ACTIVE, NULL);
+ camera_driver_active = false;
+ location_driver_active = false;
/* Performance counters no longer valid. */
performance_counters_clear();
}
#if defined(HAVE_RUNAHEAD)
+static void free_retro_ctx_load_content_info(struct
+ retro_ctx_load_content_info *dest)
+{
+ if (!dest)
+ return;
+
+ core_free_retro_game_info(dest->info);
+ string_list_free((struct string_list*)dest->content);
+ if (dest->info)
+ free(dest->info);
+
+ dest->info = NULL;
+ dest->content = NULL;
+}
+
+static struct retro_game_info* clone_retro_game_info(const
+ struct retro_game_info *src)
+{
+ void *data = NULL;
+ struct retro_game_info *dest = NULL;
+
+ if (!src)
+ return NULL;
+
+ dest = (struct retro_game_info*)calloc(1,
+ sizeof(struct retro_game_info));
+ if (!dest)
+ return NULL;
+
+ dest->data = NULL;
+ dest->path = strcpy_alloc(src->path);
+
+ if (src->size && src->data)
+ {
+ data = malloc(src->size);
+
+ if (data)
+ {
+ memcpy(data, src->data, src->size);
+ dest->data = data;
+ }
+ }
+
+ dest->size = src->size;
+ dest->meta = strcpy_alloc(src->meta);
+
+ return dest;
+}
+
+
+static struct retro_ctx_load_content_info
+*clone_retro_ctx_load_content_info(
+ const struct retro_ctx_load_content_info *src)
+{
+ struct retro_ctx_load_content_info *dest = NULL;
+ if (!src || src->special)
+ return NULL; /* refuse to deal with the Special field */
+
+ dest = (struct retro_ctx_load_content_info*)
+ calloc(1, sizeof(*dest));
+
+ if (!dest)
+ return NULL;
+
+ dest->info = clone_retro_game_info(src->info);
+ dest->content = NULL;
+ dest->special = NULL;
+
+ if (src->content)
+ dest->content = string_list_clone(src->content);
+ return dest;
+}
+
+
+static void set_load_content_info(const retro_ctx_load_content_info_t *ctx)
+{
+ free_retro_ctx_load_content_info(load_content_info);
+ free(load_content_info);
+ load_content_info = clone_retro_ctx_load_content_info(ctx);
+}
+
/* RUNAHEAD - SECONDARY CORE */
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
static void secondary_core_destroy(void)
@@ -4077,82 +4745,80 @@ static bool secondary_core_create(void)
return false;
/* Load Core */
- if (init_libretro_symbols_custom(
+ if (!init_libretro_symbols_custom(
CORE_TYPE_PLAIN, &secondary_core,
secondary_library_path, &secondary_module))
- {
- secondary_core.symbols_inited = true;
- secondary_core.retro_set_environment(
- rarch_environment_secondary_core_hook);
+ return false;
+
+ secondary_core.symbols_inited = true;
+ secondary_core.retro_set_environment(
+ rarch_environment_secondary_core_hook);
#ifdef HAVE_RUNAHEAD
- has_variable_update = true;
+ has_variable_update = true;
#endif
- secondary_core.retro_init();
+ secondary_core.retro_init();
- content_get_status(&contentless, &is_inited);
- secondary_core.inited = is_inited;
+ content_get_status(&contentless, &is_inited);
+ secondary_core.inited = is_inited;
- /* Load Content */
- if (!load_content_info || load_content_info->special)
- {
- /* disabled due to crashes */
- return false;
+ /* Load Content */
+ if (!load_content_info || load_content_info->special)
+ {
+ /* disabled due to crashes */
+ return false;
#if 0
- secondary_core.game_loaded = secondary_core.retro_load_game_special(
- loadContentInfo.special->id, loadContentInfo.info, loadContentInfo.content->size);
- if (!secondary_core.game_loaded)
- {
- secondary_core_destroy();
- return false;
- }
-#endif
- }
- else if (load_content_info->content->size > 0 && load_content_info->content->elems[0].data)
- {
- secondary_core.game_loaded = secondary_core.retro_load_game(load_content_info->info);
- if (!secondary_core.game_loaded)
- {
- secondary_core_destroy();
- return false;
- }
- }
- else if (contentless)
- {
- secondary_core.game_loaded = secondary_core.retro_load_game(NULL);
- if (!secondary_core.game_loaded)
- {
- secondary_core_destroy();
- return false;
- }
- }
- else
- secondary_core.game_loaded = false;
-
- if (!secondary_core.inited)
+ secondary_core.game_loaded = secondary_core.retro_load_game_special(
+ loadContentInfo.special->id, loadContentInfo.info, loadContentInfo.content->size);
+ if (!secondary_core.game_loaded)
{
secondary_core_destroy();
return false;
}
-
- core_set_default_callbacks(&secondary_callbacks);
- secondary_core.retro_set_video_refresh(secondary_callbacks.frame_cb);
- secondary_core.retro_set_audio_sample(secondary_callbacks.sample_cb);
- secondary_core.retro_set_audio_sample_batch(secondary_callbacks.sample_batch_cb);
- secondary_core.retro_set_input_state(secondary_callbacks.state_cb);
- secondary_core.retro_set_input_poll(secondary_callbacks.poll_cb);
-
- for (port = 0; port < 16; port++)
+#endif
+ }
+ else if (load_content_info->content->size > 0 && load_content_info->content->elems[0].data)
+ {
+ secondary_core.game_loaded = secondary_core.retro_load_game(load_content_info->info);
+ if (!secondary_core.game_loaded)
{
- device = port_map[port];
- if (device >= 0)
- secondary_core.retro_set_controller_port_device(
- (unsigned)port, (unsigned)device);
+ secondary_core_destroy();
+ return false;
+ }
+ }
+ else if (contentless)
+ {
+ secondary_core.game_loaded = secondary_core.retro_load_game(NULL);
+ if (!secondary_core.game_loaded)
+ {
+ secondary_core_destroy();
+ return false;
}
- clear_controller_port_map();
}
else
+ secondary_core.game_loaded = false;
+
+ if (!secondary_core.inited)
+ {
+ secondary_core_destroy();
return false;
+ }
+
+ core_set_default_callbacks(&secondary_callbacks);
+ secondary_core.retro_set_video_refresh(secondary_callbacks.frame_cb);
+ secondary_core.retro_set_audio_sample(secondary_callbacks.sample_cb);
+ secondary_core.retro_set_audio_sample_batch(secondary_callbacks.sample_batch_cb);
+ secondary_core.retro_set_input_state(secondary_callbacks.state_cb);
+ secondary_core.retro_set_input_poll(secondary_callbacks.poll_cb);
+
+ for (port = 0; port < 16; port++)
+ {
+ device = port_map[port];
+ if (device >= 0)
+ secondary_core.retro_set_controller_port_device(
+ (unsigned)port, (unsigned)device);
+ }
+ clear_controller_port_map();
return true;
}
@@ -4414,27 +5080,6 @@ bool wifi_driver_ctl(enum rarch_wifi_ctl_state state, void *data)
/* UI COMPANION */
-/**
- * ui_companion_find_driver:
- * @ident : Identifier name of driver to find.
- *
- * Finds driver with @ident. Does not initialize.
- *
- * Returns: pointer to driver if successful, otherwise NULL.
- **/
-const ui_companion_driver_t *ui_companion_find_driver(const char *ident)
-{
- unsigned i;
-
- for (i = 0; ui_companion_drivers[i]; i++)
- {
- if (string_is_equal(ui_companion_drivers[i]->ident, ident))
- return ui_companion_drivers[i];
- }
-
- return NULL;
-}
-
void ui_companion_set_foreground(unsigned enable)
{
main_ui_companion_is_on_foreground = enable;
@@ -4445,18 +5090,6 @@ bool ui_companion_is_on_foreground(void)
return main_ui_companion_is_on_foreground;
}
-/**
- * ui_companion_init_first:
- *
- * Finds first suitable driver and initialize.
- *
- * Returns: pointer to first suitable driver, otherwise NULL.
- **/
-const ui_companion_driver_t *ui_companion_init_first(void)
-{
- return ui_companion_drivers[0];
-}
-
void ui_companion_event_command(enum event_command action)
{
const ui_companion_driver_t *ui = ui_companion;
@@ -4492,7 +5125,7 @@ void ui_companion_driver_init_first(void)
{
settings_t *settings = configuration_settings;
- ui_companion = (ui_companion_driver_t*)ui_companion_init_first();
+ ui_companion = (ui_companion_driver_t*)ui_companion_drivers[0];
#ifdef HAVE_QT
if (settings->bools.desktop_menu_enable && settings->bools.ui_companion_toggle)
@@ -4559,18 +5192,14 @@ void ui_companion_driver_notify_refresh(void)
void ui_companion_driver_notify_list_loaded(file_list_t *list, file_list_t *menu_list)
{
const ui_companion_driver_t *ui = ui_companion;
- if (!ui)
- return;
- if (ui->notify_list_loaded)
+ if (ui && ui->notify_list_loaded)
ui->notify_list_loaded(ui_companion_data, list, menu_list);
}
void ui_companion_driver_notify_content_loaded(void)
{
const ui_companion_driver_t *ui = ui_companion;
- if (!ui)
- return;
- if (ui->notify_content_loaded)
+ if (ui && ui->notify_content_loaded)
ui->notify_content_loaded(ui_companion_data);
}
@@ -4803,7 +5432,7 @@ static void recording_dump_frame(const void *data, unsigned width,
ffemu_data.pitch = (int)pitch;
ffemu_data.is_dupe = false;
- if (video_driver_record_gpu_buffer != NULL)
+ if (video_driver_record_gpu_buffer)
{
struct video_viewport vp;
@@ -6812,37 +7441,169 @@ static int16_t input_state_device(
{
int16_t res = 0;
settings_t *settings = configuration_settings;
-#ifdef HAVE_OVERLAY
- int16_t res_overlay = 0;
- if (overlay_ptr && port == 0)
+ switch (device)
{
- input_overlay_state_t *ol_state = &overlay_ptr->overlay_state;
+ case RETRO_DEVICE_JOYPAD:
- switch (device)
- {
- case RETRO_DEVICE_JOYPAD:
- if (input_overlay_key_pressed(overlay_ptr, id))
- res_overlay |= 1;
- break;
- case RETRO_DEVICE_KEYBOARD:
+#ifdef HAVE_NETWORKGAMEPAD
+ if (input_driver_remote)
+ if (input_remote_key_pressed(id, port))
+ res |= 1;
+#endif
+
+ if (id < RARCH_FIRST_META_KEY)
+ {
+ bool bind_valid = libretro_input_binds[port]
+ && libretro_input_binds[port][id].valid;
+
+ if (settings->bools.input_remap_binds_enable &&
+ id != settings->uints.input_remap_ids[port][id])
+ res = 0;
+ else if (bind_valid)
+ {
+ if (button_mask)
+ {
+ res = 0;
+ if (ret & (1 << id))
+ res |= (1 << id);
+ }
+ else
+ res = ret;
+
+#ifdef HAVE_OVERLAY
+ {
+ int16_t res_overlay = 0;
+ if (overlay_ptr && port == 0 && overlay_ptr->alive)
+ {
+ if (input_overlay_key_pressed(overlay_ptr, id))
+ res_overlay |= 1;
+ if (overlay_ptr->alive)
+ res |= res_overlay;
+ }
+ }
+#endif
+ }
+ }
+
+ if (settings->bools.input_remap_binds_enable && input_driver_mapper)
+ input_mapper_state(input_driver_mapper,
+ &res, port, device, idx, id);
+
+ /* Don't allow turbo for D-pad. */
+ if ((id < RETRO_DEVICE_ID_JOYPAD_UP || id > RETRO_DEVICE_ID_JOYPAD_RIGHT))
+ {
+ /*
+ * Apply turbo button if activated.
+ *
+ * If turbo button is held, all buttons pressed except
+ * for D-pad will go into a turbo mode. Until the button is
+ * released again, the input state will be modulated by a
+ * periodic pulse defined by the configured duty cycle.
+ */
+ if (res && input_driver_turbo_btns.frame_enable[port])
+ input_driver_turbo_btns.enable[port] |= (1 << id);
+ else if (!res)
+ input_driver_turbo_btns.enable[port] &= ~(1 << id);
+
+ if (input_driver_turbo_btns.enable[port] & (1 << id))
+ {
+ /* if turbo button is enabled for this key ID */
+ res = res && ((input_driver_turbo_btns.count
+ % settings->uints.input_turbo_period)
+ < settings->uints.input_turbo_duty_cycle);
+ }
+ }
+
+ break;
+
+ case RETRO_DEVICE_MOUSE:
+
+ if (id < RARCH_FIRST_META_KEY)
+ {
+ bool bind_valid = libretro_input_binds[port]
+ && libretro_input_binds[port][id].valid;
+
+ if (bind_valid)
+ {
+ if (button_mask)
+ {
+ res = 0;
+ if (ret & (1 << id))
+ res |= (1 << id);
+ }
+ else
+ res = ret;
+ }
+ }
+
+ if (settings->bools.input_remap_binds_enable && input_driver_mapper)
+ input_mapper_state(input_driver_mapper,
+ &res, port, device, idx, id);
+
+ break;
+
+ case RETRO_DEVICE_KEYBOARD:
+
+ res = ret;
+
+#ifdef HAVE_OVERLAY
+ if (overlay_ptr && port == 0)
+ {
+ int16_t res_overlay = 0;
if (id < RETROK_LAST)
{
-#if 0
- RARCH_LOG("UDLR %u %u %u %u\n",
- OVERLAY_GET_KEY(ol_state, RETROK_UP),
- OVERLAY_GET_KEY(ol_state, RETROK_DOWN),
- OVERLAY_GET_KEY(ol_state, RETROK_LEFT),
- OVERLAY_GET_KEY(ol_state, RETROK_RIGHT)
- );
-#endif
+ input_overlay_state_t *ol_state = &overlay_ptr->overlay_state;
if (OVERLAY_GET_KEY(ol_state, id))
res_overlay |= 1;
}
- break;
- case RETRO_DEVICE_ANALOG:
+
+ if (overlay_ptr->alive)
+ res |= res_overlay;
+ }
+#endif
+
+ if (settings->bools.input_remap_binds_enable && input_driver_mapper)
+ input_mapper_state(input_driver_mapper,
+ &res, port, device, idx, id);
+
+ break;
+
+ case RETRO_DEVICE_LIGHTGUN:
+
+ if (id < RARCH_FIRST_META_KEY)
+ {
+ bool bind_valid = libretro_input_binds[port]
+ && libretro_input_binds[port][id].valid;
+
+ if (bind_valid)
{
- unsigned base = 0;
+ if (button_mask)
+ {
+ res = 0;
+ if (ret & (1 << id))
+ res |= (1 << id);
+ }
+ else
+ res = ret;
+ }
+ }
+
+ if (settings->bools.input_remap_binds_enable && input_driver_mapper)
+ input_mapper_state(input_driver_mapper,
+ &res, port, device, idx, id);
+
+ break;
+
+ case RETRO_DEVICE_ANALOG:
+
+ {
+#ifdef HAVE_OVERLAY
+ int16_t res_overlay = 0;
+ if (overlay_ptr && port == 0)
+ {
+ unsigned base = 0;
+ input_overlay_state_t *ol_state = &overlay_ptr->overlay_state;
if (idx == RETRO_DEVICE_INDEX_ANALOG_RIGHT)
base = 2;
@@ -6851,162 +7612,8 @@ static int16_t input_state_device(
if (ol_state && ol_state->analog[base])
res_overlay = ol_state->analog[base];
}
- break;
- }
- }
#endif
- switch (device)
- {
- case RETRO_DEVICE_JOYPAD:
- {
-#ifdef HAVE_NETWORKGAMEPAD
- if (input_driver_remote)
- if (input_remote_key_pressed(id, port))
- res |= 1;
-#endif
-
- if (id < RARCH_FIRST_META_KEY)
- {
- bool bind_valid = libretro_input_binds[port]
- && libretro_input_binds[port][id].valid;
-
- if (settings->bools.input_remap_binds_enable &&
- id != settings->uints.input_remap_ids[port][id])
- res = 0;
- else if (bind_valid)
- {
- if (button_mask)
- {
- res = 0;
- if (ret & (1 << id))
- res |= (1 << id);
- }
- else
- res = ret;
-
-#ifdef HAVE_OVERLAY
- if (overlay_ptr && overlay_ptr->alive && port == 0)
- res |= res_overlay;
-#endif
- }
- }
-
- if (settings->bools.input_remap_binds_enable && input_driver_mapper)
- input_mapper_state(input_driver_mapper,
- &res, port, device, idx, id);
-
- /* Don't allow turbo for D-pad. */
- if ((id < RETRO_DEVICE_ID_JOYPAD_UP || id > RETRO_DEVICE_ID_JOYPAD_RIGHT))
- {
- /*
- * Apply turbo button if activated.
- *
- * If turbo button is held, all buttons pressed except
- * for D-pad will go into a turbo mode. Until the button is
- * released again, the input state will be modulated by a
- * periodic pulse defined by the configured duty cycle.
- */
- if (res && input_driver_turbo_btns.frame_enable[port])
- input_driver_turbo_btns.enable[port] |= (1 << id);
- else if (!res)
- input_driver_turbo_btns.enable[port] &= ~(1 << id);
-
- if (input_driver_turbo_btns.enable[port] & (1 << id))
- {
- /* if turbo button is enabled for this key ID */
- res = res && ((input_driver_turbo_btns.count
- % settings->uints.input_turbo_period)
- < settings->uints.input_turbo_duty_cycle);
- }
- }
- }
-
- break;
-
- case RETRO_DEVICE_MOUSE:
-
- {
- if (id < RARCH_FIRST_META_KEY)
- {
- bool bind_valid = libretro_input_binds[port]
- && libretro_input_binds[port][id].valid;
-
- if (bind_valid)
- {
- if (button_mask)
- {
- res = 0;
- if (ret & (1 << id))
- res |= (1 << id);
- }
- else
- res = ret;
-
-#ifdef HAVE_OVERLAY
- if (overlay_ptr && overlay_ptr->alive && port == 0)
- res |= res_overlay;
-#endif
- }
- }
-
- if (settings->bools.input_remap_binds_enable && input_driver_mapper)
- input_mapper_state(input_driver_mapper,
- &res, port, device, idx, id);
- }
- break;
-
- case RETRO_DEVICE_KEYBOARD:
-
- {
- res = ret;
-
-#ifdef HAVE_OVERLAY
- if (overlay_ptr && overlay_ptr->alive && port == 0)
- res |= res_overlay;
-#endif
-
- if (settings->bools.input_remap_binds_enable && input_driver_mapper)
- input_mapper_state(input_driver_mapper,
- &res, port, device, idx, id);
- }
- break;
-
- case RETRO_DEVICE_LIGHTGUN:
-
- {
- if (id < RARCH_FIRST_META_KEY)
- {
- bool bind_valid = libretro_input_binds[port]
- && libretro_input_binds[port][id].valid;
-
- if (bind_valid)
- {
- if (button_mask)
- {
- res = 0;
- if (ret & (1 << id))
- res |= (1 << id);
- }
- else
- res = ret;
-
-#ifdef HAVE_OVERLAY
- if (overlay_ptr && overlay_ptr->alive && port == 0)
- res |= res_overlay;
-#endif
- }
- }
-
- if (settings->bools.input_remap_binds_enable && input_driver_mapper)
- input_mapper_state(input_driver_mapper,
- &res, port, device, idx, id);
- }
- break;
-
- case RETRO_DEVICE_ANALOG:
-
- {
#ifdef HAVE_NETWORKGAMEPAD
if (input_driver_remote)
{
@@ -7073,34 +7680,28 @@ static int16_t input_state_device(
case RETRO_DEVICE_POINTER:
+ if (id < RARCH_FIRST_META_KEY)
{
- if (id < RARCH_FIRST_META_KEY)
+ bool bind_valid = libretro_input_binds[port]
+ && libretro_input_binds[port][id].valid;
+
+ if (bind_valid)
{
- bool bind_valid = libretro_input_binds[port]
- && libretro_input_binds[port][id].valid;
-
- if (bind_valid)
+ if (button_mask)
{
- if (button_mask)
- {
- res = 0;
- if (ret & (1 << id))
- res |= (1 << id);
- }
- else
- res = ret;
-
-#ifdef HAVE_OVERLAY
- if (overlay_ptr && overlay_ptr->alive && port == 0)
- res |= res_overlay;
-#endif
+ res = 0;
+ if (ret & (1 << id))
+ res |= (1 << id);
}
+ else
+ res = ret;
}
-
- if (settings->bools.input_remap_binds_enable && input_driver_mapper)
- input_mapper_state(input_driver_mapper,
- &res, port, device, idx, id);
}
+
+ if (settings->bools.input_remap_binds_enable && input_driver_mapper)
+ input_mapper_state(input_driver_mapper,
+ &res, port, device, idx, id);
+
break;
}
@@ -7139,32 +7740,26 @@ static int16_t input_state(unsigned port, unsigned device,
device &= RETRO_DEVICE_MASK;
ret = current_input->input_state(
- current_input_data, joypad_info, libretro_input_binds, port, device, idx, id);
-
- if ( (device == RETRO_DEVICE_JOYPAD) &&
- (id == RETRO_DEVICE_ID_JOYPAD_MASK))
- {
- unsigned i;
- int16_t res = 0;
-
- if ( !input_driver_flushing_input
- && !input_driver_block_libretro_input)
- {
- for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
- if (input_state_device(ret, port, device, idx, i, true))
- res |= (1 << i);
- }
- if (BSV_MOVIE_IS_PLAYBACK_OFF())
- {
- res = swap_if_big16(res);
- intfstream_write(bsv_movie_state_handle->file, &res, 1);
- }
- return res;
- }
+ current_input_data, joypad_info,
+ libretro_input_binds, port, device, idx, id);
if ( !input_driver_flushing_input
&& !input_driver_block_libretro_input)
- result = input_state_device(ret, port, device, idx, id, false);
+ {
+ if ( (device == RETRO_DEVICE_JOYPAD) &&
+ (id == RETRO_DEVICE_ID_JOYPAD_MASK))
+ {
+ unsigned i;
+
+ {
+ for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
+ if (input_state_device(ret, port, device, idx, i, true))
+ result |= (1 << i);
+ }
+ }
+ else
+ result = input_state_device(ret, port, device, idx, id, false);
+ }
if (BSV_MOVIE_IS_PLAYBACK_OFF())
{
@@ -8969,9 +9564,8 @@ void input_pad_connect(unsigned port, input_device_driver_t *driver)
fire_connection_listener(port, driver);
- if (!input_autoconfigure_connect(driver->name(port), NULL, driver->ident,
- port, 0, 0))
- input_config_set_device_name(port, driver->name(port));
+ input_autoconfigure_connect(driver->name(port), NULL, driver->ident,
+ port, 0, 0);
}
#ifdef HAVE_HID
@@ -9154,7 +9748,7 @@ static bool input_keyboard_line_event(
word = array;
}
- if (word != NULL)
+ if (word)
{
/* OSK - update last character */
if (word[0] == 0)
@@ -10451,7 +11045,7 @@ bool midi_driver_init(void)
err_str = "driver init failed";
else
{
- midi_drv_input_enabled = input != NULL;
+ midi_drv_input_enabled = input != NULL;
midi_drv_output_enabled = output != NULL;
if (!midi_driver_init_io_buffers())
@@ -12982,7 +13576,7 @@ static bool video_driver_init_internal(bool *video_is_threaded)
video.width = width;
video.height = height;
video.fullscreen = settings->bools.video_fullscreen || retroarch_is_forced_fullscreen();
- video.vsync = settings->bools.video_vsync && !rarch_ctl(RARCH_CTL_IS_NONBLOCK_FORCED, NULL);
+ video.vsync = settings->bools.video_vsync && !runloop_force_nonblock;
video.force_aspect = settings->bools.video_force_aspect;
video.font_enable = settings->bools.video_font_enable;
video.swap_interval = settings->uints.video_swap_interval;
@@ -13394,7 +13988,7 @@ static void video_driver_monitor_adjust_system_rates(void)
float timing_skew_hz = video_refresh_rate;
const struct retro_system_timing *info = (const struct retro_system_timing*)&video_driver_av_info.timing;
- rarch_ctl(RARCH_CTL_UNSET_NONBLOCK_FORCED, NULL);
+ runloop_force_nonblock = false;
if (!info || info->fps <= 0.0)
return;
@@ -13423,7 +14017,7 @@ static void video_driver_monitor_adjust_system_rates(void)
return;
/* We won't be able to do VSync reliably when game FPS > monitor FPS. */
- rarch_ctl(RARCH_CTL_SET_NONBLOCK_FORCED, NULL);
+ runloop_force_nonblock = true;
RARCH_LOG("[Video]: Game FPS > Monitor FPS. Cannot rely on VSync.\n");
}
@@ -14454,10 +15048,6 @@ bool video_driver_texture_unload(uintptr_t *id)
void video_driver_build_info(video_frame_info_t *video_info)
{
- bool is_perfcnt_enable = false;
- bool is_paused = false;
- bool is_idle = false;
- bool is_slowmotion = false;
video_viewport_t *custom_vp = NULL;
struct retro_hw_render_callback *hwr =
video_driver_get_hw_context_internal();
@@ -14934,7 +15524,7 @@ bool video_context_driver_get_refresh_rate(float *refresh_rate)
if (refresh_rate)
refresh_holder =
current_video_context.get_refresh_rate(video_context_data);
- if (refresh_holder != video_driver_core_hz) /* Fix for incorrect interlace detsction -- HARD SET VSNC TO REQUIRED REFRESH FOR CRT*/
+ if (refresh_holder != video_driver_core_hz) /* Fix for incorrect interlacing detection -- HARD SET VSNC TO REQUIRED REFRESH FOR CRT*/
*refresh_rate = video_driver_core_hz;
}
@@ -15289,7 +15879,7 @@ static void find_location_driver(void)
*
* Returns: true (1) if successful, otherwise false (0).
**/
-bool driver_location_start(void)
+static bool driver_location_start(void)
{
if (location_driver && location_data && location_driver->start)
{
@@ -15310,7 +15900,7 @@ bool driver_location_start(void)
*
* Returns: true (1) if successful, otherwise false (0).
**/
-void driver_location_stop(void)
+static void driver_location_stop(void)
{
if (location_driver && location_driver->stop && location_data)
location_driver->stop(location_data);
@@ -15324,7 +15914,7 @@ void driver_location_stop(void)
* Sets interval update time for location driver interface.
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
**/
-void driver_location_set_interval(unsigned interval_msecs,
+static void driver_location_set_interval(unsigned interval_msecs,
unsigned interval_distance)
{
if (location_driver && location_driver->set_interval
@@ -15346,7 +15936,7 @@ void driver_location_set_interval(unsigned interval_msecs,
*
* Returns: bool (1) if successful, otherwise false (0).
**/
-bool driver_location_get_position(double *lat, double *lon,
+static bool driver_location_get_position(double *lat, double *lon,
double *horiz_accuracy, double *vert_accuracy)
{
if (location_driver && location_driver->get_position
@@ -15376,7 +15966,7 @@ static void init_location(void)
if (!location_data)
{
RARCH_ERR("Failed to initialize location driver. Will continue without location.\n");
- rarch_ctl(RARCH_CTL_LOCATION_UNSET_ACTIVE, NULL);
+ location_driver_active = false;
}
if (system->location_cb.initialized)
@@ -15861,7 +16451,7 @@ void drivers_init(int flags)
if (!camera_data)
{
RARCH_ERR("Failed to initialize camera driver. Will continue without camera.\n");
- rarch_ctl(RARCH_CTL_CAMERA_UNSET_ACTIVE, NULL);
+ camera_driver_active = false;
}
if (camera_cb.initialized)
@@ -17803,7 +18393,9 @@ bool retroarch_main_init(int argc, char *argv[])
{
settings_t *settings = configuration_settings;
enum rarch_content_type cont_type = path_is_media_type(fullpath);
+#ifdef HAVE_IMAGEVIEWER
bool builtin_imageviewer = settings ? settings->bools.multimedia_builtin_imageviewer_enable : false;
+#endif
bool builtin_mediaplayer = settings ? settings->bools.multimedia_builtin_mediaplayer_enable : false;
switch (cont_type)
@@ -18045,6 +18637,42 @@ static void runloop_task_msg_queue_push(
runloop_msg_queue_push(msg, prio, duration, flush, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
+static void rarch_init_core_options(
+ const struct retro_core_option_definition *option_defs)
+{
+ settings_t *settings = configuration_settings;
+ char *game_options_path = NULL;
+
+ if (settings->bools.game_specific_options &&
+ rarch_game_specific_options(&game_options_path))
+ {
+ runloop_game_options_active = true;
+ runloop_core_options =
+ core_option_manager_new(game_options_path, option_defs);
+ free(game_options_path);
+ }
+ else
+ {
+ char buf[PATH_MAX_LENGTH];
+ const char *options_path = settings ? settings->paths.path_core_options : NULL;
+
+ buf[0] = '\0';
+
+ if (string_is_empty(options_path) && !path_is_empty(RARCH_PATH_CONFIG))
+ {
+ fill_pathname_resolve_relative(buf, path_get(RARCH_PATH_CONFIG),
+ file_path_str(FILE_PATH_CORE_OPTIONS_CONFIG), sizeof(buf));
+ options_path = buf;
+ }
+
+ runloop_game_options_active = false;
+
+ if (!string_is_empty(options_path))
+ runloop_core_options =
+ core_option_manager_new(options_path, option_defs);
+ }
+}
+
bool rarch_ctl(enum rarch_ctl_state state, void *data)
{
static bool has_set_username = false;
@@ -18054,12 +18682,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
switch(state)
{
- case RARCH_CTL_LOCATION_SET_ACTIVE:
- location_driver_active = true;
- break;
- case RARCH_CTL_LOCATION_UNSET_ACTIVE:
- location_driver_active = false;
- break;
case RARCH_CTL_BSV_MOVIE_IS_INITED:
return (bsv_movie_state_handle != NULL);
case RARCH_CTL_IS_PATCH_BLOCKED:
@@ -18169,7 +18791,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
for (i = 0; i < MAX_USERS; i++)
input_config_set_device(i, RETRO_DEVICE_JOYPAD);
}
- rarch_ctl(RARCH_CTL_HTTPSERVER_INIT, NULL);
retroarch_msg_queue_init();
break;
case RARCH_CTL_IS_SRAM_LOAD_DISABLED:
@@ -18409,14 +19030,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
break;
case RARCH_CTL_IS_PERFCNT_ENABLE:
return runloop_perfcnt_enable;
- case RARCH_CTL_SET_NONBLOCK_FORCED:
- runloop_force_nonblock = true;
- break;
- case RARCH_CTL_UNSET_NONBLOCK_FORCED:
- runloop_force_nonblock = false;
- break;
- case RARCH_CTL_IS_NONBLOCK_FORCED:
- return runloop_force_nonblock;
case RARCH_CTL_GET_WINDOWED_SCALE:
{
unsigned **scale = (unsigned**)data;
@@ -18539,7 +19152,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
}
}
break;
- case RARCH_CTL_CORE_OPTIONS_INIT:
+ case RARCH_CTL_CORE_VARIABLES_INIT:
{
settings_t *settings = configuration_settings;
char *game_options_path = NULL;
@@ -18551,7 +19164,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
{
runloop_game_options_active = true;
runloop_core_options =
- core_option_manager_new(game_options_path, vars);
+ core_option_manager_new_vars(game_options_path, vars);
free(game_options_path);
}
else
@@ -18572,11 +19185,39 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
if (!string_is_empty(options_path))
runloop_core_options =
- core_option_manager_new(options_path, vars);
+ core_option_manager_new_vars(options_path, vars);
}
-
}
break;
+ case RARCH_CTL_CORE_OPTIONS_INIT:
+ {
+ const struct retro_core_option_definition *option_defs =
+ (const struct retro_core_option_definition*)data;
+
+ rarch_init_core_options(option_defs);
+ }
+ break;
+
+ case RARCH_CTL_CORE_OPTIONS_INTL_INIT:
+ {
+ const struct retro_core_options_intl *core_options_intl =
+ (const struct retro_core_options_intl*)data;
+
+ /* Parse core_options_intl to create option definitions array */
+ struct retro_core_option_definition *option_defs =
+ core_option_manager_get_definitions(core_options_intl);
+
+ if (option_defs)
+ {
+ /* Initialise core options */
+ rarch_init_core_options(option_defs);
+
+ /* Clean up */
+ free(option_defs);
+ }
+ }
+ break;
+
case RARCH_CTL_CORE_OPTIONS_DEINIT:
{
if (!runloop_core_options)
@@ -18601,6 +19242,22 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
runloop_core_options = NULL;
}
break;
+
+ case RARCH_CTL_CORE_OPTIONS_DISPLAY:
+ {
+ const struct retro_core_option_display *core_options_display =
+ (const struct retro_core_option_display*)data;
+
+ if (!runloop_core_options || !core_options_display)
+ return false;
+
+ core_option_manager_set_display(
+ runloop_core_options,
+ core_options_display->key,
+ core_options_display->visible);
+ }
+ break;
+
case RARCH_CTL_KEY_EVENT_GET:
{
retro_keyboard_event_t **key_event =
@@ -18619,23 +19276,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
*key_event = &runloop_frontend_key_event;
}
break;
- case RARCH_CTL_HTTPSERVER_INIT:
- break;
- case RARCH_CTL_HTTPSERVER_DESTROY:
- break;
- case RARCH_CTL_CAMERA_SET_ACTIVE:
- camera_driver_active = true;
- break;
- case RARCH_CTL_CAMERA_UNSET_ACTIVE:
- camera_driver_active = false;
- break;
- case RARCH_CTL_CAMERA_SET_CB:
- {
- struct retro_camera_callback *cb =
- (struct retro_camera_callback*)data;
- camera_cb = *cb;
- }
- break;
case RARCH_CTL_NONE:
default:
return false;
@@ -21325,25 +21965,35 @@ static void retro_input_poll_null(void)
{
}
+static int16_t core_input_state_poll(unsigned port,
+ unsigned device, unsigned idx, unsigned id)
+{
+ return input_state(port, device, idx, id);
+}
+
+static int16_t core_input_state_poll_late(unsigned port,
+ unsigned device, unsigned idx, unsigned id)
+{
+ if (!current_core.input_polled)
+ input_driver_poll();
+
+ current_core.input_polled = true;
+ return input_state(port, device, idx, id);
+}
+
+static retro_input_state_t core_input_state_poll_return_cb(void)
+{
+ if (current_core.poll_type == POLL_TYPE_LATE)
+ return core_input_state_poll_late;
+ return core_input_state_poll;
+}
+
static void core_input_state_poll_maybe(void)
{
if (current_core.poll_type == POLL_TYPE_NORMAL)
input_driver_poll();
}
-static int16_t core_input_state_poll(unsigned port,
- unsigned device, unsigned idx, unsigned id)
-{
- if (current_core.poll_type == POLL_TYPE_LATE)
- {
- if (!current_core.input_polled)
- input_driver_poll();
-
- current_core.input_polled = true;
- }
- return input_state(port, device, idx, id);
-}
-
/**
* core_init_libretro_cbs:
* @data : pointer to retro_callbacks object
@@ -21353,10 +22003,12 @@ static int16_t core_input_state_poll(unsigned port,
**/
static bool core_init_libretro_cbs(struct retro_callbacks *cbs)
{
+ retro_input_state_t state_cb = core_input_state_poll_return_cb();
+
current_core.retro_set_video_refresh(video_driver_frame);
current_core.retro_set_audio_sample(audio_driver_sample);
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch);
- current_core.retro_set_input_state(core_input_state_poll);
+ current_core.retro_set_input_state(state_cb);
current_core.retro_set_input_poll(core_input_state_poll_maybe);
core_set_default_callbacks(cbs);
@@ -21379,10 +22031,12 @@ static bool core_init_libretro_cbs(struct retro_callbacks *cbs)
**/
bool core_set_default_callbacks(struct retro_callbacks *cbs)
{
+ retro_input_state_t state_cb = core_input_state_poll_return_cb();
+
cbs->frame_cb = video_driver_frame;
cbs->sample_cb = audio_driver_sample;
cbs->sample_batch_cb = audio_driver_sample_batch;
- cbs->state_cb = core_input_state_poll;
+ cbs->state_cb = state_cb;
cbs->poll_cb = input_driver_poll;
return true;
@@ -21488,9 +22142,9 @@ bool core_api_version(retro_ctx_api_info_t *api)
return true;
}
-bool core_set_poll_type(unsigned *type)
+bool core_set_poll_type(unsigned type)
{
- current_core.poll_type = *type;
+ current_core.poll_type = type;
return true;
}
@@ -21746,16 +22400,6 @@ bool core_has_set_input_descriptor(void)
return current_core.has_set_input_descriptors;
}
-bool core_is_inited(void)
-{
- return current_core.inited;
-}
-
-bool core_is_symbols_inited(void)
-{
- return current_core.symbols_inited;
-}
-
void core_free_retro_game_info(struct retro_game_info *dest)
{
if (!dest)
diff --git a/retroarch.h b/retroarch.h
index 678598816a..2340b50b68 100644
--- a/retroarch.h
+++ b/retroarch.h
@@ -147,10 +147,6 @@ enum rarch_ctl_state
RARCH_CTL_IS_GAME_OPTIONS_ACTIVE,
- RARCH_CTL_IS_NONBLOCK_FORCED,
- RARCH_CTL_SET_NONBLOCK_FORCED,
- RARCH_CTL_UNSET_NONBLOCK_FORCED,
-
RARCH_CTL_IS_PAUSED,
RARCH_CTL_SET_PAUSED,
@@ -180,31 +176,21 @@ enum rarch_ctl_state
RARCH_CTL_CORE_OPTIONS_LIST_GET,
RARCH_CTL_CORE_OPTION_PREV,
RARCH_CTL_CORE_OPTION_NEXT,
+ RARCH_CTL_CORE_VARIABLES_INIT,
RARCH_CTL_CORE_OPTIONS_INIT,
+ RARCH_CTL_CORE_OPTIONS_INTL_INIT,
RARCH_CTL_CORE_OPTIONS_DEINIT,
+ RARCH_CTL_CORE_OPTIONS_DISPLAY,
/* System info */
RARCH_CTL_SYSTEM_INFO_INIT,
RARCH_CTL_SYSTEM_INFO_FREE,
- /* HTTP server */
- RARCH_CTL_HTTPSERVER_INIT,
- RARCH_CTL_HTTPSERVER_DESTROY,
-
RARCH_CTL_CONTENT_RUNTIME_LOG_INIT,
RARCH_CTL_CONTENT_RUNTIME_LOG_DEINIT,
- /* Camera */
- RARCH_CTL_CAMERA_SET_ACTIVE,
- RARCH_CTL_CAMERA_UNSET_ACTIVE,
- RARCH_CTL_CAMERA_SET_CB,
-
/* BSV Movie */
- RARCH_CTL_BSV_MOVIE_IS_INITED,
-
- /* Location */
- RARCH_CTL_LOCATION_SET_ACTIVE,
- RARCH_CTL_LOCATION_UNSET_ACTIVE
+ RARCH_CTL_BSV_MOVIE_IS_INITED
};
enum rarch_capabilities
@@ -2084,53 +2070,6 @@ extern location_driver_t location_corelocation;
extern location_driver_t location_android;
extern location_driver_t location_null;
-/**
- * driver_location_start:
- *
- * Starts location driver interface..
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: true (1) if successful, otherwise false (0).
- **/
-bool driver_location_start(void);
-
-/**
- * driver_location_stop:
- *
- * Stops location driver interface..
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: true (1) if successful, otherwise false (0).
- **/
-void driver_location_stop(void);
-
-/**
- * driver_location_get_position:
- * @lat : Latitude of current position.
- * @lon : Longitude of current position.
- * @horiz_accuracy : Horizontal accuracy.
- * @vert_accuracy : Vertical accuracy.
- *
- * Gets current positioning information from
- * location driver interface.
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: bool (1) if successful, otherwise false (0).
- **/
-bool driver_location_get_position(double *lat, double *lon,
- double *horiz_accuracy, double *vert_accuracy);
-
-/**
- * driver_location_set_interval:
- * @interval_msecs : Interval time in milliseconds.
- * @interval_distance : Distance at which to update.
- *
- * Sets interval update time for location driver interface.
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- **/
-void driver_location_set_interval(unsigned interval_msecs,
- unsigned interval_distance);
-
/**
* config_get_location_driver_options:
*
diff --git a/runahead/copy_load_info.c b/runahead/copy_load_info.c
deleted file mode 100644
index 337ff7b990..0000000000
--- a/runahead/copy_load_info.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include
-#include
-
-#include
-#include
-
-#include "../core.h"
-#include "mem_util.h"
-#include "copy_load_info.h"
-
-retro_ctx_load_content_info_t *load_content_info;
-enum rarch_core_type last_core_type;
-
-static struct retro_game_info* clone_retro_game_info(const
- struct retro_game_info *src)
-{
- void *data = NULL;
- struct retro_game_info *dest = NULL;
-
- if (!src)
- return NULL;
-
- dest = (struct retro_game_info*)calloc(1,
- sizeof(struct retro_game_info));
- if (!dest)
- return NULL;
-
- dest->data = NULL;
- dest->path = strcpy_alloc(src->path);
-
- if (src->size && src->data)
- {
- data = malloc(src->size);
-
- if (data)
- {
- memcpy(data, src->data, src->size);
- dest->data = data;
- }
- }
-
- dest->size = src->size;
- dest->meta = strcpy_alloc(src->meta);
-
- return dest;
-}
-
-static void free_retro_ctx_load_content_info(struct
- retro_ctx_load_content_info *dest)
-{
- if (!dest)
- return;
-
- core_free_retro_game_info(dest->info);
- string_list_free((struct string_list*)dest->content);
- if (dest->info)
- free(dest->info);
-
- dest->info = NULL;
- dest->content = NULL;
-}
-
-static struct retro_ctx_load_content_info
-*clone_retro_ctx_load_content_info(
- const struct retro_ctx_load_content_info *src)
-{
- struct retro_ctx_load_content_info *dest = NULL;
- if (!src || src->special != NULL)
- return NULL; /* refuse to deal with the Special field */
-
- dest = (struct retro_ctx_load_content_info*)
- calloc(1, sizeof(*dest));
-
- if (!dest)
- return NULL;
-
- dest->info = clone_retro_game_info(src->info);
- dest->content = NULL;
- dest->special = NULL;
-
- if (src->content)
- dest->content = string_list_clone(src->content);
- return dest;
-}
-
-void set_load_content_info(const retro_ctx_load_content_info_t *ctx)
-{
- free_retro_ctx_load_content_info(load_content_info);
- free(load_content_info);
- load_content_info = clone_retro_ctx_load_content_info(ctx);
-}
-
-void set_last_core_type(enum rarch_core_type type)
-{
- last_core_type = type;
-}
diff --git a/runahead/copy_load_info.h b/runahead/copy_load_info.h
deleted file mode 100644
index fced73a2d6..0000000000
--- a/runahead/copy_load_info.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __COPY_LOAD_INFO_H__
-#define __COPY_LOAD_INFO_H__
-
-#include
-#include
-
-#include
-
-#include "../core.h"
-
-RETRO_BEGIN_DECLS
-
-void set_load_content_info(const retro_ctx_load_content_info_t *ctx);
-
-void set_last_core_type(enum rarch_core_type type);
-
-RETRO_END_DECLS
-
-#endif
diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c
index b1e51de8a7..b7f3ae31fb 100644
--- a/tasks/task_autodetect.c
+++ b/tasks/task_autodetect.c
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
#include
#ifdef HAVE_LIBUSB
@@ -321,11 +322,14 @@ static bool input_autoconfigure_joypad_from_conf_dir(
{
size_t i;
char path[PATH_MAX_LENGTH];
+ char best_path[PATH_MAX_LENGTH];
int ret = 0;
int index = -1;
int current_best = 0;
+ config_file_t *best_conf = NULL;
struct string_list *list = NULL;
+ best_path[0] = '\0';
path[0] = '\0';
fill_pathname_application_special(path, sizeof(path),
@@ -355,39 +359,51 @@ static bool input_autoconfigure_joypad_from_conf_dir(
for (i = 0; i < list->size; i++)
{
- config_file_t *conf = config_file_new(list->elems[i].data);
+ int res;
+ int64_t length = 0;
+ uint8_t *ret_buf = NULL;
+ config_file_t *conf = NULL;
+
+ if (!filestream_read_file(list->elems[i].data, (void**)&ret_buf, &length))
+ continue;
- if (conf)
- ret = input_autoconfigure_joypad_try_from_conf(conf, params);
+ if (length < 0)
+ {
+ free((void*)ret_buf);
+ continue;
+ }
- if (ret >= current_best)
+ conf = config_file_new_from_string((const char*)ret_buf);
+ free((void*)ret_buf);
+
+ if (!conf)
+ continue;
+
+ res = input_autoconfigure_joypad_try_from_conf(conf, params);
+
+ if (res >= current_best)
{
index = (int)i;
- current_best = ret;
+ current_best = res;
+ if (best_conf)
+ config_file_free(best_conf);
+ strlcpy(best_path, list->elems[i].data, sizeof(best_path));
+ best_conf = NULL;
+ best_conf = conf;
}
- config_file_free(conf);
- }
-
- if (index >= 0 && current_best > 0)
- {
- config_file_t *conf = config_file_new(list->elems[index].data);
-
- if (conf)
- {
- char conf_path[PATH_MAX_LENGTH];
-
- conf_path[0] = '\0';
-
- config_get_config_path(conf, conf_path, sizeof(conf_path));
-
- RARCH_LOG("[Autoconf]: selected configuration: %s\n", conf_path);
- input_autoconfigure_joypad_add(conf, params, task);
+ else
config_file_free(conf);
- ret = 1;
- }
}
- else
- ret = 0;
+
+ if (index >= 0 && current_best > 0 && best_conf)
+ {
+ RARCH_LOG("[Auoconf]: selected configuration: %s\n", best_path);
+ input_autoconfigure_joypad_add(best_conf, params, task);
+ ret = 1;
+ }
+
+ if (best_conf)
+ config_file_free(best_conf);
string_list_free(list);
@@ -690,9 +706,7 @@ done:
return NULL;
}
-#endif
-
-#ifndef _WIN32
+#else
static const blissbox_pad_type_t* input_autoconfigure_get_blissbox_pad_type_libusb(int vid, int pid)
{
#ifdef HAVE_LIBUSB
@@ -969,7 +983,7 @@ unsigned input_autoconfigure_get_device_name_index(unsigned i)
return input_device_name_index[i];
}
-bool input_autoconfigure_connect(
+void input_autoconfigure_connect(
const char *name,
const char *display_name,
const char *driver,
@@ -985,7 +999,18 @@ bool input_autoconfigure_connect(
bool autodetect_enable = settings ? settings->bools.input_autodetect_enable : false;
if (!task || !state || !autodetect_enable)
- goto error;
+ {
+ if (state)
+ {
+ input_autoconfigure_params_free(state);
+ free(state);
+ }
+ if (task)
+ free(task);
+
+ input_config_set_device_name(idx, name);
+ return;
+ }
if (!string_is_empty(name))
state->name = strdup(name);
@@ -1002,7 +1027,7 @@ bool input_autoconfigure_connect(
input_autoconfigure_override_handler(state);
if (!string_is_empty(state->name))
- input_config_set_device_name(state->idx, state->name);
+ input_config_set_device_name(state->idx, state->name);
input_config_set_pid(state->idx, state->pid);
input_config_set_vid(state->idx, state->vid);
@@ -1011,10 +1036,10 @@ bool input_autoconfigure_connect(
input_autoconf_binds[state->idx][i].joykey = NO_BTN;
input_autoconf_binds[state->idx][i].joyaxis = AXIS_NONE;
if (
- !string_is_empty(input_autoconf_binds[state->idx][i].joykey_label))
+ !string_is_empty(input_autoconf_binds[state->idx][i].joykey_label))
free(input_autoconf_binds[state->idx][i].joykey_label);
if (
- !string_is_empty(input_autoconf_binds[state->idx][i].joyaxis_label))
+ !string_is_empty(input_autoconf_binds[state->idx][i].joyaxis_label))
free(input_autoconf_binds[state->idx][i].joyaxis_label);
input_autoconf_binds[state->idx][i].joykey_label = NULL;
input_autoconf_binds[state->idx][i].joyaxis_label = NULL;
@@ -1026,17 +1051,4 @@ bool input_autoconfigure_connect(
task->handler = input_autoconfigure_connect_handler;
task_queue_push(task);
-
- return true;
-
-error:
- if (state)
- {
- input_autoconfigure_params_free(state);
- free(state);
- }
- if (task)
- free(task);
-
- return false;
}
diff --git a/tasks/task_content.c b/tasks/task_content.c
index 25d0bc5f93..791664f6eb 100644
--- a/tasks/task_content.c
+++ b/tasks/task_content.c
@@ -171,7 +171,6 @@ struct content_information_ctx
bool is_ips_pref;
bool is_bps_pref;
bool is_ups_pref;
- bool history_list_enable;
bool block_extract;
bool need_fullpath;
bool set_supports_no_game_enable;
@@ -197,9 +196,6 @@ static bool pending_content_rom_crc = false;
static char pending_content_rom_crc_path[PATH_MAX_LENGTH] = {0};
static char pending_subsystem_ident[255];
-#if 0
-static char pending_subsystem_extensions[PATH_MAX_LENGTH];
-#endif
static char *pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS];
#ifdef HAVE_CDROM
@@ -1296,25 +1292,17 @@ static void menu_content_environment_get(int *argc, char *argv[],
}
/**
- * task_load_content:
+ * task_push_to_history_list:
*
- * Loads content into currently selected core.
- * Will also optionally push the content entry to the history playlist.
- *
- * Returns: true (1) if successful, otherwise false (0).
+ * Will push the content entry to the history playlist.
**/
-static bool task_load_content(content_ctx_info_t *content_info,
- content_information_ctx_t *content_ctx,
+static void task_push_to_history_list(
bool launched_from_menu,
- bool launched_from_cli,
- char **error_string)
+ bool launched_from_cli)
{
bool contentless = false;
bool is_inited = false;
- if (!content_load(content_info))
- return false;
-
content_get_status(&contentless, &is_inited);
/* Push entry to top of history playlist */
@@ -1349,6 +1337,7 @@ static bool task_load_content(content_ctx_info_t *content_info,
const char *crc32 = NULL;
const char *db_name = NULL;
playlist_t *playlist_hist = g_defaults.content_history;
+ settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
switch (path_is_media_type(tmp))
@@ -1374,19 +1363,15 @@ static bool task_load_content(content_ctx_info_t *content_info,
break;
default:
{
-#ifdef HAVE_MENU
- menu_handle_t *menu = NULL;
-#endif
core_info_t *core_info = NULL;
-
- /* Set core path */
- core_path = path_get(RARCH_PATH_CORE);
-
/* Set core display name
* (As far as I can tell, core_info_get_current_core()
* should always provide a valid pointer here...) */
core_info_get_current_core(&core_info);
+ /* Set core path */
+ core_path = path_get(RARCH_PATH_CORE);
+
if (core_info)
core_name = core_info->display_name;
@@ -1394,15 +1379,18 @@ static bool task_load_content(content_ctx_info_t *content_info,
core_name = info->library_name;
#ifdef HAVE_MENU
- /* Set database name + checksum */
- if (menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
{
- playlist_t *playlist_curr = playlist_get_cached();
-
- if (playlist_index_is_valid(playlist_curr, menu->rpl_entry_selection_ptr, tmp, core_path))
+ menu_handle_t *menu = NULL;
+ /* Set database name + checksum */
+ if (menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
{
- playlist_get_crc32(playlist_curr, menu->rpl_entry_selection_ptr, &crc32);
- playlist_get_db_name(playlist_curr, menu->rpl_entry_selection_ptr, &db_name);
+ playlist_t *playlist_curr = playlist_get_cached();
+
+ if (playlist_index_is_valid(playlist_curr, menu->rpl_entry_selection_ptr, tmp, core_path))
+ {
+ playlist_get_crc32(playlist_curr, menu->rpl_entry_selection_ptr, &crc32);
+ playlist_get_db_name(playlist_curr, menu->rpl_entry_selection_ptr, &db_name);
+ }
}
}
#endif
@@ -1410,17 +1398,11 @@ static bool task_load_content(content_ctx_info_t *content_info,
}
}
- if (launched_from_cli)
- {
- settings_t *settings = config_get_ptr();
- content_ctx->history_list_enable = settings->bools.history_list_enable;
- }
-
if (global && !string_is_empty(global->name.label))
label = global->name.label;
if (
- content_ctx->history_list_enable
+ settings && settings->bools.history_list_enable
&& playlist_hist)
{
char subsystem_name[PATH_MAX_LENGTH];
@@ -1448,8 +1430,6 @@ static bool task_load_content(content_ctx_info_t *content_info,
free(tmp);
}
-
- return true;
}
#ifdef HAVE_MENU
@@ -1476,9 +1456,10 @@ static bool command_event_cmd_exec(const char *data,
}
#if defined(HAVE_DYNAMIC)
- if (!task_load_content(&content_info, content_ctx,
- true, launched_from_cli, error_string))
+ /* Loads content into currently selected core. */
+ if (!content_load(&content_info))
return false;
+ task_push_to_history_list(true, launched_from_cli);
#else
frontend_driver_set_fork(FRONTEND_FORK_CORE_WITH_ARGS);
#endif
@@ -1576,8 +1557,6 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
content_ctx.subsystem.data = NULL;
content_ctx.subsystem.size = 0;
- content_ctx.history_list_enable = settings->bools.history_list_enable;
-
if (global)
{
if (!string_is_empty(global->name.ips))
@@ -1604,9 +1583,8 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
rarch_ctl(RARCH_CTL_DATA_DEINIT, NULL);
rarch_ctl(RARCH_CTL_TASK_INIT, NULL);
- /* Load content */
- if (!task_load_content(content_info, &content_ctx,
- false, false, &error_string))
+ /* Loads content into currently selected core. */
+ if (!content_load(content_info))
{
if (error_string)
{
@@ -1617,6 +1595,8 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
ret = false;
}
+ else
+ task_push_to_history_list(false, false);
if (content_ctx.name_ips)
free(content_ctx.name_ips);
@@ -1667,8 +1647,6 @@ bool task_push_load_content_from_playlist_from_menu(
content_ctx.subsystem.data = NULL;
content_ctx.subsystem.size = 0;
- content_ctx.history_list_enable = settings->bools.history_list_enable;
-
if (global)
{
if (!string_is_empty(global->name.ips))
@@ -1765,8 +1743,6 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
content_ctx.subsystem.data = NULL;
content_ctx.subsystem.size = 0;
- content_ctx.history_list_enable = settings->bools.history_list_enable;
-
if (global)
{
if (!string_is_empty(global->name.ips))
@@ -1794,8 +1770,8 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
if (firmware_update_status(&content_ctx))
goto end;
- if (!task_load_content(content_info, &content_ctx,
- true, false, &error_string))
+ /* Loads content into currently selected core. */
+ if (!content_load(content_info))
{
if (error_string)
{
@@ -1809,6 +1785,8 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
ret = false;
goto end;
}
+ else
+ task_push_to_history_list(true, false);
#ifdef HAVE_MENU
/* Push quick menu onto menu stack */
@@ -1889,8 +1867,6 @@ bool task_push_load_content_with_new_core_from_menu(
content_ctx.subsystem.data = NULL;
content_ctx.subsystem.size = 0;
- content_ctx.history_list_enable = settings->bools.history_list_enable;
-
if (global)
{
if (!string_is_empty(global->name.ips))
@@ -1920,8 +1896,8 @@ bool task_push_load_content_with_new_core_from_menu(
if (firmware_update_status(&content_ctx))
goto end;
- if (!task_load_content(content_info, &content_ctx,
- true, false, &error_string))
+ /* Loads content into currently selected core. */
+ if (!content_load(content_info))
{
if (error_string)
{
@@ -1935,7 +1911,8 @@ bool task_push_load_content_with_new_core_from_menu(
ret = false;
goto end;
}
-
+ else
+ task_push_to_history_list(true, false);
#else
command_event_cmd_exec(path_get(RARCH_PATH_CONTENT), &content_ctx,
false, &error_string);
@@ -1996,7 +1973,6 @@ static bool task_load_content_callback(content_ctx_info_t *content_info,
{
struct retro_system_info *system = runloop_get_libretro_system_info();
- content_ctx.history_list_enable = settings->bools.history_list_enable;
content_ctx.set_supports_no_game_enable = settings->bools.set_supports_no_game_enable;
if (!string_is_empty(settings->paths.directory_system))
@@ -2013,8 +1989,6 @@ static bool task_load_content_callback(content_ctx_info_t *content_info,
content_ctx.subsystem.size = sys_info->subsystem.size;
}
- content_ctx.history_list_enable = settings->bools.history_list_enable;
-
if (global)
{
if (!string_is_empty(global->name.ips))
@@ -2045,7 +2019,11 @@ static bool task_load_content_callback(content_ctx_info_t *content_info,
}
#endif
- ret = task_load_content(content_info, &content_ctx, true, loading_from_cli, &error_string);
+ /* Loads content into currently selected core. */
+ ret = content_load(content_info);
+
+ if (ret)
+ task_push_to_history_list(true, loading_from_cli);
end:
if (content_ctx.name_ips)
@@ -2454,7 +2432,6 @@ bool content_init(void)
content_ctx.is_bps_pref = rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL);
content_ctx.is_ups_pref = rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL);
content_ctx.temporary_content = temporary_content;
- content_ctx.history_list_enable = false;
content_ctx.directory_system = NULL;
content_ctx.directory_cache = NULL;
content_ctx.name_ips = NULL;
@@ -2482,7 +2459,6 @@ bool content_init(void)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
- content_ctx.history_list_enable = settings->bools.history_list_enable;
content_ctx.set_supports_no_game_enable = settings->bools.set_supports_no_game_enable;
if (!string_is_empty(settings->paths.directory_system))
diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c
index 860cbf0de9..251c0c13d5 100644
--- a/tasks/task_overlay.c
+++ b/tasks/task_overlay.c
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
@@ -734,6 +735,8 @@ bool task_push_overlay_load_default(
void *user_data)
{
task_finder_data_t find_data;
+ int64_t length = 0;
+ uint8_t *ret_buf = NULL;
retro_task_t *t = NULL;
config_file_t *conf = NULL;
overlay_loader_t *loader = NULL;
@@ -753,7 +756,12 @@ bool task_push_overlay_load_default(
if (!loader)
return false;
- conf = config_file_new(overlay_path);
+ if (filestream_read_file(overlay_path, (void**)&ret_buf, &length))
+ {
+ if (length >= 0)
+ conf = config_file_new_from_string((const char*)ret_buf);
+ free((void*)ret_buf);
+ }
if (!conf)
{
@@ -761,6 +769,8 @@ bool task_push_overlay_load_default(
return false;
}
+ conf->path = strdup(overlay_path);
+
if (!config_get_uint(conf, "overlays", &loader->size))
{
/* Error - overlays varaible not defined in config. */
diff --git a/tasks/task_powerstate.c b/tasks/task_powerstate.c
index 4db4922e83..5d8dd3bab4 100644
--- a/tasks/task_powerstate.c
+++ b/tasks/task_powerstate.c
@@ -16,12 +16,14 @@
*/
#include
-#include "../../frontend/frontend_driver.h"
-#include "tasks_internal.h"
+
#include
-static int power_percent = 0;
-static enum frontend_powerstate state = FRONTEND_POWERSTATE_NONE;
+#include "../../frontend/frontend_driver.h"
+#include "tasks_internal.h"
+
+static int powerstate_percent = 0;
+static enum frontend_powerstate powerstate_status = FRONTEND_POWERSTATE_NONE;
typedef struct powerstate powerstate_t;
@@ -34,9 +36,9 @@ struct powerstate
enum frontend_powerstate get_last_powerstate(int *percent)
{
if (percent)
- *percent = power_percent;
+ *percent = powerstate_percent;
- return state;
+ return powerstate_status;
}
static void task_powerstate_cb(retro_task_t *task,
@@ -45,8 +47,8 @@ static void task_powerstate_cb(retro_task_t *task,
{
powerstate_t *powerstate = (powerstate_t*)task_data;
- power_percent = powerstate->percent;
- state = powerstate->state;
+ powerstate_percent = powerstate->percent;
+ powerstate_status = powerstate->state;
free(powerstate);
}
@@ -58,8 +60,9 @@ static void task_powerstate_handler(retro_task_t *task)
if (frontend && frontend->get_powerstate)
{
- int seconds = 0;
- powerstate->state = frontend->get_powerstate(&seconds, &powerstate->percent);
+ int seconds = 0;
+ powerstate->state = frontend->get_powerstate(
+ &seconds, &powerstate->percent);
}
task_set_data(task, powerstate);
diff --git a/tasks/task_save.c b/tasks/task_save.c
index 7dcb6c6cff..72190b3833 100644
--- a/tasks/task_save.c
+++ b/tasks/task_save.c
@@ -407,7 +407,7 @@ bool content_undo_load_state(void)
RARCH_LOG("%s: %u %s.\n",
msg_hash_to_str(MSG_STATE_SIZE),
- undo_load_buf.size,
+ (unsigned int)undo_load_buf.size,
msg_hash_to_str(MSG_BYTES));
/* TODO/FIXME - This checking of SRAM overwrite,
diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h
index f4ae943036..92a1a388f3 100644
--- a/tasks/tasks_internal.h
+++ b/tasks/tasks_internal.h
@@ -134,7 +134,7 @@ unsigned input_autoconfigure_get_device_name_index(unsigned i);
void input_autoconfigure_reset(void);
-bool input_autoconfigure_connect(
+void input_autoconfigure_connect(
const char *name,
const char *display_name,
const char *driver,
diff --git a/ui/drivers/cocoa/ui_cocoa_application.m b/ui/drivers/cocoa/ui_cocoa_application.m
index 6a27ecd2ee..1d5d2993d5 100644
--- a/ui/drivers/cocoa/ui_cocoa_application.m
+++ b/ui/drivers/cocoa/ui_cocoa_application.m
@@ -29,14 +29,6 @@ static void* ui_application_cocoa_initialize(void)
return NULL;
}
-static bool ui_application_cocoa_pending_events(void)
-{
- NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES];
- if (!event)
- return false;
- return true;
-}
-
static void ui_application_cocoa_process_events(void)
{
while (1)
@@ -56,7 +48,6 @@ static void ui_application_cocoa_process_events(void)
ui_application_t ui_application_cocoa = {
ui_application_cocoa_initialize,
- ui_application_cocoa_pending_events,
ui_application_cocoa_process_events,
NULL,
false,
diff --git a/ui/drivers/null/ui_null_application.c b/ui/drivers/null/ui_null_application.c
deleted file mode 100644
index f10667d390..0000000000
--- a/ui/drivers/null/ui_null_application.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2011-2017 - Daniel De Matteis
- *
- * 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 .
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include "../../ui_companion_driver.h"
-
-static void* ui_application_null_initialize(void)
-{
- return NULL;
-}
-
-static bool ui_application_null_pending_events(void)
-{
- return true;
-}
-
-static void ui_application_null_process_events(void)
-{
-}
-
-ui_application_t ui_application_null = {
- ui_application_null_initialize,
- ui_application_null_pending_events,
- ui_application_null_process_events,
- NULL,
- false,
- "null"
-};
diff --git a/ui/drivers/null/ui_null_browser_window.c b/ui/drivers/null/ui_null_browser_window.c
deleted file mode 100644
index 548069f2f7..0000000000
--- a/ui/drivers/null/ui_null_browser_window.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2011-2017 - Daniel De Matteis
- *
- * 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 .
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include "../../ui_companion_driver.h"
-
-static bool ui_browser_window_null_open(ui_browser_window_state_t *state)
-{
- return false;
-}
-
-static bool ui_browser_window_null_save(ui_browser_window_state_t *state)
-{
- return false;
-}
-
-ui_browser_window_t ui_browser_window_null = {
- ui_browser_window_null_open,
- ui_browser_window_null_save,
- "null"
-};
diff --git a/ui/drivers/null/ui_null_msg_window.c b/ui/drivers/null/ui_null_msg_window.c
deleted file mode 100644
index adc84ce467..0000000000
--- a/ui/drivers/null/ui_null_msg_window.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2011-2017 - Daniel De Matteis
- *
- * 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 .
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include "../../ui_companion_driver.h"
-
-static enum ui_msg_window_response ui_msg_window_null_error(ui_msg_window_state *state)
-{
- return UI_MSG_RESPONSE_CANCEL;
-}
-
-static enum ui_msg_window_response ui_msg_window_null_information(ui_msg_window_state *state)
-{
- return UI_MSG_RESPONSE_CANCEL;
-}
-
-static enum ui_msg_window_response ui_msg_window_null_question(ui_msg_window_state *state)
-{
- return UI_MSG_RESPONSE_CANCEL;
-}
-
-static enum ui_msg_window_response ui_msg_window_null_warning(ui_msg_window_state *state)
-{
- return UI_MSG_RESPONSE_CANCEL;
-}
-
-ui_msg_window_t ui_msg_window_null = {
- ui_msg_window_null_error,
- ui_msg_window_null_information,
- ui_msg_window_null_question,
- ui_msg_window_null_warning,
- "null"
-};
diff --git a/ui/drivers/null/ui_null_window.c b/ui/drivers/null/ui_null_window.c
deleted file mode 100644
index 793019803d..0000000000
--- a/ui/drivers/null/ui_null_window.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2011-2017 - Daniel De Matteis
- *
- * 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 .
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include "../../ui_companion_driver.h"
-
-static void* ui_window_null_init(void)
-{
- return NULL;
-}
-
-static void ui_window_null_destroy(void *data)
-{
-}
-
-static void ui_window_null_set_focused(void *data)
-{
-}
-
-static void ui_window_null_set_visible(void *data,
- bool set_visible)
-{
-}
-
-static void ui_window_null_set_title(void *data, char *buf)
-{
-}
-
-static void ui_window_null_set_droppable(void *data, bool droppable)
-{
-}
-
-static bool ui_window_null_focused(void *data)
-{
- return true;
-}
-
-ui_window_t ui_window_null = {
- ui_window_null_init,
- ui_window_null_destroy,
- ui_window_null_set_focused,
- ui_window_null_set_visible,
- ui_window_null_set_title,
- ui_window_null_set_droppable,
- ui_window_null_focused,
- "null"
-};
diff --git a/ui/drivers/qt/coreoptionsdialog.cpp b/ui/drivers/qt/coreoptionsdialog.cpp
index 60162623e7..e7dce9e8eb 100644
--- a/ui/drivers/qt/coreoptionsdialog.cpp
+++ b/ui/drivers/qt/coreoptionsdialog.cpp
@@ -137,9 +137,7 @@ void CoreOptionsDialog::onSaveGameSpecificOptions()
if (!conf)
{
- conf = config_file_new(NULL);
-
- if (!conf)
+ if (!(conf = config_file_new_alloc()))
{
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR), msg_hash_to_str(MSG_ERROR_SAVING_CORE_OPTIONS_FILE));
return;
diff --git a/ui/drivers/qt/qt_playlist.cpp b/ui/drivers/qt/qt_playlist.cpp
index 10de21189b..108ef06104 100644
--- a/ui/drivers/qt/qt_playlist.cpp
+++ b/ui/drivers/qt/qt_playlist.cpp
@@ -265,7 +265,8 @@ inline static bool comp_hash_name_key_lower(const QHash &lhs,
return lhs.value("name").toLower() < rhs.value("name").toLower();
}
-bool MainWindow::addDirectoryFilesToList(QProgressDialog *dialog, QStringList &list, QDir &dir, QStringList &extensions)
+bool MainWindow::addDirectoryFilesToList(QProgressDialog *dialog,
+ QStringList &list, QDir &dir, QStringList &extensions)
{
PlaylistEntryDialog *playlistDialog = playlistEntryDialog();
QStringList dirList = dir.entryList(QStringList(), QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System, QDir::Name);
@@ -312,16 +313,18 @@ bool MainWindow::addDirectoryFilesToList(QProgressDialog *dialog, QStringList &l
{
if (path_is_compressed_file(pathData))
{
- struct string_list *list = file_archive_get_file_list(pathData, NULL);
+ struct string_list *archive_list =
+ file_archive_get_file_list(pathData, NULL);
- if (list)
+ if (archive_list)
{
- if (list->size == 1)
+ if (archive_list->size == 1)
{
/* Assume archives with one file should have that file loaded directly.
* Don't just extend this to add all files in a zip, because we might hit
* something like MAME/FBA where only the archives themselves are valid content. */
- pathArray = (QString(pathData) + "#" + list->elems[0].data).toUtf8();
+ pathArray = (QString(pathData) + "#"
+ + archive_list->elems[0].data).toUtf8();
pathData = pathArray.constData();
if (!extensions.isEmpty() && playlistDialog->filterInArchive())
@@ -333,7 +336,7 @@ bool MainWindow::addDirectoryFilesToList(QProgressDialog *dialog, QStringList &l
}
}
- string_list_free(list);
+ string_list_free(archive_list);
}
}
}
diff --git a/ui/drivers/qt/ui_qt_application.cpp b/ui/drivers/qt/ui_qt_application.cpp
index db9ea4f202..eebc1e6011 100644
--- a/ui/drivers/qt/ui_qt_application.cpp
+++ b/ui/drivers/qt/ui_qt_application.cpp
@@ -128,19 +128,10 @@ static void* ui_application_qt_initialize(void)
return &ui_application;
}
-static bool ui_application_qt_pending_events(void)
-{
- QAbstractEventDispatcher *dispatcher = QApplication::eventDispatcher();
-
- if (dispatcher)
- return dispatcher->hasPendingEvents();
-
- return false;
-}
-
static void ui_application_qt_process_events(void)
{
- if (ui_application_qt_pending_events())
+ QAbstractEventDispatcher *dispatcher = QApplication::eventDispatcher();
+ if (dispatcher && dispatcher->hasPendingEvents())
QApplication::processEvents();
}
@@ -162,7 +153,6 @@ int main(int argc, char *argv[])
ui_application_t ui_application_qt = {
ui_application_qt_initialize,
- ui_application_qt_pending_events,
ui_application_qt_process_events,
ui_application_qt_quit,
false,
diff --git a/ui/drivers/ui_cocoatouch.m b/ui/drivers/ui_cocoatouch.m
index 0c82711846..c9eadf6afc 100644
--- a/ui/drivers/ui_cocoatouch.m
+++ b/ui/drivers/ui_cocoatouch.m
@@ -689,9 +689,9 @@ ui_companion_driver_t ui_companion_cocoatouch = {
ui_companion_cocoatouch_render_messagebox,
NULL, /* get_main_window */
NULL, /* log_msg */
- &ui_browser_window_null,
- &ui_msg_window_null,
- &ui_window_null,
- &ui_application_null,
+ NULL, /* ui_browser_window_null */
+ NULL, /* ui_msg_window_null */
+ NULL, /* ui_window_null */
+ NULL, /* ui_application_null */
"cocoatouch",
};
diff --git a/ui/drivers/ui_null.c b/ui/drivers/ui_null.c
deleted file mode 100644
index 6e901a63bd..0000000000
--- a/ui/drivers/ui_null.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2011-2017 - Daniel De Matteis
- *
- * 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 .
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include "../ui_companion_driver.h"
-
-typedef struct ui_companion_null
-{
- void *empty;
-} ui_companion_null_t;
-
-static void ui_companion_null_deinit(void *data)
-{
- ui_companion_null_t *handle = (ui_companion_null_t*)data;
-
- if (handle)
- free(handle);
-}
-
-static void *ui_companion_null_init(void)
-{
- ui_companion_null_t *handle = (ui_companion_null_t*)calloc(1, sizeof(*handle));
-
- if (!handle)
- return NULL;
-
- return handle;
-}
-
-static int ui_companion_null_iterate(void *data, unsigned action)
-{
- (void)data;
- (void)action;
-
- return 0;
-}
-
-static void ui_companion_null_notify_content_loaded(void *data)
-{
- (void)data;
-}
-
-static void ui_companion_null_toggle(void *data, bool force)
-{
- (void)data;
- (void)force;
-}
-
-static void ui_companion_null_event_command(void *data, enum event_command cmd)
-{
- (void)data;
- (void)cmd;
-}
-
-static void ui_companion_null_notify_list_pushed(void *data,
- file_list_t *list, file_list_t *menu_list)
-{
- (void)data;
- (void)list;
- (void)menu_list;
-}
-
-ui_companion_driver_t ui_companion_null = {
- ui_companion_null_init,
- ui_companion_null_deinit,
- ui_companion_null_iterate,
- ui_companion_null_toggle,
- ui_companion_null_event_command,
- ui_companion_null_notify_content_loaded,
- ui_companion_null_notify_list_pushed,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- &ui_browser_window_null,
- &ui_msg_window_null,
- &ui_window_null,
- &ui_application_null,
- "null",
-};
diff --git a/ui/drivers/win32/ui_win32_application.c b/ui/drivers/win32/ui_win32_application.c
index 1dc19502eb..df88f2fb05 100644
--- a/ui/drivers/win32/ui_win32_application.c
+++ b/ui/drivers/win32/ui_win32_application.c
@@ -28,30 +28,18 @@ static void* ui_application_win32_initialize(void)
return NULL;
}
-static bool ui_application_win32_pending_events(void)
-{
- MSG msg;
- return PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
-}
-
static void ui_application_win32_process_events(void)
{
MSG msg;
- while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
+ while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
- MSG msg;
-
- if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
- {
- TranslateMessage(&msg);
- DispatchMessage (&msg);
- }
+ TranslateMessage(&msg);
+ DispatchMessage (&msg);
}
}
ui_application_t ui_application_win32 = {
ui_application_win32_initialize,
- ui_application_win32_pending_events,
ui_application_win32_process_events,
NULL,
false,
diff --git a/ui/ui_companion_driver.h b/ui/ui_companion_driver.h
index 06914dbb4b..3317a695fc 100644
--- a/ui/ui_companion_driver.h
+++ b/ui/ui_companion_driver.h
@@ -105,7 +105,6 @@ typedef struct ui_msg_window
typedef struct ui_application
{
void* (*initialize)(void);
- bool (*pending_events)(void);
void (*process_events)(void);
void (*quit)(void);
bool exiting;
@@ -145,22 +144,18 @@ typedef struct ui_companion_driver
const char *ident;
} ui_companion_driver_t;
-extern ui_browser_window_t ui_browser_window_null;
extern ui_browser_window_t ui_browser_window_cocoa;
extern ui_browser_window_t ui_browser_window_qt;
extern ui_browser_window_t ui_browser_window_win32;
-extern ui_window_t ui_window_null;
extern ui_window_t ui_window_cocoa;
extern ui_window_t ui_window_qt;
extern ui_window_t ui_window_win32;
-extern ui_msg_window_t ui_msg_window_null;
extern ui_msg_window_t ui_msg_window_win32;
extern ui_msg_window_t ui_msg_window_qt;
extern ui_msg_window_t ui_msg_window_cocoa;
-extern ui_application_t ui_application_null;
extern ui_application_t ui_application_cocoa;
extern ui_application_t ui_application_qt;
extern ui_application_t ui_application_win32;
@@ -171,27 +166,8 @@ extern ui_companion_driver_t ui_companion_cocoatouch;
extern ui_companion_driver_t ui_companion_qt;
extern ui_companion_driver_t ui_companion_win32;
-/**
- * ui_companion_find_driver:
- * @ident : Identifier name of driver to find.
- *
- * Finds driver with @ident. Does not initialize.
- *
- * Returns: pointer to driver if successful, otherwise NULL.
- **/
-const ui_companion_driver_t *ui_companion_find_driver(const char *ident);
-
const ui_companion_driver_t *ui_companion_get_ptr(void);
-/**
- * ui_companion_init_first:
- *
- * Finds first suitable driver and initialize.
- *
- * Returns: pointer to first suitable driver, otherwise NULL.
- **/
-const ui_companion_driver_t *ui_companion_init_first(void);
-
void ui_companion_driver_init_first(void);
bool ui_companion_is_on_foreground(void);