mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Commited my new wiimote plugin work so far. Some code was copied from the current wiimote plugin. I have cleaned up most of the functions, but there are still a bunch of unused structs and stuff that I need to clean up.
Moved ControllerInterface to InputCommon. Moved GCPadNew GUI/Config code to a new project, InputPluginCommon. It is used by both GCPadNew and WiimoteNew. I hope that I included everyone's fixes to GCPadNew and ControllerInterface. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5355 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -408,6 +408,74 @@
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="ControllerInterface"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\ControllerInterface.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\ControllerInterface.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="DirectInput"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\DirectInput\DirectInput.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\DirectInput\DirectInput.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\DirectInput\DirectInputJoystick.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\DirectInput\DirectInputJoystick.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\DirectInput\DirectInputKeyboardMouse.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\DirectInput\DirectInputKeyboardMouse.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\DirectInput\NamedKeys.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="SDL"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\SDL\SDL.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\SDL\SDL.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="XInput"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\XInput\XInput.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ControllerInterface\XInput\XInput.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\Src\Configuration.cpp"
|
||||
>
|
||||
|
||||
+7
-3
@@ -40,7 +40,7 @@ void ControllerInterface::Init()
|
||||
ciface::DirectInput::Init( m_devices/*, (HWND)m_hwnd*/ );
|
||||
#endif
|
||||
#ifdef CIFACE_USE_XLIB
|
||||
ciface::Xlib::Init( m_devices, m_hwnd );
|
||||
ciface::XLIB::Init( m_devices, m_hwnd );
|
||||
#endif
|
||||
#ifdef CIFACE_USE_OSX
|
||||
ciface::OSX::Init( m_devices, m_hwnd );
|
||||
@@ -238,7 +238,7 @@ ControlState ControllerInterface::InputReference::State( const ControlState igno
|
||||
if ( NULL == device )
|
||||
return 0;
|
||||
|
||||
ControlState state = 0;
|
||||
ControlState state;
|
||||
// this mode thing will be turned into a switch statement
|
||||
switch ( mode )
|
||||
{
|
||||
@@ -360,7 +360,11 @@ void ControllerInterface::DeviceQualifier::FromDevice(const ControllerInterface:
|
||||
//
|
||||
bool ControllerInterface::DeviceQualifier::operator==(const ControllerInterface::Device* const dev) const
|
||||
{
|
||||
return (dev->GetName() == name) && (dev->GetId() == cid) && (dev->GetSource() == source);
|
||||
if ( dev->GetName() == name )
|
||||
if ( dev->GetId() == cid )
|
||||
if ( dev->GetSource() == source )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
-2
@@ -377,12 +377,10 @@ std::string Joystick::GetSource() const
|
||||
|
||||
// update IO
|
||||
|
||||
|
||||
bool Joystick::UpdateInput()
|
||||
{
|
||||
if ( m_must_poll )
|
||||
m_device->Poll();
|
||||
//return false;
|
||||
|
||||
HRESULT hr = m_device->GetDeviceState( sizeof(m_state_in), &m_state_in );
|
||||
|
||||
+2
-2
@@ -189,8 +189,8 @@ bool KeyboardMouse::UpdateOutput()
|
||||
m_current_state_out[i] ^= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( kbinputs.size() )
|
||||
|
||||
if (kbinputs.size())
|
||||
return ( kbinputs.size() == SendInput( (UINT)kbinputs.size(), &kbinputs[0], sizeof( kbinputs[0] ) ) );
|
||||
else
|
||||
return true;
|
||||
+101
-101
@@ -1,101 +1,101 @@
|
||||
#include "../ControllerInterface.h"
|
||||
|
||||
#ifdef CIFACE_USE_OSX
|
||||
|
||||
#include "OSX.h"
|
||||
#include "OSXPrivate.h"
|
||||
|
||||
namespace ciface
|
||||
{
|
||||
namespace OSX
|
||||
{
|
||||
|
||||
|
||||
void Init( std::vector<ControllerInterface::Device*>& devices, void* hwnd )
|
||||
{
|
||||
// mouse will be added to this, Keyboard class will be turned into KeyboardMouse
|
||||
// single device for combined keyboard/mouse, this will allow combinations like shift+click more easily
|
||||
//devices.push_back( new Keyboard( hwnd ) );
|
||||
}
|
||||
|
||||
Keyboard::Keyboard( void *View )
|
||||
{
|
||||
|
||||
memset( &m_state, 0, sizeof(m_state) );
|
||||
OSX_Init(View);
|
||||
// This is REALLY dumb right here
|
||||
// Should REALLY cover the entire UTF-8 Range
|
||||
for (int a = 0; a < 256; ++a)
|
||||
inputs.push_back( new Key( (char)a ) );
|
||||
}
|
||||
|
||||
|
||||
Keyboard::~Keyboard()
|
||||
{
|
||||
// might not need this func
|
||||
}
|
||||
|
||||
|
||||
ControlState Keyboard::GetInputState( const ControllerInterface::Device::Input* const input )
|
||||
{
|
||||
return ((Input*)input)->GetState( &m_state );
|
||||
}
|
||||
|
||||
void Keyboard::SetOutputState( const ControllerInterface::Device::Output* const output, const ControlState state )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Keyboard::UpdateInput()
|
||||
{
|
||||
memset(m_state.keyboard, 0, 256);
|
||||
OSX_UpdateKeys(256, m_state.keyboard );
|
||||
|
||||
// mouse stuff in here too
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Keyboard::UpdateOutput()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
std::string Keyboard::GetName() const
|
||||
{
|
||||
return "Keyboard";
|
||||
//return "Keyboard Mouse"; // change to this later
|
||||
}
|
||||
|
||||
std::string Keyboard::GetSource() const
|
||||
{
|
||||
return "OSX";
|
||||
}
|
||||
|
||||
int Keyboard::GetId() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ControlState Keyboard::Key::GetState( State* const state )
|
||||
{
|
||||
for(unsigned int a = 0; a < 256; ++a)
|
||||
if(state->keyboard[a] == m_index)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string Keyboard::Key::GetName() const
|
||||
{
|
||||
char temp[16];
|
||||
sprintf(temp, "Key:%c", m_index);
|
||||
return std::string(temp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#include "../ControllerInterface.h"
|
||||
|
||||
#ifdef CIFACE_USE_OSX
|
||||
|
||||
#include "OSX.h"
|
||||
#include "OSXPrivate.h"
|
||||
|
||||
namespace ciface
|
||||
{
|
||||
namespace OSX
|
||||
{
|
||||
|
||||
|
||||
void Init( std::vector<ControllerInterface::Device*>& devices, void* hwnd )
|
||||
{
|
||||
// mouse will be added to this, Keyboard class will be turned into KeyboardMouse
|
||||
// single device for combined keyboard/mouse, this will allow combinations like shift+click more easily
|
||||
//devices.push_back( new Keyboard( hwnd ) );
|
||||
}
|
||||
|
||||
Keyboard::Keyboard( void *View )
|
||||
{
|
||||
|
||||
memset( &m_state, 0, sizeof(m_state) );
|
||||
OSX_Init(View);
|
||||
// This is REALLY dumb right here
|
||||
// Should REALLY cover the entire UTF-8 Range
|
||||
for (int a = 0; a < 256; ++a)
|
||||
inputs.push_back( new Key( (char)a ) );
|
||||
}
|
||||
|
||||
|
||||
Keyboard::~Keyboard()
|
||||
{
|
||||
// might not need this func
|
||||
}
|
||||
|
||||
|
||||
ControlState Keyboard::GetInputState( const ControllerInterface::Device::Input* const input )
|
||||
{
|
||||
return ((Input*)input)->GetState( &m_state );
|
||||
}
|
||||
|
||||
void Keyboard::SetOutputState( const ControllerInterface::Device::Output* const output, const ControlState state )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Keyboard::UpdateInput()
|
||||
{
|
||||
memset(m_state.keyboard, 0, 256);
|
||||
OSX_UpdateKeys(256, m_state.keyboard );
|
||||
|
||||
// mouse stuff in here too
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Keyboard::UpdateOutput()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
std::string Keyboard::GetName() const
|
||||
{
|
||||
return "Keyboard";
|
||||
//return "Keyboard Mouse"; // change to this later
|
||||
}
|
||||
|
||||
std::string Keyboard::GetSource() const
|
||||
{
|
||||
return "OSX";
|
||||
}
|
||||
|
||||
int Keyboard::GetId() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ControlState Keyboard::Key::GetState( State* const state )
|
||||
{
|
||||
for(unsigned int a = 0; a < 256; ++a)
|
||||
if(state->keyboard[a] == m_index)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string Keyboard::Key::GetName() const
|
||||
{
|
||||
char temp[16];
|
||||
sprintf(temp, "Key:%c", m_index);
|
||||
return std::string(temp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+68
-68
@@ -1,68 +1,68 @@
|
||||
#ifndef _CIFACE_OSX_H_
|
||||
#define _CIFACE_OSX_H_
|
||||
|
||||
#include "../ControllerInterface.h"
|
||||
|
||||
namespace ciface
|
||||
{
|
||||
namespace OSX
|
||||
{
|
||||
|
||||
void Init( std::vector<ControllerInterface::Device*>& devices, void* hwnd );
|
||||
|
||||
class Keyboard : public ControllerInterface::Device
|
||||
{
|
||||
friend class ControllerInterface;
|
||||
friend class ControllerInterface::ControlReference;
|
||||
|
||||
protected:
|
||||
|
||||
struct State
|
||||
{
|
||||
char keyboard[256]; // really dumb
|
||||
// mouse crap will go here
|
||||
};
|
||||
|
||||
class Input : public ControllerInterface::Device::Input
|
||||
{
|
||||
friend class Keyboard;
|
||||
protected:
|
||||
Input( const unsigned char index ) : m_index(index) {}
|
||||
virtual ControlState GetState( State* const js ) = 0;
|
||||
|
||||
const unsigned char m_index;
|
||||
};
|
||||
|
||||
class Key : public Input
|
||||
{
|
||||
friend class Keyboard;
|
||||
public:
|
||||
std::string GetName() const;
|
||||
protected:
|
||||
Key( const unsigned char key ) : Input(key) {}
|
||||
ControlState GetState( State* const js );
|
||||
|
||||
};
|
||||
|
||||
bool UpdateInput();
|
||||
bool UpdateOutput();
|
||||
|
||||
ControlState GetInputState( const ControllerInterface::Device::Input* const input );
|
||||
void SetOutputState( const ControllerInterface::Device::Output* const output, const ControlState state );
|
||||
|
||||
public:
|
||||
Keyboard( void* view );
|
||||
~Keyboard();
|
||||
|
||||
std::string GetName() const;
|
||||
std::string GetSource() const;
|
||||
int GetId() const;
|
||||
|
||||
private:
|
||||
State m_state;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifndef _CIFACE_OSX_H_
|
||||
#define _CIFACE_OSX_H_
|
||||
|
||||
#include "../ControllerInterface.h"
|
||||
|
||||
namespace ciface
|
||||
{
|
||||
namespace OSX
|
||||
{
|
||||
|
||||
void Init( std::vector<ControllerInterface::Device*>& devices, void* hwnd );
|
||||
|
||||
class Keyboard : public ControllerInterface::Device
|
||||
{
|
||||
friend class ControllerInterface;
|
||||
friend class ControllerInterface::ControlReference;
|
||||
|
||||
protected:
|
||||
|
||||
struct State
|
||||
{
|
||||
char keyboard[256]; // really dumb
|
||||
// mouse crap will go here
|
||||
};
|
||||
|
||||
class Input : public ControllerInterface::Device::Input
|
||||
{
|
||||
friend class Keyboard;
|
||||
protected:
|
||||
Input( const unsigned char index ) : m_index(index) {}
|
||||
virtual ControlState GetState( State* const js ) = 0;
|
||||
|
||||
const unsigned char m_index;
|
||||
};
|
||||
|
||||
class Key : public Input
|
||||
{
|
||||
friend class Keyboard;
|
||||
public:
|
||||
std::string GetName() const;
|
||||
protected:
|
||||
Key( const unsigned char key ) : Input(key) {}
|
||||
ControlState GetState( State* const js );
|
||||
|
||||
};
|
||||
|
||||
bool UpdateInput();
|
||||
bool UpdateOutput();
|
||||
|
||||
ControlState GetInputState( const ControllerInterface::Device::Input* const input );
|
||||
void SetOutputState( const ControllerInterface::Device::Output* const output, const ControlState state );
|
||||
|
||||
public:
|
||||
Keyboard( void* view );
|
||||
~Keyboard();
|
||||
|
||||
std::string GetName() const;
|
||||
std::string GetSource() const;
|
||||
int GetId() const;
|
||||
|
||||
private:
|
||||
State m_state;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+9
-1
@@ -148,7 +148,15 @@ bool Device::UpdateInput()
|
||||
|
||||
bool Device::UpdateOutput()
|
||||
{
|
||||
return ( ERROR_SUCCESS == XInputSetState( m_index, &m_state_out ) );
|
||||
// this if statement is to make rumble work better when multiple ControllerInterfaces are using the device
|
||||
static XINPUT_VIBRATION current_state_out = {0,0};
|
||||
if ( memcmp( &m_state_out, ¤t_state_out, sizeof(m_state_out) ) )
|
||||
{
|
||||
current_state_out = m_state_out;
|
||||
return ( ERROR_SUCCESS == XInputSetState( m_index, &m_state_out ) );
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
// GET name/source/id
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user