Merge remote-tracking branch 'refs/remotes/libretro/master' into wiiu_controller_patcher

This commit is contained in:
Maschell 2017-05-20 20:19:04 +02:00
commit a8a2d7730f
11 changed files with 70 additions and 124 deletions

View File

@ -90,7 +90,6 @@
struct command
{
bool local_enable;
#ifdef HAVE_STDIN_CMD
bool stdin_enable;
char stdin_buf[STDIN_BUF_SIZE];
@ -157,8 +156,7 @@ struct cmd_action_map
const char *arg_desc;
};
#ifdef HAVE_COMMAND
static bool command_set_shader(const char *arg)
bool command_set_shader(const char *arg)
{
char msg[256];
enum rarch_shader_type type = RARCH_SHADER_NONE;
@ -190,7 +188,7 @@ static bool command_set_shader(const char *arg)
return video_driver_set_shader(type, arg);
}
#ifdef HAVE_COMMAND
#ifdef HAVE_CHEEVOS
static bool command_read_ram(const char *arg)
{
@ -541,14 +539,12 @@ static bool command_stdin_init(command_t *handle)
}
#endif
command_t *command_new(bool local_enable)
command_t *command_new(void)
{
command_t *handle = (command_t*)calloc(1, sizeof(*handle));
if (!handle)
return NULL;
handle->local_enable = local_enable;
return handle;
}
@ -631,8 +627,6 @@ static void command_stdin_poll(command_t *handle)
bool command_poll(command_t *handle)
{
memset(handle->state, 0, sizeof(handle->state));
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
#ifdef HAVE_COMMAND
command_network_poll(handle);

View File

@ -221,6 +221,8 @@ enum event_command
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET
};
bool command_set_shader(const char *arg);
#ifdef HAVE_COMMAND
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
bool command_network_send(const char *cmd_);
@ -233,7 +235,7 @@ bool command_network_new(
bool network_enable,
uint16_t port);
command_t *command_new(bool local_enable);
command_t *command_new(void);
bool command_poll(command_t *handle);

40
dirs.c
View File

@ -23,10 +23,10 @@
#include <retro_stat.h>
#include "dirs.h"
#include "command.h"
#include "configuration.h"
#include "command.h"
#include "defaults.h"
#include "gfx/video_driver.h"
#include "list_special.h"
#include "file_path_special.h"
#include "msg_hash.h"
@ -108,9 +108,6 @@ bool dir_free_shader(void)
**/
void dir_check_shader(bool pressed_next, bool pressed_prev)
{
char msg[128];
const char *shader = NULL;
enum rarch_shader_type type = RARCH_SHADER_NONE;
struct rarch_dir_list *dir_list = (struct rarch_dir_list*)&dir_shader_list;
if (!dir_list || !dir_list->list)
@ -131,40 +128,7 @@ void dir_check_shader(bool pressed_next, bool pressed_prev)
else
return;
shader = dir_list->list->elems[dir_list->ptr].data;
switch (msg_hash_to_file_type(msg_hash_calculate(
path_get_extension(shader))))
{
case FILE_TYPE_SHADER_GLSL:
case FILE_TYPE_SHADER_PRESET_GLSLP:
type = RARCH_SHADER_GLSL;
break;
case FILE_TYPE_SHADER_SLANG:
case FILE_TYPE_SHADER_PRESET_SLANGP:
type = RARCH_SHADER_SLANG;
break;
case FILE_TYPE_SHADER_CG:
case FILE_TYPE_SHADER_PRESET_CGP:
type = RARCH_SHADER_CG;
break;
default:
return;
}
msg[0] = '\0';
snprintf(msg, sizeof(msg), "%s #%u: \"%s\".",
msg_hash_to_str(MSG_SHADER),
(unsigned)dir_list->ptr, shader);
runloop_msg_queue_push(msg, 2, 120, true);
RARCH_LOG("%s \"%s\".\n",
msg_hash_to_str(MSG_APPLYING_SHADER),
shader);
if (!video_driver_set_shader(type, shader))
RARCH_WARN("%s\n", msg_hash_to_str(MSG_FAILED_TO_APPLY_SHADER));
command_set_shader(dir_list->list->elems[dir_list->ptr].data);
}
/* empty functions */

View File

@ -886,14 +886,8 @@ static bool d3d_alive(void *data)
if (resize)
{
gfx_ctx_mode_t mode;
d3d->should_resize = true;
mode.width = temp_width;
mode.height = temp_height;
current_video_context.set_resize(video_context_data, mode.width, mode.height);
video_driver_set_resize(temp_width, temp_height);
d3d_restore(d3d);
}

View File

