From 8405c4049dff15998e333ba9f6115c8883d7d5f8 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 26 Nov 2009 05:01:24 +0000 Subject: [PATCH] Commit better wiiuse compiles, the ones in last commit may have been switched around by git on me. Add MotionPlus to the statesave so it won't be a bother later, and uncomment some things so accessing it doesn't cause PanicAlerts git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4612 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/WiiUse/Win32/wiiuse.dll | Bin 27136 -> 27136 bytes Externals/WiiUse/Win32/wiiuse.lib | Bin 8610 -> 8610 bytes Externals/WiiUse/X64/wiiuse.dll | Bin 31744 -> 31744 bytes Externals/WiiUse/X64/wiiuse.lib | Bin 8462 -> 8462 bytes Externals/WiiUseSrc/Src/io_win.c | 4 +- .../Plugin_Wiimote/Src/EmuDefinitions.cpp | 2 +- .../Plugin_Wiimote/Src/EmuDefinitions.h | 52 ++++-------------- Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp | 1 + .../Plugin_Wiimote/Src/EmuSubroutines.cpp | 25 +++------ Source/Plugins/Plugin_Wiimote/Src/main.cpp | 4 +- .../Plugins/Plugin_Wiimote/Src/wiimote_hid.h | 1 - .../Plugin_Wiimote/Src/wiimote_real.cpp | 3 +- 12 files changed, 26 insertions(+), 66 deletions(-) diff --git a/Externals/WiiUse/Win32/wiiuse.dll b/Externals/WiiUse/Win32/wiiuse.dll index 43c39f115f17424e9cb9214415948246cd5604b4..9635cea6c34d4cc03834a90eeeeb86ddc34c5c47 100644 GIT binary patch delta 37 ucmZp;!q{+yal!*8onI3l`7tFoZZ=}vE5NvL^9R8a4 diff --git a/Externals/WiiUse/Win32/wiiuse.lib b/Externals/WiiUse/Win32/wiiuse.lib index ba9196a109f2a91ad55f9a32b01ddc005dc225fb..a6a009ccc06511e24de6b6c113aa4a7b62b07c4c 100644 GIT binary patch delta 840 zcmZ4FyvTWi44aXGxsjpKkJ_!xYh&0T1+~>CchE3f+>QEM2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YSSBa%h)qtHl0;|%JNS$k+!&BUlp%&&h&v$EiBERTo~>uK?at|GQ7B4B_|Dc707~OX|M$y(r~YXM4v)L ze@VkF0g1{({8bv0QC&XZGsDFRtx4DqjroEx$zG!zcVA%%kYWT)aBn`42Ro8S W0iMjDiL^!mt_Bo_&_w!7K?4ACc-dzF 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);