| View previous topic :: View next topic |
| Author |
Message |
pj1115
Joined: 22 Jan 2007 Posts: 23
|
Posted: Wed Feb 21, 2007 5:30 am Post subject: PRX in VSH: Button input disabled. |
|
|
Hey
I've built a PRX that simply renames a file with a button combination in the XMB (made from the SDK sample).
The XMB boots fine with the module loading, but the XMB's button input no longer works. (ie, I can't move around). However, all the file renaming works like a charm (I checked with USB).
What I've changed from the sample is the main function, added a library or two (for button input) and I've put "USE_PSPSDK_LIBC" as "0" (which I assume lets the app use the kernel's LIBC), which reduced the file size by 50% but made no difference to the operation of the module (still works, but the XMB's button input doesn't).
So, here's my question:
How can I re-enable the XMB's button input? |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Wed Feb 21, 2007 6:09 am Post subject: |
|
|
If you're using sceCtrlRead*, it will stop the normal keypress events in the VSH.
The trick is to use sceCtrlPeek* instead. |
|
| Back to top |
|
 |
pj1115
Joined: 22 Jan 2007 Posts: 23
|
Posted: Wed Feb 21, 2007 6:12 am Post subject: |
|
|
I haven't got that code.
I've only got
| Code: |
SceCtrlData pad; sceCtrlReadBufferPositive(&pad, 1);
if ((pad.Buttons & PSP_CTRL_HOME) && (pad.Buttons & PSP_CTRL_RTRIGGER)){
//code
}
|
EDIT: I see, sceCtrlReadBufferPositive should change to sceCtrlPeekBufferPositive? |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Wed Feb 21, 2007 6:17 am Post subject: |
|
|
| As pointed out already, replace sceCtrlReadBufferPositive with sceCtrlPeekBufferPositive, geez. |
|
| Back to top |
|
 |
pj1115
Joined: 22 Jan 2007 Posts: 23
|
Posted: Wed Feb 21, 2007 6:32 am Post subject: |
|
|
I noticed that, sorry if I peeved you off...
Oh, and it doesn't work. Well, it does, but the XMB will only work if one of the button combinations I'm using is being pressed.
For example, when the PSP boots, all I see is a black screen, but when I hold down [Home]+[R] or [Home]+[L] (both are the button inputs I've specified), the memory stick light constantly flashes, and the XMB boots. When I stop holding the buttons, it freezes until I hold them down again.
Can I rectify this? |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Wed Feb 21, 2007 6:58 am Post subject: |
|
|
Urm how are you actually reading the key presses ? Are you just doing basically:
| Code: | | while(1) { /* Check Key Press */ } |
If so then probably your are preventing other threads from running. |
|
| Back to top |
|
 |
pj1115
Joined: 22 Jan 2007 Posts: 23
|
Posted: Wed Feb 21, 2007 7:08 am Post subject: |
|
|
Yep, that's basicly what I'm doing.
How would be a better way? |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Wed Feb 21, 2007 7:10 am Post subject: |
|
|
| Either add some delay element to the loop, so do sceKernelDelayThread(100000) which will delay for a 10th of a second and give other threads a chance to do something, or implement the keypresses using the controller callback functions, which I dont fancy explaining ;) |
|
| Back to top |
|
 |
pj1115
Joined: 22 Jan 2007 Posts: 23
|
Posted: Wed Feb 21, 2007 7:14 am Post subject: |
|
|
Heh, I'll give the delay a go. Where should I put it in the loop? Before the key-press bit?
BTW, well done, 500 posts. :)
Finished, works good. Cheers, TyRaNiD and Insert_witty_name. |
|
| Back to top |
|
 |
|