Create frontend->parse_drive_list

This commit is contained in:
twinaphex 2015-06-15 22:45:02 +02:00
parent 24a1f191c1
commit a2c8f89137
14 changed files with 224 additions and 131 deletions

View File

@ -794,5 +794,6 @@ const frontend_ctx_driver_t frontend_ctx_android = {
NULL, /* load_content */
frontend_android_get_architecture,
NULL, /* get_powerstate */
NULL, /* parse_drive_list */
"android",
};

View File

@ -21,10 +21,16 @@
#include <string.h>
#include <file/file_path.h>
#ifndef IS_SALAMANDER
#include <file/file_list.h>
#endif
#include "../../general.h"
#ifdef IS_SALAMANDER
#include "../../file_ext.h"
#else
#include "../../menu/menu_list.h"
#endif
@ -200,6 +206,21 @@ enum frontend_architecture frontend_ctr_get_architecture(void)
return FRONTEND_ARCH_ARM;
}
static int frontend_ctr_parse_drive_list(void *data)
{
file_list_t *list = (file_list_t*)data;
#ifndef IS_SALAMANDER
if (!list)
return -1;
menu_list_push(list,
"sdmc:/", "", MENU_FILE_DIRECTORY, 0, 0);
#endif
return 0;
}
const frontend_ctx_driver_t frontend_ctx_ctr = {
frontend_ctr_get_environment_settings,
frontend_ctr_init,
@ -215,5 +236,6 @@ const frontend_ctx_driver_t frontend_ctx_ctr = {
NULL, /* load_content */
frontend_ctr_get_architecture,
NULL, /* get_powerstate */
frontend_ctr_parse_drive_list,
"ctr",
};

View File

@ -558,6 +558,27 @@ static enum frontend_architecture frontend_darwin_get_architecture(void)
return FRONTEND_ARCH_NONE;
}
static int frontend_darwin_parse_drive_list(void *data)
{
int ret = -1;
#if TARGET_OS_IPHONE
file_list_t *list = (file_list_t*)data;
menu_list_push(list,
"/var/mobile/Documents/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/var/mobile/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
g_defaults.core_dir, "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list, "/", "",
MENU_FILE_DIRECTORY, 0, 0);
ret = 0;
#endif
return ret;
}
const frontend_ctx_driver_t frontend_ctx_darwin = {
frontend_darwin_get_environment_settings,
NULL, /* init */
@ -573,5 +594,6 @@ const frontend_ctx_driver_t frontend_ctx_darwin = {
frontend_darwin_load_content,
frontend_darwin_get_architecture,
frontend_darwin_get_powerstate,
frontend_darwin_parse_drive_list,
"darwin",
};

View File

@ -15,20 +15,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <boolean.h>
#include "../../driver.h"
#include "../../general.h"
#include "../../libretro_private.h"
#include "../../gfx/drivers/gx_sdk_defines.h"
#include <file/file_path.h>
#if defined(HW_RVL) && !defined(IS_SALAMANDER)
#include "../../wii/mem2_manager.h"
#include <ogc/mutex.h>
#include <ogc/cond.h>
#endif
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
@ -41,6 +27,24 @@
#include <unistd.h>
#include <dirent.h>
#if defined(HW_RVL) && !defined(IS_SALAMANDER)
#include <ogc/mutex.h>
#include <ogc/cond.h>
#include "../../wii/mem2_manager.h"
#endif
#include <boolean.h>
#include <file/file_path.h>
#ifndef IS_SALAMANDER
#include <file/file_list.h>
#endif
#include "../../driver.h"
#include "../../general.h"
#include "../../libretro_private.h"
#include "../../gfx/drivers/gx_sdk_defines.h"
#ifdef HW_RVL
#include <ogc/ios.h>
#include <ogc/usbstorage.h>
@ -381,6 +385,25 @@ static enum frontend_architecture frontend_gx_get_architecture(void)
return FRONTEND_ARCH_PPC;
}
static int frontend_gx_parse_drive_list(void *data)
{
#ifndef IS_SALAMANDER
file_list_t *list = (file_list_t*)data;
#ifdef HW_RVL
menu_list_push(list,
"sd:/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"usb:/", "", MENU_FILE_DIRECTORY, 0, 0);
#endif
menu_list_push(list,
"carda:/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"cardb:/", "", MENU_FILE_DIRECTORY, 0, 0);
#endif
return 0;
}
const frontend_ctx_driver_t frontend_ctx_gx = {
frontend_gx_get_environment_settings,
frontend_gx_init,
@ -396,5 +419,6 @@ const frontend_ctx_driver_t frontend_ctx_gx = {
NULL, /* load_content */
frontend_gx_get_architecture,
NULL, /* get_powerstate */
frontend_gx_parse_drive_list,
"gx",
};

View File

@ -483,5 +483,6 @@ const frontend_ctx_driver_t frontend_ctx_linux = {
NULL, /* load_content */
frontend_linux_get_architecture,
frontend_linux_get_powerstate,
NULL, /* parse_drive_list */
"linux",
};

View File

@ -36,5 +36,6 @@ const frontend_ctx_driver_t frontend_ctx_null = {
NULL, /* load_content */
NULL, /* get_architecture */
NULL, /* get_powerstate */
NULL, /* parse_drive_list */
"null",
};

View File

@ -16,10 +16,14 @@
#include <sys/process.h>
#include <file/file_path.h>
#ifndef IS_SALAMANDER
#include <file/file_list.h>
#endif
#include "../../ps3/sdk_defines.h"
#include "../../general.h"
#include <file/file_path.h>
#define EMULATOR_CONTENT_DIR "SSNE10000"
@ -448,6 +452,38 @@ enum frontend_architecture frontend_ps3_get_architecture(void)
return FRONTEND_ARCH_PPC;
}
static int frontend_ps3_parse_drive_list(void *data)
{
#ifndef IS_SALAMANDER
file_list_t *list = (file_list_t*)data;
menu_list_push(list,
"/app_home/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_hdd0/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_hdd1/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/host_root/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb000/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb001/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb002/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb003/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb004/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb005/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb006/", "", MENU_FILE_DIRECTORY, 0, 0);
#endif
return 0;
}
const frontend_ctx_driver_t frontend_ctx_ps3 = {
frontend_ps3_get_environment_settings,
frontend_ps3_init,
@ -463,5 +499,6 @@ const frontend_ctx_driver_t frontend_ctx_ps3 = {
NULL, /* load_content */
frontend_ps3_get_architecture,
NULL, /* get_powerstate */
frontend_ps3_parse_drive_list,
"ps3",
};

View File

@ -25,8 +25,12 @@
#include <stddef.h>
#include <string.h>
#include "../../gfx/drivers/psp_sdk_defines.h"
#include <file/file_path.h>
#ifndef IS_SALAMANDER
#include <file/file_list.h>
#endif
#include "../../gfx/drivers/psp_sdk_defines.h"
#include "../../general.h"
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER)
@ -266,6 +270,22 @@ enum frontend_architecture frontend_psp_get_architecture(void)
return FRONTEND_ARCH_MIPS;
}
static int frontend_psp_parse_drive_list(void *data)
{
#ifndef IS_SALAMANDER
file_list_t *list = (file_list_t*)data;
menu_list_push(list,
"ms0:/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"ef0:/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"host0:/", "", MENU_FILE_DIRECTORY, 0, 0);
#endif
return 0;
}
const frontend_ctx_driver_t frontend_ctx_psp = {
frontend_psp_get_environment_settings,
frontend_psp_init,
@ -281,5 +301,6 @@ const frontend_ctx_driver_t frontend_ctx_psp = {
NULL, /* load_content */
frontend_psp_get_architecture,
frontend_psp_get_powerstate,
frontend_psp_parse_drive_list,
"psp",
};

View File

@ -79,5 +79,6 @@ const frontend_ctx_driver_t frontend_ctx_qnx = {
NULL, /* load_content */
frontend_qnx_get_architecture,
NULL, /* get_powerstate */
NULL, /* parse_drive_list */
"qnx",
};

View File

@ -12,22 +12,21 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef _XBOX
#include <xtl.h>
#else
#include <windows.h>
#endif
#include <retro_miscellaneous.h>
#include "../frontend_driver.h"
#include <dynamic/dylib.h>
#include "../../general.h"
#include <stdint.h>
#include <boolean.h>
#include <stddef.h>
#include <string.h>
#if defined(_WIN32) && !defined(_XBOX)
#include <windows.h>
#include <retro_miscellaneous.h>
#include <dynamic/dylib.h>
#include <file/file_list.h>
#include "../frontend_driver.h"
#include "../../general.h"
#if defined(_WIN32)
/* We only load this library once, so we let it be
* unloaded at application shutdown, since unloading
* it early seems to cause issues on some systems.
@ -209,6 +208,24 @@ enum frontend_architecture frontend_win32_get_architecture(void)
return FRONTEND_ARCH_NONE;
}
static int frontend_win32_parse_drive_list(void *data)
{
size_t i = 0;
unsigned drives = GetLogicalDrives();
char drive[] = " :\\";
file_list_t *list = (file_list_t*)data;
for (i = 0; i < 32; i++)
{
drive[0] = 'A' + i;
if (drives & (1 << i))
menu_list_push(list,
drive, "", MENU_FILE_DIRECTORY, 0, 0);
}
return 0;
}
const frontend_ctx_driver_t frontend_ctx_win32 = {
NULL, /* environment_get */
frontend_win32_init,
@ -224,5 +241,6 @@ const frontend_ctx_driver_t frontend_ctx_win32 = {
NULL, /* load_content */
frontend_win32_get_architecture,
frontend_win32_get_powerstate,
frontend_win32_parse_drive_list,
"win32",
};

View File

@ -14,19 +14,21 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <xtl.h>
#include <stddef.h>
#include <stdint.h>
#include <stddef.h>
#include "platform_xdk.h"
#include <xtl.h>
#include <xbdm.h>
#include "../../general.h"
#include <file/file_path.h>
#ifndef IS_SALAMANDER
#include <file/file_list.h>
#endif
#include <retro_miscellaneous.h>
#include "platform_xdk.h"
#include "../../general.h"
static bool exit_spawn;
static bool exitspawn_start_game;
@ -380,6 +382,31 @@ enum frontend_architecture frontend_xdk_get_architecture(void)
#endif
}
static int frontend_xdk_parse_drive_list(void *data)
{
#ifndef IS_SALAMANDER
file_list_t *list = (file_list_t*)data;
#if defined(_XBOX1)
menu_list_push(list,
"C:", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"D:", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"E:", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"F:", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"G:", "", MENU_FILE_DIRECTORY, 0, 0);
#elif defined(_XBOX360)
menu_list_push(list,
"game:", "", MENU_FILE_DIRECTORY, 0, 0);
#endif
#endif
return 0;
}
const frontend_ctx_driver_t frontend_ctx_xdk = {
frontend_xdk_get_environment_settings,
frontend_xdk_init,
@ -395,5 +422,6 @@ const frontend_ctx_driver_t frontend_ctx_xdk = {
NULL, /* load_content */
frontend_xdk_get_architecture,
NULL, /* get_powerstate */
frontend_xdk_parse_drive_list,
"xdk",
};

View File

@ -108,3 +108,12 @@ const frontend_ctx_driver_t *frontend_get_ptr(void)
return driver->frontend_ctx;
}
#endif
int frontend_driver_parse_drive_list(void *data)
{
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->parse_drive_list)
return -1;
return frontend->parse_drive_list(data);
}

