Advertising (This ad goes away for registered users. You can Login or Register)

PSP_CTRL_SCREEN, _HOME and kernel mode

Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
User avatar
codestation
Big Beholder
Posts: 1660
Joined: Wed Jan 19, 2011 3:45 pm
Location: /dev/negi

Re: PSP_CTRL_SCREEN, _HOME and kernel mode

Post by codestation » Wed Mar 12, 2014 5:35 pm

Check my other plugin in the same thread: viewtopic.php?p=293474#p293474

I made a hook inside the sceController_Service module so _ALL_ the buttons are captured (not only the ones from PeekBufferPositive).

Use that hook to read from the pureButtons variable and read the buttons pressed. This hook is better than one on PeekBufferPositive since you can read the buttons AND clear them if you want (for example use the volume buttons as controls for your homebrew THEN clear them so the PSP won't notice that the buttons were pressed and doesn't try to alter the volume). You can even produce synthetic button presses and analog moments without using the physical controls ;) .
Advertising
Plugin list
Working on: QPSNProxy, QCMA - Open source content manager for the PS Vita
Playing: Error: ENOTIME
Repositories: github, google code
Just feel the code..

User avatar
DS_Marine
Developer
Posts: 276
Joined: Wed Oct 10, 2012 1:32 pm
Location: Argentina
Contact:

Re: PSP_CTRL_SCREEN, _HOME and kernel mode

Post by DS_Marine » Wed Mar 12, 2014 6:04 pm

eh, I already pointed them there in post #2 : D
@jukki If you take a look at TyRaNiD's psplink, he uses a loader that loads (duh) the psplink prx, maybe you can get an idea from there.
(fyi orange is for legendary)
Advertising
ImagePSP-Controlled drone
"Hackers don't have superpowers. Just a hackable PSP and a brain (ships by default on most humans models)" - A famous guy
Image

Jukki
Posts: 55
Joined: Fri Feb 04, 2011 7:28 pm

Re: PSP_CTRL_SCREEN, _HOME and kernel mode

Post by Jukki » Wed Mar 12, 2014 6:36 pm

codestation wrote:Check my other plugin in the same thread: viewtopic.php?p=293474#p293474

I made a hook inside the sceController_Service module so _ALL_ the buttons are captured (not only the ones from PeekBufferPositive).

Use that hook to read from the pureButtons variable and read the buttons pressed. This hook is better than one on PeekBufferPositive since you can read the buttons AND clear them if you want (for example use the volume buttons as controls for your homebrew THEN clear them so the PSP won't notice that the buttons were pressed and doesn't try to alter the volume). You can even produce synthetic button presses and analog moments without using the physical controls ;) .
Derp, i dint notice that post from the topic, should have looked closer. Going to give this a shot, will report back :)


*EDIT: Right now i have been able to redirect the buttons to diferent buttons, however I still have not been able to use the buttons independently (as in pass them to the came as independent button)

Jukki
Posts: 55
Joined: Fri Feb 04, 2011 7:28 pm

Re: PSP_CTRL_SCREEN, _HOME and kernel mode

Post by Jukki » Thu Mar 20, 2014 5:31 pm

Still havent found a way to pass the button pressing to the game, only a way to clear it from the list. Ideas?

Felix-Dev
Developer
Posts: 13
Joined: Tue Mar 19, 2013 7:53 pm

Re: PSP_CTRL_SCREEN, _HOME and kernel mode

Post by Felix-Dev » Mon Mar 24, 2014 7:36 pm

If you want to read any kernel mode PSP button within a user mode application, I suggest to write a kernel module which overrides the kernel button mask set by Sony.

If I remember it correctly, the check you want to overwrite is this one: https://github.com/uofw/uofw/blob/maste ... rl.c#L2026

Code: Select all

if (pspK1IsUserMode())
     buttons &= g_ctrl.userModeButtons;
As you can see, kernel mode buttons are ignored if the application obtaining them is a user mode application. Therefore, I suggest to skip the bitwise AND operation above.

For the PSP kernel version 6.60, this particular code is located at the following addresses within the PSP's controller module:

Code: Select all

0x00001FE8: 0x8D050004 '....' - lw         $a1, 4($t0)
0x00001FEC: 0x11600003 '..`.' - beqz       $t3, loc_00001FFC
0x00001FF0: 0xACD30000 '....' - sw         $s3, 0($a2)
0x00001FF4: 0x8DF90298 '....' - lw         $t9, 664($t7)
0x00001FF8: 0x00B92824 '$(..' - and        $a1, $a1, $t9 <-- kernel buttons are ignored here
Overwrite the value at address 0x00001FF8 with a NOP instruction (0x00000000) and you should be able to read kernel mode buttons within your user mode applications.

If you need help patching the controller module to achieve this, I'm sure Codestation and the other guys here in this thread can give you some help.

EDIT: Another interesting solution would be to compile your own custom version of the controller module (uofw's controller module compiles and works, so just add your changes to it) and to replace SONY's original ctrl module with it.

Post Reply

Return to “Programming and Security”