From 0059b0f44f6af976fa1b17cea932b3d828d58e3c Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 28 Dec 2010 22:14:15 +0000 Subject: [PATCH] Made wiimotes automatically connect on start based on their selected "Input Source" in the wiimote configuration.(fixes issue 2261) Made wiimotes 2-4 input source default to "None". git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6679 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/Core.cpp | 9 +++++++++ Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 2 +- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 46bba9d0d9..0b0c8af66a 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -53,6 +53,8 @@ #include "HW/VideoInterface.h" #include "HW/SystemTimers.h" +#include "IPC_HLE/WII_IPC_HLE_Device_usb.h" + #include "PowerPC/PowerPC.h" #include "PowerPC/JitCommon/JitBase.h" @@ -390,8 +392,15 @@ THREAD_RETURN EmuThread(void *pArg) // Load and Init Wiimotes - only if we are booting in wii mode if (_CoreParameter.bWii) + { Wiimote::Initialize(g_pWindowHandle); + // activate wiimotes which don't have source set to "None" + for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) + if (g_wiimote_sources[i]) + GetUsbPointer()->AccessWiiMote(i | 0x100)->Activate(true); + } + // The hardware is initialized. g_bHwInit = true; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 727cd29d48..9bb1f9d24d 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -266,7 +266,7 @@ void LoadSettings() secname += (char)('1' + i); IniFile::Section& sec = *inifile.GetOrCreateSection(secname.c_str()); - sec.Get("Source", &g_wiimote_sources[i], WIIMOTE_SRC_EMU); + sec.Get("Source", &g_wiimote_sources[i], i ? WIIMOTE_SRC_NONE : WIIMOTE_SRC_EMU); } } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index 2873a2f684..ad2fdfdb3e 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -57,7 +57,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De tmpBD.b[0] = BT_DINF[6 + (i * WIIMOTESIZE)]; INFO_LOG(WII_IPC_WIIMOTE, "Wiimote %d BT ID %x,%x,%x,%x,%x,%x", i, tmpBD.b[0], tmpBD.b[1], tmpBD.b[2], tmpBD.b[3], tmpBD.b[4], tmpBD.b[5]); - m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, i, tmpBD, !i)); + m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, i, tmpBD, false)); i++; } while (i < 4) @@ -73,7 +73,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De memcpy((BT_DINF+7 + (i * WIIMOTESIZE)), wmName, 20); INFO_LOG(WII_IPC_WIIMOTE, "Adding to SYSConf Wiimote %d BT ID %x,%x,%x,%x,%x,%x", i, tmpBD.b[0], tmpBD.b[1], tmpBD.b[2], tmpBD.b[3], tmpBD.b[4], tmpBD.b[5]); - m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, i, tmpBD, !i)); + m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, i, tmpBD, false)); i++; } if (BT_DINF[0] != maxWM)