mirror of
https://github.com/libretro/RetroArch
synced 2025-03-16 16:21:15 +00:00
--disable-menu buildfixes
This commit is contained in:
parent
e8ab0a892a
commit
9be7da9665
516
retroarch.c
516
retroarch.c
@ -3082,6 +3082,264 @@ static int16_t input_state_wrap(
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* DRIVERS */
|
||||
|
||||
/**
|
||||
* find_driver_nonempty:
|
||||
* @label : string of driver type to be found.
|
||||
* @i : index of driver.
|
||||
* @str : identifier name of the found driver
|
||||
* gets written to this string.
|
||||
* @len : size of @str.
|
||||
*
|
||||
* Find driver based on @label.
|
||||
*
|
||||
* Returns: NULL if no driver based on @label found, otherwise
|
||||
* pointer to driver.
|
||||
**/
|
||||
static const void *find_driver_nonempty(
|
||||
const char *label, int i,
|
||||
char *s, size_t len)
|
||||
{
|
||||
if (string_is_equal(label, "camera_driver"))
|
||||
{
|
||||
if (camera_drivers[i])
|
||||
{
|
||||
const char *ident = camera_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return camera_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "location_driver"))
|
||||
{
|
||||
if (location_drivers[i])
|
||||
{
|
||||
const char *ident = location_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return location_drivers[i];
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_MENU
|
||||
else if (string_is_equal(label, "menu_driver"))
|
||||
{
|
||||
if (menu_ctx_drivers[i])
|
||||
{
|
||||
const char *ident = menu_ctx_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return menu_ctx_drivers[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (string_is_equal(label, "input_driver"))
|
||||
{
|
||||
if (input_drivers[i])
|
||||
{
|
||||
const char *ident = input_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return input_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "input_joypad_driver"))
|
||||
{
|
||||
if (joypad_drivers[i])
|
||||
{
|
||||
const char *ident = joypad_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return joypad_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "video_driver"))
|
||||
{
|
||||
if (video_drivers[i])
|
||||
{
|
||||
const char *ident = video_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return video_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "audio_driver"))
|
||||
{
|
||||
if (audio_drivers[i])
|
||||
{
|
||||
const char *ident = audio_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return audio_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "record_driver"))
|
||||
{
|
||||
if (record_drivers[i])
|
||||
{
|
||||
const char *ident = record_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return record_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "midi_driver"))
|
||||
{
|
||||
if (midi_driver_find_handle(i))
|
||||
{
|
||||
const char *ident = midi_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return midi_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "audio_resampler_driver"))
|
||||
{
|
||||
if (audio_resampler_driver_find_handle(i))
|
||||
{
|
||||
const char *ident = audio_resampler_driver_find_ident(i);
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return audio_resampler_driver_find_handle(i);
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "bluetooth_driver"))
|
||||
{
|
||||
if (bluetooth_drivers[i])
|
||||
{
|
||||
const char *ident = bluetooth_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return bluetooth_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "wifi_driver"))
|
||||
{
|
||||
if (wifi_drivers[i])
|
||||
{
|
||||
const char *ident = wifi_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return wifi_drivers[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* driver_find_index:
|
||||
* @label : string of driver type to be found.
|
||||
* @drv : identifier of driver to be found.
|
||||
*
|
||||
* Find index of the driver, based on @label.
|
||||
*
|
||||
* Returns: -1 if no driver based on @label and @drv found, otherwise
|
||||
* index number of the driver found in the array.
|
||||
**/
|
||||
static int driver_find_index(const char *label, const char *drv)
|
||||
{
|
||||
unsigned i;
|
||||
char str[256];
|
||||
|
||||
str[0] = '\0';
|
||||
|
||||
for (i = 0;
|
||||
find_driver_nonempty(label, i, str, sizeof(str)) != NULL; i++)
|
||||
{
|
||||
if (string_is_empty(str))
|
||||
break;
|
||||
if (string_is_equal_noncase(drv, str))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Find index of the driver, based on @drv->label */
|
||||
static bool driver_ctl_find_index(driver_ctx_info_t *drv)
|
||||
{
|
||||
if (!drv)
|
||||
return false;
|
||||
drv->len = driver_find_index(drv->label, drv->s);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_find_last:
|
||||
* @label : string of driver type to be found.
|
||||
* @s : identifier of driver to be found.
|
||||
* @len : size of @s.
|
||||
*
|
||||
* Find last driver in driver array.
|
||||
**/
|
||||
static bool driver_find_last(const char *label, char *s, size_t len)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0;
|
||||
find_driver_nonempty(label, i, s, len) != NULL; i++)
|
||||
{}
|
||||
|
||||
if (i)
|
||||
i = i - 1;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
find_driver_nonempty(label, i, s, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_find_prev:
|
||||
* @label : string of driver type to be found.
|
||||
* @s : identifier of driver to be found.
|
||||
* @len : size of @s.
|
||||
*
|
||||
* Find previous driver in driver array.
|
||||
**/
|
||||
static bool driver_find_prev(const char *label, char *s, size_t len)
|
||||
{
|
||||
int i = driver_find_index(label, s);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
find_driver_nonempty(label, i - 1, s, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
RARCH_WARN(
|
||||
"Couldn't find any previous driver (current one: \"%s\").\n", s);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_find_next:
|
||||
* @label : string of driver type to be found.
|
||||
* @s : identifier of driver to be found.
|
||||
* @len : size of @s.
|
||||
*
|
||||
* Find next driver in driver array.
|
||||
**/
|
||||
static bool driver_find_next(const char *label, char *s, size_t len)
|
||||
{
|
||||
int i = driver_find_index(label, s);
|
||||
|
||||
if (i >= 0 && string_is_not_equal(s, "null"))
|
||||
{
|
||||
find_driver_nonempty(label, i + 1, s, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
RARCH_WARN("%s (current one: \"%s\").\n",
|
||||
msg_hash_to_str(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER),
|
||||
s);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* TODO/FIXME - public global variables */
|
||||
@ -7325,264 +7583,6 @@ const char *menu_driver_get_last_shader_pass_dir(void)
|
||||
|
||||
#endif
|
||||
|
||||
/* DRIVERS */
|
||||
|
||||
/**
|
||||
* find_driver_nonempty:
|
||||
* @label : string of driver type to be found.
|
||||
* @i : index of driver.
|
||||
* @str : identifier name of the found driver
|
||||
* gets written to this string.
|
||||
* @len : size of @str.
|
||||
*
|
||||
* Find driver based on @label.
|
||||
*
|
||||
* Returns: NULL if no driver based on @label found, otherwise
|
||||
* pointer to driver.
|
||||
**/
|
||||
static const void *find_driver_nonempty(
|
||||
const char *label, int i,
|
||||
char *s, size_t len)
|
||||
{
|
||||
if (string_is_equal(label, "camera_driver"))
|
||||
{
|
||||
if (camera_drivers[i])
|
||||
{
|
||||
const char *ident = camera_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return camera_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "location_driver"))
|
||||
{
|
||||
if (location_drivers[i])
|
||||
{
|
||||
const char *ident = location_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return location_drivers[i];
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_MENU
|
||||
else if (string_is_equal(label, "menu_driver"))
|
||||
{
|
||||
if (menu_ctx_drivers[i])
|
||||
{
|
||||
const char *ident = menu_ctx_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return menu_ctx_drivers[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (string_is_equal(label, "input_driver"))
|
||||
{
|
||||
if (input_drivers[i])
|
||||
{
|
||||
const char *ident = input_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return input_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "input_joypad_driver"))
|
||||
{
|
||||
if (joypad_drivers[i])
|
||||
{
|
||||
const char *ident = joypad_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return joypad_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "video_driver"))
|
||||
{
|
||||
if (video_drivers[i])
|
||||
{
|
||||
const char *ident = video_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return video_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "audio_driver"))
|
||||
{
|
||||
if (audio_drivers[i])
|
||||
{
|
||||
const char *ident = audio_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return audio_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "record_driver"))
|
||||
{
|
||||
if (record_drivers[i])
|
||||
{
|
||||
const char *ident = record_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return record_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "midi_driver"))
|
||||
{
|
||||
if (midi_driver_find_handle(i))
|
||||
{
|
||||
const char *ident = midi_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return midi_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "audio_resampler_driver"))
|
||||
{
|
||||
if (audio_resampler_driver_find_handle(i))
|
||||
{
|
||||
const char *ident = audio_resampler_driver_find_ident(i);
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return audio_resampler_driver_find_handle(i);
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "bluetooth_driver"))
|
||||
{
|
||||
if (bluetooth_drivers[i])
|
||||
{
|
||||
const char *ident = bluetooth_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return bluetooth_drivers[i];
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(label, "wifi_driver"))
|
||||
{
|
||||
if (wifi_drivers[i])
|
||||
{
|
||||
const char *ident = wifi_drivers[i]->ident;
|
||||
|
||||
strlcpy(s, ident, len);
|
||||
return wifi_drivers[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_find_last:
|
||||
* @label : string of driver type to be found.
|
||||
* @s : identifier of driver to be found.
|
||||
* @len : size of @s.
|
||||
*
|
||||
* Find last driver in driver array.
|
||||
**/
|
||||
static bool driver_find_last(const char *label, char *s, size_t len)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0;
|
||||
find_driver_nonempty(label, i, s, len) != NULL; i++)
|
||||
{}
|
||||
|
||||
if (i)
|
||||
i = i - 1;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
find_driver_nonempty(label, i, s, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_find_index:
|
||||
* @label : string of driver type to be found.
|
||||
* @drv : identifier of driver to be found.
|
||||
*
|
||||
* Find index of the driver, based on @label.
|
||||
*
|
||||
* Returns: -1 if no driver based on @label and @drv found, otherwise
|
||||
* index number of the driver found in the array.
|
||||
**/
|
||||
static int driver_find_index(const char *label, const char *drv)
|
||||
{
|
||||
unsigned i;
|
||||
char str[256];
|
||||
|
||||
str[0] = '\0';
|
||||
|
||||
for (i = 0;
|
||||
find_driver_nonempty(label, i, str, sizeof(str)) != NULL; i++)
|
||||
{
|
||||
if (string_is_empty(str))
|
||||
break;
|
||||
if (string_is_equal_noncase(drv, str))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* driver_find_prev:
|
||||
* @label : string of driver type to be found.
|
||||
* @s : identifier of driver to be found.
|
||||
* @len : size of @s.
|
||||
*
|
||||
* Find previous driver in driver array.
|
||||
**/
|
||||
static bool driver_find_prev(const char *label, char *s, size_t len)
|
||||
{
|
||||
int i = driver_find_index(label, s);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
find_driver_nonempty(label, i - 1, s, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
RARCH_WARN(
|
||||
"Couldn't find any previous driver (current one: \"%s\").\n", s);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_find_next:
|
||||
* @label : string of driver type to be found.
|
||||
* @s : identifier of driver to be found.
|
||||
* @len : size of @s.
|
||||
*
|
||||
* Find next driver in driver array.
|
||||
**/
|
||||
static bool driver_find_next(const char *label, char *s, size_t len)
|
||||
{
|
||||
int i = driver_find_index(label, s);
|
||||
|
||||
if (i >= 0 && string_is_not_equal(s, "null"))
|
||||
{
|
||||
find_driver_nonempty(label, i + 1, s, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
RARCH_WARN("%s (current one: \"%s\").\n",
|
||||
msg_hash_to_str(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER),
|
||||
s);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Find index of the driver, based on @drv->label */
|
||||
static bool driver_ctl_find_index(driver_ctx_info_t *drv)
|
||||
{
|
||||
if (!drv)
|
||||
return false;
|
||||
drv->len = driver_find_index(drv->label, drv->s);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
|
Loading…
x
Reference in New Issue
Block a user