usbloadergx/source/listfiles.c
dimok321 e8de174866 *Fixed gamebrowser wrong DPAD behaviour after switching from Carousell
*Fixed browsers not getting darker when going into HOME Menu
*Removed MP3 Menu
*Added Patch Country Strings (thanks to WiiPower and SoftChip Team)
Note: "This is an option for import games only. If you have problems with that try this option. Mostly japanese users need that.

*some other small fixes

**Note 2: Right now the loader is having some issue with IOS Reload. If you initialized network and try to run a game and its not working its due to that bug. I am trying to find why it isnt working right now. FreetypGX is making codedumps on there sometimes (ardi look into it you missed something).

** Also there is a new libogc in our download in which there are new libfat and libogc files. If you had issues with SD they might now be fixed, so try it out.
2009-05-30 16:58:34 +00:00

51 lines
830 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gccore.h>
#include <fat.h>
#include <sys/dir.h>
#include <unistd.h>
#include "listfiles.h"
char filename[80];
s32 filenamescmp(const void *a, const void *b)
{
/* Compare strings */
return stricmp((char *)a, (char *)b);
}
int GetFiles(char * filespath)
{
int countfiles = 0;
struct stat st;
DIR_ITER* dir;
dir = diropen (filespath);
if (dir == NULL) //If empty
{
return 0;
}
else
{
while (dirnext(dir,filename,&st) == 0)
{
if ((st.st_mode & S_IFDIR) == 0)
{
// st.st_mode & S_IFDIR indicates a directory
snprintf(alldirfiles[countfiles], 70, "%s", filename);
countfiles++;
}
}
}
qsort(alldirfiles, countfiles, sizeof(char[70]), filenamescmp);
return countfiles;
}