diff --git a/SConstruct b/SConstruct index 9657922eaf..027295712a 100644 --- a/SConstruct +++ b/SConstruct @@ -77,6 +77,7 @@ dirs = [ 'Source/Plugins/Plugin_DSP_HLE/Src', 'Source/Plugins/Plugin_DSP_LLE/Src', 'Source/Plugins/Plugin_GCPad/Src', + 'Source/Plugins/Plugin_GCPadNew/Src', 'Source/Plugins/Plugin_Wiimote/Src', 'Source/Core/DolphinWX/Src', 'Source/Core/DebuggerWX/Src', diff --git a/Source/Plugins/Plugin_GCPadNew/Src/Config.h b/Source/Plugins/Plugin_GCPadNew/Src/Config.h index 39159bdd93..fba27c612c 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/Config.h +++ b/Source/Plugins/Plugin_GCPadNew/Src/Config.h @@ -4,8 +4,8 @@ #define CONFIG_FILE_NAME "GCPadNew.ini" #include "ControllerInterface/ControllerInterface.h" -#include "../../../Core/Common/Src/thread.h" -#include "../../../Core/Common/Src/FileUtil.h" +#include "Thread.h" +#include "FileUtil.h" #include "IniFile.h" #include "ControllerEmu.h" diff --git a/Source/Plugins/Plugin_GCPadNew/Src/ConfigDiag.cpp b/Source/Plugins/Plugin_GCPadNew/Src/ConfigDiag.cpp index 2230778606..5b79c7480c 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/ConfigDiag.cpp +++ b/Source/Plugins/Plugin_GCPadNew/Src/ConfigDiag.cpp @@ -183,10 +183,12 @@ void GamepadPage::ClearAll( wxCommandEvent& event ) m_plugin.controls_crit.Enter(); // enter // just load an empty ini section to clear everything :P - controller->LoadConfig( IniSection() ); + IniSection Section = IniSection(); + ControllerInterface Face = ControllerInterface(); + controller->LoadConfig( Section ); // no point in using the real ControllerInterface i guess - controller->UpdateReferences( ControllerInterface() ); + controller->UpdateReferences( Face ); UpdateGUI(); diff --git a/Source/Plugins/Plugin_GCPadNew/Src/ControllerEmu.cpp b/Source/Plugins/Plugin_GCPadNew/Src/ControllerEmu.cpp index 64a3038fa0..ea798e3e30 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/ControllerEmu.cpp +++ b/Source/Plugins/Plugin_GCPadNew/Src/ControllerEmu.cpp @@ -110,7 +110,7 @@ void ControllerEmu::SaveConfig( IniFile::Section& sec ) // input mode if ( (*ci)->control_ref->is_input ) sec.SetValue( group+(*ci)->name+"/Mode", - ((ControllerInterface::InputReference*)((*ci)->control_ref))->mode, 0 ); + ((ControllerInterface::InputReference*)((*ci)->control_ref))->mode, (unsigned int)0 ); } } } diff --git a/Source/Plugins/Plugin_GCPadNew/Src/ControllerEmu.h b/Source/Plugins/Plugin_GCPadNew/Src/ControllerEmu.h index 06327d1685..f98350e60a 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/ControllerEmu.h +++ b/Source/Plugins/Plugin_GCPadNew/Src/ControllerEmu.h @@ -7,6 +7,7 @@ #include "pluginspecs_pad.h" #include "pluginspecs_wiimote.h" //#include +#include #include "ControllerInterface/ControllerInterface.h" #include "IniFile.h" diff --git a/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/ControllerInterface.cpp b/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/ControllerInterface.cpp index 4b0dc358ee..9649fd6bfe 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/ControllerInterface.cpp +++ b/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/ControllerInterface.cpp @@ -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::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::const_iterator i = controls.begin(), - e = controls.end(); - for ( ; i!=e; ++i ) - control_qualifier.name += (*i)->GetName() + '|'; + std::vector::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 ); diff --git a/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/ControllerInterface.h b/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/ControllerInterface.h index e216ba4d74..78b6931d27 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/ControllerInterface.h +++ b/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/ControllerInterface.h @@ -24,11 +24,13 @@ #define CIFACE_USE_SDL #endif +#if defined(HAVE_WX) && HAVE_WX #ifdef CIFACE_USE_REGEX #include #endif #include #include +#endif // idk in case i wanted to change it to double or somethin, idk what's best typedef float ControlState; diff --git a/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/SDL/SDL.cpp b/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/SDL/SDL.cpp index d91af9f849..90b7f886da 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/SDL/SDL.cpp +++ b/Source/Plugins/Plugin_GCPadNew/Src/ControllerInterface/SDL/SDL.cpp @@ -23,8 +23,8 @@ void Init( std::vector& 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 ); diff --git a/Source/Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp b/Source/Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp index c68d138fc6..d599b3425e 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp +++ b/Source/Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp @@ -1,11 +1,14 @@ #include - +#include "Common.h" #include "pluginspecs_pad.h" #include "pluginspecs_wiimote.h" #include "ControllerInterface/ControllerInterface.h" +#if defined(HAVE_WX) && HAVE_WX #include "ConfigDiag.h" +#endif +#include "Config.h" #define CIFACE_PLUGIN_VERSION 0x0100 diff --git a/Source/Plugins/Plugin_GCPadNew/Src/IniFile.cpp b/Source/Plugins/Plugin_GCPadNew/Src/IniFile.cpp index b9a05b83b0..94aca72f39 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/IniFile.cpp +++ b/Source/Plugins/Plugin_GCPadNew/Src/IniFile.cpp @@ -29,7 +29,7 @@ void IniSection::SetValue( const std::string& key, const std::string& val, const operator[](key) = val; else { - const const_iterator f = find(key); + iterator f = find(key); if ( f != end() ) erase( f ); } @@ -125,7 +125,7 @@ void IniFile::Clean() e = end(); for ( ; i != e; ) { - Section::const_iterator si = i->second.begin(), + Section::iterator si = i->second.begin(), se = i->second.end(); for ( ; si != se; ) { diff --git a/Source/Plugins/Plugin_GCPadNew/Src/IniFile.h b/Source/Plugins/Plugin_GCPadNew/Src/IniFile.h index 982c84b070..4792c3c970 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/IniFile.h +++ b/Source/Plugins/Plugin_GCPadNew/Src/IniFile.h @@ -26,7 +26,7 @@ public: } else { - const const_iterator f = find(key); + iterator f = find(key); if ( f != end() ) erase( f ); } diff --git a/Source/Plugins/Plugin_GCPadNew/Src/SConscript b/Source/Plugins/Plugin_GCPadNew/Src/SConscript new file mode 100644 index 0000000000..353fe18191 --- /dev/null +++ b/Source/Plugins/Plugin_GCPadNew/Src/SConscript @@ -0,0 +1,34 @@ +# -*- python -*- + +Import('env') +import sys + +name = "Plugin_GCPadNew" +padenv = env.Clone() + +files = [ + 'Config.cpp', + 'ControllerEmu.cpp', + 'ControllerEmu/GCPad/GCPad.cpp', + 'GCPadNew.cpp', + 'ControllerInterface/ControllerInterface.cpp', + 'IniFile.cpp', + ] + +if padenv['HAVE_SDL']: + files += [ 'ControllerInterface/SDL/SDL.cpp' ] + +if padenv['HAVE_WX']: + files += [ + 'ConfigDiag.cpp', + 'ConfigDiagBitmaps.cpp', + ] + +padenv.Append( + LIBS = [ 'inputcommon', 'common', ], + ) + +if sys.platform == 'darwin': + padenv['FRAMEWORKS'] = ['CoreFoundation', 'System' ] + +padenv.SharedLibrary(env['plugin_dir']+name, files)