devilsclaw
New member
I bought a Univeral USB Convertor from Walmart (yeah I know Walmart is evil).
This convertor takes GameCube, PS2, XBox and USB as input types, It can take them all at once even. In windows 4 Devices show up even if only one controler is plugged in.
I Linux blight detects two controllers, first one does nothing, no button pressed detection. The second one works on the button detection, but it will not work in game unless I assign the first controler to one of the other 3 controllers in blight.
Since I would like to be able to use all 4 controllers but would not be able to because of how the convertor is handled, I made a patch tha makes it work with this convertor.
What the patch does is, It maps the controller handle to the correct controller slots if there assigned. If there not assigned it just opens all other joysticks just so I can use up to 4 controllers with these convertor boxs.
I know that in some case people would not want all controllers connected to be opened so im not suggesting this as a fix that needs to be put into release.
This convertor takes GameCube, PS2, XBox and USB as input types, It can take them all at once even. In windows 4 Devices show up even if only one controler is plugged in.
I Linux blight detects two controllers, first one does nothing, no button pressed detection. The second one works on the button detection, but it will not work in game unless I assign the first controler to one of the other 3 controllers in blight.
Since I would like to be able to use all 4 controllers but would not be able to because of how the convertor is handled, I made a patch tha makes it work with this convertor.
What the patch does is, It maps the controller handle to the correct controller slots if there assigned. If there not assigned it just opens all other joysticks just so I can use up to 4 controllers with these convertor boxs.
I know that in some case people would not want all controllers connected to be opened so im not suggesting this as a fix that needs to be put into release.
Code:
--- plugin.c 2008-03-17 18:16:04.000000000 -0700
+++ Mupen64Plus-1-3-RC1-src/blight_input/plugin.c 2008-03-20 03:43:34.000000000 -0700
@@ -1019,7 +1021,8 @@
void
RomOpen( void )
{
- int i;
+ int i, j, num_joys;
+ int joy_open = 0;
// init SDL joystick subsystem
if( !SDL_WasInit( SDL_INIT_JOYSTICK ) )
@@ -1030,15 +1033,25 @@
}
// open joysticks
+ num_joys = SDL_NumJoysticks();
+ for(j = 0; j < num_joys;++j)
+ {
+ joy_open = 0;
for( i = 0; i < 4; i++ )
- if( controller[i].device >= 0 )
+ {
+ if(!controller[i].joystick)
+ if( controller[i].device == j)
{
controller[i].joystick = SDL_JoystickOpen( controller[i].device );
if( controller[i].joystick == NULL )
fprintf( stderr, "["PLUGIN_NAME"]: Couldn't open joystick for controller #%d: %s\n", i, SDL_GetError() );
+ else joy_open = 1;
}
else
controller[i].joystick = NULL;
+ }
+ if(!joy_open) SDL_JoystickOpen( j );
+ }
// grab mouse
if (controller[0].mouse || controller[1].mouse || controller[2].mouse || controller[3].mouse)