diff options
author | Nebuleon Fumika | 2013-02-04 23:45:44 -0500 |
---|---|---|
committer | Nebuleon Fumika | 2013-02-04 23:45:44 -0500 |
commit | d1a7bf5eb558e7db4a1a27e15ebedb02e6b7f804 (patch) | |
tree | d951252d393b9d7defb508483aba29e0daad764c /sdk-modifications/libsrc/fs/fat_misc.c | |
parent | b1c298ab5066c2e37a69c7c30bd499dd11ed6eb3 (diff) | |
download | snes9x2005-d1a7bf5eb558e7db4a1a27e15ebedb02e6b7f804.tar.gz snes9x2005-d1a7bf5eb558e7db4a1a27e15ebedb02e6b7f804.tar.bz2 snes9x2005-d1a7bf5eb558e7db4a1a27e15ebedb02e6b7f804.zip |
Fully integrate BassAceGold's libraries, finally. The README still states that 1.2 is required to overwrite 0.13's stuff; really, 0.13 is needed only for `gcc`. So the sequence goes 0.13's `gcc` -> 1.2 -> BassAceGold's libraries -> make `libds2a.a`.
DMA function names changed to match BassAceGold's.
Diffstat (limited to 'sdk-modifications/libsrc/fs/fat_misc.c')
-rw-r--r-- | sdk-modifications/libsrc/fs/fat_misc.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/sdk-modifications/libsrc/fs/fat_misc.c b/sdk-modifications/libsrc/fs/fat_misc.c index c0f62ac..335ab59 100644 --- a/sdk-modifications/libsrc/fs/fat_misc.c +++ b/sdk-modifications/libsrc/fs/fat_misc.c @@ -1,9 +1,9 @@ -//fat_misc.c -//v1.0 - +//fat_misc.c
+//v1.0
+
#include "fat_misc.h"
-#include "fs_api.h" - +#include "fs_api.h"
+
static unsigned int _usedSecNums;
static int strFindFromEnd( char *str,char strValue )
@@ -40,11 +40,11 @@ static int strFindFromEnd( char *str,char strValue ) int getDirSize( const char * path, int includeSubdirs, unsigned int * dirSize )
{
- char dirPath[MAX_FILENAME_LENGTH]; + char dirPath[MAX_FILENAME_LENGTH];
unsigned int size = 0;
if( "" == path ){
return false;
- } + }
memset( dirPath,0,MAX_FILENAME_LENGTH );
strcpy( dirPath,path );
@@ -54,29 +54,31 @@ int getDirSize( const char * path, int includeSubdirs, unsigned int * dirSize ) if( strlen(dirPath) > MAX_FILENAME_LENGTH )
return false;
- DIR_STATE_STRUCT *dir;
dir = fat_opendir((const char*)dirPath);
+ DIR_STATE_STRUCT *dir;
+ dir = fat_opendir((const char*)dirPath);
if (dir == NULL)
- return false;
- struct stat stat_buf; - DIR_ENTRY *currentEntry; - char* filename; - - while(fat_readdir_ex(dir, &stat_buf) != NULL)
+ return false;
+
+ struct stat stat_buf;
+ DIR_ENTRY *currentEntry;
+ char* filename;
+
+ while((currentEntry = fat_readdir_ex(dir, &stat_buf)) != NULL)
{
- filename = currentEntry->d_name; - + filename = currentEntry->d_name;
+
if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0)
continue;
if (!(stat_buf.st_mode & S_IFDIR)) {
size += (stat_buf.st_size+511)/512;
_usedSecNums +=(stat_buf.st_size+511)/512;
- } - else if (includeSubdirs) + }
+ else if (includeSubdirs)
{
// calculate the size recursively
- unsigned int subDirSize = 0; - char dirPathBuffer[MAX_FILENAME_LENGTH]; + unsigned int subDirSize = 0;
+ char dirPathBuffer[MAX_FILENAME_LENGTH];
memset( dirPathBuffer,0,MAX_FILENAME_LENGTH );
strcpy( dirPathBuffer,dirPath );
@@ -90,8 +92,8 @@ int getDirSize( const char * path, int includeSubdirs, unsigned int * dirSize ) memset( dirPath,0,MAX_FILENAME_LENGTH );
strcpy( dirPath,dirPathBuffer );
}
- } - + }
+
fat_closedir(dir);
*dirSize = size;
@@ -102,7 +104,7 @@ int fat_getDiskTotalSpace( char * diskName, unsigned int * diskSpace ) {
if( !strcmp("",diskName) )
return false;
- +
unsigned int len = strlen(diskName);
if( *(diskName+len-1) != '/' ){
*(diskName+len) = '/';
@@ -116,10 +118,10 @@ int fat_getDiskTotalSpace( char * diskName, unsigned int * diskSpace ) return true;
}
-int fat_getDiskSpaceInfo( char * diskName, unsigned int * total, unsigned int * used, unsigned int * freeSpace ) +int fat_getDiskSpaceInfo( char * diskName, unsigned int * total, unsigned int * used, unsigned int * freeSpace )
{
_usedSecNums = 0;
- +
if( !strcmp("",diskName) )
return -1;
if( !fat_getDiskTotalSpace(diskName, total) )
|