Load ELF files with sceKernelLoadExec
no no !!!! Thanks to your idea, I leanrt plenty of things and as Tyranid told me, we never thought it could be possible to run an plain elf using Load/StartModule... either if it seems to be redirected to LoadExec...
By the way, with Placasoft, we played with it and we have a UMD game screenshot dumper which nearly works (the image is corrupted due to the 'slowness' of writing a file) for games (as BOOT.BIN is not a plain elf but a true PRX)
So the future is simple, stop creating ELF ! Time to learn how to create PRX !!!!
So PSPKrazy, don't shut up :D Continue to have such good ideas !
By the way, with Placasoft, we played with it and we have a UMD game screenshot dumper which nearly works (the image is corrupted due to the 'slowness' of writing a file) for games (as BOOT.BIN is not a plain elf but a true PRX)
So the future is simple, stop creating ELF ! Time to learn how to create PRX !!!!
So PSPKrazy, don't shut up :D Continue to have such good ideas !
- TiTAN Art Division -
http://www.titandemo.org
http://www.titandemo.org
I'm trying to figure out this stuff. Will this work:
Well, no, it wont.. but I dont know why. hehe :)
-Bill
Code: Select all
PSP_MODULE_INFO("Blah", 0x1000, 1, 1); // 0x1000 = Kernel MODE
PSP_MAIN_THREAD_ATTR(0); // 0 for kernel mode too
int main(void)
{
//THIS??
//sceKernelLoadExec("ms0:/PSP_GAME/SYSDIR/boot.elf",0);
//Or this??
int exec_p = sceKernelLoadModule("ms0:/PSP_GAME/SYSDIR/boot.elf", 0, 0);
sceKernelStartModule(exec_p, 0, 0, 0, 0);
return 0;
}
-Bill
About this:
I know you're going to fool around with it anyway, but could you at least pretend you're not trying to run a game you've copied to the memory card? Maybe change the path a little when you're pasting code to these forums?
You know, attempt to follow the rules or something?
Unbelievable.
Code: Select all
int exec_p = sceKernelLoadModule("ms0:/PSP_GAME/SYSDIR/boot.elf", 0, 0);
You know, attempt to follow the rules or something?
Unbelievable.
Hi, I have a little problem loading .elf's from Memory Stick, and I hope that somebody could help me.
Ok, so I was going to make myself a little sample program which would load an emulator from Memory Stick. I extracted the DATA.PSP from the EBOOT.PBP of the emulator, and renamed that to EMU.ELF (Isn't this right?). Now, my code looks like this:
The program compiles OK, no errors or anything, but it doesn't work on my 1.5 PSP. All I have is a black screen, memstick light flashes couple of times, then it gets back to XMB. For some emus it doesn't give any error, but with some it gives "80020001". Does somebody know what's wrong and how I could succesfully load that .ELF -file?
EDIT:
It would help if I'd get a sample code somewhere which would just load an .ELF/.PBP from memory stick, so if somebody knows where to get that kind of source, please post it here :)
Ok, so I was going to make myself a little sample program which would load an emulator from Memory Stick. I extracted the DATA.PSP from the EBOOT.PBP of the emulator, and renamed that to EMU.ELF (Isn't this right?). Now, my code looks like this:
Code: Select all
// Kernel Mode
PSP_MODULE_INFO("EMULATOR", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
.
.
.
and in main it's just like this:
sceKernelLoadExec("ms0:/EMULATORS/EMU.ELF",0);
EDIT:
It would help if I'd get a sample code somewhere which would just load an .ELF/.PBP from memory stick, so if somebody knows where to get that kind of source, please post it here :)
MiKA- wrote:Sorry for double posting, but what should I put into my code so it would print "File doesn't exist" or something like that if the file doesn't actually exist? In my code, I'm loading ms0:/EBOOT.PBP with SceKernelLoadExec when pressing X.
Code: Select all
int FileExists(char *path)
{
SceIoStat stat;
return (sceIoGetstat(path, &stat) >= 0)
}
void yourfunction(char *yourfile)
{
struct SceKernelLoadExecParam param;
if (!FileExists(yourfile))
{
printf("File doesn't exist");
return;
}
memset(¶m, 0, sizeof(param));
param.size = sizeof(param);
param.args = strlen(yourfile) + 1;
param.argp = yourfile;
sceKernelLoadExec(yourfile, ¶m);
}
As I'm just a beginner, I don't actually know how to use this code :( I've read all the Yeldarb tutorials and just borrowed a C-programming book from the library, so I don't know much about coding, yet. And because of that, I don't understand how do I define the path "ms0:/EBOOT.PBP" to this piece of code? If somebody can still teach me little more, I'll be happy.moonlight wrote:Well, more or less.Code: Select all
Some code . . .
in your C book look up how pointers are
used in a functions argument list and why
but example lets use first function moonlight posted
the function argument char *path is a string pointer
to path of your file to check if it exists
and anytime the pointer path is used your string
array is replaced ... using ms0:/EBOOT.PBP for example
the above function works like this
so if you add above function before main()
then you will be able to use it like so in your program
using pseudo code below
you must take into affect the return status of one of the
sceIoGetstat() status return codes and if file exist from
returned success code then making a simple check against
this number is simple and and yourfunction() can run only
if FileExists() returned positive return ...that i leave to you
and keep reading on with C book and dont just read one
and go by it religiously ...read as many articles and books
on the language as time should allow ...any language takes
practice and so does C
used in a functions argument list and why
but example lets use first function moonlight posted
Code: Select all
int FileExists(char *path)
{
SceIoStat stat;
return (sceIoGetstat(path, &stat) >= 0)
}
to path of your file to check if it exists
and anytime the pointer path is used your string
array is replaced ... using ms0:/EBOOT.PBP for example
the above function works like this
Code: Select all
int FileExists("ms0:/EBOOT.PBP")
{
SceIoStat stat;
return (sceIoGetstat("ms0:/EBOOT.PBP", &stat) >= 0)
}
then you will be able to use it like so in your program
using pseudo code below
Code: Select all
int main(int argc, char* argv[]) {
....
//check if file exists at root of psp
FileExists("ms0:/EBOOT.PBP");
...
//if it does run the file
yourfunction("ms0:/EBOOT.PBP");
...
sceIoGetstat() status return codes and if file exist from
returned success code then making a simple check against
this number is simple and and yourfunction() can run only
if FileExists() returned positive return ...that i leave to you
and keep reading on with C book and dont just read one
and go by it religiously ...read as many articles and books
on the language as time should allow ...any language takes
practice and so does C
10011011 00101010 11010111 10001001 10111010