Jump to content

Steel Battalion controller and win 7 64-Bit drivers


417 replies to this topic

#61 CMDR Sunset Shimmer

    Member

  • PipPipPipPipPipPipPipPipPipPip
  • Legendary Founder
  • Legendary Founder
  • 5,335 posts
  • Twitch: Link
  • LocationNetherlands

Posted 25 September 2012 - 06:38 PM

Oh...man... please please please, get this up and running for MWO Hack, I'm dying to use it... I'm dying to play.

You did a great job with it on MW4:mercs, I have no doubt you can work magic in MWO.

#62 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 25 September 2012 - 06:39 PM

View PostXimmons, 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.


View PostJade Kitsune, on 25 September 2012 - 06:38 PM, said:

Oh...man... please please please, get this up and running for MWO Hack, I'm dying to use it... I'm dying to play.

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 Ximmons

    Member

  • Pip
  • 17 posts

Posted 25 September 2012 - 07:36 PM

The new files solved that problem of a limited amount of buttons. All of the buttons and axis on the controller are now being recognized save for the tuner dial and toggles. During the calibration though the left and center pedal did not come up for configuration.

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 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 25 September 2012 - 07:41 PM

I haven't gotten around to fully explaining the pedals, so that my be why the center one doesn't "show up" I'm combining the left and right pedal into one axis, so during the Game Device Calibration, when it shows the z axis, press the center pedal for it to go down and the right pedal for it to go up. The left pedal should be set for Y rotation during the game device calibration.

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 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 26 September 2012 - 12:59 AM

I was editing the config and some commands don't seem to work in my code example below
I commented the one's that crash the driver with //error//

	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
}


Am I doing it wrong? The code above works unless I try to bind to any of the commented out //error// lines...


I am going to need help getting the toggles to do what I want (hopefully you understand the pic)...

THanks in advance,
von Pilsner

p.s. - I would like to make free look button toggle on and off as well, I suppose that is what the state change is for...
p.p.s. - Also how to assign key codes to the POV output so I can map it to up, down, left, right.

No rush, I am just a bit excited about using the thing in Win7... :D

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 Urban UK

    Member

  • PipPipPipPipPip
  • 185 posts
  • LocationUK

Posted 26 September 2012 - 07:10 AM

thanks for creating this hacknfly

#67 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 26 September 2012 - 07:10 AM

von Pilsner


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 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 26 September 2012 - 11:11 AM

View PostHackNFly, on 26 September 2012 - 07:10 AM, said:

von Pilsner


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) :ph34r:

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 B)

Edited by von Pilsner, 26 September 2012 - 12:15 PM.


#69 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 26 September 2012 - 02:26 PM

Figured it out, Needed to use: controller.AddButtonKeyMapping instead as those buttons do not have any lights. :P

(found it in the code, glad I looked)

#70 Ximmons

    Member

  • Pip
  • 17 posts

Posted 26 September 2012 - 02:49 PM

Any chance us lowly unversed mech pilots could get a download link to your config file. My technical expertise stop at making the usb cable for the controller.

#71 SouthernRex

    Member

  • PipPipPipPipPipPip
  • Legendary Founder
  • Legendary Founder
  • 374 posts

Posted 26 September 2012 - 03:34 PM

Hack n Fly, you are a gangster of the mech world. Cheers on what you've accomplished.

#72 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 26 September 2012 - 05:02 PM

View PostXimmons, on 26 September 2012 - 02:49 PM, said:

Any chance us lowly unversed mech pilots could get a download link to your config file. My technical expertise stop at making the usb cable for the controller.


Here is the setup:
Posted Image

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.... :P

-von Pilsner

p.s. - there is a problem with the POV mapped to the arrows and the pedals, I am looking into it right now... If you get a chance HackNFly would you check out the profile and take a look at the POV setup?

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...) :D

EDIT: New beta version of Steel-Batallion-64_v2_beta.zip
Once again here is my current profile (same link I use every time): BvP-MWO.cs
Tested with: Steel-Batallion-64_v2_pre.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 Tempered

    Member

  • PipPipPipPipPipPipPip
  • 730 posts

Posted 26 September 2012 - 05:33 PM

I don't own the sb controller but I applaud your work. The more input device choices we have, the better. Perhaps this will get PGI to support more input devices natively.

#74 Ximmons

    Member

  • Pip
  • 17 posts

Posted 26 September 2012 - 07:38 PM

View Postvon Pilsner, on 26 September 2012 - 05:02 PM, said:


And the config file: BvP-MWO.cs (right click and 'save as')


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 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 26 September 2012 - 07:51 PM

View PostXimmons, on 26 September 2012 - 07:38 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.

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 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 26 September 2012 - 08:47 PM

I added this at the top before initialize:
 
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 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 26 September 2012 - 08:57 PM

View PostHackNFly, on 26 September 2012 - 08:47 PM, said:

I added this at the top before initialize:
...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 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 26 September 2012 - 09:05 PM

I managed to fix the dll issue, now I'm just addressing the issue you ran into earlier, I"m splitting up the definition of the buttons into something like buttons, and buttonLights, so that the configuration file will show a compilation error. After that I"ll keep testing your config

#79 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 26 September 2012 - 09:10 PM

View PostHackNFly, on 26 September 2012 - 09:05 PM, said:

I managed to fix the dll issue, now I'm just addressing the issue you ran into earlier, I"m splitting up the definition of the buttons into something like buttons, and buttonLights, so that the configuration file will show a compilation error. After that I"ll keep testing your config


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 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

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?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users