More improvements to new wiimote plugin: Added emulated Drums/Guitar extensions. Wiimote rumble now handled for every output report. Fixed some mem leaks. Hopefully fixed a floating point exception in Linux, thanks to glennrics.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5403 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak committed 2010-04-24 00:44:10 +00:00
1 parent 1d8db5ce3f
commit 23689387e1
24 files changed
+540 -166

No files matched your search

+23 -15
View File
@@ -64,8 +64,8 @@ GCPad::GCPad( const unsigned int index ) : m_index(index)
m_dpad->controls.push_back( new ControlGroup::Input( named_directions[i] ) );
// options
groups.push_back( options = new ControlGroup( "Options" ) );
options->settings.push_back( new ControlGroup::Setting( "Background Input", false ) );
groups.push_back( m_options = new ControlGroup( "Options" ) );
m_options->settings.push_back( new ControlGroup::Setting( "Background Input", false ) );
}
@@ -76,25 +76,33 @@ std::string GCPad::GetName() const
void GCPad::GetInput( SPADStatus* const pad )
{
std::vector< ControlGroup::Control* >::iterator i,e;
// if window has focus or background input enabled
if (g_PADInitialize->pRendererHasFocus() || m_options[0].settings[0]->value )
{
// buttons
m_buttons->GetState( &pad->button, button_bitmasks );
// buttons
m_buttons->GetState( &pad->button, button_bitmasks );
// TODO: set analog A/B analog to full or w/e, prolly not needed
// TODO: set analog A/B to full or w/e
// dpad
m_dpad->GetState( &pad->button, dpad_bitmasks );
// dpad
m_dpad->GetState( &pad->button, dpad_bitmasks );
// sticks
m_main_stick->GetState( &pad->stickX, &pad->stickY, 0x80, 127 );
m_c_stick->GetState( &pad->substickX, &pad->substickY, 0x80, 127 );
// sticks
m_main_stick->GetState( &pad->stickX, &pad->stickY, 0x80, 127 );
m_c_stick->GetState( &pad->substickX, &pad->substickY, 0x80, 127 );
// triggers
m_triggers->GetState( &pad->button, trigger_bitmasks, &pad->triggerLeft, 0xFF );
// triggers
m_triggers->GetState( &pad->button, trigger_bitmasks, &pad->triggerLeft, 0xFF );
}
else
{
// center sticks
memset( &pad->stickX, 0x80, 4 );
}
}
void GCPad::SetOutput( const bool on )
{
m_rumble->controls[0]->control_ref->State( on );
// only rumble if window has focus or background input is enabled
m_rumble->controls[0]->control_ref->State( on && (g_PADInitialize->pRendererHasFocus() || m_options[0].settings[0]->value) );
}
@@ -3,6 +3,8 @@
#include <ControllerEmu.h>
extern SPADInitialize *g_PADInitialize;
class GCPad : public ControllerEmu
{
public:
@@ -22,6 +24,7 @@ private:
Buttons* m_dpad;
MixedTriggers* m_triggers;
ControlGroup* m_rumble;
ControlGroup* m_options;
const unsigned int m_index;
@@ -161,19 +161,8 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
}
_last_numPAD = _numPAD;
// if we want background input or have focus
if ( g_plugin.controllers[_numPAD]->options[0].settings[0]->value || g_PADInitialize->pRendererHasFocus() )
{
// get input
((GCPad*)g_plugin.controllers[ _numPAD ])->GetInput( _pPADStatus );
}
else
{
// center sticks
memset( &_pPADStatus->stickX, 0x80, 4 );
// stop rumble
((GCPad*)g_plugin.controllers[ _numPAD ])->SetOutput( false );
}
// get input
((GCPad*)g_plugin.controllers[ _numPAD ])->GetInput( _pPADStatus );
// leave
g_plugin.controls_crit.Leave();
@@ -202,9 +191,9 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
// enter
if ( g_plugin.controls_crit.TryEnter() )
{
// only on/off rumble, if we have focus or background input on
if ( g_plugin.controllers[_numPAD]->options[0].settings[0]->value || g_PADInitialize->pRendererHasFocus() )
((GCPad*)g_plugin.controllers[ _numPAD ])->SetOutput( 1 == _uType && _uStrength > 2 );
// TODO: this has potential to not stop rumble if user is messing with GUI at the perfect time
// set rumble
((GCPad*)g_plugin.controllers[ _numPAD ])->SetOutput( 1 == _uType && _uStrength > 2 );
// leave
g_plugin.controls_crit.Leave();