search flash, i believe it's located at: flash0:/vsh/kd/idstorarge.prx
but i'd need to double check that to make sure and i don't have my psp on me atm
Printable View
search flash, i believe it's located at: flash0:/vsh/kd/idstorarge.prx
but i'd need to double check that to make sure and i don't have my psp on me atm
no im not talking about the plugin,
the "actual" idstorage.
~!SlasheR!~
ahh, my bad, not something i've ever looked into modifying, so i'm no help than
thx 4 replying,
thats ok...
if any1 knows where it is?
!~SlasheR~!
May I ask why you want to know that?
does it really matter?
i want to print the ascii characters to a file for each key.
Spoiler for SECRET:
~!SlasheR!~
I think some people get a little worried when others mess around with IDStorage because of the irrepairable damage it can cause.
However, in reply to your question, I believe its stored in a seperate partition of the NAND, idstorage:/ but I may be thinking of the IPL, its been too long since I did any major coding on the PSP to be certain.
-Aura
Aura im not putting it into FixItPSP i just want to play with mine (ive got PLENTY on nand dumps)
Anyways do the guys talking 'bout DC8, id say it regenerates 95% of the keys, the only keys it cant fix are the magicgate ones for some reason!
~!SlasheR!~
something like that should work.Code:SceUID idDumpUID;
char idFilePath[200];
u16 key;
char dump[512];
for( key = 0x000; key <= 0x200; key++ )
{
sceIdStorageReadLeaf( key , dump );
sprintf(idFilePath,"dump/Idstorage/0x%03X.bin",key);
idDumpUID = sceIoOpen(idFilePath, PSP_O_CREAT | PSP_O_TRUNC | PSP_O_WRONLY, 0777);
if( idDumpUID < 0)
return -1;
sceIoWrite(idDumpUID, dump, 512);
if(sceIoClose(idDumpUID) < 0)
return -1;
}
-=Double Post Merge =-
http://forums.qj.net/showpost.php?p=...postcount=9426
I aint doing anything at all , even the untouched samples in the sdk doesnt work:s
Any plugins running in the background?
nop , only my prx (wich is packed into an eboot) => that's the reason?
A retarded suggestion at best but... have you tried adding a delay of about 10 seconds in first? I've had simillarly strange errors in Project4 where loading something straight away failed but loading a fraction of time later worked. Try adding the delay if it still fails you've lost nothing, if its successful however play around with the time until its as low as possible. 10 seconds is overkill by any stretch but gives a sufficient time scale to test once for certainty.
-Aura
Oh, that's true. I know anything I write waits until the kernel is loaded before touching a thing.
hey why wont this function properly copy a file? i have been trying to write a copying function without help but i am kinda stumped. thanks guys
btw i have print defined as pspDebugScreenKprintf but when I call this function in a usermode module for some reason it wont print anything to the screen.Code:int CopyFile(char *file, char *dst){
pspDebugInstallKprintfHandler(NULL);
pspDebugInstallErrorHandler(NULL);
pspDebugInstallStdoutHandler(pspDebugScreenPrintData);
pspSdkInstallNoPlainModuleCheckPatch();
int size = (sizeof(file));
char buffer[size];
int fd = sceIoOpen(file, PSP_O_RDONLY, 0777);
if(fd < 0){print("error opening %s\n", file); return -1;}
else{
int read = sceIoRead(fd, buffer, size);
if(read<0){print("error reading %s into buffer\n", file); return -1;}
else{
sceIoClose(fd);
fclose(file);
int dest = sceIoOpen(dst, PSP_O_WRONLY|PSP_O_CREAT|PSP_O_TRUNC, 0777);
if(dest<0){print("error opening %s\n", dst); return -1;}
else{
while(sizeof(dest) < size){
sceIoWrite(dest, buffer, size);
}
if(dest<0){print("error writing to %s", dst); return -1;}
else{
sceIoClose(dest);
print("Success! Copied %s to %s\n\n", file, dst);
return 1;
}
}}}}
When reading from a file I find using malloc is the best method for creating a buffer. Also I'd suggest streaming the file rather than loading the entire thing into memory, allocate maybe 1mb and keep looping it until completes... remember the PSP has only 32mb of memory in total, and not all of that is accessible for numerous reasons, try to use as little as possible.
Yes pspDegbuScreenKprintf is a kernel function, you want pspDebugScreenPrintf for user mode/update mode/[insert any other non kernel mode]
-Aura
Problems at a glance:
int size = (sizeof(file)); // You're asking for the size of a pointer (4 bytes on PSP).
fclose(file); // Where'd that come from?!?
sizeof(dest) // This is also 4 bytes, and not what you want.
If you want to get the size of a physical file in bytes, look at sceIoLseek() and friends - if you seek to the end of a file it will return the size for you.
Are you writing a user or kernel mode program?
Also, you may want to try writing well formatted code. That's one big illegible mess.
thanks insert_witty_name you always have helpful comments. i am trying what you said, unfortunately i get some errors. btw the copy function is in a kernel mode prx, being called in a usermode prx. also, if i just assign flash0 within a kernel prx, can i access the flash with usermode functions?
int size = sceIoLseek(file, 0, 2); sceIoLseek(file, 0, 0);
would get you the size of the file and skip back to the beginning.
Symbolic constants make everything more readable.
hi guys
i was wondering if there war any function to get the pommel,fuse id and the rest of them???
~!SlasheR!~
Very true, I once forgot an include and was too lazy to scroll up, so I just popped in 2. Same thing.
I'm normally firmly against providing full code because people tend to copy/paste and not learn, but I've posted part of my patching for Project4 which copies files in the flash (renaming fails for various reasons, so it was the only way I could get it to work). I'm pretty sure the code will compile, the only thing I've added is the loop (my patching never required copying anything larger than 5mb).
This method removes the need to know the size of the file... dunno why I coded it like that but it worked and I never changed it; I have the same method as above in normal fileIO, just ported it to the PSP.Code:int renamePatch(char* oldFile, char* newFile)
{
SceUID oFile, nFile; //files, equivalent to FILE*
char* buffer; //buffer to malloc
int read = 0, write = 0;
oFile = sceIoOpen(oldFile, PSP_O_RDONLY, 0777); //open file in read only (equivalent to r in fopen)
if(oFile < 0)
{
return oFile; //if opening failed return error code supplied by sceIo
}
nFile = sceIoOpen(newFile, PSP_O_CREAT|PSP_O_WRONLY, 0777); //create and open file in read/write (equivalent to w in fopen)
if(nFile < 0)
{
return nFile; //if opening failed return error code supplied by sceIo
}
buffer = (char*) malloc (5*1024*1024); //allocate 5mb of user memory for patching pureposes
if(buffer == NULL) //if buffer address is null allocation failed
{
return 0x800000FF; //random error code I created
}
read = sceIoRead(oFile, buffer, 5*1024*1024); //read up to 5mb in size
if(read == 0)
{
free(buffer); //free the allocated 5mb of user memory, avoid memory leak!
return 0x80AA00AA; //random error code I created
}
while(1)
{
if(read <= 0)
{
break; //if read is equal to or less (somehow) than 0
}
{
write = sceIoWrite(nFile, buffer, read);
if(write != read)
{
//if data written isn't same length as data read return an error
return 0x80BB00BB; //random error code I created
}
}
read = sceIoRead(oFile, buffer, 5*1024*1024); //read up to 5mb in size
}
//close files, same method as fclose
sceIoClose(nFile);
sceIoClose(oFile);
free(buffer); //free the allocated 5mb of user memory, avoid memory leak!
return 1;
}
You can write to flash0 without being in kernel mode, you'll need to be in updater mode/extended mode... whatever people call it, which is 0x800, this gives you flash read/write capabilites in a user module. Finally, you'll need to assign the flash0 in read/write mode. Really, theres no need for the above to be in kernel mode (if thats what you were intending).
Hopefully thats of some help just don't copy and paste it :)
-Aura
for some reason that function still just makes the file but the new file is 0kb
Doesn't use malloc, but it works fine for me.Code:int copy_file(char *src_file, char *dst_file)
{
/* Found it in my archives of source
* I think Anti-QuickJay wrote this
* */
unsigned char buffer[40];
SceUID infd = sceIoOpen(src_file, PSP_O_RDONLY, 0777);
SceUID outfd = sceIoOpen(dst_file, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
int bytesread;
if (infd < 0 || outfd < 0)
{
pspDebugScreenClear();
sceIoRemove(dst_file);
sceKernelDelayThread(5*1000*1000);
sceKernelExitGame();
}
while ((bytesread = sceIoRead(infd, buffer, 8192)) > 0)
{
sceIoWrite(outfd, buffer, bytesread);
}
sceIoClose(infd);
sceIoClose(outfd);
return 0;
}
thanks man this works great
How do you fit 8K into a 40byte buffer?Code:int copy_file(char *src_file, char *dst_file)
{
...
unsigned char buffer[40];
...
while ((bytesread = sceIoRead(infd, buffer, 8192)) > 0)
...
}
Buffer overflow? Exceptionally large char? I noticed this but thought I was missing something else, seems I'm not the only one who got a bit worried. This is why I prefer using malloc as you can do on the fly memory allocation and expand on the memory as you need (within reason).
-Aura
Hi
I have problems setting up the environment paths. When I try to compile this example he tells me
where c:/dev/pspsdk/ is my path to my minPSPw installation (I have a full cygwin-installation, but minPSPw promised to come with a lot of libraries so I wanted to give it a shot), anyways, the files he needs are all in "freetype2/freetype" in the same directory as ft2build.h.Zitat:
c:/dev/pspsdk/lib/gcc/../../psp/include/ft2build.h (56) :38: error: freetype/config/ftheader.h: No such file or directory
How do I tell him where to find it?
Instead of linking -lfreetype in the Makefile, do something like this instead:
You may also need to do the following in the CFLAGS too:Code:$(shell $(PSPBIN)/bin/freetype-config --libs)
Finally, you'd be a lot better using pgeFont than Fontloader, search these forums for it.Code:$(shell $(PSPBIN)/bin/freetype-config --cflags)
Thanks insomaniac, I'll try pgeFont. But the Makefile still won't work. I only get errormessages:
Zitat:
psp-gcc -I. -IC:/dev/pspsdk/psp/sdk/include -O2 -G0 -Wall -g -D_PSP_FW_VERSION=150 -c -o ../../pgeFont.o ../../pgeFont.c
process_begin: CreateProcess((null), /bin/freetype-config --cflags, ...) failed.
process_begin: CreateProcess((null), /bin/freetype-config --libs, ...) failed.
[...]
Well that is because you have to change your makefile according to pgeFont.
I am not sure what libs it uses so I cannot help you there.
No, it's because PSPBIN isn't defined as an environment variable, so it can't find the executable 'freetype-config'. You have too options:
- Export PSPBIN as an environment variable to your SDKs bin path.
- Get rid of "$(PSPBIN)" and just type out the entire path to the freetype-config executable.
Okay. Sorry i did not know that pgeFont used 'freetype-config'. :Cry:
>_>Zitat:
psp-gcc -I. -IC:/dev/pspsdk/psp/sdk/include -O2 -G0 -Wall -g -D_PSP_FW_VERSION=150 -c -o ../../pgeFont.o ../../pgeFont.c
process_begin: CreateProcess((null), /bin/freetype-config --cflags, ...) failed.
process_begin: CreateProcess((null), /bin/freetype-config --libs, ...) failed.
[...]