fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
1f92ae6
codespace-scaling-space-guide-56rpxqvxpg2v57v
1#include "modes/extra/MKWii.hpp" 2 3#define ANALOG_STICK_MIN 1 4#define ANALOG_STICK_NEUTRAL 128 5#define ANALOG_STICK_MAX 255 6 7MKWii ::MKWii (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 ::l ,& InputState ::down ,socd_type }, 12 socd::SocdPair {& InputState ::l ,& InputState ::mod_x ,socd_type }, 13 socd::SocdPair {& InputState ::l ,& InputState ::mod_y ,socd_type }, 14 }; 15} 16 17void MKWii ::UpdateDigitalOutputs (InputState & inputs ,OutputState & outputs ) { 18outputs .a = inputs .b ; 19outputs .b = inputs .x ; 20outputs .triggerLDigital = inputs .z ; 21outputs .buttonR = inputs .up ; 22outputs .dpadUp = inputs .a ; 23outputs .start = inputs .start ; 24} 25 26void MKWii ::UpdateAnalogOutputs (InputState & inputs ,OutputState & outputs ) { 27bool up = inputs .down || inputs .mod_x || inputs .mod_y ; 28 29UpdateDirections ( 30inputs .left , 31inputs .right , 32inputs .l , 33up , 34 false, 35 false, 36 false, 37 false, 38ANALOG_STICK_MIN , 39ANALOG_STICK_NEUTRAL , 40ANALOG_STICK_MAX , 41outputs 42 ); 43 44if (inputs .z ) { 45outputs .triggerLAnalog = 140 ; 46 } 47 48// Nunchuk overrides left stick. 49if (inputs .nunchuk_connected ) { 50outputs .leftStickX = inputs .nunchuk_x ; 51outputs .leftStickY = inputs .nunchuk_y ; 52 } 53}