So, as I'm doing this I'm curious if anyone else is doing this, and perhaps that we should collaborate our efforts? Getting a true 3D-library on the PSP would be a great gain, and as it won't in itself allow anyone to crack games, I'm all for doing some work on it.
From what I've discovered the PSP-graphicscircuit executes lists of commands, much like the GS on PS2 does. The command-format is (command << 24)|(argument), which gives us 24 bits to play with. Floats are also passed this way, using a small wrapper:
Code: Select all
void sendCommandf(u8 cmd, float argument)
{
sendCommandi(cmd,(*((u32*)&argument)) >> 8);
}
The wrapper-library is as I said very lowlevel and most of it maps 1:1 to the underlying hardware. Example:
Code: Select all
void sceGuAmbientColor(u32 color)
{
sendCommandi(85,color & 0xffffff);
sendCommandi(88,color >> 24);
}
Code: Select all
void sendCommandi(u8 cmd, u32 argument)
{
u32* gu_struct = *((u32*)0x527a78); // base context?
u32* current = *(gu_struct+1); // get current list pointer
*(current++) = (cmd << 24) | (argument & 0xffffff);
*(gu_struct+1) = current; // store back
}
I've rewritten 20 functions in C so far, and when I get closer to usability I'll submit to the repository.