mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-18 23:04:25 +00:00
Refactors to do with set_fork method
This commit is contained in:
parent
0e7729c660
commit
321690b416
@ -25,13 +25,12 @@
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <file/dir_list.h>
|
||||
|
||||
#include "../performance.h"
|
||||
|
||||
#include "audio_dsp_filter.h"
|
||||
#include "../dynamic.h"
|
||||
#include "audio_filters/dspfilter.h"
|
||||
#include "../file_ext.h"
|
||||
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "../performance.h"
|
||||
#include "../dynamic.h"
|
||||
|
||||
struct rarch_dsp_plug
|
||||
{
|
||||
@ -226,12 +225,13 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
const char *filter_config, float sample_rate)
|
||||
{
|
||||
char basedir[PATH_MAX_LENGTH] = {0};
|
||||
#ifdef HAVE_DYLIB
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
struct string_list *plugs = NULL;
|
||||
rarch_dsp_filter_t *dsp = NULL;
|
||||
|
||||
(void)basedir;
|
||||
|
||||
dsp = (rarch_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
if (!dsp)
|
||||
return NULL;
|
||||
@ -243,7 +243,10 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false, false);
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
#endif
|
||||
|
@ -15,13 +15,16 @@
|
||||
*/
|
||||
|
||||
#include "dir_list_special.h"
|
||||
#include "frontend/frontend_driver.h"
|
||||
#include "general.h"
|
||||
#include "file_ext.h"
|
||||
#include "configuration.h"
|
||||
#include "core_info.h"
|
||||
|
||||
struct string_list *dir_list_new_special(const char *input_dir, enum dir_list_type type, const char *filter)
|
||||
{
|
||||
#ifdef HAVE_DYLIB
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
const char *dir = NULL;
|
||||
const char *exts = NULL;
|
||||
bool include_dirs = false;
|
||||
@ -35,7 +38,11 @@ struct string_list *dir_list_new_special(const char *input_dir, enum dir_list_ty
|
||||
{
|
||||
case DIR_LIST_CORES:
|
||||
dir = settings->libretro_directory;
|
||||
exts = EXT_EXECUTABLES;
|
||||
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
return NULL;
|
||||
|
||||
exts = ext_name;
|
||||
break;
|
||||
case DIR_LIST_CORE_INFO:
|
||||
dir = input_dir;
|
||||
|
46
file_ext.h
46
file_ext.h
@ -1,46 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _FILE_EXT_H
|
||||
#define _FILE_EXT_H
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
#ifdef _WIN32
|
||||
#define EXT_EXECUTABLES "dll"
|
||||
#elif defined(__APPLE__) || defined(__MACH__)
|
||||
#define EXT_EXECUTABLES "dylib"
|
||||
#else
|
||||
#define EXT_EXECUTABLES "so"
|
||||
#endif
|
||||
#else
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#define EXT_EXECUTABLES "self|bin"
|
||||
#elif defined(PSP)
|
||||
#define EXT_EXECUTABLES "pbp"
|
||||
#elif defined(VITA)
|
||||
#define EXT_EXECUTABLES "velf"
|
||||
#elif defined(_XBOX1)
|
||||
#define EXT_EXECUTABLES "xbe"
|
||||
#elif defined(_XBOX360)
|
||||
#define EXT_EXECUTABLES "xex"
|
||||
#elif defined(GEKKO)
|
||||
#define EXT_EXECUTABLES "dol"
|
||||
#else
|
||||
#define EXT_EXECUTABLES ""
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
@ -107,6 +107,48 @@ frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
||||
return frontend;
|
||||
}
|
||||
|
||||
bool frontend_driver_get_core_extension(char *s, size_t len)
|
||||
{
|
||||
#ifdef HAVE_DYNAMIC
|
||||
|
||||
#ifdef _WIN32
|
||||
strlcpy(s, "dll", len);
|
||||
return true;
|
||||
#elif defined(__APPLE__) || defined(__MACH__)
|
||||
strlcpy(s, "dylib", len);
|
||||
return true;
|
||||
#else
|
||||
strlcpy(s, "so", len);
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
strlcpy(s, "self|bin", len);
|
||||
return true;
|
||||
#elif defined(PSP)
|
||||
strlcpy(s, "pbp", len);
|
||||
return true;
|
||||
#elif defined(VITA)
|
||||
strlcpy(s, "velf", len);
|
||||
return true;
|
||||
#elif defined(_XBOX1)
|
||||
strlcpy(s, "xbe", len);
|
||||
return true;
|
||||
#elif defined(_XBOX360)
|
||||
strlcpy(s, "xex", len);
|
||||
return true;
|
||||
#elif defined(GEKKO)
|
||||
strlcpy(s, "dol", len);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool frontend_driver_get_salamander_basename(char *s, size_t len)
|
||||
{
|
||||
#ifdef HAVE_DYNAMIC
|
||||
|
@ -140,6 +140,8 @@ void frontend_driver_exitspawn(char *s, size_t len);
|
||||
|
||||
bool frontend_driver_has_fork(void);
|
||||
|
||||
bool frontend_driver_get_core_extension(char *s, size_t len);
|
||||
|
||||
bool frontend_driver_get_salamander_basename(char *s, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <file/dir_list.h>
|
||||
#include <dynamic/dylib.h>
|
||||
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "../dynamic.h"
|
||||
#include "../file_ext.h"
|
||||
#include "../general.h"
|
||||
#include "../performance.h"
|
||||
#include "../verbosity.h"
|
||||
@ -382,7 +382,10 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_config,
|
||||
unsigned max_width, unsigned max_height)
|
||||
{
|
||||
softfilter_simd_mask_t cpu_features = retro_get_cpu_features();
|
||||
char basedir[PATH_MAX_LENGTH] = {0};
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
#ifdef HAVE_DYLIB
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
struct string_list *plugs = NULL;
|
||||
rarch_softfilter_t *filt = NULL;
|
||||
|
||||
@ -402,7 +405,11 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_config,
|
||||
#if defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false, false);
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, false);
|
||||
|
||||
if (!plugs)
|
||||
{
|
||||
RARCH_ERR("[SoftFilter]: Could not build up string list...\n");
|
||||
|
@ -42,7 +42,6 @@
|
||||
|
||||
#include "../../verbosity.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../file_ext.h"
|
||||
#include "../../system.h"
|
||||
|
||||
#include "../../tasks/tasks.h"
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "../gfx/video_shader_driver.h"
|
||||
#include "../config.features.h"
|
||||
#include "../git_version.h"
|
||||
#include "../file_ext.h"
|
||||
#include "../input/input_config.h"
|
||||
#include "../dir_list_special.h"
|
||||
#include "../string_list_special.h"
|
||||
@ -3181,8 +3180,13 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
strlcpy(info->exts, "lpl", sizeof(info->exts));
|
||||
break;
|
||||
case DISPLAYLIST_CORES:
|
||||
info->type_default = MENU_FILE_PLAIN;
|
||||
strlcpy(info->exts, EXT_EXECUTABLES, sizeof(info->exts));
|
||||
{
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
|
||||
info->type_default = MENU_FILE_PLAIN;
|
||||
if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
strlcpy(info->exts, ext_name, sizeof(info->exts));
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_CONFIG_FILES:
|
||||
info->type_default = MENU_FILE_CONFIG;
|
||||
|
@ -28,8 +28,9 @@
|
||||
#include <file/config_file.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "menu_setting.h"
|
||||
#include "../frontend/frontend_driver.h"
|
||||
|
||||
#include "menu_setting.h"
|
||||
#include "menu_driver.h"
|
||||
#include "menu_animation.h"
|
||||
#include "menu_display.h"
|
||||
@ -50,7 +51,6 @@
|
||||
#include "../input/input_config.h"
|
||||
#include "../input/input_autodetect.h"
|
||||
#include "../config.def.h"
|
||||
#include "../file_ext.h"
|
||||
#include "../performance.h"
|
||||
|
||||
|
||||
@ -3318,18 +3318,23 @@ static bool setting_append_list_main_menu_options(
|
||||
if (frontend_driver_has_fork())
|
||||
#endif
|
||||
{
|
||||
CONFIG_ACTION(
|
||||
list, list_info,
|
||||
menu_hash_to_str(MENU_LABEL_CORE_LIST),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_CORE_LIST),
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].size = sizeof(settings->libretro);
|
||||
(*list)[list_info->index - 1].value.string = settings->libretro;
|
||||
(*list)[list_info->index - 1].values = EXT_EXECUTABLES;
|
||||
menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_LOAD_CORE);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_BROWSER_ACTION);
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
|
||||
if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
{
|
||||
CONFIG_ACTION(
|
||||
list, list_info,
|
||||
menu_hash_to_str(MENU_LABEL_CORE_LIST),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_CORE_LIST),
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].size = sizeof(settings->libretro);
|
||||
(*list)[list_info->index - 1].value.string = settings->libretro;
|
||||
(*list)[list_info->index - 1].values = ext_name;
|
||||
menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_LOAD_CORE);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_BROWSER_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG_ACTION(
|
||||
|
Loading…
x
Reference in New Issue
Block a user