//Flight Controls
define Steer_Left USB[0x04] //a
define Steer_Right USB[0x07] //d
define Boost USB[0x2B] //tab
define Full_Stop USB[0x1B] //x
define Strafe_Up USB[0x15] //r
define Strafe_Down USB[0x09] //f
define Strafe_Left USB[0x14] //q
define Strafe_Right USB[0x08] //e
define Flight_Assist USB[0x1D] //z
//Weapons
define Fire_Primary_Weapon USB[0x2C] //space
define Fire_Secondary_Weapon USB[0x10] //m
define Cycle_Next_Fire_Group USB[0x11] //n
define Deploy_Hard_Point USB[0x28] //return
//Targeting
define Target_Ahead USB[0x17] //t
define Target_Enemy USB[0x0B] //h
define Target_Next USB[0x0A] //g
define Target_Subsystem USB[0x1C] //y
define Increase_Sensor_Range USB[0x4B] //page up
define Decrease_Sensor_Range USB[0x4E] //page down
//Systems
define Silent_Running USB[0x4C] //delete
define Deploy_Heat_Sink USB[0x19] //v
define Ship_Lights USB[0x0F] //l
define Power_To_Engines USB[0x52] //up arrow
define Power_To_Weapons USB[0x4F] //right arrow
define Power_To_Systems USB[0x50] //left arrow
define Power_To_Balance USB[0x51] //down arrow
define UI_Focus USB[0xE1] //left shift
define Target_Panel USB[0x1E] //1
define Radar_Panel USB[0x1F] //2
define System_Panel USB[0x20] //3
//Menus
define Menu_Select USB[0x2C] //space
define UIMenu_Next USB[0x08] //e
define UIMenu_Back USB[0x14] //q
define Menu_Up USB[0x1A] //w
define Menu_Down USB[0x16] //s
define Menu_Left USB[0x04] //a
define Menu_Right USB[0x07] //d
include "target.tmh"
include "EliteDangerous.ttm"
//program startup
int main()
{
if(Init(&EventHandle)) return 1; // declare the event handler, return on error
//use MapAxis function to map USB Device and Physical Axis Name to a DirectX Axis
MapAxis(&Joystick, JOYX, DX_X_AXIS);
MapAxis(&Joystick, JOYY, DX_Y_AXIS);
MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS);
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS);
MapAxis(&Throttle, SCX, DX_XROT_AXIS);
MapAxis(&Throttle, SCY, DX_YROT_AXIS);
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS);
//Joystick buttons
MapKey(&Joystick,TG1,Fire_Primary_Weapon); //also select menu item
MapKey(&Joystick,S1,Fire_Secondary_Weapon);
MapKey(&Joystick, S4, SEQ(EXEC("MapAxis(&Joystick, JOYX, DX_SLIDER_AXIS);"),EXEC("MapAxis(&Joystick, JOYX, DX_X_AXIS);")));
MapKey(&Joystick,S3,Flight_Assist);
MapKey(&Joystick,S2,Boost);
//TMS Hat
MapKey(&Joystick,H2D,Silent_Running);
MapKey(&Joystick,H2L,Deploy_Heat_Sink);
MapKey(&Joystick,H2U,Cycle_Next_Fire_Group);
MapKey(&Joystick,H2R,Deploy_Hard_Point);
//DMS Hat
MapKey(&Joystick,H3U,Target_Ahead);
MapKey(&Joystick,H3R,Target_Next);
MapKey(&Joystick,H3D,Target_Subsystem);
MapKey(&Joystick,H3L,Target_Enemy);
//CMS Hat
MapKey(&Joystick,H4U,Increase_Sensor_Range);
MapKey(&Joystick,H4D,Decrease_Sensor_Range);
MapKey(&Joystick,H4L,Ship_Lights);
//Trim Hat
MapKey(&Joystick,H1U,Power_To_Engines);
MapKey(&Joystick,H1R,Power_To_Weapons);
MapKey(&Joystick,H1L,Power_To_Systems);
MapKey(&Joystick,H1D,Power_To_Balance);
//Throttle Switches
MapKey(&Throttle,EACON,Target_Panel);
MapKey(&Throttle,EACOFF,Target_Panel);
MapKey(&Throttle,RDRNRM,Radar_Panel);
MapKey(&Throttle,RDRDIS,Radar_Panel);
MapKey(&Throttle,APPAT,System_Panel);
MapKey(&Throttle,APAH,System_Panel);
MapKey(&Throttle,APALT,System_Panel);
//Mic Switch (menus)
MapKey(&Throttle,MSU,Menu_Up);
MapKey(&Throttle,MSD,Menu_Down);
MapKey(&Throttle,MSL,Menu_Left);
MapKey(&Throttle,MSR,Menu_Right);
MapKey(&Throttle,MSP,UI_Focus);
//Coolie Switch (Strafe)
MapKey(&Throttle,CSU,Strafe_Up);
MapKey(&Throttle,CSD,Strafe_Down);
MapKey(&Throttle,CSL,Strafe_Left); //also UI Left
MapKey(&Throttle,CSR,Strafe_Right); //also UI Right
//Speedbrake
MapKey(&Throttle,SPDB,Full_Stop);
MapKey(&Throttle,SPDF,Boost);
}
//event handler
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
//add event handling code here
}
ok problem solved.
Got to save the file with Wordpad , not Notepad![]()
Thanks for posting the profile. I was planning on jumping into TARGET this weekend and creating a profile for myself. I'll probably still do that to get the experience, but having yours available as a reference will make things easier.
PS - thanks for commenting your code. It makes it so much easier to read, particularly since you are using hex code for the key assignments
you are welcome!
I figured since we have such an international community I had better stick to USB hex codes as much as I could. I am assuming the defined macros for SPC/PGDN/PGUP/etc work across all international keyboard types...if the profile has trouble working on some crazy Chinese keyboard try flipping the SPC/PGDN/PGUP/etc over to the USB hex equivalents and that should fix any weird issues.
please let me know if you have any suggestions/what works/what doesn't
//Flight Controls
define Steer_Left USB[0x04] //a
define Steer_Right USB[0x07] //d
define Boost USB[0x2B] //tab
define Full_Stop USB[0x1B] //x
define Strafe_Up USB[0x15] //r
define Strafe_Down USB[0x09] //f
define Strafe_Left USB[0x14] //q
define Strafe_Right USB[0x08] //e
define Flight_Assist USB[0x1D] //z
//Weapons
define Fire_Primary_Weapon USB[0x2C] //space
define Fire_Secondary_Weapon USB[0x10] //m
define Cycle_Next_Fire_Group USB[0x11] //n
define Deploy_Hard_Point USB[0x28] //return
//Targeting
define Target_Ahead USB[0x17] //t
define Target_Enemy USB[0x0B] //h
define Target_Next USB[0x0A] //g
define Target_Subsystem USB[0x1C] //y
define Increase_Sensor_Range USB[0x4B] //page up
define Decrease_Sensor_Range USB[0x4E] //page down
//Systems
define Silent_Running USB[0x4C] //delete
define Deploy_Heat_Sink USB[0x19] //v
define Ship_Lights USB[0x0F] //l
define Power_To_Engines USB[0x52] //up arrow
define Power_To_Weapons USB[0x4F] //right arrow
define Power_To_Systems USB[0x50] //left arrow
define Power_To_Balance USB[0x51] //down arrow
define UI_Focus USB[0xE1] //left shift
define Target_Panel USB[0x1E] //1
define Radar_Panel USB[0x1F] //2
define System_Panel USB[0x20] //3
//Menus
define Menu_Select USB[0x2C] //space
define UIMenu_Next USB[0x08] //e
define UIMenu_Back USB[0x14] //q
define Menu_Up USB[0x1A] //w
define Menu_Down USB[0x16] //s
define Menu_Left USB[0x04] //a
define Menu_Right USB[0x07] //d
comment: actually i did a HORRIBLE job of this...lol. The PROPER way to do it would be to add an include in the tmc file to a tmh file that has this code in it and replace the USB codes in the MapKey calls with the constants defined in the tmh file!
Hi
I'm sorry if this is a little off topic..
I'm looking at purchasing an x52 pro joystick, but I'm having tracking one down at realistic price in the UK.
Can anyone remember a good place to purchase one, they seem to have a RRP of around £135ish if purchased direct from their website.
Thanks
https://www.shop.bt.com/products/saitek-x52-pro-flight-control-system-4BYR.html
in short supply but £109 pounds, they also do the non pro for £89 but no stock at present.