Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 8Bitdo SFC30, IPEGA PG-9028 #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions iCade/LMBTControllerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@

typedef enum _LMBTControllerType
{
LMBTControllerType_Custom = 0,
LMBTControllerType_iCade = 1,
LMBTControllerType_iCade8Bitty = 2,
LMBTControllerType_EXHybrid = 3,
LMBTControllerType_SteelSeriesFree = 4,
LMBTControllerType_8BitdoFC30 = 5,
LMBTControllerType_iMpulse = 6,
LMBTControllerType_8BitdoNES30 = 7,
LMBTControllerType_IPEGAPG9025 = 8,
LMBTControllerType_Snakebyteidroidcon = 9
LMBTControllerType_Custom = 0,
LMBTControllerType_iCade = 1,
LMBTControllerType_iCade8Bitty = 2,
LMBTControllerType_8BitdoFC30 = 3,
LMBTControllerType_8BitdoNES30 = 4,
LMBTControllerType_8BitdoSFC30 = 5,
LMBTControllerType_IPEGAPG9025 = 6,
LMBTControllerType_IPEGAPG9028 = 7,
LMBTControllerType_SteelSeriesFree = 8,
LMBTControllerType_Snakebyteidroidcon = 9,
LMBTControllerType_iMpulse = 10
} LMBTControllerType;

@interface LMBTControllerView : iCadeReaderView {
Expand Down
65 changes: 34 additions & 31 deletions iCade/LMBTControllerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (void)setControllerType:(LMBTControllerType)controllerType
if(_controllerType != controllerType)
{
_controllerType = controllerType;

for(NSArray* controller in [LMBTControllerView supportedControllers])
{
if([[controller objectAtIndex:1] intValue] == _controllerType)
Expand All @@ -51,7 +51,7 @@ - (void)setControllerType:(LMBTControllerType)controllerType
memset(offString, '.', 12*sizeof(char));
onString[12] = '\0';
offString[12] = '\0';

NSString* controllerString = [controller objectAtIndex:2];
for(NSUInteger i=0; i<[controllerString length]; i++)
{
Expand All @@ -60,11 +60,11 @@ - (void)setControllerType:(LMBTControllerType)controllerType
else
offString[i/2] = [controllerString characterAtIndex:i];
}

/*NSLog(@"on: %s", onString);
NSLog(@"off: %s", offString);
NSLog(@"Original: %@", controllerString);*/

/*char* customOnString = "wdxa..lkoyhj";
char* customOffString = "eczq..vpgtrn";
NSMutableString* rebuilt = [NSMutableString string];
Expand All @@ -78,7 +78,7 @@ - (void)setControllerType:(LMBTControllerType)controllerType
[rebuilt appendString:[NSString stringWithCharacters:&character length:1]];
}
NSLog(@"rebuilt: %@", rebuilt);*/

[self LMBT_setOnStateString:onString
offStateString:offString];
break;
Expand All @@ -98,60 +98,63 @@ + (NSArray*)supportedControllers
// X
// SE ST Y A
// B

// map order: UP RT DN LT SE ST Y B X A L R

LMBTSupportedControllers = [[@[
/*@[@"Custom",
[NSNumber numberWithInt:LMBTControllerType_Custom],
@""],*/

// iCade
@[@"iCade",
[NSNumber numberWithInt:LMBTControllerType_iCade],
@"wedcxzaqythrufjnimkpoglv"],

// iCade 8-Bitty
@[@"iCade 8-Bitty",
[NSNumber numberWithInt:LMBTControllerType_iCade8Bitty],
@"wedcxzaqytufimkpoglvhrjn"],

// EX Hybrid
// TODO: Properly support the EX Hybrid
@[@"EX Hybrid",
[NSNumber numberWithInt:LMBTControllerType_EXHybrid],
@"wedcxzaqythrufjnimkpoglv"],

// SteelSeries Free (thanks to Infernoten)
@[@"SteelSeries Free",
[NSNumber numberWithInt:LMBTControllerType_SteelSeriesFree],
@"wedcxzaqoglvythrufjnimkp"],


// 8Bitdo FC30 (thanks to guidoscheffler)
@[@"8Bitdo FC30",
[NSNumber numberWithInt:LMBTControllerType_8BitdoFC30],
@"wedcxzaqytufimkpoglvhrjn"],

// 8Bitdo NES30 (thanks to DerekT07)
@[@"8Bitdo NES30",
[NSNumber numberWithInt:LMBTControllerType_8BitdoNES30],
@"wedcxzaqlvogythrjnufkpim"],
// iMpulse
@[@"iMpulse",
[NSNumber numberWithInt:LMBTControllerType_iMpulse],
@"wedcxzaq....lvkpogythrjn"],

// 8Bitdo SFC30 (thanks to defkode)
@[@"8Bitdo SFC30",
[NSNumber numberWithInt:LMBTControllerType_8BitdoSFC30],
@"wedcxzaqlvogythrjnufkpim"],

// IPEGA PG-9025 (thanks to naldin)
@[@"IPEGA PG-9025",
[NSNumber numberWithInt:LMBTControllerType_IPEGAPG9025],
@"wedcxzaqoglvjnufythrimkp"],


// IPEGA PG-9028 (thanks to klattimer)
@[@"IPEGA PG-9028",
[NSNumber numberWithInt:LMBTControllerType_IPEGAPG9028],
@"wedcxzaqimkpjnufythroglv"],

// SteelSeries Free (thanks to Infernoten)
@[@"SteelSeries Free",
[NSNumber numberWithInt:LMBTControllerType_SteelSeriesFree],
@"wedcxzaqoglvythrufjnimkp"],

// Snakebyte idroid:con (thanks to Gohlan)
@[@"Snakebyte idroid:con",
[NSNumber numberWithInt:LMBTControllerType_Snakebyteidroidcon],
@"wedcxzaqlvogythrjnufimkp"]

@"wedcxzaqlvogythrjnufimkp"],

// iMpulse
@[@"iMpulse",
[NSNumber numberWithInt:LMBTControllerType_iMpulse],
@"wedcxzaq....lvkpogythrjn"]
] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
return [[obj1 firstObject] compare:[obj2 firstObject]];
}] copy];
Expand Down