Jump to content
LaunchBox Community Forums

AHK Library Crashes LaunchBox


DivinityCycle

Recommended Posts

I've been working on trying to make the center "Guide" button on my Xbox 360 controller usable in emulators outside of RetroArch. I found a brilliant AHK library for working with Xbox 360 controllers over on GitHub, which does allow the user to read the Guide button inputs. However, putting this code into LaunchBox as an AHK script or even using an #Include statement causes LaunchBox to crash when attempting to launch a game. The library does work with the latest AutoHotKey mainline branch, so I'm guessing the issue is something to do with the way the library works. I'm guessing this is probably a question for Jason: What version(s) or AHK is LaunchBox natively compatible with?

I may mess around with trying to strip down what I actually need out of that library, since the only thing I'm really trying to do is make a Guide button detector. Generally, all the other buttons are easy to access without any special sauce, and the Guide button would be super useful in Launchbox.

 

Link to comment
Share on other sites

Well, my test script is to just do an #Include scripts/XBOX360.ahk and then throw up a message box. If I run this using AutoHotKey is works fine. If I run the same script using LaunchBox, it crashes LaunchBox.  In my research I had found a different script that is able to grab the Guide input, and that does not actually crash LB. However, I had never figured out how to re-write that to do what I wanted. The problem is that the scripts involved here are pretty high level and my understanding of AHK is pretty low level. I'm presently working on teaching myself the syntax, although I won't be able to do any testing on this until I get home from work later on. Ideally, I'd love to just be able to use a full-featured library and keep the main script that the user puts into LB to be as minimal as possible, but we'll see.

All of this because Microsoft opted to make the Guide button their special baby, so it's "hidden" as far as the official Windows drivers are concerned. Incidentally, I've attached a version of Xinput1_4.dll which ignores the Guide button. Dropping this DLL into your Steam directory will cause Steam to auto-load it at launch. This is needed to prevent the Guide button from opening Big Picture Mode automatically, which is the other half of the coin.

XInput1_4.dll

Link to comment
Share on other sites

I just tried simple code below and it works! Very cool. I don't know if this does what you are looking for, but I thought it would be cool to open LB or BB via this guide button.

With this ahk script running all the time, I can easily assign the guide button to do something that I want. I always have one ahk stand alone script running anyway for other things too, like displaying a Loading splash when LB unzips a game. So now I can just add this too:


vk07sc000::

	Run, R:\LaunchBox\LaunchBox.exe

return

 

Link to comment
Share on other sites

I tried adding this ahk to MAME in LB as a test just now to send the 1 key press which is my MAME start key. It doesn't work, but when I do this in stand alone ahk script, what happens when i press the 360 guide button while in notepad, it does send the "1" character but also win 10 pops up some question about it asking if i want to open the game bar. haha

Link to comment
Share on other sites

ok, i disabled the game bar thing (had to do it with a registry setting since there was no app setting without logging in). that took care of that.

but the press to send "1" still doesn't work at least in MAME. However, I also tried changing the guide button to just send a MsgBox when pressed and when I pressed the button inside MAME it did popup the message box. maybe MAME knows the "1" is not from the regular keyboard but would work if i set it in MAME input settings using the guide button.

so perhaps this will help you get what you wanted from the guide button. the cool thing is that this exercise got me what i wanted :)

 

 

Link to comment
Share on other sites

I'll do some experimentation ASAP.

Because I'm stuck at work I did have time to begin getting familiar with the AHK syntax more. The script I found which uses DirectInput to read the controller state uses seemingly every weird part of AHK's language, but there's really good documentation for pretty much everything, so I think I actually now understand what the code does and how to slim it down to just the essential parts. It's got a lot of extra stuff in it because it can be used to read the state of both sticks, the D-Pad, and all the buttons, and it was written for general use (sort of like the big library I was originally trying to use). I'm about to the point where I'll be able to do some testing and then hopefully find a working solution I can post here.

@ckp, what OS are you running? I'd like to control for possible variations, as I know Microsoft has made some changes under the hood in Windows 10, particularly with regard to their own proprietary stuff like the Xbox App. I'm presently using the Enterprise 64-bit version of Windows 10, which does not have the Xbox app installed, although I've seen that same issue on some other machines (like my gf's laptop which has the Home edition of Windows 10).

Link to comment
Share on other sites

So, I was able to rewrite the other script I had found to pull input from the 360 controller, and so now I can use AHK to do things with the 360 Guide button.

However, I can't seem to get MAME to accept input from other programs at all.

I tested AHK, antimicro, JoyToKey and button_on_guide2.exe. JoyToKey doesn't recognize the Guide button, and the others do but don't successfully send inputs to MAME.

I tried running a patched version of MAME that has DirectInput, as well as launching MAME with various -keyboardprovider switches, no success.

I saw some forum posts here where Jason has mentioned this is a MAME issue he plans on eventually looking into so I'm gonna hold off for now on this one...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...