forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Press a key without pressing it

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Tsukasa



Joined: 04 Jul 2005
Posts: 12

PostPosted: Thu May 11, 2006 5:46 am    Post subject: Press a key without pressing it Reply with quote

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
Back to top
View user's profile Send private message
lS[UMD/2kdlSU]



Joined: 26 Oct 2005
Posts: 8
Location: Shiga, Japan

PostPosted: Fri May 12, 2006 9:08 am    Post subject: Re: Press a key without pressing it Reply with quote

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


Possible :)
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:

// 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;
}

_________________
lS[UMD/2kdlSU] - now working as 67...
----------------------------------------------
site: jap | eng
jap blog: here
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
pipspsp



Joined: 13 May 2006
Posts: 4

PostPosted: Sat May 13, 2006 1:49 am    Post subject: Reply with quote

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");
}
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sat May 13, 2006 1:56 am    Post subject: Reply with quote

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");
}


But maybe he is running code in the background and wants to generate the press for a another program.
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Sat May 13, 2006 8:37 am    Post subject: Reply with quote

What possible use could this have?
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Sat May 13, 2006 9:07 am    Post subject: Reply with quote

err why not just skip the controller input for function
for using the function you want at a given time
to execute at that time ...controller input is after all
just input to another function :P
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sat May 13, 2006 9:13 am    Post subject: Reply with quote

Drakonite wrote:
What possible use could this have?


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.

Another possible use of this would be something like VNC, but at the contrary: controlling the psp with a computer or with another psp.
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Sat May 13, 2006 9:55 am    Post subject: Reply with quote

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.


...and we don't hack official games here.
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sat May 13, 2006 1:45 pm    Post subject: Reply with quote

Drakonite wrote:
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.


...and we don't hack official games here.


I didn't mention the word official, it can be whatever game ;)
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Sat May 13, 2006 3:40 pm    Post subject: Reply with quote

moonlight wrote:
Drakonite wrote:
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.


...and we don't hack official games here.


I didn't mention the word official, it can be whatever game ;)

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.
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sat May 13, 2006 4:22 pm    Post subject: Reply with quote

Drakonite wrote:
moonlight wrote:
Drakonite wrote:
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.


...and we don't hack official games here.


I didn't mention the word official, it can be whatever game ;)

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.


But still can be used for other things.
For example the psp vnc server concept. Useful? Probably not, but like a curiosity or proof of concept is right.
Back to top
View user's profile Send private message
Devun_06



Joined: 17 Jun 2006
Posts: 15

PostPosted: Sun Jun 18, 2006 10:49 am    Post subject: Reply with quote

Well, I'd love to see how this is done, simply because it's the only way I see a program being able to turn off the PSP's screen and I want to introduce a nice sleep feature within my own program/eboot.
Back to top
View user's profile Send private message
Zettablade



Joined: 05 May 2006
Posts: 71

PostPosted: Sun Jun 18, 2006 5:23 pm    Post subject: Reply with quote

Same here. So, uh, well? What is the code! lol sorry. I've been wanting to know all day...
Back to top
View user's profile Send private message
vista200



Joined: 19 Mar 2008
Posts: 13

PostPosted: Fri Mar 21, 2008 7:53 pm    Post subject: Maybe a little late, but... Reply with quote

I tried some ways and i found a solution:

You just have to add the PSP_CTRL_XXXXX to pad.Buttons like here:

Code:
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"); }
}


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
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Fri Mar 21, 2008 8:34 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Sat Mar 22, 2008 4:19 am    Post subject: Reply with quote

XmbController :D, LocoRoco motion :D, vshanalog, JoySens, RemoteJoy, etc
_________________
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sat Mar 22, 2008 4:56 am    Post subject: Reply with quote

KickinAezz wrote:
XmbController :D, LocoRoco motion :D, vshanalog, JoySens, RemoteJoy, etc

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.
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Sat Mar 22, 2008 6:36 am    Post subject: Reply with quote

jean wrote:
KickinAezz wrote:
XmbController :D, LocoRoco motion :D, vshanalog, JoySens, RemoteJoy, etc

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.
Ofcourse! First two seem familiar to me, cuz they're are mine ;)
_________________
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sat Mar 22, 2008 10:33 am    Post subject: Reply with quote

@KickinAezz
Oh, sorry i didn't know :)))) ....greetings for those good pieces of software...oh, and by "IF you can already code ..." i did not mean YOU, of course
hi!
Back to top
View user's profile Send private message
Leot91



Joined: 04 Jun 2008
Posts: 6
Location: California

PostPosted: Fri Jun 06, 2008 7:55 am    Post subject: Reply with quote

Drakonite wrote:
What possible use could this have?


I just thought of a good idea for this.
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 **
Back to top
View user's profile Send private message Visit poster's website AIM Address
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sat Jun 07, 2008 1:46 am    Post subject: Reply with quote

Quote:
Posted: Fri May 12, 2006 11:37 pm Post subject:...

This post is old as my grandpa's ass, and all the "endless" possiblilities have been explored...take a look to the ton of homebrew starting with pikey
Back to top
View user's profile Send private message
Mopeto



Joined: 27 Jun 2008
Posts: 1

PostPosted: Wed Jul 02, 2008 11:00 pm    Post subject: Reply with quote

I dont know if this works but the pump it up zero game have "replay" function which only press the butons you did.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Wed Jul 02, 2008 11:06 pm    Post subject: Reply with quote

Don't feel attacked, but....no, it's not the point.
Back to top
View user's profile Send private message
Wally



Joined: 26 Sep 2005
Posts: 672

PostPosted: Thu Jul 03, 2008 10:12 am    Post subject: Reply with quote

jean wrote:
Quote:
Posted: Fri May 12, 2006 11:37 pm Post subject:...

This post is old as my grandpa's ass, and all the "endless" possiblilities have been explored...take a look to the ton of homebrew starting with pikey


Slight exaggeration there jean, or your grandpa is only two years old :)
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group