Jump to content



Photo
- - - - -

Potential for game pad controller input to DOFLinx


  • Please log in to reply
19 replies to this topic

#1 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 15 July 2017 - 06:47 AM

Slydog43 has raised the question about getting gamepad inputs working with DOFLinx in addition to keyboard inputs.  After a quick look, I thought, why not give it a try.  I setup this thread so that anyone interested can follow the adventure.

 

Step 1 for me is going to be getting a controller to connect to my development box.  I know my son has an XBox with wireless controllers, just not sure if he has an older on with wired controllers.  If not, I think ebay will be the answer.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#2 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 15 July 2017 - 07:48 AM

No older Xbox or wired controllers in the house, so its time to buy one locally via ebay so that I can get it in a reasonable time frame.  Should I get a genuine controller or a compatible one?  For the few extra dollars will a genuine controller ensure that what I'm coding to has more certainty to work with those of you using Xbox controllers?

 

I have two possibilities that I've found shipping from Australia.

Genuine

Compatible

 

Any guidance from those experienced with these controllers is welcome before I look to order in a couple of days.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#3 Slydog43

Slydog43

    Pinball Wizard

  • Platinum Supporter
  • 3,008 posts
  • Location:Hackettstown, NJ

  • Flag: United States of America

  • Favorite Pinball: Addams Family, All Williams 90's Games

Posted 15 July 2017 - 12:34 PM

Great news.  Just last night I was playing around on a new mame/pincab that I build and noticed a large delay when I was running joy2key to map buttons to keys for PinballFX2.  When I run 360ce no delay was perceivable, so I;m going to boot joy2key on all my systems.  If doflinx can work directly it will only improve everything.  Good luck, and I can test anything you like as I have a few machines set up



#4 TerryRed

TerryRed

    Pinball Wizard

  • Silver Supporter
  • 2,002 posts

  • Flag: Canada

  • Favorite Pinball: Too many to choose...

Contributor

Posted 15 July 2017 - 03:28 PM

I don't know how this affects you, but there are two API's for gamepad's / controllers for Windows.

 

Direct Input, and XInput.

 

Direct Input is the older standard that was used before XBOX 360 gamepads came out. Alot of the older Logitech gamepads and controllers use this (as well as steering wheels,etc).   Many of them still do. However the newer controllers all would be required to use XINPUT.

 

The newer Logitech gamepads use both DINPUT and XINPUT. It has a switch to toggle between them. When in DINPUT, its seen as a Logitech Rumblepad, when in XINPUT its seen as an XBOX 360 Gamepad (even though it shows a Logitech name).

 

XBOX 360 gamepads / controllers are all XINPUT.

 

XBOX One controllers are all XINPUT.  They are all the same...there is no wireless vs wired. They can plug in via USB. Or you can use the wireless via dongle.   The newer XBOX One S controllers support Bluetooth and the dongle.

 

 

My cabinet uses two controllers. 1 XBOX 360 gamepad, and one Logitech Gamepad.

 

 

 

On another note...the program you use to map memory triggers for DOFLinx for PFX2......   that should be able to be used to map memory triggers for "anything" right?   So could it be used to map PC games or emulators (MAME) for DOFLinx?


Edited by TerryRed, 15 July 2017 - 03:54 PM.


#5 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 15 July 2017 - 10:50 PM

