Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Keyboard2Xinput (Virtual X360 pads from keyboard)  (Read 92329 times)

0 Members and 1 Guest are viewing this topic.

floodie

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:April 10, 2022, 03:38:22 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #120 on: October 13, 2020, 04:10:20 am »
update : so i checked a few things last night... Installed the Visual C++ Redistributable for Visual Studio 2015 32bit but that didnt make the difference... I noticed that i was getting the error in my k2x Log file to suggest i was missing this ReDis'

at Nefarius.ViGEm.Client.ViGEmClient.vigem_alloc()
at Nefarius.ViGEm.Client.ViGEmClient..ctor()
at Keyboard2XinputLib.Keyboard2Xinput..ctor(String mappingFile)
at Keyboard2XinputGui.Keyboard2XinputGui.InitK2x()
at Keyboard2XinputGui.Keyboard2XinputGui..ctor(String aMappingFile)
at Keyboard2XinputGui.Program.Main(String[] args)

After this i would swap out the Mapping.ini files and sometimes the program would SEEM to work and not dissapear. I knew it was working also because i could toggle it RED with the Divide key as per the mapping i had... however, loading Streets of Rage 4 or any other windows game it just would not see my ipac button pressed.. Even though i had mapped the ipac keyboard keys to ABXY etc in the mappings.ini (All upper case too).

i cant see how people have praised this SW so much, ive had nothing but issues, crashes, and crazy glitchyness.. It must be my set up or something as i fail to believe every one here is mad and that the software really is bad. Just need to get to the bottom of it

Schwing

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:January 30, 2024, 01:40:08 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #121 on: October 31, 2020, 11:16:38 am »
Hi floodie,
Did you install ViGem? Could you post your config and the complete log file afetr an unsccessful launch?

kagaden

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 243
  • Last login:September 10, 2022, 10:58:37 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #122 on: December 24, 2020, 05:49:58 am »
Hey ya'll!

I'm back and FINALLY was able to get into work to take my cab PC's home for the holidays to give them their yearly upgrade.

@Schwing, I'll do some testing on MK and Injustice on both machines.
@Schwing, were you able to remove the error toast on duplicant runs in the latest version? I'm excited to check it out.
@Earlier post on mouse jiggler, that's a brilliant idea if I can find someway to move the mouse on Xinput now... :lol I'm going to think about this some, the problem will be making mouse jiggler exit when there's no input so the timer can close the game.
@Even Earlier posts on launch scripts. I'll add mine now that I have access.

This pandemic has sucked heh. Be back in a few days while I'm on break with some results.

Thanks for keeping this thread and awesome app alive Schwing, PM me your paypal so I can donate a little holiday merriment your way.

-K
« Last Edit: December 24, 2020, 05:53:14 am by kagaden »

xul

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:March 18, 2024, 12:13:49 pm
  • Toasty!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #123 on: January 23, 2021, 04:01:00 pm »
Hi Xul,
it should work with MK11 (apart from trying to use A+X to throw, which only works intermitently) and DAO6. A common issue is having Joy2Key, did you use it?

Hi Schwing,  I don't have Joy2Key installed on my pc/Windows10.  I'm having the same problem with Samurai Showdown as well.  It seems like some games just don't recognize the virtual xbox360 controllers and some games do.  I did use the Ipac multi-mode on these problematic games and it recognizes them... the problem I have with using that method is that my machine BSOD's intermittently with the Ipac multimode changes sometimes... It doesn't mind your program at all.  I'd prefer to use K2X.  Anyway, curious if you or anyone has seen this behavior.  Appreciate it. :cheers:

Foxhole

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:March 04, 2024, 04:36:28 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #124 on: January 23, 2021, 04:10:31 pm »
I use k2x on samurai shodown with no issues.
Windows 7.

xul

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:March 18, 2024, 12:13:49 pm
  • Toasty!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #125 on: January 24, 2021, 11:32:11 am »
I use k2x on samurai shodown with no issues.
Windows 7.

Strange... Is there a way to log this to see what's happening on my machine? 

Foxhole

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:March 04, 2024, 04:36:28 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #126 on: January 25, 2021, 12:42:54 am »
I use k2x on samurai shodown with no issues.
Windows 7.

Strange... Is there a way to log this to see what's happening on my machine?
There already is. Inside the folder there's a k2x log file.

xul

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:March 18, 2024, 12:13:49 pm
  • Toasty!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #127 on: January 25, 2021, 04:18:57 pm »
I use k2x on samurai shodown with no issues.
Windows 7.

Strange... Is there a way to log this to see what's happening on my machine?
There already is. Inside the folder there's a k2x log file.

Thanks for the info.  It's working and here's the log but just tried it with Samurai Shodown and the game doesn't recognize/see the xinput game controllers that K2X creates.  Really stumped on this.  Some games it works find... others they don't see the virtual controllers.

