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 scmZp;!q{+yal!*8onI3l`7tFoZZ=}vE5NvL^9R8a51`=Yw5VD906J_B^8f$< delta 37 scmZp;!q{+yal!+pH+d5u`7u4p-fYCUSAcQR<`04;9zem(X;HKI0ZYmd#Q*>R diff --git a/Externals/WiiUse/Win32/wiiuse.lib b/Externals/WiiUse/Win32/wiiuse.lib index ba9196a109f2a91ad55f9a32b01ddc005dc225fb..a6a009ccc06511e24de6b6c113aa4a7b62b07c4c 100644 GIT binary patch delta 840 zcmZva&r1S96vtPs6fG@x+|m8vjvXw_LoHDj5|Yp*@faSXW0yQe(5-6_&LyZr7z9BP z;l*2f=x^|>mrnfwv0a)syF0r=bDIy}_ulvWX8O&3^G2Vu*0-$T?a4m z6LGg?OxH4*Xw@0iGe40)hSBB@anEtG6^Tk!XW?*2@3JPnTKWofWhlMPE{jrIt}sNu zI*TVy|v+6DrTBctu>fHsPp9u=pk z?b1RVq35UZ_O4FdAo$~@ScR;laq8wIEG~2x4bB= F{sE_bEs^}c4^=2?(7K7Z9aV8d*APy>DT-9TYagxTihv^Xg8^RR9a!-I(QAA z@w+8sx|K)-r=3AH@e}Z67?t*jb55g;Kv0@?R*r}CK55eHwQpaShtj*`Ixn^4f{o}@ z-uFZX#YHF83;U%jHagpTFWwelAWWL zLq}Pj$Iaa|=lt2TnLpF^r-8q54AHU4w*^~p*St-5-Y#J~d?3PmG7`^m$B@kZmY2EB EKMD`+ng9R* diff --git a/Externals/WiiUse/X64/wiiuse.dll b/Externals/WiiUse/X64/wiiuse.dll index f8e28edd2284feb88c64bddca19af591cc06aff6..9ff06976558e5c97aa931360add4842045efc351 100644 GIT binary patch delta 37 tcmZqp!PxMFal#9xIUgs!@?-k8YqJ&Oe?i8Do2`Urg#raPU(3)E1^{H`5y1ce delta 37 scmZqp!PxMFal#8Gue^z`{Fnl_Znk3lFUYuPvz73yP@v%EYZ+R?06IetZU6uP diff --git a/Externals/WiiUse/X64/wiiuse.lib b/Externals/WiiUse/X64/wiiuse.lib index 40e8c29877bfc31cdcde577275dbe43b9bb3641e..a700dce7001d11aa811ab56c31d1f346a92d5ec4 100644 GIT binary patch delta 854 zcmZ{ize@sP7{@P>q&&^j^X|Og7)UsjsD*_@NQ6{F{Ra*~OGHp(HAYJkysLvY=2Sv7 zG&D9ue}c3qjk$#o^gi$1J$D7&c3-~F^Zh)}`!s9K+O=9h^xj2?YmH)Ck3>saBrFVlUk*x@WFAX*>^zmo zNvh(RT&3?TkXjN`;H!&O&zDeT(s9%Wan)17J4iEcF1-{~zh$O2(G+CmiNW-BTqiw2QZ__D+%&d5L{RSyaSC2$fljNC zT|*-CQGpzqwr7Hfk~44J+z6`f7M{((77(Xw1#oc9Hx`chZZSyS#xrw|^wdUA;7Et| F+z(P1^{4;< delta 854 zcmZ{ize>YU6vksI7HwLaHcis}r$UhqYHiReMWl$7>Y#7XL2!{G=%|k3ViE2Ow2pSt zf;c!hI*5-@Tv{9*r673EO>zek{ zWGcSNQwD(osbw((zPecTeJNEYT~~b&*L@Yd!z}X_vddxhTV`rIyB1bG?>O+%{5a67 z9LL4DC~5K%IZ$&!5d(geunmCBy3H%{M&Lt`Tlp^t3(#pmoCb7x<#&Kgt}MoSuHaT+ zE>Hak)RgM77HF#^ZS}_I$yp9rfvjh;Rxi1lPezMil~r}qSD-mv4^j!Vm7e&I%G8hw z0**BnaH-+wpblMitYHYKmOIyxj<48}7|cM&bevent_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);