Press a key without pressing it
Press a key without pressing it
Hi
I've a simple question:
Is it possible to code a program which is able to press automatically a predefined button in a certain time?
Thanks in advance
I've a simple question:
Is it possible to code a program which is able to press automatically a predefined button in a certain time?
Thanks in advance
-
- Posts: 8
- Joined: Wed Oct 26, 2005 10:08 pm
- Location: Shiga, Japan
- Contact:
Re: Press a key without pressing it
Possible :)Tsukasa wrote:Hi
I've a simple question:
Is it possible to code a program which is able to press automatically a predefined button in a certain time?
Thanks in advance
You have to patch the sceCtrl**** stub(if you want to take a effect to a module)
or function body(if you want to take a effect to all modules).
I've tried patching sceCtrlReadBufferPositive stub in "game" module and it worked:)
Code: Select all
// The part of the test code
PspCtrlButtons mask_and;
PspCtrlButtons mask_or;
int patched_sceCtrlReadBufferPositive(SceCtrlData *pad_data, int count)
{
int result = sceCtrlReadBufferPositive(pad_data, count);
pad->Buttons &= mask_and;
pad->Buttons |= mask_or;
return result;
}
But maybe he is running code in the background and wants to generate the press for a another program.pipspsp wrote:im not a c coder, but shouldn't you use the function that the button executes?
if (pad.Buttons & PSP_CTRL_SQUARE){
printf("Square pressed \n");
}
couldn't you just change the if
if ("time" = "when i want it"){
printf("Square pressed \n");
}
I'm not him, but maybe he wants to generate events for another program, or for a game, maybe a list of events in specific times to automatize some things.Drakonite wrote:What possible use could this have?
Another possible use of this would be something like VNC, but at the contrary: controlling the psp with a computer or with another psp.
...and we don't hack official games here.moonlight wrote: I'm not him, but maybe he wants to generate events for another program, or for a game, maybe a list of events in specific times to automatize some things.
Shoot Pixels Not People!
Makeshift Development
Makeshift Development
Thats still not really within our rules... If it's your game, you don't need to fake button presses like this.. and if it's someone elses, we really don't hack games like that here.moonlight wrote:I didn't mention the word official, it can be whatever game ;)Drakonite wrote:...and we don't hack official games here.moonlight wrote: I'm not him, but maybe he wants to generate events for another program, or for a game, maybe a list of events in specific times to automatize some things.
Shoot Pixels Not People!
Makeshift Development
Makeshift Development
But still can be used for other things.Drakonite wrote:Thats still not really within our rules... If it's your game, you don't need to fake button presses like this.. and if it's someone elses, we really don't hack games like that here.moonlight wrote:I didn't mention the word official, it can be whatever game ;)Drakonite wrote: ...and we don't hack official games here.
For example the psp vnc server concept. Useful? Probably not, but like a curiosity or proof of concept is right.
-
- Posts: 71
- Joined: Fri May 05, 2006 5:59 pm
Maybe a little late, but...
I tried some ways and i found a solution:
You just have to add the PSP_CTRL_XXXXX to pad.Buttons like here:
and tada, you see the message, that CROSS is pressed!
It works for me on 3.90 M33-2 with 1.50 Kernel
This is very useful when remote controlling the psp's music player! You just add your codes of your remote control and then switch songs with the remote.
Thus far from my side,
vista200
You just have to add the PSP_CTRL_XXXXX to pad.Buttons like here:
Code: Select all
SceCtrlData pad;
while (1)
{
sceCtrlReadBufferPositive(&pad, 1);
pspDebugScreenSetXY(0, 0);
printf("%i\n", pad.Buttons); // standard pad, nothing pressed
pad.Buttons = pad.Buttons + PSP_CTRL_CROSS;
printf("%i\n", pad.Buttons); // changed pad, where CROSS is pressed
if (pad.Buttons & PSP_CTRL_CROSS) { printf("X is pressed!\n"); }
}
It works for me on 3.90 M33-2 with 1.50 Kernel
This is very useful when remote controlling the psp's music player! You just add your codes of your remote control and then switch songs with the remote.
Thus far from my side,
vista200
Did you resume such an old post to say such wrong things?? Once you get pad data structure, that is YOUR LOCAL COPY of a system struct, not the struct itself....if you modify it in your code, then your code is the scope of your variable, and other processes CANNOT see the change: you definitely cannot drive the xmb mp3 player with this nonsense...local and global scopes:things i learned in a BASICA course when i was eight.
-
- Posts: 328
- Joined: Sun Jun 03, 2007 10:05 pm
Ok, but none of these are made with that crappy code...they do it hooking sys function calls...i guess piKey sources are a good place to start learning how to do such a thing.....IF you can already code c and distinguish between local/global/process/system scopes.KickinAezz wrote:XmbController :D, LocoRoco motion :D, vshanalog, JoySens, RemoteJoy, etc
-
- Posts: 328
- Joined: Sun Jun 03, 2007 10:05 pm
Ofcourse! First two seem familiar to me, cuz they're are mine ;)jean wrote:Ok, but none of these are made with that crappy code...they do it hooking sys function calls...i guess piKey sources are a good place to start learning how to do such a thing.....IF you can already code c and distinguish between local/global/process/system scopes.KickinAezz wrote:XmbController :D, LocoRoco motion :D, vshanalog, JoySens, RemoteJoy, etc
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Use it more for Development than for Gaming.
I just thought of a good idea for this.Drakonite wrote:What possible use could this have?
The possiblitys are endless.
My current psp status
3.71 M33 - 2, w/ 1.50 patch.
Type - Fat psp fully working
Pandora batt on hand.
** Im a willing betta tester **
3.71 M33 - 2, w/ 1.50 patch.
Type - Fat psp fully working
Pandora batt on hand.
** Im a willing betta tester **