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

@ -77,6 +77,7 @@ dirs = [
'Source/Plugins/Plugin_DSP_HLE/Src', 'Source/Plugins/Plugin_DSP_HLE/Src',
'Source/Plugins/Plugin_DSP_LLE/Src', 'Source/Plugins/Plugin_DSP_LLE/Src',
'Source/Plugins/Plugin_GCPad/Src', 'Source/Plugins/Plugin_GCPad/Src',
'Source/Plugins/Plugin_GCPadNew/Src',
'Source/Plugins/Plugin_Wiimote/Src', 'Source/Plugins/Plugin_Wiimote/Src',
'Source/Core/DolphinWX/Src', 'Source/Core/DolphinWX/Src',
'Source/Core/DebuggerWX/Src', 'Source/Core/DebuggerWX/Src',

View File

@ -4,8 +4,8 @@
#define CONFIG_FILE_NAME "GCPadNew.ini" #define CONFIG_FILE_NAME "GCPadNew.ini"
#include "ControllerInterface/ControllerInterface.h" #include "ControllerInterface/ControllerInterface.h"
#include "../../../Core/Common/Src/thread.h" #include "Thread.h"
#include "../../../Core/Common/Src/FileUtil.h" #include "FileUtil.h"
#include "IniFile.h" #include "IniFile.h"
#include "ControllerEmu.h" #include "ControllerEmu.h"

View File

@ -183,10 +183,12 @@ void GamepadPage::ClearAll( wxCommandEvent& event )
m_plugin.controls_crit.Enter(); // enter m_plugin.controls_crit.Enter(); // enter
// just load an empty ini section to clear everything :P // 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 // no point in using the real ControllerInterface i guess
controller->UpdateReferences( ControllerInterface() ); controller->UpdateReferences( Face );
UpdateGUI(); UpdateGUI();

View File

@ -110,7 +110,7 @@ void ControllerEmu::SaveConfig( IniFile::Section& sec )
// input mode // input mode
if ( (*ci)->control_ref->is_input ) if ( (*ci)->control_ref->is_input )
sec.SetValue( group+(*ci)->name+"/Mode", sec.SetValue( group+(*ci)->name+"/Mode",
((ControllerInterface::InputReference*)((*ci)->control_ref))->mode, 0 ); ((ControllerInterface::InputReference*)((*ci)->control_ref))->mode, (unsigned int)0 );
} }
} }
} }

View File

@ -7,6 +7,7 @@
#include "pluginspecs_pad.h" #include "pluginspecs_pad.h"
#include "pluginspecs_wiimote.h" #include "pluginspecs_wiimote.h"
//#include <CommonTypes.h> //#include <CommonTypes.h>
#include <math.h>
#include "ControllerInterface/ControllerInterface.h" #include "ControllerInterface/ControllerInterface.h"
#include "IniFile.h" #include "IniFile.h"

View File

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

View File

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

View File

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

View File

@ -1,11 +1,14 @@
#include <math.h> #include <math.h>
#include "Common.h"
#include "pluginspecs_pad.h" #include "pluginspecs_pad.h"
#include "pluginspecs_wiimote.h" #include "pluginspecs_wiimote.h"
#include "ControllerInterface/ControllerInterface.h" #include "ControllerInterface/ControllerInterface.h"
#if defined(HAVE_WX) && HAVE_WX
#include "ConfigDiag.h" #include "ConfigDiag.h"
#endif
#include "Config.h"
#define CIFACE_PLUGIN_VERSION 0x0100 #define CIFACE_PLUGIN_VERSION 0x0100

View File

@ -29,7 +29,7 @@ void IniSection::SetValue( const std::string& key, const std::string& val, const
operator[](key) = val; operator[](key) = val;
else else
{ {
const const_iterator f = find(key); iterator f = find(key);
if ( f != end() ) if ( f != end() )
erase( f ); erase( f );
} }
@ -125,7 +125,7 @@ void IniFile::Clean()
e = end(); e = end();
for ( ; i != e; ) for ( ; i != e; )
{ {
Section::const_iterator si = i->second.begin(), Section::iterator si = i->second.begin(),
se = i->second.end(); se = i->second.end();
for ( ; si != se; ) for ( ; si != se; )
{ {

View File

@ -26,7 +26,7 @@ public:
} }
else else
{ {
const const_iterator f = find(key); iterator f = find(key);
if ( f != end() ) if ( f != end() )
erase( f ); erase( f );
} }

View File

@ -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)