I'm trying to replicate the argument-passing that the kernel does to _startup(), for the EBOOT loader.
But I'm a bit confused about what it actually passes.
The PSPSDK API docs claim that the arguments passed to a thread via StartThread() are:
SceSize arglen (size of argp data in bytes)
void * argp
That seems to correlate with the code for _start() in crt0.c too.
My question is: should this be the same as the classic argc, argv? Clearly argc is normally a count of elements in the argv[] array, so would be a count of 32-bit words rather than bytes.
And regardless of that, when I pass:
arglen = 4
argp = { char * => "test" }
I don't seem to get anything like those params passed to main.
Can anyone shed any light on what's going on? What gets passed to argc, argv on a 1.5 PSP?
Arguments to main()
if you are calling crt0 directly from your code, and not through a kernel function such as sceLoadExec, i would think that you need to pass argc=0 and argv[0]="ms0:/path/to/eboot". the description in the pspsdk probably relates to how those params are passed via loadexec, which is a bit different. (it takes a struct with some info about the params)
I do pass the EBOOT path in argv[0] - because I figured out that the problem with some EBOOTs is that they use that to determine their working directory.
But that parameter never actually reaches the app, and I don't understand why not.
I'll take a look at the KernelLoadExec params - maybe that will offer some clues.
But that parameter never actually reaches the app, and I don't understand why not.
I'll take a look at the KernelLoadExec params - maybe that will offer some clues.