mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Create string_list_special.c
This commit is contained in:
parent
1b51882b8a
commit
08a97a4ca3
@ -137,6 +137,7 @@ OBJ += frontend/frontend.o \
|
|||||||
libretro-common/string/stdstring.o \
|
libretro-common/string/stdstring.o \
|
||||||
libretro-common/memmap/memalign.o \
|
libretro-common/memmap/memalign.o \
|
||||||
dir_list_special.o \
|
dir_list_special.o \
|
||||||
|
string_list_special.o \
|
||||||
file_ops.o \
|
file_ops.o \
|
||||||
libretro-common/file/nbio/nbio_stdio.o \
|
libretro-common/file/nbio/nbio_stdio.o \
|
||||||
libretro-common/file/file_path.o \
|
libretro-common/file/file_path.o \
|
||||||
|
@ -608,6 +608,7 @@ FILE
|
|||||||
#include "../libretro-common/file/retro_file.c"
|
#include "../libretro-common/file/retro_file.c"
|
||||||
#include "../libretro-common/file/retro_stat.c"
|
#include "../libretro-common/file/retro_stat.c"
|
||||||
#include "../dir_list_special.c"
|
#include "../dir_list_special.c"
|
||||||
|
#include "../string_list_special.c"
|
||||||
#include "../libretro-common/string/string_list.c"
|
#include "../libretro-common/string/string_list.c"
|
||||||
#include "../libretro-common/string/stdstring.c"
|
#include "../libretro-common/string/stdstring.c"
|
||||||
#include "../file_ops.c"
|
#include "../file_ops.c"
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string/string_list.h>
|
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "menu_display.h"
|
#include "menu_display.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
#include "../string_list_special.h"
|
||||||
|
|
||||||
static bool menu_alive = false;
|
static bool menu_alive = false;
|
||||||
|
|
||||||
@ -85,35 +85,9 @@ const char *menu_driver_find_ident(int idx)
|
|||||||
* Returns: string listing of all menu driver names,
|
* Returns: string listing of all menu driver names,
|
||||||
* separated by '|'.
|
* separated by '|'.
|
||||||
**/
|
**/
|
||||||
const char* config_get_menu_driver_options(void)
|
const char *config_get_menu_driver_options(void)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
return string_list_special_new(STRING_LIST_MENU_DRIVERS);
|
||||||
unsigned i;
|
|
||||||
char *options = NULL;
|
|
||||||
int options_len = 0;
|
|
||||||
struct string_list *options_l = string_list_new();
|
|
||||||
|
|
||||||
attr.i = 0;
|
|
||||||
|
|
||||||
if (!options_l)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (i = 0; menu_driver_find_handle(i); i++)
|
|
||||||
{
|
|
||||||
const char *opt = menu_driver_find_ident(i);
|
|
||||||
options_len += strlen(opt) + 1;
|
|
||||||
string_list_append(options_l, opt, attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
options = (char*)calloc(options_len, sizeof(char));
|
|
||||||
|
|
||||||
if (options)
|
|
||||||
string_list_join_concat(options, options_len, options_l, "|");
|
|
||||||
|
|
||||||
string_list_free(options_l);
|
|
||||||
options_l = NULL;
|
|
||||||
|
|
||||||
return options;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void find_menu_driver(void)
|
void find_menu_driver(void)
|
||||||
|
66
string_list_special.c
Normal file
66
string_list_special.c
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/* RetroArch - A frontend for libretro.
|
||||||
|
* Copyright (C) 2011-2015 - 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <string/string_list.h>
|
||||||
|
|
||||||
|
#include "string_list_special.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
#include "menu/menu_driver.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const char *string_list_special_new(enum string_list_type type)
|
||||||
|
{
|
||||||
|
union string_list_elem_attr attr;
|
||||||
|
unsigned i;
|
||||||
|
char *options = NULL;
|
||||||
|
int len = 0;
|
||||||
|
struct string_list *s = string_list_new();
|
||||||
|
|
||||||
|
attr.i = 0;
|
||||||
|
|
||||||
|
if (!s)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case STRING_LIST_MENU_DRIVERS:
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
for (i = 0; menu_driver_find_handle(i); i++)
|
||||||
|
{
|
||||||
|
const char *opt = menu_driver_find_ident(i);
|
||||||
|
len += strlen(opt) + 1;
|
||||||
|
|
||||||
|
string_list_append(s, opt, attr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case STRING_LIST_NONE:
|
||||||
|
default:
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
options = (char*)calloc(len, sizeof(char));
|
||||||
|
|
||||||
|
if (options)
|
||||||
|
string_list_join_concat(options, len, s, "|");
|
||||||
|
|
||||||
|
end:
|
||||||
|
string_list_free(s);
|
||||||
|
s = NULL;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
27
string_list_special.h
Normal file
27
string_list_special.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/* RetroArch - A frontend for libretro.
|
||||||
|
* Copyright (C) 2011-2015 - 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 _STRING_LIST_SPECIAL_H
|
||||||
|
#define _STRING_LIST_SPECIAL_H
|
||||||
|
|
||||||
|
enum string_list_type
|
||||||
|
{
|
||||||
|
STRING_LIST_NONE = 0,
|
||||||
|
STRING_LIST_MENU_DRIVERS
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *string_list_special_new(enum string_list_type type);
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user