2009-07-24 22:34:55 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* libwiigui Template
|
2009-10-05 12:53:19 +02:00
|
|
|
* Tantric 2009
|
2009-07-30 07:41:12 +02:00
|
|
|
*
|
2009-10-05 12:53:19 +02:00
|
|
|
* modified by dimok and ardi
|
2009-07-24 22:34:55 +02:00
|
|
|
*
|
|
|
|
* filebrowser.h
|
|
|
|
*
|
|
|
|
* Generic file routines - reading, writing, browsing
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _FILEBROWSER_H_
|
|
|
|
#define _FILEBROWSER_H_
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <gccore.h>
|
|
|
|
|
|
|
|
#define MAXJOLIET 255
|
2009-07-30 07:41:12 +02:00
|
|
|
#define MAXDISPLAY MAXPATHLEN
|
2009-10-05 12:53:19 +02:00
|
|
|
#define ROOTDIRLEN 10
|
2009-07-30 07:41:12 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
u64 offset; // DVD offset
|
|
|
|
u64 length; // file length in 64 bytes for sizes higher than 4GB
|
|
|
|
char isdir; // 0 - file, 1 - directory
|
|
|
|
char filename[MAXJOLIET + 1]; // full filename
|
|
|
|
char displayname[MAXDISPLAY + 1]; // name for browser display
|
2009-07-30 07:41:12 +02:00
|
|
|
} BROWSERENTRY;
|
2009-07-24 22:34:55 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
char dir[MAXPATHLEN]; // directory path of browserList
|
|
|
|
char rootdir[ROOTDIRLEN];// directory path of browserList
|
|
|
|
int pageIndex; // starting index of browserList page display
|
|
|
|
std::vector<BROWSERENTRY> browserList;
|
2009-10-05 12:53:19 +02:00
|
|
|
} BROWSERINFO;
|
|
|
|
extern BROWSERINFO *browser;
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
#define FB_NOFOLDER_BTN 0x0001
|
|
|
|
#define FB_NODEVICE_BTN 0x0002
|
|
|
|
#define FB_TRYROOTDIR 0x0004
|
|
|
|
#define FB_TRYSTDDEV 0x0008
|
|
|
|
#define FB_DEFAULT (FB_TRYROOTDIR | FB_TRYSTDDEV)
|
2009-07-24 22:34:55 +02:00
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
typedef int (*FILEFILTERCALLBACK)(BROWSERENTRY *Entry, void* Args);
|
|
|
|
int noDIRS(BROWSERENTRY *Entry, void* Args);
|
|
|
|
int noFILES(BROWSERENTRY *Entry, void* Args);
|
|
|
|
int noEXT(BROWSERENTRY *Entry, void* Args);
|
2009-10-05 12:53:19 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
typedef struct _FILTERCASCADE
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
FILEFILTERCALLBACK filter;
|
|
|
|
void *filter_args;
|
|
|
|
_FILTERCASCADE *next;
|
2009-10-05 12:53:19 +02:00
|
|
|
} FILTERCASCADE;
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* BrowseDevice
|
|
|
|
* Displays a list of files on the selected path
|
|
|
|
* Path returns the selectet Path/File
|
|
|
|
* Path_size is the space of the Path-array
|
|
|
|
* Ret: 0 ok / -1 Error
|
|
|
|
***************************************************************************/
|
|
|
|
/***************************************************************************
|
2011-07-26 00:28:22 +02:00
|
|
|
* Example:
|
2009-10-05 12:53:19 +02:00
|
|
|
* FILTERKASKADE filter2 = {noEXT, NULL, NULL};
|
|
|
|
* FILTERKASKADE filter1 = {noDirs, NULL, &filter2};
|
|
|
|
* char Path[MAXPATHLEN] = "SD:/";
|
|
|
|
* BrowseDevice(Path, MAXPATHLEN, FB_DEFAULT, &filter1);
|
|
|
|
*
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
2010-09-24 02:48:03 +02:00
|
|
|
int BrowseDevice(char * Path, int Path_size, int Flags/*=FB_DEFAULT*/, FILTERCASCADE *Filter = NULL);
|
|
|
|
int BrowseDevice(char * Path, int Path_size, int Flags, FILEFILTERCALLBACK Filter, void *FilterArgs = NULL);
|
2009-07-24 22:34:55 +02:00
|
|
|
|
|
|
|
#endif
|
2009-10-05 12:53:19 +02:00
|
|
|
|