Clean up of new Plugin, get it compiling in Linux/OSX, Linux side, you need to add the Xlib portion to SConscript

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5258 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1
2010-04-01 02:59:40 +00:00
parent ca3f4a6494
commit d2cee0a869
12 changed files with 66 additions and 21 deletions

View File

@@ -12,6 +12,7 @@
#ifdef CIFACE_USE_SDL
#include "SDL/SDL.h"
#endif
#include "Thread.h"
//#define MAX_DOUBLE_TAP_TIME 400
//#define MAX_HOLD_DOWN_TIME 400
@@ -488,8 +489,9 @@ bool ControllerInterface::InputReference::Detect( const unsigned int ms, const u
while ( (time < ms) && (detected.size() < count) )
{
device->UpdateInput();
std::vector<Device::Input*>::const_iterator i = device->Inputs().begin(),
e = device->Inputs().end();
i = device->Inputs().begin();
e = device->Inputs().end();
for ( unsigned int n=0;i != e; ++i,++n )
{
if ( device->GetInputState( *i ) > INPUT_DETECT_THRESHOLD )
@@ -501,7 +503,7 @@ bool ControllerInterface::InputReference::Detect( const unsigned int ms, const u
else
states[n] = false;
}
wxMilliSleep( 10 ); time += 10;
Common::SleepCurrentThread( 10 ); time += 10;
}
delete states;
@@ -513,10 +515,10 @@ bool ControllerInterface::InputReference::Detect( const unsigned int ms, const u
if ( controls.size() > 1 )
{
control_qualifier.name = '|';
std::vector<Device::Control*>::const_iterator i = controls.begin(),
e = controls.end();
for ( ; i!=e; ++i )
control_qualifier.name += (*i)->GetName() + '|';
std::vector<Device::Control*>::const_iterator c_i = controls.begin(),
c_e = controls.end();
for ( ; c_i != c_e; ++c_i )
control_qualifier.name += (*c_i)->GetName() + '|';
}
else
control_qualifier.FromControl( controls[0] );
@@ -546,7 +548,7 @@ bool ControllerInterface::OutputReference::Detect( const unsigned int ms, const
while ( ms > ( slept += 10 ) )
{
device->UpdateOutput();
wxMilliSleep( 10 );
Common::SleepCurrentThread( 10 );
}
State( 0 );

View File

@@ -24,11 +24,13 @@
#define CIFACE_USE_SDL
#endif
#if defined(HAVE_WX) && HAVE_WX
#ifdef CIFACE_USE_REGEX
#include <wx/regex.h>
#endif
#include <wx/stopwatch.h>
#include <wx/utils.h>
#endif
// idk in case i wanted to change it to double or somethin, idk what's best
typedef float ControlState;

View File

@@ -23,8 +23,8 @@ void Init( std::vector<ControllerInterface::Device*>& devices )
// joysticks
for( int i = 0; i < SDL_NumJoysticks(); ++i )
{
SDL_Joystick* dev;
if ( dev = SDL_JoystickOpen( i ) )
SDL_Joystick* dev = SDL_JoystickOpen( i );
if ( dev )
{
Joystick* js = new Joystick( dev, i );
// only add if it has some inputs/outputs
@@ -60,9 +60,9 @@ Joystick::Joystick( SDL_Joystick* const joystick, const unsigned int index ) : m
inputs.push_back( new Axis( i, -32768 ) );
inputs.push_back( new Axis( i, 32767 ) );
}
m_haptic = SDL_HapticOpenFromJoystick( m_joystick );
// try to get supported ff effects
if ( m_haptic = SDL_HapticOpenFromJoystick( m_joystick ) )
if ( m_haptic )
{
//SDL_HapticSetGain( m_haptic, 1000 );