mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 17:29:17 +01:00
*re-eveluate partition size after installing games and such (from r-win)
This commit is contained in:
parent
1c6c607cf1
commit
aeb7aff9ea
@ -2,8 +2,8 @@
|
|||||||
<app version="1">
|
<app version="1">
|
||||||
<name> USB Loader GX</name>
|
<name> USB Loader GX</name>
|
||||||
<coder>USB Loader GX Team</coder>
|
<coder>USB Loader GX Team</coder>
|
||||||
<version>1.0 r901</version>
|
<version>1.0 r902</version>
|
||||||
<release_date>201001312334</release_date>
|
<release_date>201002011014</release_date>
|
||||||
<short_description>Loads games from USB-devices</short_description>
|
<short_description>Loads games from USB-devices</short_description>
|
||||||
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
||||||
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
||||||
|
@ -34,11 +34,6 @@ char wbfs_fs_drive[16];
|
|||||||
char wbfs_fat_dir[16] = "/wbfs";
|
char wbfs_fat_dir[16] = "/wbfs";
|
||||||
char invalid_path[] = "/\\:|<>?*\"'";
|
char invalid_path[] = "/\\:|<>?*\"'";
|
||||||
|
|
||||||
int wbfs_fat_vfs_have = 0;
|
|
||||||
int wbfs_fat_vfs_lba = 0;
|
|
||||||
int wbfs_fat_vfs_dev = 0;
|
|
||||||
struct statvfs wbfs_fat_vfs;
|
|
||||||
|
|
||||||
split_info_t split;
|
split_info_t split;
|
||||||
|
|
||||||
static u32 fat_sector_size = 512;
|
static u32 fat_sector_size = 512;
|
||||||
@ -317,27 +312,18 @@ s32 WBFS_FAT_DiskSpace(f32 *used, f32 *free)
|
|||||||
{
|
{
|
||||||
f32 size;
|
f32 size;
|
||||||
int ret;
|
int ret;
|
||||||
|
struct statvfs wbfs_fat_vfs;
|
||||||
|
|
||||||
*used = 0;
|
*used = 0;
|
||||||
*free = 0;
|
*free = 0;
|
||||||
// statvfs is slow, so cache values
|
ret = statvfs(wbfs_fs_drive, &wbfs_fat_vfs);
|
||||||
if (!wbfs_fat_vfs_have
|
if (ret) return -1;
|
||||||
|| wbfs_fat_vfs_lba != wbfs_part_lba
|
|
||||||
|| wbfs_fat_vfs_dev != wbfsDev )
|
|
||||||
{
|
|
||||||
ret = statvfs(wbfs_fs_drive, &wbfs_fat_vfs);
|
|
||||||
if (ret) return 0;
|
|
||||||
wbfs_fat_vfs_have = 1;
|
|
||||||
wbfs_fat_vfs_lba = wbfs_part_lba;
|
|
||||||
wbfs_fat_vfs_dev = wbfsDev;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FS size in GB */
|
/* FS size in GB */
|
||||||
size = (f32)wbfs_fat_vfs.f_frsize * (f32)wbfs_fat_vfs.f_blocks / GB_SIZE;
|
size = (f32)wbfs_fat_vfs.f_frsize * (f32)wbfs_fat_vfs.f_blocks / GB_SIZE;
|
||||||
*free = (f32)wbfs_fat_vfs.f_frsize * (f32)wbfs_fat_vfs.f_bfree / GB_SIZE;
|
*free = (f32)wbfs_fat_vfs.f_frsize * (f32)wbfs_fat_vfs.f_bfree / GB_SIZE;
|
||||||
*used = size - *free;
|
*used = size - *free;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,14 +360,14 @@ void title_filename(char *title)
|
|||||||
}
|
}
|
||||||
// trim trailing space - not allowed on windows directories
|
// trim trailing space - not allowed on windows directories
|
||||||
while (len && title[len-1] == ' ') {
|
while (len && title[len-1] == ' ') {
|
||||||
title[len-1] = 0;
|
title[len-1] = 0;
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
// replace silly chars with '_'
|
// replace silly chars with '_'
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
if(strchr(invalid_path, title[i]) || iscntrl((int) title[i])) {
|
if(strchr(invalid_path, title[i]) || iscntrl((int) title[i])) {
|
||||||
title[i] = '_';
|
title[i] = '_';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,7 +672,7 @@ s32 WBFS_FAT_RenameGame(u8 *discid, const void *newname)
|
|||||||
{
|
{
|
||||||
wbfs_t *part = WBFS_FAT_OpenPart((char *) discid);
|
wbfs_t *part = WBFS_FAT_OpenPart((char *) discid);
|
||||||
if (!part)
|
if (!part)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s32 ret = wbfs_ren_disc(part, discid,(u8*)newname);
|
s32 ret = wbfs_ren_disc(part, discid,(u8*)newname);
|
||||||
|
|
||||||
@ -699,7 +685,7 @@ s32 WBFS_FAT_ReIDGame(u8 *discid, const void *newID)
|
|||||||
{
|
{
|
||||||
wbfs_t *part = WBFS_FAT_OpenPart((char *) discid);
|
wbfs_t *part = WBFS_FAT_OpenPart((char *) discid);
|
||||||
if (!part)
|
if (!part)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s32 ret = wbfs_rID_disc(part, discid,(u8*)newID);
|
s32 ret = wbfs_rID_disc(part, discid,(u8*)newID);
|
||||||
|
|
||||||
@ -711,19 +697,19 @@ s32 WBFS_FAT_ReIDGame(u8 *discid, const void *newID)
|
|||||||
char fnamenew[100];
|
char fnamenew[100];
|
||||||
s32 cnt = 0x31;
|
s32 cnt = 0x31;
|
||||||
|
|
||||||
WBFS_FAT_fname(discid, fname, sizeof(fname), NULL);
|
WBFS_FAT_fname(discid, fname, sizeof(fname), NULL);
|
||||||
WBFS_FAT_fname((u8*) newID, fnamenew, sizeof(fnamenew), NULL);
|
WBFS_FAT_fname((u8*) newID, fnamenew, sizeof(fnamenew), NULL);
|
||||||
|
|
||||||
int stringlength = strlen(fname);
|
int stringlength = strlen(fname);
|
||||||
|
|
||||||
while(rename(fname, fnamenew) == 0)
|
while(rename(fname, fnamenew) == 0)
|
||||||
{
|
{
|
||||||
fname[stringlength] = cnt;
|
fname[stringlength] = cnt;
|
||||||
fname[stringlength+1] = 0;
|
fname[stringlength+1] = 0;
|
||||||
fnamenew[stringlength] = cnt;
|
fnamenew[stringlength] = cnt;
|
||||||
fnamenew[stringlength+1] = 0;
|
fnamenew[stringlength+1] = 0;
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user