Thanks TerryRed.  I had been reading about both types of input but hadn't linked it together as succinctly as you did - appreciated.  I was looking at using XInput via the standard XInput1_4.dll that has shipped with Windows for a while.  It certainly sounds like the controller I choose is not relevant, in fact I could probably "borrow" one of my son's wireless controllers (that may not end well, he's bigger then I am!)

 

As for memory mapping and MAME, technically DOFLinx can drive DOF devices from any valid trigger.  Memory mapping is the hardest as you need to find the memory offsets in the triggering system, that can be a royal PITA.  To trigger from another program there would need to be some DOFLinx changes as I wrap a number of "niceties" around handling specific processes.  This is all very possible for monitoring another program, the trick is finding the triggers.  Happy to talk more if there is an adventure you are thinking of.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#6 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 16 July 2017 - 07:54 AM

..... I can test anything you like as I have a few machines set up

 

Yes please  :D

 

I ordered two generic XBox wired controllers today.  Hopefully here to work on late this week.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#7 TerryRed

TerryRed

    Pinball Wizard

  • Silver Supporter
  • 2,002 posts

  • Flag: Canada

  • Favorite Pinball: Too many to choose...

Contributor

Posted 16 July 2017 - 08:46 AM

Thanks TerryRed.  I had been reading about both types of input but hadn't linked it together as succinctly as you did - appreciated.  I was looking at using XInput via the standard XInput1_4.dll that has shipped with Windows for a while.  It certainly sounds like the controller I choose is not relevant, in fact I could probably "borrow" one of my son's wireless controllers (that may not end well, he's bigger then I am!)

 

As for memory mapping and MAME, technically DOFLinx can drive DOF devices from any valid trigger.  Memory mapping is the hardest as you need to find the memory offsets in the triggering system, that can be a royal PITA.  To trigger from another program there would need to be some DOFLinx changes as I wrap a number of "niceties" around handling specific processes.  This is all very possible for monitoring another program, the trick is finding the triggers.  Happy to talk more if there is an adventure you are thinking of.

 

 

I was more curious if anything else had to be done to use it with other programs.   Since MAME "may" be simpler (smaller games) compared to PFX2, (though MAME itself is possibly complicated), I wondered about adding effects from specific game event triggers instead of a simple "key to output" based on key / button presses.   PC Games would be cool too, but I'm sure more complicated.

 

Triggers from very consistent things:

 

-game sounds being played / accessed

-events like dying, power ups, etc...

-specific levels being loaded / started

-maybe force feedback triggers used on some old arcade games

 

The nice thing about something like MAME, is that the games don't change at all, and I don't think the base code,etc drastically does either.

 

 

Just a thought. I know it's not an easy thing to do....just wondering how difficult it would be for other programs.



#8 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 16 July 2017 - 10:17 AM

Well, of course for MAME you could just use the MAME outputs for the game ROM you are playing.  Many games were designed to control hardware, those outputs are accessible from MAME.  I'm not sure how many, or with what emulators.  In theory making MAME outputs become DOFLinx triggers is possible.  I don't use MAME on a PC so I don't have experience with this.  My MAME emulation (and others) are on my coffee table with a Raspberry Pi.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#9 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 18 July 2017 - 12:42 AM

The design for the Xbox gamepad is done, preliminary coding, now just waiting on my controllers to test it out.

 

What I've done is allowed for two types of data when you enter in a key parameter.  The existing KK hex keyboard code, ie A0, then I've added a new "X" code for 'Xbox' in the format XCSS (X - Fixed, C- controller #, SS - String for button Identifier), ie X1A being Xbox, controller #1, A button or X2DU, Xbox, controller #2, D-Pad Up.  These codes can be used interchangeably as well, so you can have some keyboard and some Xbox inputs.

 

Of course, this is all great to talk about with no hardware and no testing yet!  @Slydog43, coming your way soon!


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#10 TerryRed

TerryRed

    Pinball Wizard

  • Silver Supporter
  • 2,002 posts

  • Flag: Canada

  • Favorite Pinball: Too many to choose...

Contributor

Posted 19 July 2017 - 12:03 AM

Starting next week, I will be living in a hotel for 2 weeks during the pack, load and move process.  

 

Won't be able to test anything during that time.



#11 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 29 July 2017 - 10:45 PM

.... and still waiting for my gamepad controllers - longest trip from Sydney to Adelaide ever!  I've logged a case with the eBay seller as something is wrong.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#12 Slydog43

Slydog43

    Pinball Wizard

  • Platinum Supporter
  • 3,008 posts
  • Location:Hackettstown, NJ

  • Flag: United States of America

  • Favorite Pinball: Addams Family, All Williams 90's Games

Posted 29 July 2017 - 11:25 PM

Patiently waiting.  Actually I'm in the process of upgrading the computer in my main pincab, so I couldn't test anything for a little bit anyway.   This might be fun to add feedback to other things also with a keyboard encoder and firing off something (led, noise maker, etc).



#13 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 05 August 2017 - 02:55 AM

What more can I say .....

 

doflinxxboximage_t.jpg

 

@SlyDog43 - PM with a link coming your way!


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#14 Slydog43

Slydog43

    Pinball Wizard

  • Platinum Supporter
  • 3,008 posts
  • Location:Hackettstown, NJ

  • Flag: United States of America

  • Favorite Pinball: Addams Family, All Williams 90's Games

Posted 05 August 2017 - 03:27 PM

Awesome, this eliminates the need for xpadder or joy2key.  Thanks man



#15 coreduo0099

coreduo0099

    Enthusiast

  • Members
  • PipPipPip
  • 109 posts

  • Flag: United States of America

  • Favorite Pinball: Tommy

Posted 13 August 2017 - 05:37 PM

Looking forward to this as well!



#16 coreduo0099

coreduo0099

    Enthusiast

  • Members
  • PipPipPip
  • 109 posts

  • Flag: United States of America

  • Favorite Pinball: Tommy

Posted 14 August 2017 - 11:56 PM

Hi,

 

Doing initial testing of 5.10... (I don't have any xbox controllers)

initially got this in debug:

13-Aug-17 20:41:04.190 - Error Detecting XBox controller - System.DllNotFoundException: Unable to load DLL 'xinput1_4.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at DOFLinx.MainForm.XInputGetBatteryInformation(Int32 uJoyID, UInt32 uJoyID2, XINPUT_BATTERY_INFORMATION& GameState)
   at DOFLinx.MainForm.Check_XBox()
 
I don't like errors, so I found a xinput1_4.dll and placed in doflinx directory
 
now getting this in debug (no controllers connected other than normal windows game controller):
13-Aug-17 20:47:08.617 - Error Detecting XBox controller - System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at DOFLinx.MainForm.XInputGetBatteryInformation(Int32 uJoyID, UInt32 uJoyID2, XINPUT_BATTERY_INFORMATION& GameState)
   at DOFLinx.MainForm.Check_XBox()
 
Windows 7 Pro x64 rig.
 


#17 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 15 August 2017 - 03:09 AM

Thanks for the report.

 

There is no problem with this and things will operate as normal.  It looks a bit ugly in the DEBUG.LOG as I had the code reporting the full exception to the log when it couldn't find any part of the Xbox controller stuff.  In the next release I will trim it back to :

 

13-Aug-17 20:47:08.617 - Failed detecting Xbox controller

 

without the rest of the information.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#18 coreduo0099

coreduo0099

    Enthusiast

  • Members
  • PipPipPip
  • 109 posts

  • Flag: United States of America

  • Favorite Pinball: Tommy

Posted 15 August 2017 - 04:42 AM

Thanks for the report.

 

There is no problem with this and things will operate as normal.  It looks a bit ugly in the DEBUG.LOG as I had the code reporting the full exception to the log when it couldn't find any part of the Xbox controller stuff.  In the next release I will trim it back to :

 

13-Aug-17 20:47:08.617 - Failed detecting Xbox controller

 

without the rest of the information.

Awesome.  Nice work!



#19 Slydog43

Slydog43

    Pinball Wizard

  • Platinum Supporter
  • 3,008 posts
  • Location:Hackettstown, NJ

  • Flag: United States of America

  • Favorite Pinball: Addams Family, All Williams 90's Games

Posted 08 March 2018 - 10:57 PM

Just got my cab running again with DOFLinx and would like an easier way to map my Joystick Emulator to DOFLinx.  Has anyone successfully used the program x360ce (which emulates a xbox 360 controller) with DOFLinx.  When I run x360ce and then run DOFLinx, no XBox controller is shown in the debug window.

 

If this doesn't work, then is there a way to use DirectInput (I know it old)

 

I actually don't know how DOFLinx works with my setup for pinball FX3 & FX2.  I use x360ce to emulate a xbox controller and map my flipper buttons to the triggers.  This somehow gets picked up by DOFLinx (Is the memory mapping just reading a flipper press and doesn't care what actually triggers the flipper?  I have left & right shift in the DOFLinx.ini as my flippers.  Just seems like it shouldn't work.

 

I have to believe some people who use DOFLinx have the zero lag encoder or something like it that only does directInput.


Edited by Slydog43, 09 March 2018 - 12:00 AM.


#20 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,627 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 09 March 2018 - 10:16 AM

....

 

I actually don't know how DOFLinx works with my setup for pinball FX3 & FX2.  I use x360ce to emulate a xbox controller and map my flipper buttons to the triggers.  This somehow gets picked up by DOFLinx (Is the memory mapping just reading a flipper press and doesn't care what actually triggers the flipper?  I have left & right shift in the DOFLinx.ini as my flippers.  Just seems like it shouldn't work.

 

...

 

I can answer part of this, DOFLinx gets the flipper press for FX2/3 from its mapping to the application.  So correct, DOFinx does not care what triggers the flipper.  The flipper mapping to left and right shift in DOFLinx.INI is for when DOFLinx needs to "fall back" to simple keyboard monitoring rather than a full link.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here