dooom Posted February 18, 2011 Posted February 18, 2011 They are claiming the following two input devices are recognized as standard USB gamind devices and not dedicated FSX or X Plane controllers. Anyone using with DCS or LockOn? http://www.vrinsight.com/public_html/index.php?module=Board&action=SiteBoard_1&iBrdNo=28&sMode=SELECT_FORM http://www.vrinsight.com/public_html/index.php?module=Board&action=SiteBoard_1&iBrdNo=26&sMode=SELECT_FORM ASUS Tuf Gaming Pro x570 / AMD Ryzen 7 5800X @ 3.8 / XFX Radeon 6900 XT / 64 GB DDR4 3200 "This was not in the Manual I did not read", cried the Noob" - BMBM, WWIIOL
nomdeplume Posted September 19, 2011 Posted September 19, 2011 (edited) Very late to the party... but the answer is yes with a caveat. They are just standard USB controllers, however the switches are presented as a single DirectX button. That means when you move the switch up the button is 'pressed', and when you move it down it's 'released'. That's fine and good, but since you can't assign an action to "button released" in DCS, it means you can't make a single switch e.g. raise the gear when it's up, and lower it when it's down. But, some of the controls in A-10C do work like that, i.e. anything that's on the TM Warthog throttle, such as the APU start switch. However... the particular command that's assigned to the TM Warthog throttle's APU Start/OFF switch can't be assigned to other controllers. Seems like it's a special command just for that controller. So - does anyone know if there's a way to configure DCS to recognise these kind of switches for arbitrary commands? Or - does anyone know of any software that can be used to translate DirectX device inputs into keystrokes? The same kind of functionality that TARGET or SST or CH Control Manager has - but not locked devices from the respective vendor? The buttons and axis controls work just fine, although I haven't found any other functions in A-10C to assign the axis commands to. The encoder rotaries in the middle of the MS panel function as two buttons, i.e. each turn clockwise registers one instantaneous button press, and each turn anti-clockwise registers one instantaneous press of a different button. The "T3" and "T4" buttons on the MS panel are three-state (up, middle, down) - T3 returns to the middle position automatically while T4 will hold in whatever position you move it to. These both are presented as two separate DX buttons, one for "Up" and one for "Down", with the middle position being both buttons off. So, they work like the LASTE mode switch on the TM Warthog throttle. So again the issue is with getting the game to recognise the buttons being released as an event worth reacting to. Edited September 19, 2011 by nomdeplume
hassata Posted September 19, 2011 Posted September 19, 2011 http://forums.eagle.ru/showthread.php?t=63003 1 [sIGPIC][/sIGPIC]
nomdeplume Posted September 19, 2011 Posted September 19, 2011 (edited) VRinsight panel and AutoHotKey configuration Thanks hassata, AutoHotKey seems to detect them (as joysticks #10 and #11) so I think the future is looking bright. Thanks again! Edit - so after a lot of messing around this is what I've come up with, and it seems to work pretty reliably. The first issue I had was in getting DCS to actually recogonise/respond to the keypresses. I tried a few methods that AHK offers, and found the most reliable was to use SendInput with "key down" commands, pause for a short time, and then send "key up" commands. This seems to be completely reliable, at least for me with Warthog 1.1.0.9. The other issue I encountered was with getting the switches into a state which matches the in-game switches. This isn't a problem for those that have individual mappings (e.g. master arm on, safe, and training can be assigned individual keystrokes), but it's a problem for many of the switches which are only accessible as toggles (e.g. TGP). That means you have to send the same keystroke for "tgp on" as for "tgp off", so it's easy to have your physical switch doing the opposite of the in-game switch. Additionally, it seems AHK will detect a "button down" event for any switch that is currently up as soon as you press any button/flick any switch on the panel. You can also use it to determine the button number of each switch. For example, if you've got one of the switches in the "on" position when you start the AHK script, nothing will happen at first. But when you flip a switch or press a button on that panel, the event for what you just did will be triggered in parallel to the event for the switch that was already in the on position. My solution to that is to assign one of the switches on the panel to toggle whether the script is actively sending keystrokes or not. When it's off, it will still notice button state changes and set up the listeners for when the switch is turned off, but won't actually send the keypresses. That way you just start it up with that off, mash a button on each panel, and then turn it on. I won't post my whole script but here's the gist. Firstly I start with this: #SingleInstance #NoEnv #MaxThreads 1 SendMode Input holdDownTime := 50 pollInterval := 100 sendKeystrokes := 0I'm not sure if the maxthreads thing really helps, but it doesn't hurt. Basically I'm just trying to prevent multiple commands trying to run simultaneously. The holdDownTime is the time (in milliseconds) to hold down the key combination for. This seems to work okay for me, but it's easy to adjust having it as a variable. The pollInterval is the time between checks for when the button is switched off. Finally, sendKeystrokes is the flag which controls whether we're actually sending the keystrokes or not, so it's set to 0 (false) to start with. Each button needs two handlers, one for it being pressed, and one for it being released. The "pressed" handler is a hotkey using the xJoyN syntax. You can find out the joystick number through trial and error by using the test script which is accessible through the AHK helpfile (it's linked in the Joystick section on the 'List of Keys, Mouse Buttons, and Joystick Controls' page). Just change the "JoystickNumber" variable at the start, starting with 1, try a button on your panel, and see if it registers. If not, go to the next number. My panels ended up joystick numbers 10 and 11. This is the script I use to control the sendKeystrokes flag, which is controlled using the bottom-left switch on my Multi Switch panel. ; toggle sendKeystrokes flag 11Joy13:: if sendKeystrokes = 0 { sendKeystrokes := 1 SoundBeep 400, 100 SoundBeep 800, 250 } SetTimer WaitForSendKeystrokesOff, %pollInterval% return WaitForSendKeystrokesOff: if GetKeyState("11Joy13") return SetTimer WaitForSendKeystrokesOff, %pollInterval% if sendKeystrokes { sendKeystrokes := 0 SoundBeep 800, 100 SoundBeep 400, 250 } returnNote that it plays a two-tone indicator when switched on and off; be warned that it's quite loud. You might want to turn your sound down before the first time you try it... The "11Joy13::" bit sets up a hotkey for button 13 on the 11th joystick. This checks the sendKeystrokes flag, and it's not set, enabled it and plays a tone to indicate it's done so. It then sets a timer to call the routine WaitForSendKeystrokesOff at the poll interval defined earlier (100ms is what I use). This just means that every 100ms, that part of the script is run. To detect if it's off, we use the AHK function GetKeyState with the button name. If it returns true then the button/switch is still down/on. So, as long as the switch is in the "up" position (which means the DirectX button is being held down), every 100ms AHK will check that state and then do nothing. Eventually when you turn the switch off, the routine wakes up, checks the status of the button, discovers it's no longer down, and then runs the rest of the code. The first thing it does is disable the timer which calls itself (so it stops polling for the button to be released), and then it toggles the sendKeystrokes flag if necessary, and again plays a tone to indicate it's taken action. So what about actual game actions? These are handled by detecting the switch and then sending the appropriate keystrokes, so as long as the sendKeystrokes flag is set. We then start another timer to monitor for the switch to be turned off, and then send the appropriate keystrokes for that action. So here's an example for the landing gear, which can be assigned separate keystrokes for "raise gear" and "lower gear" in the sim (which means this particular switch can never be desynched): ; landing gear 10Joy26:: if sendKeystrokes { Send {LCtrl down}{g down} Sleep holdDownTime Send {g up}{LCtrl up} } SetTimer WaitForGearDown, %pollInterval% return WaitForGearDown: if GetKeyState("10Joy26") return SetTimer ,, off if sendKeystrokes { Send {LShift down}{g down} Sleep holdDownTime Send {g up}{LShift up} } returnIt's very similar to the script for the sendKeystrokes toggle switch, but instead of just changing an AHK variable, we send some keystrokes. The script for things like the TGP switch which only have a single keybinding are the same as the above example, except they send the same keystrokes in both the up and down positions. That means it can get desynced, e.g. if you usually do a ramp start, your physical TGP switch may be down, but if you do an air start mission one day it'll start on. You can correct that just by turning off the sendKeystrokes flag with the appropriate switch, flipping your physical TGP switch on, and then turning the sendKeystrokes flag back on. My final example is the three-state switch (T4) on the MS panel. I use this for the gun, since I use all 3 modes quite regularly. Here it goes: ; gun arm switch up 11Joy17:: if sendKeystrokes { Send {LAlt down}{a down} Sleep holdDownTime Send {a up}{LAlt up} } SetTimer WaitForGunArmOff, %pollInterval% return ; gun arm switch down 11Joy18:: if sendKeystrokes { Send {LAlt down}{g down} Sleep holdDownTime Send {g up}{LAlt up} } SetTimer WaitForGunArmOff, %pollInterval% return WaitForGunArmOff: if GetKeyState("11Joy17") return if GetKeyState("11Joy18") return SetTimer ,, off if sendKeystrokes { Send {LAlt down}{s down} Sleep holdDownTime Send {s up}{LAlt up} } return This is pretty much identical to the two-state switch examples above. The only differences are a) there's two buttons which both set up the WaitForGunArmOff timer (the three-state switch controls two DirectX buttons, one of which is 'pressed' when the switch is in the up position, the other which is 'pressed' when the switch is in the down position; in the center position, neither button is being 'pressed'); and b) WaitForGunArmOff checks the status of both buttons that invoke it, and only takes action if both have been released. Hope this is clear enough and saves someone else a bit of time trying to implement this. It's a bit of effort but it works well once it's all running. Note that most of the game's controls don't have default keybindings, so you'll have to add them as you go. Edited September 26, 2011 by nomdeplume Added my configuration
hassata Posted September 27, 2011 Posted September 27, 2011 Thanks for the write-up man. [sIGPIC][/sIGPIC]
Recommended Posts