mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Fix wiimote in homebrew
Marginally speed up old wiimote plugin by doing less memcpys A lot of changes went into the bt dongle emulation, so please test for regressions :) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6177 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -1206,14 +1206,6 @@
|
||||
<Filter
|
||||
Name="IPC HLE"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\hci.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\l2cap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE.cpp"
|
||||
>
|
||||
@@ -1226,22 +1218,10 @@
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_Error.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_stm.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_usb.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_usb.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Keyboard"
|
||||
>
|
||||
@@ -1255,8 +1235,24 @@
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="WiiMote"
|
||||
Name="USB/BT/Wiimote"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\hci.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\l2cap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_usb.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_usb.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_WiiMote.cpp"
|
||||
>
|
||||
@@ -1298,18 +1294,6 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="FileIO"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_FileIO.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_FileIO.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="DI -DVD Interface"
|
||||
>
|
||||
@@ -1337,6 +1321,14 @@
|
||||
<Filter
|
||||
Name="FS"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_FileIO.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_FileIO.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\WII_IPC_HLE_Device_fs.cpp"
|
||||
>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,7 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _WII_IPC_HLE_DEVICE_USB_H_
|
||||
#define _WII_IPC_HLE_DEVICE_USB_H_
|
||||
#pragma once
|
||||
|
||||
#include "hci.h"
|
||||
#include <vector>
|
||||
@@ -25,21 +24,6 @@
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
#include "WII_IPC_HLE_WiiMote.h"
|
||||
|
||||
#define HCI_MAX_SIZE 128
|
||||
#define ACL_MAX_SIZE 128
|
||||
|
||||
union UACLHeader
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned ConnectionHandle : 12;
|
||||
unsigned PBFlag : 2;
|
||||
unsigned BCFlag : 2;
|
||||
unsigned Size : 16;
|
||||
};
|
||||
u32 Hex;
|
||||
};
|
||||
|
||||
struct SQueuedEvent
|
||||
{
|
||||
u8 m_buffer[1024];
|
||||
@@ -55,6 +39,7 @@ struct SQueuedEvent
|
||||
// i know this code sux...
|
||||
PanicAlert("SQueuedEvent: allocate too big buffer!!");
|
||||
}
|
||||
memset(m_buffer, 0, 1024);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -66,7 +51,6 @@ struct SQueuedEvent
|
||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_usb_oh1_57e_305();
|
||||
@@ -79,16 +63,13 @@ public:
|
||||
|
||||
virtual u32 Update();
|
||||
|
||||
// Send ACL data back to bt stack
|
||||
void SendACLPacket(u16 _ConnectionHandle, u8* _pData, u32 _Size);
|
||||
void PurgeACLPool();
|
||||
void PurgeHCIPool();
|
||||
|
||||
bool RemoteDisconnect(u16 _connectionHandle);
|
||||
|
||||
//hack for wiimote plugin
|
||||
|
||||
public:
|
||||
|
||||
// hack for wiimote plugin
|
||||
public:
|
||||
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
|
||||
CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr);
|
||||
CWII_IPC_HLE_WiiMote* AccessWiiMote(u16 _ConnectionHandle);
|
||||
@@ -98,28 +79,22 @@ public:
|
||||
void NetPlay_WiimoteUpdate(int _number);
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
enum USBIOCtl
|
||||
{
|
||||
USB_IOCTL_HCI_COMMAND_MESSAGE = 0,
|
||||
USB_IOCTL_BLKMSG = 1,
|
||||
USB_IOCTL_INTRMSG = 2,
|
||||
USB_IOCTL_SUSPENDDEV = 5,
|
||||
USB_IOCTL_RESUMEDEV = 6,
|
||||
USB_IOCTL_GETDEVLIST = 12,
|
||||
USB_IOCTL_DEVREMOVALHOOK = 26,
|
||||
USB_IOCTL_DEVINSERTHOOK = 27,
|
||||
USBV0_IOCTL_CTRLMSG = 0,
|
||||
USBV0_IOCTL_BLKMSG = 1,
|
||||
USBV0_IOCTL_INTRMSG = 2,
|
||||
};
|
||||
|
||||
enum
|
||||
enum USBEndpoint
|
||||
{
|
||||
HCI_EVENT_ENDPOINT = 0x81,
|
||||
ACL_DATA_BLK_OUT = 0x02,
|
||||
ACL_DATA_ENDPOINT = 0x82,
|
||||
HCI_CTRL = 0x00,
|
||||
HCI_EVENT = 0x81,
|
||||
ACL_DATA_IN = 0x82,
|
||||
ACL_DATA_OUT = 0x02
|
||||
};
|
||||
|
||||
|
||||
struct SHCICommandMessage
|
||||
struct SHCICommandMessage
|
||||
{
|
||||
u8 bRequestType;
|
||||
u8 bRequest;
|
||||
@@ -132,75 +107,75 @@ private:
|
||||
u32 m_Address;
|
||||
};
|
||||
|
||||
struct ACLPool
|
||||
{
|
||||
u32 m_number;
|
||||
u8 m_data[ACL_MAX_SIZE * 16];
|
||||
|
||||
ACLPool(int num)
|
||||
: m_number(num)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct HCIPool
|
||||
{
|
||||
u32 m_number;
|
||||
u8 m_data[HCI_MAX_SIZE * 16];
|
||||
u8 m_size[16];
|
||||
|
||||
HCIPool(int num)
|
||||
: m_number(num)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct CtrlBuffer
|
||||
// This is a lightweight/specialized version of SIOCtlVBuffer
|
||||
struct CtrlBuffer
|
||||
{
|
||||
u32 m_address;
|
||||
u32 m_buffer;
|
||||
|
||||
CtrlBuffer(u32 _Address)
|
||||
: m_address(_Address)
|
||||
CtrlBuffer(u32 _Address) : m_address(_Address), m_buffer()
|
||||
{
|
||||
if(_Address == 0)
|
||||
if (m_address)
|
||||
{
|
||||
m_buffer = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 _BufferVector = Memory::Read_U32(_Address + 0x18);
|
||||
u32 _InBufferNum = Memory::Read_U32(_Address + 0x10);
|
||||
m_buffer = Memory::Read_U32(_BufferVector + _InBufferNum * 8);
|
||||
u32 InBufferNum = Memory::Read_U32(m_address + 0x10);
|
||||
u32 BufferVector = Memory::Read_U32(m_address + 0x18);
|
||||
m_buffer = Memory::Read_U32(
|
||||
BufferVector + InBufferNum * sizeof(SIOCtlVBuffer::SBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
inline void FillBuffer(const void* src, const size_t size) const
|
||||
{
|
||||
memcpy(Memory::GetPointer(m_buffer), src, size);
|
||||
}
|
||||
|
||||
inline void SetRetVal(const u32 retval) const
|
||||
{
|
||||
Memory::Write_U32(retval, m_address + 4);
|
||||
}
|
||||
|
||||
inline bool IsValid() const
|
||||
{
|
||||
return m_address != 0;
|
||||
}
|
||||
|
||||
inline void Invalidate()
|
||||
{
|
||||
m_address = m_buffer = 0;
|
||||
}
|
||||
};
|
||||
|
||||
bdaddr_t m_ControllerBD;
|
||||
u8 m_ClassOfDevice[HCI_CLASS_SIZE];
|
||||
char m_LocalName[HCI_UNIT_NAME_SIZE];
|
||||
u8 m_PINType;
|
||||
|
||||
// this is used to trigger connecting via ACL
|
||||
u8 m_ScanEnable;
|
||||
|
||||
u8 m_EventFilterType;
|
||||
u8 m_EventFilterCondition;
|
||||
|
||||
u16 m_HostMaxACLSize;
|
||||
u8 m_HostMaxSCOSize;
|
||||
u16 m_HostNumACLPackets;
|
||||
u16 m_HostNumSCOPackets;
|
||||
|
||||
// STATE_TO_SAVE
|
||||
SHCICommandMessage m_CtrlSetup;
|
||||
CtrlBuffer m_HCIEndpoint;
|
||||
std::queue<SQueuedEvent> m_EventQueue;
|
||||
|
||||
u32 m_ACLSetup;
|
||||
CtrlBuffer m_HCIBuffer;
|
||||
HCIPool m_HCIPool;
|
||||
CtrlBuffer m_ACLBuffer;
|
||||
ACLPool m_ACLPool;
|
||||
u32 m_LastCmd;
|
||||
CtrlBuffer m_ACLEndpoint;
|
||||
struct ACLQ
|
||||
{
|
||||
u8* m_buffer;
|
||||
size_t m_size;
|
||||
u16 m_conn_handle;
|
||||
ACLQ(const u8* data, const size_t size, const u16 conn_handle)
|
||||
: m_size(size), m_conn_handle(conn_handle)
|
||||
{
|
||||
m_buffer = new u8[m_size];
|
||||
memcpy(m_buffer, data, m_size);
|
||||
}
|
||||
};
|
||||
std::queue<ACLQ> m_ACLQ;
|
||||
|
||||
u32 m_PacketCount[4];
|
||||
u32 m_FreqDividerMote;
|
||||
u32 m_FreqDividerSync;
|
||||
u32 m_WiimoteUpdate_Freq;
|
||||
u32 m_NumCompPackets_Freq;
|
||||
|
||||
// Send ACL data to a device (wiimote)
|
||||
void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size);
|
||||
|
||||
// Events
|
||||
void AddEventToQueue(const SQueuedEvent& _event);
|
||||
@@ -216,12 +191,12 @@ private:
|
||||
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(const bdaddr_t& _bd);
|
||||
bool SendEventLinkKeyNotification(const CWII_IPC_HLE_WiiMote& _rWiiMote);
|
||||
bool SendEventLinkKeyNotification(const u8 num_to_send);
|
||||
|
||||
// Execute HCI Message
|
||||
void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage);
|
||||
@@ -271,45 +246,6 @@ private:
|
||||
void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size);
|
||||
void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size);
|
||||
|
||||
void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size);
|
||||
|
||||
// Debugging
|
||||
void LOG_LinkKey(const u8* _pLinkKey);
|
||||
};
|
||||
|
||||
class CWII_IPC_HLE_Device_usb_oh0 : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_usb_oh0(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_usb_oh0();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
virtual bool Close(u32 _CommandAddress, bool _bForce); // hermes' dsp demo
|
||||
|
||||
virtual bool IOCtlV(u32 _CommandAddress);
|
||||
virtual bool IOCtl(u32 _CommandAddress);
|
||||
|
||||
// virtual u32 Update();
|
||||
};
|
||||
|
||||
|
||||
// Addresses Human Interface Devices via the Wii's USB 2.0 ports.
|
||||
// Used by Rock Band 1 + 2 instruments.
|
||||
class CWII_IPC_HLE_Device_usb_hid : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_usb_hid(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
virtual ~CWII_IPC_HLE_Device_usb_hid();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
virtual bool Close(u32 _CommandAddress, bool _bForce);
|
||||
|
||||
virtual bool IOCtlV(u32 _CommandAddress);
|
||||
virtual bool IOCtl(u32 _CommandAddress);
|
||||
|
||||
// virtual u32 Update();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,111 +26,6 @@ class CWII_IPC_HLE_Device_usb_oh1_57e_305;
|
||||
|
||||
CWII_IPC_HLE_Device_usb_oh1_57e_305* GetUsbPointer();
|
||||
|
||||
enum
|
||||
{
|
||||
SDP_CHANNEL = 0x01,
|
||||
HID_CONTROL_CHANNEL = 0x11,
|
||||
HID_INTERRUPT_CHANNEL= 0x13,
|
||||
|
||||
// L2CAP command codes
|
||||
L2CAP_COMMAND_REJ = 0x01,
|
||||
L2CAP_CONN_REQ = 0x02,
|
||||
L2CAP_CONN_RSP = 0x03,
|
||||
L2CAP_CONF_REQ = 0x04,
|
||||
L2CAP_CONF_RSP = 0x05,
|
||||
L2CAP_DISCONN_REQ = 0x06,
|
||||
L2CAP_DISCONN_RSP = 0x07,
|
||||
L2CAP_ECHO_REQ = 0x08,
|
||||
L2CAP_ECHO_RSP = 0x09,
|
||||
L2CAP_INFO_REQ = 0x0a,
|
||||
L2CAP_INFO_RSP = 0x0b,
|
||||
|
||||
// connect result
|
||||
L2CAP_CR_SUCCESS = 0x0000,
|
||||
L2CAP_CR_PEND = 0x0001,
|
||||
L2CAP_CR_BAD_PSM = 0x0002,
|
||||
L2CAP_CR_SEC_BLOCK = 0x0003,
|
||||
L2CAP_CR_NO_MEM = 0x0004,
|
||||
|
||||
//connect status
|
||||
L2CAP_CS_NO_INFO = 0x0000,
|
||||
L2CAP_CS_AUTHEN_PEND = 0x0001,
|
||||
L2CAP_CS_AUTHOR_PEND = 0x0002,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct SL2CAP_Header
|
||||
{
|
||||
u16 Length;
|
||||
u16 CID;
|
||||
};
|
||||
|
||||
struct SL2CAP_Command
|
||||
{
|
||||
u8 code;
|
||||
u8 ident;
|
||||
u16 len;
|
||||
};
|
||||
|
||||
struct SL2CAP_CommandConnectionReq // 0x02
|
||||
{
|
||||
u16 psm;
|
||||
u16 scid;
|
||||
};
|
||||
|
||||
struct SL2CAP_ConnectionResponse // 0x03
|
||||
{
|
||||
u16 dcid;
|
||||
u16 scid;
|
||||
u16 result;
|
||||
u16 status;
|
||||
};
|
||||
|
||||
struct SL2CAP_Options
|
||||
{
|
||||
u8 type;
|
||||
u8 length;
|
||||
};
|
||||
|
||||
struct SL2CAP_OptionsMTU
|
||||
{
|
||||
u16 MTU;
|
||||
};
|
||||
|
||||
struct SL2CAP_OptionsFlushTimeOut
|
||||
{
|
||||
u16 TimeOut;
|
||||
};
|
||||
|
||||
struct SL2CAP_CommandConfigurationReq // 0x04
|
||||
{
|
||||
u16 dcid;
|
||||
u16 flags;
|
||||
};
|
||||
|
||||
struct SL2CAP_CommandConfigurationResponse // 0x05
|
||||
{
|
||||
u16 scid;
|
||||
u16 flags;
|
||||
u16 result;
|
||||
};
|
||||
|
||||
struct SL2CAP_CommandDisconnectionReq // 0x06
|
||||
{
|
||||
u16 dcid;
|
||||
u16 scid;
|
||||
};
|
||||
|
||||
struct SL2CAP_CommandDisconnectionResponse // 0x07
|
||||
{
|
||||
u16 dcid;
|
||||
u16 scid;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
class CBigEndianBuffer
|
||||
{
|
||||
public:
|
||||
@@ -163,7 +58,7 @@ public:
|
||||
// ugly Host handling....
|
||||
// we really have to clean all this code
|
||||
|
||||
int IsConnected() const { return m_Connected; }
|
||||
bool IsConnected() const { return m_ConnectionState == CONN_COMPLETE; }
|
||||
bool LinkChannel();
|
||||
void ResetChannels();
|
||||
void Activate(bool ready);
|
||||
@@ -188,8 +83,14 @@ public:
|
||||
const u8* GetLinkKey() const { return m_LinkKey; }
|
||||
|
||||
private:
|
||||
// -1: inactive, 0: ready, 1: connecting 2: linking 3: connected & linked
|
||||
int m_Connected;
|
||||
enum ConnectionState
|
||||
{
|
||||
CONN_INACTIVE = -1,
|
||||
CONN_READY,
|
||||
CONN_LINKING,
|
||||
CONN_COMPLETE
|
||||
};
|
||||
ConnectionState m_ConnectionState;
|
||||
|
||||
bool m_HIDControlChannel_Connected;
|
||||
bool m_HIDControlChannel_ConnectedWait;
|
||||
@@ -207,7 +108,7 @@ private:
|
||||
u8 features[HCI_FEATURES_SIZE];
|
||||
u8 lmp_version;
|
||||
u16 lmp_subversion;
|
||||
u8 m_LinkKey[16];
|
||||
u8 m_LinkKey[HCI_KEY_SIZE];
|
||||
std::string m_Name;
|
||||
CWII_IPC_HLE_Device_usb_oh1_57e_305* m_pHost;
|
||||
|
||||
|
||||
+1486
-1487
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1335,13 +1335,13 @@ void CFrame::UpdateGUI()
|
||||
if (Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->
|
||||
AccessWiiMote(0x0100)->IsConnected() == 3);
|
||||
AccessWiiMote(0x0100)->IsConnected());
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(GetUsbPointer()->
|
||||
AccessWiiMote(0x0101)->IsConnected() == 3);
|
||||
AccessWiiMote(0x0101)->IsConnected());
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(GetUsbPointer()->
|
||||
AccessWiiMote(0x0102)->IsConnected() == 3);
|
||||
AccessWiiMote(0x0102)->IsConnected());
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(GetUsbPointer()->
|
||||
AccessWiiMote(0x0103)->IsConnected() == 3);
|
||||
AccessWiiMote(0x0103)->IsConnected());
|
||||
}
|
||||
|
||||
if (Running)
|
||||
|
||||
@@ -117,8 +117,6 @@ void SendReportCore(u16 _channelID)
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(g_ID, _channelID, DataFrame, Offset);
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,9 +140,6 @@ void SendReportCoreAccel(u16 _channelID)
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(g_ID, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,9 +166,6 @@ void SendReportCoreAccelIr12(u16 _channelID) {
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(g_ID, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,9 +208,6 @@ void SendReportCoreAccelExt16(u16 _channelID)
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(g_ID, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -291,9 +280,6 @@ void SendReportCoreAccelIr10Ext(u16 _channelID)
|
||||
DEBUG_LOG(WIIMOTE, " Size: %08x", Offset);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(g_ID, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -605,11 +605,6 @@ void DoState(PointerWrap &p)
|
||||
response to Output from the Wii. */
|
||||
void InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
|
||||
{
|
||||
/* 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. */
|
||||
//InterruptDebugging(true, (const void*)_pData);
|
||||
|
||||
g_ID = _number;
|
||||
|
||||
hid_packet* hidp = (hid_packet*)_pData;
|
||||
@@ -673,13 +668,11 @@ void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
|
||||
else
|
||||
{
|
||||
// AyuanX: My experiment shows Control Channel is never used
|
||||
// shuffle2: but homebrew uses this, so we'll do what we must :)
|
||||
// shuffle2: but lwbt uses this, so we'll do what we must :)
|
||||
HidOutputReport(_channelID, (wm_report*)hidp->data);
|
||||
|
||||
u8 handshake = HID_HANDSHAKE_SUCCESS;
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(g_ID, _channelID, &handshake, 1);
|
||||
|
||||
PanicAlert("HID_TYPE_DATA - OUTPUT: Ambiguous Control Channel Report!");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -179,9 +179,6 @@ void WmSendAck(u16 _channelID, u8 _reportID)
|
||||
DEBUG_LOG(WIIMOTE, " Report ID: %02x", _reportID);
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(g_ID, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -367,9 +364,6 @@ void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _AddressHI,
|
||||
|
||||
// Update the size that is left
|
||||
_Size -= copySize;
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,9 +536,6 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs, int Extension)
|
||||
|
||||
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(g_ID, _channelID, DataFrame, Offset);
|
||||
|
||||
// Debugging
|
||||
//ReadDebugging(true, DataFrame, Offset);
|
||||
}
|
||||
|
||||
//http://snzgoo.blogspot.com for more details on what this is doing
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include <iostream> // System
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "CommonTypes.h"
|
||||
@@ -30,10 +30,8 @@
|
||||
#include <X11/XKBlib.h>
|
||||
extern Display* WMdisplay;
|
||||
#endif
|
||||
// Definitions and declarations
|
||||
|
||||
bool IsFocus();
|
||||
//void InterruptDebugging(bool Emu, const void* _pData);
|
||||
//void ReadDebugging(bool Emu, const void* _pData, int Size);
|
||||
|
||||
// Movement recording
|
||||
#define RECORDING_ROWS 15
|
||||
|
||||
@@ -127,10 +127,6 @@ void SendData(u16 _channelID, const u8* _pData, u32 _Size)
|
||||
memcpy(WriteEvent.m_PayLoad, _pData, _Size);
|
||||
WriteEvent._Size = _Size;
|
||||
m_EventWriteQueue.push(WriteEvent);
|
||||
|
||||
// Debugging
|
||||
//std::string Temp = ArrayToString(WriteEvent.m_PayLoad, 28, 0, 30);
|
||||
//DEBUG_LOG(WIIMOTE, "Wiimote Write:\n%s", Temp.c_str());
|
||||
}
|
||||
m_pCriticalSection->Leave();
|
||||
}
|
||||
@@ -147,9 +143,10 @@ void ReadData()
|
||||
// Send data to the Wiimote
|
||||
if (!m_EventWriteQueue.empty())
|
||||
{
|
||||
//DEBUG_LOG(WIIMOTE, "Writing data to the Wiimote");
|
||||
SEvent& rEvent = m_EventWriteQueue.front();
|
||||
const SEvent& rEvent = m_EventWriteQueue.front();
|
||||
wiiuse_io_write(m_pWiiMote, (byte*)rEvent.m_PayLoad, rEvent._Size);
|
||||
//std::string Temp = ArrayToString(rEvent.m_PayLoad, rEvent._Size);
|
||||
//DEBUG_LOG(WIIMOTE, "Wiimote Write:\n%s:%d", Temp.c_str(), ret);
|
||||
#ifdef _WIN32
|
||||
if (m_pWiiMote->event == WIIUSE_UNEXPECTED_DISCONNECT)
|
||||
{
|
||||
@@ -157,8 +154,6 @@ void ReadData()
|
||||
}
|
||||
#endif
|
||||
m_EventWriteQueue.pop();
|
||||
|
||||
// InterruptDebugging(false, rEvent.m_PayLoad);
|
||||
}
|
||||
|
||||
m_pCriticalSection->Leave();
|
||||
@@ -168,6 +163,8 @@ void ReadData()
|
||||
if (wiiuse_io_read(m_pWiiMote))
|
||||
{
|
||||
const byte* pBuffer = m_pWiiMote->event_buf;
|
||||
//std::string Temp = ArrayToString(pBuffer, 20);
|
||||
//DEBUG_LOG(WIIMOTE, "Wiimote Read:\n%s", Temp.c_str());
|
||||
// Check if we have a channel (connection) if so save the data...
|
||||
if (m_channelID > 0)
|
||||
{
|
||||
@@ -191,6 +188,8 @@ void ReadData()
|
||||
}
|
||||
m_pCriticalSection->Leave();
|
||||
}
|
||||
|
||||
memset((void*)&m_pWiiMote->event_buf,0,sizeof(m_pWiiMote->event_buf));
|
||||
}
|
||||
#ifdef _WIN32
|
||||
else if (m_pWiiMote->event == WIIUSE_UNEXPECTED_DISCONNECT)
|
||||
@@ -277,9 +276,6 @@ void SendEvent(SEvent& _rEvent)
|
||||
|
||||
// Send it
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(m_WiimoteNumber, m_channelID, Buffer, Offset);
|
||||
|
||||
// Debugging
|
||||
// ReadDebugging(false, Buffer, Offset);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -541,8 +537,14 @@ void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u3
|
||||
|
||||
void ControlChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size)
|
||||
{
|
||||
//DEBUG_LOG(WIIMOTE, "Real ControlChannel on WiiMote #%i", _WiimoteNumber);
|
||||
g_WiiMotes[_WiimoteNumber]->SendData(_channelID, (const u8*)_pData, _Size);
|
||||
|
||||
const hid_packet* const hidp = (hid_packet*)_pData;
|
||||
if (hidp->type == HID_TYPE_SET_REPORT)
|
||||
{
|
||||
u8 handshake_ok = HID_HANDSHAKE_SUCCESS;
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(_WiimoteNumber, _channelID, &handshake_ok, sizeof(handshake_ok));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -68,9 +68,6 @@ void Wiimote::ReportMode(const wm_report_mode* const dr)
|
||||
// reset IR camera
|
||||
//memset(m_reg_ir, 0, sizeof(*m_reg_ir)); //ugly hack
|
||||
|
||||
if (false == m_reporting_auto)
|
||||
PanicAlert("Wiimote: Reporting is set to OFF! Everything should be fine, but games never do this.");
|
||||
|
||||
if (dr->mode > 0x37)
|
||||
PanicAlert("Wiimote: Unsupported Reporting mode.");
|
||||
else if (dr->mode < WM_REPORT_CORE)
|
||||
|
||||
@@ -763,7 +763,7 @@ void Wiimote::ControlChannel(const u16 _channelID, const void* _pData, u32 _Size
|
||||
|
||||
INFO_LOG(WIIMOTE, "Emu ControlChannel (page: %i, type: 0x%02x, param: 0x%02x)", m_index, hidp->type, hidp->param);
|
||||
|
||||
switch(hidp->type)
|
||||
switch (hidp->type)
|
||||
{
|
||||
case HID_TYPE_HANDSHAKE :
|
||||
PanicAlert("HID_TYPE_HANDSHAKE - %s", (hidp->param == HID_PARAM_INPUT) ? "INPUT" : "OUPUT");
|
||||
@@ -777,13 +777,11 @@ void Wiimote::ControlChannel(const u16 _channelID, const void* _pData, u32 _Size
|
||||
else
|
||||
{
|
||||
// AyuanX: My experiment shows Control Channel is never used
|
||||
// shuffle2: but homebrew uses this, so we'll do what we must :)
|
||||
// shuffle2: but lwbt uses this, so we'll do what we must :)
|
||||
HidOutputReport((wm_report*)hidp->data);
|
||||
|
||||
u8 handshake = HID_HANDSHAKE_SUCCESS;
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(m_index, _channelID, &handshake, 1);
|
||||
|
||||
PanicAlert("HID_TYPE_DATA - OUTPUT: Ambiguous Control Channel Report!");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -118,7 +118,15 @@ void Wiimote::ControlChannel(const u16 channel, const void* const data, const u3
|
||||
if (99 == channel)
|
||||
Disconnect();
|
||||
else
|
||||
{
|
||||
InterruptChannel(channel, data, size);
|
||||
const hid_packet* const hidp = (hid_packet*)data;
|
||||
if (hidp->type == HID_TYPE_SET_REPORT)
|
||||
{
|
||||
u8 handshake_ok = HID_HANDSHAKE_SUCCESS;
|
||||
g_WiimoteInitialize.pWiimoteInterruptChannel(index, channel, &handshake_ok, sizeof(handshake_ok));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Wiimote::InterruptChannel(const u16 channel, const void* const data, const u32 size)
|
||||
|
||||
Reference in New Issue
Block a user