Steel Battalion controller and win 7 64-Bit drivers
#61
Posted 25 September 2012 - 06:38 PM
You did a great job with it on MW4:mercs, I have no doubt you can work magic in MWO.
#62
Posted 25 September 2012 - 06:39 PM
Ximmons, on 25 September 2012 - 05:57 PM, said:
Yes I do have it working now. After correcting my mistake I was able to watch the amazing christmas tree lighting I read about. Going into calibration of the controller from the control panel the right joystick, left joystick, gear lever, left/right peddle(not the center) and 8 buttons are recognized.
I am reading over your second post trying to wrap my mind around it but when it comes to programming I can not get out of the proverbial paper bag. The controller is responding in game with its limited functions before writing a new configuration file.
When you say 8 buttons, is that all that shows up in the control panel? If so, I may have forgotten a step. If you go to http://sourceforge.n...ps.zip/download
The author of vJoy created a program to allow you configure the virtual joysticks. Unzip the file and go to vJoyConf/vJoyConf64 and run vJoyConf.exe
This will allow you to configure the number of axes in the virtual joystick and the number of buttons. Go on and check all the axes yous see, set the number of POVs to 1, click on the continuous radio button above POVs select 32 under the drop down for number of Buttons, and leave the target device set to 1, click apply, and you should now have 32 buttons. And all the axes
Also, don't be scared by the programming. Thats what I'm here for. Just ask on how you want something done and I'll help. I'm leaving the simple config file as is for the moment, as I want people from the community to help with it. I'll certainly help with some more complex customizations, like the using the left pedal for jump and stop, like I did for MW4, but I feel people should be able to put together the custom button mapping for all the keys in the game. It'll save me the 30 min or so of copying down the keys and typing in the appropriate lines.
Jade Kitsune, on 25 September 2012 - 06:38 PM, said:
You did a great job with it on MW4:mercs, I have no doubt you can work magic in MWO.
Thanks for the compliment. The pre-release is available on the website. Give it a try. That way once I have any bugs cleaned up, you'll already have the required libusb and vJoy libraries installed. Plus its always fun to know you're one of the few to have this working in Windows 7 64 bit, and certainly one of the few to have tried it in MWO
Meanwhile, going to continue trying to figure out how to fix that pesky dll error
Edited by HackNFly, 25 September 2012 - 06:47 PM.
#63
Posted 25 September 2012 - 07:36 PM
I am sure I will be coming to you with plenty of questions as I try to put together a configuration very similar if not identical to the one earlier in this thread for MW4 or MWO with XP. The layout seems well done all though I would change the overheat override to the eject button for some added oh crap moments when the plastic cover refuses to open.
I will do further testing tomorrow when I get off work. Not sure if any of my input is helping but ill keep tossing it your way.
#64
Posted 25 September 2012 - 07:41 PM
To be more specific, the axes are set within the mainloop section of the code:
//this gets called once every refreshRate milliseconds by main program public void mainLoop() { joystick.setAxis(1,controller.AimingX,HID_USAGES.HID_USAGE_X); joystick.setAxis(1,controller.AimingY,HID_USAGES.HID_USAGE_Y); joystick.setAxis(1,(controller.RightPedal - controller.MiddlePedal),HID_USAGES.HID_USAGE_Z);//throttle joystick.setAxis(1,controller.RotationLever,HID_USAGES.HID_USAGE_RZ); joystick.setAxis(1,controller.SightChangeX,HID_USAGES.HID_USAGE_SL0); joystick.setAxis(1,controller.SightChangeY,HID_USAGES.HID_USAGE_RX); joystick.setAxis(1,controller.LeftPedal,HID_USAGES.HID_USAGE_RY); joystick.setAxis(1,controller.GearLever,HID_USAGES.HID_USAGE_SL1); joystick.setContPov(1,getDegrees(controller.SightChangeX,controller.SightChangeY),1); for(int i=1;i<=32;i++) { joystick.setButton((bool)controller.GetButtonState(i-1),(uint)1,(char)(i-1)); } joystick.sendUpdate(1); }
the important part of this code is the setAxis function
joystick.setAxis(1,controller.AimingX,HID_USAGES.HID_USAGE_X);
the first parameter specifies the virtual joystick we're assigning. I can't think of a situation where you would want to use more than one virtual joystick, so leave it as 1
the second parameter corresponds to one of the axes available on the SB controller:
the available axes are:
/// Corresponds to the "Rotation Lever" joystick on the left. RotationLever /// Corresponds to the "Sight Change" analog stick on the "Rotation Lever" joystick. X Axis value. SightChangeX /// Corresponds to the "Sight Change" analog stick on the "Rotation Lever" joystick. Y Axis value. SightChangeY /// Corresponds to the "Aiming Lever" joystick on the right. X Axis value. AimingX /// Corresponds to the "Aiming Lever" joystick on the right. Y Axis value. AimingY /// Corresponds to the left pedal on the pedal block LeftPedal /// Corresponds to the middle pedal on the pedal block MiddlePedal /// Corresponds to the right pedal on the pedal block RightPedal /// Corresponds to the tuner dial position. The 9 o'clock postion is 0, and the 6 o'clock position is 12. /// The blank area between the 6 and 9 o'clock positions is 13, 14, and 15 clockwise. TunerDial /// Corresponds to the gear lever on the left block. GearLever
So we have 10 axes available and only 8 places for them to be mapped to. The middle and right pedals naturally map to one axis in most games. And things such as the gear lever and the tunerdial are actually discrete axes that only have a few possible states.
the third parameter is the vJoy axes you want it mapped to, these names should correspond to the names you see on the calibration screen.
HID_USAGES.HID_USAGE_X//shows up as part of calibration square on first screen HID_USAGES.HID_USAGE_Y//shows up as part of calibration square on first screen HID_USAGES.HID_USAGE_Z//Z axis --third screen HID_USAGES.HID_USAGE_RZ//Z Rotation - sixth screen HID_USAGES.HID_USAGE_SL0//Slider - seventh screen HID_USAGES.HID_USAGE_RX// X Rotation -- fourth screen HID_USAGES.HID_USAGE_RY// Y Rotation -- fifth screen HID_USAGES.HID_USAGE_SL1//Dial -- eighth screen
Thats its for the basics. Of course since the files are C# based, you can always do some slightly more complicated programming such as
joystick.setAxis(1,(controller.RightPedal - controller.MiddlePedal),HID_USAGES.HID_USAGE_Z);//throttle
Or you can use fancier things such as exponential. If you find your axes are reversed, you can always multiply by -1.
joystick.setAxis(1,-1*(controller.RightPedal - controller.MiddlePedal),HID_USAGES.HID_USAGE_Z);//throttle
Edited by HackNFly, 25 September 2012 - 08:01 PM.
#65
Posted 26 September 2012 - 12:59 AM
public void Initialize() { int baseLineIntensity = 1;//just an average value for LED intensity int emergencyLightIntensity = 15;//for stuff like eject,cockpit Hatch,Ignition, and Start controller = new SteelBattalionController(); controller.Init(50);//50 is refresh rate in milliseconds //set all buttons by default to light up only when you press them down for(int i=4;i<4+30;i++) { if (i != (int)ButtonEnum.Eject)//excluding eject since we are going to flash that one controller.AddButtonLightMapping((ButtonEnum)(i-1),(ControllerLEDEnum)(i),true,baseLineIntensity); } //error//controller.AddButtonKeyLightMapping(ButtonEnum.RightJoyMainWeapon, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.RightJoyFire, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.RightJoyLockOn, true, 3, Microsoft.DirectX.DirectInput.Key.R, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.Eject, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.Ignition, true, 3, Microsoft.DirectX.DirectInput.Key.P, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Start, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonOpenClose, true, 3, Microsoft.DirectX.DirectInput.Key.B, true); controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonMapZoomInOut, true, 3, Microsoft.DirectX.DirectInput.Key.B, true); //controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonModeSelect, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonSubMonitor, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomIn, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true); controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomOut, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionFSS, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionManipulator, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionLineColorChange, true, 3, Microsoft.DirectX.DirectInput.Key.H, true); controller.AddButtonKeyLightMapping(ButtonEnum.Washing, true, 3, Microsoft.DirectX.DirectInput.Key.C, true); controller.AddButtonKeyLightMapping(ButtonEnum.Extinguisher, true, 3, Microsoft.DirectX.DirectInput.Key.O, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Chaff, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionTankDetach, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionOverride, true, 3, Microsoft.DirectX.DirectInput.Key.O, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionNightScope, true, 3, Microsoft.DirectX.DirectInput.Key.N, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF1, true, 3, Microsoft.DirectX.DirectInput.Key.Tab, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF2, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF3, true, 3, Microsoft.DirectX.DirectInput.Key.LeftControl, true); controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMain, true, 3, Microsoft.DirectX.DirectInput.Key.RightControl, true); controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConSub, true, 3, Microsoft.DirectX.DirectInput.Key.BackSpace, true); //controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMagazine, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.Comm1, true, 3, Microsoft.DirectX.DirectInput.Key.F6, true); controller.AddButtonKeyLightMapping(ButtonEnum.Comm2, true, 3, Microsoft.DirectX.DirectInput.Key.F8, true); controller.AddButtonKeyLightMapping(ButtonEnum.Comm3, true, 3, Microsoft.DirectX.DirectInput.Key.F9, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Comm4, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.Comm5, true, 3, Microsoft.DirectX.DirectInput.Key.RightBracket, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.LeftJoySightChange, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.ToggleFilterControl, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.ToggleOxygenSupply, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.ToggleFuelFlowRate, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.ToggleBufferMaterial, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.ToggleVTLocation, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //error//controller.AddButtonKeyLightMapping(ButtonEnum.GearLeverStateChange, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch, true, 3, Microsoft.DirectX.DirectInput.Key.A, true); //last true means if you hold down the button, joystick = new vJoy(); acquired = joystick.acquireVJD(1); joystick.resetAll();//have to reset before we use it }
THanks in advance,
von Pilsner
No rush, I am just a bit excited about using the thing in Win7...
EDIT: I think I got the errors taken care of (see my post below)
Edited by von Pilsner, 27 September 2012 - 12:45 AM.
#66
Posted 26 September 2012 - 07:10 AM
#67
Posted 26 September 2012 - 07:10 AM
I appreciate your enthusiasm, it encourages me to keep pushing to get it right. I have a busy day today, so I won't get to take a look at this until around 9 - 10 p.m. tonight, but I'll test your code out as soon as I have a chance, and I"ll get back to you today.
Urban UK
You're welcome, if you can test the program for me, the more people testing it, the easier it is to fix errors.
Edited by HackNFly, 26 September 2012 - 07:11 AM.
#68
Posted 26 September 2012 - 11:11 AM
HackNFly, on 26 September 2012 - 07:10 AM, said:
I appreciate your enthusiasm, it encourages me to keep pushing to get it right. I have a busy day today, so I won't get to take a look at this until around 9 - 10 p.m. tonight, but I'll test your code out as soon as I have a chance, and I"ll get back to you today.
Sounds great, I have visual studio as well and compiled it myself just to see if it works (it does) so I will poke around your code a bit and see what makes it work... (I used to do some C so maybe I can make heads or tails of it)
EDIT: using the above script (from my previous post), I configured it to 3 buttons (using vJoyConf) and ran it through XPadder (to map space, w, s, and the left thumbstick to the arrow keys), works in game - got a few kills... I have been messing with a few parameters in user.cfg as well to adjust the 'feel' in game.
; Joystick Setup cl_joystick_gain = 1.1 cl_joystick_sensitivity = 0.8 cl_joystick_invert_throttle = 0 cl_joystick_invert_pitch = 1 cl_joystick_invert_yaw = 0 cl_joystick_invert_turn = 0 cl_joystick_throttle_range = 0 ;i_joystick_buffered disables the Joystick buffering which greatly increases the joystick's sensitivity ;i_joystick_buffered = 0 ; Joystick DeadZone, you require both the i and cl lines to make the joystick deadzone change work. ;i_joystick_deadzone = 0.070 ;cl_joystick_deadzone = 0.070 ;ZOOM settings (they adjust sensitivity of joystick when zoomed) gp_mech_view_look_sensitivity = 0.0090 //Normal view gp_mech_view_zoom_level1_sensitivity_modifier = 0.2 //Zoom 1.5x gp_mech_view_zoom_level2_sensitivity_modifier = 0.3 //Zoom 3x gp_mech_view_zoom_level3_sensitivity_modifier = 0.35 //Zoom 4x
Complete WIP settings (I was driving an assault so it may be wrong for a fast mech), some lines are commented out as the default currently feels better to me...
EDIT: can not get sight change button to work... (I usually use for zoom)
Very nice, so far so good
Edited by von Pilsner, 26 September 2012 - 12:15 PM.
#69
Posted 26 September 2012 - 02:26 PM
(found it in the code, glad I looked)
#70
Posted 26 September 2012 - 02:49 PM
#71
Posted 26 September 2012 - 03:34 PM
#72
Posted 26 September 2012 - 05:02 PM
Ximmons, on 26 September 2012 - 02:49 PM, said:
Here is the setup:
And the config file: BvP-MWO.cs (right click and 'save as')
It uses the default game button mapping. I got the toggles to work - they can be a bit confusing....
If FILT Toggle is down your Sub Weapon (trigger) is 'Fire Selected'
If FILT Toggle is up your Sub Weapon (trigger) is 'Alpha Strike'
If O2 Toggle is down your Main weapon button fires weapon group 5
If O2 Toggle is up your Main weapon button fires weapon group 6
If Fuel Flow Toggle is down your left pedal is 'full stop'
If Fuel Flow Toggle is up your left pedal is 'jump jet'
In the MWO options screen you should only have to re-bind your left stick to 'turn' and bind the 'throttle' to your throttle stick on the controller (I am using the default key bindings, so if you customized them you should reset them back to default).
here are the user.cfg changes I am using (I think some of them are important for the throttle to work correctly):
; Joystick Setup cl_joystick_gain = 1.35 ;cl_joystick_sensitivity = 0.8 cl_joystick_invert_throttle = 0 cl_joystick_invert_pitch = 1 cl_joystick_invert_yaw = 0 cl_joystick_invert_turn = 0 cl_joystick_throttle_range = 0
Example user.cfg
Thanks again HackNFly!!!! I think I got somewhat figured out (even the toggles) before you got home....
-von Pilsner
EDIT: version 0.7 has working POV, I think I have everything where I want it (I mapped 'override' to the eject button in addition to the 2 other 'override' buttons...)
EDIT: New beta version of Steel-Batallion-64_v2_beta.zip
Steel-Batallion-64_v2_beta.zip <-- new version - old profiles no longer work!
New profile (working with beta): BvP-MWO-0.8.cs.
Example user.cfg
Button mapping diagram
Toggle explanation: here
Edited by von Pilsner, 27 September 2012 - 11:11 AM.
#73
Posted 26 September 2012 - 05:33 PM
#74
Posted 26 September 2012 - 07:38 PM
von Pilsner, on 26 September 2012 - 05:02 PM, said:
I went ahead and downloaded the config file, wich I greatly appreciate you uploading it for the rest of us so quickly, but ran into a snag. When i activated the simple config all 32 buttons will show up in the windows calibration but with your config file only the secondary fire trigger works and the two joy sticks. This transfers over to in game as well. I have probably done something wrong but its late and I need some sleep. Any advice you can give Is appreciated.
Edited by Ximmons, 26 September 2012 - 07:38 PM.
#75
Posted 26 September 2012 - 07:51 PM
Ximmons, on 26 September 2012 - 07:38 PM, said:
I bet you got it working, I mapped everything except for the trigger and axes to the default keyboard buttons so I don't have to deal with re-mapping controlls in-game (except for axis) this way I can have minimal in-game setup...
Also, I am gonna keep updating it tonight so re-download the file when you wake up.
Edited by von Pilsner, 26 September 2012 - 07:52 PM.
#76
Posted 26 September 2012 - 08:47 PM
bool jumpPressed = false; bool stopPressed = false;//used in special handling of left pedal int pedalTriggerLevel = 50;//used in special handlign of left pedal, Microsoft.DirectX.DirectInput.Key jumpKey = Microsoft.DirectX.DirectInput.Key.Space; Microsoft.DirectX.DirectInput.Key stopKey = Microsoft.DirectX.DirectInput.Key.X;
And this at the end of the loop section
if(controller.LeftPedal > pedalTriggerLevel) { //take care of the button logic separately, to be less confusing if(!jumpPressed)//if not currently holding down jump key { if(controller.RightPedal > pedalTriggerLevel || controller.MiddlePedal > pedalTriggerLevel) { controller.sendKeyDown(jumpKey); jumpPressed = true; } } else//jump button was pressed { //adding these so that else if won't get optimized into one statement if(controller.RightPedal < pedalTriggerLevel && controller.MiddlePedal < pedalTriggerLevel) { controller.sendKeyUp(jumpKey); jumpPressed = false; } } if(!stopPressed)//if not currently holding down stop key { if(controller.RightPedal < pedalTriggerLevel && controller.MiddlePedal < pedalTriggerLevel) { controller.sendKeyDown(stopKey);//send fullstop command stopPressed = true; } } else//stop button was pressed { if(controller.RightPedal > pedalTriggerLevel || controller.MiddlePedal > pedalTriggerLevel) { controller.sendKeyUp(stopKey); stopPressed = false; } } } else { if(stopPressed) { controller.sendKeyUp(stopKey); stopPressed = false; } if(jumpPressed) { controller.sendKeyUp(jumpKey); jumpPressed = false; } }
The extra booleans were necessary otherwise it would press the key repeatedly. So you have to send one downkey when the pedal is pressed and one upkey when it is released.
Thats the gist of what is needed to get the control pedals working. I copied it from my MW4 code I was previously using. The left pedal becomes dual use, press it by itself and it functions as a stop key, press it in combination with the right or middle pedals and it works as a jump jet. Its actually quite intuitive. I'd upload my configuration file to you, but I"ve changed some settings on the program since the last one I put out and don't want to cause issues. The main thing is I've simplified the whole thing to one project, Still trying to fix the problem where you can't just press stop and start again because of the Microsoft.DirectInput dll
Edited by HackNFly, 26 September 2012 - 08:49 PM.
#77
Posted 26 September 2012 - 08:57 PM
HackNFly, on 26 September 2012 - 08:47 PM, said:
...code...
The extra booleans were necessary otherwise it would press the key repeatedly. So you have to send one downkey when the pedal is pressed and one upkey when it is released.
Thats the gist of what is needed to get the control pedals working. I copied it from my MW4 code I was previously using. The left pedal becomes dual use, press it by itself and it functions as a stop key, press it in combination with the right or middle pedals and it works as a jump jet. Its actually quite intuitive. I'd upload my configuration file to you, but I"ve changed some settings on the program since the last one I put out and don't want to cause issues. The main thing is I've simplified the whole thing to one project, Still trying to fix the problem where you can't just press stop and start again because of the Microsoft.DirectInput dll
Nice, I got the pedals working in mine, but it is not as ellegent a solution
I slowed down some of the pedals so they work with the throttle and made a 'Jump Jets are on' variable to trigger the key release
if ((jj == 1) && ((controller.LeftPedal) < 50)) { controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Space); jj = 0; }
I will try and incorporate your changes in my next profile (POV is all I got left I think).
Here is my current profile: BvP-MWO.cs
Edited by von Pilsner, 26 September 2012 - 09:01 PM.
#78
Posted 26 September 2012 - 09:05 PM
#79
Posted 26 September 2012 - 09:10 PM
HackNFly, on 26 September 2012 - 09:05 PM, said:
I am only using 1 actual button (button0) the rest are unassigned and bound to keys. I used:
controller.AddButtonKeyMapping and controller.AddButtonKeyLightMapping to get around the issue.
#80
Posted 26 September 2012 - 09:17 PM
controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomIn, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true); controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomOut, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true);
Kind of confused by this. It'll work, but why bind two keys to the same keyboard key?
9 user(s) are reading this topic
0 members, 9 guests, 0 anonymous users