diff --git a/blackberry-qnx/bb10/src/RetroArch-Cascades.h b/blackberry-qnx/bb10/src/RetroArch-Cascades.h index 449b184a4f..c18e9e0c3c 100644 --- a/blackberry-qnx/bb10/src/RetroArch-Cascades.h +++ b/blackberry-qnx/bb10/src/RetroArch-Cascades.h @@ -9,7 +9,7 @@ #include <screen/screen.h> #include <sys/neutrino.h> #include "ButtonMap.h" -#include "core_info.h" +#include "../../../core_info.h" using namespace bb::cascades; diff --git a/blackberry-qnx/bb10/src/core_info.h b/blackberry-qnx/bb10/src/core_info.h deleted file mode 100644 index 69d5695ee5..0000000000 --- a/blackberry-qnx/bb10/src/core_info.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CORE_INFO_H_ -#define CORE_INFO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "conf/config_file.h" - -typedef struct { - char * path; - config_file_t* data; - char * configPath; - char * displayName; - char * supportedExtensions; -} core_info_t; - -typedef struct { - core_info_t *list; - int count; -} core_info_list_t; - -core_info_list_t *get_core_info_list(); -void free_core_info_list(core_info_list_t * core_info_list); - -#ifdef __cplusplus -} -#endif - -#endif /* CORE_INFO_H_ */ diff --git a/blackberry-qnx/bb10/src/core_info.c b/core_info.c similarity index 56% rename from blackberry-qnx/bb10/src/core_info.c rename to core_info.c index 5249e7f393..da9b110b17 100644 --- a/blackberry-qnx/bb10/src/core_info.c +++ b/core_info.c @@ -1,9 +1,24 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2013 - Hans-Kristian Arntzen + * + * 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 "core_info.h" #include "general.h" #include <math.h> #include <dirent.h> -core_info_list_t *get_core_info_list() +core_info_list_t *get_core_info_list(void) { DIR *dirp; struct dirent* direntp; @@ -11,23 +26,24 @@ core_info_list_t *get_core_info_list() core_info_t *core_info; core_info_list_t *core_info_list; - if(!*g_settings.libretro) + if (!*g_settings.libretro) return NULL; dirp = opendir(g_settings.libretro); - if( dirp == NULL ) + if (dirp == NULL) return NULL; //Count number of cores - for(;;) + for (;;) { - direntp = readdir( dirp ); - if( direntp == NULL ) break; + direntp = readdir(dirp); + if (direntp == NULL) + break; count++; } rewinddir(dirp); - if(count == 2) + if (count == 2) { //Only . and .. closedir(dirp); @@ -39,36 +55,38 @@ core_info_list_t *get_core_info_list() core_info_list->list = core_info; count = 0; - for(;;) + for (;;) { - direntp = readdir( dirp ); - if( direntp == NULL ) break; - if(strcmp((char*)direntp->d_name, ".")==0 || strcmp((char*)direntp->d_name, "..")==0) + direntp = readdir(dirp); + if (direntp == NULL) + break; + if (strcmp((char*)direntp->d_name, ".") == 0 || strcmp((char*)direntp->d_name, "..") == 0) continue; core_info[count++].path = strdup((char*)direntp->d_name); } core_info_list->count = count; - for(i=0;i<count;++i) + for (i = 0; i < count; i++) { char info_path[255]; snprintf(info_path, sizeof(info_path), "app/native/modules/"); strncat(info_path, core_info[i].path, sizeof(info_path)-strlen(info_path)-1); - char * substr = strrchr(info_path, '_'); - if(substr) + char *substr = strrchr(info_path, '_'); + + if (substr) { info_path[strlen(info_path) - strlen(substr)] = '\0'; strncat(info_path, ".info", sizeof(info_path)-strlen(info_path)-1); core_info[i].data = config_file_new(info_path); - if(core_info[i].data) + if (core_info[i].data) { config_get_string(core_info[i].data, "display_name", &core_info[i].displayName); config_get_string(core_info[i].data, "supported_extensions", &core_info[i].supportedExtensions); - } else { - core_info[i].displayName = "Not Supported"; } + else + core_info[i].displayName = "Not Supported"; } } @@ -77,16 +95,18 @@ core_info_list_t *get_core_info_list() return core_info_list; } -void free_core_info_list(core_info_list_t * core_info_list) +void free_core_info_list(core_info_list_t *core_info_list) { int i; - for(i=0;i<core_info_list->count;++i) + + for (i = 0; i < core_info_list->count; i++) { free(core_info_list->list[i].path); free(core_info_list->list[i].displayName); free(core_info_list->list[i].supportedExtensions); config_file_free(core_info_list->list[i].data); } + free(core_info_list->list); free(core_info_list); } diff --git a/core_info.h b/core_info.h new file mode 100644 index 0000000000..f26cd327e9 --- /dev/null +++ b/core_info.h @@ -0,0 +1,45 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2013 - Hans-Kristian Arntzen + * + * 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 CORE_INFO_H_ +#define CORE_INFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "conf/config_file.h" + +typedef struct { + char * path; + config_file_t* data; + char * configPath; + char * displayName; + char * supportedExtensions; +} core_info_t; + +typedef struct { + core_info_t *list; + int count; +} core_info_list_t; + +core_info_list_t *get_core_info_list(void); +void free_core_info_list(core_info_list_t * core_info_list); + +#ifdef __cplusplus +} +#endif + +#endif /* CORE_INFO_H_ */ diff --git a/griffin/griffin.c b/griffin/griffin.c index e647c924d1..ef44ab0600 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -86,6 +86,10 @@ CONFIG FILE #include "../conf/config_file.c" #include "../core_options.c" +#if defined(__QNX__) +#include "../core_info.c" +#endif + /*============================================================ CHEATS ============================================================ */