From aeb7aff9ea51819325a644021d4c18f6323bc3f7 Mon Sep 17 00:00:00 2001 From: giantpune Date: Mon, 1 Feb 2010 11:22:48 +0000 Subject: [PATCH] *re-eveluate partition size after installing games and such (from r-win) --- HBC/META.XML | 4 +-- source/usbloader/wbfs_fat.c | 64 +++++++++++++++---------------------- 2 files changed, 27 insertions(+), 41 deletions(-) diff --git a/HBC/META.XML b/HBC/META.XML index b33f76bb..42b7771b 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 1.0 r901 - 201001312334 + 1.0 r902 + 201002011014 Loads games from USB-devices 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. diff --git a/source/usbloader/wbfs_fat.c b/source/usbloader/wbfs_fat.c index adb0ca91..b432f4c5 100644 --- a/source/usbloader/wbfs_fat.c +++ b/source/usbloader/wbfs_fat.c @@ -34,11 +34,6 @@ char wbfs_fs_drive[16]; char wbfs_fat_dir[16] = "/wbfs"; 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; static u32 fat_sector_size = 512; @@ -192,7 +187,7 @@ s32 _WBFS_FAT_GetHeadersCount() } } // no title found, read it from wbfs file - // but this is a little bit slower + // but this is a little bit slower // open 'partition' file part = WBFS_FAT_OpenPart(fpath); if (!part) { @@ -317,27 +312,18 @@ s32 WBFS_FAT_DiskSpace(f32 *used, f32 *free) { f32 size; int ret; + struct statvfs wbfs_fat_vfs; *used = 0; *free = 0; - // statvfs is slow, so cache values - if (!wbfs_fat_vfs_have - || 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; - } + ret = statvfs(wbfs_fs_drive, &wbfs_fat_vfs); + if (ret) return -1; /* FS size in GB */ 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; *used = size - *free; - return 0; } @@ -374,14 +360,14 @@ void title_filename(char *title) } // trim trailing space - not allowed on windows directories while (len && title[len-1] == ' ') { - title[len-1] = 0; - len--; + title[len-1] = 0; + len--; } // replace silly chars with '_' for (i=0; iwii_sec_sz; - + partition_selector_t part_sel; if (Settings.fullcopy) { part_sel = ALL_PARTITIONS;