mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 14:28:47 +00:00
(QNX/General) Move core_info.c/.h to root directory for reuse later
This commit is contained in:
parent
395309d072
commit
54a661030f
@ -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;
|
||||
|
||||
|
@ -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_ */
|
@ -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);
|
||||
}
|
45
core_info.h
Normal file
45
core_info.h
Normal file
@ -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_ */
|
@ -86,6 +86,10 @@ CONFIG FILE
|
||||
#include "../conf/config_file.c"
|
||||
#include "../core_options.c"
|
||||
|
||||
#if defined(__QNX__)
|
||||
#include "../core_info.c"
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
CHEATS
|
||||
============================================================ */
|
||||
|
Loading…
Reference in New Issue
Block a user