More improvements to new wiimote plugin: Added emulated Drums/Guitar extensions. Wiimote rumble now handled for every output report. Fixed some mem leaks. Hopefully fixed a floating point exception in Linux, thanks to glennrics.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5403 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-04-24 00:44:10 +00:00
parent 1d8db5ce3f
commit 23689387e1
24 changed files with 540 additions and 166 deletions
@@ -13,7 +13,7 @@
// Registry sizes
#define WIIMOTE_EEPROM_SIZE (16*1024)
#define WIIMOTE_EEPROM_FREE_SIZE 0x16ff
#define WIIMOTE_EEPROM_FREE_SIZE 0x1700
#define WIIMOTE_REG_SPEAKER_SIZE 10
#define WIIMOTE_REG_EXT_SIZE 0x100
#define WIIMOTE_REG_IR_SIZE 0x34
@@ -28,20 +28,22 @@ extern const u8 shake_data[8];
class Wiimote : public ControllerEmu
{
public:
Wiimote( const unsigned int index );
std::string GetName() const;
void Update();
void InterruptChannel(const u16 _channelID, const void* _pData, u32 _Size);
void ControlChannel(const u16 _channelID, const void* _pData, u32 _Size);
private:
struct ReadRequest
{
unsigned int address, size, position;
u8* data;
};
Wiimote( const unsigned int index );
void Reset();
void Update();
void InterruptChannel(const u16 _channelID, const void* _pData, u32 _Size);
void ControlChannel(const u16 _channelID, const void* _pData, u32 _Size);
void ReportMode(const u16 _channelID, wm_report_mode* dr);
void HidOutputReport(const u16 _channelID, wm_report* sr);
void SendAck(const u16 _channelID, u8 _reportID);
@@ -51,10 +53,7 @@ public:
void ReadData(const u16 _channelID, wm_read_data* rd);
void SendReadDataReply(const u16 _channelID, ReadRequest& _request);
std::string GetName() const;
private:
// control groups
Buttons* m_buttons;
Buttons* m_dpad;
Buttons* m_shake;
@@ -63,11 +62,13 @@ private:
Force* m_swing;
ControlGroup* m_rumble;
Extension* m_extension;
// TODO: add ir
ControlGroup* m_options;
// wiimote index, 0-3
const unsigned int m_index;
bool m_rumble_on;
bool m_speaker_mute;
bool m_reporting_auto;
unsigned int m_reporting_mode;
@@ -90,13 +91,20 @@ private:
// maybe read requests cancel any current requests
std::queue< ReadRequest > m_read_requests;
//u8 m_eeprom[WIIMOTE_EEPROM_SIZE];
u8 m_eeprom[WIIMOTE_EEPROM_SIZE];
//std::queue< u8 > m_speaker_data;
//u8* m_reg_speaker;
//u8* m_reg_motion_plus;
u8* m_reg_ir;
u8 m_eeprom[WIIMOTE_EEPROM_SIZE];
u8* m_reg_ext;
u8* m_reg_ir;
u8* m_reg_motion_plus;
struct SpeakerConfig
{
u16 : 16;
u8 format;
u16 sample_rate;
u8 volume;
} *m_reg_speaker;
wiimote_key m_ext_key;
};