Two Joypads disturbing each other

Gamepad acting up? Keyboard not responding properly? Can't get that other user to work? Read and post about it here.

Moderator: ZSNES Mods

Post Reply
donmartio
New Member
Posts: 6
Joined: Fri Sep 09, 2005 8:50 am

Two Joypads disturbing each other

Post by donmartio »

Hallo,

i recently bought 2 Logitech Precisiion Pads for playing Street Fighter.
There was no problem to configure them but in the game we had to notice, that some Keys are
double-binded... So for example if i walk, my opponent kicks.
This is a little bit disturbing.

Is there any trick to force zsnes using 2 different devices seprately?

Im using zsnes under Gentoo.
I tried:
zsnes -1 5 -2 5

but it doesn't change anything.

Any ideas?

My Street Fighter TNC Module is broken and you can't get it anywhere outthere so
it would be nice if we can play it with ZSNES.

Greetings Don Martio
donmartio
New Member
Posts: 6
Joined: Fri Sep 09, 2005 8:50 am

Post by donmartio »

And now i tested it with two different Joypads but the result is somewhat differnt and at last the same.

When i start zsnes from console i get the feedback

Device 0 /dev/input/js0
2 axis, 2 buttons, 0 hats, 0 balls
Device 1 /dev/input/js1
2 axis, 2 buttons, 0 hats, 0 balls

Does that mean, that there is some error in the device configuration of zsnes?

If i use the devices with cat there is no disturbing each other.

Any help is appriciated.

Greetings
DonMartio
kevman
Redneck Gamer-Mod
Posts: 433
Joined: Wed Aug 04, 2004 2:15 am
Location: Pittsburgh

Post by kevman »

Well, make sure that the settings don't conflict in Zsnes.

Try completely redoing the controller config in both p1 and p2, and make sure that there's no setting in P3 or p4.

How are these connected to your computer?
SHREIK!!!!!!! DDdddnnnnnnaaaa! GESTAHLLLLLLLLLL!!!!!!!!

Steelers now officially own your ass.
donmartio
New Member
Posts: 6
Joined: Fri Sep 09, 2005 8:50 am

Post by donmartio »

Thanks for the reply.

I've done the Controller Setup a thousend times. What i can say is, that the Button-Codes
that where entered in the fields are partially the same for the to Input-configs.
For exmple J07 is the X-Button on Input 1 and Right on Input 2.

The Controllers are connected via USB and i tested them with cat and with kcontrol. On the system they don't mix up with each other.

I took a look ( :oops: ) in the sources and i wonder if this isn't a zsnes but a SDL Problem.

I can't imagine how the two controllers are mixed up because they are two different devices.
Im not firm with Input-Programming but in my understanding it's more difficult to mix them up than to keep them seperated.

Well is there anybody who encountered the same Problem?

Greetings
DonMartio
donmartio
New Member
Posts: 6
Joined: Fri Sep 09, 2005 8:50 am

Post by donmartio »

So finally i did it (with some dirty hack).

I did some investigation in the sourcecode:

First tried a change of the file sdlintrf.asm:
before:

Code: Select all

; Total Number of Input Devices
NEWSYM NumInputDevices, dd 2

; Input Device Names
NEWSYM GUIInputNames
db 'NONE            ',0
db 'KEYB/JOYSTICK  ',0
db '                ',0
db '                ',0
db '                ',0
db '                ',0
db 'SIDEWINDERPAD1  ',0
after:

Code: Select all

; Total Number of Input Devices
NEWSYM NumInputDevices, dd 3

; Input Device Names
NEWSYM GUIInputNames
db 'NONE            ',0
db 'KEYB/JOYSTICK1  ',0
db 'KEYB/JOYSTICK2  ',1
db '                ',0
db '                ',0
db '                ',0
db 'SIDEWINDERPAD1  ',0
But that doesn't do the job so i found finally the file sdllink.c:
In this file is a function called InitJoystickInput
In there the offsets for the Axis, Buttons, etc. are calculated from the infos given by
SDL. And now comes the dirty stuff.
I changed the line:
num_buttons = SDL_JoystickNumButtons(JoystickInput) ;
to:
num_buttons = SDL_JoystickNumButtons(JoystickInput) + 6;
Because i have more buttons than the 2 found by SDL.
Now there was only two Buttons double-binded. So
i added:

Code: Select all

} else if (num_hats == 0 && num_balls == 0) {
       AxisOffset[i] = ButtonOffset[i - 1] + SDL_JoystickNumButtons(JoystickInput[i - 1]) + 16;
       ButtonOffset[i] = AxisOffset[i] + num_axes * 2;
 } else {...
I simply added 16 to AxisOffset for every Joypad after the first and now everything works fine!.
Ok it's not nice, but it do the job.
I think the main problem is with SDL and the wrong Button Information.
I don't know a clean solution this time but i think of it.

So long
DonMartio
donmartio
New Member
Posts: 6
Joined: Fri Sep 09, 2005 8:50 am

Post by donmartio »

Ok... stupid me... forget the stuff above.
The only thing, that is important, is thad sdl gives the wrong info about my pads.
My Pads have 10 Buttons and SDL says they have two... no calcualte.
I added 8 in the sources and i'm thinking of an option which let you manually set the Buttoncount for your pads.

So don't even read the above sollution.

Greetings
DonMartio
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

You should file a bug report with SDL, except I'm not really sure now.
[u][url=http://bash.org/?577451]#577451[/url][/u]
Zondeman
New Member
Posts: 4
Joined: Sun Aug 08, 2004 2:31 pm

Post by Zondeman »

I made this current joystick code :) Glad you found an SDL problem; every error i hear of are SDL bugs, btw.

I think it is strange that SDL does handle the high(er) buttons/axis, but doesn't report them. Do you have the latest SDL? (maybe even from CVS?). Otherwise, this must be a small SDL bug, so try to fix that. You can also simply post your problem on this mailing list and hope somebody else fixes it.
donmartio
New Member
Posts: 6
Joined: Fri Sep 09, 2005 8:50 am

Post by donmartio »

Heyho Zondeman,
nice piece of work. I think i'll take a look myself. It was some kind of fun to dig
around in C++/ASM Code for somebody like me who's every day business it is to walk knee-deep through miserable PHP code and Java stuff.

Greetings
DonMartio
Post Reply