diff --git a/Externals/WiiUse/Win32/wiiuse.dll b/Externals/WiiUse/Win32/wiiuse.dll index 43c39f115f..9635cea6c3 100644 Binary files a/Externals/WiiUse/Win32/wiiuse.dll and b/Externals/WiiUse/Win32/wiiuse.dll differ diff --git a/Externals/WiiUse/Win32/wiiuse.lib b/Externals/WiiUse/Win32/wiiuse.lib index ba9196a109..a6a009ccc0 100644 Binary files a/Externals/WiiUse/Win32/wiiuse.lib and b/Externals/WiiUse/Win32/wiiuse.lib differ diff --git a/Externals/WiiUse/X64/wiiuse.dll b/Externals/WiiUse/X64/wiiuse.dll index f8e28edd22..9ff0697655 100644 Binary files a/Externals/WiiUse/X64/wiiuse.dll and b/Externals/WiiUse/X64/wiiuse.dll differ diff --git a/Externals/WiiUse/X64/wiiuse.lib b/Externals/WiiUse/X64/wiiuse.lib index 40e8c29877..a700dce700 100644 Binary files a/Externals/WiiUse/X64/wiiuse.lib and b/Externals/WiiUse/X64/wiiuse.lib differ diff --git a/Externals/WiiUseSrc/Src/io_win.c b/Externals/WiiUseSrc/Src/io_win.c index f64f256fb2..f4ecf58172 100644 --- a/Externals/WiiUseSrc/Src/io_win.c +++ b/Externals/WiiUseSrc/Src/io_win.c @@ -204,9 +204,9 @@ int wiiuse_io_read(struct wiimote_t* wm) { } // This needs to be done even if ReadFile fails, essential during init - // Move the data over one, so we can add back in 0xa2 + // Move the data over one, so we can add back in data report indicator byte (here, 0xa1) memmove(wm->event_buf + 1, wm->event_buf, sizeof(wm->event_buf) - 1); - wm->event_buf[0] = 0xa2; + wm->event_buf[0] = 0xa1; ResetEvent(wm->hid_overlap.hEvent); return 1; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp index f96e7b9cb4..3aa4e294fb 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp @@ -43,7 +43,7 @@ u8 g_IR; u8 g_Eeprom[WIIMOTE_EEPROM_SIZE]; u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE]; -//u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE]; +u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE]; u8 g_RegExt[WIIMOTE_REG_EXT_SIZE]; u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE]; u8 g_RegIr[WIIMOTE_REG_IR_SIZE]; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h index eccfe00145..ef622533ed 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h @@ -75,7 +75,7 @@ extern u8 g_IR; extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE]; extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE]; -//extern u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE]; +extern u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE]; extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE]; extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE]; extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE]; @@ -140,47 +140,15 @@ static const u8 classic_calibration[] = 0x00,0x00, 0x51,0xa6 }; - - -/* The Nunchuck id. It should be written to the last bytes of the - extension register */ -static const u8 nunchuck_id[] = -{ - 0x00, 0x00, 0xa4, 0x20, 0x00, 0x00 -}; - -/* The Classic Controller id. It should be written to the last bytes of the - extension register */ -static const u8 classic_id[] = -{ - 0x00, 0x00, 0xa4, 0x20, 0x01, 0x01 -}; - -/* The GH3 guitar id. It should be written to the last bytes of the - extension register */ -static const u8 gh3glp_id[] = -{ - 0x00, 0x00, 0xa4, 0x20, 0x01, 0x03 -}; - -/* The GHWT drums id. It should be written to the last bytes of the - extension register */ -static const u8 ghwtdrums_id[] = -{ - 0x01, 0x00, 0xa4, 0x20, 0x01, 0x03 -}; - -/* The id for nothing inserted */ -static const u8 nothing_id[] = -{ - 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e -}; - -/* The id for a partially inserted extension */ -static const u8 partially_id[] = -{ - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff -}; +// Extension device IDs to be written to the last bytes of the extension reg +static const u8 nunchuck_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x00, 0x00 }; +static const u8 classic_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x01, 0x01 }; +static const u8 gh3glp_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x01, 0x03 }; +static const u8 ghwtdrums_id[] = { 0x01, 0x00, 0xa4, 0x20, 0x01, 0x03 }; +// The id for nothing inserted +static const u8 nothing_id[] = { 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e }; +// The id for a partially inserted extension +static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }; // Gamepad input extern int NumPads, NumGoodPads; // Number of goods pads diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index 63b0a3c0ca..1a2d110607 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -474,6 +474,7 @@ void DoState(PointerWrap &p) p.DoArray(g_Eeprom, WIIMOTE_EEPROM_SIZE); p.DoArray(g_RegSpeaker, WIIMOTE_REG_SPEAKER_SIZE); p.DoArray(g_RegExt, WIIMOTE_REG_EXT_SIZE); + p.DoArray(g_RegMotionPlus, WIIMOTE_REG_EXT_SIZE); p.DoArray(g_RegExtTmp, WIIMOTE_REG_EXT_SIZE); p.DoArray(g_RegIr, WIIMOTE_REG_IR_SIZE); diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp index 5f60c794ba..37d736fd31 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp @@ -46,11 +46,6 @@ extern SWiimoteInitialize g_WiimoteInitialize; namespace WiiMoteEmu { -//****************************************************************************** -// Subroutines -//****************************************************************************** - - /* Here we process the Output Reports that the Wii sends. Our response will be an Input Report back to the Wii. Input and Output is from the Wii's perspective, Output means data to the Wiimote (from the Wii), Input means @@ -60,10 +55,6 @@ namespace WiiMoteEmu 1. Wiimote_InterruptChannel > InterruptChannel > HidOutputReport 2. Wiimote_ControlChannel > ControlChannel > HidOutputReport - - The IR lights and speaker enable/disable and mute/unmute values are - 0x2 = Disable - 0x6 = Enable */ void HidOutputReport(u16 _channelID, wm_report* sr) { @@ -71,8 +62,8 @@ void HidOutputReport(u16 _channelID, wm_report* sr) switch(sr->wm) { - case WM_RUMBLE: // 0x10 - // TODO: Implement rumble for real wiimotes + case 0x10: + // Unknown break; case WM_LEDS: // 0x11 @@ -128,8 +119,7 @@ void HidOutputReport(u16 _channelID, wm_report* sr) // Send general feedback except the following types // as these ones generate their own feedbacks - if ((sr->wm != WM_RUMBLE) - && (sr->wm != WM_READ_DATA) + if ((sr->wm != WM_READ_DATA) && (sr->wm != WM_REQUEST_STATUS) && (sr->wm != WM_WRITE_SPEAKER_DATA) ) @@ -235,7 +225,8 @@ void WmReadData(u16 _channelID, wm_read_data* rd) blockSize = WIIMOTE_REG_EXT_SIZE; DEBUG_LOG(WIIMOTE, " Case 0xa4: ExtReg"); break; -/* + + // MotionPlus is pretty much just a dummy atm :p case 0xA6: block = g_RegMotionPlus; block[0xFC] = 0xA6; @@ -245,7 +236,7 @@ void WmReadData(u16 _channelID, wm_read_data* rd) blockSize = WIIMOTE_REG_EXT_SIZE; DEBUG_LOG(WIIMOTE, " Case 0xa6: MotionPlusReg [%x]", address); break; -*/ + case 0xB0: block = g_RegIr; blockSize = WIIMOTE_REG_IR_SIZE; @@ -407,13 +398,13 @@ void WmWriteData(u16 _channelID, wm_write_data* wd) blockSize = WIIMOTE_REG_EXT_SIZE; DEBUG_LOG(WIIMOTE, " Case 0xa4: ExtReg"); break; -/* + case 0xA6: block = g_RegMotionPlus; blockSize = WIIMOTE_REG_EXT_SIZE; DEBUG_LOG(WIIMOTE, " Case 0xa6: MotionPlusReg [%x]", address); break; -*/ + case 0xB0: block = g_RegIr; blockSize = WIIMOTE_REG_IR_SIZE; diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index 86f7116f81..df9dd207ea 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -942,9 +942,9 @@ void InterruptDebugging(bool Emu, const void* _pData) if (g_DebugComm) Name.append("WM_SPEAKER"); size = 1; if(data[1] == 0x14) { - DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] == 0x06) ? "On" : "Off"); + DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] & 4) ? "On" : "Off"); } else if(data[1] == 0x19) { - DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] == 0x06) ? "Muted" : "Unmuted"); + DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] & 4) ? "Muted" : "Unmuted"); } break; case WM_WRITE_SPEAKER_DATA: // 0x18 diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h b/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h index f12c8bd991..073a2ead6c 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h @@ -49,7 +49,6 @@ struct wm_report { u8 data[0]; }; -#define WM_RUMBLE 0x10 #define WM_LEDS 0x11 struct wm_leds { u8 rumble : 1; diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp index be6f4f3525..c3e0a84226 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp @@ -225,11 +225,12 @@ void SendEvent(SEvent& _rEvent) u8 Buffer[1024]; u32 Offset = 0; hid_packet* pHidHeader = (hid_packet*)(Buffer + Offset); - Offset += sizeof(hid_packet); pHidHeader->type = HID_TYPE_DATA; pHidHeader->param = HID_PARAM_INPUT; // Create the buffer + memcpy(&Buffer[Offset], pHidHeader, sizeof(hid_packet)); + Offset += sizeof(hid_packet); memcpy(&Buffer[Offset], _rEvent.m_PayLoad, sizeof(_rEvent.m_PayLoad)); Offset += sizeof(_rEvent.m_PayLoad);