Logs:
2021-01-25 16:20:24,710 [1] INFO  Keyboard2XinputGui.Program- Keyboard2Xinput v1.2.1.24
2021-01-25 16:20:24,826 [1] DEBUG Keyboard2XinputLib.Config- Using default config file: mapping.ini
2021-01-25 16:20:24,827 [1] INFO  Keyboard2XinputLib.Config- Loading config file: D:\Tools\Xinput\Keyboard2Xinput-1.2.1\mapping.ini
2021-01-25 16:20:24,834 [1] DEBUG Keyboard2XinputLib.Config- found config for pad 1
2021-01-25 16:20:24,834 [1] DEBUG Keyboard2XinputLib.Config- found config for pad 2
2021-01-25 16:20:24,834 [1] INFO  Keyboard2XinputLib.Config- D:\Tools\Xinput\Keyboard2Xinput-1.2.1\mapping1.ini exists: False
2021-01-25 16:20:24,834 [1] INFO  Keyboard2XinputLib.Config- found 2 pads
2021-01-25 16:20:24,834 [1] INFO  Keyboard2XinputLib.Config- found 1 mappings
2021-01-25 16:20:24,838 [1] DEBUG Keyboard2XinputLib.Keyboard2Xinput- initialize dicts done.


« Last Edit: January 25, 2021, 04:21:33 pm by xul »

Foxhole

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:March 04, 2024, 04:36:28 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #128 on: January 25, 2021, 04:31:02 pm »
a friend of mine had a similar issue, we fixed it by running k2x as admin.
Worth a shot.

xul

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:March 18, 2024, 12:13:49 pm
  • Toasty!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #129 on: January 26, 2021, 11:26:10 am »
a friend of mine had a similar issue, we fixed it by running k2x as admin.
Worth a shot.

Dude!  I think this fixed my problem with those games... strange that this only affected certain games.  I'm going to do some testing later tonight.  Really appreciate your input and suggestions.  :applaud:  :cheers:

dino82

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:May 02, 2021, 11:50:52 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #130 on: May 02, 2021, 11:32:24 pm »
Firstly I'd like to thank you for the software, if I had a more conventional setup I would be all set to go, that being said.....

I have two IPAC Ultimates, Players 1 and 3 on one, and Players 2 and 4 on the other

[3 1 2 4]

Players 1 and 2 use an U360 (USB) joystick, while Players 3 and 4 use a traditional 8-way.  The U360's are directly connected to the PC using USB, the 8-ways are connected to the IPACS and mapped to keyboard keys.

Mapping all of the keys works fine, absolutely no issues there.  The issue is that the joysticks for Players 1 and 2 don't work at all, being that they are not connected to the IPAC nor are they keyboards, I expected some fuss from them.  What would be the best suggestion to get an analog stick + IPAC mapped keys to work here?

If I use something like X360CE, it will create a new virtual controller out of the P1 U360/IPAC, and P2 U360/IPAC, but I assume that will either conflict or completely remove the ability for P3 and P4 to create virtual controllers as well, since they are also on the P1/P2 IPAC?

« Last Edit: May 02, 2021, 11:34:49 pm by dino82 »

kagaden

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 243
  • Last login:September 10, 2022, 10:58:37 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #131 on: June 23, 2021, 04:44:45 am »
Hi all,
The input delay problem with Injustice 2 and Mortal Kombat 11 for users that have a six-button configuration has been nagging me, so I made a very raw implementation of Keyboard2Xinput in C++, to see if it perform better. First results were encouraging, as it reported 0ms between 2 keyboard presses more often than not. It would not be perfect as I also had 7-15 ms between presses sometimes (I'd say 2 out of 10 times), but it was worth a shot.
So I mapped a joypad, fired up Mortal Kombat 11 (which I bought thanks to a donation :)), and... Nothing. I'd say 1 throw out of 20 presses. ---fudgesicle---.

Then I got an idea: for these games, instead of sending the button press as soon as I get the keyboard event, I store the joypad state, and wait 10 ms before sending the joypad state. This way if I get another keyboard event within 10 ms, the next joypad state will have both buttons pressed simultaneously. It's far from ideal, as this introduces input lag, but it might be bast than nothing. This time it worked ! To get it to work reliably I had to make it 15 ms (so a full frame at 60fps), but every single throw works.

I think I will introduce this feature in the C# Keyboard2Xinput, but before I do that, I'd like to have some feedback from those who are affected by this, So I packed multiple versions of the C++ experimental build, with different delays. If some of you would be so kind to test & report which delay works for them (if any), that would be useful for default values in the sample configuration.
Please keep in mind that this is a very raw implementation, so the mapping is hard-coded, there's a big window that serves no purpose and none of the features of Keyboard2Xinput are present besides one joypad being created.
It's available here: http://kb2xi.schwingsk.net/Keyboard2XinputCpp.zip.

