diff options
| author | daco65 <daco65@gmail.com> | 2009-02-09 18:43:03 +0000 |
|---|---|---|
| committer | daco65 <daco65@gmail.com> | 2009-02-09 18:43:03 +0000 |
| commit | 2ff2852771d7b38576832f73201b531e2f23212a (patch) | |
| tree | 29c083bd5b41b2e96f43bef4bb80881a304044b5 /Source/Core/InputCommon | |
| parent | 1026b3b6f1abbbed313d71a3d41f80a14c393dbb (diff) | |
Njoy: added an option to choose what kind of analog filtering you want. it should be changeable when you choose to view advanced settings. this solved my analog/digital config problems i had and it *should* still work for those who had np with Jpeterson's change. i was told the wiimote had the same problem (makes sense) but im not sure if alot of ppl had that problem with their controllers so i have kept it as an ini changeable option only (set AdvancedMapFilter to True to use the same filtering as Njoy 0.3 does with AdvancedMapFilter enabled.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2180 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/Src/SDL.cpp | 23 | ||||
| -rw-r--r-- | Source/Core/InputCommon/Src/SDL.h | 4 |
2 files changed, 19 insertions, 8 deletions
diff --git a/Source/Core/InputCommon/Src/SDL.cpp b/Source/Core/InputCommon/Src/SDL.cpp index 67c4b97b31..80d3b91308 100644 --- a/Source/Core/InputCommon/Src/SDL.cpp +++ b/Source/Core/InputCommon/Src/SDL.cpp @@ -240,14 +240,23 @@ 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)
+bool AvoidValues(int value,int AdvancedMapFilter)
{
// Avoid detecting very small or very big (for triggers) values
- if( (value > -0x2000 && value < 0x2000) // Small values
- || (value < -0x6000 || value > 0x6000)) // Big values
- return true; // Avoid
+ if( (value > -0x2000 && value < 0x2000) )// Small values
+ {
+ return true; //Avoid
+ }
else
- return false; // Keep
+ {
+ if (!AdvancedMapFilter)
+ {
+ if (value < -0x6000 || value > 0x6000) // Big values
+ return true; //Avoid
+ }
+ return false; //Keep
+ }
+
}
@@ -255,7 +264,7 @@ bool AvoidValues(int value) // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
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)
+ bool LeftRight, bool Axis, bool XInput, bool Button, bool Hat , int FilterSet)
{
// It needs the wxWidgets excape keycode
static const int WXK_ESCAPE = 27;
@@ -270,7 +279,7 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h {
value = SDL_JoystickGetAxis(joy, i);
- if(AvoidValues(value)) continue; // Avoid values
+ if(AvoidValues(value,FilterSet)) continue; // Avoid values
pressed = i + (LeftRight ? 1000 : 0); // Identify the analog triggers
type = InputCommon::CTL_AXIS;
diff --git a/Source/Core/InputCommon/Src/SDL.h b/Source/Core/InputCommon/Src/SDL.h index e54895d7cd..515b8f9b39 100644 --- a/Source/Core/InputCommon/Src/SDL.h +++ b/Source/Core/InputCommon/Src/SDL.h @@ -86,6 +86,7 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING int triggertype; // Triggers range
std::string SDiagonal;
bool bSquareToCircle;
+ bool bFilterSettings;
int eventnum; // Linux Event Number, Can't be found dynamically yet
};
@@ -180,6 +181,7 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING int triggertype; // SDL or XInput trigger
std::string SDiagonal;
bool bSquareToCircle;
+ bool bFilterSettings;
};
////////////////////////////
@@ -191,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);
+void GetButton(SDL_Joystick*, int,int,int,int, int&,int&,int&,int&,bool&,bool&, bool,bool,bool,bool,bool,int);
// Value conversion
int Pad_Convert(int _val);
|
