This is from the PSPSDK samples:
Code: Select all
void usbEnable()
{
//Setup USB
LoadStartModule("flash0:/kd/semawm.prx");
LoadStartModule("flash0:/kd/usbstor.prx");
LoadStartModule("flash0:/kd/usbstormgr.prx");
LoadStartModule("flash0:/kd/usbstorms.prx");
LoadStartModule("flash0:/kd/usbstorboot.prx");
//return;
if ( sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0 ) != 0 )
{
sysUsb=0; return;
}
if ( sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0 ) != 0 )
{
sysUsb=0; return;
}
if ( sceUsbstorBootSetCapacity( 0x800000 ) != 0 )
{
sysUsb=0; return;
}
sceUsbActivate( 0x1c8 );
}
1) In my code, I don't even call usbEnable and it causes my PRX to stop from loading
2) So if I just link the function without using it - it still stops the PRX
3) BUT, if I put a "return;" right before the 'if (sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0 ) != 0 )', the damn thing compiles and runs fine - even though I don't call usbEnable from anywhere!
It's not a stack problem - it has to do with the sceUsb* functions - if I use them, the damn PRX fails to start.
I've included the pspusb.h and pspusbstor.h files
And yes I've linked the needed libs:
LIBS = -lpspchnnlsv -lpsputility -lpspdebug -lpspge_driver -lpspwlan -lpspumd -lpspusb -lpspusbstor
LDFLAGS = -nostdlib -nodefaultlibs
I've ran the thing in PSPLink and the funny part was - that it ran just fine.
But then I run it as a plugin in custom firmware 3.40 OE and BOOM =/
Any ideas?