fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
1f92ae6
codespace-scaling-space-guide-56rpxqvxpg2v57v
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 (socd::SocdType socd_type ) { 9_socd_pair_count = 4 ; 10_socd_pairs = new socd::SocdPair [_socd_pair_count ]{ 11 socd::SocdPair {& InputState ::left ,& InputState ::right ,socd_type }, 12 socd::SocdPair {& InputState ::down ,& InputState ::up ,socd_type }, 13 socd::SocdPair {& InputState ::c_left ,& InputState ::c_right ,socd_type }, 14 socd::SocdPair {& InputState ::c_down ,& InputState ::c_up ,socd_type }, 15 }; 16} 17 18void Ultimate2 ::UpdateDigitalOutputs (InputState & inputs ,OutputState & outputs ) { 19outputs .a = inputs .a ; 20outputs .b = inputs .b ; 21outputs .x = inputs .x ; 22outputs .y = inputs .y ; 23outputs .buttonR = inputs .z ; 24outputs .triggerLDigital = inputs .l ; 25outputs .triggerRDigital = inputs .r ; 26outputs .start = inputs .start ; 27 28// Turn on D-Pad layer by holding Mod X + Mod Y, or Nunchuk C button. 29if ((inputs .mod_x && inputs .mod_y )|| inputs .nunchuk_c ) { 30outputs .dpadUp = inputs .c_up ; 31outputs .dpadDown = inputs .c_down ; 32outputs .dpadLeft = inputs .c_left ; 33outputs .dpadRight = inputs .c_right ; 34 } 35 36if (inputs .select ) 37outputs .dpadLeft = true; 38if (inputs .home ) 39outputs .dpadRight = true; 40} 41 42void Ultimate2 ::UpdateAnalogOutputs (InputState & inputs ,OutputState & outputs ) { 43// Coordinate calculations to make modifier handling simpler. 44UpdateDirections ( 45inputs .left , 46inputs .right , 47inputs .down , 48inputs .up , 49inputs .c_left , 50inputs .c_right , 51inputs .c_down , 52inputs .c_up , 53ANALOG_STICK_MIN , 54ANALOG_STICK_NEUTRAL , 55ANALOG_STICK_MAX , 56outputs 57 ); 58 59bool shield_button_pressed = inputs .l || inputs .r || inputs .lightshield || inputs .midshield ; 60 61if (inputs .mod_x ) { 62// MX + Horizontal = 6625 = 53 63if (directions .horizontal ) { 64outputs .leftStickX = 128 + (directions .x * 53 ); 65// Horizontal Shield tilt = 51 66if (shield_button_pressed ) { 67outputs .leftStickX = 128 + (directions .x * 51 ); 68 } 69// Horizontal Tilts = 36 70if (inputs .a ) { 71outputs .leftStickX = 128 + (directions .x * 36 ); 72 } 73 } 74// MX + Vertical = 44 75if (directions .vertical ) { 76outputs .leftStickY = 128 + (directions .y * 44 ); 77// Vertical Shield Tilt = 51 78if (shield_button_pressed ) { 79outputs .leftStickY = 128 + (directions .y * 51 ); 80 } 81 } 82if (directions .diagonal ) { 83// MX + q1/2/3/4 = 53 40 84outputs .leftStickX = 128 + (directions .x * 53 ); 85outputs .leftStickY = 128 + (directions .y * 40 ); 86if (shield_button_pressed ) { 87// MX + L, R, LS, and MS + q1/2/3/4 = 6375 3750 = 51 30 88outputs .leftStickX = 128 + (directions .x * 51 ); 89outputs .leftStickY = 128 + (directions .y * 30 ); 90 } 91 } 92 93// Angled fsmash/ftilt with C-Stick + MX 94if (directions .cx != 0 ) { 95outputs .rightStickX = 128 + (directions .cx * 127 ); 96outputs .rightStickY = 128 + (directions .y * 59 ); 97 } 98 99/* Up B angles */ 100if (directions .diagonal && !shield_button_pressed ) { 101// (33.44) = 53 40 102outputs .leftStickX = 128 + (directions .x * 53 ); 103outputs .leftStickY = 128 + (directions .y * 40 ); 104 105// Angled Ftilts 106if (inputs .a ) { 107outputs .leftStickX = 128 + (directions .x * 36 ); 108outputs .leftStickY = 128 + (directions .y * 26 ); 109 } 110 } 111 } 112 113if (inputs .mod_y ) { 114// MY + Horizontal (even if shield is held) = 41 115if (directions .horizontal ) { 116outputs .leftStickX = 128 + (directions .x * 41 ); 117// MY Horizontal Tilts 118if (inputs .a ) { 119outputs .leftStickX = 128 + (directions .x * 36 ); 120 } 121 } 122// MY + Vertical (even if shield is held) = 44 123if (directions .vertical ) { 124outputs .leftStickY = 128 + (directions .y * 44 ); 125// MY Vertical Tilts 126if (inputs .a ) { 127outputs .leftStickY = 128 + (directions .y * 36 ); 128 } 129 } 130if (directions .diagonal ) { 131// MY + q1/2/3/4 = 41 44 132outputs .leftStickX = 128 + (directions .x * 41 ); 133outputs .leftStickY = 128 + (directions .y * 44 ); 134if (shield_button_pressed ) { 135// MY + L, R, LS, and MS + q1/2 = 38 70 136outputs .leftStickX = 128 + (directions .x * 38 ); 137outputs .leftStickY = 128 + (directions .y * 70 ); 138// MY + L, R, LS, and MS + q3/4 = 40 68 139if (directions .x == -1 ) { 140outputs .leftStickX = 128 + (directions .x * 40 ); 141outputs .leftStickY = 128 + (directions .y * 68 ); 142 } 143 } 144 } 145 146/* Up B angles */ 147if (directions .diagonal && !shield_button_pressed ) { 148// (56.56) = 41 44 149outputs .leftStickX = 128 + (directions .x * 41 ); 150outputs .leftStickY = 128 + (directions .y * 44 ); 151 152// MY Pivot Uptilt/Dtilt 153if (inputs .a ) { 154outputs .leftStickX = 128 + (directions .x * 34 ); 155outputs .leftStickY = 128 + (directions .y * 38 ); 156 } 157 } 158 } 159 160// C-stick ASDI Slideoff angle overrides any other C-stick modifiers (such as 161// angled fsmash). 162if (directions .cx != 0 && directions .cy != 0 ) { 163// 5250 8500 = 42 68 164outputs .rightStickX = 128 + (directions .cx * 42 ); 165outputs .rightStickY = 128 + (directions .cy * 68 ); 166 } 167 168if (inputs .l ) { 169outputs .triggerLAnalog = 140 ; 170 } 171 172if (inputs .r ) { 173outputs .triggerRAnalog = 140 ; 174 } 175 176// Shut off C-stick when using D-Pad layer. 177if ((inputs .mod_x && inputs .mod_y )|| inputs .nunchuk_c ) { 178outputs .rightStickX = 128 ; 179outputs .rightStickY = 128 ; 180 } 181 182// Nunchuk overrides left stick. 183if (inputs .nunchuk_connected ) { 184outputs .leftStickX = inputs .nunchuk_x ; 185outputs .leftStickY = inputs .nunchuk_y ; 186 } 187}