diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-02-01 12:29:04 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-02-01 12:29:04 +0000 |
| commit | 9bf85f976ca1c539788e6d1d60995434eb856812 (patch) | |
| tree | 2324f498d64c97271b07f0c420ce32dd743caad8 /macosx/plugins/HIDInput/src | |
| parent | 843732611c8eab41931a6e434a9cb8bac0a06e6f (diff) | |
| download | pcsxr-9bf85f976ca1c539788e6d1d60995434eb856812.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@41013 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/HIDInput/src')
| -rw-r--r-- | macosx/plugins/HIDInput/src/KeyConfig.m | 28 | ||||
| -rw-r--r-- | macosx/plugins/HIDInput/src/PlugPAD.c | 17 |
2 files changed, 22 insertions, 23 deletions
diff --git a/macosx/plugins/HIDInput/src/KeyConfig.m b/macosx/plugins/HIDInput/src/KeyConfig.m index 6b82665b..82ecd18b 100644 --- a/macosx/plugins/HIDInput/src/KeyConfig.m +++ b/macosx/plugins/HIDInput/src/KeyConfig.m @@ -38,7 +38,7 @@ int LoadConfig() { if (!sKeyconfig) sKeyconfig = [[KeyConfig alloc] init]; - + return 0; } @@ -80,7 +80,7 @@ static void GetDeviceElementNameString(pRecDevice pDevice, pRecElement pElement, { if ((self = [super init]) == nil) return nil; - + /* Using the defaults system means that we will effectively piggy-back on the parent process' preferences. This behaviour is ok, since it allows for seperate preferences for each application that will use the plugin */ @@ -89,15 +89,15 @@ static void GetDeviceElementNameString(pRecDevice pDevice, pRecElement pElement, @"Default", @"net.pcsx.HIDInputPlugin Current Set", [[NSMutableDictionary alloc] initWithCapacity:1], @"net.pcsx.HIDInputPlugin Pad Settings", nil]]; - + /* load from preferences */ keyValues = [[defaults dictionaryForKey:@"net.pcsx.HIDInputPlugin Pad Settings"] retain]; list = [[ControllerList alloc] initWithConfig:self]; - + [self setCurrentSet:[self currentSet]]; [self updateKeys]; - + return self; } @@ -469,30 +469,30 @@ static void GetDeviceElementNameString(pRecDevice pDevice, pRecElement pElement, - (void)updateKeys { int i, j, k; - + /* transfer to working set */ for (i=0; i<MAX_NUM_PADS; i++) { NSString *type = [self currentTypeForPlayer:i]; - + gControllerType[i] = [list controllerTypeIdForType:type]; gNumKeys[i] = gNumAxes[i] = 0; - + for (j=0; j<[list elementCountForType:type]; j++) { NSString *name = [list elementNameAtIndex:j type:type]; NSArray *mappings = [self currentMappingsForElement:name player:i]; int button = [list buttonIdAtIndex:j type:type]; - + if (-1 == button) { int axis = [list axisIdAtIndex:j type:type]; if (-1 != axis) { BOOL positive = ([list axisDirectionAtIndex:j type:type] >= 0); - + for (k=0; k<[mappings count]; k++) { NSString *mapId = [mappings objectAtIndex:k]; - + if (gNumAxes[i] >= MAX_NUM_AXES) break; - + if ([KeyConfig reverseMappingForId:mapId outElement:&gAxes[i][gNumAxes[i]].element outDevice:&gAxes[i][gNumAxes[i]].device]) { gAxes[i][gNumAxes[i]].axis = axis; gAxes[i][gNumAxes[i]].reverse = [KeyConfig mappingIsReverse:mapId]; @@ -505,7 +505,7 @@ static void GetDeviceElementNameString(pRecDevice pDevice, pRecElement pElement, } else { for (k=0; k<[mappings count]; k++) { NSString *mapId = [mappings objectAtIndex:k]; - + if (gNumKeys[i] >= MAX_NUM_KEYS) break; @@ -518,7 +518,7 @@ static void GetDeviceElementNameString(pRecDevice pDevice, pRecElement pElement, } } } - + /* save to preferences */ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:keyValues forKey:@"net.pcsx.HIDInputPlugin Pad Settings"]; diff --git a/macosx/plugins/HIDInput/src/PlugPAD.c b/macosx/plugins/HIDInput/src/PlugPAD.c index c9717d7f..e5bfdf4c 100644 --- a/macosx/plugins/HIDInput/src/PlugPAD.c +++ b/macosx/plugins/HIDInput/src/PlugPAD.c @@ -49,13 +49,13 @@ long PADinit(long flags) { if (!HIDHaveDeviceList()) { // List all HID devices HIDBuildDeviceList(kHIDPage_GenericDesktop, 0); - + if (HIDCountDevices() == 0) { // No devices found! HIDReleaseDeviceList(); return PSE_PAD_ERR_INIT; } - + //HIDCloseReleaseInterface( } @@ -103,7 +103,7 @@ long PADclose(void) { long PADconfigure(void) { // make sure our previous configuration was loaded if (sPadFlags == 0) { - fprintf(stderr, "PADconfigure() called before PADinit()\n"); + //fprintf(stderr, "PADconfigure() called before PADinit()\n"); if (!HIDHaveDeviceList()) { HIDBuildDeviceList(kHIDPage_GenericDesktop, 0); } @@ -116,16 +116,15 @@ void PADabout(void) { DoAbout(); } -long _readPortX(PadDataS *data, int port) -{ +long _readPortX(PadDataS *data, int port) { unsigned short buttonState = 0xffff; keyEntry *keys = gKeys[port]; axisEntry *axes = gAxes[port]; int i; - + //pRecDevice device; //IOHIDEventStruct event; - + /*device = HIDGetFirstDevice(); do { while (HIDGetEvent(device, &event)) { @@ -140,10 +139,10 @@ long _readPortX(PadDataS *data, int port) } } while (HIDGetNextDevice(device));*/ - + for (i=0; i<gNumKeys[port]; i++) { long value = HIDGetElementValue(keys[i].device, keys[i].element); - + if (keys[i].element->usagePage == kHIDPage_GenericDesktop && keys[i].element->usage >= kHIDUsage_GD_X && keys[i].element->usage <= kHIDUsage_GD_Rz) { /* axis input device */ |
