Jump to content

Steel Battalion controller and win 7 64-Bit drivers


417 replies to this topic

#41 0101101

    Member

  • PipPipPip
  • 85 posts
  • LocationThe Pirate's Lair, Germany

Posted 21 August 2012 - 09:33 AM

The PPJoy Virtual Joystick wont show up in my game controller panel. Any ideas?

#42 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 21 August 2012 - 09:43 AM

Checking if you are in Windows Test mode is the first step. So, you add a new controller under PPJoy and it doesn't show up under game controllers?

If that is the case I would suggest uninstalling PPJoy and try reinstalling, noting if there is any error or if anything deviates from the norm.

Here are the written instructions:
http://code.google.c...ki/Installation

#43 0101101

    Member

  • PipPipPip
  • 85 posts
  • LocationThe Pirate's Lair, Germany

Posted 21 August 2012 - 09:49 AM

If I try to map the keys in PPJoy directly following error pops up... "Cannot read mappings from joystick driver".

Reinstall doesnt help.

Testmode is on.

Edited by nr1pusher, 21 August 2012 - 09:50 AM.


#44 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 21 August 2012 - 09:53 AM

So does the virtual joystick show up in the game control panel? Also when you say you try to map the keys directly, do you mean using one of PPJoy's built in demos, or by running the program I wrote?

#45 0101101

    Member

  • PipPipPip
  • 85 posts
  • LocationThe Pirate's Lair, Germany

Posted 21 August 2012 - 10:21 AM

I tried to use PPJoy's mapping function. Still no virtual joystick in the gcp. The controller installation works fine, after using the .exe it glows like a christmas tree. ;) I uninstall everything now and try it again.

Works now. ;)

Edited by nr1pusher, 21 August 2012 - 12:04 PM.


#46 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 22 August 2012 - 10:14 PM

I have it working in general, but would really love it if it was working in MWO. :D

#47 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 22 August 2012 - 10:17 PM

I"m still working on the new version, which will let you more easily customize it any way you want. I'll have to rely on someone else making the actual mapping for MWO since I don't have the game.

#48 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 22 August 2012 - 10:26 PM

That sounds great :D
Should the axis be showing up in MWO now? cause XPadder will recognize them, but MWO does not...

Edited by von Pilsner, 22 August 2012 - 10:45 PM.


#49 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 12 September 2012 - 04:50 PM

I made a thread in the BETA Forums with a mapping for the old WinXP driver here.

#50 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 22 September 2012 - 10:54 PM

I posted this in another thread, but since this seems to be the main page people get led to when looking up the Steel Batallion Controller. Long story short, I had to do a major rewrite to make it work with MWO since PPJoy doesn't work, good news is I've got it working now. Heres the status:
.....


Just wanted to say SB controller works in MWO!

Its almost 3 in the morning though, so going to bed. But currently I have 8 axes and 32 buttons mapped. I can actually map 10 axes though, as vJoy supports a continous POV, which would be the first time thats ever been possible as far as I know. Not that any reasonable game would ever make use of 10 axes. The controller does has more buttons than windows supports, so I have to find a replacement for my keyboard emulator library, I have a fix up my sleeve, but I"ll get to that at a later date.

Anyways, I tried it in game, and felt sorry for the first person I ran into and knocked over both our mechs. I had my throttle and pitch axes inverted. I quickly fixed that, but I really need help creating a default profile people can use, as I'm NOT a gamer, and only played enough Mechwarrior back in the day to get consistently beat online.

Anyways, just wanted to give everyone an update. I'll try and put something together people can help BETA test. The GUI to my program is absolutely minimal, it just pops up windows with one text box to show any errors in the program and that's it. I"ll probably add a file picker so you can change profiles without relaunching the program.

Have a good night.

~Santiago

#51 Gremlich Johns

    Member

  • PipPipPipPipPipPipPipPipPip
  • The 1 Percent
  • The 1 Percent
  • 3,855 posts
  • LocationMaryland, USA

Posted 23 September 2012 - 08:39 AM

View Postvon Pilsner, on 22 August 2012 - 10:14 PM, said:

I have it working in general, but would really love it if it was working in MWO. :P


Try it out on MW:LL, if it works there.....

#52 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 23 September 2012 - 05:18 PM

Just wanted to give a quick update, I got keyboard emulation working for MWO, that means my "driver" will be able to fully support the SB controller, all switches, all buttons all axes. Just need to incorporate this new code into my current framework.

