Commit better wiiuse compiles, the ones in last commit may have been switched around by git on me. Add MotionPlus to the statesave so it won't be a bother later, and uncomment some things so accessing it doesn't cause PanicAlerts

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4612 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-11-26 05:01:24 +00:00
parent 574a03b1e1
commit 8405c4049d
12 changed files with 26 additions and 66 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -204,9 +204,9 @@ int wiiuse_io_read(struct wiimote_t* wm) {
}
// This needs to be done even if ReadFile fails, essential during init
// Move the data over one, so we can add back in 0xa2
// Move the data over one, so we can add back in data report indicator byte (here, 0xa1)
memmove(wm->event_buf + 1, wm->event_buf, sizeof(wm->event_buf) - 1);
wm->event_buf[0] = 0xa2;
wm->event_buf[0] = 0xa1;
ResetEvent(wm->hid_overlap.hEvent);
return 1;

View File

@ -43,7 +43,7 @@ u8 g_IR;
u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE];
//u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE];
u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE];
u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
u8 g_RegIr[WIIMOTE_REG_IR_SIZE];

View File

@ -75,7 +75,7 @@ extern u8 g_IR;
extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE];
//extern u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE];
@ -140,47 +140,15 @@ static const u8 classic_calibration[] =
0x00,0x00, 0x51,0xa6
};
/* 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
};
/* The Classic Controller id. It should be written to the last bytes of the
extension register */
static const u8 classic_id[] =
{
0x00, 0x00, 0xa4, 0x20, 0x01, 0x01
};
/* The GH3 guitar id. It should be written to the last bytes of the
extension register */
static const u8 gh3glp_id[] =
{
0x00, 0x00, 0xa4, 0x20, 0x01, 0x03
};
/* The GHWT drums id. It should be written to the last bytes of the
extension register */
static const u8 ghwtdrums_id[] =
{
0x01, 0x00, 0xa4, 0x20, 0x01, 0x03
};
/* The id for nothing inserted */
static const u8 nothing_id[] =
{
0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e
};
/* The id for a partially inserted extension */
static const u8 partially_id[] =
{
0x00, 0x00, 0x00, 0x00, 0xff, 0xff
};
// Extension device IDs to be written to the last bytes of the extension reg
static const u8 nunchuck_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x00, 0x00 };
static const u8 classic_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x01, 0x01 };
static const u8 gh3glp_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x01, 0x03 };
static const u8 ghwtdrums_id[] = { 0x01, 0x00, 0xa4, 0x20, 0x01, 0x03 };
// The id for nothing inserted
static const u8 nothing_id[] = { 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e };
// The id for a partially inserted extension
static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
// Gamepad input
extern int NumPads, NumGoodPads; // Number of goods pads

View File

@ -474,6 +474,7 @@ void DoState(PointerWrap &p)
p.DoArray(g_Eeprom, WIIMOTE_EEPROM_SIZE);
p.DoArray(g_RegSpeaker, WIIMOTE_REG_SPEAKER_SIZE);
p.DoArray(g_RegExt, WIIMOTE_REG_EXT_SIZE);
p.DoArray(g_RegMotionPlus, WIIMOTE_REG_EXT_SIZE);
p.DoArray(g_RegExtTmp, WIIMOTE_REG_EXT_SIZE);
p.DoArray(g_RegIr, WIIMOTE_REG_IR_SIZE);

View File

@ -46,11 +46,6 @@ extern SWiimoteInitialize g_WiimoteInitialize;
namespace WiiMoteEmu
{
//******************************************************************************
// Subroutines
//******************************************************************************
/* Here we process the Output Reports that the Wii sends. Our response will be
an Input Report back to the Wii. Input and Output is from the Wii's
perspective, Output means data to the Wiimote (from the Wii), Input means
@ -60,10 +55,6 @@ namespace WiiMoteEmu
1. Wiimote_InterruptChannel > InterruptChannel > HidOutputReport
2. Wiimote_ControlChannel > ControlChannel > HidOutputReport
The IR lights and speaker enable/disable and mute/unmute values are
0x2 = Disable
0x6 = Enable
*/
void HidOutputReport(u16 _channelID, wm_report* sr)
{
@ -71,8 +62,8 @@ void HidOutputReport(u16 _channelID, wm_report* sr)
switch(sr->wm)
{
case WM_RUMBLE: // 0x10
// TODO: Implement rumble for real wiimotes
case 0x10:
// Unknown
break;
case WM_LEDS: // 0x11
@ -128,8 +119,7 @@ void HidOutputReport(u16 _channelID, wm_report* sr)
// Send general feedback except the following types
// as these ones generate their own feedbacks
if ((sr->wm != WM_RUMBLE)
&& (sr->wm != WM_READ_DATA)
if ((sr->wm != WM_READ_DATA)
&& (sr->wm != WM_REQUEST_STATUS)
&& (sr->wm != WM_WRITE_SPEAKER_DATA)
)
@ -235,7 +225,8 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
blockSize = WIIMOTE_REG_EXT_SIZE;
DEBUG_LOG(WIIMOTE, " Case 0xa4: ExtReg");
break;
/*
// MotionPlus is pretty much just a dummy atm :p
case 0xA6:
block = g_RegMotionPlus;
block[0xFC] = 0xA6;
@ -245,7 +236,7 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
blockSize = WIIMOTE_REG_EXT_SIZE;
DEBUG_LOG(WIIMOTE, " Case 0xa6: MotionPlusReg [%x]", address);
break;
*/
case 0xB0:
block = g_RegIr;
blockSize = WIIMOTE_REG_IR_SIZE;
@ -407,13 +398,13 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
blockSize = WIIMOTE_REG_EXT_SIZE;
DEBUG_LOG(WIIMOTE, " Case 0xa4: ExtReg");
break;
/*
case 0xA6:
block = g_RegMotionPlus;
blockSize = WIIMOTE_REG_EXT_SIZE;
DEBUG_LOG(WIIMOTE, " Case 0xa6: MotionPlusReg [%x]", address);
break;
*/
case 0xB0:
block = g_RegIr;
blockSize = WIIMOTE_REG_IR_SIZE;

View File

@ -942,9 +942,9 @@ void InterruptDebugging(bool Emu, const void* _pData)
if (g_DebugComm) Name.append("WM_SPEAKER");
size = 1;
if(data[1] == 0x14) {
DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] == 0x06) ? "On" : "Off");
DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] & 4) ? "On" : "Off");
} else if(data[1] == 0x19) {
DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] == 0x06) ? "Muted" : "Unmuted");
DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] & 4) ? "Muted" : "Unmuted");
}
break;
case WM_WRITE_SPEAKER_DATA: // 0x18

View File

@ -49,7 +49,6 @@ struct wm_report {
u8 data[0];
};
#define WM_RUMBLE 0x10
#define WM_LEDS 0x11
struct wm_leds {
u8 rumble : 1;

View File

@ -225,11 +225,12 @@ void SendEvent(SEvent& _rEvent)
u8 Buffer[1024];
u32 Offset = 0;
hid_packet* pHidHeader = (hid_packet*)(Buffer + Offset);
Offset += sizeof(hid_packet);
pHidHeader->type = HID_TYPE_DATA;
pHidHeader->param = HID_PARAM_INPUT;
// Create the buffer
memcpy(&Buffer[Offset], pHidHeader, sizeof(hid_packet));
Offset += sizeof(hid_packet);
memcpy(&Buffer[Offset], _rEvent.m_PayLoad, sizeof(_rEvent.m_PayLoad));
Offset += sizeof(_rEvent.m_PayLoad);