Preliminary emulated Wiimote Extension support. It works in some games. The nunchuck controls are numpad 4, 5, 6, 8 for up down left right and C and Z for the c and z buttons. You have to select Extension connected from the settings to enable it.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1212 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2008-11-19 08:31:31 +00:00
parent 482cc819fb
commit 76ca6ac031
15 changed files with 1033 additions and 216 deletions

View File

@ -25,6 +25,7 @@
#include "Common.h"
#include "wiimote_hid.h"
#include "EmuDefinitions.h"
#include "Encryption.h"
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
extern SWiimoteInitialize g_WiimoteInitialize;
@ -38,7 +39,6 @@ namespace WiiMoteEmu
// Definitions and variable declarations
//******************************************************************************
extern u16 g_channelID;
//extern u8 g_Leds = 0x1;
extern u8 g_Leds;
@ -47,11 +47,15 @@ extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE];
extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegExtBlnk[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE];
extern u8 g_ReportingMode;
extern u16 g_ReportingChannel;
extern wiimote_key g_ExtKey; // extension encryption key
static const u8 EepromData_0[] = {
0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30,
@ -69,19 +73,40 @@ static const u8 EepromData_16D0[] = {
};
/* Default calibration for the nunchuck. It should be written to 0x20 - 0x3f of the
extension register */
static const u8 nunchuck_calibration[] =
{
0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00,
0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43,
0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00,
0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43
};
/* The nunchuck id. It should be written to the last bytes of the
extension register */
static const u8 nunchuck_id[] =
{
0x00, 0x00, 0xa4, 0x20, 0x00, 0x00
//0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void HidOutputReport(u16 _channelID, wm_report* sr);
void WmLeds(u16 _channelID, wm_leds* leds);
void WmReadData(u16 _channelID, wm_read_data* rd);
void WmWriteData(u16 _channelID, wm_write_data* wd);
void WmRequestStatus(u16 _channelID, wm_request_status* rs);
void WmRequestStatus_(u16 _channelID);
void WmRequestStatus_(u16 _channelID, int a);
void WmDataReporting(u16 _channelID, wm_data_reporting* dr);
void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size);
void SendReportCoreAccel(u16 _channelID);
void SendReportCoreAccelIr12(u16 _channelID);
void SendReportCore(u16 _channelID);
void SendReportCoreAccelExt16(u16 _channelID);
void SendReportCoreAccelIr10Ext(u16 _channelID);
int WriteWmReport(u8* dst, u8 channel);
@ -92,6 +117,7 @@ void FillReportAcc(wm_accel& _acc);
void FillReportInfo(wm_core& _core);
void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1);
void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1);
void FillReportExtension(wm_extension& _ext);
u32 convert24bit(const u8* src);