The mapping is the following:
Up = UP
Down = DOWN
Left = LEFT
Right = RIGHT
LControlKey = A
LMenu = B
LShiftKey = X
W = Y
D5 = START
D1 = BACK

So if you want to test a throw, you have to push shift & left Control simultaneously.

Can't believe no one's tested this yet. Yes! This program is seriously rough, my keyboard stopped working at all even after it was closed while testing. MK11 after closing it once had 4 corrupted files and wouldn't reboot without reverifying the game.

As for throws! I tested out 7ms and 10ms tonight:

Rig - Windows 10 Home 64bit (fresh install/upgraded hardware)
i5-11400
32gb DDR4
1080GTX

Normal version - 5% of throws accomplished. Repeated many sets of 10 throws each.
7ms results - 70% of throws accomplished. Repeated many sets of 10 throws each.
10ms results - 75% of throws accomplished. Repeated many sets of 10 throws each.
15ms results - 95% of throws accomplished. Repeated many sets of 10 throws each.
25ms results - 100% of throws accomplished. Repeated many sets of 10 throws each.

Conclusions - THIS HELPS A TON, and I'd love to see this in a special build to use for Netherrealm fighters. It does add some input latency that will likely be a little noticeable at higher skill levels. I'd stick with 15ms as that seemed like a really good balance between latency and success rate. Plus with a little training it felt like I could get this timed 100%.


Other thoughts - Unfortunately after I closed MK11 while testing it corrupted on me, likely due to me end-tasking it suddenly. I was not nice on my computer while running this. Reverifying the files through steam and it's working again.

I may -FINALLY- try my build on Windows 7 as well before I upgrade it to windows 10 just for record keeping, but I don't think i'll use this experimental app on it just in case :P I'll post a Win 7 update for the stable build when I get around to upgrading my 2nd arcade pc soon.

Thanks again, please dm me your paypal Schwing!
-K
« Last Edit: June 24, 2021, 01:44:05 am by kagaden »

Pierre_Blignaut

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 1
  • Last login:March 13, 2023, 05:07:10 am
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #132 on: June 23, 2021, 06:11:14 am »
Good work.

Sent from my SM-N970F using Tapatalk


