PSP as gamepad fo PC

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

Moderators: cheriff, TyRaNiD

memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

PSP as gamepad fo PC

Post by memon »

Hi,

I'm prototyping a project for a PSP and would like to use the PSP itself as a controller for the initial PC prototype. I like fast turnaround times, and I have better framework to get started in PC so I will not make to prototype for PSP yet.

Does anyone know if there is similar projects already available?

If not, I think I have to go and make one :) I do not have the serial cable or IrDA port on my pc, so those solutions for communication are not viable at the moment for me. I think the USB communication (except for enabling the storage) has not been figured out yet. It would be super nice to just write a common joystick protocol for PSP and let the windows understand it as gamepad :).

Wlan is pretty much the only viable solution I can imagine at the moment. I'm a bit puzzled though, since the stuff in svn seems to be outdated (?) compared to the bits and pieces I've heard her at the forums and I have nerver written a piece of net code before. Is there any examples for psp talking to pc and vice versa which I could use to get started?

I'm not really interested for a grand unified solution (like to write an actualy device driver for windows), I'd just like to get the control data from PSP in realtime.

Thanks!
AyAn4m1
Posts: 15
Joined: Mon Sep 26, 2005 2:45 am

Post by AyAn4m1 »

At this point, what you want would be best accomplished using Wlan. I suggest looking at the libnet included in the FTPD source code (http://www.amoks.com/extra/FTPDv0_21.zip) You should be able to adapt this code to your purposes pretty easily. You could even use FTP and simply modify the commands to CROSS, TRIANGLE, SQUARE, CIRCLE instead of USER, PASS, STOR, RETR... but that's up to you and whatever app is getting the data on the PC. Hope that solves your problem.
memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

Post by memon »

Thanks! That should get me started. I already managed to make simple winsock client/server thing (it was not as hard as I imagined :)), let's see how to get that psp up and running.
memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

Post by memon »

That FTPd sample was actually reeeally old, so it did not work. Psppet's wifi sample is way better to get started and works brilliantly: http://aibopet.com/psp/wifitest.htm. (I'm pretty sure I could have found that with some more through out search on the forum.)

After a couple of hours I got it all working! There is an interesting problem, though. I only need to send 6 bytes per frame, but unless I add some payload there is huge latency. At the moment I'm sending 256 byte packets resulting 15.3k/s, which seem to work ok.

Does anyone know what would be the best packet size for least altency or is that something that depends in ten different things?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Are you using tcp or udp ? tcp will buffer up data unless you explictly tell it no t to, udp should send packs straight away, at least I would guess :)
memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

Post by memon »

Using TCP. I took a quick look at the UDP stuff, looks scary :) I think I'll figure it out. I also tried to change the SO_SNDLOWAT, but I bet there's quite a few buffers on the way in the sending and receiving ends.
AyAn4m1
Posts: 15
Joined: Mon Sep 26, 2005 2:45 am

Post by AyAn4m1 »

Yeah TCP is a lot more regulated, UDP is the way to go if you're looking for speed. I don't even know if you can force the PSP to send TCP data as soon as it can... But I'd recommend spending some time with UDP and just working through it. It will work much faster, although you'll lose a bit of error checking (which might mean something seeing as you're going over a wireless connection) Anyways, good luck, and if you need any help on the PC end of things, I have quite a bit of netcode experience in Windows.
memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

Post by memon »

The UDP was the solution :) Now I'm able to send nice 11 byte packets at good rate. I finally settled to a solution, where the psp just sends the data to the server/host/pc at constant rate and the host just listens to a certain port and waits for something to be retrieved. It turned out to be much easier solution than the original with TCP.

If someone is interested, here's the stuff:

http://www.moppiproductions.net/memon/s ... er-010.zip

I bet a lot of people will not find that very usefull, though :)

But for me, it already proved that the controls I tested to work very well with a ps2 style gamepad suck on psp because of the very very badly placed analog nub (why could not they put it above the d-pad, oh why?)
User avatar
EdwardFMA
Posts: 40
Joined: Wed Jul 06, 2005 11:47 am

