|
[SOLVED] How to read from ISFS? May 23, 2010 04:14PM | Registered: 16 years ago Posts: 19 |
ISFS_Initialize();
fd=ISFS_Open("/title/00010001/57525550/data/savefile.dat",ISFS_OPEN_READ);
if (fd < 0) {
printf("\n Error: ISFS_OpenFile() returned %d", fd);
if (fd == -106) {
printf("\n It seems like you haven't got BIT.TRIP Runner (PAL)...");
}
reload();
} else {
printf("\n\n\n File found!");
ret = ISFS_Read(fd, buffer, 2);
if (ret < 0) {
printf("\n Error: ISFS_Read() returned %d", ret);
ISFS_Close(fd);
reload();
} else {
printf("\n First Value: %s",buffer);
ISFS_Close(fd);
reload();
}
}
It does open the file, but as soon as I try to read a value, it gives me error -101. I looked at the sources of Playstats and FSToolbox, did a Google Search, but nothing helped me.|
Re: How to read from ISFS? May 24, 2010 01:53PM | Registered: 16 years ago Posts: 19 |
u8 *buffer;
int fd;
s32 ret;
u32 size;
fd = ISFS_Open("/title/00010001/57525550/data/savefile.dat", ISFS_OPEN_READ);
if (fd < 0)
{
printf("\nError: ISFS_OpenFile() returned %d\n", fd);
return 0;
}
buffer = (u8 *)memalign(32, 2048);
size = 2048;
ret = ISFS_Read(fd, buffer, size);
if (ret < 0)
{
printf("\nISFS_Read(%d, %p, %d) returned %d\n", fd, buffer, size, ret);
ISFS_Close(fd);
free(buffer);
return 0;
}
ISFS_Close(fd);
free(buffer);
printf("\n\n%h\n", buffer);
It properly displays the hex value 8030bbc0... but the file begins 0101010c... what the?|
Re: How to read from ISFS? May 24, 2010 03:09PM | Registered: 17 years ago Posts: 234 |
|
Re: How to read from ISFS? May 24, 2010 03:21PM | Registered: 16 years ago Posts: 19 |
|
Re: How to read from ISFS? May 24, 2010 03:36PM | Registered: 17 years ago Posts: 234 |
|
Re: How to read from ISFS? May 24, 2010 03:49PM | Registered: 16 years ago Posts: 19 |
|
Re: How to read from ISFS? May 25, 2010 12:19AM | Registered: 17 years ago Posts: 43 |
|
Re: How to read from ISFS? May 25, 2010 10:23AM | Registered: 16 years ago Posts: 19 |
|
Re: How to read from ISFS? May 25, 2010 11:39AM | Registered: 17 years ago Posts: 43 |
|
Re: How to read from ISFS? May 25, 2010 01:24PM | Registered: 16 years ago Posts: 19 |
|
Re: How to read from ISFS? May 25, 2010 03:50PM | Registered: 17 years ago Posts: 552 |
|
Re: How to read from ISFS? May 25, 2010 05:41PM | Registered: 17 years ago Posts: 188 |
|
Re: How to read from ISFS? May 25, 2010 05:46PM | Registered: 17 years ago Posts: 234 |
char ascii(char s) {
if(s < 0x20) return '.';
if(s > 0x7E) return '.';
return s;
}
void hexdump(void *d, int len) {
u8 *data;
int i, off;
data = (u8*)d;
for (off=0; off=len) printf(" ");
else printf("%02x ",data[off+i]);
gprintf(" ");
for(i=0; i<16; i++)
if((i+off)>=len) printf(" ");
else printf("%c",ascii(data[off+i]));
printf("\n");
}
} hexdump( buffer, however_much_you_want_to_see );
|
Re: How to read from ISFS? May 25, 2010 07:08PM | Registered: 16 years ago Posts: 19 |