mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Wiimote: More work, don't ask, no answer
nJoy: Maybe this could reactivate multi-pad? git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4729 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -41,7 +41,7 @@ public:
|
||||
// I perfer speed so let's do down-sampling instead of up-sampling
|
||||
// If you like better sound than speed, feel free to implement the up-sampling code
|
||||
m_sampleRate = 32000;
|
||||
NOTICE_LOG(AUDIO_INTERFACE, "Mixer is initialized (AISampleRate:%i, DACSampleRate:%i)", AISampleRate, DACSampleRate);
|
||||
INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized (AISampleRate:%i, DACSampleRate:%i)", AISampleRate, DACSampleRate);
|
||||
}
|
||||
|
||||
// Called from audio threads
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
namespace Common {
|
||||
|
||||
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
||||
typedef void (__cdecl* TWiimote_Update)();
|
||||
typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size);
|
||||
typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size);
|
||||
typedef void (__cdecl* TWiimote_Update)(int _number);
|
||||
typedef void (__cdecl* TWiimote_Output)(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
typedef void (__cdecl* TWiimote_Input)(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)();
|
||||
|
||||
class PluginWiimote : public CPlugin {
|
||||
|
||||
@@ -79,7 +79,7 @@ const char *Callback_ISOName(void);
|
||||
void Callback_DSPInterrupt();
|
||||
void Callback_PADLog(const TCHAR* _szMessage);
|
||||
void Callback_WiimoteLog(const TCHAR* _szMessage, int _v);
|
||||
void Callback_WiimoteInput(u16 _channelID, const void* _pData, u32 _Size);
|
||||
void Callback_WiimoteInput(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
// For keyboard shortcuts.
|
||||
void Callback_KeyPress(int key, bool shift, bool control);
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
ERROR_LOG(WII_IPC_STM, "STM immediate: Open");
|
||||
INFO_LOG(WII_IPC_STM, "STM immediate: Open");
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
m_Active = true;
|
||||
return true;
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
virtual bool Close(u32 _CommandAddress, bool _bForce)
|
||||
{
|
||||
ERROR_LOG(WII_IPC_STM, "STM immediate: Close");
|
||||
INFO_LOG(WII_IPC_STM, "STM immediate: Close");
|
||||
if (!_bForce)
|
||||
Memory::Write_U32(0, _CommandAddress+4);
|
||||
m_Active = false;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,8 @@
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
#include "WII_IPC_HLE_WiiMote.h"
|
||||
|
||||
#define HCI_MAX_SIZE 128
|
||||
#define ACL_MAX_SIZE 128
|
||||
|
||||
union UACLHeader
|
||||
{
|
||||
@@ -129,7 +131,7 @@ private:
|
||||
struct ACLPool
|
||||
{
|
||||
u32 m_number;
|
||||
u8 m_data[1024]; // Capacity: 64B x 16
|
||||
u8 m_data[ACL_MAX_SIZE * 16];
|
||||
|
||||
ACLPool(int num)
|
||||
: m_number(num)
|
||||
@@ -140,7 +142,7 @@ private:
|
||||
struct HCIPool
|
||||
{
|
||||
u32 m_number;
|
||||
u8 m_data[1024]; // Capacity: 64B x 16
|
||||
u8 m_data[HCI_MAX_SIZE * 16];
|
||||
u8 m_size[16];
|
||||
|
||||
HCIPool(int num)
|
||||
@@ -191,9 +193,9 @@ private:
|
||||
CtrlBuffer m_ACLBuffer;
|
||||
ACLPool m_ACLPool;
|
||||
u32 m_LastCmd;
|
||||
int m_PacketCount;
|
||||
u32 m_PacketCount[4];
|
||||
u32 m_FreqDividerMote[4];
|
||||
u32 m_FreqDividerSync;
|
||||
u32 m_FreqDividerMote;
|
||||
|
||||
// Events
|
||||
void AddEventToQueue(const SQueuedEvent& _event);
|
||||
@@ -201,19 +203,19 @@ private:
|
||||
void SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize);
|
||||
bool SendEventInquiryResponse();
|
||||
bool SendEventInquiryComplete();
|
||||
bool SendEventRemoteNameReq(bdaddr_t _bd);
|
||||
bool SendEventRemoteNameReq(const bdaddr_t& _bd);
|
||||
bool SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote);
|
||||
bool SendEventConnectionComplete(bdaddr_t _bd);
|
||||
bool SendEventConnectionComplete(const bdaddr_t& _bd);
|
||||
bool SendEventReadClockOffsetComplete(u16 _connectionHandle);
|
||||
bool SendEventConPacketTypeChange(u16 _connectionHandle, u16 _packetType);
|
||||
bool SendEventReadRemoteVerInfo(u16 _connectionHandle);
|
||||
bool SendEventReadRemoteFeatures(u16 _connectionHandle);
|
||||
bool SendEventRoleChange(bdaddr_t _bd, bool _master);
|
||||
bool SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count);
|
||||
bool SendEventNumberOfCompletedPackets();
|
||||
bool SendEventAuthenticationCompleted(u16 _connectionHandle);
|
||||
bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value);
|
||||
bool SendEventDisconnect(u16 _connectionHandle, u8 _Reason);
|
||||
bool SendEventRequestLinkKey(bdaddr_t _bd);
|
||||
bool SendEventRequestLinkKey(const bdaddr_t& _bd);
|
||||
bool SendEventLinkKeyNotification(const CWII_IPC_HLE_WiiMote& _rWiiMote);
|
||||
|
||||
// Execute HCI Message
|
||||
|
||||
@@ -31,9 +31,8 @@
|
||||
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb;
|
||||
|
||||
|
||||
CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number)
|
||||
: m_Connected(false)
|
||||
, m_Linked(false)
|
||||
CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number, bool ready)
|
||||
: m_Linked(false)
|
||||
, m_HIDControlChannel_Connected(false)
|
||||
, m_HIDControlChannel_ConnectedWait(false)
|
||||
, m_HIDControlChannel_Config(false)
|
||||
@@ -47,9 +46,14 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
|
||||
|
||||
|
||||
{
|
||||
s_Usb = _pHost;
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "Wiimote #%i constructed", _Number);
|
||||
|
||||
s_Usb = _pHost;
|
||||
|
||||
m_Connected = (ready) ? 0 : -1;
|
||||
m_ConnectionHandle = 0x100 + _Number;
|
||||
memset(m_LinkKey, 0xA0 + _Number, 16);
|
||||
|
||||
m_BD.b[0] = 0x11;
|
||||
m_BD.b[1] = 0x02;
|
||||
m_BD.b[2] = 0x19;
|
||||
@@ -57,8 +61,6 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
|
||||
m_BD.b[4] = 0x00;
|
||||
m_BD.b[5] = _Number;
|
||||
|
||||
m_ControllerConnectionHandle = 0x100 + _Number;
|
||||
|
||||
uclass[0]= 0x00;
|
||||
uclass[1]= 0x04;
|
||||
uclass[2]= 0x48;
|
||||
@@ -74,8 +76,6 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
|
||||
|
||||
lmp_version = 0x2;
|
||||
lmp_subversion = 0x229;
|
||||
|
||||
memset(m_LinkKey, 0xA0 + _Number, 16);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
|
||||
|
||||
bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||
{
|
||||
if ((m_Connected == false) || (m_Linked == true))
|
||||
if ((m_Connected <= 0) || (m_Linked == true))
|
||||
return false;
|
||||
|
||||
// try to connect HID_CONTROL_CHANNEL
|
||||
@@ -102,7 +102,6 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||
return false;
|
||||
|
||||
m_HIDControlChannel_ConnectedWait = true;
|
||||
// The CID is fixed, other CID will be rejected
|
||||
SendConnectionRequest(0x0040, HID_CONTROL_CHANNEL);
|
||||
return true;
|
||||
}
|
||||
@@ -113,10 +112,8 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||
if (m_HIDControlChannel_ConfigWait)
|
||||
return false;
|
||||
|
||||
SChannel& rChannel = m_Channel[0x0040];
|
||||
|
||||
m_HIDControlChannel_ConfigWait = true;
|
||||
SendConfigurationRequest(rChannel.DCID);
|
||||
SendConfigurationRequest(0x0040);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -127,7 +124,6 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||
return false;
|
||||
|
||||
m_HIDInterruptChannel_ConnectedWait = true;
|
||||
// The CID is fixed, other CID will be rejected
|
||||
SendConnectionRequest(0x0041, HID_INTERRUPT_CHANNEL);
|
||||
return true;
|
||||
}
|
||||
@@ -139,9 +135,7 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||
return false;
|
||||
|
||||
m_HIDInterruptChannel_ConfigWait = true;
|
||||
|
||||
SChannel& rChannel = m_Channel[0x0041];
|
||||
SendConfigurationRequest(rChannel.DCID);
|
||||
SendConfigurationRequest(0x0041);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -225,37 +219,43 @@ void CWII_IPC_HLE_WiiMote::UpdateStatus()
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::Activate(bool ready)
|
||||
{
|
||||
if (ready)
|
||||
m_Connected = 0;
|
||||
else
|
||||
m_Connected = -1;
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::EventConnectionAccepted()
|
||||
{
|
||||
m_Connected = true;
|
||||
m_Connected = 1;
|
||||
m_Linked = false;
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::EventDisconnect()
|
||||
{
|
||||
m_Connected = false;
|
||||
m_Connected = 0;
|
||||
m_Linked = false;
|
||||
// Clear channel flags
|
||||
EventCommandWriteLinkPolicy();
|
||||
ResetChannels();
|
||||
}
|
||||
|
||||
bool CWII_IPC_HLE_WiiMote::EventPagingChanged(u8 _pageMode)
|
||||
{
|
||||
if (m_Connected)
|
||||
if (m_Connected != 0)
|
||||
return false;
|
||||
|
||||
if ((_pageMode & 2) == 0)
|
||||
if ((_pageMode & 0x2) == 0)
|
||||
return false;
|
||||
|
||||
|
||||
m_Connected = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::EventCommandWriteLinkPolicy()
|
||||
void CWII_IPC_HLE_WiiMote::ResetChannels()
|
||||
{
|
||||
// reset connection process
|
||||
|
||||
m_HIDControlChannel_Connected = false;
|
||||
m_HIDControlChannel_Config = false;
|
||||
m_HIDInterruptChannel_Connected = false;
|
||||
@@ -291,8 +291,7 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
||||
SL2CAP_Header* pHeader = (SL2CAP_Header*)_pData;
|
||||
u8* pData = _pData + sizeof(SL2CAP_Header);
|
||||
u32 DataSize = _Size - sizeof(SL2CAP_Header);
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "++++++++++++++++++++++++++++++++++++++");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "Execute L2CAP Command: Cid 0x%04x, Len 0x%x, DataSize 0x%x", pHeader->CID, pHeader->Length, DataSize);
|
||||
INFO_LOG(WII_IPC_WIIMOTE, " CID 0x%04x, Len 0x%x, DataSize 0x%x", pHeader->CID, pHeader->Length, DataSize);
|
||||
|
||||
if(pHeader->Length != DataSize)
|
||||
{
|
||||
@@ -322,13 +321,13 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
||||
break;
|
||||
|
||||
case HID_CONTROL_CHANNEL:
|
||||
mote->Wiimote_ControlChannel(rChannel.DCID, pData, DataSize);
|
||||
mote->Wiimote_ControlChannel(m_ConnectionHandle & 0x1, pHeader->CID, pData, DataSize);
|
||||
// Call Wiimote Plugin
|
||||
break;
|
||||
|
||||
case HID_INTERRUPT_CHANNEL:
|
||||
ShowStatus(pData);
|
||||
mote->Wiimote_InterruptChannel(rChannel.DCID, pData, DataSize);
|
||||
mote->Wiimote_InterruptChannel(m_ConnectionHandle & 0x1, pHeader->CID, pData, DataSize);
|
||||
// Call Wiimote Plugin
|
||||
break;
|
||||
|
||||
@@ -415,7 +414,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConnectionReq(u8 _Ident, u8* _pData, u32 _Size
|
||||
rChannel.SCID = pCommandConnectionReq->scid;
|
||||
rChannel.DCID = pCommandConnectionReq->scid;
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] ReceiveConnectionRequest");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConnectionRequest");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " PSM: 0x%04x", rChannel.PSM);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", rChannel.SCID);
|
||||
@@ -428,7 +427,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConnectionReq(u8 _Ident, u8* _pData, u32 _Size
|
||||
Rsp.result = 0x00;
|
||||
Rsp.status = 0x00;
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] SendConnectionResponse");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConnectionResponse");
|
||||
SendCommandToACL(_Ident, L2CAP_CONN_RSP, sizeof(SL2CAP_ConnectionResponse), (u8*)&Rsp);
|
||||
}
|
||||
|
||||
@@ -438,7 +437,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConnectionResponse(u8 _Ident, u8* _pData, u32
|
||||
|
||||
_dbg_assert_(WII_IPC_WIIMOTE, _Size == sizeof(l2cap_conn_rsp));
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] ReceiveConnectionResponse");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConnectionResponse");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", rsp->dcid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", rsp->scid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Result: 0x%04x", rsp->result);
|
||||
@@ -476,7 +475,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _S
|
||||
|
||||
SChannel& rChannel = m_Channel[pCommandConfigReq->dcid];
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] ReceiveConfigurationRequest");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConfigurationRequest");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", pCommandConfigReq->dcid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", pCommandConfigReq->flags);
|
||||
@@ -506,7 +505,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _S
|
||||
_dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == 2);
|
||||
SL2CAP_OptionsMTU* pMTU = (SL2CAP_OptionsMTU*)&_pData[Offset];
|
||||
rChannel.MTU = pMTU->MTU;
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Config MTU: 0x%04x", pMTU->MTU);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " MTU: 0x%04x", pMTU->MTU);
|
||||
// AyuanX: My experiment shows that the MTU is always set to 640 bytes
|
||||
// This means that we only need temp_frame_size of 640B instead 1024B
|
||||
// Actually I've never seen a frame bigger than 64B
|
||||
@@ -519,7 +518,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _S
|
||||
_dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == 2);
|
||||
SL2CAP_OptionsFlushTimeOut* pFlushTimeOut = (SL2CAP_OptionsFlushTimeOut*)&_pData[Offset];
|
||||
rChannel.FlushTimeOut = pFlushTimeOut->TimeOut;
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Config FlushTimeOut: 0x%04x", pFlushTimeOut->TimeOut);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " FlushTimeOut: 0x%04x", pFlushTimeOut->TimeOut);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -535,14 +534,13 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _S
|
||||
RespLen += OptionSize;
|
||||
}
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] SendConfigurationResponse");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConfigurationResponse");
|
||||
SendCommandToACL(_Ident, L2CAP_CONF_RSP, RespLen, TempBuffer);
|
||||
|
||||
// update state machine
|
||||
if (rChannel.PSM == HID_CONTROL_CHANNEL)
|
||||
m_HIDControlChannel_Connected = true;
|
||||
|
||||
if (rChannel.PSM == HID_INTERRUPT_CHANNEL)
|
||||
else if (rChannel.PSM == HID_INTERRUPT_CHANNEL)
|
||||
m_HIDInterruptChannel_Connected = true;
|
||||
|
||||
}
|
||||
@@ -551,9 +549,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u
|
||||
{
|
||||
l2cap_conf_rsp* rsp = (l2cap_conf_rsp*)_pData;
|
||||
|
||||
_dbg_assert_(WII_IPC_WIIMOTE, _Size == sizeof(l2cap_conf_rsp));
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] ReceiveConfigurationResponse");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConfigurationResponse");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", rsp->scid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", rsp->flags);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Result: 0x%04x", rsp->result);
|
||||
@@ -564,30 +560,32 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u
|
||||
SChannel& rChannel = m_Channel[rsp->scid];
|
||||
|
||||
if (rChannel.PSM == HID_CONTROL_CHANNEL)
|
||||
{
|
||||
m_HIDControlChannel_Config = true;
|
||||
|
||||
if (rChannel.PSM == HID_INTERRUPT_CHANNEL)
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "Building HID_CONTROL_CHANNEL -- OK");
|
||||
}
|
||||
else if (rChannel.PSM == HID_INTERRUPT_CHANNEL)
|
||||
{
|
||||
m_HIDInterruptChannel_Config = true;
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "Building HID_INTERRUPT_CHANNEL -- OK");
|
||||
}
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::ReceiveDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size)
|
||||
{
|
||||
SL2CAP_CommandDisconnectionReq* pCommandDisconnectionReq = (SL2CAP_CommandDisconnectionReq*)_pData;
|
||||
|
||||
_dbg_assert_(WII_IPC_WIIMOTE, m_Channel.find(pCommandDisconnectionReq->scid) != m_Channel.end());
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] ReceiveDisconnectionReq");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveDisconnectionReq");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", pCommandDisconnectionReq->dcid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", pCommandDisconnectionReq->scid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", pCommandDisconnectionReq->dcid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", pCommandDisconnectionReq->scid);
|
||||
|
||||
// response
|
||||
SL2CAP_CommandDisconnectionResponse Rsp;
|
||||
Rsp.scid = pCommandDisconnectionReq->scid;
|
||||
Rsp.dcid = pCommandDisconnectionReq->dcid;
|
||||
Rsp.scid = pCommandDisconnectionReq->scid;
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] SendDisconnectionResponse");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendDisconnectionResponse");
|
||||
SendCommandToACL(_Ident, L2CAP_DISCONN_RSP, sizeof(SL2CAP_CommandDisconnectionResponse), (u8*)&Rsp);
|
||||
}
|
||||
|
||||
@@ -614,7 +612,8 @@ void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm)
|
||||
cr.psm = psm;
|
||||
cr.scid = scid;
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] SendConnectionRequest");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "-------------------------------------");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConnectionRequest");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Psm: 0x%04x", cr.psm);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Scid: 0x%04x", cr.scid);
|
||||
|
||||
@@ -631,14 +630,14 @@ void CWII_IPC_HLE_WiiMote::SendDisconnectRequest(u16 scid)
|
||||
cr.dcid = rChannel.DCID;
|
||||
cr.scid = rChannel.SCID;
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] SendDisconnectionRequest");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendDisconnectionRequest");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Dcid: 0x%04x", cr.dcid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Scid: 0x%04x", cr.scid);
|
||||
|
||||
SendCommandToACL(L2CAP_DISCONN_REQ, L2CAP_DISCONN_REQ, sizeof(l2cap_disconn_req), (u8*)&cr);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16* MTU, u16* FlushTimeOut)
|
||||
void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 FlushTimeOut)
|
||||
{
|
||||
_dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(scid));
|
||||
SChannel& rChannel = m_Channel[scid];
|
||||
@@ -651,31 +650,29 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16* MTU, u16* Flu
|
||||
cr->flags = 0;
|
||||
Offset += sizeof(l2cap_conf_req);
|
||||
|
||||
if (MTU != NULL)
|
||||
{
|
||||
SL2CAP_Options* pOptions = (SL2CAP_Options*)&Buffer[Offset];
|
||||
Offset += sizeof(SL2CAP_Options);
|
||||
SL2CAP_Options* pOptions;
|
||||
|
||||
pOptions->type = 1;
|
||||
pOptions->length = 2;
|
||||
if (MTU == NULL) MTU = rChannel.MTU;
|
||||
pOptions = (SL2CAP_Options*)&Buffer[Offset];
|
||||
Offset += sizeof(SL2CAP_Options);
|
||||
pOptions->type = 1;
|
||||
pOptions->length = 2;
|
||||
*(u16*)&Buffer[Offset] = MTU;
|
||||
Offset += 2;
|
||||
|
||||
*(u16*)&Buffer[Offset] = *MTU; Offset += 2;
|
||||
}
|
||||
if (FlushTimeOut == NULL) FlushTimeOut = rChannel.FlushTimeOut;
|
||||
pOptions = (SL2CAP_Options*)&Buffer[Offset];
|
||||
Offset += sizeof(SL2CAP_Options);
|
||||
pOptions->type = 2;
|
||||
pOptions->length = 2;
|
||||
*(u16*)&Buffer[Offset] = FlushTimeOut;
|
||||
Offset += 2;
|
||||
|
||||
if (FlushTimeOut != NULL)
|
||||
{
|
||||
SL2CAP_Options* pOptions = (SL2CAP_Options*)&Buffer[Offset];
|
||||
Offset += sizeof(SL2CAP_Options);
|
||||
|
||||
pOptions->type = 2;
|
||||
pOptions->length = 2;
|
||||
|
||||
*(u16*)&Buffer[Offset] = *FlushTimeOut; Offset += 2;
|
||||
}
|
||||
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[ACL] SendConfigurationRequest");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConfigurationRequest");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Dcid: 0x%04x", cr->dcid);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", cr->flags);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " MTU: 0x%04x", MTU);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " FlushTimeOut: 0x%04x", FlushTimeOut);
|
||||
|
||||
SendCommandToACL(L2CAP_CONF_REQ, L2CAP_CONF_REQ, Offset, Buffer);
|
||||
}
|
||||
@@ -885,17 +882,17 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
|
||||
u32 Offset = 0;
|
||||
|
||||
SL2CAP_Header* pHeader = (SL2CAP_Header*)&DataFrame[Offset]; Offset += sizeof(SL2CAP_Header);
|
||||
pHeader->CID = 0x0001;
|
||||
pHeader->Length = sizeof(SL2CAP_Command) + _CommandLength;
|
||||
pHeader->CID = 0x0001;
|
||||
|
||||
SL2CAP_Command* pCommand = (SL2CAP_Command*)&DataFrame[Offset]; Offset += sizeof(SL2CAP_Command);
|
||||
pCommand->len = _CommandLength;
|
||||
pCommand->ident = _Ident;
|
||||
pCommand->code = _Code;
|
||||
pCommand->ident = _Ident;
|
||||
pCommand->len = _CommandLength;
|
||||
|
||||
memcpy(&DataFrame[Offset], _pCommandData, _CommandLength);
|
||||
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SendCommandToACL (to CPU)");
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "Send ACL Command to CPU");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Code: 0x%02x", _Code);
|
||||
|
||||
@@ -944,16 +941,16 @@ namespace Core
|
||||
{
|
||||
/* This is called continuously from the Wiimote plugin as soon as it has received
|
||||
a reporting mode. _Size is the byte size of the report. */
|
||||
void Callback_WiimoteInput(u16 _channelID, const void* _pData, u32 _Size)
|
||||
void Callback_WiimoteInput(int _number, u16 _channelID, const void* _pData, u32 _Size)
|
||||
{
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, "=========================================================");
|
||||
const u8* pData = (const u8*)_pData;
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, "Callback_WiimoteInput:");
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Data: %s", ArrayToString(pData, _Size, 0, 50).c_str());
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Channel: %u", _channelID);
|
||||
|
||||
s_Usb->m_WiiMotes[0].ReceiveL2capData(_channelID, _pData, _Size);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, "=========================================================");
|
||||
INFO_LOG(WIIMOTE, "==========================");
|
||||
INFO_LOG(WIIMOTE, "Callback_WiimoteInput: (Page: %i)", _number);
|
||||
DEBUG_LOG(WIIMOTE, " Data: %s", ArrayToString(pData, _Size, 0, 50).c_str());
|
||||
DEBUG_LOG(WIIMOTE, " Channel: %u", _channelID);
|
||||
|
||||
s_Usb->m_WiiMotes[_number].ReceiveL2capData(_channelID, _pData, _Size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ class CWII_IPC_HLE_WiiMote
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number);
|
||||
CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number, bool ready = false);
|
||||
|
||||
virtual ~CWII_IPC_HLE_WiiMote()
|
||||
{}
|
||||
@@ -193,7 +193,9 @@ public:
|
||||
// we really have to clean all this code
|
||||
|
||||
bool LinkChannel();
|
||||
bool IsConnected() const { return m_Connected; }
|
||||
void ResetChannels();
|
||||
void Activate(bool ready);
|
||||
bool IsConnected() const { return (m_Connected > 0) ? true : false; }
|
||||
bool IsLinked() const { return m_Linked; }
|
||||
void ShowStatus(const void* _pData); // Show status
|
||||
void UpdateStatus(); // Update status
|
||||
@@ -203,11 +205,10 @@ public:
|
||||
void EventConnectionAccepted();
|
||||
void EventDisconnect();
|
||||
bool EventPagingChanged(u8 _pageMode);
|
||||
void EventCommandWriteLinkPolicy();
|
||||
|
||||
const bdaddr_t& GetBD() const { return m_BD; }
|
||||
const uint8_t* GetClass() const { return uclass; }
|
||||
u16 GetConnectionHandle() const { return m_ControllerConnectionHandle; }
|
||||
u16 GetConnectionHandle() const { return m_ConnectionHandle; }
|
||||
const u8* GetFeatures() const { return features; }
|
||||
const char* GetName() const { return m_Name.c_str(); }
|
||||
u8 GetLMPVersion() const { return lmp_version; }
|
||||
@@ -218,7 +219,7 @@ public:
|
||||
private:
|
||||
|
||||
// state machine
|
||||
bool m_Connected;
|
||||
int m_Connected; // 0: ready, -1: inactive/connecting, 1: connected
|
||||
bool m_Linked;
|
||||
bool m_HIDControlChannel_Connected;
|
||||
bool m_HIDControlChannel_ConnectedWait;
|
||||
@@ -231,7 +232,7 @@ private:
|
||||
|
||||
// STATE_TO_SAVE
|
||||
bdaddr_t m_BD;
|
||||
u16 m_ControllerConnectionHandle;
|
||||
u16 m_ConnectionHandle;
|
||||
uint8_t uclass[HCI_CLASS_SIZE];
|
||||
u8 features[HCI_FEATURES_SIZE];
|
||||
u8 lmp_version;
|
||||
@@ -263,7 +264,7 @@ private:
|
||||
void SignalChannel(u8* _pData, u32 _Size);
|
||||
|
||||
void SendConnectionRequest(u16 _SCID, u16 _PSM);
|
||||
void SendConfigurationRequest(u16 _SCID, u16* _pMTU = NULL, u16* _pFlushTimeOut = NULL);
|
||||
void SendConfigurationRequest(u16 _SCID, u16 _pMTU = NULL, u16 _pFlushTimeOut = NULL);
|
||||
void SendDisconnectRequest(u16 _SCID);
|
||||
|
||||
void ReceiveConnectionReq(u8 _Ident, u8* _pData, u32 _Size);
|
||||
|
||||
@@ -286,7 +286,7 @@ void CConfigMain::CreateGUIControls()
|
||||
wxT("\nIt can be convenient in a Wii game that already has a cursor."));
|
||||
WiimoteStatusLEDs->SetToolTip(wxT("Show which wiimotes are connected in the statusbar."));
|
||||
WiimoteStatusSpeakers->SetToolTip(wxT("Show wiimote speaker status in the statusbar."));
|
||||
DSPThread->SetToolTip(wxT("Run DSPLLE on a dedicate thread, this has no affect on DSPHLE."));
|
||||
DSPThread->SetToolTip(wxT("Run DSPLLE on a dedicate thread, this has no effects on DSPHLE."));
|
||||
CPUThread->SetToolTip(wxT("This splits the Video and CPU threads, so they can be run on separate cores.")
|
||||
wxT("\nCauses major speed improvements on PCs with more than one core,")
|
||||
wxT("\nbut can also cause occasional crashes/glitches."));
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef void (*TLogv)(const char* _pMessage, int _v);
|
||||
|
||||
// This is called when the Wiimote sends input reports to the Core.
|
||||
// Payload: an L2CAP packet.
|
||||
typedef void (*TWiimoteInput)(u16 _channelID, const void* _pData, u32 _Size);
|
||||
typedef void (*TWiimoteInput)(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
// This data is passed from the core on initialization.
|
||||
typedef struct
|
||||
@@ -35,7 +35,7 @@ typedef struct
|
||||
// input: Da pakket.
|
||||
// output: none
|
||||
//
|
||||
EXPORT void CALL Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size);
|
||||
EXPORT void CALL Wiimote_ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// Function: Wiimote_Input
|
||||
@@ -44,7 +44,7 @@ EXPORT void CALL Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32
|
||||
// input: Da pakket.
|
||||
// output: none
|
||||
//
|
||||
EXPORT void CALL Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
|
||||
EXPORT void CALL Wiimote_InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// Function: Wiimote_Update
|
||||
@@ -52,7 +52,7 @@ EXPORT void CALL Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u3
|
||||
// input: none
|
||||
// output: none
|
||||
//
|
||||
EXPORT void CALL Wiimote_Update();
|
||||
EXPORT void CALL Wiimote_Update(int _number);
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// Function: PAD_GetAttachedPads
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "wiimote_hid.h"
|
||||
#include "Config.h"
|
||||
#include "EmuDefinitions.h" // for PadMapping
|
||||
#include "main.h"
|
||||
@@ -293,7 +293,7 @@ void Config::Load(bool ChangePad)
|
||||
iniFile.Get("Real", "AccNunNeutralY", &iAccNunNeutralY, 0);
|
||||
iniFile.Get("Real", "AccNunNeutralZ", &iAccNunNeutralZ, 0);
|
||||
|
||||
for (int i = 0; i < 1; i++) // Only got 1 wiimote yet
|
||||
for (int i = 0; i < MAX_WIIMOTES; i++)
|
||||
{
|
||||
// Slot specific settings
|
||||
char SectionName[32];
|
||||
@@ -404,7 +404,7 @@ void Config::Save(int Slot)
|
||||
iniFile.Set("Real", "AccNunNeutralY", iAccNunNeutralY);
|
||||
iniFile.Set("Real", "AccNunNeutralZ", iAccNunNeutralZ);
|
||||
|
||||
for (int i = 0; i < 1; i++) // Only got 1 wiimote yet
|
||||
for (int i = 0; i < MAX_WIIMOTES; i++)
|
||||
{
|
||||
// Slot specific settings
|
||||
char SectionName[32];
|
||||
|
||||
@@ -261,7 +261,7 @@ void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot)
|
||||
if(ChangePad)
|
||||
{
|
||||
// Since we are selecting the pad to save to by the Id we can't update it when we change the pad
|
||||
for(int i = 0; i < 1; i++) // Only got 1 wiimote yet
|
||||
for(int i = 0; i < MAX_WIIMOTES; i++)
|
||||
SaveButtonMapping(i, true);
|
||||
// Save the settings for the current pad
|
||||
// g_Config.Save(Slot);
|
||||
@@ -271,7 +271,7 @@ void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot)
|
||||
else
|
||||
{
|
||||
// Update PadMapping[] from the GUI controls
|
||||
for(int i = 0; i < 1; i++) // Only got 1 wiimote yet
|
||||
for(int i = 0; i < MAX_WIIMOTES; i++)
|
||||
SaveButtonMapping(i);
|
||||
// g_Config.Save(Slot);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void WmReportMode(u16 _channelID, wm_report_mode* dr)
|
||||
DEBUG_LOG(WIIMOTE, " All The Time: %x (not only on data change)", dr->all_the_time);
|
||||
DEBUG_LOG(WIIMOTE, " Mode: 0x%02x", dr->mode);
|
||||
|
||||
g_ReportingAuto = dr->all_the_time;
|
||||
g_ReportingAuto[g_RefreshWiimote] = dr->all_the_time;
|
||||
g_ReportingMode = dr->mode;
|
||||
g_ReportingChannel = _channelID;
|
||||
|
||||
@@ -114,8 +114,7 @@ void SendReportCore(u16 _channelID)
|
||||
DEBUG_LOG(WIIMOTE, " Channel: %04x", _channelID);
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, DataFrame, Offset);
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
@@ -140,7 +139,7 @@ void SendReportCoreAccel(u16 _channelID)
|
||||
DEBUG_LOG(WIIMOTE, " Channel: %04x", _channelID);
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
@@ -170,7 +169,7 @@ void SendReportCoreAccelIr12(u16 _channelID) {
|
||||
DEBUG_LOG(WIIMOTE, " Channel: %04x", _channelID);
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
@@ -215,7 +214,7 @@ void SendReportCoreAccelExt16(u16 _channelID)
|
||||
DEBUG_LOG(WIIMOTE, " Channel: %04x", _channelID);
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
@@ -269,7 +268,7 @@ void SendReportCoreAccelIr10Ext(u16 _channelID)
|
||||
DEBUG_LOG(WIIMOTE, " Channel: %04x", _channelID);
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace WiiMoteEmu
|
||||
// Definitions and variable declarations
|
||||
//******************************************************************************
|
||||
|
||||
u8 g_Leds;
|
||||
u8 g_Leds[4];
|
||||
u8 g_Speaker;
|
||||
u8 g_SpeakerVoice;
|
||||
u8 g_IR;
|
||||
@@ -48,7 +48,8 @@ u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
|
||||
u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
|
||||
u8 g_RegIr[WIIMOTE_REG_IR_SIZE];
|
||||
|
||||
bool g_ReportingAuto; // Auto report or passive report
|
||||
int g_RefreshWiimote; // Current refreshing Wiimote
|
||||
bool g_ReportingAuto[4]; // Auto report or passive report
|
||||
u8 g_ReportingMode; // The reporting mode and channel id
|
||||
u16 g_ReportingChannel;
|
||||
|
||||
@@ -69,6 +70,7 @@ KeyboardNunchuck g_NunchuckExt;
|
||||
KeyboardClassicController g_ClassicContExt;
|
||||
KeyboardGH3GLP g_GH3Ext;
|
||||
bool KeyStatus[64];
|
||||
SWiimoteData g_WiimoteData[4];
|
||||
} // namespace
|
||||
|
||||
#endif //_EMU_DECLARATIONS_
|
||||
|
||||
@@ -68,7 +68,7 @@ extern double g_RecordingCurrentTime[3];
|
||||
#define WIIMOTE_REG_EXT_SIZE 0x100
|
||||
#define WIIMOTE_REG_IR_SIZE 0x34
|
||||
|
||||
extern u8 g_Leds;
|
||||
extern u8 g_Leds[4];
|
||||
extern u8 g_Speaker;
|
||||
extern u8 g_SpeakerVoice;
|
||||
extern u8 g_IR;
|
||||
@@ -80,7 +80,8 @@ extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
|
||||
extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
|
||||
extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE];
|
||||
|
||||
extern bool g_ReportingAuto;
|
||||
extern int g_RefreshWiimote;
|
||||
extern bool g_ReportingAuto[4];
|
||||
extern u8 g_ReportingMode;
|
||||
extern u16 g_ReportingChannel;
|
||||
|
||||
@@ -187,6 +188,14 @@ struct STiltData
|
||||
}
|
||||
};
|
||||
|
||||
struct SWiimoteData
|
||||
{
|
||||
// Raw X and Y coordinate and processed X and Y coordinates
|
||||
SIR IR;
|
||||
STiltData TiltWM;
|
||||
STiltData TiltNC;
|
||||
};
|
||||
extern SWiimoteData g_WiimoteData[4];
|
||||
|
||||
// Keyboard input
|
||||
struct KeyboardWiimote
|
||||
@@ -204,10 +213,6 @@ struct KeyboardWiimote
|
||||
MA, MB,
|
||||
LAST_CONSTANT
|
||||
};
|
||||
|
||||
// Raw X and Y coordinate and processed X and Y coordinates
|
||||
SIR IR;
|
||||
STiltData TiltData;
|
||||
};
|
||||
extern KeyboardWiimote g_Wiimote_kbd;
|
||||
|
||||
@@ -215,12 +220,7 @@ struct KeyboardNunchuck
|
||||
{
|
||||
enum EKeyboardNunchuck
|
||||
{
|
||||
// This is not allowed in Linux so we have to set the starting value manually
|
||||
#ifdef _WIN32
|
||||
Z = g_Wiimote_kbd.LAST_CONSTANT,
|
||||
#else
|
||||
Z = 18,
|
||||
#endif
|
||||
Z = 18,
|
||||
C,
|
||||
L, R, U, D,
|
||||
ROLL_L, ROLL_R,
|
||||
@@ -228,8 +228,6 @@ struct KeyboardNunchuck
|
||||
SHAKE,
|
||||
LAST_CONSTANT
|
||||
};
|
||||
|
||||
STiltData TiltData;
|
||||
};
|
||||
extern KeyboardNunchuck g_NunchuckExt;
|
||||
|
||||
@@ -237,12 +235,7 @@ struct KeyboardClassicController
|
||||
{
|
||||
enum EKeyboardClassicController
|
||||
{
|
||||
// This is not allowed in Linux so we have to set the starting value manually
|
||||
#ifdef _WIN32
|
||||
A = g_NunchuckExt.LAST_CONSTANT,
|
||||
#else
|
||||
A = 29,
|
||||
#endif
|
||||
A = 29,
|
||||
B, X, Y,
|
||||
P, M, H,
|
||||
Tl, Tr, Zl, Zr,
|
||||
@@ -258,12 +251,7 @@ struct KeyboardGH3GLP
|
||||
{
|
||||
enum EKeyboardGH3GLP
|
||||
{
|
||||
// This is not allowed in Linux so we have to set the starting value manually
|
||||
#ifdef _WIN32
|
||||
Green = g_ClassicContExt.LAST_CONSTANT,
|
||||
#else
|
||||
Green = 52,
|
||||
#endif
|
||||
Green = 52,
|
||||
Red, Yellow, Blue, Orange,
|
||||
Plus, Minus, Whammy,
|
||||
Al, Ar, Au, Ad,
|
||||
|
||||
@@ -243,6 +243,7 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in
|
||||
// IR data functions
|
||||
//******************************************************************************
|
||||
|
||||
/*
|
||||
// Calculate dot positions from the basic 10 byte IR data
|
||||
void IRData2DotsBasic(u8 *Data)
|
||||
{
|
||||
@@ -260,7 +261,7 @@ void IRData2DotsBasic(u8 *Data)
|
||||
Dot[3].Rx = 1023 - (Data[8] | ((Data[7] & 0x03) << 8));
|
||||
Dot[3].Ry = Data[9] | ((Data[7] & 0x0c) << 6);
|
||||
|
||||
/* set each IR spot to visible if spot is in range */
|
||||
// set each IR spot to visible if spot is in range
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (Dot[i].Ry == 1023)
|
||||
@@ -270,7 +271,7 @@ void IRData2DotsBasic(u8 *Data)
|
||||
else
|
||||
{
|
||||
Dot[i].Visible = 1;
|
||||
Dot[i].Size = 0; /* since we don't know the size, set it as 0 */
|
||||
Dot[i].Size = 0; // since we don't know the size, set it as 0
|
||||
}
|
||||
|
||||
// For now we let our virtual resolution be the same as the default one
|
||||
@@ -281,8 +282,9 @@ void IRData2DotsBasic(u8 *Data)
|
||||
ReorderIRDots();
|
||||
IRData2Distance();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// Calculate dot positions from the extented 12 byte IR data
|
||||
void IRData2Dots(u8 *Data)
|
||||
{
|
||||
@@ -297,7 +299,7 @@ void IRData2Dots(u8 *Data)
|
||||
|
||||
Dot[i].Size = Data[(3*i)+2] & 0x0f;
|
||||
|
||||
/* if in range set to visible */
|
||||
// if in range set to visible
|
||||
if (Dot[i].Ry == 1023)
|
||||
Dot[i].Visible = false;
|
||||
else
|
||||
@@ -313,8 +315,9 @@ void IRData2Dots(u8 *Data)
|
||||
ReorderIRDots();
|
||||
IRData2Distance();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// Reorder the IR dots according to their x-axis value
|
||||
void ReorderIRDots()
|
||||
{
|
||||
@@ -347,8 +350,9 @@ void ReorderIRDots()
|
||||
Dot[i].Order = order;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// Calculate dot positions from the extented 12 byte IR data
|
||||
void IRData2Distance()
|
||||
{
|
||||
@@ -371,15 +375,15 @@ void IRData2Distance()
|
||||
// Only one dot was visible, we can not calculate the distance
|
||||
if (i2 == 4) { g_Wiimote_kbd.IR.Distance = 0; return; }
|
||||
|
||||
/* For the emulated Wiimote the y distance is always zero so then the distance is the
|
||||
simple distance between the x dots, i.e. the sensor bar width */
|
||||
// For the emulated Wiimote the y distance is always zero so then the distance is the
|
||||
// simple distance between the x dots, i.e. the sensor bar width
|
||||
int xd = Dot[i2].X - Dot[i1].X;
|
||||
int yd = Dot[i2].Y - Dot[i1].Y;
|
||||
|
||||
// Save the distance
|
||||
g_Wiimote_kbd.IR.Distance = (int)sqrt((float)(xd*xd) + (float)(yd*yd));
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
//******************************************************************************
|
||||
// Classic Controller functions
|
||||
|
||||
@@ -374,11 +374,17 @@ void ExtensionChecksum(u8 * Calibration)
|
||||
// Set initial valuesm this done both in Init and Shutdown
|
||||
void ResetVariables()
|
||||
{
|
||||
g_ReportingAuto = false;
|
||||
g_RefreshWiimote = 0;
|
||||
g_ReportingMode = 0;
|
||||
g_ReportingChannel = 0;
|
||||
g_Encryption = false;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
g_ReportingAuto[i] = false;
|
||||
memset(&g_WiimoteData[i], 0, sizeof(g_WiimoteData));
|
||||
}
|
||||
|
||||
// Set default recording values
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
for (int i = 0; i < 3; i++)
|
||||
@@ -469,7 +475,6 @@ void Initialize()
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
// TODO: Shorten the list
|
||||
p.Do(g_Leds);
|
||||
p.Do(g_Speaker);
|
||||
p.Do(g_SpeakerVoice);
|
||||
p.Do(g_IR);
|
||||
@@ -480,7 +485,6 @@ void DoState(PointerWrap &p)
|
||||
p.DoArray(g_RegExtTmp, WIIMOTE_REG_EXT_SIZE);
|
||||
p.DoArray(g_RegIr, WIIMOTE_REG_IR_SIZE);
|
||||
|
||||
p.Do(g_ReportingAuto);
|
||||
p.Do(g_ReportingMode);
|
||||
p.Do(g_ReportingChannel);
|
||||
|
||||
@@ -492,10 +496,16 @@ void DoState(PointerWrap &p)
|
||||
//p.Do(joyinfo);
|
||||
//p.DoArray(PadState, 4);
|
||||
//p.DoArray(PadMapping, 4);
|
||||
|
||||
//p.Do(g_Wiimote_kbd);
|
||||
//p.Do(g_NunchuckExt);
|
||||
//p.Do(g_ClassicContExt);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
p.Do(g_ReportingAuto[i]);
|
||||
p.Do(g_Leds[i]);
|
||||
p.Do(g_WiimoteData[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -515,8 +525,9 @@ void Shutdown()
|
||||
|
||||
/* This function produce Wiimote Input, i.e. reports from the Wiimote in
|
||||
response to Output from the Wii. */
|
||||
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||
void InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
|
||||
{
|
||||
g_RefreshWiimote = _number;
|
||||
/* Debugging. We have not yet decided how much of 'data' we will use, it's
|
||||
not determined by sizeof(data). We have to determine it by looking at
|
||||
the data cases. */
|
||||
@@ -524,7 +535,7 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||
|
||||
hid_packet* hidp = (hid_packet*)_pData;
|
||||
|
||||
INFO_LOG(WIIMOTE, "Emu InterruptChannel (type: 0x%02x, param: 0x%02x)", hidp->type, hidp->param);
|
||||
INFO_LOG(WIIMOTE, "Emu InterruptChannel (page: %i, type: 0x%02x, param: 0x%02x)", _number, hidp->type, hidp->param);
|
||||
|
||||
switch(hidp->type)
|
||||
{
|
||||
@@ -562,11 +573,13 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||
}
|
||||
|
||||
|
||||
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||
void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
|
||||
{
|
||||
g_RefreshWiimote = _number;
|
||||
|
||||
hid_packet* hidp = (hid_packet*)_pData;
|
||||
|
||||
INFO_LOG(WIIMOTE, "Emu ControlChannel (type: 0x%02x, param: 0x%02x)", hidp->type, hidp->param);
|
||||
INFO_LOG(WIIMOTE, "Emu ControlChannel (page: %i, type: 0x%02x, param: 0x%02x)", _number, hidp->type, hidp->param);
|
||||
|
||||
switch(hidp->type)
|
||||
{
|
||||
@@ -586,7 +599,7 @@ void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||
// (TO_BE_VERIFIED)
|
||||
//
|
||||
u8 handshake = 0;
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, &handshake, 1);
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, &handshake, 1);
|
||||
|
||||
PanicAlert("HID_TYPE_DATA - OUTPUT: Ambiguous Control Channel Report!");
|
||||
}
|
||||
@@ -608,13 +621,14 @@ void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||
documentation. I'm not sure exactly how often this function is called but I
|
||||
think it's tied to the frame rate of the game rather than a certain amount
|
||||
of times per second. */
|
||||
void Update()
|
||||
void Update(int _number)
|
||||
{
|
||||
if(g_ReportingAuto == false)
|
||||
if (g_ReportingAuto[_number] == false)
|
||||
return;
|
||||
|
||||
// Read input or not
|
||||
g_RefreshWiimote = _number;
|
||||
|
||||
// Read input or not
|
||||
if (g_Config.bInputActive)
|
||||
{
|
||||
ReadLinuxKeyboard();
|
||||
@@ -626,9 +640,8 @@ void Update()
|
||||
&& NumGoodPads > 0 && joyinfo.size() > (u32)PadMapping[0].ID)
|
||||
*/
|
||||
// Check if the pad state should be updated
|
||||
const int Page = 0;
|
||||
if (NumGoodPads > 0 && joyinfo.size() > (u32)PadMapping[Page].ID)
|
||||
WiiMoteEmu::GetJoyState(PadState[Page], PadMapping[Page], Page, joyinfo[PadMapping[Page].ID].NumButtons);
|
||||
if (NumGoodPads > 0 && joyinfo.size() > (u32)PadMapping[g_RefreshWiimote].ID)
|
||||
WiiMoteEmu::GetJoyState(PadState[g_RefreshWiimote], PadMapping[g_RefreshWiimote], g_RefreshWiimote, joyinfo[PadMapping[g_RefreshWiimote].ID].NumButtons);
|
||||
}
|
||||
|
||||
switch(g_ReportingMode)
|
||||
|
||||
@@ -38,9 +38,9 @@ void GetMousePos(float& x, float& y);
|
||||
void Initialize();
|
||||
void DoState(PointerWrap &p);
|
||||
void Shutdown();
|
||||
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
|
||||
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
|
||||
void Update();
|
||||
void InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size) ;
|
||||
void Update(int _number);
|
||||
void ReadLinuxKeyboard();
|
||||
|
||||
// Recordings
|
||||
@@ -68,8 +68,8 @@ void AdjustAngles(int &Roll, int &Pitch);
|
||||
void RotateIRDots(int &_x, int &_y, STiltData &_TiltData);
|
||||
void IRData2Dots(u8 *Data);
|
||||
void IRData2DotsBasic(u8 *Data);
|
||||
void ReorderIRDots();
|
||||
void IRData2Distance();
|
||||
//void ReorderIRDots();
|
||||
//void IRData2Distance();
|
||||
|
||||
// Classic Controller data
|
||||
std::string CCData2Values(u8 *Data);
|
||||
|
||||
@@ -164,7 +164,7 @@ void WmLeds(u16 _channelID, wm_leds* leds)
|
||||
{
|
||||
INFO_LOG(WIIMOTE, "Set LEDs: %x, Rumble: %x", leds->leds, leds->rumble);
|
||||
|
||||
g_Leds = leds->leds;
|
||||
g_Leds[g_RefreshWiimote] = leds->leds;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ void WmSendAck(u16 _channelID, u8 _reportID)
|
||||
DEBUG_LOG(WIIMOTE, "WMSendAck");
|
||||
DEBUG_LOG(WIIMOTE, " Report ID: %02x", _reportID);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
@@ -360,11 +360,11 @@ void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, int _Size)
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
std::string Temp = ArrayToString(DataFrame, Offset);
|
||||
ERROR_LOG(WIIMOTE, "Data: %s", Temp.c_str());
|
||||
DEBUG_LOG(WIIMOTE, "Data: %s", Temp.c_str());
|
||||
#endif
|
||||
|
||||
// Send a piece
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, DataFrame, Offset);
|
||||
|
||||
// Update the size that is left
|
||||
_Size -= copySize;
|
||||
@@ -482,7 +482,7 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs, int Extension)
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
FillReportInfo(pStatus->buttons);
|
||||
#endif
|
||||
pStatus->leds = g_Leds; // leds are 4 bit
|
||||
pStatus->leds = g_Leds[g_RefreshWiimote]; // leds are 4 bit
|
||||
pStatus->ir = g_IR; // 1 bit
|
||||
pStatus->speaker = g_Speaker; // 1 bit
|
||||
pStatus->battery_low = 0; // battery is okay
|
||||
@@ -514,7 +514,7 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs, int Extension)
|
||||
DEBUG_LOG(WIIMOTE, " Extension: %x", pStatus->extension);
|
||||
DEBUG_LOG(WIIMOTE, " Buttons: 0x%04x", pStatus->buttons);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||
g_WiimoteInitialize.pWiimoteInput(g_RefreshWiimote, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
|
||||
@@ -686,16 +686,16 @@ void TiltWiimote(int &_x, int &_y, int &_z)
|
||||
return;
|
||||
// Select input method and return the x, y, x values
|
||||
else if (g_Config.Tilt.TypeWM == g_Config.Tilt.KEYBOARD)
|
||||
TiltByKeyboardWM(g_Wiimote_kbd.TiltData);
|
||||
TiltByKeyboardWM(g_WiimoteData[g_RefreshWiimote].TiltWM);
|
||||
else
|
||||
TiltByGamepad(g_Wiimote_kbd.TiltData, g_Config.Tilt.TypeWM);
|
||||
TiltByGamepad(g_WiimoteData[g_RefreshWiimote].TiltWM, g_Config.Tilt.TypeWM);
|
||||
|
||||
// Adjust angles, it's only needed if both roll and pitch is used together
|
||||
if (g_Config.Tilt.Range.Roll != 0 && g_Config.Tilt.Range.Pitch != 0)
|
||||
AdjustAngles(g_Wiimote_kbd.TiltData.Roll, g_Wiimote_kbd.TiltData.Pitch);
|
||||
AdjustAngles(g_WiimoteData[g_RefreshWiimote].TiltWM.Roll, g_WiimoteData[g_RefreshWiimote].TiltWM.Pitch);
|
||||
|
||||
// Calculate the accelerometer value from this tilt angle
|
||||
TiltToAccelerometer(_x, _y, _z, g_Wiimote_kbd.TiltData);
|
||||
TiltToAccelerometer(_x, _y, _z, g_WiimoteData[g_RefreshWiimote].TiltWM);
|
||||
|
||||
//DEBUG_LOG(WIIMOTE, "Roll:%i, Pitch:%i, _x:%u, _y:%u, _z:%u", g_Wiimote_kbd.TiltData.Roll, g_Wiimote_kbd.TiltData.Pitch, _x, _y, _z);
|
||||
}
|
||||
@@ -708,16 +708,16 @@ void TiltNunchuck(int &_x, int &_y, int &_z)
|
||||
return;
|
||||
// Select input method and return the x, y, x values
|
||||
else if (g_Config.Tilt.TypeNC == g_Config.Tilt.KEYBOARD)
|
||||
TiltByKeyboardNC(g_NunchuckExt.TiltData);
|
||||
TiltByKeyboardNC(g_WiimoteData[g_RefreshWiimote].TiltNC);
|
||||
else
|
||||
TiltByGamepad(g_NunchuckExt.TiltData, g_Config.Tilt.TypeNC);
|
||||
TiltByGamepad(g_WiimoteData[g_RefreshWiimote].TiltNC, g_Config.Tilt.TypeNC);
|
||||
|
||||
// Adjust angles, it's only needed if both roll and pitch is used together
|
||||
if (g_Config.Tilt.Range.Roll != 0 && g_Config.Tilt.Range.Pitch != 0)
|
||||
AdjustAngles(g_NunchuckExt.TiltData.Roll, g_NunchuckExt.TiltData.Pitch);
|
||||
AdjustAngles(g_WiimoteData[g_RefreshWiimote].TiltNC.Roll, g_WiimoteData[g_RefreshWiimote].TiltNC.Pitch);
|
||||
|
||||
// Calculate the accelerometer value from this tilt angle
|
||||
TiltToAccelerometer(_x, _y, _z, g_NunchuckExt.TiltData);
|
||||
TiltToAccelerometer(_x, _y, _z, g_WiimoteData[g_RefreshWiimote].TiltNC);
|
||||
|
||||
//DEBUG_LOG(WIIMOTE, "Roll:%i, Pitch:%i, _x:%u, _y:%u, _z:%u", g_NunchuckExt.TiltData.Roll, g_NunchuckExt.TiltData.Pitch, _x, _y, _z);
|
||||
}
|
||||
@@ -745,11 +745,11 @@ void FillReportAcc(wm_accel& _acc)
|
||||
|
||||
// Adjust position, also add some noise to prevent disconnection
|
||||
if (!g_Config.bUpright)
|
||||
_acc.z += g_wm.cal_g.z + g_Wiimote_kbd.TiltData.FakeNoise;
|
||||
_acc.z += g_wm.cal_g.z + g_WiimoteData[g_RefreshWiimote].TiltWM.FakeNoise;
|
||||
else // Upright wiimote
|
||||
_acc.y -= g_wm.cal_g.y + g_Wiimote_kbd.TiltData.FakeNoise;
|
||||
_acc.y -= g_wm.cal_g.y + g_WiimoteData[g_RefreshWiimote].TiltWM.FakeNoise;
|
||||
|
||||
g_Wiimote_kbd.TiltData.FakeNoise = -g_Wiimote_kbd.TiltData.FakeNoise;
|
||||
g_WiimoteData[g_RefreshWiimote].TiltWM.FakeNoise = -g_WiimoteData[g_RefreshWiimote].TiltWM.FakeNoise;
|
||||
|
||||
if (IsFocus())
|
||||
{
|
||||
@@ -757,14 +757,14 @@ void FillReportAcc(wm_accel& _acc)
|
||||
int acc_y = _acc.y;
|
||||
int acc_z = _acc.z;
|
||||
|
||||
if (IsKey(g_Wiimote_kbd.SHAKE) && g_Wiimote_kbd.TiltData.Shake == 0)
|
||||
g_Wiimote_kbd.TiltData.Shake = 1;
|
||||
if (IsKey(g_Wiimote_kbd.SHAKE) && g_WiimoteData[g_RefreshWiimote].TiltWM.Shake == 0)
|
||||
g_WiimoteData[g_RefreshWiimote].TiltWM.Shake = 1;
|
||||
|
||||
// Step the shake simulation one step
|
||||
ShakeToAccelerometer(acc_x, acc_y, acc_z, g_Wiimote_kbd.TiltData);
|
||||
ShakeToAccelerometer(acc_x, acc_y, acc_z, g_WiimoteData[g_RefreshWiimote].TiltWM);
|
||||
|
||||
// Tilt Wiimote, allow the shake function to interrupt it
|
||||
if (g_Wiimote_kbd.TiltData.Shake == 0)
|
||||
if (g_WiimoteData[g_RefreshWiimote].TiltWM.Shake == 0)
|
||||
TiltWiimote(acc_x, acc_y, acc_z);
|
||||
|
||||
// Boundary check
|
||||
@@ -916,8 +916,8 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
|
||||
int x0 = 1023 - g_Config.iIRLeft - g_Config.iIRWidth * MouseX - SENSOR_BAR_WIDTH / 2;
|
||||
int x1 = x0 + SENSOR_BAR_WIDTH;
|
||||
|
||||
RotateIRDot(x0, y0, g_Wiimote_kbd.TiltData);
|
||||
RotateIRDot(x1, y1, g_Wiimote_kbd.TiltData);
|
||||
RotateIRDot(x0, y0, g_WiimoteData[g_RefreshWiimote].TiltWM);
|
||||
RotateIRDot(x1, y1, g_WiimoteData[g_RefreshWiimote].TiltWM);
|
||||
|
||||
// Converted to IR data
|
||||
_ir0.x = x0 & 0xff; _ir0.xHi = x0 >> 8;
|
||||
@@ -993,8 +993,8 @@ void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1)
|
||||
int x1 = 1023 - g_Config.iIRLeft - g_Config.iIRWidth * MouseX - SENSOR_BAR_WIDTH / 2;
|
||||
int x2 = x1 + SENSOR_BAR_WIDTH;
|
||||
|
||||
RotateIRDot(x1, y1, g_Wiimote_kbd.TiltData);
|
||||
RotateIRDot(x2, y2, g_Wiimote_kbd.TiltData);
|
||||
RotateIRDot(x1, y1, g_WiimoteData[g_RefreshWiimote].TiltWM);
|
||||
RotateIRDot(x2, y2, g_WiimoteData[g_RefreshWiimote].TiltWM);
|
||||
|
||||
/* As with the extented report we settle with emulating two out of four
|
||||
possible objects the only difference is that we don't report any size of
|
||||
@@ -1082,14 +1082,14 @@ if (IsFocus())
|
||||
int acc_y = _ext.ay;
|
||||
int acc_z = _ext.az;
|
||||
|
||||
if (IsKey(g_NunchuckExt.SHAKE) && g_NunchuckExt.TiltData.Shake == 0)
|
||||
g_NunchuckExt.TiltData.Shake = 1;
|
||||
if (IsKey(g_NunchuckExt.SHAKE) && g_WiimoteData[g_RefreshWiimote].TiltNC.Shake == 0)
|
||||
g_WiimoteData[g_RefreshWiimote].TiltNC.Shake = 1;
|
||||
|
||||
// Step the shake simulation one step
|
||||
ShakeToAccelerometer(acc_x, acc_y, acc_z, g_NunchuckExt.TiltData);
|
||||
ShakeToAccelerometer(acc_x, acc_y, acc_z, g_WiimoteData[g_RefreshWiimote].TiltNC);
|
||||
|
||||
// Tilt Nunchuck, allow the shake function to interrupt it
|
||||
if (g_NunchuckExt.TiltData.Shake == 0)
|
||||
if (g_WiimoteData[g_RefreshWiimote].TiltNC.Shake == 0)
|
||||
TiltNunchuck(acc_x, acc_y, acc_z);
|
||||
|
||||
// Boundary check
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user