diff --git a/SConstruct b/SConstruct index 8398b242a3..ad01b32935 100644 --- a/SConstruct +++ b/SConstruct @@ -54,7 +54,7 @@ include_paths = [ basedir + 'Externals/WiiUseSrc/Src', basedir + 'Source/Core/VideoCommon/Src', basedir + 'Source/Core/InputCommon/Src', - basedir + 'Source/Core/InputPluginCommon/Src', + basedir + 'Source/Plugins/InputPluginCommon/Src', basedir + 'Source/Core/AudioCommon/Src', basedir + 'Source/Core/DebuggerUICommon/Src', basedir + 'Source/Core/DSPCore/Src', @@ -83,7 +83,7 @@ dirs = [ 'Source/Core/DolphinWX/Src', 'Source/Core/DebuggerWX/Src', 'Source/UnitTests/', - 'Source/Core/InputPluginCommon/Src/', + 'Source/Plugins/InputPluginCommon/Src/', 'Source/Plugins/Plugin_WiimoteNew/Src/', ] diff --git a/Source/Dolphin.sln b/Source/Dolphin.sln index ab634c77a0..7aabf8edc9 100644 --- a/Source/Dolphin.sln +++ b/Source/Dolphin.sln @@ -216,7 +216,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_WiimoteNew", "Plugin {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InputPluginCommon", "Core\InputPluginCommon\InputPluginCommon.vcproj", "{660BB3F7-ED8F-4027-A460-8E4EDA8189BE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InputPluginCommon", "Plugins\InputPluginCommon\InputPluginCommon.vcproj", "{660BB3F7-ED8F-4027-A460-8E4EDA8189BE}" ProjectSection(ProjectDependencies) = postProject {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} {05C75041-D67D-4903-A362-8395A7B35C75} = {05C75041-D67D-4903-A362-8395A7B35C75} diff --git a/Source/Core/InputPluginCommon/InputPluginCommon.vcproj b/Source/Plugins/InputPluginCommon/InputPluginCommon.vcproj similarity index 100% rename from Source/Core/InputPluginCommon/InputPluginCommon.vcproj rename to Source/Plugins/InputPluginCommon/InputPluginCommon.vcproj diff --git a/Source/Core/InputPluginCommon/Src/Config.cpp b/Source/Plugins/InputPluginCommon/Src/Config.cpp similarity index 100% rename from Source/Core/InputPluginCommon/Src/Config.cpp rename to Source/Plugins/InputPluginCommon/Src/Config.cpp diff --git a/Source/Core/InputPluginCommon/Src/Config.h b/Source/Plugins/InputPluginCommon/Src/Config.h similarity index 100% rename from Source/Core/InputPluginCommon/Src/Config.h rename to Source/Plugins/InputPluginCommon/Src/Config.h diff --git a/Source/Core/InputPluginCommon/Src/ConfigDiag.cpp b/Source/Plugins/InputPluginCommon/Src/ConfigDiag.cpp similarity index 100% rename from Source/Core/InputPluginCommon/Src/ConfigDiag.cpp rename to Source/Plugins/InputPluginCommon/Src/ConfigDiag.cpp diff --git a/Source/Core/InputPluginCommon/Src/ConfigDiag.h b/Source/Plugins/InputPluginCommon/Src/ConfigDiag.h similarity index 100% rename from Source/Core/InputPluginCommon/Src/ConfigDiag.h rename to Source/Plugins/InputPluginCommon/Src/ConfigDiag.h diff --git a/Source/Core/InputPluginCommon/Src/ConfigDiagBitmaps.cpp b/Source/Plugins/InputPluginCommon/Src/ConfigDiagBitmaps.cpp similarity index 100% rename from Source/Core/InputPluginCommon/Src/ConfigDiagBitmaps.cpp rename to Source/Plugins/InputPluginCommon/Src/ConfigDiagBitmaps.cpp diff --git a/Source/Core/InputPluginCommon/Src/ControllerEmu.cpp b/Source/Plugins/InputPluginCommon/Src/ControllerEmu.cpp similarity index 100% rename from Source/Core/InputPluginCommon/Src/ControllerEmu.cpp rename to Source/Plugins/InputPluginCommon/Src/ControllerEmu.cpp diff --git a/Source/Core/InputPluginCommon/Src/ControllerEmu.h b/Source/Plugins/InputPluginCommon/Src/ControllerEmu.h similarity index 99% rename from Source/Core/InputPluginCommon/Src/ControllerEmu.h rename to Source/Plugins/InputPluginCommon/Src/ControllerEmu.h index be09b740e7..3026828f09 100644 --- a/Source/Core/InputPluginCommon/Src/ControllerEmu.h +++ b/Source/Plugins/InputPluginCommon/Src/ControllerEmu.h @@ -286,8 +286,8 @@ public: std::vector attachments; - unsigned int switch_extension; - unsigned int active_extension; + int switch_extension; + int active_extension; }; virtual ~ControllerEmu(); diff --git a/Source/Core/InputPluginCommon/Src/IniFile.cpp b/Source/Plugins/InputPluginCommon/Src/IniFile.cpp similarity index 100% rename from Source/Core/InputPluginCommon/Src/IniFile.cpp rename to Source/Plugins/InputPluginCommon/Src/IniFile.cpp diff --git a/Source/Core/InputPluginCommon/Src/IniFile.h b/Source/Plugins/InputPluginCommon/Src/IniFile.h similarity index 100% rename from Source/Core/InputPluginCommon/Src/IniFile.h rename to Source/Plugins/InputPluginCommon/Src/IniFile.h diff --git a/Source/Core/InputPluginCommon/Src/SConscript b/Source/Plugins/InputPluginCommon/Src/SConscript similarity index 100% rename from Source/Core/InputPluginCommon/Src/SConscript rename to Source/Plugins/InputPluginCommon/Src/SConscript diff --git a/Source/Plugins/Plugin_GCPadNew/Plugin_GCPadNew.vcproj b/Source/Plugins/Plugin_GCPadNew/Plugin_GCPadNew.vcproj index cdedc5333f..f748bbcc6a 100644 --- a/Source/Plugins/Plugin_GCPadNew/Plugin_GCPadNew.vcproj +++ b/Source/Plugins/Plugin_GCPadNew/Plugin_GCPadNew.vcproj @@ -44,7 +44,7 @@ all_the_time) - PanicAlert("Wiimote: Reporting Always is set to OFF!"); + PanicAlert("Wiimote: Reporting Always is set to OFF! Everything should be fine, but games never do this."); // Validation check switch (dr->mode) @@ -200,23 +200,21 @@ void Wiimote::RequestStatus(u16 _channelID, wm_request_status* rs, int Extension // handle switch extension if ( m_extension->active_extension != m_extension->switch_extension ) { - if ( m_extension->active_extension && m_extension->switch_extension ) - // detach extension first + // if an extension is currently connected and we want to switch to a different extension + if ( (m_extension->active_extension > 0) && m_extension->switch_extension ) + // detach extension first, wait til next Update() or RequestStatus() call to change to the new extension m_extension->active_extension = 0; else + // set the wanted extension m_extension->active_extension = m_extension->switch_extension; - + + // update status struct + m_status.extension = m_extension->active_extension ? 1 : 0; + // set register, I hate this line m_register[ 0xa40000 ] = ((WiimoteEmu::Attachment*)m_extension->attachments[ m_extension->active_extension ])->reg; - - // Wiibrew: Following a connection or disconnection event on the Extension Port, - // data reporting is disabled and the Data Reporting Mode must be reset before new data can arrive. - m_reporting_auto = false; } - // extension status - m_status.extension = m_extension->active_extension ? 1 : 0; - // set up report u8 data[8]; data[0] = 0xA1; @@ -317,14 +315,13 @@ void Wiimote::ReadData(u16 _channelID, wm_read_data* rd) // Read from EEPROM if (address + size > WIIMOTE_EEPROM_FREE_SIZE) { - // generate a read error - size = 0; - if (address + size > WIIMOTE_EEPROM_SIZE) { PanicAlert("ReadData: address + size out of bounds"); return; } + // generate a read error + size = 0; } SendReadDataReply(_channelID, m_eeprom + address, address, size); } diff --git a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteEmu/WiimoteEmu.cpp b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteEmu/WiimoteEmu.cpp index 6429c8f4d6..f39205e24f 100644 --- a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteEmu/WiimoteEmu.cpp @@ -76,6 +76,10 @@ void Wiimote::Reset() m_reporting_channel = 0; m_reporting_auto = false; + // will make the first Update() call send a status request + // the first call to RequestStatus() will then set up the status struct extension bit + m_extension->active_extension = -1; + // eeprom memset( m_eeprom, 0, sizeof(m_eeprom) ); // calibration data @@ -109,9 +113,6 @@ Wiimote::Wiimote( const unsigned int index, SWiimoteInitialize* const wiimote_in : m_index(index) , m_wiimote_init( wiimote_initialize ) { - // reset eeprom/register/values to default - Reset(); - // ---- set up all the controls ---- // buttons @@ -157,6 +158,10 @@ Wiimote::Wiimote( const unsigned int index, SWiimoteInitialize* const wiimote_in groups.push_back( options = new ControlGroup( "Options" ) ); options->settings.push_back( new ControlGroup::Setting( "Background Input", false ) ); options->settings.push_back( new ControlGroup::Setting( "Sideways Wiimote", false ) ); + + + // --- reset eeprom/register/values to default --- + Reset(); } std::string Wiimote::GetName() const @@ -173,17 +178,23 @@ void Wiimote::Update() m_buttons->GetState( &m_status.buttons, button_bitmasks ); m_dpad->GetState( &m_status.buttons, is_sideways ? dpad_sideways_bitmasks : dpad_bitmasks ); - if ( false == m_reporting_auto ) - return; - - // handle extension switching - if ( m_extension->active_extension != m_extension->switch_extension ) + // check if a status report needs to be sent + // this happens on wiimote sync and when extensions are switched + if (m_extension->active_extension != m_extension->switch_extension) { RequestStatus( m_reporting_channel, NULL ); - // games don't seem to like me sending the status report and the data report - return; + + // Wiibrew: Following a connection or disconnection event on the Extension Port, + // data reporting is disabled and the Data Reporting Mode must be reset before new data can arrive. + + // after a game receives an unrequested status report, + // it expects data reports to stop until it sets the reporting mode again + m_reporting_auto = false; } + if ( false == m_reporting_auto ) + return; + // figure out what data we need size_t rpt_size = 0; size_t rpt_core = 0;