void read_to_ram() {
int fd;
int cpa = 8; //defines the position of characters of interest
int cpb = 9; //
int cpc = 10; //
int cpd = 11; //
fd = sceIoOpen("flash0:/vsh/etc/version.txt", PSP_O_RDONLY, 0777);
sceIoRead(fd,data,256);
sceIoClose(fd);
printf(" PSP Unit Firmware Version Check: ");
printf("version ");
printf("%c",data[cpa]);
printf("%c",data[cpb]);
printf("%c",data[cpc]);
printf("%c",data[cpd]);
printf("\n");
int fdo;
fdo = sceIoOpen("ms0:/debug.txt", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
sceIoWrite(fd,"ms0:/version.txt", 256);
sceIoClose(fdo);
}
Hello,
I'm trying to write this file back from RAM to memory stick.
THe file reads to RAM ok, and the version number is printed to screen,
but the file that gets written to ms is a small section of my program's source code.
Cheers, Art.
is trying to write 256 letters of the string "ms0:/version.txt", to the file pointed to by fd, ie flash0:/vsh/etc/version.txt. Maybe it's lucky that you opened it read only then?? :)
if you just want to copy it ts ms:/xxxx then:
sceIoWrite(fdo,data, 256);
void read_to_ram() {
int fd;
int cpa = 8; //defines the position of characters of interest
int cpb = 9; //
int cpc = 10; //
int cpd = 11; //
fd = sceIoOpen("flash0:/vsh/etc/version.txt", PSP_O_RDONLY, 0777);
sceIoRead(fd,data,256);
sceIoClose(fd);
printf(" PSP Unit Firmware Version Check: ");
printf("version ");
printf("%c",data[cpa]);
printf("%c",data[cpb]);
printf("%c",data[cpc]);
printf("%c",data[cpd]);
printf("\n");
int fdo;
fdo = sceIoOpen("ms0:/debug.txt", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
sceIoWrite(fd,"ms0:/version.txt", 256);
sceIoClose(fdo);
}
Umm.. why are you using version.txt? I haven't looked at the file much, but I believe the version number is stored in the index.dat file. Also, when writing to the file ms0:/debug.txt, you may want to try this
sceIoWrite(fdo, string, strlen(string));
The real version number is there even when PSPset or any other program
has tricked the version.
My program makes sure it is running on 1.50 or it quits.