@ -411,6 +411,12 @@ static bool set_resize_null(void *a, unsigned b, unsigned c)
return false;
}
void video_driver_set_resize(unsigned width, unsigned height)
{
if (current_video_context.set_resize)
current_video_context.set_resize(video_context_data, width, height);
}
/**
* video_driver_find_handle:
* @idx : index of driver to get handle to.

View File

@ -1066,6 +1066,8 @@ void video_driver_set_threaded(bool val);
void video_driver_get_status(uint64_t *frame_count, bool * is_alive,
bool *is_focused);
void video_driver_set_resize(unsigned width, unsigned height);
extern video_driver_t video_gl;
extern video_driver_t video_vulkan;
extern video_driver_t video_psp1;

View File

@ -1183,7 +1183,7 @@ bool input_driver_init_command(void)
"Cannot use this command interface.\n");
}
input_driver_command = command_new(false);
input_driver_command = command_new();
if (command_network_new(
input_driver_command,

View File

@ -65,23 +65,6 @@ void dir_list_sort(struct string_list *list, bool dir_first);
**/
void dir_list_free(struct string_list *list);
/**
* dir_list_read:
* @dir : directory path.
* @list : the string list to add files to
* @ext_list : the string list of extensions to include
* @include_dirs : include directories as part of the finished directory listing?
* @include_hidden : include hidden files and directories as part of the finished directory listing?
* @include_compressed : Only include files which match ext. Do not try to match compressed files, etc.
* @recursive : list directory contents recursively
*
* Add files within a directory to an existing string list
*
* Returns: -1 on error, 0 on success.
**/
int dir_list_read(const char *dir, struct string_list *list, struct string_list *ext_list,
bool include_dirs, bool include_hidden, bool include_compressed, bool recursive);
RETRO_END_DECLS
#endif

View File

@ -124,7 +124,8 @@ static int parse_dir_entry(const char *name, char *file_path,
if (!include_dirs && is_dir)
return 1;
if (string_is_equal_fast(name, ".", 1) || string_is_equal_fast(name, "..", 2))
if ((name[0] == '.' && name[1] == '\0') ||
(name[0] == '.' && name[1] == '.' && name[2] == '\0'))
return 1;
if (!is_dir && ext_list &&
@ -153,46 +154,6 @@ static int parse_dir_entry(const char *name, char *file_path,
return 0;
}
/**
* dir_list_new:
* @dir : directory path.
* @ext : allowed extensions of file directory entries to include.
* @include_dirs : include directories as part of the finished directory listing?
* @include_hidden : include hidden files and directories as part of the finished directory listing?
* @include_compressed : Only include files which match ext. Do not try to match compressed files, etc.
* @recursive : list directory contents recursively
*
* Create a directory listing.
*
* Returns: pointer to a directory listing of type 'struct string_list *' on success,
* NULL in case of error. Has to be freed manually.
**/
struct string_list *dir_list_new(const char *dir,
const char *ext, bool include_dirs,
bool include_hidden, bool include_compressed,
bool recursive)
{
struct string_list *ext_list = NULL;
struct string_list *list = NULL;
if (!(list = string_list_new()))
return NULL;
if (ext)
ext_list = string_split(ext, "|");
if(dir_list_read(dir, list, ext_list, include_dirs,
include_hidden, include_compressed, recursive) == -1)
{
string_list_free(list);
string_list_free(ext_list);
return NULL;
}
string_list_free(ext_list);
return list;
}
/**
* dir_list_read:
* @dir : directory path.
@ -207,7 +168,7 @@ struct string_list *dir_list_new(const char *dir,
*
* Returns: -1 on error, 0 on success.
**/
int dir_list_read(const char *dir,
static int dir_list_read(const char *dir,
struct string_list *list, struct string_list *ext_list,
bool include_dirs, bool include_hidden,
bool include_compressed, bool recursive)
@ -275,3 +236,44 @@ int dir_list_read(const char *dir,
return 0;
}
/**
* dir_list_new:
* @dir : directory path.
* @ext : allowed extensions of file directory entries to include.
* @include_dirs : include directories as part of the finished directory listing?
* @include_hidden : include hidden files and directories as part of the finished directory listing?
* @include_compressed : Only include files which match ext. Do not try to match compressed files, etc.
* @recursive : list directory contents recursively
*
* Create a directory listing.
*
* Returns: pointer to a directory listing of type 'struct string_list *' on success,
* NULL in case of error. Has to be freed manually.
**/
struct string_list *dir_list_new(const char *dir,
const char *ext, bool include_dirs,
bool include_hidden, bool include_compressed,
bool recursive)
{
struct string_list *ext_list = NULL;
struct string_list *list = NULL;
if (!(list = string_list_new()))
return NULL;
if (ext)
ext_list = string_split(ext, "|");
if(dir_list_read(dir, list, ext_list, include_dirs,
include_hidden, include_compressed, recursive) == -1)
{
string_list_free(list);
string_list_free(ext_list);
return NULL;
}
string_list_free(ext_list);
return list;
}

View File

@ -20,6 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <ctype.h>
@ -32,6 +34,8 @@
#include <unistd.h>
#endif
#include <boolean.h>
#if defined(_WIN32) && defined(_XBOX)
size_t read_stdin(char *buf, size_t size)
{

View File

@ -1093,20 +1093,15 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir)
{
char core_path[PATH_MAX_LENGTH];
char config_directory[PATH_MAX_LENGTH];
const char *core_name = NULL;
const char *game_name = NULL;
rarch_system_info_t *system = runloop_get_system_info();
config_directory[0] = core_path[0] = '\0';
if (system)
core_name = system->info.library_name;
game_name = path_basename(path_get(RARCH_PATH_BASENAME));
const char *core_name = system ? system->info.library_name : NULL;
const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME));
if (string_is_empty(core_name) || string_is_empty(game_name))
return false;
config_directory[0] = core_path[0] = '\0';
fill_pathname_application_special(config_directory,
sizeof(config_directory),
APPLICATION_SPECIAL_DIRECTORY_CONFIG);