Преглед изворни кода

fix: restrict A/B swap to Switch modes only, default to swapped

copilot-swe-agent[bot] пре 4 месеци
родитељ
комит
01fca8897b
4 измењених фајлова са 5 додато и 6 уклоњено
  1. 1 1
      OpenPuck/config.cpp
  2. 1 1
      OpenPuck/config.h
  3. 2 3
      OpenPuck/mode_xinput.cpp
  4. 1 1
      OpenPuck/serial_console.cpp

+ 1 - 1
OpenPuck/config.cpp

@@ -18,7 +18,7 @@ bool g_debugCdcThisBoot = false;
 static uint8_t g_debugCdc = 0;
 
 int g_mDiv = 64, g_mFric = 94;
-uint8_t g_abSwap = 0;
+uint8_t g_abSwap = 1;
 uint8_t g_back[4] = {
 	5, 6, 7, 8
 }; // L4->LB R4->RB L5->L3 R5->R3 (0..11 buttons, 12..15 D-pad U/D/L/R)

+ 1 - 1
OpenPuck/config.h

@@ -79,7 +79,7 @@ void armDebugCdcNextBoot(); // persist the one-shot (caller reboots)
 
 // persisted, runtime-tunable config:
 extern int g_mDiv, g_mFric; // xbox/lizard mouse sensitivity divisor / friction%
-extern uint8_t g_abSwap; // 1 = swap A/B and X/Y (Nintendo face-button layout)
+extern uint8_t g_abSwap; // 1 = swap A/B and X/Y (Switch modes only; default ON)
 
 // back paddles L4,R4,L5,R5 -> button codes (0..15 standard, 16=PS Touch Click, 17=PS5 Mute)
 extern uint8_t g_back[4];

+ 2 - 3
OpenPuck/mode_xinput.cpp

@@ -320,9 +320,8 @@ static void rfXboxGamepad(uint8_t slot, const uint8_t *r)
 		btn |= XB_L3;
 	if (b & TB_R3)
 		btn |= XB_R3;
-	// face buttons, with optional A/B + X/Y swap (Nintendo layout)
-	uint16_t fA = g_abSwap ? XB_B : XB_A, fB = g_abSwap ? XB_A : XB_B,
-		 fX = g_abSwap ? XB_Y : XB_X, fY = g_abSwap ? XB_X : XB_Y;
+	// face buttons: Xbox always uses standard layout (swap is Switch-only)
+	uint16_t fA = XB_A, fB = XB_B, fX = XB_X, fY = XB_Y;
 	if (b & TB_A)
 		btn |= fA;
 	if (b & TB_B)

+ 1 - 1
OpenPuck/serial_console.cpp

@@ -217,7 +217,7 @@ void serialConsolePoll()
 				g_abSwap = !g_abSwap;
 				saveCfg();
 				Serial.printf(
-					"# A/B + X/Y swap %s (Nintendo layout)\n",
+					"# A/B + X/Y swap %s (Switch modes only)\n",
 					g_abSwap ? "ON" : "off");
 			} else if (line[0] == 'K') {
 				int i = line[1] - '0';