Help with prx plugin...
Help with prx plugin...
I try to make my first prx plugin, but the compiler give me some errors,
please help me...
Here is the complete source code:
http://nopaste.com/p/atfRrFUwJ
And here is the error:
In function 'unloadStopModule':
[Warning] assignment from incompatible pointer type
In function 'loadUsb':
[Warning] no return statement in function returning non-void
In function 'threadMain':
Line:292 invalid operands to binary |
Line:292 invalid operands to binary |
Line:297 invalid operands to binary |
Line:297 invalid operands to binary |
Line:303 invalid operands to binary |
Line:303 invalid operands to binary |
Line:308 invalid operands to binary |
Line:308 invalid operands to binary |
[Build Error] [main.o] Error 1
Please, someone give me help...
please help me...
Here is the complete source code:
http://nopaste.com/p/atfRrFUwJ
And here is the error:
In function 'unloadStopModule':
[Warning] assignment from incompatible pointer type
In function 'loadUsb':
[Warning] no return statement in function returning non-void
In function 'threadMain':
Line:292 invalid operands to binary |
Line:292 invalid operands to binary |
Line:297 invalid operands to binary |
Line:297 invalid operands to binary |
Line:303 invalid operands to binary |
Line:303 invalid operands to binary |
Line:308 invalid operands to binary |
Line:308 invalid operands to binary |
[Build Error] [main.o] Error 1
Please, someone give me help...
Code: Select all
if((pad.Buttons & ("HOME"|"NOTE")) == ("HOME"|"NOTE"))
Code: Select all
if((pad.Buttons & (PSP_CTRL_HOME|PSP_CTRL_NOTE)) == (PSP_CTRL_HOME|PSP_CTRL_NOTE))
J.F. beat me to it :(
You are trying to binary or two strings and then binary and them with a unsigned integer. First off, to compare a or b it's a || b, not a | b. Second, you can't compare a string like that unless you are using the std::string class. Third, pad.Buttons is a bitmask (you should look up some information on binary math and bitmasks/bitfields to understand what is going on), you don't check it against strings. Look at the controller/basic sample for how to check button presses.
Wrong:
Right:
You are trying to binary or two strings and then binary and them with a unsigned integer. First off, to compare a or b it's a || b, not a | b. Second, you can't compare a string like that unless you are using the std::string class. Third, pad.Buttons is a bitmask (you should look up some information on binary math and bitmasks/bitfields to understand what is going on), you don't check it against strings. Look at the controller/basic sample for how to check button presses.
Wrong:
Code: Select all
if((pad.Buttons & ("HOME"|"NOTE")) == ("HOME"|"NOTE")
Code: Select all
if( (pad.Buttons & (PSP_CTRL_HOME | PSP_CTRL_NOTE)) == (PSP_CTRL_HOME | PSP_CTRL_NOTE) )
--or--
if( (pad.Buttons & PSP_CTRL_HOME) && (pad.Buttons & PSP_CTRL_NOTE) )
Alternative:
since that does the same thing.
Also,
If 'name' is over 5 characters long, you will have a buffer overflow. 'tmp' starts with 26 chars, you add name, plus a null. 26+5+1=32. More than 5 chars... bad.
Also, you never change 'kill_display'... is this for debugging only?
Also, precisely what is the point of this?
Especially when all the strings are used for is this:
Just do this:
Code: Select all
if( pad.Buttons & (PSP_CTRL_HOME | PSP_CTRL_NOTE)){...}
Also,
Code: Select all
char tmp[32];
strcpy(tmp, "lsm: Error loading module ");
strcat(tmp, name);
doBlit(tmp);
Also, you never change 'kill_display'... is this for debugging only?
Also, precisely what is the point of this?
Code: Select all
sprintf(strBuf0, "%s + %s = Shutdown PSP", "NOTE", "HOME");
sprintf(strBuf4, "%s + %s = Set Max Brightness", "NOTE", "DOWN");
sprintf(strBuf5, "%s + %s = Start/Stop Usb Mass", "NOTE", "L");
sprintf(strBuf8, "%s + %s = Show this help", "NOTE", "VOL_DOWN");
Code: Select all
blit_string(1, 12, strBuf0,0xffffff,0x000000);
Code: Select all
blit_string(1, 12, "NOTE + DOWN = Shutdown PSP",0xffffff,0x000000);
Last edited by FreePlay on Sat Mar 15, 2008 8:39 am, edited 1 time in total.
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
Hehe i saw this code somewhere in the past :)ne0h wrote: http://nopaste.com/p/atfRrFUwJ