mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Some cleanups to the internal Wiimote configuration handling. No functional change.
Patch by lpfaint99. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7691 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
986825124e
commit
c351743986
@ -26,9 +26,6 @@
|
|||||||
#include "../ConfigManager.h"
|
#include "../ConfigManager.h"
|
||||||
#include "CoreTiming.h"
|
#include "CoreTiming.h"
|
||||||
|
|
||||||
#define WIIMOTESIZE 0x46
|
|
||||||
#define BTDINFSIZE WIIMOTESIZE * 0x10
|
|
||||||
|
|
||||||
// The device class
|
// The device class
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName)
|
CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName)
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||||
@ -39,45 +36,41 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
|
|||||||
{
|
{
|
||||||
// Activate only first Wiimote by default
|
// Activate only first Wiimote by default
|
||||||
|
|
||||||
u8 BT_DINF[BTDINFSIZE];
|
_conf_pads BT_DINF;
|
||||||
u8 maxWM = 0;
|
|
||||||
if (!SConfig::GetInstance().m_SYSCONF->GetArrayData("BT.DINF", BT_DINF, BTDINFSIZE))
|
if (!SConfig::GetInstance().m_SYSCONF->GetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)))
|
||||||
{
|
{
|
||||||
PanicAlertT("Trying to read from invalid SYSCONF\nWiimote bt ids are not available");
|
PanicAlertT("Trying to read from invalid SYSCONF\nWiimote bt ids are not available");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// BT_DINF first has num wiimotes at 0
|
u8 maxWM = min<u8>(BT_DINF.num_registered, CONF_PAD_MAX_ACTIVE);
|
||||||
// 10 potential wiimotes 0x46 each from 1 - 0x2be
|
|
||||||
// 4 currently connected wiimotes bt address only at 0x2bf-0x3d6 0x46 each
|
|
||||||
// verified by http://devkitpro.svn.sourceforge.net/viewvc/devkitpro?view=revision&revision=3013
|
|
||||||
maxWM = BT_DINF[0];
|
|
||||||
bdaddr_t tmpBD = BDADDR_ANY;
|
bdaddr_t tmpBD = BDADDR_ANY;
|
||||||
u8 i = 0;
|
u8 i = 0;
|
||||||
while (i < maxWM)
|
while (i < maxWM)
|
||||||
{
|
{
|
||||||
tmpBD.b[5] = BT_DINF[1 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[1 + (i * WIIMOTESIZE)];
|
tmpBD.b[5] = BT_DINF.active[i].bdaddr[0] = BT_DINF.registered[i].bdaddr[0];
|
||||||
tmpBD.b[4] = BT_DINF[2 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[2 + (i * WIIMOTESIZE)];
|
tmpBD.b[4] = BT_DINF.active[i].bdaddr[1] = BT_DINF.registered[i].bdaddr[1];
|
||||||
tmpBD.b[3] = BT_DINF[3 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[3 + (i * WIIMOTESIZE)];
|
tmpBD.b[3] = BT_DINF.active[i].bdaddr[2] = BT_DINF.registered[i].bdaddr[2];
|
||||||
tmpBD.b[2] = BT_DINF[4 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[4 + (i * WIIMOTESIZE)];
|
tmpBD.b[2] = BT_DINF.active[i].bdaddr[3] = BT_DINF.registered[i].bdaddr[3];
|
||||||
tmpBD.b[1] = BT_DINF[5 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[5 + (i * WIIMOTESIZE)];
|
tmpBD.b[1] = BT_DINF.active[i].bdaddr[4] = BT_DINF.registered[i].bdaddr[4];
|
||||||
tmpBD.b[0] = BT_DINF[6 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[6 + (i * WIIMOTESIZE)];
|
tmpBD.b[0] = BT_DINF.active[i].bdaddr[5] = BT_DINF.registered[i].bdaddr[5];
|
||||||
|
|
||||||
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]);
|
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, false));
|
m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, i, tmpBD, false));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
while (i < 4)
|
while (i < CONF_PAD_MAX_ACTIVE)
|
||||||
{
|
{
|
||||||
const char * wmName = "Nintendo RVL-CNT-01";
|
const char * wmName = "Nintendo RVL-CNT-01";
|
||||||
BT_DINF[0] = 4;
|
++BT_DINF.num_registered;
|
||||||
BT_DINF[1 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[1 + (i * WIIMOTESIZE)] = tmpBD.b[5] = i;
|
BT_DINF.active[i].bdaddr[0] = BT_DINF.registered[i].bdaddr[0] = tmpBD.b[5] = i;
|
||||||
BT_DINF[2 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[2 + (i * WIIMOTESIZE)] = tmpBD.b[4] = 0x00;
|
BT_DINF.active[i].bdaddr[1] = BT_DINF.registered[i].bdaddr[1] = tmpBD.b[4] = 0;
|
||||||
BT_DINF[3 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[3 + (i * WIIMOTESIZE)] = tmpBD.b[3] = 0x79;
|
BT_DINF.active[i].bdaddr[2] = BT_DINF.registered[i].bdaddr[2] = tmpBD.b[3] = 0x79;
|
||||||
BT_DINF[4 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[4 + (i * WIIMOTESIZE)] = tmpBD.b[2] = 0x19;
|
BT_DINF.active[i].bdaddr[3] = BT_DINF.registered[i].bdaddr[3] = tmpBD.b[2] = 0x19;
|
||||||
BT_DINF[5 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[5 + (i * WIIMOTESIZE)] = tmpBD.b[1] = 0x02;
|
BT_DINF.active[i].bdaddr[4] = BT_DINF.registered[i].bdaddr[4] = tmpBD.b[1] = 2;
|
||||||
BT_DINF[6 + ((0xa+i) * WIIMOTESIZE)] = BT_DINF[6 + (i * WIIMOTESIZE)] = tmpBD.b[0] = 0x11;
|
BT_DINF.active[i].bdaddr[5] = BT_DINF.registered[i].bdaddr[5] = tmpBD.b[0] = 0x11;
|
||||||
memcpy((BT_DINF+7 + (i * WIIMOTESIZE)), wmName, 20);
|
memcpy(BT_DINF.registered[i].name, 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]);
|
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, false));
|
m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, i, tmpBD, false));
|
||||||
@ -86,9 +79,8 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
|
|||||||
|
|
||||||
// save now so that when games load sysconf file it includes the new wiimotes
|
// save now so that when games load sysconf file it includes the new wiimotes
|
||||||
// and the correct order for connected wiimotes
|
// and the correct order for connected wiimotes
|
||||||
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("BT.DINF", BT_DINF, BTDINFSIZE) || !SConfig::GetInstance().m_SYSCONF->Save())
|
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)) || !SConfig::GetInstance().m_SYSCONF->Save())
|
||||||
PanicAlertT("Failed to write BT.DINF to SYSCONF");
|
PanicAlertT("Failed to write BT.DINF to SYSCONF");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The BCM2045's btaddr:
|
// The BCM2045's btaddr:
|
||||||
|
@ -307,4 +307,25 @@ private:
|
|||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
void LOG_LinkKey(const u8* _pLinkKey);
|
void LOG_LinkKey(const u8* _pLinkKey);
|
||||||
|
|
||||||
|
#pragma pack(push,1)
|
||||||
|
#define CONF_PAD_MAX_REGISTERED 10
|
||||||
|
#define CONF_PAD_MAX_ACTIVE 4
|
||||||
|
|
||||||
|
struct _conf_pad_device
|
||||||
|
{
|
||||||
|
u8 bdaddr[6];
|
||||||
|
char name[0x40];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _conf_pads
|
||||||
|
{
|
||||||
|
u8 num_registered;
|
||||||
|
_conf_pad_device registered[CONF_PAD_MAX_REGISTERED];
|
||||||
|
_conf_pad_device active[CONF_PAD_MAX_ACTIVE];
|
||||||
|
_conf_pad_device balance_board;
|
||||||
|
u8 unknown[0x45];
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user