New Wiimote Plugin: Added a "Hybrid Wiimote" input source type. This allows a real wiimote to be used with an emulated extension.(and in the future, real wiimote with emulated motion plus) If the emulated extension is set to "None", a real extension can be used. Real/Emulated buttons are combined. Real acceleration data is used. Currently, emulated IR data is used.(might change this to allow both) Switching between an emulated and a real extension in-game is a bit testy right now, but if you switch the emu-extension to "None" before connecting a real extension, it usually works.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6082 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-08-10 04:12:32 +00:00
parent a1daa636c2
commit 2b45e87b3e
9 changed files with 603 additions and 417 deletions

View File

@ -8,7 +8,7 @@
// just used to get the OpenAL includes :p
//#include <OpenALStream.h>
#include <ControllerEmu.h>
#include "ControllerEmu.h"
#include "ChunkFile.h"
#include "WiimoteHid.h"
@ -32,6 +32,13 @@ extern SWiimoteInitialize g_WiimoteInitialize;
namespace WiimoteEmu
{
struct ReportFeatures
{
u8 core, accel, ir, ext, size;
};
extern const ReportFeatures reporting_mode_features[];
void EmulateShake(u8* const accel_data
, ControllerEmu::Buttons* const buttons_group
, unsigned int* const shake_step);
@ -77,6 +84,19 @@ public:
void LoadDefaults(const ControllerInterface& ciface);
protected:
bool Step();
void HidOutputReport(const wm_report* const sr, const bool send_ack = true);
void HandleExtensionSwap();
void GetCoreData(u8* const data);
void GetAccelData(u8* const data);
void GetIRData(u8* const data);
void GetExtData(u8* const data);
bool HaveExtension() const { return m_extension->active_extension > 0; }
bool WantExtension() const { return m_extension->switch_extension != 0; }
private:
struct ReadRequest
{
@ -87,14 +107,12 @@ private:
void Reset();
void ReportMode(const u16 _channelID, wm_report_mode* dr);
void HidOutputReport(const u16 _channelID, wm_report* sr);
void SendAck(const u16 _channelID, u8 _reportID);
void RequestStatus(const u16 _channelID, wm_request_status* rs = NULL);
void WriteData(const u16 _channelID, wm_write_data* wd);
void ReadData(const u16 _channelID, wm_read_data* rd);
void SendReadDataReply(const u16 _channelID, ReadRequest& _request);
void ReportMode(const wm_report_mode* const dr);
void SendAck(const u8 _reportID);
void RequestStatus(const wm_request_status* const rs = NULL);
void ReadData(const wm_read_data* const rd);
void WriteData(const wm_write_data* const wd);
void SendReadDataReply(ReadRequest& _request);
#ifdef USE_WIIMOTE_EMU_SPEAKER
void SpeakerData(wm_speaker_data* sd);
@ -131,7 +149,7 @@ private:
class Register : public std::map< size_t, std::vector<u8> >
{
public:
void Write( size_t address, void* src, size_t length );
void Write( size_t address, const void* src, size_t length );
void Read( size_t address, void* dst, size_t length );
} m_register;