summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
authorJohn Peterson <jpeterson57@gmail.com>2009-02-09 20:06:27 +0000
committerJohn Peterson <jpeterson57@gmail.com>2009-02-09 20:06:27 +0000
commit5edef947536c1dc7aef41603530ad9b5545cd4f0 (patch)
tree0e4ca3e7666b517dab75650da9a772398d78492e /Source/Core/InputCommon
parent09c83681809d188aa505d207acdb90e6739b8662 (diff)
SimplePad: Added input recording options to the GUI, now we just need to get rerecording to work to, perhaps one can rewind the input counter when a state is loaded? So the input counter is saved in the savestate for the pad.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2184 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/Src/SDL.cpp26
-rw-r--r--Source/Core/InputCommon/Src/SDL.h6
2 files changed, 11 insertions, 21 deletions
diff --git a/Source/Core/InputCommon/Src/SDL.cpp b/Source/Core/InputCommon/Src/SDL.cpp
index 80d3b91308..6967e6c489 100644
--- a/Source/Core/InputCommon/Src/SDL.cpp
+++ b/Source/Core/InputCommon/Src/SDL.cpp
@@ -240,23 +240,14 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
/* Function: We have to avoid very big values to becuse some triggers are -0x8000 in the
unpressed state (and then go from -0x8000 to 0x8000 as they are fully pressed) */
-bool AvoidValues(int value,int AdvancedMapFilter)
+bool AvoidValues(int value, bool NoTriggerFilter)
{
// Avoid detecting very small or very big (for triggers) values
- if( (value > -0x2000 && value < 0x2000) )// Small values
- {
- return true; //Avoid
- }
+ if( (value > -0x2000 && value < 0x2000) // Small values
+ || ((value < -0x6000 || value > 0x6000) && !NoTriggerFilter)) // Big values
+ return true; // Avoid
else
- {
- if (!AdvancedMapFilter)
- {
- if (value < -0x6000 || value > 0x6000) // Big values
- return true; //Avoid
- }
- return false; //Keep
- }
-
+ return false; // Keep
}
@@ -264,7 +255,7 @@ bool AvoidValues(int value,int AdvancedMapFilter)
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int hats,
int &KeyboardKey, int &value, int &type, int &pressed, bool &Succeed, bool &Stop,
- bool LeftRight, bool Axis, bool XInput, bool Button, bool Hat , int FilterSet)
+ bool LeftRight, bool Axis, bool XInput, bool Button, bool Hat, bool NoTriggerFilter)
{
// It needs the wxWidgets excape keycode
static const int WXK_ESCAPE = 27;
@@ -279,13 +270,12 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h
{
value = SDL_JoystickGetAxis(joy, i);
- if(AvoidValues(value,FilterSet)) continue; // Avoid values
+ if(AvoidValues(value, NoTriggerFilter)) continue; // Avoid values
pressed = i + (LeftRight ? 1000 : 0); // Identify the analog triggers
type = InputCommon::CTL_AXIS;
Succeed = true;
}
- Console::Print("Id: %i\n", joy);
}
// Check for a hat
@@ -358,7 +348,7 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h
}
}
// Only accept the escape key
- else
+ else if (KeyboardKey == WXK_ESCAPE)
{
Succeed = true;
KeyboardKey = 0;
diff --git a/Source/Core/InputCommon/Src/SDL.h b/Source/Core/InputCommon/Src/SDL.h
index 515b8f9b39..803c29b329 100644
--- a/Source/Core/InputCommon/Src/SDL.h
+++ b/Source/Core/InputCommon/Src/SDL.h
@@ -86,7 +86,7 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING
int triggertype; // Triggers range
std::string SDiagonal;
bool bSquareToCircle;
- bool bFilterSettings;
+ bool bNoTriggerFilter;
int eventnum; // Linux Event Number, Can't be found dynamically yet
};
@@ -181,7 +181,7 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING
int triggertype; // SDL or XInput trigger
std::string SDiagonal;
bool bSquareToCircle;
- bool bFilterSettings;
+ bool bNoTriggerFilter;
};
////////////////////////////
@@ -193,7 +193,7 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING
// General functions
bool SearchDevices(std::vector<CONTROLLER_INFO> &_joyinfo, int &NumPads, int &NumGoodPads);
void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int controller, int NumButtons);
-void GetButton(SDL_Joystick*, int,int,int,int, int&,int&,int&,int&,bool&,bool&, bool,bool,bool,bool,bool,int);
+void GetButton(SDL_Joystick*, int,int,int,int, int&,int&,int&,int&,bool&,bool&, bool,bool,bool,bool,bool,bool);
// Value conversion
int Pad_Convert(int _val);