What's new

Mupen64Plus - blight-input patch

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.


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)
 
OP
D

devilsclaw

New member
yes thats the device.

Im running the kernel version 2.6.24.3

im using the GameCube controller slot.

im sure depending on the slot you use. ie xbox or maybe ps2. it might work with out any problems. since one of them will be device one when it shows up.
 
Last edited:

MasterPhW

Master of the Emulation Flame
I hate to zombify this thread, but how do you intall or run this patch?
You didn't zombify the thread it's only 2 months old.
Like I know the M+ devs the patch was probably already added to the trunk, so if you will get the newest svn code you probably already got the patch applied, but I would wait till a M+ dev reply.
 

gszx1337

New member
You didn't zombify the thread it's only 2 months old.
Like I know the M+ devs the patch was probably already added to the trunk, so if you will get the newest svn code you probably already got the patch applied, but I would wait till a M+ dev reply.
I DLed the latest version of Mupen64+ and my Universal adapter still wouldn't work.
 

okaygo

Mupen64Plus Dev.
By latest version do you mean you built from the following:
16:42 < okaygo`work> .latest
16:42 <@Mupen64PlusAgent> Mupen64Plus is currently at r495

There have been quite a few changes to blight input since 1.3, please try rebuilding from source or trying to find a newer build posted in the sub-forum...

I am moving this post to Mupen64Plus.
 
OP
D

devilsclaw

New member
If you want I and update the patch to the newest version of the blight input.

I keep ending up coming back to this site since its the only open source n64 emulator that is worth looking at lol. I was side tracked by WII64 which uses this engine.
 

nmn

Mupen64Plus Dev.
If you want I and update the patch to the newest version of the blight input.

I keep ending up coming back to this site since its the only open source n64 emulator that is worth looking at lol. I was side tracked by WII64 which uses this engine.

Wii64 is based off of vanilla Mupen64.
 

Top