Post by EdwardFMA »

I've actually done this before it was terribly slow and was very sensetive i had a serial IR device on my computer and a program which you could set certant key to certant IR signals i then simply made a program that sent out different signals. ;) I don't have anymore I think i mentioned it on this board, but that was when it had the other forum and stuff.

Good Luck I hope you have better luck than i did ;)

-EdwardFMA
EdwardFMA/IchigoKurosaki - PSP Expert
Athlon 64 - Socket 939 - 3000+
1GB 333 DDR-Ram
Geforce 6600 GT PCI-Express

Orbis PSP Development
Open-Source Development
liquid8d
Posts: 66
Joined: Thu Jun 30, 2005 6:29 am

Post by liquid8d »

Nice job... not useful as of yet, but it has potential :) I'm checking out the udp stuff as I am about to get into that.

Not sure what your intentions are with this, but I would like to see profiles for button mapping to keyboard (with maybe an image displayed that describes the button presses for that profile). With little modification, you could have a profile for say... controlling winamp.

Keep up the good work...

LiQuiD8d

p.s. also.. does it really need to send the data if the controllers state hasn't changed?
salvi
Posts: 3
Joined: Mon Nov 28, 2005 9:23 pm

Post by salvi »

This would be just excellent. Currently im using the IR receiver, a ps2 to USB adapter and joy to key (http://www.vector.co.jp/soft/win95/util/se101657.html) to use the PSP as a remote for a media center pc, but being able to do it over wifi would be amazing.

Very interested in the outcome of this, keep up the good work!
memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

Post by memon »

My motovation was to just get the data from the psp to the PC for a game prototype - which at this moment only works on PC - to test the controls on the real thing. So I'm not going to go any forther at this point. As for sending the stuff constantly, you propably could do some optimisation there, but 11B*60Hz = 660bytes/sec is not worrying me too much :) There's still plenty of bandwidth to leach the pr... programming related material.
Rich43
Posts: 28
Joined: Sat Oct 22, 2005 2:13 am

Post by Rich43 »

OH MY GOD! That is amazing!

I can see my self playing all my fravorate PC games with this thing!

Maybe you could write a Windows Joystick Driver that works with it? I dont know!

It seems real fast to me.

Edit: I just got a idea, I can code a server in Visual Basic, I dont know C++ but I own at VB :P. I know people hate that language!

Edit 2: I might have a nice looking server soon. I have figured out your protocol (well most of it). I think I just need it to interface with the keyboard and mouse which is easy :). Right now, it looks like this (Its just a load of debug data):
Image

Not done any GUI just finished figuring out what number does what.
Sorry for turning this post into a blog :P Gonna be playing all my games with a very expensive gamepad soon :)
salvi
Posts: 3
Joined: Mon Nov 28, 2005 9:23 pm

Post by salvi »

Yes please! :D
Rich43
Posts: 28
Joined: Sat Oct 22, 2005 2:13 am

Post by Rich43 »

I am planning a spin off to his project.

I think I might either:
Keep his client software and use my own server.
OR
Recode the whole PSP client in LUA

If you are wondering what the server looks like right now, here it is:
Image

It will look better than that when its done :)

I still have a heap of work to do on it, but it will be worth it. At the moment, I can move my mouse around the screen with my analog stick.

Many thanks to memon for the idea and the origional client/server software, he will get some credit :)
eggzrule
Posts: 4
Joined: Mon Mar 07, 2005 11:28 pm

Post by eggzrule »

Rich43 wrote:I am planning a spin off to his project.

I think I might either:
Keep his client software and use my own server.
OR
Recode the whole PSP client in LUA

If you are wondering what the server looks like right now, here it is:
*IMG Removed*

It will look better than that when its done :)

I still have a heap of work to do on it, but it will be worth it. At the moment, I can move my mouse around the screen with my analog stick.

Many thanks to memon for the idea and the origional client/server software, he will get some credit :)
Looking good so far :-) .
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Moved to PSP Hardware Development.
User avatar
JoshDB
Posts: 87
Joined: Wed Oct 05, 2005 3:54 am