#53 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 24 September 2012 - 03:37 PM

Great news HackNFly B)

I dual booted so I could use VTCHID drivers, I use the left thumb POV for quick weapon group changing (up, down, left, right) so I am hoping that the behavior can be duplicated.

Also, thanks for the hard work on the 64 bit drivers! :blink:

#54 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 24 September 2012 - 11:20 PM

I've made a pre-release of version 2.0 available on google code, here's the link:
http://steel-batalli...n-64_v2_pre.zip

Basics:
Install LibUSB, also available from my website.
http://code.google.c....8.exe&can=2&q=

If you have PPJoy installed, uninstall it!

INSTALL vJoy
http://vjoystick.sou...load_x86x64.php

unzip Steel-Batallion-64_v2_pre.zip
go down to Steel-Batallion-64 and double click on runSteelBatallion64 shortcut

It should bring up a very simple program. Click File, Open, select Simple.cs. Click Ok, and the filename should show up as a label on the program, click Start, and the lights on the controller should blink. pull up the set up usb game controller menu and calibrate vJoy.

I'm purposefully leaving out a lot of detail right now, because I'm tired. I plan on polishing up the code more this weekend, but I need a break from coding for a few days to fly my RC planes and relax. In the meanwhile I'll answer any questions from those brave enough to test this code.


View Postvon Pilsner, on 24 September 2012 - 03:37 PM, said:

Great news HackNFly :D

I dual booted so I could use VTCHID drivers, I use the left thumb POV for quick weapon group changing (up, down, left, right) so I am hoping that the behavior can be duplicated.

Also, thanks for the hard work on the 64 bit drivers! :mellow:

Yes, this is possible.
The configuration files are actually written in C#. The program compiles the configuration file on the fly. This is old news in the .NET world, but first time I've done it and I think its pretty slick. I was working with someone else testing an earlier version of this, and I was able to create new features combining multiple axes to perform certain functions and e-mail him back the updates in the configuration file. This will make the configuration files very powerful and flexible.

This revision required rewriting about half the existing code. I moved from a Visual C++ / Visual C# program to a purely C# program. Anyways I hope someone else out there can also get this working. You'll here more from me later on.

#55 Ximmons

    Member

  • Pip
  • 17 posts

Posted 25 September 2012 - 02:29 PM

I would again like to say thank you for putting forth the work to get these drivers up and going. Ran into a little snag when I try and install libUSB. The program installs fine but is not showing up in my device manager. I did not realize it was not their until i clicked start in the steelbattalion64.exe and the program crashed. Most of my problems are always user error so I will keep trying and if I get it then Ill post what not to do.

#56 von Pilsner

    Member

  • PipPipPipPipPipPipPipPip
  • 1,043 posts
  • LocationColorado

Posted 25 September 2012 - 03:46 PM

Installed and it's working in windows, not I just gotta figure out how to write my own config file... ;)

Thanks for the hard work, HackNFly!

#57 Ximmons

    Member

  • Pip
  • 17 posts

Posted 25 September 2012 - 04:03 PM

As I suspected it was my issue. I was not routing the install drivers to the correct sub folder for libusb it seems. Any input you need I will be more than happy to provide.

#58 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 25 September 2012 - 04:36 PM

View PostXimmons, on 25 September 2012 - 04:03 PM, said:

As I suspected it was my issue. I was not routing the install drivers to the correct sub folder for libusb it seems. Any input you need I will be more than happy to provide.

Does this mean you got it working, i.e. you tested it in USB game controllers and it moves around the axes?

View Postvon Pilsner, on 25 September 2012 - 03:46 PM, said:

Installed and it's working in windows, not I just gotta figure out how to write my own config file... ;)

Thanks for the hard work, HackNFly!

Same question, so you can move the axes around in set up usb game controllers, under properties of vJoy Device, under the Test tab?

Also, under the settings tab, it probably requires you to calibrate. My next post will be an explanation of the "configuration file"

#59 HackNFly

    Member

  • PipPipPipPipPip
  • 131 posts

Posted 25 September 2012 - 05:10 PM