Schwing

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:January 30, 2024, 01:40:08 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #133 on: June 25, 2021, 02:28:29 pm »
Hi Kagaden, and thanks a lot for trying these builds (never had those problems with MK11 corruption, really sorry about that :() !
This is really good news, so I'll be adding the option in the next release. There's a non-zero probability that it will land next week, but don't keep your hopes up ;) If it doesn't, I'm afraid you'll have to wait until the end of July, as I'll be taking  some holidays without access to my computer (unless COVID ---smurfs--- everything up again...).

Again, thanks a lot for testing these wonky builds!

xul

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:March 18, 2024, 12:13:49 pm
  • Toasty!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #134 on: June 26, 2021, 11:13:15 am »
Looking forward to the next build and take the time needed.  Appreciate your hard work.  :cheers:

kagaden

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 243
  • Last login:September 10, 2022, 10:58:37 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #135 on: June 26, 2021, 06:47:46 pm »
Hi Kagaden, and thanks a lot for trying these builds (never had those problems with MK11 corruption, really sorry about that :() !
This is really good news, so I'll be adding the option in the next release. There's a non-zero probability that it will land next week, but don't keep your hopes up ;) If it doesn't, I'm afraid you'll have to wait until the end of July, as I'll be taking  some holidays without access to my computer (unless COVID ---smurfs--- everything up again...).

Again, thanks a lot for testing these wonky builds!

It's totally okay. It was my fault for alt-f4'ing out of MK11 during testing while flipping between timings to test. I understand that it's a prototype and very happy to test it out for ya!

I'll post my results on my win 7 machine today, as I was just about to start work on it but remembered you and this thread to see if you had responded.

I got your DM, check your email tonight.  :applaud: Thank you so much again for making this program! I understand it's ontop of other's work too so I'll take that into consideration and give them some love as well in the near future.

I'm very excited to try out the next full release! You're making this better and better! Take your time and lmk if you need any testing along the way.
If I could request, would you be able to work in the error handling pop-up if multiple versions are spun up or is that already in the latest?

Enjoy your well deserved upcoming vacation!

Cheers!
-K


kagaden

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 243
  • Last login:September 10, 2022, 10:58:37 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #136 on: June 26, 2021, 08:15:56 pm »
Well crap, I lost my post due to auto-logout while I was testing.  :badmood:

In short here are the results for Windows 7. I may rewrite my analysis later but I'm sure others will draw similar questions and interest here.

System specs:
Windows 7 home premium 64
CPU - i3 6100 @ 3.7Ghz (4 CPUs)
RAM - 16GB DDR4
GPU - 1080 GTX FE
K2X Version - 1.1.2.0

MKXL Results
10/10 - 100% of throws work

MK11 Results
5/10 - 50% of throws work

Injustice Results
10/10 - 100% of throws work

Injustice 2 Results
0/10 - 1% of throws work


Injustice 2 seems to be when the input issues start and bleed into MK11. Prior NRS games seem to work fine on Win7 with K2X.

kagaden

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 243
  • Last login:September 10, 2022, 10:58:37 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #137 on: June 26, 2021, 08:22:56 pm »
I also remembered that I owed someone my startup/shutdown scripts for K2X.

Setup: Using RocketlauncherUI for game launcher startup/shutdown functionality.

Normal startup - Bat file
Code: [Select]
start /min X:\Path\Keyboard2xinputGui.exe
exit
Delayed startup - Bat file (fixes some p2 connection issues on some games due to race condition)
Code: [Select]
start /min X:\Path\Keyboard2xinputGui.exe
ping 127.0.0.1 -n 4 > nul
exit

Maybe not the most elegant but it works, if anyone sees improvements to make with these I'm open! For example I was thinking of testing out if /b argument would keep multiple instances from being opened on accident.

My exit script is an autohotkey that I made some years ago and I've totally spaced on my approach with it... it works though and I'm not messing with it for now. It's an Autohotkey .exe so I won't share it here.
I imagine one could build another .bat file with the "taskkill" command to quit out similarly to the above to start.

Hope that's helpful to someone out there.

 :cheers:
-K
« Last Edit: June 26, 2021, 08:24:32 pm by kagaden »

Schwing

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:January 30, 2024, 01:40:08 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #138 on: June 28, 2021, 04:51:13 pm »
Hi K, and thanks for all the tests and useful info !
As for the popup when multiple instances are started: I can't reproduce it on version 1.2.1 with Windows 10. Looking at the code, it should exit silently, but it may depend on the OS: what does the popup look like?

Normal behaviour is: when k2xi is already running, the new process (you can see it in the Task Manager) starts, wait 5 seconds, then exits if the first instance hasn't exited.

For the exit script, you can just press the configured key to make k2xi exit; in AHK :

Code: [Select]
; stop keyboard2Xinput by sending numpad multiply key (see k2x mapping.ini)
SendInput {NumpadMult}

kagaden

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 243
  • Last login:September 10, 2022, 10:58:37 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #139 on: June 29, 2021, 12:53:44 pm »
Hi K, and thanks for all the tests and useful info !
As for the popup when multiple instances are started: I can't reproduce it on version 1.2.1 with Windows 10. Looking at the code, it should exit silently, but it may depend on the OS: what does the popup look like?

Normal behaviour is: when k2xi is already running, the new process (you can see it in the Task Manager) starts, wait 5 seconds, then exits if the first instance hasn't exited.

For the exit script, you can just press the configured key to make k2xi exit; in AHK :

Code: [Select]
; stop keyboard2Xinput by sending numpad multiply key (see k2x mapping.ini)
SendInput {NumpadMult}

That's great, thank you Schwing! I tried to reproduce it and I couldn't reproduce the popup text box either now that I'm upgraded to Windows 10. I'm hoping you have a memorable and safe vacation. Thank you for the response :D

 :applaud:
-K

Schwing

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:January 30, 2024, 01:40:08 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #140 on: October 15, 2021, 08:15:41 am »
Hi all, I finally took the time to implement input buffering for Mortal Kombat XI & similar games; it took longer than expected because my first naive approach had some drawbacks that could lead to lost inputs...
Now everything works as expected on the PCs I tested.
A new parameter has been introduced in the config: pollInterval. If 0, the behavior is the same as before (well almost, as I have improved the flow, resulting in less input lag). if >0, it represents the number of milliseconds a first input is buffered before being fed to the virtual joystick. You'll have to experiment as this is highly dependent on the PC: my newer one only needs 2, and on my previous PC (a 7700K), 10 works fine. Since the optimizations I haven't needed to use a setting > 16 (for reference, I needed 20 on the same PC), which means that all is done in less than a frame at 60fps. I can't guarantee that it will be the case for every configuration, though ;)
If you have a six-button config and couldn't perform throws with Mortal Kombat XI, Injustice 2 or others, please test this version, I'm very curious to know if that solves the problem for everyone.
As always, any other feedback is welcome too!
Download

kagaden

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 243
  • Last login:September 10, 2022, 10:58:37 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #141 on: October 18, 2021, 05:07:35 pm »
Hi all, I finally took the time to implement input buffering for Mortal Kombat XI & similar games; it took longer than expected because my first naive approach had some drawbacks that could lead to lost inputs...
Now everything works as expected on the PCs I tested.
A new parameter has been introduced in the config: pollInterval. If 0, the behavior is the same as before (well almost, as I have improved the flow, resulting in less input lag). if >0, it represents the number of milliseconds a first input is buffered before being fed to the virtual joystick. You'll have to experiment as this is highly dependent on the PC: my newer one only needs 2, and on my previous PC (a 7700K), 10 works fine. Since the optimizations I haven't needed to use a setting > 16 (for reference, I needed 20 on the same PC), which means that all is done in less than a frame at 60fps. I can't guarantee that it will be the case for every configuration, though ;)
If you have a six-button config and couldn't perform throws with Mortal Kombat XI, Injustice 2 or others, please test this version, I'm very curious to know if that solves the problem for everyone.
As always, any other feedback is welcome too!
Download

Nice work Schwing! Just wrapped up testing this out and here are my results on my PC

Windows 10 home - Build 19043
LG Oled 4k@60Hz
Mobo - Z590 Aorus Elite (F3d bios)
CPU - i5-11400
Ram - 32GB
DX12

Method - Tested various pollInterval settings with Injustice 2, then verified 17ms with MK11 to make sure it was 100% too

Results:
- 0-5 resulted in a very low success rate, maybe 5%
- 6-10 resulted in a slightly higher success rate, maybe 15%
- 10-16 resulted in a slightly higher success rate, maybe 25%
- 17ms resulted in a 100% success rate

Conclusion - My guess is going over the 16.7ms threshold for 1 frame of buffer @60hz completely fixed the issue. I'm going to set up 2 versions of Keyboard2Xinput, one with pollInterval set to 0 and one with pollInterval set to 17. The 17 setting I'll only use for the games that need it (MK11 and Injustice2 primarily) that have poor combo input detection themselves, that way I don't introduce 1 frame of lag across all 150 (or so) PC games I have running fine on the machine.

Tested the following NetherRealm games with 0 polling and could throw 100% of the time:
Injustice 1
MK Complete
MK XL

I'd only use this for MK11 and Injustice 2 so far, and it makes those games playable with minimal input latency!

Thanks again for this valuable update Schwing!
« Last Edit: October 18, 2021, 05:22:34 pm by kagaden »

xul

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:March 18, 2024, 12:13:49 pm
  • Toasty!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #142 on: October 23, 2021, 12:16:22 am »
Did some quick testing on my system with MK11:

5 - ~25 - 35%
10 - ~ 35 - 50%
12 - ~seemed to be 25% ???
17 - ~ 90 - 100%

Processor   Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz   4.00 GHz
Installed RAM   16.0 GB (15.9 GB usable)
System type   64-bit operating system, x64-based processor
Edition   Windows 10 Pro
Version   21H1
OS build   19043.1288
Experience   Windows Feature Experience Pack 120.2212.3920.0
Nvidia RTX 2070 Super
« Last Edit: October 23, 2021, 12:19:55 am by xul »

Schwing

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:January 30, 2024, 01:40:08 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #143 on: October 26, 2021, 03:43:13 am »
Thanks Kagaden & Xul for the feedback, I had hoped that settings lower than 17 would also work on most systems, but it really seems to be quite picky about the processor (although I had some variations on my bartop, so other factors seem to influence results), but glad to know that it works nonetheless.
For reference,
My system is:
Windows 10 Pro
Processor   AMD Ryzen 7 5800X 8-Core Processor                3.80 GHz
Installed RAM   32.0 GB
Edition   Windows 10 Pro
Version   21H1
OS build   19043.1288
Experience   Windows Feature Experience Pack 120.2212.3920.0
Nvidia 1070Ti

2ms works fine on this system.

My kids' system:
Processor   Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz   4.20 GHz
Installed RAM   16,0 Go
Édition   Windows 10 Professionnel
Version   20H2
OS build   19042.1288
Expérience   Windows Feature Experience Pack 120.2212.3920.0
Nvidia Quadro K620

10 ms works fine on this one.

kagaden

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 243
  • Last login:September 10, 2022, 10:58:37 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #144 on: December 30, 2021, 05:03:14 pm »
Thanks Kagaden & Xul for the feedback, I had hoped that settings lower than 17 would also work on most systems, but it really seems to be quite picky about the processor (although I had some variations on my bartop, so other factors seem to influence results), but glad to know that it works nonetheless.
For reference,
My system is:
Windows 10 Pro
Processor   AMD Ryzen 7 5800X 8-Core Processor                3.80 GHz
Installed RAM   32.0 GB
Edition   Windows 10 Pro
Version   21H1
OS build   19043.1288
Experience   Windows Feature Experience Pack 120.2212.3920.0
Nvidia 1070Ti

2ms works fine on this system.

My kids' system:
Processor   Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz   4.20 GHz
Installed RAM   16,0 Go
Édition   Windows 10 Professionnel
Version   20H2
OS build   19042.1288
Expérience   Windows Feature Experience Pack 120.2212.3920.0
Nvidia Quadro K620

10 ms works fine on this one.

I hope you've been having a wonderful holiday season while the year comes to a close, Schwing! I have a feature request that I hope should be really easy to implement into your latest version, if you are still working on this.

Feature Request: The latest version of Keyboard2Xinput -> with the ability to KEEP the keyboard keystrokes. (In other words, no keystroke blocking from K2X.)
Update - should have read through the readme info on his source page! This exists in the latest build :D When I have my arcade PC's home I'll give my solution a shot.

Explaination: As you know I've been doing years of research on windows idle timer with virtualized inputs in order to automatically close applications if the machine goes idle. I have a workaround with EventGhost, but it's pretty janky and doesn't work with all applications, so I've continued searching.

Discovery: I've come across an application called HidHide here: https://github.com/ViGEm/HidHide This application allows a user to take any input device, and block/allow specific programs from seeing inputs from it.

Hypothesis: My hypothesis is that a version of Keyboard2Xinput that doesn't block keystrokes would allow me to block keyboard keys with HidHide for every application EXCEPT windows idle timer and/or associated idle timer programs (like Turs Idle Volume Timer, or RLauncher itself). Hypothetically, this would allow for the idle timer to work the same as it does with a hardware keyboard event while not interfering with gameplay that is running.

If it's not too much trouble, would it be possible?

Thanks for considering it Schwing, and hope you and your family have an amazing 2022~
-K
« Last Edit: February 06, 2022, 04:44:37 pm by kagaden »

Saffa

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:September 11, 2022, 11:53:43 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #145 on: January 06, 2022, 05:33:33 am »
Thanks Schwing.

This has been very useful.

 :applaud:

sirgubster9

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 23
  • Last login:July 19, 2023, 06:23:35 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #146 on: March 03, 2022, 06:43:16 pm »
Trying to have this program start up when I run a game and then close down when im down running that game on launchbox.  Running the game isnt too much of a problem but does anyone know how to exit the program without going down there and clicking it with a mouse?

Saffa

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:September 11, 2022, 11:53:43 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #147 on: March 06, 2022, 12:15:23 am »
Hi sirgubster9,

Setup Launchbox to point to custom AHK script instead of games exe.

This is example of one of my AHK:

Code: [Select]
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, Force
#Persistent

Run D:\Games\Keyboard2Xinput\Keyboard2XinputGui.exe
Sleep, 1000  ; sleep 1 second
Run D:\Games\Game shortcuts\DoubleDragon.exe.lnk
Sleep, 1000  ; sleep 1 second

proc1 = DoubleDragon.exe
Process, Wait, %proc1%
Process, WaitClose, %proc1%
SendInput {NumpadMult}
ExitApp

Once windows process DoubleDragon ends AHK sends * NumpadMult which closes Keyboard2Xinput

sirgubster9

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 23
  • Last login:July 19, 2023, 06:23:35 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #148 on: March 07, 2022, 12:13:52 am »
Hi sirgubster9,

Setup Launchbox to point to custom AHK script instead of games exe.

This is example of one of my AHK:

Code: [Select]
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, Force
#Persistent

Run D:\Games\Keyboard2Xinput\Keyboard2XinputGui.exe
Sleep, 1000  ; sleep 1 second
Run D:\Games\Game shortcuts\DoubleDragon.exe.lnk
Sleep, 1000  ; sleep 1 second

proc1 = DoubleDragon.exe
Process, Wait, %proc1%
Process, WaitClose, %proc1%
SendInput {NumpadMult}
ExitApp

Once windows process DoubleDragon ends AHK sends * NumpadMult which closes Keyboard2Xinput

Oh thank you so much for the response, Everything works great except after about 10 seconds the game closes and I get an error that says the game is not working.  If I play the game regularly through launchbox it works fine so Im guessing it has something to do with the AHK file.  I basically used your exact code just changed the directories to my own. Any ideas?
« Last Edit: March 07, 2022, 05:07:37 pm by sirgubster9 »

alg0280

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:June 27, 2022, 09:16:35 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #149 on: June 26, 2022, 08:12:55 am »
Schwing,

It looks like the server hosting the binary releases is down?  I'm getting

This site can’t be reached
kb2xi.schwingsk.net’s server IP address could not be found.

when I tried to download 1.2.2.

Thanks

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Online Online
  • Posts: 9394
  • Last login:Today at 02:12:01 pm
  • Designated spam hunter
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #150 on: June 26, 2022, 12:41:20 pm »
It looks like the server hosting the binary releases is down?  I'm getting

This site can’t be reached
kb2xi.schwingsk.net’s server IP address could not be found.

when I tried to download 1.2.2.
Try again.

Just confirmed that the server is working.   ;D


Scott

alg0280

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:June 27, 2022, 09:16:35 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #151 on: June 27, 2022, 09:00:06 pm »
Try again.

Just confirmed that the server is working.   ;D


Scott

Thanks, it's working now for me.

BigPuppy

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:August 23, 2022, 10:59:26 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #152 on: August 23, 2022, 12:34:12 am »
Hello, thank you for your work with this project. I bought a cabinet that had a lot of stuff installed including Attract Mode, but the joysticks were only set to keyboard and none of the Steam games I was trying to play worked quite right.

My main issue now is that I can't quite get the AHK script for Steam to work. I've taken the sample and filled in my directories:

Code: [Select]
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Run, "R:\Arcade\Keyboard2Xinput\Keyboard2XinputGui.exe"
Run, "C:\Program Files (x86)\Steam\steam.exe" -applaunch %1%

isRunning := "0"
While (isRunning = "0") ; Wait until the game is launched
    RegRead, isRunning, HKCU\Software\Valve\Steam\Apps\%1%, Running
Sleep, 5000

Sleep, 5000
MouseMove, 1920, 1200
WinGetTitle, Title

While (isRunning = "1") ; Wait until the game is closed
    RegRead, isRunning, HKCU\Software\Valve\Steam\Apps\%1%, Running
Sleep, 500

; Game stopped, stop keyboard2Xinput by sending numpad multiply key (see k2x mapping.ini)
SendInput {NumpadMult}

; change focus back to Attract-Mode
WinActivate Attract-Mode

Then, in AM, I have this as my emulator configuration:

Code: [Select]
# Generated by Attract-Mode v2.6.1
#
executable           R:\Arcade\Emulators\steamXinput.exe
args                 -applaunch [name]
workdir             
rompath              C:\Program Files (x86)\Steam\steamapps
romext               .acf
system               PC
info_source          steam
nb_mode_wait         10
artwork    flyer           R:\Arcade\attract\scraper\Steam\boxart
artwork    snap            R:\Arcade\attract\scraper\Steam\video;R:\Arcade\attract\scraper\Steam\snap

The behavior I'm seeing is that the parameter of the game doesn't seem to be passing to the AHF script I compiled or to the AHF script itself. The script will run and open K2X and Steam, but it doesn't try to open a game and just fails back to AM. Are there any variables that I'm missing?

BigPuppy

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:August 23, 2022, 10:59:26 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #153 on: August 23, 2022, 10:59:27 pm »
Hello again. I ended up solving my problem a bit more indirectly without the use of an AHK script, but in case this helps anyone in the future:

  • I set Keyboard2Xinput to start at Startup, but I left the startup parameter as disabled so that AM would continue to function.
    I also reverted my AM Steam config file to the default.
    I mapped the ToggleEnable in Keyboard2Xinput to the furthest, least used button on my cabinet (Player 3 Start in my case).
    Whenever Steam launches a game, it seems to auto turn on K2X, but in case it doesn't, I simply toggle the P3 Start button when it is switching to Steam/Retroarch and then toggle back if needed when it focuses back to AM.


Schwing

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:January 30, 2024, 01:40:08 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #154 on: September 09, 2022, 05:55:59 am »
Hi BigPuppy,
you have an error in the emilator configuration:
Code: [Select]
args                 -applaunch [name]should be
Code: [Select]
args                 [name]
That's what causing Steam to not launch your game.
I also see that you have 'Sleep, 5000' in the first while loop, don't forget to set it back to 500. It will still work but will generally wait too long before going on to the next section of code.

Maxforwardspeed

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:April 06, 2023, 08:27:02 am
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #155 on: April 01, 2023, 09:24:02 pm »
First, thanks to the developer of this awesome app! This is just what I've been looking for with my ipac-4 cab. It's been working great with my PC games except for the new TMNT steam game. The game is not recognizing any controllers from k2xi. But, my normal Xbox one controllers are detected right away.  Has anyone been successful with getting k2xi working with TMNT?

Edit: Got it working by running k2xi as administrator
« Last Edit: April 04, 2023, 11:53:20 am by Maxforwardspeed »

Fursphere

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1206
  • Last login:Today at 12:56:07 pm
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #156 on: April 14, 2023, 01:55:48 pm »
Yes.  I use it on my cabinets to play a whole host of Steam games, including the new TMNT titles. 

Use your i-pac shift keys to setup a toggle to enable / disable the xinput app.  Sometimes you need the keyboard to actually work as a keyboard.  :)

Student123

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16
  • Last login:Today at 12:20:52 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #157 on: May 01, 2023, 05:56:04 pm »
Hey guys,

Running into an issue for a very long time I am trying to fix once and for all.

I use Keyboard2Xinput. I was trying to run it in a custom AHK script, one for every game that I am trying to convert Keyboard input into Xbox Controller input.

I use this :

Code: [Select]
; Code in this file will only be run for the game whose name matches the filename of this file and whose system name matches the folder name this file is located in
; Do not change the line with the class declaration! The class name must always be GameUserFunction and extend GameFunction
; This is just a sample file, you only need to implement the methods you will use the others can be deleted

class GameUserFunction extends GameFunction {

; Use this function to define any code you want to run on initialization
InitUserFeatures() {
RLLog.Info(A_ThisFunc . " - Starting")
run, D:\Arcade\Tools\Keyboard2Xinput\Keyboard2XinputGui.exe
Sleep, 1000
RLLog.Info(A_ThisFunc . " - Ending")

}


; Use this function to define any code you may need to stop or clean up in every module on exit
StopUserFeatures() {
RLLog.Info(A_ThisFunc . " - Starting")
Process, Close, Keyboard2XinputGui.exe
ExitApp
RLLog.Info(A_ThisFunc . " - Ending")

}



}


Ended up with the same issue, loaded multiple games one after the other no issues, tested with the game with this AHK and nothing after loaded. The game without the ahk loads fine, so we definitely have our culprit, just not sure how to resolve the issue.

Anyone knows the best way to load Keyboard2Xinput in Rocketlauncher without causing issues? Does not seem custom scripts works with it, unless I am missing something.

Any help is appreciated!

Vitaly17

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:Today at 03:05:18 am
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #158 on: July 19, 2023, 06:09:29 pm »
Hey guys,

Running into an issue for a very long time I am trying to fix once and for all.

I use Keyboard2Xinput. I was trying to run it in a custom AHK script, one for every game that I am trying to convert Keyboard input into Xbox Controller input.

I use this :

Code: [Select]
; Code in this file will only be run for the game whose name matches the filename of this file and whose system name matches the folder name this file is located in
; Do not change the line with the class declaration! The class name must always be GameUserFunction and extend GameFunction
; This is just a sample file, you only need to implement the methods you will use the others can be deleted

class GameUserFunction extends GameFunction {

; Use this function to define any code you want to run on initialization
InitUserFeatures() {
RLLog.Info(A_ThisFunc . " - Starting")
run, D:\Arcade\Tools\Keyboard2Xinput\Keyboard2XinputGui.exe
Sleep, 1000
RLLog.Info(A_ThisFunc . " - Ending")

}


; Use this function to define any code you may need to stop or clean up in every module on exit
StopUserFeatures() {
RLLog.Info(A_ThisFunc . " - Starting")
Process, Close, Keyboard2XinputGui.exe
ExitApp
RLLog.Info(A_ThisFunc . " - Ending")

}



}


Ended up with the same issue, loaded multiple games one after the other no issues, tested with the game with this AHK and nothing after loaded. The game without the ahk loads fine, so we definitely have our culprit, just not sure how to resolve the issue.

Anyone knows the best way to load Keyboard2Xinput in Rocketlauncher without causing issues? Does not seem custom scripts works with it, unless I am missing something.

Any help is appreciated!
Everything works for me, I configured the program through the PC Launcher prelaunch script module. I also brought scripts to my streamdeck, everything works too.
I checked the work through UserFunctions , no problems, everything works.Here is the script.

; This function gets ran right before the primaryExe
    PreLaunch() {
        RLLog.Info(A_ThisFunc . " - Starting")
        run C:\keyxbox\Keyboard2Xinput-1.2.2\Keyboard2XinputGui.exe
        RLLog.Info(A_ThisFunc . " - Ending")
    }
; This function gets ran after the module thread ends and before RL exits
    PostExit() {
        RLLog.Info(A_ThisFunc . " - Starting")
        Run,taskkill /im "Keyboard2XinputGui.exe" /F
        RLLog.Info(A_ThisFunc . " - Ending")

Most often, such problems appear when something is running on behalf of the administrator. I'd be looking this way.



Yardley

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 137
  • Last login:September 20, 2023, 07:35:08 pm
  • I want to build my own arcade controls!
Re: Keyboard2Xinput (Virtual X360 pads from keyboard)
« Reply #159 on: August 02, 2023, 12:56:31 pm »
Hi all, long time keyboard2xinput user here. I have the need to do something I haven’t tried before which is to map two keyboard keys so that both output the same Xinput button. In other words, if I press keyboard key X it will output button A and if I press keyboard key Y it will also output button A. Does anyone know of this is possible?