File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -559,6 +559,15 @@ void XInputController::reset() {
559559 autoSendOption = true ;
560560}
561561
562+ static void fillBuffer (char * buff, const char fill) {
563+ uint8_t i = 0 ;
564+ while (true ) {
565+ if (buff[i] == 0 ) break ;
566+ buff[i] = fill;
567+ i++;
568+ }
569+ }
570+
562571void XInputController::printDebug (Print &output) const {
563572 const char fillCharacter = ' _' ;
564573
@@ -584,14 +593,8 @@ void XInputController::printDebug(Print &output) const {
584593 char leftBumper[3 ] = " LB" ;
585594 char rightBumper[3 ] = " RB" ;
586595
587- if (!getButton (BUTTON_LB)) {
588- leftBumper[0 ] = fillCharacter;
589- leftBumper[1 ] = fillCharacter;
590- }
591- if (!getButton (BUTTON_RB)) {
592- rightBumper[0 ] = fillCharacter;
593- rightBumper[1 ] = fillCharacter;
594- }
596+ if (!getButton (BUTTON_LB)) fillBuffer (leftBumper, fillCharacter);
597+ if (!getButton (BUTTON_RB)) fillBuffer (rightBumper, fillCharacter);
595598
596599 output.print (" XInput Debug: " );
597600 sprintf (buffer,
You can’t perform that action at this time.
0 commit comments