PRX in VSH: Button input disabled.

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
pj1115
Posts: 23
Joined: Mon Jan 22, 2007 4:46 am

PRX in VSH: Button input disabled.

Post by pj1115 »

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?
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

If you're using sceCtrlRead*, it will stop the normal keypress events in the VSH.

The trick is to use sceCtrlPeek* instead.
pj1115
Posts: 23
Joined: Mon Jan 22, 2007 4:46 am

Post by pj1115 »

I haven't got that code.

I've only got

Code: Select all

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?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

As pointed out already, replace sceCtrlReadBufferPositive with sceCtrlPeekBufferPositive, geez.
pj1115
Posts: 23
Joined: Mon Jan 22, 2007 4:46 am

Post by pj1115 »

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?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Urm how are you actually reading the key presses ? Are you just doing basically:

Code: Select all

while(1) { /* Check Key Press */ }
If so then probably your are preventing other threads from running.
pj1115
Posts: 23
Joined: Mon Jan 22, 2007 4:46 am

Post by pj1115 »

Yep, that's basicly what I'm doing.

How would be a better way?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

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 ;)
pj1115
Posts: 23
Joined: Mon Jan 22, 2007 4:46 am

Post by pj1115 »

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.
Post Reply