//If you want a quick overview of how the configuration system works, take a look at SolExodus.cs
//This example was meant to recreate the functionality I displayed for the system in the original release
//however that also means that it is actually pretty complicated.
using SBC;
using myVJoyWrapper;
using System;
//using Microsoft.DirectX.DirectInput;
namespace SBC {
public class DynamicClass
{
SteelBattalionController controller;
vJoy joystick;
bool acquired;
const int refreshRate = 50;//number of milliseconds between call to mainLoop
 
//this gets called once by main program
	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);
  }
 
		 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
}
 
//this is necessary, as main program calls this to know how often to call mainLoop
public int getRefreshRate()
{
  return refreshRate;
}
 
private uint getDegrees(double x,double y)
{
  uint temp = (uint)(System.Math.Atan(y/x)* (180/Math.PI));
  if(x < 0)
   temp +=180;
  if(x > 0 && y < 0)
   temp += 360;
  
  temp += 90;//origin is vertical on POV not horizontal
  
  if(temp > 360)//by adding 90 we may have gone over 360
   temp -=360;
 
  temp*=100;
 
  if (temp > 35999)
   temp = 35999;
  if (temp < 0)
   temp = 0;
  return temp;
}
//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);
}
 
//this gets called at the end of the program and must be present, as it cleans up resources
public void shutDown()
{
  controller.UnInit();
  joystick.Release(1);
}
 
}
}


So here is the code from the example Simple.cs configuration file. It is standard C# code. To begin with the majority of changes you'll want to make will be within the Initialize function. Currently as an example I added the line
controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch,			true, 3,	Microsoft.DirectX.DirectInput.Key.A, true);//last true means if you hold down the button,


First variable defines which key on the SteelBatallionController you want to affect, here is a list of available keys and their proper name. (Capitalization does matter)

public enum ButtonEnum {
RightJoyMainWeapon,
RightJoyFire,
RightJoyLockOn,
Eject,
CockpitHatch,
Ignition,
Start,
MultiMonOpenClose,
MultiMonMapZoomInOut,
MultiMonModeSelect,
MultiMonSubMonitor,
MainMonZoomIn,
MainMonZoomOut,
FunctionFSS,
FunctionManipulator,
FunctionLineColorChange,
Washing,
Extinguisher,
Chaff,
FunctionTankDetach,
FunctionOverride,
FunctionNightScope,
FunctionF1,
FunctionF2,
FunctionF3,
WeaponConMain,
WeaponConSub,
WeaponConMagazine,
Comm1,
Comm2,
Comm3,
Comm4,
Comm5,
LeftJoySightChange,
ToggleFilterControl,
ToggleOxygenSupply,
ToggleFuelFlowRate,
ToggleBufferMaterial,
ToggleVTLocation,
TunerDialStateChange,
GearLeverStateChange
}



As you can see by the code, we're talking about the CockpitHatch key located under the eject button on the far right hand side of the controller.

The second parameter controls state change. if you change the parameter from true to false, then the button becomes a statebutton, useful for modes such as nightvision where you press the button to toggle the state.

controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch,			false, 3,	Microsoft.DirectX.DirectInput.Key.A, true);//last true means if you hold down the button,

The third parameter controls the light intensity, any value from 1 - 15 is acceptable.

In order to define what key you want the button to press you need to know the DirectX.DirectInput key enumerations, they are available here:
http://msdn.microsof...4(v=vs.85).aspx

If you make a mistake typing one in, the program will let you know inside the text box labeled Errors. it'll tell you a line and column number of where the mistake was made.

The last variable for AddButtonKeyLightMapping controls whether or not the button is held down when you press it.


controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch,			true, 3,	Microsoft.DirectX.DirectInput.Key.A, false);//last true means if you hold down the button,


I can't think of when you would want this to be the case, it means if you press and hold the cockpit hatch button you'll only get on letter a instead of aaaaaaaaaaaaaaaaaa

I"ll add more instructions later on, the next section to cover is how to configure joysticks.

Normally when you're revising something and you got the program to compile, you simply hit start to start the program and stop to stop. I've noticed an issue with the reference to the DirectX.DirectInput dll, Which means you'll have to restart the program between changes. I"ll see if I can get this fixed tonight.

Edited by HackNFly, 25 September 2012 - 05:11 PM.


#60 Ximmons

    Member

  • Pip
  • 17 posts

Posted 25 September 2012 - 05:57 PM

View PostHackNFly, on 25 September 2012 - 04:36 PM, said:

Does this mean you got it working, i.e. you tested it in USB game controllers and it moves around the axes?


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.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users