fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
818d962
gram
1/* Ultimate2 profile by Taker */ 2#include "modes/extra/Ultimate2.hpp" 3 4#define ANALOG_STICK_MIN 28 5#define ANALOG_STICK_NEUTRAL 128 6#define ANALOG_STICK_MAX 228 7 8Ultimate2 ::Ultimate2 () :ControllerMode () {} 9 10void Ultimate2 ::UpdateDigitalOutputs (const InputState & inputs ,OutputState & outputs ) { 11outputs .a = inputs .rt1 ; 12outputs .b = inputs .rf1 ; 13outputs .x = inputs .rf2 ; 14outputs .y = inputs .rf6 ; 15outputs .buttonR = inputs .rf3 ; 16outputs .triggerLDigital = inputs .lf4 ; 17outputs .triggerRDigital = inputs .rf5 ; 18outputs .start = inputs .mb1 ; 19 20// Turn on D-Pad layer by holding Mod X + Mod Y, or Nunchuk C button. 21if ((inputs .lt1 && inputs .lt2 )|| inputs .nunchuk_c ) { 22outputs .dpadUp = inputs .rt4 ; 23outputs .dpadDown = inputs .rt2 ; 24outputs .dpadLeft = inputs .rt3 ; 25outputs .dpadRight = inputs .rt5 ; 26 } 27 28if (inputs .mb3 ) 29outputs .dpadLeft = true; 30if (inputs .mb2 ) 31outputs .dpadRight = true; 32} 33 34void Ultimate2 ::UpdateAnalogOutputs (const InputState & inputs ,OutputState & outputs ) { 35// Coordinate calculations to make modifier handling simpler. 36UpdateDirections ( 37inputs .lf3 ,// Left 38inputs .lf1 ,// Right 39inputs .lf2 ,// Down 40inputs .rf4 ,// Up 41inputs .rt3 ,// C-Left 42inputs .rt5 ,// C-Right 43inputs .rt2 ,// C-Down 44inputs .rt4 ,// C-Up 45ANALOG_STICK_MIN , 46ANALOG_STICK_NEUTRAL , 47ANALOG_STICK_MAX , 48outputs 49 ); 50 51bool shield_button_pressed = inputs .lf4 || inputs .rf5 || inputs .rf7 || inputs .rf8 ; 52 53if (inputs .lt1 ) { 54// MX + Horizontal = 6625 = 53 55if (directions .horizontal ) { 56outputs .leftStickX = 128 + (directions .x * 53 ); 57// Horizontal Shield tilt = 51 58if (shield_button_pressed ) { 59outputs .leftStickX = 128 + (directions .x * 51 ); 60 } 61// Horizontal Tilts = 36 62if (inputs .rt1 ) { 63outputs .leftStickX = 128 + (directions .x * 36 ); 64 } 65 } 66// MX + Vertical = 44 67if (directions .vertical ) { 68outputs .leftStickY = 128 + (directions .y * 44 ); 69// Vertical Shield Tilt = 51 70if (shield_button_pressed ) { 71outputs .leftStickY = 128 + (directions .y * 51 ); 72 } 73 } 74if (directions .diagonal ) { 75// MX + q1/2/3/4 = 53 40 76outputs .leftStickX = 128 + (directions .x * 53 ); 77outputs .leftStickY = 128 + (directions .y * 40 ); 78if (shield_button_pressed ) { 79// MX + L, R, LS, and MS + q1/2/3/4 = 6375 3750 = 51 30 80outputs .leftStickX = 128 + (directions .x * 51 ); 81outputs .leftStickY = 128 + (directions .y * 30 ); 82 } 83 } 84 85// Angled fsmash/ftilt with C-Stick + MX 86if (directions .cx != 0 ) { 87outputs .rightStickX = 128 + (directions .cx * 127 ); 88outputs .rightStickY = 128 + (directions .y * 59 ); 89 } 90 91/* Up B angles */ 92if (directions .diagonal && !shield_button_pressed ) { 93// (33.44) = 53 40 94outputs .leftStickX = 128 + (directions .x * 53 ); 95outputs .leftStickY = 128 + (directions .y * 40 ); 96 97// Angled Ftilts 98if (inputs .rt1 ) { 99outputs .leftStickX = 128 + (directions .x * 36 ); 100outputs .leftStickY = 128 + (directions .y * 26 ); 101 } 102 } 103 } 104 105if (inputs .lt2 ) { 106// MY + Horizontal (even if shield is held) = 41 107if (directions .horizontal ) { 108outputs .leftStickX = 128 + (directions .x * 41 ); 109// MY Horizontal Tilts 110if (inputs .rt1 ) { 111outputs .leftStickX = 128 + (directions .x * 36 ); 112 } 113 } 114// MY + Vertical (even if shield is held) = 44 115if (directions .vertical ) { 116outputs .leftStickY = 128 + (directions .y * 44 ); 117// MY Vertical Tilts 118if (inputs .rt1 ) { 119outputs .leftStickY = 128 + (directions .y * 36 ); 120 } 121 } 122if (directions .diagonal ) { 123// MY + q1/2/3/4 = 41 44 124outputs .leftStickX = 128 + (directions .x * 41 ); 125outputs .leftStickY = 128 + (directions .y * 44 ); 126if (shield_button_pressed ) { 127// MY + L, R, LS, and MS + q1/2 = 38 70 128outputs .leftStickX = 128 + (directions .x * 38 ); 129outputs .leftStickY = 128 + (directions .y * 70 ); 130// MY + L, R, LS, and MS + q3/4 = 40 68 131if (directions .x == -1 ) { 132outputs .leftStickX = 128 + (directions .x * 40 ); 133outputs .leftStickY = 128 + (directions .y * 68 ); 134 } 135 } 136 } 137 138/* Up B angles */ 139if (directions .diagonal && !shield_button_pressed ) { 140// (56.56) = 41 44 141outputs .leftStickX = 128 + (directions .x * 41 ); 142outputs .leftStickY = 128 + (directions .y * 44 ); 143 144// MY Pivot Uptilt/Dtilt 145if (inputs .rt1 ) { 146outputs .leftStickX = 128 + (directions .x * 34 ); 147outputs .leftStickY = 128 + (directions .y * 38 ); 148 } 149 } 150 } 151 152// C-stick ASDI Slideoff angle overrides any other C-stick modifiers (such as 153// angled fsmash). 154if (directions .cx != 0 && directions .cy != 0 ) { 155// 5250 8500 = 42 68 156outputs .rightStickX = 128 + (directions .cx * 42 ); 157outputs .rightStickY = 128 + (directions .cy * 68 ); 158 } 159 160if (inputs .lf4 ) { 161outputs .triggerLAnalog = 140 ; 162 } 163 164if (inputs .rf5 ) { 165outputs .triggerRAnalog = 140 ; 166 } 167 168// Shut off C-stick when using D-Pad layer. 169if ((inputs .lt1 && inputs .lt2 )|| inputs .nunchuk_c ) { 170outputs .rightStickX = 128 ; 171outputs .rightStickY = 128 ; 172 } 173 174// Nunchuk overrides left stick. 175if (inputs .nunchuk_connected ) { 176outputs .leftStickX = inputs .nunchuk_x ; 177outputs .leftStickY = inputs .nunchuk_y ; 178 } 179}