From 54a661030f1643e9ddecb8cd4cb45f813ab1489c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 24 Jun 2013 13:52:14 +0200 Subject: [PATCH] (QNX/General) Move core_info.c/.h to root directory for reuse later --- blackberry-qnx/bb10/src/RetroArch-Cascades.h | 2 +- blackberry-qnx/bb10/src/core_info.h | 30 ---------- .../bb10/src/core_info.c => core_info.c | 58 +++++++++++++------ core_info.h | 45 ++++++++++++++ griffin/griffin.c | 4 ++ 5 files changed, 89 insertions(+), 50 deletions(-) delete mode 100644 blackberry-qnx/bb10/src/core_info.h rename blackberry-qnx/bb10/src/core_info.c => core_info.c (56%) create mode 100644 core_info.h 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 #include #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 . + */ + #include "core_info.h" #include "general.h" #include #include -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;icount;++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 . + */ + +#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 ============================================================ */