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 

Best way to send key presses/releases through socket

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



Joined: 17 Dec 2009
Posts: 39

PostPosted: Sat Jan 30, 2010 8:52 am    Post subject: Best way to send key presses/releases through socket Reply with quote

Hi everyone.
I'm trying to create an simple app to send key presses/releases to be interpreted using WinAPI. Everything went fine, its all working. But now i've run into this problem:
I'm using SceCtrlLatch to get the changes on key states and send the 'events' (presses and releases) throught a simple UDP socket.
The problem is sometimes when you press two keys at the 'same' time (or in a short time) it does not send that packet or psp does not recongnize that.If that is a key release, it becomes really anoying, cause if you're running an emulator, it does not get the key release and mario keeps running foward, for example.
So my question is: what is the best way of doing it? Should i send them over TCP or anything like that?
Thanks in advance.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Sun Jan 31, 2010 1:51 am    Post subject: Reply with quote

Application layer wifi is not suitable for sending keypresses in the first place. You will lose something.
Back to top
View user's profile Send private message
victorprosa



Joined: 14 Jan 2009
Posts: 38

PostPosted: Sun Jan 31, 2010 2:04 am    Post subject: Reply with quote

Torch wrote:
Application layer wifi is not suitable for sending keypresses in the first place. You will lose something.


Except if the PSP client sends like 5 times the single key press information in for example 100ms...

in reciever, you configure it to ignore key repeat in a 100ms interval...


Information loss problem solved? xD
Back to top
View user's profile Send private message Send e-mail
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Sun Jan 31, 2010 2:17 am    Post subject: Reply with quote

You shouldn't use UDP if you're going to merely transmit keystrokes. Use TCP instead. Here a few hints about why to do so:

http://en.wikipedia.org/wiki/Transmission_Control_Protocol#Data_transfer

Torch wrote:
Application layer wifi is not suitable for sending keypresses in the first place. You will lose something.

I completely disagree. How can you play games over ad-hoc Wifi then? TCP is a reliable protocol. You don't have to lose a single thing.
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Sun Jan 31, 2010 4:04 am    Post subject: Reply with quote

m0skit0 wrote:
I completely disagree. How can you play games over ad-hoc Wifi then? TCP is a reliable protocol. You don't have to lose a single thing.


Games send updates of the game state, not button presses. And much much less frequently than button sampling rate. There is no way you can play something like Tekken if it sent button presses, where there are moves that require timing accurate up to 1/60th of a second known as just frame or single frame moves. Buttons are interpreted on the client side and only the resulting application action is sent to the server.
Back to top
View user's profile Send private message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Sun Jan 31, 2010 4:07 am    Post subject: Reply with quote

(PLZ DELETE)
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
lgnr



Joined: 17 Dec 2009
Posts: 39

PostPosted: Wed Feb 17, 2010 2:49 am    Post subject: Reply with quote

Thanks for every answer. It was really helpful.
But the question is another:
The PSP CANNOT read every key press if there are too many at the same time.
I mean, i found that is not reliable to send one key press when the key is pressed.
Perhaps it would be nicier to send all the key states instead of each button at a time?
Any thoughts on that, guys?

Thanks a lot again!
Back to top
View user's profile Send private message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Wed Feb 17, 2010 3:26 am    Post subject: Reply with quote

Send game status or better, only modifications that had ocurred. Do not send keypresses, process them and send game status as Torch already explained.
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
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