RetroArch/menu/menu_content.c

70 lines
2.1 KiB
C
Raw Normal View History

2016-01-25 03:32:52 +00:00
/* RetroArch - A frontend for libretro.
2017-01-22 12:40:32 +00:00
* Copyright (C) 2011-2017 - Daniel De Matteis
2016-01-25 03:32:52 +00:00
*
* 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/>.
*/
2016-09-05 22:56:00 +00:00
#include <compat/strl.h>
#include <retro_assert.h>
2016-03-20 15:29:14 +00:00
#include <streams/file_stream.h>
2016-01-25 03:44:54 +00:00
#include <file/file_path.h>
#include <retro_stat.h>
#include <string/stdstring.h>
2016-01-25 03:44:54 +00:00
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
2016-01-25 03:32:52 +00:00
#include "menu_content.h"
2016-01-25 03:44:54 +00:00
#include "menu_driver.h"
#include "menu_shader.h"
#include "../core_info.h"
2016-01-25 03:44:54 +00:00
#include "../configuration.h"
#include "../defaults.h"
#include "../playlist.h"
#include "../verbosity.h"
2016-07-01 13:55:36 +00:00
bool menu_content_playlist_find_associated_core(const char *path, char *s, size_t len)
{
unsigned j;
2016-12-04 03:42:01 +00:00
bool ret = false;
settings_t *settings = config_get_ptr();
2016-07-01 13:55:36 +00:00
struct string_list *existing_core_names =
2017-04-28 20:59:13 +00:00
string_split(settings->arrays.playlist_names, ";");
2016-07-01 13:55:36 +00:00
struct string_list *existing_core_paths =
2017-04-28 20:59:13 +00:00
string_split(settings->arrays.playlist_cores, ";");
2016-07-01 13:55:36 +00:00
for (j = 0; j < existing_core_names->size; j++)
{
2016-12-15 11:18:26 +00:00
if (!string_is_equal(path, existing_core_names->elems[j].data))
continue;
if (existing_core_paths)
2016-07-01 13:55:36 +00:00
{
2016-12-15 11:18:26 +00:00
const char *existing_core = existing_core_paths->elems[j].data;
2016-07-01 13:55:36 +00:00
2016-12-15 11:18:26 +00:00
if (existing_core)
{
strlcpy(s, existing_core, len);
ret = true;
2016-07-01 13:55:36 +00:00
}
}
2016-12-15 11:18:26 +00:00
break;
2016-07-01 13:55:36 +00:00
}
string_list_free(existing_core_names);
string_list_free(existing_core_paths);
return ret;
}