fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
a4cb19b
v0.1.1
1#include "modes/RivalsOfAether.hpp" 2 3#define ANALOG_STICK_MIN 28 4#define ANALOG_STICK_NEUTRAL 128 5#define ANALOG_STICK_MAX 228 6 7RivalsOfAether ::RivalsOfAether (socd::SocdType socd_type ) { 8_socd_pair_count = 4 ; 9_socd_pairs = new socd::SocdPair [_socd_pair_count ]{ 10 socd::SocdPair {& InputState ::left ,& InputState ::right ,socd_type }, 11 socd::SocdPair {& InputState ::down ,& InputState ::up ,socd_type }, 12 socd::SocdPair {& InputState ::c_left ,& InputState ::c_right ,socd_type }, 13 socd::SocdPair {& InputState ::c_down ,& InputState ::c_up ,socd_type }, 14 }; 15} 16 17void RivalsOfAether ::UpdateDigitalOutputs (InputState & inputs ,OutputState & outputs ) { 18outputs .a = inputs .a ; 19outputs .b = inputs .b ; 20outputs .x = inputs .x ; 21outputs .y = inputs .y ; 22outputs .buttonR = inputs .z ; 23if (inputs .nunchuk_connected ) { 24// Lightshield with C button. 25if (inputs .nunchuk_c ) { 26outputs .triggerLAnalog = 49 ; 27 } 28outputs .triggerLDigital = inputs .nunchuk_z ; 29 }else { 30outputs .triggerLDigital = inputs .l ; 31 } 32outputs .triggerRDigital = inputs .r ; 33outputs .start = inputs .start ; 34outputs .select = inputs .select ; 35outputs .home = inputs .home ; 36outputs .leftStickClick = inputs .lightshield ; 37outputs .rightStickClick = inputs .midshield ; 38 39// Activate D-Pad layer by holding Mod X + Mod Y. 40if (inputs .mod_x && inputs .mod_y || inputs .up2 ) { 41outputs .dpadUp = inputs .c_up ; 42outputs .dpadDown = inputs .c_down ; 43outputs .dpadLeft = inputs .c_left ; 44outputs .dpadRight = inputs .c_right ; 45 } 46} 47 48void RivalsOfAether ::UpdateAnalogOutputs (InputState & inputs ,OutputState & outputs ) { 49// Coordinate calculations to make modifier handling simpler. 50UpdateDirections ( 51inputs .left , 52inputs .right , 53inputs .down , 54inputs .up , 55inputs .c_left , 56inputs .c_right , 57inputs .c_down , 58inputs .c_up , 59ANALOG_STICK_MIN , 60ANALOG_STICK_NEUTRAL , 61ANALOG_STICK_MAX , 62outputs 63 ); 64 65bool shield_button_pressed = inputs .l || inputs .r ; 66 67 68// 48 total DI angles, 24 total Up b angles, 16 total airdodge angles 69 70if (inputs .mod_x ) { 71if (directions .horizontal ) { 72outputs .leftStickX = 128 + (directions .x * 66 ); 73// MX Horizontal Tilts 74if (inputs .a ) { 75outputs .leftStickX = 128 + (directions .x * 44 ); 76 } 77 } 78 79if (directions .vertical ) { 80outputs .leftStickY = 128 + (directions .y * 44 ); 81// MX Vertical Tilts 82if (inputs .a ) { 83outputs .leftStickY = 128 + (directions .y * 67 ); 84 } 85 } 86 87/* Extra DI, Air Dodge, and Up B angles */ 88if (directions .diagonal ) { 89outputs .leftStickX = 128 + (directions .x * 59 ); 90outputs .leftStickY = 128 + (directions .y * 23 ); 91 92// Angles just for DI and Up B 93if (inputs .c_down ) { 94outputs .leftStickX = 128 + (directions .x * 49 ); 95outputs .leftStickY = 128 + (directions .y * 24 ); 96 } 97 98// Angles just for DI 99if (inputs .c_left ) { 100outputs .leftStickX = 128 + (directions .x * 52 ); 101outputs .leftStickY = 128 + (directions .y * 31 ); 102 } 103 104if (inputs .c_up ) { 105outputs .leftStickX = 128 + (directions .x * 49 ); 106outputs .leftStickY = 128 + (directions .y * 35 ); 107 } 108 109if (inputs .c_right ) { 110outputs .leftStickX = 128 + (directions .x * 51 ); 111outputs .leftStickY = 128 + (directions .y * 43 ); 112 } 113 } 114 } 115 116if (inputs .mod_y ) { 117if (directions .horizontal ) { 118outputs .leftStickX = 128 + (directions .x * 44 ); 119 } 120 121if (directions .vertical ) { 122outputs .leftStickY = 128 + (directions .y * 67 ); 123 } 124 125/* Extra DI, Air Dodge, and Up B angles */ 126if (directions .diagonal ) { 127outputs .leftStickX = 128 + (directions .x * 44 ); 128outputs .leftStickY = 128 + (directions .y * 113 ); 129 130// Angles just for DI and Up B 131if (inputs .c_down ) { 132outputs .leftStickX = 128 + (directions .x * 44 ); 133outputs .leftStickY = 128 + (directions .y * 90 ); 134 } 135 136// Angles just for DI 137if (inputs .c_left ) { 138outputs .leftStickX = 128 + (directions .x * 44 ); 139outputs .leftStickY = 128 + (directions .y * 74 ); 140 } 141 142if (inputs .c_up ) { 143outputs .leftStickX = 128 + (directions .x * 45 ); 144outputs .leftStickY = 128 + (directions .y * 63 ); 145 } 146 147if (inputs .c_right ) { 148outputs .leftStickX = 128 + (directions .x * 47 ); 149outputs .leftStickY = 128 + (directions .y * 57 ); 150 } 151 } 152 } 153 154// Shut off C-stick when using D-Pad layer. 155if (inputs .mod_x && inputs .mod_y || inputs .up2 ) { 156outputs .rightStickX = 128 ; 157outputs .rightStickY = 128 ; 158 } 159 160// Nunchuk overrides left stick. 161if (inputs .nunchuk_connected ) { 162outputs .leftStickX = inputs .nunchuk_x ; 163outputs .leftStickY = inputs .nunchuk_y ; 164 } 165}