Thanks a lot for taking the time to reply.
Right now i found serveral cs files though the net, some of them use the toggle to change the button key.
Example : toggle off : main weapon = joy4 toggle on main weapon = M
My goal is to have something like Toggle off : hat stick = up down right left / toggle on = z q s d on the one hand.
On the other hand I would like the tuner dial to have a key at each position (execept 0) and if you could explain to me how to have all the lights always lighted it would be great.
Actually I took the base simple.cs file, adding some toggle option i found through the web. unfortunately as I don't really understand how it works I can't do what i want with the toggles but i'm sur you, with your knowledge, could do it in a few minutes...
here's my actual cs file :
//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 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 = 20;//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;
}
public void updatePOVhat()
{
int thumbstickDeadZone = 44;
SBC.POVdirection lastDirection = controller.POVhat;
if(( (Math.Abs(controller.SightChangeX) > thumbstickDeadZone) || (Math.Abs(controller.SightChangeY) > thumbstickDeadZone) ))
{
if(Math.Abs(controller.SightChangeX) > Math.Abs(controller.SightChangeY))
if(controller.SightChangeX <0)
controller.POVhat = SBC.POVdirection.LEFT;
else
controller.POVhat = SBC.POVdirection.RIGHT;
else
if(controller.SightChangeY <0)
controller.POVhat = SBC.POVdirection.DOWN;
else
controller.POVhat = SBC.POVdirection.UP;
}
else
{
controller.POVhat = SBC.POVdirection.CENTER;
}
if(lastDirection != controller.POVhat)
{
switch(lastDirection)
{
case SBC.POVdirection.LEFT:
controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Left);
break;
case SBC.POVdirection.RIGHT:
controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Right);
break;
case SBC.POVdirection.DOWN:
controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Up);
break;
case SBC.POVdirection.UP:
controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Down);
break;
}
}
else
{
switch(controller.POVhat)
{
case SBC.POVdirection.LEFT:
controller.sendKeyDown(Microsoft.DirectX.DirectInput.Key.Left);
break;
case SBC.POVdirection.RIGHT:
controller.sendKeyDown(Microsoft.DirectX.DirectInput.Key.Right);
break;
case SBC.POVdirection.DOWN:
controller.sendKeyDown(Microsoft.DirectX.DirectInput.Key.Up);
break;
case SBC.POVdirection.UP:
controller.sendKeyDown(Microsoft.DirectX.DirectInput.Key.Down);
break;
}
}
}
//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));
}
This is the toggle code i borrow in some files, it's working but it's not the function i'm looking for.
//Handle Buttons
joystick.setButton(controller.GetButtonState(ButtonEnum.RightJoyFire),1,
controller.GetButtonState(ButtonEnum.ToggleBufferMaterial) ? 09 : 10); //Right Trigger
joystick.setButton(controller.GetButtonState(ButtonEnum.RightJoyMainWeapon),1,
controller.GetButtonState(ButtonEnum.ToggleBufferMaterial) ? 10 : 09); //Left Trigger
joystick.setButton(controller.GetButtonState(ButtonEnum.RightJoyLockOn),1,06); //Right Analog Stick
joystick.setButton(controller.GetButtonState(ButtonEnum.ToggleOxygenSupply),1,02); //B Button
//joystick.setButton(controller.GetButtonState(ButtonEnum.ToggleFilterControl),1,11); //Back Button
joystick.setButton(controller.GetButtonState(ButtonEnum.LeftJoySightChange),1,01); //A Button
//joystick.setButton(controller.GetButtonState(ButtonEnum.MultiMonOpenClose),1,15); //D-PAD DOWN
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 any Idea? ( for toggles / Light always lighted / Tuner Dial ). (Again, everything else is working perfectly

)
If you wrote some code and send it to me, I could test it

(if you don't have the time to setup the SBC)
Thank's again, for all the work.
File :
http://374xuk8e7r.1fichier.com/
Quote
I've also "upgraded" to Windows 8.1
Argh, good luck with "that"
Edited by Nydo, 31 July 2014 - 09:50 AM.