mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 14:39:01 +01:00
Merge pull request #6389 from spycrab/fix_wiimote
Fix emulated Wiimotes
This commit is contained in:
commit
619f98b97b
@ -205,7 +205,7 @@ void Wiimote::RequestStatus(const wm_request_status* const rs)
|
|||||||
HandleExtensionSwap();
|
HandleExtensionSwap();
|
||||||
|
|
||||||
// update status struct
|
// update status struct
|
||||||
m_status.extension = (m_extension->active_extension || m_motion_plus_active) ? 1 : 0;
|
m_status.extension = m_extension->active_extension ? 1 : 0;
|
||||||
|
|
||||||
// set up report
|
// set up report
|
||||||
u8 data[8];
|
u8 data[8];
|
||||||
@ -299,17 +299,14 @@ void Wiimote::WriteData(const wm_write_data* const wd)
|
|||||||
|
|
||||||
// extension register
|
// extension register
|
||||||
case 0xa4:
|
case 0xa4:
|
||||||
region_ptr = m_motion_plus_active ? (void*)&m_reg_motion_plus : (void*)&m_reg_ext;
|
region_ptr = (void*)&m_reg_ext;
|
||||||
region_size = WIIMOTE_REG_EXT_SIZE;
|
region_size = WIIMOTE_REG_EXT_SIZE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// motion plus
|
// motion plus
|
||||||
case 0xa6:
|
case 0xa6:
|
||||||
if (false == m_motion_plus_active)
|
region_ptr = &m_reg_motion_plus;
|
||||||
{
|
region_size = WIIMOTE_REG_EXT_SIZE;
|
||||||
region_ptr = &m_reg_motion_plus;
|
|
||||||
region_size = WIIMOTE_REG_EXT_SIZE;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// ir
|
// ir
|
||||||
@ -340,7 +337,6 @@ void Wiimote::WriteData(const wm_write_data* const wd)
|
|||||||
{
|
{
|
||||||
// maybe hacky
|
// maybe hacky
|
||||||
m_reg_motion_plus.activated = 0;
|
m_reg_motion_plus.activated = 0;
|
||||||
m_motion_plus_active ^= 1;
|
|
||||||
|
|
||||||
RequestStatus();
|
RequestStatus();
|
||||||
}
|
}
|
||||||
@ -434,18 +430,15 @@ void Wiimote::ReadData(const wm_read_data* const rd)
|
|||||||
|
|
||||||
// extension
|
// extension
|
||||||
case 0xa4:
|
case 0xa4:
|
||||||
region_ptr = m_motion_plus_active ? (void*)&m_reg_motion_plus : (void*)&m_reg_ext;
|
region_ptr = (void*)&m_reg_ext;
|
||||||
region_size = WIIMOTE_REG_EXT_SIZE;
|
region_size = WIIMOTE_REG_EXT_SIZE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// motion plus
|
// motion plus
|
||||||
case 0xa6:
|
case 0xa6:
|
||||||
// reading from 0xa6 returns error when mplus is activated
|
// reading from 0xa6 returns error when mplus is activated
|
||||||
if (false == m_motion_plus_active)
|
region_ptr = &m_reg_motion_plus;
|
||||||
{
|
region_size = WIIMOTE_REG_EXT_SIZE;
|
||||||
region_ptr = &m_reg_motion_plus;
|
|
||||||
region_size = WIIMOTE_REG_EXT_SIZE;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// ir
|
// ir
|
||||||
@ -556,8 +549,6 @@ void Wiimote::DoState(PointerWrap& p)
|
|||||||
p.Do(ir_cos);
|
p.Do(ir_cos);
|
||||||
p.Do(m_rumble_on);
|
p.Do(m_rumble_on);
|
||||||
p.Do(m_speaker_mute);
|
p.Do(m_speaker_mute);
|
||||||
p.Do(m_motion_plus_present);
|
|
||||||
p.Do(m_motion_plus_active);
|
|
||||||
p.Do(m_reporting_auto);
|
p.Do(m_reporting_auto);
|
||||||
p.Do(m_reporting_mode);
|
p.Do(m_reporting_mode);
|
||||||
p.Do(m_reporting_channel);
|
p.Do(m_reporting_channel);
|
||||||
|
@ -207,8 +207,6 @@ void Wiimote::Reset()
|
|||||||
|
|
||||||
m_rumble_on = false;
|
m_rumble_on = false;
|
||||||
m_speaker_mute = false;
|
m_speaker_mute = false;
|
||||||
m_motion_plus_present = false;
|
|
||||||
m_motion_plus_active = false;
|
|
||||||
|
|
||||||
// will make the first Update() call send a status request
|
// will make the first Update() call send a status request
|
||||||
// the first call to RequestStatus() will then set up the status struct extension bit
|
// the first call to RequestStatus() will then set up the status struct extension bit
|
||||||
@ -395,8 +393,6 @@ ControllerEmu::ControlGroup* Wiimote::GetTurntableGroup(TurntableGroup group)
|
|||||||
|
|
||||||
bool Wiimote::Step()
|
bool Wiimote::Step()
|
||||||
{
|
{
|
||||||
m_motion_plus_present = m_motion_plus_setting->GetValue();
|
|
||||||
|
|
||||||
m_motor->control_ref->State(m_rumble_on);
|
m_motor->control_ref->State(m_rumble_on);
|
||||||
|
|
||||||
// when a movie is active, this button status update is disabled (moved), because movies only
|
// when a movie is active, this button status update is disabled (moved), because movies only
|
||||||
@ -661,13 +657,6 @@ void Wiimote::GetExtData(u8* const data)
|
|||||||
// i think it should be unencrpyted in the register, encrypted when read.
|
// i think it should be unencrpyted in the register, encrypted when read.
|
||||||
memcpy(m_reg_ext.controller_data, data, sizeof(wm_nc)); // TODO: Should it be nc specific?
|
memcpy(m_reg_ext.controller_data, data, sizeof(wm_nc)); // TODO: Should it be nc specific?
|
||||||
|
|
||||||
if (m_motion_plus_active)
|
|
||||||
{
|
|
||||||
reinterpret_cast<wm_motionplus_data*>(data)->is_mp_data = 0;
|
|
||||||
reinterpret_cast<wm_motionplus_data*>(data)->extension_connected =
|
|
||||||
m_extension->active_extension;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0xAA == m_reg_ext.encryption)
|
if (0xAA == m_reg_ext.encryption)
|
||||||
WiimoteEncrypt(&m_ext_key, data, 0x00, sizeof(wm_nc));
|
WiimoteEncrypt(&m_ext_key, data, 0x00, sizeof(wm_nc));
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,6 @@ private:
|
|||||||
ControllerEmu::ControlGroup* m_rumble;
|
ControllerEmu::ControlGroup* m_rumble;
|
||||||
ControllerEmu::Output* m_motor;
|
ControllerEmu::Output* m_motor;
|
||||||
ControllerEmu::Extension* m_extension;
|
ControllerEmu::Extension* m_extension;
|
||||||
ControllerEmu::BooleanSetting* m_motion_plus_setting;
|
|
||||||
ControllerEmu::ControlGroup* m_options;
|
ControllerEmu::ControlGroup* m_options;
|
||||||
ControllerEmu::BooleanSetting* m_sideways_setting;
|
ControllerEmu::BooleanSetting* m_sideways_setting;
|
||||||
ControllerEmu::BooleanSetting* m_upright_setting;
|
ControllerEmu::BooleanSetting* m_upright_setting;
|
||||||
@ -270,8 +269,6 @@ private:
|
|||||||
|
|
||||||
bool m_rumble_on;
|
bool m_rumble_on;
|
||||||
bool m_speaker_mute;
|
bool m_speaker_mute;
|
||||||
bool m_motion_plus_present;
|
|
||||||
bool m_motion_plus_active;
|
|
||||||
|
|
||||||
bool m_reporting_auto;
|
bool m_reporting_auto;
|
||||||
u8 m_reporting_mode;
|
u8 m_reporting_mode;
|
||||||
|
@ -74,7 +74,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
|||||||
static std::thread g_save_thread;
|
static std::thread g_save_thread;
|
||||||
|
|
||||||
// Don't forget to increase this after doing changes on the savestate system
|
// Don't forget to increase this after doing changes on the savestate system
|
||||||
static const u32 STATE_VERSION = 92; // Last changed in PR 6173
|
static const u32 STATE_VERSION = 93; // Last changed in PR 6389
|
||||||
|
|
||||||
// Maps savestate versions to Dolphin versions.
|
// Maps savestate versions to Dolphin versions.
|
||||||
// Versions after 42 don't need to be added to this list,
|
// Versions after 42 don't need to be added to this list,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user