Post by JoshDB »

Wow, great work. This would be awesome as an emulator controller (emulator on PC)
eggzrule
Posts: 4
Joined: Mon Mar 07, 2005 11:28 pm

Post by eggzrule »

This project interests me because if they implemented the PSP as a type of controller for the PC, I could then maybe control what music is playing on my computer all around the house by assigning hotkeys to Winamp and then "hitting" those keys through my PSP. Would be one of those programs that I would use if I had, but probably live without.
Rich43
Posts: 28
Joined: Sat Oct 22, 2005 2:13 am

Post by Rich43 »

I will also research emulating a real gamepad. I think this sounds difficult but il ask around...
If anyone knows anything about writing gamepad drivers for this thing, the help would be much appreciated.
salvi
Posts: 3
Joined: Mon Nov 28, 2005 9:23 pm

Post by salvi »

Rich43, thanks for your work, hopefully someday we´ll see it as an actual gamepad. Keep it up!
Gizmo
Posts: 14
Joined: Sat Feb 05, 2005 1:54 am

Post by Gizmo »

I have used PPJoy in the past to use a Playstation 1 controller connected to the parallel port as a Gamepad in Windows XP.
The good thing is that PPJoy also supports custom interfaces (Virtual Joystick is the keyword to look for on the PPJoy website). So somebody could just write a PSP specific interface (a DLL I think) for PPJoy without actually having to care about all the windows device driver and direct input stuff.

Have a look here for all the details:
http://www.geocities.com/deonvdw/Docs/PPJoyMain.htm
Rich43
Posts: 28
Joined: Sat Oct 22, 2005 2:13 am

Post by Rich43 »

Thank you Gizmo, I think the first version will only control Keyboard and Mouse. For the version after that, I will look more deeply into joystick emulation etc

The software is very good, It even transfers the client to your PSP and configures it for you :)
EdwardDam
Posts: 5
Joined: Sat Dec 31, 2005 10:03 pm

Post by EdwardDam »

hey rich, how is it going?

i can't wait till this is done, if it only controls keyboard then that can do for now

i can set games to keyboard and assign the keys? :)

how long do you think it will take to be done?

i heard that pspupdates has someone trying to make the same thing

can't find it though
Edward`
Rich43
Posts: 28
Joined: Sat Oct 22, 2005 2:13 am

Post by Rich43 »

Well I did the stupidest thing a developer could do, Accidentally overwrite one of the source files (full of lots of code) with something else.

So basically, I have lost a load of code but I will re-code it, I do need this myself!

I cant believe what a stupid thing I did!

oh and If anyone is good at making ICO files, ya can make me a PSP Controller icon if u want :)
Mr.Modem
Posts: 28
Joined: Wed Sep 21, 2005 4:43 am

Post by Mr.Modem »

I'm sorry for the source file, I hope you rewrite it soon. I have a PSP icon you can have for your project. Here's a preview:
Image

And here's the icon file:

http://www.sendmefile.com/00208977
Rich43
Posts: 28
Joined: Sat Oct 22, 2005 2:13 am

Post by Rich43 »

Tnx for the icon, I cant get the File downloading website to work, you can email it to me: RichieS@GMail.com

Or I could take the time to convert the png to a ico

Oh yes, Thanks to the latest 2.00 loader. It now works with firmware 2.00. thats neat cause I can play Grand theft auto and use PSP controller :)
EdwardDam
Posts: 5
Joined: Sat Dec 31, 2005 10:03 pm

Post by EdwardDam »

ive uploaded the icon on my server for you

http://www.edwarddam.co.uk/psp.zip
Edward`
Mr.Modem
Posts: 28
Joined: Wed Sep 21, 2005 4:43 am

Post by Mr.Modem »

Thanks EdwardDam for uploading it to your server. I've sent the file to him by email so I think he have it now ;)
EdwardDam
Posts: 5
Joined: Sat Dec 31, 2005 10:03 pm

Post by EdwardDam »

this isnt going to work with 2.6 is it? :(

:'(
Edward`
Post Reply