Fortunately with the onofficial SE firmwares, people have recently had a
logical format performed by the app that writes the firmware to flash.
It is still very difficult.
Anyway, here's the routine I wrote for telling how much is used.
I started with the SDK sample that dumps a filesystem.
Any variables that aren't declared are global in my program.
Code: Select all
void add_file(const char *read_loc, const char *write_loc, const char *name) {
char readpath[256];
build_path(readpath, read_loc, name, 0);
int ffls;
int filef_size = 0;
ffls = sceIoOpen(readpath, PSP_O_RDONLY, 0777);
filef_size = sceIoLseek32(ffls, 0, SEEK_END);
sceIoClose(ffls);
flash_size = flash_size + filef_size;
mbflash_size = flash_size/1024; // derive Kilobytes used
mbflash_size = mbflash_size/1024; // derive Megabytes used
flashsi = mbflash_size; // derive integer for counting display
pspDebugScreenSetXY(21, 28);
printf("Flash0 Space Used: %d",flashsi);
pspDebugScreenSetXY(44, 28);
printf(" Mb ");
}
void add_flash(const char *root, const char *write_loc) {
int dfd;
char next_root[256];
char next_write[256];
dfd = sceIoDopen(root);
if(dfd > 0)
{
SceIoDirent dir;
while(sceIoDread(dfd, &dir) > 0)
{
if(dir.d_stat.st_attr & FIO_SO_IFDIR)
{
if(dir.d_name[0] != '.')
{
build_path(next_write, write_loc, dir.d_name, 0);
build_path(next_root, root, dir.d_name, 1);
add_flash(next_root, next_write);
}
}
else
{
add_file(root, write_loc, dir.d_name);
}
}
sceIoDclose(dfd);
}
}
Cheers, Art.