sharpii/WadInstaller_Source/source/fat.c
mzolob@gmail.com bc65416cf7 Updated to 1.5 - Added the ability to send WADs to the HBC using SendWad
- You can now download an IOS with -ios # in NUSD
                - Downloaded IOS wads are now named like so: IOS##-64-####.wad
                - Under certain conditions, when downloading a wad with NUS, it will not be saved in a folder, just as the WAD (see ReadMe)
                - If missing dll's are detected (WadInstaller or libWiiSharp), Sharpii will ask to download them, if they are required.
                - You can now use a .dol file instead of a .wad with the '-dol' in the WAD editor/packer
                - Probably a few other little things I have forgotten
                - Even more code cleanup and bug fixes
2011-11-02 01:02:11 +00:00

58 lines
964 B
C

#include <stdio.h>
#include <string.h>
#include <ogcsys.h>
#include "fat.h"
s32 Fat_Mount(fatDevice *dev)
{
s32 ret;
/* Initialize interface */
ret = dev->interface->startup();
if (!ret)
return -1;
/* Mount device */
ret = fatMountSimple(dev->mount, dev->interface);
if (!ret)
return -1;
return 0;
}
void Fat_Unmount(fatDevice *dev)
{
/* Unmount device */
fatUnmount(dev->mount);
/* Shutdown interface */
dev->interface->shutdown();
}
char *Fat_ToFilename(const char *filename)
{
static char buffer[128];
u32 cnt, idx, len;
/* Clear buffer */
memset(buffer, 0, sizeof(buffer));
/* Get filename length */
len = strlen(filename);
for (cnt = idx = 0; idx < len; idx++) {
char c = filename[idx];
/* Valid characters */
if ( (c >= '#' && c <= ')') || (c >= '-' && c <= '.') ||
(c >= '0' && c <= '9') || (c >= 'A' && c <= 'z') ||
(c >= 'a' && c <= 'z') || (c == '!') )
buffer[cnt++] = c;
}
return buffer;
}