Merge pull request #1459 from Buddybenj/nunchuk

Nunchuck -> Nunchuk Fixes
This commit is contained in:
Ryan Houdek 2014-11-02 09:44:43 -06:00
commit cd64253cb4
7 changed files with 17 additions and 17 deletions

View File

@ -20,7 +20,7 @@ $Always 0 missed Buoys
046199F4 00000000 046199F4 00000000
$Always turbo $Always turbo
04620FDC 0000004B 04620FDC 0000004B
$Never 'out of bounds' - can not finish race $Never 'out of bounds' - cannot finish race
04619BD4 00000000 04619BD4 00000000
$Stunt mode: Massive score $Stunt mode: Massive score
0461B2B8 05F5E0FF 0461B2B8 05F5E0FF

View File

@ -6,7 +6,7 @@
[EmuState] [EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set. # The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 3 EmulationStateId = 3
EmulationIssues = Nunchuck doesn't work (both real and emulated). EmulationIssues = Nunchuk doesn't work (both real and emulated).
[OnLoad] [OnLoad]
# Add memory patches to be loaded once on boot here. # Add memory patches to be loaded once on boot here.

View File

@ -6,7 +6,7 @@
[EmuState] [EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set. # The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 3 EmulationStateId = 3
EmulationIssues = Nunchuck doesn't work (both real and emulated). EmulationIssues = Nunchuk doesn't work (both real and emulated).
[OnLoad] [OnLoad]
# Add memory patches to be loaded once on boot here. # Add memory patches to be loaded once on boot here.

View File

@ -6,7 +6,7 @@
[EmuState] [EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set. # The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 3 EmulationStateId = 3
EmulationIssues = Nunchuck doesn't work (both real and emulated). EmulationIssues = Nunchuk doesn't work (both real and emulated).
[OnLoad] [OnLoad]
# Add memory patches to be loaded once on boot here. # Add memory patches to be loaded once on boot here.

View File

@ -7,11 +7,11 @@
namespace WiimoteEmu namespace WiimoteEmu
{ {
static const u8 nunchuck_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x00, 0x00 }; static const u8 nunchuk_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x00, 0x00 };
/* Default calibration for the nunchuck. It should be written to 0x20 - 0x3f of the /* Default calibration for the nunchuk. It should be written to 0x20 - 0x3f of the
extension register. 0x80 is the neutral x and y accelerators and 0xb3 is the extension register. 0x80 is the neutral x and y accelerators and 0xb3 is the
neutral z accelerometer that is adjusted for gravity. */ neutral z accelerometer that is adjusted for gravity. */
static const u8 nunchuck_calibration[] = static const u8 nunchuk_calibration[] =
{ {
0x80, 0x80, 0x80, 0x00, // accelerometer x, y, z neutral 0x80, 0x80, 0x80, 0x00, // accelerometer x, y, z neutral
0xb3, 0xb3, 0xb3, 0x00, // x, y, z g-force values 0xb3, 0xb3, 0xb3, 0x00, // x, y, z g-force values
@ -52,9 +52,9 @@ Nunchuk::Nunchuk(WiimoteEmu::ExtensionReg& _reg) : Attachment(_trans("Nunchuk"),
// set up register // set up register
// calibration // calibration
memcpy(&calibration, nunchuck_calibration, sizeof(nunchuck_calibration)); memcpy(&calibration, nunchuk_calibration, sizeof(nunchuk_calibration));
// id // id
memcpy(&id, nunchuck_id, sizeof(nunchuck_id)); memcpy(&id, nunchuk_id, sizeof(nunchuk_id));
// this should get set to 0 on disconnect, but it isn't, o well // this should get set to 0 on disconnect, but it isn't, o well
memset(m_shake_step, 0, sizeof(m_shake_step)); memset(m_shake_step, 0, sizeof(m_shake_step));

View File

@ -393,7 +393,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
//INFO_LOG(CONSOLE, "Extension ID: %s", ArrayToString(rdr->data, rdr->size+1).c_str()); //INFO_LOG(CONSOLE, "Extension ID: %s", ArrayToString(rdr->data, rdr->size+1).c_str());
} }
// Nunchuck calibration // Nunchuk calibration
if (data[4] == 0xf0 && data[5] == 0x00 && (data[6] == 0x20 || data[6] == 0x30)) if (data[4] == 0xf0 && data[5] == 0x00 && (data[6] == 0x20 || data[6] == 0x30))
{ {
// log // log
@ -403,9 +403,9 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
//if(((u8*)&wm->m_reg_ext)[0xf0] == 0xaa) { //if(((u8*)&wm->m_reg_ext)[0xf0] == 0xaa) {
// WiimoteDecrypt(&wm->m_ext_key, &data[0x07], 0x00, (data[4] >> 0x04) + 1); // WiimoteDecrypt(&wm->m_ext_key, &data[0x07], 0x00, (data[4] >> 0x04) + 1);
//if (wm->m_extension->name == "NUNCHUCK") //if (wm->m_extension->name == "NUNCHUK")
//{ //{
// INFO_LOG(CONSOLE, "\nGame got the Nunchuck calibration:\n"); // INFO_LOG(CONSOLE, "\nGame got the Nunchuk calibration:\n");
// INFO_LOG(CONSOLE, "Cal_zero.x: %i\n", data[7 + 0]); // INFO_LOG(CONSOLE, "Cal_zero.x: %i\n", data[7 + 0]);
// INFO_LOG(CONSOLE, "Cal_zero.y: %i\n", data[7 + 1]); // INFO_LOG(CONSOLE, "Cal_zero.y: %i\n", data[7 + 1]);
// INFO_LOG(CONSOLE, "Cal_zero.z: %i\n", data[7 + 2]); // INFO_LOG(CONSOLE, "Cal_zero.z: %i\n", data[7 + 2]);
@ -447,18 +447,18 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
//memcpy((u8*)&wm->m_reg_ext.calibration, &data[7], 0x10); //memcpy((u8*)&wm->m_reg_ext.calibration, &data[7], 0x10);
//memcpy((u8*)&wm->m_reg_ext.unknown3, &data[7], 0x10); //memcpy((u8*)&wm->m_reg_ext.unknown3, &data[7], 0x10);
} }
// Save the default values that should work with Wireless Nunchucks // Save the default values that should work with Wireless Nunchuks
else else
{ {
//WiimoteEmu::SetDefaultExtensionRegistry(); //WiimoteEmu::SetDefaultExtensionRegistry();
} }
//WiimoteEmu::UpdateEeprom(); //WiimoteEmu::UpdateEeprom();
} }
// third party Nunchuck // third party Nunchuk
else if (data[7] == 0xff) else if (data[7] == 0xff)
{ {
//memcpy(wm->m_reg_ext + 0x20, WiimoteEmu::wireless_nunchuck_calibration, sizeof(WiimoteEmu::wireless_nunchuck_calibration)); //memcpy(wm->m_reg_ext + 0x20, WiimoteEmu::wireless_nunchuk_calibration, sizeof(WiimoteEmu::wireless_nunchuk_calibration));
//memcpy(wm->m_reg_ext + 0x30, WiimoteEmu::wireless_nunchuck_calibration, sizeof(WiimoteEmu::wireless_nunchuck_calibration)); //memcpy(wm->m_reg_ext + 0x30, WiimoteEmu::wireless_nunchuk_calibration, sizeof(WiimoteEmu::wireless_nunchuk_calibration));
} }
// print encrypted data // print encrypted data

View File

@ -581,7 +581,7 @@ void Wiimote::GetExtData(u8* const data)
{ {
switch (m_reg_motion_plus.ext_identifier[0x4]) switch (m_reg_motion_plus.ext_identifier[0x4])
{ {
// nunchuck pass-through mode // nunchuk pass-through mode
// Bit 7 of byte 5 is moved to bit 6 of byte 5, overwriting it // Bit 7 of byte 5 is moved to bit 6 of byte 5, overwriting it
// Bit 0 of byte 4 is moved to bit 7 of byte 5 // Bit 0 of byte 4 is moved to bit 7 of byte 5
// Bit 3 of byte 5 is moved to bit 4 of byte 5, overwriting it // Bit 3 of byte 5 is moved to bit 4 of byte 5, overwriting it