DosBox, AutoHotkey, and Wing Commander

Kraguntor

Spaceman
Hi All,

I run Wing Commander I and II in Dosbox 0.74 under Window 7 Prof 64bit with no problems whatsoever. Now I try to use AutoHotkey for mapping various joystick-buttons and combining key sequences.

Joystick-buttons mapped as "y" and "n" type "y" and "n" on the DosBox prompt and they work as expected on the question "Exit to DOS (y/n)" - but in the cockpit no mapping has any effect at all (The joystick buttons mapped to tabulator, t, l, w, g, c, etc. do write on the DosBox prompt).

I tried the various forms of sending available in AutoHotkey to no avail. Neither the DosBox forum nor the AutoHotkey forum has anything relevant on Wing Commander, on this forum I did not find anything on AutoHotkey.

Has anybody got it working? What am I missing?

Kraguntor
 

centaurianmudpig

Rear Admiral
I tried to do the same and had the same limited success as you. You could try modifying the text file itself, though I can't point you in that direction as I didn't bother to try that route.
 

centaurianmudpig

Rear Admiral
It stores defined hot keys in a text file, which you can edit yourself IIRC. I just quickly checked, the key mappings are kept inside the WC folder in a file called mapper.map. The contents of the file looks complicated so you be better checking the DOSBOX forums on how to manually change the values as it looks complicated at a glance.
 

Kraguntor

Spaceman
It stores defined hot keys in a text file, which you can edit yourself IIRC. I just quickly checked, the key mappings are kept inside the WC folder in a file called mapper.map. The contents of the file looks complicated so you be better checking the DOSBOX forums on how to manually change the values as it looks complicated at a glance.
Ahhh, ok! You meant the DosBox key mapper file! I new that one, and mappings done there do work inside the cockpit (having at least Enter mapped to Joystick button 2 :)). Fortunately you don't have to edit the mapper file, but you can use <Ctrl>+<F1> inside DosBox to make the mappings...

...unfortunately that doesn't help me much: joystick-wise these mappings are limited to the first 2 buttons of each of the 2 joysticks DosBox supports - and I have 5 (3 of them so called usb game controller boards , see here, which drive my homemade control panels). I had to apply the Joystick selector patch (and compile my own DosBox Version) to make DosBox use my G940 joystick (#4) as first joystick.

Well, seems as if I had to go on using the good old school way playing wc ;)
 

centaurianmudpig

Rear Admiral
It seems you are quite technical, I won't embarrass myself any further with my limited knowledge on DOSBOX. I'm contempt with having analogue joystick support, that's old skool enough for me :)
 

Kraguntor

Spaceman
I won't embarrass myself any further
C'mon, not at all - on the contrary: Firstly you confirmed that it's not my stupidity, but that others have the same problem and you gave me an idea: If the DosBox-internal mappings do work inside the cockpit, then why don't the external mappings? I should now check the source code of the DosBox....
 

sp00n

Rear Admiral
I just recently installed WC1 again, and stumbled across the same problem.
I was able to somewhat solve this, at least it's working right now for me. It might not for you, as it seems a rather hacky solution.


Code:
SetTitleMatchMode 2
#IfWinActive DOSBox
{
   ; Set the delay for key presses
   SetKeyDelay, 0, 10
   
   
   ; Set the input mode to event
   ; SendMode Input|Play|Event|InputThenPlay
   SendMode Event
   
   
   ; Extra mouse button 1
   ; Lock
   XButton1::
     Send {l 3}
   return
   
   
   ; Mouse wheel up
   ; Speed up
   WheelUp::
     Send {NumpadAdd 3}
   return
   
   
   ; Mouse wheel down
   ; Slow down
   WheelDown::
     Send {NumpadSub 3}
   return
   
   
   ; Press mouse wheel
   ; Missile
   MButton::
     Send {Enter 3}
   return
}

I need to use SendMode Event, and additionally need to repeat every keystroke 3 times for whatever reason. Speeding up / slowing would actually work without this, but the 3 makes it change the speed by 30 klicks instead of only 10, so that's just a convience.
Lock and fire missile however don't work reliable if I "press" the key only once. With 3 it seems to work fine so far.
 
Top