View File

@ -69,6 +69,7 @@ typedef struct frontend_ctx_driver
void (*content_loaded)(void);
enum frontend_architecture (*get_architecture)(void);
enum frontend_powerstate (*get_powerstate)(int *seconds, int *percent);
int (*parse_drive_list)(void*);
const char *ident;
@ -108,6 +109,8 @@ const frontend_ctx_driver_t *frontend_get_ptr(void);
**/
const frontend_ctx_driver_t *frontend_ctx_init_first(void);
int frontend_driver_parse_drive_list(void *data);
#ifdef __cplusplus
}
#endif

View File

@ -101,103 +101,6 @@ static void menu_displaylist_push_perfcounter(
counters[i]->ident, "", id + i, 0, 0);
}
/**
* menu_displaylist_parse_drive_list:
* @list : File list handle.
*
* Generates default directory drive list.
* Platform-specific.
*
**/
static void menu_displaylist_parse_drive_list(file_list_t *list)
{
size_t i = 0;
(void)i;
#if defined(GEKKO)
#ifdef HW_RVL
menu_list_push(list,
"sd:/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"usb:/", "", MENU_FILE_DIRECTORY, 0, 0);
#endif
menu_list_push(list,
"carda:/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"cardb:/", "", MENU_FILE_DIRECTORY, 0, 0);
#elif defined(_XBOX1)
menu_list_push(list,
"C:", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"D:", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"E:", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"F:", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"G:", "", MENU_FILE_DIRECTORY, 0, 0);
#elif defined(_XBOX360)
menu_list_push(list,
"game:", "", MENU_FILE_DIRECTORY, 0, 0);
#elif defined(_WIN32)
unsigned drives = GetLogicalDrives();
char drive[] = " :\\";
for (i = 0; i < 32; i++)
{
drive[0] = 'A' + i;
if (drives & (1 << i))
menu_list_push(list,
drive, "", MENU_FILE_DIRECTORY, 0, 0);
}
#elif defined(__CELLOS_LV2__)
menu_list_push(list,
"/app_home/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_hdd0/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_hdd1/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/host_root/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb000/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb001/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb002/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb003/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb004/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb005/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/dev_usb006/", "", MENU_FILE_DIRECTORY, 0, 0);
#elif defined(PSP)
menu_list_push(list,
"ms0:/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"ef0:/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"host0:/", "", MENU_FILE_DIRECTORY, 0, 0);
#elif defined(_3DS)
menu_list_push(list,
"sdmc:/", "", MENU_FILE_DIRECTORY, 0, 0);
#elif defined(IOS)
menu_list_push(list,
"/var/mobile/Documents/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
"/var/mobile/", "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list,
g_defaults.core_dir, "", MENU_FILE_DIRECTORY, 0, 0);
menu_list_push(list, "/", "",
MENU_FILE_DIRECTORY, 0, 0);
#else
menu_list_push(list, "/", "",
MENU_FILE_DIRECTORY, 0, 0);
#endif
}
static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
{
unsigned i;
@ -1575,7 +1478,9 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n
if (!*info->path)
{
menu_displaylist_parse_drive_list(info->list);
if (frontend_driver_parse_drive_list(info->list) != 0)
menu_list_push(info->list, "/", "",
MENU_FILE_DIRECTORY, 0, 0);
return 0;
}