ソースを参照

fix #2 - Nunchuck Rev2 & Classic Controller Pro

Kali 3 年 前
コミット
d833473bd4
3 ファイル変更21 行追加2 行削除
  1. 13 2
      wii_anal_ec.c
  2. 6 0
      wii_ec.c
  3. 2 0
      wii_ec.h

+ 13 - 2
wii_anal_ec.c

@@ -23,7 +23,7 @@ bool  evWiiEC (const eventMsg_t* const msg,  state_t* const state)
 			case WIIEC_RELEASE:  s = "Release";     break ;
 			case WIIEC_ANALOG:   s = "Analog";      break ;
 			case WIIEC_ACCEL:    s = "Accel";       break ;
-			default:            s = "Bug";         break ;
+			default:             s = "Bug";         break ;
 		}
 		INFO("WIIP : %s '%c' = %d", s, (isprint((int)msg->wiiEc.in) ? msg->wiiEc.in : '_'), msg->wiiEc.val);
 		if ((msg->wiiEc.type == WIIEC_CONN) || (msg->wiiEc.type == WIIEC_DISCONN))
@@ -38,6 +38,17 @@ bool  evWiiEC (const eventMsg_t* const msg,  state_t* const state)
 			state->calib = CAL_TRACK;
 			sceneSet(state, ecId[msg->wiiEc.val].scene);
 			redraw = true ;
+
+#if 1  // Workaround for Classic Controller Pro, which shows 00's for Factory Calibration Data!?
+			if (state->ec.pidx == PID_CLASSIC_PRO) {
+				// Simulate a Long-OK keypress, to start Software Calibration mode
+				eventMsg_t  msg = {
+					input.type = InputTypeLong,
+					input.key  = InputKeyOk
+				};
+				key_calib(&msg, state);
+			}
+#endif
 			break;
 
 		case WIIEC_DISCONN:
@@ -59,7 +70,7 @@ bool  evWiiEC (const eventMsg_t* const msg,  state_t* const state)
 			}
 
 #if 1  //! factory calibration method not known for classic triggers - this will set the digital switch point
-			if (state->ec.pidx == PID_CLASSIC) {
+			if ((state->ec.pidx == PID_CLASSIC) || (state->ec.pidx == PID_CLASSIC_PRO)) {
 				if (msg->wiiEc.in == 'l')  state->ec.calS.classic[2].trgZL = msg->wiiEc.val ;
 				if (msg->wiiEc.in == 'r')  state->ec.calS.classic[2].trgZR = msg->wiiEc.val ;
 			}

+ 6 - 0
wii_ec.c

@@ -23,9 +23,15 @@ const ecId_t  ecId[PID_CNT] = {
 	[PID_NUNCHUCK   ] = { {0x00, 0x00, 0xA4, 0x20, 0x00, 0x00}, "Nunchuck", SCENE_NUNCHUCK,
 	                      NULL, nunchuck_decode, nunchuck_msg, nunchuck_calib, nunchuck_show, nunchuck_key },
 
+	[PID_NUNCHUCK_R2] = { {0xFF, 0x00, 0xA4, 0x20, 0x00, 0x00}, "Nunchuck (rev2)", SCENE_NUNCHUCK,
+	                      NULL, nunchuck_decode, nunchuck_msg, nunchuck_calib, nunchuck_show, nunchuck_key },
+
 	[PID_CLASSIC    ] = { {0x00, 0x00, 0xA4, 0x20, 0x01, 0x01}, "Classic Controller", SCENE_CLASSIC,
 	                      NULL, classic_decode, classic_msg, classic_calib, classic_show, classic_key },
 
+	[PID_CLASSIC_PRO] = { {0x01, 0x00, 0xA4, 0x20, 0x01, 0x01}, "Classic Controller Pro", SCENE_CLASSIC,
+	                      NULL, classic_decode, classic_msg, classic_calib, classic_show, classic_key },
+
 	[PID_BALANCE    ] = { {0x00, 0x00, 0xA4, 0x20, 0x04, 0x02}, "Balance Board", SCENE_DUMP,
 	                      NULL, NULL, NULL, NULL, NULL, NULL },
 

+ 2 - 0
wii_ec.h

@@ -75,7 +75,9 @@ typedef
 		PID_NUNCHUCK = PID_FIRST,
 
 		// If you're wise, ONLY edit this section
+			PID_NUNCHUCK_R2,
 			PID_CLASSIC,
+			PID_CLASSIC_PRO,
 			PID_BALANCE,
 			PID_GH_GUITAR,
 			PID_GH_DRUMS,