[PRX] Hooking button action ingame - Help needed.

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

Moderators: cheriff, TyRaNiD

Post Reply
Maku
Posts: 2
Joined: Tue Jun 16, 2009 5:33 pm

[PRX] Hooking button action ingame - Help needed.

Post by Maku »

Hey,

Yesterday my Home button stopped working, and i had to disable it by plugin out the plug of the front panel, so I'm stuck with only standard buttons and SCREEN, NOTE, START and SELECT (this ones I were able to save ;).

Because it's kinda hard to do anything without the Home button, I've decided to write a small plugin which will hook into sceController_Service, and redirect RTRIGGER & LTRIGGER & SQUARE to Home button.

I've managed to get it working in VSH (by using: sceVshBridge_Driver), but I have problems getting this ingame. Basically, the only problem I have is that I can not use any of the special buttons (IE. i can redirect square to cross, but can not redirect square to volume up).

I've did some research and I found this:

Code: Select all

/**
 * Enumeration for the digital controller buttons.
 *
 * @note PSP_CTRL_HOME, PSP_CTRL_NOTE, PSP_CTRL_SCREEN, PSP_CTRL_VOLUP, PSP_CTRL_VOLDOWN, PSP_CTRL_DISC, PSP_CTRL_WLAN_UP, PSP_CTRL_REMOTE, PSP_CTRL_MS can only be read in kernel mode
 */
It's possible that my plugin runs in user mode?

You can check the sources here:
http://pastebin.com/me40f019

BTW, please also take a look at the mydisplay thread, it doesn't print any data on the screen :s
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

vshCtrlReadBufferPositive has privileges to read some of the the kernel mode buttons (Home etc). sceCtrl* cannot read these buttons.

Therefore you can send a fake Home press to VSH but not in games. For games you must patch the kernel version of sceCtrl* stuff and somewhere in the middle of that perform your button swaps. Actually the checking of special buttons is not done by games, but is done by other kernel mode firmware modules, so hooking the sceCtrl* syscalls is useless anyway.

Since only your Home button is not working, there is another thing you can do for games. You can patch the import of sceCtrlPeekBufferPositive in impose.prx using MAKE_CALL and send a fake Home button for some other button combination. Thus the Home screen can be made to show for another button.

The easier way is to use sceSysconSetDebugHandlers to hook the buttons. Here you can modify the pad_data similar to normal hook for any button. Look for Booster's syscon hook sample on how to do this.
Post Reply