summaryrefslogtreecommitdiff
path: root/macosx/plugins/HIDInput/src/ControllerList.m
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-07-29 00:34:36 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-07-29 00:34:36 +0000
commit8d4373b70d74ff5903c13780f397bdbaa5ad4991 (patch)
treea329eae7b9c41010d23dd41300a3b1317ccbca9f /macosx/plugins/HIDInput/src/ControllerList.m
parentdf065b4bf4205db561a5fe7d5652352f6046e40f (diff)
downloadpcsxr-8d4373b70d74ff5903c13780f397bdbaa5ad4991.tar.gz
implemented config dialog for DFInput on OSX, removed HIDInput.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@55259 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/HIDInput/src/ControllerList.m')
-rw-r--r--macosx/plugins/HIDInput/src/ControllerList.m245
1 files changed, 0 insertions, 245 deletions
diff --git a/macosx/plugins/HIDInput/src/ControllerList.m b/macosx/plugins/HIDInput/src/ControllerList.m
deleted file mode 100644
index 21fc9acf..00000000
--- a/macosx/plugins/HIDInput/src/ControllerList.m
+++ /dev/null
@@ -1,245 +0,0 @@
-/***************************************************************************
- ControllerList.m
- HIDInput
-
- Created by Gil Pedersen on Mon May 03 2004.
- Copyright (c) 2004 Gil Pedersen.
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. See also the license.txt file for *
- * additional informations. *
- * *
- ***************************************************************************/
-
-#import "ControllerList.h"
-
-@implementation ControllerList
-
-- (id)initWithConfig:(KeyConfig *)keyconfig
-{
- if (!(self = [super init]) || nil == keyconfig)
- return nil;
-
- config = keyconfig;
-
- /* load keyinfo plist */
- NSString *path = [[NSBundle bundleWithIdentifier:@"net.pcsx.HIDInputPlugin"] pathForResource:@"psxKeys" ofType:@"plist"];
- NSData *plistData;
- NSString *error;
- int i;
-
- plistData = [NSData dataWithContentsOfFile:path];
- plist = [NSPropertyListSerialization propertyListFromData:plistData
- mutabilityOption:NSPropertyListImmutable
- format:nil
- errorDescription:&error];
- if(!plist)
- {
- NSLog(error);
- [error release];
- return nil;
- }
-
- [plist retain];
- //[plistData retain];
-
- /* build typelist */
- NSMutableArray *tmpList = [NSMutableArray arrayWithCapacity:[plist count]];
- for (i=0; i<[plist count]; i++) {
- id name = [plist objectAtIndex:i];
- if ([name isKindOfClass:[NSString class]]) {
- [tmpList addObject:name];
- }
- }
- typeList = [[NSArray alloc] initWithArray:tmpList];
-
- return self;
-}
-
-- (void)dealloc
-{
- [typeList release];
-
- //[plistData release];
- [plist release];
- //[currentSet release];
-}
-
-
-
-/*
-- (NSString *)typeDefaultKey
-{
- return [NSString stringWithFormat:@"TypeForPad%iSet%@", currentController, [[NSUserDefaults standardUserDefaults] stringForKey:@"CurrentPadSet"]];
-}
-
-- (void)setType:(NSString *)aType
-{
- if (type)
- [type release];
- if (keys)
- [keys release];
-
- type = aType ? [aType retain] : [typeList objectAtIndex:0];
- keys = [[plist objectForKey:type] objectForKey:@"Buttons"];
- if (keys)
- [keys retain];
-
- [[NSUserDefaults standardUserDefaults] setObject:type forKey:[self typeDefaultKey]];
-}
-*/
-- (NSArray *)controllerTypes
-{
- return typeList;
-}
-/*
-- (NSString *)controllerType
-{
- return type;
-}*/
-
-- (NSDictionary *)dictForType:(NSString *)type
-{
- int index = [plist indexOfObject:type];
- if (NSNotFound == index)
- return [NSDictionary dictionary];
-
- id dict = [plist objectAtIndex:index+1];
- if (![dict isKindOfClass:[NSDictionary class]])
- return [NSDictionary dictionary];
-
- return dict;
-}
-
-- (NSArray *)elementsForType:(NSString *)type
-{
- return [[self dictForType:type] objectForKey:@"Elements"];
-}
-
-- (NSString *)elementNameAtIndex:(int)index type:(NSString *)type
-{
- if (nil == type || index < 0)
- return @"";
-
- NSArray *list = [self elementsForType:type];
- if (index*2 >= [list count])
- return @"";
-
- return [list objectAtIndex:index*2];
-}
-
-- (int)elementCountForType:(NSString *)type
-{
- if (nil == type)
- return 0;
-
- return [[self elementsForType:type] count]/2;
-}
-
-- (int)controllerTypeIdForType:(NSString *)type
-{
- if (nil == type)
- return 0;
-
- NSNumber *number = [[self dictForType:type] objectForKey:@"Type ID"];
- if (nil == number)
- return 0;
-
- return [number intValue];
-}
-
-- (int)buttonIdAtIndex:(int)index type:(NSString *)type
-{
- if (nil == type || index < 0)
- return -1;
-
- NSDictionary *dict = [[self elementsForType:type] objectAtIndex:index*2+1];
- NSNumber *number = [dict objectForKey:@"Button"];
- if (nil == number)
- return -1;
-
- return [number intValue];
-}
-
-- (int)axisIdAtIndex:(int)index type:(NSString *)type
-{
- if (nil == type || index < 0)
- return -1;
-
- NSDictionary *dict = [[self elementsForType:type] objectAtIndex:index*2+1];
- NSNumber *number = [dict objectForKey:@"Axis"];
- if (nil == number)
- return -1;
-
- return [number intValue];
-}
-
-- (int)axisDirectionAtIndex:(int)index type:(NSString *)type
-{
- if (nil == type || index < 0)
- return -1;
-
- NSDictionary *dict = [[self elementsForType:type] objectAtIndex:index*2+1];
- NSNumber *number = [dict objectForKey:@"Axis-Positive"];
- if (nil == number)
- return 1;
-
- return [number boolValue] ? 1 : -1;
-}
-
-- (NSArray *)defaultMappingsAtIndex:(int)index type:(NSString *)type
-{
- if (nil == type || index < 0)
- return -1;
-
- NSDictionary *dict = [[self elementsForType:type] objectAtIndex:index*2+1];
- return [dict objectForKey:@"Default Mappings"];
-}
-
-
-/* sets current controller data returned by data source */
-- (void)setCurrentController:(int)which
-{
- currentController = which;
-}
-
-- (int)currentController
-{
- return currentController;
-}
-
-/* NSDataSource */
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView
-{
- return [self elementCountForType:[config currentTypeForPlayer:currentController]];
-}
-
-- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
-{
- NSString *type = [config currentTypeForPlayer:currentController];
- if (type) {
- NSString *name = [self elementNameAtIndex:rowIndex type:type];
-
- if ([((NSString *)[aTableColumn identifier]) isEqualToString:@"key"])
- return NSLocalizedString(name, @"");
- else {
- // actual keys
- NSString *mappingName = [config mappingNamesForElement:name player:currentController];
- if (nil == mappingName) {
- return @"";
- //return NSLocalizedString(@"Double-Click to Set", @"");
- }
- return mappingName;
- }
- }
-
- return @"";
-}
-
-@end