Usbjoy Library + Joytest Available


Puck2099

Certified Guru
Joined
Oct 22, 2004
Messages
422
Location
Madrid, Spain
Website
www.gp32wip.com
Hi,

After some time, I have just finished a library to use USB Joysticks on GP2X connected to the Breakout Board or a similar device.

What could it be useful for? For example, you could play at the same time with 3 friends to Sunset Riders in front of your TV.

This library only makes use of kernel's and standard functions, so you could use it with SDL, Rlyeh's minimal libs or another APIs.

I think it is quite simple to use it, but I have added a complete documentation in HTML so coders could make use of it in a easier way to implement USB control on their games/emulators.

The library is licensed as LGPL and I have added the source code, if you make use of it I would only ask you to make it know that you use it. If you could improve the library, please, make public that improvements :)

I have included also a simple program to test USB joysticks called joytest.

joytest.png

This program scans up to 4 USB Joysticks (they must be plugged before executing joytest), shows information about them and lets you test how they work in a visual way. You can switch from a joystick to another only pushing a button or moving the pad.

I have included also the source code to help you know how it works. By the way, you can exit the program pushing START on the GP2X.

I have tested it with 4 devices connected at the same time: two usb pads, a dancing mate and a Playstation to USB pads adapter. All of them have worked fine :)

I hope it could help coders to include USB joystick support, I will add it to my AlexKidd2X in the next days.

Sorry for my bad English :unsure:

You can download it from here: usbjoy

Regards
 
Interesting .. is this SDL-free functionality? Because I'm pretty sure Paeryn's 'HW-SDL' supports USB joysticks/gamepads/etc. now through the usual event loop interface.
 
Epicenter posted on Aug 15 2006 at 04:31 PM said:
Interesting .. is this SDL-free functionality? Because I'm pretty sure Paeryn's 'HW-SDL' supports USB joysticks/gamepads/etc. now through the usual event loop interface.
Paeryn's SDL certainly does support USB joysticks, but I'm not sure if it supports 4 devices like this lib does (it may do, but I've only got one controller to test with). I imagine this will mainly be useful for people not using SDL.
 
Last edited by a moderator:
woogal posted on Aug 15 2006 at 08:49 PM said:
Paeryn's SDL certainly does support USB joysticks, but I'm not sure if it supports 4 devices like this lib does (it may do, but I've only got one controller to test with). I imagine this will mainly be useful for people not using SDL.

Well, my intention was to do it compatible with any API but thinking in minilib.

I did my test program supporting 4 devices, but the library could support a lot more (more than 100).

Regards
 
Last edited by a moderator:
I can't wait until the emulator developers incorporate this functionality into their emulators so I can play Sonic and Super Metroid with their intended gamepads. :)
 
washo posted on Aug 15 2006 at 09:54 PM said:
is there limitations to the number of buttons/axis?
Anything like analog support?

DDR on the go would be GREAT...I need a BoB

see you :lol:

Well, I have limited 32 buttons and 2 axes for each joystick, but it can be easily changed.

If you want analog support I could add it in next version :)

Regards
 
Last edited by a moderator:
EvilDragon posted on Aug 15 2006 at 05:21 PM said:
Beat2x with USB Dancemat on TV Out? Hehe :)
It's a pitty I haven't got much time right now. Also, I don't even have a dance mat nor a dock station. Anyway, the source code is here so if anyone wants to try it... :)

By the way, I'm not sure if the last version worked properly on TV, but I think it doesn't, so that's another thing to check (easy, I guess).
 
Last edited by a moderator:
woogal posted on Aug 15 2006 at 07:49 PM said:
Paeryn's SDL certainly does support USB joysticks, but I'm not sure if it supports 4 devices like this lib does (it may do, but I've only got one controller to test with). I imagine this will mainly be useful for people not using SDL.
There should only be whatever limits SDL imposes on any other platform, I only made alterations to force joystick(0) to be the built-in one. I'm thinking of adding an extra config function to allow the GP2X's joystick to be seen as a joystick with 2 axes rather than everything as buttons. I've also toyed with allowing the joystick to appear as a mouse to make it easier for anyone porting games/apps that expect mouse control, I'll do it eventually.

For non-SDL stuff this would certainly be useful though.
 
Last edited by a moderator:
Wolfsclaw posted on Aug 18 2006 at 05:19 PM said:
EvilDragon posted on Aug 15 2006 at 05:21 PM said:
Beat2x with USB Dancemat on TV Out? Hehe :)

this would definitely be the BOMB! B)

I have just added it, I think in some hours miq01 will release Beat2X 0.5 with that new feature :)
 
Last edited by a moderator:
Does every USB joystick/gamepad work right away? If not, do you recommend any specific type of joystick/gamepad? I basically want the buttons on a gamepad like the logitech rumblepad 2 (the non-wireless version ) to work, even if the special features don't register (like the vibration, etc).

Also, does BoB support for USB joysticks/gamepads have to be coded into every emulator or, for example, can there be a firmware update by GPH that can handle all of the external USB hardware?

I don't know a lot about computers, but this I am interested in this. thanks for everything :) .
 
ThaiGrocer posted on Aug 27 2006 at 06:26 PM said:
Does every USB joystick/gamepad work right away? If not, do you recommend any specific type of joystick/gamepad? I basically want the buttons on a gamepad like the logitech rumblepad 2 (the non-wireless version ) to work, even if the special features don't register (like the vibration, etc).

Also, does BoB support for USB joysticks/gamepads have to be coded into every emulator or, for example, can there be a firmware update by GPH that can handle all of the external USB hardware?

I don't know a lot about computers, but this I am interested in this. thanks for everything :) .

There's a set standard. Basically, only the button's locations may be funky, but that's it, everything else should work fine. Basically the only thing that would make this not work is if you can't change the buttons =D
 
Last edited by a moderator:
Back
Top