summaryrefslogtreecommitdiff
path: root/macosx/plugins/DFInput/macsrc/cfgHelper.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-04-08 02:33:19 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-04-08 02:33:19 +0000
commitc875a3566e340e366553beb2dcd6b2bcf4d5ab18 (patch)
tree97dcfbe538af5f282135a27cf889ed32b1d9d54d /macosx/plugins/DFInput/macsrc/cfgHelper.m
parent0d4ea9238b154a30e8713c7d00d7b6d1b0050d5c (diff)
downloadpcsxr-c875a3566e340e366553beb2dcd6b2bcf4d5ab18.tar.gz
DFInput: Implement SDL2 GameController support.
This change allows the user to use SDL2’s GameController API instead of the Joystick API. The Game Controller API maps the buttons similar to an Xbox 360 controller, so some tricky mapping needed to be done. Note that it currently only supports OS X. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@89828 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFInput/macsrc/cfgHelper.m')
-rw-r--r--macosx/plugins/DFInput/macsrc/cfgHelper.m12
1 files changed, 6 insertions, 6 deletions
diff --git a/macosx/plugins/DFInput/macsrc/cfgHelper.m b/macosx/plugins/DFInput/macsrc/cfgHelper.m
index bb856824..8bdce079 100644
--- a/macosx/plugins/DFInput/macsrc/cfgHelper.m
+++ b/macosx/plugins/DFInput/macsrc/cfgHelper.m
@@ -43,6 +43,7 @@
#define dRightAnalogYM @"RightAnalogYM"
#define VibrateOn @"Visual Vibration"
+#define UseSDL2Mapping @"SDL2 Mapping"
NSDictionary *DefaultPadArray(int padnum)
{
@@ -63,7 +64,8 @@ NSDictionary *DefaultPadArray(int padnum)
dTriangle: [NSMutableDictionary dictionaryWithObjectsAndKeys:@0, joyVal, @(BUTTON), joyType, nil],
dCircle: [NSMutableDictionary dictionaryWithObjectsAndKeys:@1, joyVal, @(BUTTON), joyType, nil],
dCross: [NSMutableDictionary dictionaryWithObjectsAndKeys:@2, joyVal, @(BUTTON), joyType, nil],
- dSquare: [NSMutableDictionary dictionaryWithObjectsAndKeys:@3, joyVal, @(BUTTON), joyType, nil]}];
+ dSquare: [NSMutableDictionary dictionaryWithObjectsAndKeys:@3, joyVal, @(BUTTON), joyType, nil],
+ UseSDL2Mapping: @YES}];
if (padnum == 0) {
mutArray[dSelect][dfKey] = @9;
mutArray[dStart][dfKey] = @10;
@@ -154,6 +156,7 @@ void LoadPadArray(int padnum, NSDictionary *nsPrefs)
curDef->DevNum = [nsPrefs[deviceNumber] charValue];
curDef->Type = [nsPrefs[padType] unsignedShortValue];
curDef->VisualVibration = [nsPrefs[VibrateOn] boolValue]; //Not implemented on OS X right now.
+ curDef->UseSDL2 = [nsPrefs[UseSDL2Mapping] boolValue];
//Analog buttons
SetKeyFromDictionary(nsPrefs[dL3], &curDef->KeyDef[DKEY_L3]);
@@ -192,7 +195,7 @@ void LoadPadArray(int padnum, NSDictionary *nsPrefs)
NSDictionary *SavePadArray(int padnum)
{
- NSMutableDictionary *mutArray = [NSMutableDictionary dictionary];
+ NSMutableDictionary *mutArray = [[NSMutableDictionary alloc] init];
PADDEF *curDef = &g.cfg.PadDef[padnum];
mutArray[deviceNumber] = @(curDef->DevNum);
mutArray[padType] = @(curDef->Type);
@@ -200,7 +203,6 @@ NSDictionary *SavePadArray(int padnum)
switch (curDef->Type) {
case PSE_PAD_TYPE_ANALOGPAD:
- {
mutArray[dL3] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L3]);
mutArray[dR3] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_R3]);
mutArray[dAnalog] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_ANALOG]);
@@ -214,11 +216,9 @@ NSDictionary *SavePadArray(int padnum)
mutArray[dRightAnalogXM] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XM]);
mutArray[dRightAnalogYP] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YP]);
mutArray[dRightAnalogYM] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YM]);
- }
//Fall through
case PSE_PAD_TYPE_STANDARD:
- {
mutArray[dL1] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L1]);
mutArray[dL2] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L2]);
mutArray[dR1] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_R1]);
@@ -234,7 +234,7 @@ NSDictionary *SavePadArray(int padnum)
mutArray[dCircle] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_CIRCLE]);
mutArray[dCross] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_CROSS]);
mutArray[dSquare] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_SQUARE]);
- }
+ mutArray[UseSDL2Mapping] = @((BOOL)curDef->UseSDL2);
break;
default: