It works but... The Right Joy Fire is alway doing Joy2 + the touch i allowed it to ( here Joy32). THe same it is when I assigned it to key. Am I missing something? (I don't want the joy2 when toggle is ON, only the new Button Assignation).
I can not have the old button still being pressed as I aim to being able tu change the hat stick from up down right left to Z Q S D.
Here I juste made the toggle on = one key ( and make this key a Toggle in game preferences, for reverse Throttle for example ) and it does work.
_________________________________________________
I tested the 128 buttons Vjoy version. But I can not assigned a joy > 32 or at least it doesn't shine one vjoy monitor =/ Do we need to change part of your code before or something like this?
Sorry, the forum didn't update me on all the edits you made. As far as the 32 button limit, yes, I'll have to make some changes in code.
As far as the sample code, I thought something might happen with the loop above it. Whats happening is every loop we are setting buttons 0 - 31 to map with the virtual buttons. Then when you swap it in the code below that mapping is still valid since we don't have any other button mapping taking over. I've added some code to help. Let me know if that works. I haven't had a chance to actually run any of this so I apologize for any mistakes.
for(int i=1;i<=32;i++)
{
joystick.setButton((bool)controller.GetButtonState(i-1),(uint)1,(char)(i-1));
}
joystick.setButton(false,1,1);
joystick.setButton(false,1,32);//since we set all the buttons to map in the loop above we need to "unset" these
buttons since they will be set programmatically in the code below
// toggle switching buttons
if (controller.GetButtonState(ButtonEnum.ToggleFuelFlowRate)
{
joystick.setButton(controller.GetButtonState(ButtonEnum.RightJoyFire), 1, 1);
}
else
{
if (controller.GetButtonState(ButtonEnum.RightJoyFire))
joystick.setButton(controller.GetButtonState(ButtonEnum.RightJoyFire), 1, 32);
}
currentResetValue = controller.GetButtonState((int)ButtonEnum.ToggleVTLocation);
if (currentResetValue != lastResetValue && currentResetValue)
{
controller.TestLEDs(1);//reset lights
}
lastResetValue = currentResetValue;
Sorry, the forum didn't update me on all the edits you made. As far as the 32 button limit, yes, I'll have to make some changes in code.
Sorry, as i'm very limited on my number of post, i use a lot of edits
Quote
I haven't had a chance to actually run any of this so I apologize for any mistakes.
Don't, it's already really nice to you to help
So I'm going to test your code, do I need to add this only (replacing my toggle part) or is there any other value to edit ?
Let's try (i'll edit my post)
Edit 1 : the code doesn't blow my file but the 32rd joy is still not working ( when i put a joy>31 it responds as 1 or it loop ( for example joy35 : 35-31 = 4 it play joy4 and not joy34)
Also, in order to get what I told you about the toggle switching the sightChangeY to up and down an SightchangeX to Left and rigt on the keystroke. What code shoule i use to get the value? I thought of using
But i don't know how to formulate it as for the joystick, any ide? It's hard when you don't know the syntaxes. It there any library for this? sorry i'm new in this.
Hey all, sorry for not responding here or to IMs I was out in a desert for military training.
I'm excited to hear that Vjoy alows more buttons, more then even a Steel Battalion controller could need! Geting the code for it signed makes that even better! I was going to try to create a file that split the controller in two and have VJoy use each part seperatlly but now ther is no need.
As for what you are looking to do, I would look at the files made for other games available for download. Using what Hacknfly had said and looking over those files shoud help you get a better grasp of how to manage all the little workings you are trying to create.
I wish you the best and am more then happy to test out anything you create. Hacknfly truly is the code god here though and I am literally a code monkey (Script kiddie is the term from my days).
There are several new changes to the control scheme in MWO that I would like to impliment but have been too busy to try. Maybe we can help each other so we don't have to bother HacknFly too much?
Hey all, sorry for not responding here or to IMs I was out in a desert for military training.
I'm excited to hear that Vjoy alows more buttons, more then even a Steel Battalion controller could need! Geting the code for it signed makes that even better! I was going to try to create a file that split the controller in two and have VJoy use each part seperatlly but now ther is no need.
There are several new changes to the control scheme in MWO that I would like to impliment but have been too busy to try. Maybe we can help each other so we don't have to bother HacknFly too much?
Talk to you soon and GOOD LUCK!
Glad to see the people i read from coming back on this thread!
Quote
As for what you are looking to do, I would look at the files made for other games available for download. Using what Hacknfly had said and looking over those files shoud help you get a better grasp of how to manage all the little workings you are trying to create.
I wish you the best and am more then happy to test out anything you create. Hacknfly truly is the code god here though and I am literally a code monkey (Script kiddie is the term from my days).
It's what i hav tried, but didn't get me that far... =/ That's why I come to the source for help o/
Hi, i tried many times on my side to make the light being always enlighted (but at a lower intensity than a pres button) but I can't find out the code to do it. Any Ideas? (as you programmed it to enlight when a button is pressed, I wonder you could make it being always enlighted).
You're going to want to move some stuff to your main loop.
//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);
int baseLineIntensity = 5;
int litIntensity = 15;
for(int i=4;i<4+30;i++)
{
if((bool)controller.GetButtonState(i-1))
controller.SetLEDState((ControllerLEDEnum)(i),litIntensity,false);
else
controller.SetLEDState((ControllerLEDEnum)(i),baseLineIntensity,false);
}
}
specifically
int baseLineIntensity = 5;
int litIntensity = 15;
for(int i=4;i<4+30;i++)
{
if((bool)controller.GetButtonState(i-1))
controller.SetLEDState((ControllerLEDEnum)(i),litIntensity,false);
else
controller.SetLEDState((ControllerLEDEnum)(i),baseLineIntensity,false);
}
I haven't tested that, but that should do it. Give it a try and let me know if there are any issues.
Awesome, thank's a lot, you're my hero ahah.
The code work pretty well into the simple.cs file, execept than when a button is pressed the light of this last one goes away (until I press an other one) but I think it was what you wanted it to do. Here some little modification of the code (more intensity + no lights going away).
[size=4] public void mainLoop()[/size]
{
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);
int baseLineIntensity = 10;
int litIntensity = 20;
for (int i = 4; i < 4 + 30; i++)
{
if ((bool)controller.GetButtonState(i - 1))
controller.SetLEDState((ControllerLEDEnum)(i), litIntensity, false);
else
controller.SetLEDState((ControllerLEDEnum)(i), baseLineIntensity, true);
}
}
The main problem is that i fail at adding it to my main file which is use into Elite Dangerous. (this one)
Any idea of what the problem is? I'll keep looking for the problem on my side.
just to know, do you think there is a way to switch from this light mod the the original one (everything dark except when i press a button which come shiny) by using one of the toggles? Just asking =) Thank you so much again
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);
int baseLineIntensity = 10;
int litIntensity = 20;
for (int i = 4; i < 4 + 30; i++)
{
if ((bool)controller.GetButtonState(i - 1))
controller.SetLEDState((ControllerLEDEnum)(i), litIntensity, false);
else
{
if (controller.GetButtonState(ButtonEnum.ToggleFuelFlowRate))
controller.SetLEDState((ControllerLEDEnum)(i), baseLineIntensity, true);
else
controller.SetLEDState((ControllerLEDEnum)(i), 0, true);
}
}
}
That might do it. I'll take a look later today when its not so early in the morning. Basically every loop you are manually updating the lights. The toggle switch just switches whether or not we set the unlit intensity to 0 or the baseLineIntensity value.
The main problem is that i fail at adding it to my main file which is use into Elite Dangerous. (this one)
Any idea of what the problem is? I'll keep looking for the problem on my side.
Edit : you're code work perfectly (except i fail at adding it to mine), seriously I really want to take the time of leaning coding after my last year of studying CGI, you're impressing =D ( and by reading/understanding your way of doing this i'm learning a lot so thank's again).
My cousin and I work together on this, and thank's to him we succeeded to make the toggle (POV up down right left) changing to upcontrol left control etc on the keybord when the toggle is activate. Also your code works fine into mine (the lighting toggle) so everything is perfect. Thank's a lot. when i'll have cleaned this, I'll put it in here .
( now we are looking to make the tunerdial working (each position = one button or tner dial = axis).
I also have a SB controller, but I get the error below when trying to launch the steelbattalion-64.exe.
c:\controllers\Steel-Batallion-64\BvP-MWO.cs(56,46) : error CS0117: 'SBC.ButtonEnum' does not contain a definition for 'RightJoyMainFire'
When I open the file in notepad++ and comment the line with two //, it flashes the lights but then throws me an error in a window that I cannot copy
heres a screenshot:
I followed everything to the letter as described here, does anyone know how to resolve this ?
Could you try opening the Simple.cs file that came bundled with the Steel-Batallion-64_2.1_candidate.zip file? Want to make sure its a config file issue rather than something else.
Could you try opening the Simple.cs file that came bundled with the Steel-Batallion-64_2.1_candidate.zip file? Want to make sure its a config file issue rather than something else.
Hello HackNFly,
Thanks for the very quick response.
I did try doing that, and I got a "not in" message in the window, but only after doing what follows.
Solution:
Ok after 2 hours of trying everything I got it working somehow in playable fashion. I got this error by using the SB controller attached to a USB intermediary which was attached to the PC. I have this USB hub set up, because I move about a lot, and it's easy to plug out one cable instead of having to plug out 5. So make sure that your controller is plugged DIRECTLY into one of the usb ports of your PC, and NOT through a USB hub.
This could maybe be added to the readme of the installation since I saw that on the bottom of the install page
I got my controller off the attic and am using it to play Elite Dangerous using the config posted above in Nydp's post. Used to play MW-4 mektek release and the original before, but could not find any other relevant posts on other forums related to the SB controller, therefore I posted my query here.
Secondly I would like to know if it would be possible to map the toggle switches on the left block instead of the top ones on the center block? Why ?
I am using the Nexus together with a little free program called gPad and its server program.
You can create your own buttons, (like I did with excel) as shown in the screenshot below:
Then cut them up using the gimpShop (a gimp alternative with Photoshop keybinds since I am used to that), transfer them (via usb) to a folder on the Nexus and import the buttons in the gPad editor (which is part of the android apk). You can then assign keypresses (single and multiple) to different keys. This way you can create your own 'virtual keyboard" no need to remember key presses, and it looks very futuristic as well, since it works like a touchscreen TFT. If you have a bigger Android device, you can probably accomodate more buttons still, but I'm doing fine with the Nexus.
Now back to my initial question to use the toggle switches. Since the dial, the comms switches and the function switches on the center block EXACTLY match the size of a nexus, you see where I am going. Since the dial is not functional, I have removed the knob and when the Nexus is in its nifty little pad protector, it just sits perfectly still and stable on top of the top part of the center block, giving me access to the buttons I created with gPad. It doesn't even register when playing that the Nexus is not part of the SB controller. Probably, some modders will want to remove (as in cut out) the top center block physically and implement a 7 inch tablet permanently, but that desire is beyond me (at the moment). I apologize for not being able to make pictures, I will put some online this afternoon when a friend of mine will be here with his smartphone.
Then I would like to tackle some other issues that I noticed are still there from the earliest release of the steelbattalion-exe program.
1) Fiddling with the Gear lever still seems to be the culprit of randomly suddenly losing complete connection between the program and the controller, resulting in digital catastrophes ingame. When not using the gear lever, I manage to play fine with the config file posted above. Do you know of anyone having this issue in the past as well ?
2) Also, the sight change (pov) button on top of the left stick only works half way. I can use its right and top axis' but not its left and bottom axis. It would really help to be able to use that POV as a Dpad, which is missing from the SB controller.
Therefore I have a kind request to someone who knows what he's doing to add "toggle switch" support to the file below, see what can be done about the sight change button and what makes the gear lever disconnect the controller so often. The file below really works well and I have a good response from the controller ingame.
To calibrate the controller with the usb config control panel in windows it would be a plus to know which axis are which by adding a sort of diagram to the download.
I really appreciate the effort that some people have put into supporting this great controller in their free time. If I can donate a beer to a paypal account, feel free to let me know.
Thank you again.
PS. Using the 2.1 version gives me this error:
Other versions work and don't give me the error. This is when loading the Elite Dangerous file in this post.
Other versions like 2.01, the one mentioned on the download page, 2.01 work with the same file.
Nice looking setup there, you've piqued my interest in the Android tablet button panel. I'll provide a better response later after work.
In the meanwhile, was it a powered or unpowered hub you were using? The SB controller's cable is at the upper limit for usb cable length. A powered hub might work as a repeater, an unpowered one would not. The other possibility is that the usb library I modified to provide support for the SB controller as a joystick, might be looking for it to show up as a specific address. If its on a usb hub, it would have to traverse the hub to find the controller. This would take more work on my end that I unfortunately don't have time for.
I should be able to help you with the trigger thing.
Right off the bat, the error you're getting is because "Button not a lit button".
Hm I can make 2 more posts today, and then I gotto wait, and since I am not on the same timezone I dunno how long.
Anyways, ok, the USB hub is powered, see pic below. I could not possibly ask to devote your programming time for usb-hub jumps. Just that it would be a good idea to tell people not to use them and connect the controller directly to their pc's. Problem solved.
Thank you for the lines of code, and yes, after the update no error shows in version 2.1 release candidate. I would at some point want to share this information and controller config file with fellow players on the Elite Dangerous forum, so I will credit you as well.
Do you have one of the controllers yourself ? I am asking this because when the toggleswitch 'VT-Location Measurement' is flicked all lights flicker once. Dunno if that is intentional. I by the way have no programming knowledge, but copy pasting that I can still do. I use notepad++ so no risk there.
Thanks for taking the time, enabling or activating the toggle switches on the left instead and disabling the switches bscured by the tablet would really make my day. I would like to keep the 6 bottom switches on the center block though.
The tablet setup will work just as well with MWO or even MW4, might be an alternate route there.
Also is it possible to set the buttons that can be lit up to have two different states. Meaning they are on initially, but when pressing them once they tone down, and when pressed again that button is lit up again like initially done.
The buttons are set up that way, and that's actually the purpose of 'VT-Location Measurement' switch. The True/False at the end of the button assignment allows you to make the key either be momentarily on, or turn on when pressed and turn off when off. The problem with this approach is if you're killed in game and respawn then the light position isn't accurate any more, hence the need for a reset button/switch for the lights. Sorry, it's probably going to be this weekend before I have a chance to look at this again.
Also are you creating a config file yourself for elite, and need help, or want me to create it? The config file in your previous post didn't have that much extra in it, so I couldn't tell if that was just for example purposes or if you're expanding it for the game.
Also, as far as your default brightness level, its already a feature in the file you sent.
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);
}
change the baseLineIntensity = 1; to anything between 1 and 15.
I took the time to read through the 15 pages of this thread, and understood one and the other.
Basically I just installed vjoy and ran the vJoy setup utility, but that's about it. I did not assign any buttons to vJoy. I just calibrated the controller with windows default controller setup util, (setup USB controllers) and it works fine since Elite really has lots of bells and whistles to tune the controls, like deadzones, and even have the ability to use pedals as buttons.
I am really happy with the results, and although I saw that different config settings for gain etc... that you guys use, I am happy with the calibration settings windows provided me with at the moment. I did need to run it once. So most of the controls are "picked up" by elite without having to assign a button to it in the CS file.
I had to add the code for the toggle switches (after finding their names in this thread) since they weren't working in Elite
like so:
And when I flip the switch twice, it registers that key in elite, and shows and displays an "x" as it should, same as pressing "x" on the keyboard in the elite control settings panel for that particular button.
Since you're offering and what I really would appreciate, there are a few changes I would implement after trying out the .cs file for a little while.
1) The Dial should work in similar fashion to the rotation lever, meaning turning the dial clockwise should press letter E and anticlockwise should press letter Q; this would make it possible to use the dial to switch between the different tabs in the Nav and System screens. Alternately a toggleswitch ( the VT measurement one for example) could be used to switch to another two different letters, having the same clockwise anti clockwise functionality. Flicking the switch would stop E and Q to be registered, and start register S for clockwise and W for counter clockwise. This should make it a breeze through multiple selections in both screens left and right in the cockpit.
look at this movie around 2:03 to see the screen I am talking about. Pressing Q / E tabs to the next screen and W / S goes up and down in the selection per screen.
2) at the moment both pedals middle and right are combined together. Would it be possible to set the middle pedal to a button; for example x. In combat situations, the best turning speed is 50% engine power, it would be nice to have it seperate since I use the right pedal for throttle and the left pedal is set to boost. I do not use the Gear lever, since it makes steelbattalion-64 crash, or simply "disconnects" the controller making it unresponsive. I am happy using the foot pedals so I can keep both hands on the sticks.
3) I would like to use the sight Change POV for 3 different controls if possible after using a toggle switch.
maybe this can get a bit confusing so here goes:
There is like you well know, only one Dpad like button on the SB controller, that is the POV switch. Now you can move about in 6 DOF in Elite,
Option 1: use the POV for lateral and vertical thrust
- Up POV: thrust up
- Down POV: thrust down
- Left POV: thrust left
- Right POV: thrust right
.
This can be set to an axis in Elite. But can be inputted as seperate keypresses in the Elite ingame config screen too.
Option 2: with another toggle switch to be able to reroute power to different systems:
POV up: power to engines (arrow up key)
POV down: rebalance power (arrow down key)
POV left: power to shields (arrow key left)
POV right: power to weapons (arrow key right)
These are keypresses.
Option 3 the last toggle switch would be to use the POV (axis) to look around when pressing the lock-on key. Also able to setup as a keypress in Elite config.
4) Gearlever
How feasible is it to have the Gearlever's different settings permanently work as different buttons instead of an axis. In Elite you can set the speed (25,50,75,100%) with different buttons which would maybe help since the Gear lever makes my setup crash. I don't know if this is a universal issue, but I had this phenomenon from the moment I stared using the first SB.exe
Having the Gear lever work as buttons would maybe alleviate that problem. so having R,N,1-5 all getting a different button would be jolly.
5) Being able to set the sensitivity of the Rotation Lever and on the Left and Right pedals would be a plus.
I think that covers it all, but I might want to review and adapt the control sensitivity of the yaw and pitch later on, I will see how this flies. (no pun intended)
Hope this is not too much, and if you don't feel like doing it, then no worries altoghether, It would however be sweet to have it working that way. Also, if you like, let me know you email address so I can send you a donation.