Convert Objective-C code to modern syntax, mainly for the NSDictionaries.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@87115 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
parent
a3ac4842bd
commit
4b4f074b66
|
@ -279,7 +279,7 @@
|
|||
- (void)editCheatCodeSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
if (returnCode == NSOKButton) {
|
||||
PcsxrCheatTemp *tmpCheat = [cheats objectAtIndex:[cheatView selectedRow]];
|
||||
PcsxrCheatTemp *tmpCheat = cheats[[cheatView selectedRow]];
|
||||
if (![tmpCheat.cheatValues isEqualToArray:tempCheatCodes]) {
|
||||
tmpCheat.cheatValues = tempCheatCodes;
|
||||
[self setDocumentEdited:YES];
|
||||
|
@ -295,7 +295,7 @@
|
|||
NSBeep();
|
||||
return;
|
||||
}
|
||||
NSMutableArray *tmpArray = [[cheats objectAtIndex:[cheatView selectedRow]] cheatValues];
|
||||
NSMutableArray *tmpArray = [cheats[[cheatView selectedRow]] cheatValues];
|
||||
NSMutableArray *newCheats = [[NSMutableArray alloc] initWithArray:tmpArray copyItems:YES];
|
||||
self.tempCheatCodes = newCheats;
|
||||
[NSApp beginSheet:editCheatWindow modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(editCheatCodeSheetDidEnd:returnCode:contextInfo:) contextInfo:NULL];
|
||||
|
|
|
@ -23,7 +23,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
|
|||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:memChangeNotifier object:nil userInfo:
|
||||
[NSDictionary dictionaryWithObject:@(theCard) forKey:memCardChangeNumberKey]];
|
||||
@{memCardChangeNumberKey: @(theCard)}];
|
||||
}
|
||||
|
||||
+ (void)setMemoryCard:(NSInteger)theCard toPath:(NSString *)theFile
|
||||
|
@ -80,7 +80,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
|
|||
[openDlg setNameFieldStringValue:[path lastPathComponent]];
|
||||
|
||||
if ([openDlg runModal] == NSFileHandlingPanelOKButton) {
|
||||
NSURL *mcdURL = [[openDlg URLs] objectAtIndex:0];
|
||||
NSURL *mcdURL = [openDlg URLs][0];
|
||||
|
||||
[ConfigurationController setMemoryCard:tag toURL:mcdURL];
|
||||
}
|
||||
|
@ -150,27 +150,27 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
|
|||
checkBoxDefaults = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// check that the outlets are active before adding them
|
||||
if (noXaAudioCell) [checkBoxDefaults setObject:noXaAudioCell forKey:@"NoXaAudio"];
|
||||
if (enableNetPlayCell) [checkBoxDefaults setObject:enableNetPlayCell forKey:@"NetPlay"];
|
||||
if (sioIrqAlwaysCell) [checkBoxDefaults setObject:sioIrqAlwaysCell forKey:@"SioIrqAlways"];
|
||||
if (bwMdecCell) [checkBoxDefaults setObject:bwMdecCell forKey:@"BlackAndWhiteMDECVideo"];
|
||||
if (autoVTypeCell) [checkBoxDefaults setObject:autoVTypeCell forKey:@"AutoDetectVideoType"];
|
||||
if (vTypePALCell) [checkBoxDefaults setObject:vTypePALCell forKey:@"VideoTypePAL"];
|
||||
if (noCDAudioCell) [checkBoxDefaults setObject:noCDAudioCell forKey:@"NoCDAudio"];
|
||||
if (usesHleCell) [checkBoxDefaults setObject:usesHleCell forKey:@"UseHLE"];
|
||||
if (usesDynarecCell) [checkBoxDefaults setObject:usesDynarecCell forKey:@"NoDynarec"];
|
||||
if (consoleOutputCell) [checkBoxDefaults setObject:consoleOutputCell forKey:@"ConsoleOutput"];
|
||||
if (spuIrqAlwaysCell) [checkBoxDefaults setObject:spuIrqAlwaysCell forKey:@"SpuIrqAlways"];
|
||||
if (rCountFixCell) [checkBoxDefaults setObject:rCountFixCell forKey:@"RootCounterFix"];
|
||||
if (vSyncWAFixCell) [checkBoxDefaults setObject:vSyncWAFixCell forKey:@"VideoSyncWAFix"];
|
||||
if (noFastBootCell) [checkBoxDefaults setObject:noFastBootCell forKey:@"NoFastBoot"];
|
||||
if (widescreen) [checkBoxDefaults setObject:widescreen forKey:@"Widescreen"];
|
||||
if (noXaAudioCell) checkBoxDefaults[@"NoXaAudio"] = noXaAudioCell;
|
||||
if (enableNetPlayCell) checkBoxDefaults[@"NetPlay"] = enableNetPlayCell;
|
||||
if (sioIrqAlwaysCell) checkBoxDefaults[@"SioIrqAlways"] = sioIrqAlwaysCell;
|
||||
if (bwMdecCell) checkBoxDefaults[@"BlackAndWhiteMDECVideo"] = bwMdecCell;
|
||||
if (autoVTypeCell) checkBoxDefaults[@"AutoDetectVideoType"] = autoVTypeCell;
|
||||
if (vTypePALCell) checkBoxDefaults[@"VideoTypePAL"] = vTypePALCell;
|
||||
if (noCDAudioCell) checkBoxDefaults[@"NoCDAudio"] = noCDAudioCell;
|
||||
if (usesHleCell) checkBoxDefaults[@"UseHLE"] = usesHleCell;
|
||||
if (usesDynarecCell) checkBoxDefaults[@"NoDynarec"] = usesDynarecCell;
|
||||
if (consoleOutputCell) checkBoxDefaults[@"ConsoleOutput"] = consoleOutputCell;
|
||||
if (spuIrqAlwaysCell) checkBoxDefaults[@"SpuIrqAlways"] = spuIrqAlwaysCell;
|
||||
if (rCountFixCell) checkBoxDefaults[@"RootCounterFix"] = rCountFixCell;
|
||||
if (vSyncWAFixCell) checkBoxDefaults[@"VideoSyncWAFix"] = vSyncWAFixCell;
|
||||
if (noFastBootCell) checkBoxDefaults[@"NoFastBoot"] = noFastBootCell;
|
||||
if (widescreen) checkBoxDefaults[@"Widescreen"] = widescreen;
|
||||
|
||||
// make the visuals match the defaults
|
||||
|
||||
for (NSString* key in checkBoxDefaults) {
|
||||
if ([defaults integerForKey:key]) {
|
||||
[[checkBoxDefaults objectForKey:key] setNextState];
|
||||
[checkBoxDefaults[key] setNextState];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
|
|||
- (NSString *)keyForSender:(id)sender
|
||||
{
|
||||
for (NSString *key in checkBoxDefaults) {
|
||||
id object = [checkBoxDefaults objectForKey:key];
|
||||
id object = checkBoxDefaults[key];
|
||||
if ([object isEqual:sender])
|
||||
return key;
|
||||
}
|
||||
|
|
|
@ -38,14 +38,14 @@
|
|||
|
||||
- (void)mapOutletToIdentifier:(id)outlet forIdentifier:(NSString*)identifier
|
||||
{
|
||||
[hotkeyOutlets setObject:outlet forKey:identifier];
|
||||
hotkeyOutlets[identifier] = outlet;
|
||||
[self setHotkeyDisplay:identifier];
|
||||
}
|
||||
|
||||
- (void)setHotkeyDisplay:(NSString*)keyIdent
|
||||
{
|
||||
NSString *label = [self parseMappingDisplayString:keyIdent];
|
||||
NSTextField *displayField = [hotkeyOutlets objectForKey:keyIdent];
|
||||
NSTextField *displayField = hotkeyOutlets[keyIdent];
|
||||
|
||||
if(displayField) {
|
||||
[[displayField cell] setStringValue:label];
|
||||
|
@ -123,12 +123,10 @@
|
|||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults] ;
|
||||
NSMutableDictionary *tempUserMappings = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:@"HotkeyBindings"]];
|
||||
[tempUserMappings setValue:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
device, @"device",
|
||||
deviceLabel, @"deviceName",
|
||||
keyCode, @"keyCode",
|
||||
keyLabel, @"keyLabel",
|
||||
nil] forKey:keyIdent];
|
||||
[tempUserMappings setValue:@{@"device": device,
|
||||
@"deviceName": deviceLabel,
|
||||
@"keyCode": keyCode,
|
||||
@"keyLabel": keyLabel} forKey:keyIdent];
|
||||
[defaults setValue:tempUserMappings forKey:@"HotkeyBindings"];
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
- (void)addToDictionary:(NSMutableDictionary*)toAdd
|
||||
{
|
||||
[toAdd setObject:self forKey:self.argument];
|
||||
toAdd[self.argument] = self;
|
||||
}
|
||||
|
||||
- (NSString*)description
|
||||
|
|
|
@ -2560,6 +2560,7 @@
|
|||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2575,6 +2576,7 @@
|
|||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2592,6 +2594,7 @@
|
|||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2607,6 +2610,7 @@
|
|||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2630,6 +2634,7 @@
|
|||
);
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2651,6 +2656,7 @@
|
|||
);
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2671,6 +2677,7 @@
|
|||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
OTHER_CFLAGS = "$(OPTIMIZATION_CFLAGS)";
|
||||
PRODUCT_NAME = PeopsSoftGPU;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2690,6 +2697,7 @@
|
|||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
OTHER_CFLAGS = "$(OPTIMIZATION_CFLAGS)";
|
||||
PRODUCT_NAME = PeopsSoftGPU;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2716,6 +2724,7 @@
|
|||
INFOPLIST_FILE = "plugins/DFSound/Info-SDL.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2740,6 +2749,7 @@
|
|||
INFOPLIST_FILE = "plugins/DFSound/Info-SDL.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2765,6 +2775,7 @@
|
|||
"plugins/DFSound/Resorces/Shared/SPUShared-info.plist",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -2788,6 +2799,7 @@
|
|||
"plugins/DFSound/Resorces/Shared/SPUShared-info.plist",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -2808,6 +2820,7 @@
|
|||
INFOPLIST_FILE = "plugins/DFSound/Info-AL.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2827,6 +2840,7 @@
|
|||
INFOPLIST_FILE = "plugins/DFSound/Info-AL.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2848,6 +2862,7 @@
|
|||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
OTHER_CFLAGS = "$(OPTIMIZATION_CFLAGS)";
|
||||
PRODUCT_NAME = PeopsXGL;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2867,6 +2882,7 @@
|
|||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
OTHER_CFLAGS = "$(OPTIMIZATION_CFLAGS)";
|
||||
PRODUCT_NAME = PeopsXGL;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2884,6 +2900,7 @@
|
|||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2899,6 +2916,7 @@
|
|||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2948,6 +2966,7 @@
|
|||
"$(inherited)",
|
||||
);
|
||||
PRODUCT_NAME = PCSXR;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -2972,6 +2991,7 @@
|
|||
"plugins/DFSound/Resorces/Shared/SPUShared-info.plist",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Instrument;
|
||||
};
|
||||
|
@ -2986,6 +3006,7 @@
|
|||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -3007,6 +3028,7 @@
|
|||
);
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -3026,6 +3048,7 @@
|
|||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
OTHER_CFLAGS = "$(OPTIMIZATION_CFLAGS)";
|
||||
PRODUCT_NAME = PeopsSoftGPU;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -3045,6 +3068,7 @@
|
|||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
OTHER_CFLAGS = "$(OPTIMIZATION_CFLAGS)";
|
||||
PRODUCT_NAME = PeopsXGL;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -3069,6 +3093,7 @@
|
|||
INFOPLIST_FILE = "plugins/DFSound/Info-SDL.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -3088,6 +3113,7 @@
|
|||
INFOPLIST_FILE = "plugins/DFSound/Info-AL.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -3103,6 +3129,7 @@
|
|||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -3118,6 +3145,7 @@
|
|||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = psxplugin;
|
||||
};
|
||||
name = Instrument;
|
||||
|
@ -3166,6 +3194,7 @@
|
|||
LD_NO_PIE = YES;
|
||||
OTHER_CFLAGS = "$(inherited)";
|
||||
PRODUCT_NAME = PCSXR;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -3195,6 +3224,7 @@
|
|||
"$(inherited)",
|
||||
);
|
||||
PRODUCT_NAME = PCSXR;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
@ -110,7 +110,7 @@ void ShowHelpAndExit(FILE* output, int exitCode)
|
|||
|
||||
if ([openDlg runModal] == NSFileHandlingPanelOKButton) {
|
||||
NSArray* files = [openDlg URLs];
|
||||
SetIsoFile((const char *)[[[files objectAtIndex:0] path] fileSystemRepresentation]);
|
||||
SetIsoFile([[files[0] path] fileSystemRepresentation]);
|
||||
SetCdOpenCaseTime(time(NULL) + 2);
|
||||
LidInterrupt();
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ void ShowHelpAndExit(FILE* output, int exitCode)
|
|||
[openDlg setAllowedFileTypes:[PcsxrDiscHandler supportedUTIs]];
|
||||
|
||||
if ([openDlg runModal] == NSFileHandlingPanelOKButton) {
|
||||
NSURL *url = [[openDlg URLs] objectAtIndex:0];
|
||||
NSURL *url = [openDlg URLs][0];
|
||||
[recentItems addRecentItem:url];
|
||||
[self runURL:url];
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ otherblock();\
|
|||
self.sleepInBackground = [[NSUserDefaults standardUserDefaults] boolForKey:@"PauseInBackground"];
|
||||
|
||||
NSArray *progArgs = [[NSProcessInfo processInfo] arguments];
|
||||
if ([progArgs count] > 1 && ![[progArgs objectAtIndex:1] hasPrefix:@"-psn"]) {
|
||||
if ([progArgs count] > 1 && ![progArgs[1] hasPrefix:@"-psn"]) {
|
||||
self.skipFiles = [NSMutableArray array];
|
||||
|
||||
BOOL isLaunchable = NO;
|
||||
|
@ -491,7 +491,7 @@ otherblock();\
|
|||
if ([progArgs count] <= ++i) {
|
||||
ParseErrorStr(@"Not enough arguments.");
|
||||
}
|
||||
NSString *path = [[progArgs objectAtIndex:i] stringByExpandingTildeInPath];
|
||||
NSString *path = [progArgs[i] stringByExpandingTildeInPath];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:path])
|
||||
{
|
||||
ParseErrorStr([NSString stringWithFormat:@"The file \"%@\" does not exist.", path]);
|
||||
|
@ -512,7 +512,7 @@ otherblock();\
|
|||
HandleArgElse(kPCSXRArgumentMcd2, NO, ^{mcdBlock(2);})
|
||||
HandleArgElse(kPCSXRArgumentFreeze, NO, freezeBlock)
|
||||
else {
|
||||
[unknownOptions addObject:[progArgs objectAtIndex:i]];
|
||||
[unknownOptions addObject:progArgs[i]];
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
@ -526,7 +526,7 @@ otherblock();\
|
|||
unknownOptions = nil;
|
||||
if (!isLaunchable && hasParsedAnArgument) {
|
||||
NSMutableArray *mutProgArgs = [NSMutableArray arrayWithArray:progArgs];
|
||||
NSString *appRawPath = [mutProgArgs objectAtIndex:0];
|
||||
NSString *appRawPath = mutProgArgs[0];
|
||||
//Remove the app file path from the array
|
||||
[mutProgArgs removeObjectAtIndex:0];
|
||||
NSString *arg = [mutProgArgs componentsJoinedByString:@" "];
|
||||
|
@ -567,7 +567,7 @@ otherblock();\
|
|||
}*/
|
||||
|
||||
for (NSString *key in prefByteKeys) {
|
||||
u8 *dst = (u8 *)[[prefByteKeys objectForKey:key] pointerValue];
|
||||
u8 *dst = (u8 *)[prefByteKeys[key] pointerValue];
|
||||
if (dst != NULL) *dst = [defaults boolForKey:key];
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ otherblock();\
|
|||
if ([defaults boolForKey:@"UseHLE"] || 0 == [biosList count]) {
|
||||
strcpy(Config.Bios, "HLE");
|
||||
} else {
|
||||
str = [(NSString *)[biosList objectAtIndex:0] fileSystemRepresentation];
|
||||
str = [(NSString *)biosList[0] fileSystemRepresentation];
|
||||
if (str != nil) strlcpy(Config.Bios, str, MAXPATHLEN);
|
||||
else strcpy(Config.Bios, "HLE");
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ otherblock();\
|
|||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
char *str = (char *)[[prefStringKeys objectForKey:defaultKey] pointerValue];
|
||||
char *str = (char *)[prefStringKeys[defaultKey] pointerValue];
|
||||
if (str) {
|
||||
NSString *tmpNSStr = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:str length:strlen(str)];
|
||||
if (!tmpNSStr) {
|
||||
|
@ -642,7 +642,7 @@ otherblock();\
|
|||
return;
|
||||
}
|
||||
|
||||
str = (char *)[[prefURLKeys objectForKey:defaultKey] pointerValue];
|
||||
str = (char *)[prefURLKeys[defaultKey] pointerValue];
|
||||
if (str) {
|
||||
NSString *tmpNSStr = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:str length:strlen(str)];
|
||||
if (!tmpNSStr) {
|
||||
|
@ -652,7 +652,7 @@ otherblock();\
|
|||
return;
|
||||
}
|
||||
|
||||
u8 *val = (u8 *)[[prefByteKeys objectForKey:defaultKey] pointerValue];
|
||||
u8 *val = (u8 *)[prefByteKeys[defaultKey] pointerValue];
|
||||
if (val) {
|
||||
[defaults setInteger:*val forKey:defaultKey];
|
||||
return;
|
||||
|
@ -670,46 +670,37 @@ otherblock();\
|
|||
NSString *path;
|
||||
const char *str;
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@YES, @"NoDynarec",
|
||||
@YES, @"AutoDetectVideoType",
|
||||
@NO, @"UseHLE",
|
||||
@YES, @"PauseInBackground",
|
||||
@NO, @"Widescreen",
|
||||
@NO, @"NetPlay",
|
||||
nil];
|
||||
NSDictionary *appDefaults = @{@"NoDynarec": @YES,
|
||||
@"AutoDetectVideoType": @YES,
|
||||
@"UseHLE": @NO,
|
||||
@"PauseInBackground": @YES,
|
||||
@"Widescreen": @NO,
|
||||
@"NetPlay": @NO};
|
||||
|
||||
[defaults registerDefaults:appDefaults];
|
||||
|
||||
prefStringKeys = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSValue valueWithPointer:Config.Gpu], @"PluginGPU",
|
||||
[NSValue valueWithPointer:Config.Spu], @"PluginSPU",
|
||||
[NSValue valueWithPointer:Config.Pad1], @"PluginPAD",
|
||||
[NSValue valueWithPointer:Config.Cdr], @"PluginCDR",
|
||||
[NSValue valueWithPointer:Config.Net], @"PluginNET",
|
||||
[NSValue valueWithPointer:Config.Sio1], @"PluginSIO1",
|
||||
nil];
|
||||
prefStringKeys = @{@"PluginGPU": [NSValue valueWithPointer:Config.Gpu],
|
||||
@"PluginSPU": [NSValue valueWithPointer:Config.Spu],
|
||||
@"PluginPAD": [NSValue valueWithPointer:Config.Pad1],
|
||||
@"PluginCDR": [NSValue valueWithPointer:Config.Cdr],
|
||||
@"PluginNET": [NSValue valueWithPointer:Config.Net],
|
||||
@"PluginSIO1": [NSValue valueWithPointer:Config.Sio1]};
|
||||
|
||||
prefURLKeys = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSValue valueWithPointer:Config.Mcd1], @"Mcd1",
|
||||
[NSValue valueWithPointer:Config.Mcd2], @"Mcd2",
|
||||
nil];
|
||||
prefURLKeys = @{@"Mcd1": [NSValue valueWithPointer:Config.Mcd1],
|
||||
@"Mcd2": [NSValue valueWithPointer:Config.Mcd2]};
|
||||
|
||||
prefByteKeys = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSValue valueWithPointer:&Config.Xa], @"NoXaAudio",
|
||||
//[NSValue valueWithPointer:&Config.UseNet], @"NetPlay",
|
||||
[NSValue valueWithPointer:&Config.SioIrq], @"SioIrqAlways",
|
||||
[NSValue valueWithPointer:&Config.Mdec], @"BlackAndWhiteMDECVideo",
|
||||
[NSValue valueWithPointer:&Config.PsxAuto], @"AutoDetectVideoType",
|
||||
[NSValue valueWithPointer:&Config.PsxType], @"VideoTypePAL",
|
||||
[NSValue valueWithPointer:&Config.Cdda], @"NoCDAudio",
|
||||
[NSValue valueWithPointer:&Config.Cpu], @"NoDynarec",
|
||||
[NSValue valueWithPointer:&Config.PsxOut], @"ConsoleOutput",
|
||||
[NSValue valueWithPointer:&Config.SpuIrq], @"SpuIrqAlways",
|
||||
[NSValue valueWithPointer:&Config.RCntFix], @"RootCounterFix",
|
||||
[NSValue valueWithPointer:&Config.VSyncWA], @"VideoSyncWAFix",
|
||||
[NSValue valueWithPointer:&Config.Widescreen], @"Widescreen",
|
||||
nil];
|
||||
prefByteKeys = @{@"NoXaAudio": [NSValue valueWithPointer:&Config.Xa],
|
||||
@"SioIrqAlways": [NSValue valueWithPointer:&Config.SioIrq],
|
||||
@"BlackAndWhiteMDECVideo": [NSValue valueWithPointer:&Config.Mdec],
|
||||
@"AutoDetectVideoType": [NSValue valueWithPointer:&Config.PsxAuto],
|
||||
@"VideoTypePAL": [NSValue valueWithPointer:&Config.PsxType],
|
||||
@"NoCDAudio": [NSValue valueWithPointer:&Config.Cdda],
|
||||
@"NoDynarec": [NSValue valueWithPointer:&Config.Cpu],
|
||||
@"ConsoleOutput": [NSValue valueWithPointer:&Config.PsxOut],
|
||||
@"SpuIrqAlways": [NSValue valueWithPointer:&Config.SpuIrq],
|
||||
@"RootCounterFix": [NSValue valueWithPointer:&Config.RCntFix],
|
||||
@"VideoSyncWAFix": [NSValue valueWithPointer:&Config.VSyncWA],
|
||||
@"Widescreen": [NSValue valueWithPointer:&Config.Widescreen]};
|
||||
|
||||
// setup application support paths
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
|
|
|
@ -181,7 +181,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
|||
#endif
|
||||
return NO;
|
||||
}
|
||||
PcsxrMemoryObject *tmpObj = [rawArray objectAtIndex:idx];
|
||||
PcsxrMemoryObject *tmpObj = rawArray[idx];
|
||||
|
||||
int memSize = tmpObj.blockSize;
|
||||
|
||||
|
@ -260,7 +260,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
|||
return [self freeBlocks];
|
||||
}
|
||||
|
||||
return [[rawArray objectAtIndex:idx] blockSize];
|
||||
return [rawArray[idx] blockSize];
|
||||
}
|
||||
|
||||
- (void)compactMemory
|
||||
|
@ -317,7 +317,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
|||
return;
|
||||
}
|
||||
|
||||
PcsxrMemoryObject *theObj = [rawArray objectAtIndex:slotnum];
|
||||
PcsxrMemoryObject *theObj = rawArray[slotnum];
|
||||
|
||||
McdBlock flagBlock;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
- (void)memoryCardDidChangeNotification:(NSNotification *)aNote
|
||||
{
|
||||
NSDictionary *dict = [aNote userInfo];
|
||||
NSNumber *theNum = [dict objectForKey:memCardChangeNumberKey];
|
||||
NSNumber *theNum = dict[memCardChangeNumberKey];
|
||||
[self setupValues: theNum ? [theNum intValue] : 3];
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@
|
|||
|
||||
int cardSize, freeConsBlocks, availBlocks;
|
||||
|
||||
if ([[[fromCard memoryArray] objectAtIndex:selectedIndex] flagNameIndex] == memFlagFree) {
|
||||
if ([[fromCard memoryArray][selectedIndex] flagNameIndex] == memFlagFree) {
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@
|
|||
freeConsBlocks = [toCard indexOfFreeBlocksWithSize:cardSize];
|
||||
availBlocks = [toCard availableBlocks];
|
||||
if (freeConsBlocks == -1 && availBlocks >= cardSize) {
|
||||
PcsxrMemoryObject *tmpmemobj = [fromCard.memoryArray objectAtIndex:selectedIndex];
|
||||
PcsxrMemoryObject *tmpmemobj = (fromCard.memoryArray)[selectedIndex];
|
||||
NSInteger copyOK = NSRunInformationalAlertPanel(NSLocalizedString(@"Free Size", nil), NSLocalizedString(@"Memory card %i does not have enough free consecutive blocks.\n\nIn order to copy over \"%@ (%@),\" memory card %i must be compressed. Compressing memory cards will make deleted blocks unrecoverable.\n\nDo you want to continue?", nil), NSLocalizedString(@"Yes", nil), NSLocalizedString(@"No", nil), nil, cardnum, tmpmemobj.englishName, tmpmemobj.sjisName, cardnum);
|
||||
if (copyOK != NSAlertDefaultReturn) {
|
||||
return;
|
||||
|
@ -195,7 +195,7 @@
|
|||
|
||||
NSInteger selectedIndex = [selected firstIndex];
|
||||
|
||||
PcsxrMemoryObject *tmpObj = [[curCard memoryArray] objectAtIndex:selectedIndex];
|
||||
PcsxrMemoryObject *tmpObj = [curCard memoryArray][selectedIndex];
|
||||
|
||||
if (tmpObj.flagNameIndex == memFlagFree) {
|
||||
NSBeep();
|
||||
|
|
|
@ -222,7 +222,7 @@ static NSString *MemLabelEndLink;
|
|||
if (memImageIndex == -1) {
|
||||
return [PcsxrMemoryObject blankImage];
|
||||
}
|
||||
return [memImages objectAtIndex:memImageIndex];
|
||||
return memImages[memImageIndex];
|
||||
}
|
||||
|
||||
- (NSString*)flagName
|
||||
|
|
|
@ -238,7 +238,7 @@
|
|||
- (void)runCommand:(id)arg
|
||||
{
|
||||
@autoreleasepool {
|
||||
NSString *funcName = [arg objectAtIndex:0];
|
||||
NSString *funcName = arg[0];
|
||||
long (*func)(void);
|
||||
|
||||
func = SysLoadSym(pluginRef, [funcName cStringUsingEncoding:NSASCIIStringEncoding]);
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
|
||||
- (IBAction)doAbout:(id)sender
|
||||
{
|
||||
PcsxrPlugin *plugin = [plugins objectAtIndex:[pluginMenu indexOfSelectedItem]];
|
||||
PcsxrPlugin *plugin = plugins[[pluginMenu indexOfSelectedItem]];
|
||||
[plugin aboutAs:pluginType];
|
||||
}
|
||||
|
||||
- (IBAction)doConfigure:(id)sender
|
||||
{
|
||||
PcsxrPlugin *plugin = [plugins objectAtIndex:[pluginMenu indexOfSelectedItem]];
|
||||
PcsxrPlugin *plugin = plugins[[pluginMenu indexOfSelectedItem]];
|
||||
[plugin configureAs:pluginType];
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
if (sender == pluginMenu) {
|
||||
NSInteger index = [pluginMenu indexOfSelectedItem];
|
||||
if (index != -1) {
|
||||
PcsxrPlugin *plugin = [plugins objectAtIndex:index];
|
||||
PcsxrPlugin *plugin = plugins[index];
|
||||
|
||||
if (![[PluginList list] setActivePlugin:plugin forType:pluginType]) {
|
||||
/* plugin won't initialize */
|
||||
|
|
|
@ -77,7 +77,7 @@ const static int typeList[] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD, P
|
|||
|
||||
// verify that the ones that are in list still works
|
||||
for (i=0; i < [pluginList count]; i++) {
|
||||
if (![[pluginList objectAtIndex:i] verifyOK]) {
|
||||
if (![pluginList[i] verifyOK]) {
|
||||
[pluginList removeObjectAtIndex:i]; i--;
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ const static int typeList[] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD, P
|
|||
NSUInteger j;
|
||||
|
||||
for (j=0; j < [list count]; j++) {
|
||||
if ([self setActivePlugin:[list objectAtIndex:j] forType:typeList[i]])
|
||||
if ([self setActivePlugin:list[j] forType:typeList[i]])
|
||||
break;
|
||||
}
|
||||
if (j == [list count])
|
||||
|
|
|
@ -44,7 +44,7 @@ void prevState() {
|
|||
|
||||
BOOL handleHotkey(NSString* keyCode) {
|
||||
if([EmuThread active]) { // Don't catch hotkeys if there is no emulation
|
||||
NSNumber *ident = [hotkeys objectForKey:keyCode];
|
||||
NSNumber *ident = hotkeys[keyCode];
|
||||
|
||||
if(ident != nil) {
|
||||
switch([ident intValue]) {
|
||||
|
@ -87,19 +87,19 @@ BOOL handleHotkey(NSString* keyCode) {
|
|||
|
||||
void setupHotkey(int hk, NSString *label, NSDictionary *binding) {
|
||||
if(binding != nil)
|
||||
[hotkeys setObject:@(hk) forKey:[binding objectForKey:@"keyCode"]];
|
||||
hotkeys[binding[@"keyCode"]] = @(hk);
|
||||
}
|
||||
|
||||
void setupHotkeys() {
|
||||
NSDictionary *bindings = [[NSUserDefaults standardUserDefaults] objectForKey:@"HotkeyBindings"];
|
||||
hotkeys = [[NSMutableDictionary alloc] initWithCapacity:[bindings count]];
|
||||
|
||||
setupHotkey(HK_FAST_FORWARD, @"FastForward", [bindings objectForKey:@"FastForward"]);
|
||||
setupHotkey(HK_SAVE_STATE, @"SaveState", [bindings objectForKey:@"SaveState"]);
|
||||
setupHotkey(HK_LOAD_STATE, @"LoadState", [bindings objectForKey:@"LoadState"]);
|
||||
setupHotkey(HK_NEXT_STATE, @"NextState", [bindings objectForKey:@"NextState"]);
|
||||
setupHotkey(HK_PREV_STATE, @"PrevState", [bindings objectForKey:@"PrevState"]);
|
||||
setupHotkey(HK_FRAME_LIMIT, @"FrameLimit", [bindings objectForKey:@"FrameLimit"]);
|
||||
setupHotkey(HK_FAST_FORWARD, @"FastForward", bindings[@"FastForward"]);
|
||||
setupHotkey(HK_SAVE_STATE, @"SaveState", bindings[@"SaveState"]);
|
||||
setupHotkey(HK_LOAD_STATE, @"LoadState", bindings[@"LoadState"]);
|
||||
setupHotkey(HK_NEXT_STATE, @"NextState", bindings[@"NextState"]);
|
||||
setupHotkey(HK_PREV_STATE, @"PrevState", bindings[@"PrevState"]);
|
||||
setupHotkey(HK_FRAME_LIMIT, @"FrameLimit", bindings[@"FrameLimit"]);
|
||||
|
||||
currentState = 0;
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ void SysMessage(const char *fmt, ...) {
|
|||
NSString *msg = [[NSString alloc] initWithFormat:locFmtString arguments:list];
|
||||
va_end(list);
|
||||
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:msg forKey:NSLocalizedFailureReasonErrorKey];
|
||||
NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: msg};
|
||||
|
||||
RunOnMainThreadSync(^{
|
||||
[NSApp presentError:[NSError errorWithDomain:@"Unknown Domain" code:-1 userInfo:userInfo]];
|
||||
|
@ -238,7 +238,7 @@ void SysClose() {
|
|||
|
||||
//Tell the memory card manager that the memory cards changed.
|
||||
//The number three tells the mem card manager to update both cards 1 and 2.
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:memChangeNotifier object:nil userInfo:[NSDictionary dictionaryWithObject:@3 forKey:memCardChangeNumberKey]];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:memChangeNotifier object:nil userInfo:@{memCardChangeNumberKey: @3}];
|
||||
}
|
||||
|
||||
void OnFile_Exit() {
|
||||
|
|
|
@ -55,14 +55,12 @@ void AboutDlgProc()
|
|||
[icon setSize:size];
|
||||
|
||||
NSDictionary *infoPaneDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
|
||||
icon, @"ApplicationIcon",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version",
|
||||
[bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright",
|
||||
credits, @"Credits",
|
||||
nil];
|
||||
@{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"],
|
||||
@"ApplicationIcon": icon,
|
||||
@"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
|
||||
@"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
|
||||
@"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"],
|
||||
@"Credits": credits};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict];
|
||||
});
|
||||
|
@ -98,20 +96,17 @@ void ReadConfig()
|
|||
{
|
||||
NSDictionary *keyValues;
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@NO, kSioEnabled,
|
||||
@33307, kSioPort,
|
||||
@"127.0.0.1", kSioIPAddress,
|
||||
@(PLAYER_DISABLED), kSioPlayer,
|
||||
nil], PrefsKey, nil]];
|
||||
[defaults registerDefaults:@{PrefsKey: @{kSioEnabled: @NO,
|
||||
kSioPort: @33307,
|
||||
kSioIPAddress: @"127.0.0.1",
|
||||
kSioPlayer: @(PLAYER_DISABLED)}}];
|
||||
|
||||
keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
|
||||
settings.enabled = [[keyValues objectForKey:kSioEnabled] boolValue];
|
||||
settings.port = [[keyValues objectForKey:kSioPort] unsignedShortValue];
|
||||
settings.player = [[keyValues objectForKey:kSioPlayer] intValue];
|
||||
strlcpy(settings.ip, [[keyValues objectForKey:kSioIPAddress] cStringUsingEncoding:NSASCIIStringEncoding], sizeof(settings.ip));
|
||||
settings.enabled = [keyValues[kSioEnabled] boolValue];
|
||||
settings.port = [keyValues[kSioPort] unsignedShortValue];
|
||||
settings.player = [keyValues[kSioPlayer] intValue];
|
||||
strlcpy(settings.ip, [keyValues[kSioIPAddress] cStringUsingEncoding:NSASCIIStringEncoding], sizeof(settings.ip));
|
||||
}
|
||||
|
||||
@implementation Bladesio1PluginConfigController
|
||||
|
@ -137,9 +132,9 @@ void ReadConfig()
|
|||
return;
|
||||
}
|
||||
|
||||
[writeDic setObject:(([enabledButton state] == NSOnState) ? @YES : @NO) forKey:kSioEnabled];
|
||||
[writeDic setObject:theAddress forKey:kSioIPAddress];
|
||||
[writeDic setObject:@((u16)[portField intValue]) forKey:kSioPort];
|
||||
writeDic[kSioEnabled] = (([enabledButton state] == NSOnState) ? @YES : @NO);
|
||||
writeDic[kSioIPAddress] = theAddress;
|
||||
writeDic[kSioPort] = @((u16)[portField intValue]);
|
||||
|
||||
{
|
||||
int player;
|
||||
|
@ -149,7 +144,7 @@ void ReadConfig()
|
|||
case 1: player = PLAYER_MASTER; break;
|
||||
case 2: player = PLAYER_SLAVE; break;
|
||||
}
|
||||
[writeDic setObject:@(player) forKey:kSioPlayer];
|
||||
writeDic[kSioPlayer] = @(player);
|
||||
}
|
||||
|
||||
// write to defaults
|
||||
|
@ -166,7 +161,7 @@ void ReadConfig()
|
|||
{
|
||||
BOOL isEnabled = [enabledButton state] == NSOnState ? YES : NO;
|
||||
|
||||
for (NSView *subView in [[[configBox subviews] objectAtIndex:0] subviews]) {
|
||||
for (NSView *subView in [[configBox subviews][0] subviews]) {
|
||||
if ([subView isKindOfClass:[NSTextField class]] && ![(NSTextField*)subView isEditable]) {
|
||||
[(NSTextField*)subView setTextColor:isEnabled ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
|
||||
} else {
|
||||
|
@ -192,11 +187,11 @@ void ReadConfig()
|
|||
// load from preferences
|
||||
keyValues = [[defaults dictionaryForKey:PrefsKey] mutableCopy];
|
||||
|
||||
[enabledButton setState: [[keyValues objectForKey:kSioEnabled] boolValue] ? NSOnState : NSOffState];
|
||||
[ipAddressField setTitleWithMnemonic:[keyValues objectForKey:kSioIPAddress]];
|
||||
[portField setIntValue:[[keyValues objectForKey:kSioPort] intValue]];
|
||||
[enabledButton setState: [keyValues[kSioEnabled] boolValue] ? NSOnState : NSOffState];
|
||||
[ipAddressField setTitleWithMnemonic:keyValues[kSioIPAddress]];
|
||||
[portField setIntValue:[keyValues[kSioPort] intValue]];
|
||||
|
||||
switch ([[keyValues objectForKey:kSioPlayer] integerValue]) {
|
||||
switch ([keyValues[kSioPlayer] integerValue]) {
|
||||
default:
|
||||
case PLAYER_DISABLED: [playerMenu selectItemAtIndex:0]; break;
|
||||
case PLAYER_MASTER: [playerMenu selectItemAtIndex:1]; break;
|
||||
|
|
|
@ -58,14 +58,12 @@ void AboutDlgProc()
|
|||
[icon setSize:size];
|
||||
|
||||
NSDictionary *infoPaneDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
|
||||
icon, @"ApplicationIcon",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version",
|
||||
[bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright",
|
||||
credits, @"Credits",
|
||||
nil];
|
||||
@{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"],
|
||||
@"ApplicationIcon": icon,
|
||||
@"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
|
||||
@"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
|
||||
@"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"],
|
||||
@"Credits": credits};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict];
|
||||
});
|
||||
|
@ -92,18 +90,15 @@ void ReadConfig()
|
|||
{
|
||||
NSDictionary *keyValues;
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@YES, @"Threaded",
|
||||
@64, @"Cache Size",
|
||||
@0, @"Speed",
|
||||
nil], PrefsKey, nil]];
|
||||
[defaults registerDefaults:@{PrefsKey: @{@"Threaded": @YES,
|
||||
@"Cache Size": @64,
|
||||
@"Speed": @0}}];
|
||||
|
||||
keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
|
||||
ReadMode = ([[keyValues objectForKey:@"Threaded"] boolValue] ? THREADED : NORMAL);
|
||||
CacheSize = [[keyValues objectForKey:@"Cache Size"] intValue];
|
||||
CdrSpeed = [[keyValues objectForKey:@"Speed"] integerValue];
|
||||
ReadMode = ([keyValues[@"Threaded"] boolValue] ? THREADED : NORMAL);
|
||||
CacheSize = [keyValues[@"Cache Size"] intValue];
|
||||
CdrSpeed = [keyValues[@"Speed"] integerValue];
|
||||
}
|
||||
|
||||
@implementation PluginConfigController
|
||||
|
@ -121,17 +116,17 @@ void ReadConfig()
|
|||
|
||||
NSMutableDictionary *writeDic = [keyValues mutableCopy];
|
||||
|
||||
[writeDic setObject:([Cached intValue] ? @YES : @NO) forKey:@"Threaded"];
|
||||
[writeDic setObject:@([CacheSize integerValue]) forKey:@"Cache Size"];
|
||||
writeDic[@"Threaded"] = ([Cached intValue] ? @YES : @NO);
|
||||
writeDic[@"Cache Size"] = @([CacheSize integerValue]);
|
||||
|
||||
switch ([CdSpeed indexOfSelectedItem]) {
|
||||
case 1: [writeDic setObject:@1 forKey:@"Speed"]; break;
|
||||
case 2: [writeDic setObject:@2 forKey:@"Speed"]; break;
|
||||
case 3: [writeDic setObject:@4 forKey:@"Speed"]; break;
|
||||
case 4: [writeDic setObject:@8 forKey:@"Speed"]; break;
|
||||
case 5: [writeDic setObject:@16 forKey:@"Speed"]; break;
|
||||
case 6: [writeDic setObject:@32 forKey:@"Speed"]; break;
|
||||
default: [writeDic setObject:@0 forKey:@"Speed"]; break;
|
||||
case 1: writeDic[@"Speed"] = @1; break;
|
||||
case 2: writeDic[@"Speed"] = @2; break;
|
||||
case 3: writeDic[@"Speed"] = @4; break;
|
||||
case 4: writeDic[@"Speed"] = @8; break;
|
||||
case 5: writeDic[@"Speed"] = @16; break;
|
||||
case 6: writeDic[@"Speed"] = @32; break;
|
||||
default: writeDic[@"Speed"] = @0; break;
|
||||
}
|
||||
|
||||
// write to defaults
|
||||
|
@ -154,10 +149,10 @@ void ReadConfig()
|
|||
// load from preferences
|
||||
self.keyValues = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:PrefsKey]];
|
||||
|
||||
[Cached setIntValue:[[keyValues objectForKey:@"Threaded"] intValue]];
|
||||
[CacheSize setIntegerValue:[[keyValues objectForKey:@"Cache Size"] integerValue]];
|
||||
[Cached setIntValue:[keyValues[@"Threaded"] intValue]];
|
||||
[CacheSize setIntegerValue:[keyValues[@"Cache Size"] integerValue]];
|
||||
|
||||
switch ([[keyValues objectForKey:@"Speed"] intValue]) {
|
||||
switch ([keyValues[@"Speed"] intValue]) {
|
||||
case 1: [CdSpeed selectItemAtIndex:1]; break;
|
||||
case 2: [CdSpeed selectItemAtIndex:2]; break;
|
||||
case 4: [CdSpeed selectItemAtIndex:3]; break;
|
||||
|
|
|
@ -113,7 +113,7 @@ static const int DPad[DKEY_TOTAL] = {
|
|||
row:(NSInteger)rowIndex
|
||||
{
|
||||
if ([[aTableColumn identifier] isEqualToString:@"key"]) {
|
||||
return [labelText objectAtIndex:rowIndex];
|
||||
return labelText[rowIndex];
|
||||
} else {
|
||||
char buf[256] = {0};
|
||||
|
||||
|
|
|
@ -137,12 +137,9 @@ void LoadPADConfig()
|
|||
{
|
||||
SetDefaultConfig();
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:
|
||||
[NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
DefaultPadArray(0), kDFPad1,
|
||||
DefaultPadArray(1), kDFPad2,
|
||||
@YES, kDFThreading,
|
||||
nil]
|
||||
forKey:PrefsKey]];
|
||||
@{PrefsKey: @{kDFPad1: DefaultPadArray(0),
|
||||
kDFPad2: DefaultPadArray(1),
|
||||
kDFThreading: @YES}}];
|
||||
|
||||
//Load the old preferences if present.
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
@ -305,9 +302,9 @@ void LoadPADConfig()
|
|||
[fm removeItemAtPath:oldPrefPath error:NULL];
|
||||
} else {
|
||||
NSDictionary *dfPrefs = [[NSUserDefaults standardUserDefaults] dictionaryForKey:PrefsKey];
|
||||
g.cfg.Threaded = [[dfPrefs objectForKey:kDFThreading] boolValue];
|
||||
LoadPadArray(0, [dfPrefs objectForKey:kDFPad1]);
|
||||
LoadPadArray(1, [dfPrefs objectForKey:kDFPad2]);
|
||||
g.cfg.Threaded = [dfPrefs[kDFThreading] boolValue];
|
||||
LoadPadArray(0, dfPrefs[kDFPad1]);
|
||||
LoadPadArray(1, dfPrefs[kDFPad2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,18 +313,16 @@ void SavePADConfig()
|
|||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSMutableDictionary *pad1Dict = nil, *pad2Dict = nil;
|
||||
NSDictionary *prefDict = [defaults dictionaryForKey:PrefsKey];
|
||||
pad1Dict = [[NSMutableDictionary alloc] initWithDictionary:[prefDict objectForKey:kDFPad1]];
|
||||
pad2Dict = [[NSMutableDictionary alloc] initWithDictionary:[prefDict objectForKey:kDFPad2]];
|
||||
pad1Dict = [[NSMutableDictionary alloc] initWithDictionary:prefDict[kDFPad1]];
|
||||
pad2Dict = [[NSMutableDictionary alloc] initWithDictionary:prefDict[kDFPad2]];
|
||||
prefDict = nil;
|
||||
|
||||
[pad1Dict addEntriesFromDictionary:SavePadArray(0)];
|
||||
[pad2Dict addEntriesFromDictionary:SavePadArray(1)];
|
||||
|
||||
[defaults setObject:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
g.cfg.Threaded ? @YES : @NO, kDFThreading,
|
||||
pad1Dict, kDFPad1,
|
||||
pad2Dict, kDFPad2,
|
||||
nil] forKey:PrefsKey];
|
||||
[defaults setObject:@{kDFThreading: g.cfg.Threaded ? @YES : @NO,
|
||||
kDFPad1: pad1Dict,
|
||||
kDFPad2: pad2Dict} forKey:PrefsKey];
|
||||
[defaults synchronize];
|
||||
}
|
||||
|
||||
|
@ -352,14 +347,12 @@ void DoAbout()
|
|||
[icon setSize:size];
|
||||
|
||||
NSDictionary *infoPaneDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
|
||||
icon, @"ApplicationIcon",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version",
|
||||
[bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright",
|
||||
credits, @"Credits",
|
||||
nil];
|
||||
@{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"],
|
||||
@"ApplicationIcon": icon,
|
||||
@"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
|
||||
@"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
|
||||
@"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"],
|
||||
@"Credits": credits};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict];
|
||||
});
|
||||
|
|
|
@ -63,21 +63,21 @@ NSDictionary *DefaultPadArray(int padnum)
|
|||
[NSMutableDictionary dictionaryWithObjectsAndKeys:@3, joyVal, @(BUTTON), joyType, nil], dSquare,
|
||||
nil];
|
||||
if (padnum == 0) {
|
||||
[[mutArray objectForKey:dSelect] setObject:@9 forKey:dfKey];
|
||||
[[mutArray objectForKey:dStart] setObject:@10 forKey:dfKey];
|
||||
[[mutArray objectForKey:dUp] setObject:@127 forKey:dfKey];
|
||||
[[mutArray objectForKey:dRight] setObject:@125 forKey:dfKey];
|
||||
[[mutArray objectForKey:dDown] setObject:@126 forKey:dfKey];
|
||||
[[mutArray objectForKey:dLeft] setObject:@124 forKey:dfKey];
|
||||
[[mutArray objectForKey:dL2] setObject:@16 forKey:dfKey];
|
||||
[[mutArray objectForKey:dR2] setObject:@18 forKey:dfKey];
|
||||
[[mutArray objectForKey:dL1] setObject:@14 forKey:dfKey];
|
||||
[[mutArray objectForKey:dR1] setObject:@15 forKey:dfKey];
|
||||
[[mutArray objectForKey:dTriangle] setObject:@3 forKey:dfKey];
|
||||
[[mutArray objectForKey:dCircle] setObject:@8 forKey:dfKey];
|
||||
[[mutArray objectForKey:dCross] setObject:@7 forKey:dfKey];
|
||||
[[mutArray objectForKey:dSquare] setObject:@2 forKey:dfKey];
|
||||
[mutArray setObject:[NSDictionary dictionaryWithObject:@12 forKey:dfKey] forKey:dAnalog];
|
||||
mutArray[dSelect][dfKey] = @9;
|
||||
mutArray[dStart][dfKey] = @10;
|
||||
mutArray[dUp][dfKey] = @127;
|
||||
mutArray[dRight][dfKey] = @125;
|
||||
mutArray[dDown][dfKey] = @126;
|
||||
mutArray[dLeft][dfKey] = @124;
|
||||
mutArray[dL2][dfKey] = @16;
|
||||
mutArray[dR2][dfKey] = @18;
|
||||
mutArray[dL1][dfKey] = @14;
|
||||
mutArray[dR1][dfKey] = @15;
|
||||
mutArray[dTriangle][dfKey] = @3;
|
||||
mutArray[dCircle][dfKey] = @8;
|
||||
mutArray[dCross][dfKey] = @7;
|
||||
mutArray[dSquare][dfKey] = @2;
|
||||
mutArray[dAnalog] = @{dfKey: @12};
|
||||
}
|
||||
return [NSDictionary dictionaryWithDictionary:mutArray];
|
||||
}
|
||||
|
@ -86,21 +86,21 @@ static NSDictionary *DictionaryFromButtonDef(KEYDEF theKey)
|
|||
{
|
||||
NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithCapacity:3];
|
||||
if (theKey.Key) {
|
||||
[mutDict setObject:@(theKey.Key) forKey:dfKey];
|
||||
mutDict[dfKey] = @(theKey.Key);
|
||||
}
|
||||
if (theKey.JoyEvType != NONE) {
|
||||
[mutDict setObject:@(theKey.JoyEvType) forKey:joyType];
|
||||
mutDict[joyType] = @(theKey.JoyEvType);
|
||||
switch (theKey.JoyEvType) {
|
||||
case BUTTON:
|
||||
[mutDict setObject:@(theKey.J.Button) forKey:joyVal];
|
||||
mutDict[joyVal] = @(theKey.J.Button);
|
||||
break;
|
||||
|
||||
case HAT:
|
||||
[mutDict setObject:@(theKey.J.Hat) forKey:joyVal];
|
||||
mutDict[joyVal] = @(theKey.J.Hat);
|
||||
break;
|
||||
|
||||
case AXIS:
|
||||
[mutDict setObject:@(theKey.J.Axis) forKey:joyVal];
|
||||
mutDict[joyVal] = @(theKey.J.Axis);
|
||||
break;
|
||||
|
||||
case NONE:
|
||||
|
@ -119,9 +119,9 @@ static void SetKeyFromDictionary(NSDictionary *inDict, KEYDEF *outDef)
|
|||
if (!inDict) {
|
||||
return;
|
||||
}
|
||||
NSNumber *theJoyType = [inDict objectForKey:joyType];
|
||||
NSNumber *theJoyType = inDict[joyType];
|
||||
if (theJoyType) {
|
||||
NSNumber *theJoyVal = [inDict objectForKey:joyVal];
|
||||
NSNumber *theJoyVal = inDict[joyVal];
|
||||
outDef->JoyEvType = [theJoyType unsignedCharValue];
|
||||
switch (outDef->JoyEvType) {
|
||||
case BUTTON:
|
||||
|
@ -140,7 +140,7 @@ static void SetKeyFromDictionary(NSDictionary *inDict, KEYDEF *outDef)
|
|||
break;
|
||||
}
|
||||
}
|
||||
NSNumber *keyVal = [inDict objectForKey:dfKey];
|
||||
NSNumber *keyVal = inDict[dfKey];
|
||||
if (keyVal) {
|
||||
outDef->Key = [keyVal unsignedShortValue];
|
||||
}
|
||||
|
@ -149,88 +149,88 @@ static void SetKeyFromDictionary(NSDictionary *inDict, KEYDEF *outDef)
|
|||
void LoadPadArray(int padnum, NSDictionary *nsPrefs)
|
||||
{
|
||||
PADDEF *curDef = &g.cfg.PadDef[padnum];
|
||||
curDef->DevNum = [[nsPrefs objectForKey:deviceNumber] charValue];
|
||||
curDef->Type = [[nsPrefs objectForKey:padType] unsignedShortValue];
|
||||
curDef->DevNum = [nsPrefs[deviceNumber] charValue];
|
||||
curDef->Type = [nsPrefs[padType] unsignedShortValue];
|
||||
curDef->VisualVibration = 0; //Not implemented on OS X right now.
|
||||
|
||||
//Analog buttons
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dL3], &curDef->KeyDef[DKEY_L3]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dR3], &curDef->KeyDef[DKEY_R3]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dAnalog], &curDef->KeyDef[DKEY_ANALOG]);
|
||||
SetKeyFromDictionary(nsPrefs[dL3], &curDef->KeyDef[DKEY_L3]);
|
||||
SetKeyFromDictionary(nsPrefs[dR3], &curDef->KeyDef[DKEY_R3]);
|
||||
SetKeyFromDictionary(nsPrefs[dAnalog], &curDef->KeyDef[DKEY_ANALOG]);
|
||||
|
||||
//Analog sticks
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dLeftAnalogXP], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_XP]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dLeftAnalogXM], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_XM]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dLeftAnalogYP], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_YP]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dLeftAnalogYM], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_YM]);
|
||||
SetKeyFromDictionary(nsPrefs[dLeftAnalogXP], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_XP]);
|
||||
SetKeyFromDictionary(nsPrefs[dLeftAnalogXM], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_XM]);
|
||||
SetKeyFromDictionary(nsPrefs[dLeftAnalogYP], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_YP]);
|
||||
SetKeyFromDictionary(nsPrefs[dLeftAnalogYM], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_YM]);
|
||||
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dRightAnalogXP], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XP]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dRightAnalogXM], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XM]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dRightAnalogYP], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YP]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dRightAnalogYM], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YM]);
|
||||
SetKeyFromDictionary(nsPrefs[dRightAnalogXP], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XP]);
|
||||
SetKeyFromDictionary(nsPrefs[dRightAnalogXM], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XM]);
|
||||
SetKeyFromDictionary(nsPrefs[dRightAnalogYP], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YP]);
|
||||
SetKeyFromDictionary(nsPrefs[dRightAnalogYM], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YM]);
|
||||
|
||||
//Digital shouldurs
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dL1], &curDef->KeyDef[DKEY_L1]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dL2], &curDef->KeyDef[DKEY_L2]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dR1], &curDef->KeyDef[DKEY_R1]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dR2], &curDef->KeyDef[DKEY_R2]);
|
||||
SetKeyFromDictionary(nsPrefs[dL1], &curDef->KeyDef[DKEY_L1]);
|
||||
SetKeyFromDictionary(nsPrefs[dL2], &curDef->KeyDef[DKEY_L2]);
|
||||
SetKeyFromDictionary(nsPrefs[dR1], &curDef->KeyDef[DKEY_R1]);
|
||||
SetKeyFromDictionary(nsPrefs[dR2], &curDef->KeyDef[DKEY_R2]);
|
||||
|
||||
//Digital buttons
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dSelect], &curDef->KeyDef[DKEY_SELECT]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dStart], &curDef->KeyDef[DKEY_START]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dUp], &curDef->KeyDef[DKEY_UP]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dRight], &curDef->KeyDef[DKEY_RIGHT]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dDown], &curDef->KeyDef[DKEY_DOWN]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dLeft], &curDef->KeyDef[DKEY_LEFT]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dTriangle], &curDef->KeyDef[DKEY_TRIANGLE]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dCircle], &curDef->KeyDef[DKEY_CIRCLE]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dCross], &curDef->KeyDef[DKEY_CROSS]);
|
||||
SetKeyFromDictionary([nsPrefs objectForKey:dSquare], &curDef->KeyDef[DKEY_SQUARE]);
|
||||
SetKeyFromDictionary(nsPrefs[dSelect], &curDef->KeyDef[DKEY_SELECT]);
|
||||
SetKeyFromDictionary(nsPrefs[dStart], &curDef->KeyDef[DKEY_START]);
|
||||
SetKeyFromDictionary(nsPrefs[dUp], &curDef->KeyDef[DKEY_UP]);
|
||||
SetKeyFromDictionary(nsPrefs[dRight], &curDef->KeyDef[DKEY_RIGHT]);
|
||||
SetKeyFromDictionary(nsPrefs[dDown], &curDef->KeyDef[DKEY_DOWN]);
|
||||
SetKeyFromDictionary(nsPrefs[dLeft], &curDef->KeyDef[DKEY_LEFT]);
|
||||
SetKeyFromDictionary(nsPrefs[dTriangle], &curDef->KeyDef[DKEY_TRIANGLE]);
|
||||
SetKeyFromDictionary(nsPrefs[dCircle], &curDef->KeyDef[DKEY_CIRCLE]);
|
||||
SetKeyFromDictionary(nsPrefs[dCross], &curDef->KeyDef[DKEY_CROSS]);
|
||||
SetKeyFromDictionary(nsPrefs[dSquare], &curDef->KeyDef[DKEY_SQUARE]);
|
||||
}
|
||||
|
||||
NSDictionary *SavePadArray(int padnum)
|
||||
{
|
||||
NSMutableDictionary *mutArray = [NSMutableDictionary dictionary];
|
||||
PADDEF *curDef = &g.cfg.PadDef[padnum];
|
||||
[mutArray setObject:@(curDef->DevNum) forKey:deviceNumber];
|
||||
[mutArray setObject:@(curDef->Type) forKey:padType];
|
||||
mutArray[deviceNumber] = @(curDef->DevNum);
|
||||
mutArray[padType] = @(curDef->Type);
|
||||
|
||||
switch (curDef->Type) {
|
||||
case PSE_PAD_TYPE_ANALOGPAD:
|
||||
{
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_L3]) forKey:dL3];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_R3]) forKey:dR3];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_ANALOG]) forKey:dAnalog];
|
||||
mutArray[dL3] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L3]);
|
||||
mutArray[dR3] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_R3]);
|
||||
mutArray[dAnalog] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_ANALOG]);
|
||||
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_XP]) forKey:dLeftAnalogXP];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_XM]) forKey:dLeftAnalogXM];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_YP]) forKey:dLeftAnalogYP];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_YM]) forKey:dLeftAnalogYM];
|
||||
mutArray[dLeftAnalogXP] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_XP]);
|
||||
mutArray[dLeftAnalogXM] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_XM]);
|
||||
mutArray[dLeftAnalogYP] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_YP]);
|
||||
mutArray[dLeftAnalogYM] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_YM]);
|
||||
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XP]) forKey:dRightAnalogXP];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XM]) forKey:dRightAnalogXM];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YP]) forKey:dRightAnalogYP];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YM]) forKey:dRightAnalogYM];
|
||||
mutArray[dRightAnalogXP] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XP]);
|
||||
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 setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_L1]) forKey:dL1];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_L2]) forKey:dL2];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_R1]) forKey:dR1];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_R2]) forKey:dR2];
|
||||
mutArray[dL1] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L1]);
|
||||
mutArray[dL2] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L2]);
|
||||
mutArray[dR1] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_R1]);
|
||||
mutArray[dR2] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_R2]);
|
||||
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_SELECT]) forKey:dSelect];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_START]) forKey:dStart];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_UP]) forKey:dUp];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_RIGHT]) forKey:dRight];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_DOWN]) forKey:dDown];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_LEFT]) forKey:dLeft];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_TRIANGLE]) forKey:dTriangle];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_CIRCLE]) forKey:dCircle];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_CROSS]) forKey:dCross];
|
||||
[mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_SQUARE]) forKey:dSquare];
|
||||
mutArray[dSelect] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_SELECT]);
|
||||
mutArray[dStart] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_START]);
|
||||
mutArray[dUp] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_UP]);
|
||||
mutArray[dRight] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_RIGHT]);
|
||||
mutArray[dDown] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_DOWN]);
|
||||
mutArray[dLeft] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_LEFT]);
|
||||
mutArray[dTriangle] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_TRIANGLE]);
|
||||
mutArray[dCircle] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_CIRCLE]);
|
||||
mutArray[dCross] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_CROSS]);
|
||||
mutArray[dSquare] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_SQUARE]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -60,14 +60,12 @@ void AboutDlgProc()
|
|||
[icon setSize:NSMakeSize(64, 64)];
|
||||
|
||||
NSDictionary *infoPaneDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
|
||||
icon, @"ApplicationIcon",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version",
|
||||
[bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright",
|
||||
credits, @"Credits",
|
||||
nil];
|
||||
@{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"],
|
||||
@"ApplicationIcon": icon,
|
||||
@"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
|
||||
@"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
|
||||
@"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"],
|
||||
@"Credits": credits};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict];
|
||||
});
|
||||
|
@ -95,18 +93,15 @@ void ReadConfig()
|
|||
NSDictionary *keyValues;
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
[defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"127.0.0.1", kIPADDRKEY,
|
||||
@33306, kIPPORT,
|
||||
@1, kPLAYERNUM,
|
||||
nil], PrefsKey, nil]];
|
||||
[defaults registerDefaults:@{PrefsKey: @{kIPADDRKEY: @"127.0.0.1",
|
||||
kIPPORT: @33306,
|
||||
kPLAYERNUM: @1}}];
|
||||
|
||||
keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
|
||||
conf.PortNum = [[keyValues objectForKey:kIPPORT] intValue];
|
||||
conf.PlayerNum = [[keyValues objectForKey:kPLAYERNUM] intValue];
|
||||
strlcpy(conf.ipAddress, [[keyValues objectForKey:kIPADDRKEY] cStringUsingEncoding:NSASCIIStringEncoding], sizeof(conf.ipAddress));
|
||||
conf.PortNum = [keyValues[kIPPORT] intValue];
|
||||
conf.PlayerNum = [keyValues[kPLAYERNUM] intValue];
|
||||
strlcpy(conf.ipAddress, [keyValues[kIPADDRKEY] cStringUsingEncoding:NSASCIIStringEncoding], sizeof(conf.ipAddress));
|
||||
}
|
||||
|
||||
@implementation PluginConfigController
|
||||
|
@ -132,9 +127,9 @@ void ReadConfig()
|
|||
|
||||
|
||||
NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:PrefsKey]];
|
||||
[writeDic setObject:@((unsigned short)[portNum intValue]) forKey:kIPPORT];
|
||||
[writeDic setObject:@([playerNum intValue]) forKey:kPLAYERNUM];
|
||||
[writeDic setObject:theAddress forKey:kIPADDRKEY];
|
||||
writeDic[kIPPORT] = @((unsigned short)[portNum intValue]);
|
||||
writeDic[kPLAYERNUM] = @([playerNum intValue]);
|
||||
writeDic[kIPADDRKEY] = theAddress;
|
||||
|
||||
// write to defaults
|
||||
[defaults setObject:writeDic forKey:PrefsKey];
|
||||
|
@ -152,9 +147,9 @@ void ReadConfig()
|
|||
ReadConfig();
|
||||
NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
|
||||
[ipAddress setStringValue:[keyValues objectForKey:kIPADDRKEY]];
|
||||
[portNum setIntValue:[[keyValues objectForKey:kIPPORT] unsignedShortValue]];
|
||||
[playerNum setIntValue:[[keyValues objectForKey:kPLAYERNUM] intValue]];
|
||||
[ipAddress setStringValue:keyValues[kIPADDRKEY]];
|
||||
[portNum setIntValue:[keyValues[kIPPORT] unsignedShortValue]];
|
||||
[playerNum setIntValue:[keyValues[kPLAYERNUM] intValue]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
NSInteger index = [self integerValue];
|
||||
|
||||
if (index >= 0 && index < [strings count])
|
||||
return [strings objectAtIndex:index];
|
||||
return strings[index];
|
||||
|
||||
if (!pluginClass) {
|
||||
return @"(Unknown)";
|
||||
|
|
|
@ -72,14 +72,12 @@ void DoAbout()
|
|||
[icon setSize:size];
|
||||
|
||||
NSDictionary *infoPaneDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
|
||||
icon, @"ApplicationIcon",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version",
|
||||
[bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright",
|
||||
credits, @"Credits",
|
||||
nil];
|
||||
@{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"],
|
||||
@"ApplicationIcon": icon,
|
||||
@"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
|
||||
@"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
|
||||
@"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"],
|
||||
@"Credits": credits};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict];
|
||||
});
|
||||
|
@ -109,29 +107,25 @@ void ReadConfig(void)
|
|||
{
|
||||
NSDictionary *keyValues;
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@YES, @"High Compatibility Mode",
|
||||
@YES, @"SPU IRQ Wait",
|
||||
@NO, @"XA Pitch",
|
||||
@NO, @"Mono Sound Output",
|
||||
@0, @"Interpolation Quality",
|
||||
@1, @"Reverb Quality",
|
||||
@3, @"Volume",
|
||||
nil], PrefsKey,
|
||||
nil]];
|
||||
[defaults registerDefaults:@{PrefsKey: @{@"High Compatibility Mode": @YES,
|
||||
@"SPU IRQ Wait": @YES,
|
||||
@"XA Pitch": @NO,
|
||||
@"Mono Sound Output": @NO,
|
||||
@"Interpolation Quality": @0,
|
||||
@"Reverb Quality": @1,
|
||||
@"Volume": @3}}];
|
||||
|
||||
keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
|
||||
iUseTimer = [[keyValues objectForKey:@"High Compatibility Mode"] boolValue] ? 2 : 0;
|
||||
iSPUIRQWait = [[keyValues objectForKey:@"SPU IRQ Wait"] boolValue];
|
||||
iDisStereo = [[keyValues objectForKey:@"Mono Sound Output"] boolValue];
|
||||
iXAPitch = [[keyValues objectForKey:@"XA Pitch"] boolValue];
|
||||
iUseTimer = [keyValues[@"High Compatibility Mode"] boolValue] ? 2 : 0;
|
||||
iSPUIRQWait = [keyValues[@"SPU IRQ Wait"] boolValue];
|
||||
iDisStereo = [keyValues[@"Mono Sound Output"] boolValue];
|
||||
iXAPitch = [keyValues[@"XA Pitch"] boolValue];
|
||||
|
||||
iUseInterpolation = [[keyValues objectForKey:@"Interpolation Quality"] intValue];
|
||||
iUseReverb = [[keyValues objectForKey:@"Reverb Quality"] intValue];
|
||||
iUseInterpolation = [keyValues[@"Interpolation Quality"] intValue];
|
||||
iUseReverb = [keyValues[@"Reverb Quality"] intValue];
|
||||
|
||||
iVolume = 5 - [[keyValues objectForKey:@"Volume"] intValue];
|
||||
iVolume = 5 - [keyValues[@"Volume"] intValue];
|
||||
}
|
||||
|
||||
@implementation PluginController
|
||||
|
@ -146,15 +140,15 @@ void ReadConfig(void)
|
|||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:self.keyValues];
|
||||
[writeDic setObject:([hiCompBox intValue] ? @YES : @NO) forKey:@"High Compatibility Mode"];
|
||||
[writeDic setObject:([irqWaitBox intValue] ? @YES : @NO) forKey:@"SPU IRQ Wait"];
|
||||
[writeDic setObject:([monoSoundBox intValue] ? @YES : @NO) forKey:@"Mono Sound Output"];
|
||||
[writeDic setObject:([xaSpeedBox intValue] ? @YES : @NO) forKey:@"XA Pitch"];
|
||||
writeDic[@"High Compatibility Mode"] = ([hiCompBox intValue] ? @YES : @NO);
|
||||
writeDic[@"SPU IRQ Wait"] = ([irqWaitBox intValue] ? @YES : @NO);
|
||||
writeDic[@"Mono Sound Output"] = ([monoSoundBox intValue] ? @YES : @NO);
|
||||
writeDic[@"XA Pitch"] = ([xaSpeedBox intValue] ? @YES : @NO);
|
||||
|
||||
[writeDic setObject:@([interpolValue intValue]) forKey:@"Interpolation Quality"];
|
||||
[writeDic setObject:@([reverbValue intValue]) forKey:@"Reverb Quality"];
|
||||
writeDic[@"Interpolation Quality"] = @([interpolValue intValue]);
|
||||
writeDic[@"Reverb Quality"] = @([reverbValue intValue]);
|
||||
|
||||
[writeDic setObject:@([volumeValue intValue]) forKey:@"Volume"];
|
||||
writeDic[@"Volume"] = @([volumeValue intValue]);
|
||||
|
||||
// write to defaults
|
||||
[defaults setObject:writeDic forKey:PrefsKey];
|
||||
|
@ -182,14 +176,14 @@ void ReadConfig(void)
|
|||
/* load from preferences */
|
||||
self.keyValues = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:PrefsKey]];
|
||||
|
||||
[hiCompBox setIntValue:[[keyValues objectForKey:@"High Compatibility Mode"] boolValue]];
|
||||
[irqWaitBox setIntValue:[[keyValues objectForKey:@"SPU IRQ Wait"] boolValue]];
|
||||
[monoSoundBox setIntValue:[[keyValues objectForKey:@"Mono Sound Output"] boolValue]];
|
||||
[xaSpeedBox setIntValue:[[keyValues objectForKey:@"XA Pitch"] boolValue]];
|
||||
[hiCompBox setIntValue:[keyValues[@"High Compatibility Mode"] boolValue]];
|
||||
[irqWaitBox setIntValue:[keyValues[@"SPU IRQ Wait"] boolValue]];
|
||||
[monoSoundBox setIntValue:[keyValues[@"Mono Sound Output"] boolValue]];
|
||||
[xaSpeedBox setIntValue:[keyValues[@"XA Pitch"] boolValue]];
|
||||
|
||||
[interpolValue setIntValue:[[keyValues objectForKey:@"Interpolation Quality"] intValue]];
|
||||
[reverbValue setIntValue:[[keyValues objectForKey:@"Reverb Quality"] intValue]];
|
||||
[volumeValue setIntValue:[[keyValues objectForKey:@"Volume"] intValue]];
|
||||
[interpolValue setIntValue:[keyValues[@"Interpolation Quality"] intValue]];
|
||||
[reverbValue setIntValue:[keyValues[@"Reverb Quality"] intValue]];
|
||||
[volumeValue setIntValue:[keyValues[@"Volume"] intValue]];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
|
|
|
@ -63,14 +63,12 @@ void AboutDlgProc()
|
|||
[icon setSize:size];
|
||||
|
||||
NSDictionary *infoPaneDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
|
||||
icon, @"ApplicationIcon",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version",
|
||||
[bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright",
|
||||
credits, @"Credits",
|
||||
nil];
|
||||
@{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"],
|
||||
@"ApplicationIcon": icon,
|
||||
@"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
|
||||
@"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
|
||||
@"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"],
|
||||
@"Credits": credits};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict];
|
||||
});
|
||||
|
@ -98,28 +96,28 @@ BOOL isShaderEnabled()
|
|||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
return [[keyValues objectForKey:@"UseShader"] boolValue];
|
||||
return [keyValues[@"UseShader"] boolValue];
|
||||
}
|
||||
|
||||
NSURL *PSXVertexShader()
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
return [NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil];
|
||||
return [NSURL URLByResolvingBookmarkData:keyValues[@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil];
|
||||
}
|
||||
|
||||
NSURL *PSXFragmentShader()
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
return [NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil];
|
||||
return [NSURL URLByResolvingBookmarkData:keyValues[@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil];
|
||||
}
|
||||
|
||||
float PSXShaderQuality()
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
return (float)[[keyValues objectForKey:@"ShaderQuality"] intValue];
|
||||
return (float)[keyValues[@"ShaderQuality"] intValue];
|
||||
}
|
||||
|
||||
void ReadConfig(void)
|
||||
|
@ -127,34 +125,30 @@ void ReadConfig(void)
|
|||
NSDictionary *keyValues;
|
||||
NSBundle *selfBundle = [NSBundle bundleWithIdentifier:APP_ID];
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@NO, @"FPS Counter",
|
||||
@NO, @"Auto Full Screen",
|
||||
@NO, @"Frame Skipping",
|
||||
@YES, @"Frame Limit",
|
||||
@NO, @"VSync",
|
||||
@NO, @"Enable Hacks",
|
||||
@1, @"Dither Mode",
|
||||
@((unsigned int)0), @"Hacks",
|
||||
[[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil], @"VertexShader",
|
||||
[[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil], @"FragmentShader",
|
||||
@NO, @"UseShader",
|
||||
@4, @"ShaderQuality",
|
||||
nil], PrefsKey,
|
||||
nil]];
|
||||
[defaults registerDefaults:@{PrefsKey: @{@"FPS Counter": @NO,
|
||||
@"Auto Full Screen": @NO,
|
||||
@"Frame Skipping": @NO,
|
||||
@"Frame Limit": @YES,
|
||||
@"VSync": @NO,
|
||||
@"Enable Hacks": @NO,
|
||||
@"Dither Mode": @1,
|
||||
@"Hacks": @((unsigned int)0),
|
||||
@"VertexShader": [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil],
|
||||
@"FragmentShader": [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil],
|
||||
@"UseShader": @NO,
|
||||
@"ShaderQuality": @4}}];
|
||||
|
||||
keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
|
||||
iShowFPS = [[keyValues objectForKey:@"FPS Counter"] boolValue];
|
||||
iWindowMode = [[keyValues objectForKey:@"Auto Full Screen"] boolValue] ? 0 : 1;
|
||||
UseFrameSkip = [[keyValues objectForKey:@"Frame Skipping"] boolValue];
|
||||
UseFrameLimit = [[keyValues objectForKey:@"Frame Limit"] boolValue];
|
||||
iShowFPS = [keyValues[@"FPS Counter"] boolValue];
|
||||
iWindowMode = [keyValues[@"Auto Full Screen"] boolValue] ? 0 : 1;
|
||||
UseFrameSkip = [keyValues[@"Frame Skipping"] boolValue];
|
||||
UseFrameLimit = [keyValues[@"Frame Limit"] boolValue];
|
||||
//??? = [[keyValues objectForKey:@"VSync"] boolValue];
|
||||
iUseFixes = [[keyValues objectForKey:@"Enable Hacks"] boolValue];
|
||||
iUseFixes = [keyValues[@"Enable Hacks"] boolValue];
|
||||
|
||||
iUseDither = [[keyValues objectForKey:@"Dither Mode"] intValue];
|
||||
dwCfgFixes = [[keyValues objectForKey:@"Hacks"] unsignedIntValue];
|
||||
iUseDither = [keyValues[@"Dither Mode"] intValue];
|
||||
dwCfgFixes = [keyValues[@"Hacks"] unsignedIntValue];
|
||||
|
||||
iResX = 640;
|
||||
iResY = 480;
|
||||
|
@ -199,25 +193,25 @@ void ReadConfig(void)
|
|||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues];
|
||||
[writeDic setObject:([fpsCounter intValue] ? @YES : @NO) forKey:@"FPS Counter"];
|
||||
[writeDic setObject:([autoFullScreen intValue] ? @YES : @NO) forKey:@"Auto Full Screen"];
|
||||
[writeDic setObject:([frameSkipping intValue] ? @YES : @NO) forKey:@"Frame Skipping"];
|
||||
writeDic[@"FPS Counter"] = ([fpsCounter intValue] ? @YES : @NO);
|
||||
writeDic[@"Auto Full Screen"] = ([autoFullScreen intValue] ? @YES : @NO);
|
||||
writeDic[@"Frame Skipping"] = ([frameSkipping intValue] ? @YES : @NO);
|
||||
//[writeDic setObject:@([frameLimit intValue]) forKey:@"Frame Limit"];
|
||||
[writeDic setObject:([vSync intValue] ? @YES : @NO) forKey:@"VSync"];
|
||||
[writeDic setObject:([hackEnable intValue] ? @YES : @NO) forKey:@"Enable Hacks"];
|
||||
[writeDic setObject:([shaders intValue] ? @YES : @NO) forKey:@"UseShader"];
|
||||
[writeDic setObject:@([shaderQualitySelector indexOfSelectedItem] + 1) forKey:@"ShaderQuality"];
|
||||
[writeDic setObject:@([ditherMode indexOfSelectedItem]) forKey:@"Dither Mode"];
|
||||
writeDic[@"VSync"] = ([vSync intValue] ? @YES : @NO);
|
||||
writeDic[@"Enable Hacks"] = ([hackEnable intValue] ? @YES : @NO);
|
||||
writeDic[@"UseShader"] = ([shaders intValue] ? @YES : @NO);
|
||||
writeDic[@"ShaderQuality"] = @([shaderQualitySelector indexOfSelectedItem] + 1);
|
||||
writeDic[@"Dither Mode"] = @([ditherMode indexOfSelectedItem]);
|
||||
|
||||
unsigned int hackValues = 0;
|
||||
for (NSCell *control in [hacksMatrix cells]) {
|
||||
hackValues |= [control intValue] << ([control tag] - 1);
|
||||
}
|
||||
|
||||
[writeDic setObject:@(hackValues) forKey:@"Hacks"];
|
||||
writeDic[@"Hacks"] = @(hackValues);
|
||||
|
||||
[writeDic setObject:[vertexPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil] forKey:@"VertexShader"];
|
||||
[writeDic setObject:[fragmentPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil] forKey:@"FragmentShader"];
|
||||
writeDic[@"VertexShader"] = [vertexPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil];
|
||||
writeDic[@"FragmentShader"] = [fragmentPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil];
|
||||
|
||||
// write to defaults
|
||||
[defaults setObject:writeDic forKey:PrefsKey];
|
||||
|
@ -239,7 +233,7 @@ void ReadConfig(void)
|
|||
- (IBAction)hackToggle:(id)sender
|
||||
{
|
||||
BOOL enable = [sender intValue] ? YES : NO;
|
||||
NSArray *views = [[[hacksView subviews] objectAtIndex:0] subviews];
|
||||
NSArray *views = [[hacksView subviews][0] subviews];
|
||||
|
||||
for (NSView *control in views) {
|
||||
if ([control isKindOfClass:[NSControl class]]) {
|
||||
|
@ -253,7 +247,7 @@ void ReadConfig(void)
|
|||
|
||||
- (IBAction)toggleShader:(id)sender {
|
||||
BOOL enable = [sender intValue] ? YES : NO;
|
||||
NSArray *views = [[[shadersView subviews] objectAtIndex:0] subviews];
|
||||
NSArray *views = [[shadersView subviews][0] subviews];
|
||||
|
||||
for (NSView *control in views) {
|
||||
if ([control isKindOfClass:[NSControl class]]) {
|
||||
|
@ -309,11 +303,11 @@ void ReadConfig(void)
|
|||
|
||||
{
|
||||
BOOL resetPrefs = NO;
|
||||
[self setVertexPathInfo:[NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]];
|
||||
[self setVertexPathInfo:[NSURL URLByResolvingBookmarkData:keyValues[@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]];
|
||||
if (!vertexPath) {
|
||||
resetPrefs = YES;
|
||||
}
|
||||
[self setFragmentPathInfo:[NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]];
|
||||
[self setFragmentPathInfo:[NSURL URLByResolvingBookmarkData:keyValues[@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]];
|
||||
if (!fragmentPath) {
|
||||
resetPrefs = YES;
|
||||
}
|
||||
|
@ -323,17 +317,17 @@ void ReadConfig(void)
|
|||
[self setFragmentPathInfo:[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"]];
|
||||
}
|
||||
}
|
||||
[fpsCounter setIntValue:[[keyValues objectForKey:@"FPS Counter"] intValue]];
|
||||
[autoFullScreen setIntValue:[[keyValues objectForKey:@"Auto Full Screen"] intValue]];
|
||||
[frameSkipping setIntValue:[[keyValues objectForKey:@"Frame Skipping"] intValue]];
|
||||
[vSync setIntValue:[[keyValues objectForKey:@"VSync"] intValue]];
|
||||
[hackEnable setIntValue:[[keyValues objectForKey:@"Enable Hacks"] intValue]];
|
||||
[shaders setIntValue:[[keyValues objectForKey:@"UseShader"] intValue]];
|
||||
[fpsCounter setIntValue:[keyValues[@"FPS Counter"] intValue]];
|
||||
[autoFullScreen setIntValue:[keyValues[@"Auto Full Screen"] intValue]];
|
||||
[frameSkipping setIntValue:[keyValues[@"Frame Skipping"] intValue]];
|
||||
[vSync setIntValue:[keyValues[@"VSync"] intValue]];
|
||||
[hackEnable setIntValue:[keyValues[@"Enable Hacks"] intValue]];
|
||||
[shaders setIntValue:[keyValues[@"UseShader"] intValue]];
|
||||
|
||||
[ditherMode selectItemAtIndex:[[keyValues objectForKey:@"Dither Mode"] intValue]];
|
||||
[shaderQualitySelector selectItemAtIndex:[[keyValues objectForKey:@"ShaderQuality"] intValue] - 1];
|
||||
[ditherMode selectItemAtIndex:[keyValues[@"Dither Mode"] intValue]];
|
||||
[shaderQualitySelector selectItemAtIndex:[keyValues[@"ShaderQuality"] intValue] - 1];
|
||||
|
||||
unsigned int hackValues = [[keyValues objectForKey:@"Hacks"] unsignedIntValue];
|
||||
unsigned int hackValues = [keyValues[@"Hacks"] unsignedIntValue];
|
||||
|
||||
for (NSCell *control in [hacksMatrix cells]) {
|
||||
[control setIntValue:(hackValues >> ([control tag] - 1)) & 1];
|
||||
|
|
|
@ -45,7 +45,7 @@ NSRect windowFrame;
|
|||
[gameWindow makeKeyAndOrderFront:nil];
|
||||
[gameController showWindow:nil];
|
||||
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[[gameWindow screen] deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[gameWindow screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
if (CGDisplayIsCaptured(display)) {
|
||||
[gameController setFullscreen:YES];
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ NSRect windowFrame;
|
|||
{
|
||||
NSWindow *window = [self window];
|
||||
NSScreen *screen = [window screen];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[screen deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
|
||||
NSDisableScreenUpdates();
|
||||
|
||||
|
|
|
@ -69,14 +69,12 @@ void AboutDlgProc()
|
|||
[icon setSize:size];
|
||||
|
||||
NSDictionary *infoPaneDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
|
||||
icon, @"ApplicationIcon",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
|
||||
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version",
|
||||
[bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright",
|
||||
credits, @"Credits",
|
||||
nil];
|
||||
@{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"],
|
||||
@"ApplicationIcon": icon,
|
||||
@"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
|
||||
@"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
|
||||
@"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"],
|
||||
@"Credits": credits};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict];
|
||||
});
|
||||
|
@ -126,10 +124,10 @@ void PrepFactoryDefaultPreferences(void)
|
|||
NSDictionary* keyValues = [defaults dictionaryForKey:PrefsKey];
|
||||
BOOL windowSizeNeedsReset = NO;
|
||||
if (keyValues) {
|
||||
NSSize size = NSSizeFromString([keyValues objectForKey:kWindowSize]);
|
||||
if (![keyValues objectForKey:kWindowSize]) {
|
||||
NSSize size = NSSizeFromString(keyValues[kWindowSize]);
|
||||
if (!keyValues[kWindowSize]) {
|
||||
windowSizeNeedsReset = YES;
|
||||
} else if ([[keyValues objectForKey:kWindowSize] isKindOfClass:[NSNumber class]]) {
|
||||
} else if ([keyValues[kWindowSize] isKindOfClass:[NSNumber class]]) {
|
||||
windowSizeNeedsReset = YES;
|
||||
} else if (size.height == 0 || size.width == 0) {
|
||||
windowSizeNeedsReset = YES;
|
||||
|
@ -137,43 +135,40 @@ void PrepFactoryDefaultPreferences(void)
|
|||
}
|
||||
if (windowSizeNeedsReset) {
|
||||
NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc] initWithDictionary:keyValues];
|
||||
[tmpDict setObject:NSStringFromSize(NSMakeSize(800, 600)) forKey:kWindowSize];
|
||||
tmpDict[kWindowSize] = NSStringFromSize(NSMakeSize(800, 600));
|
||||
[defaults setObject:tmpDict forKey:PrefsKey];
|
||||
[defaults synchronize];
|
||||
}
|
||||
keyValues = nil;
|
||||
|
||||
[defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@NO, kFPSCounter,
|
||||
@NO, kAutoFullScreen,
|
||||
@NO, kFrameSkipping,
|
||||
@YES, kFrameLimit,
|
||||
@NO, kVSync,
|
||||
@NO, kHacksEnable,
|
||||
@0, @"Dither Mode",
|
||||
@0, kHacks,
|
||||
[defaults registerDefaults:@{PrefsKey: @{kFPSCounter: @NO,
|
||||
kAutoFullScreen: @NO,
|
||||
kFrameSkipping: @NO,
|
||||
kFrameLimit: @YES,
|
||||
kVSync: @NO,
|
||||
kHacksEnable: @NO,
|
||||
@"Dither Mode": @0,
|
||||
kHacks: @0,
|
||||
|
||||
@YES, @"Proportional Resize",
|
||||
@"Proportional Resize": @YES,
|
||||
//[NSSize stringWithCString: @"default"], @"Fullscreen Resolution",
|
||||
@2, @"Offscreen Drawing Level",
|
||||
@0, @"Texture Color Depth Level",
|
||||
@0, @"Texture Enhancement Level",
|
||||
@0, @"Texture Filter Level",
|
||||
@0, @"Frame Buffer Level",
|
||||
NSStringFromSize(NSMakeSize(800, 600)), kWindowSize,
|
||||
@NO, @"Draw Scanlines",
|
||||
@"Offscreen Drawing Level": @2,
|
||||
@"Texture Color Depth Level": @0,
|
||||
@"Texture Enhancement Level": @0,
|
||||
@"Texture Filter Level": @0,
|
||||
@"Frame Buffer Level": @0,
|
||||
kWindowSize: NSStringFromSize(NSMakeSize(800, 600)),
|
||||
@"Draw Scanlines": @NO,
|
||||
// nasty:
|
||||
[NSArchiver archivedDataWithRootObject: [NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.25]], @"Scanline Color",
|
||||
@NO, @"Advanced Blending",
|
||||
@NO, @"Opaque Pass",
|
||||
@NO, @"Blur",
|
||||
@YES, @"Z Mask Clipping",
|
||||
@NO, @"Wireframe Mode",
|
||||
@YES, @"Emulate mjpeg decoder", // helps remove unsightly vertical line in movies
|
||||
@NO, @"Fast mjpeg decoder",
|
||||
@YES, @"GteAccuracy",
|
||||
nil], PrefsKey, nil]];
|
||||
@"Scanline Color": [NSArchiver archivedDataWithRootObject: [NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.25]],
|
||||
@"Advanced Blending": @NO,
|
||||
@"Opaque Pass": @NO,
|
||||
@"Blur": @NO,
|
||||
@"Z Mask Clipping": @YES,
|
||||
@"Wireframe Mode": @NO,
|
||||
@"Emulate mjpeg decoder": @YES, // helps remove unsightly vertical line in movies
|
||||
@"Fast mjpeg decoder": @NO,
|
||||
@"GteAccuracy": @YES}}];
|
||||
}
|
||||
|
||||
void ReadConfig(void)
|
||||
|
@ -192,26 +187,26 @@ void ReadConfig(void)
|
|||
|
||||
// bind all prefs settings to their PCSXR counterparts
|
||||
// with a little finagling to make it work as expected
|
||||
iShowFPS = [[keyValues objectForKey:kFPSCounter] boolValue];
|
||||
iShowFPS = [keyValues[kFPSCounter] boolValue];
|
||||
|
||||
if ([[keyValues objectForKey:kFrameLimit] boolValue]){
|
||||
if ([keyValues[kFrameLimit] boolValue]){
|
||||
bUseFrameLimit = 1;
|
||||
iFrameLimit = 2; // required
|
||||
fFrameRate = 60; // required (some number, 60 seems ok)
|
||||
}
|
||||
|
||||
// Dithering is either on or off in OpenGL plug, but hey
|
||||
bDrawDither = [[keyValues objectForKey:@"Dither Mode"] intValue];
|
||||
bDrawDither = [keyValues[@"Dither Mode"] intValue];
|
||||
|
||||
bChangeWinMode = [[keyValues objectForKey:kAutoFullScreen] boolValue] ? 2 : 1;
|
||||
bUseFrameSkip = [[keyValues objectForKey:kFrameSkipping] boolValue];
|
||||
bChangeWinMode = [keyValues[kAutoFullScreen] boolValue] ? 2 : 1;
|
||||
bUseFrameSkip = [keyValues[kFrameSkipping] boolValue];
|
||||
|
||||
bUseFixes = [[keyValues objectForKey:kHacksEnable] boolValue];
|
||||
dwCfgFixes = [[keyValues objectForKey:kHacks] unsignedIntValue];
|
||||
bUseFixes = [keyValues[kHacksEnable] boolValue];
|
||||
dwCfgFixes = [keyValues[kHacks] unsignedIntValue];
|
||||
|
||||
|
||||
// we always start out at 800x600 (at least until resizing the window is implemented)
|
||||
NSSize winSize = NSSizeFromString([keyValues objectForKey:kWindowSize]);
|
||||
NSSize winSize = NSSizeFromString(keyValues[kWindowSize]);
|
||||
if (bChangeWinMode == 1) {
|
||||
iResX = winSize.width;
|
||||
iResY = winSize.height;
|
||||
|
@ -220,9 +215,9 @@ void ReadConfig(void)
|
|||
iResY = 600;
|
||||
}
|
||||
|
||||
iBlurBuffer = [[keyValues objectForKey:@"Blur"] boolValue]; // not noticeable, but doesn't harm
|
||||
iUseScanLines = [[keyValues objectForKey:@"Draw Scanlines"] boolValue]; // works
|
||||
NSColor* scanColor = [NSUnarchiver unarchiveObjectWithData:[keyValues objectForKey:@"Scanline Color"]];
|
||||
iBlurBuffer = [keyValues[@"Blur"] boolValue]; // not noticeable, but doesn't harm
|
||||
iUseScanLines = [keyValues[@"Draw Scanlines"] boolValue]; // works
|
||||
NSColor* scanColor = [NSUnarchiver unarchiveObjectWithData:keyValues[@"Scanline Color"]];
|
||||
scanColor = [scanColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]];
|
||||
iScanlineColor[0] = [scanColor redComponent];
|
||||
iScanlineColor[1] = [scanColor greenComponent];
|
||||
|
@ -230,29 +225,29 @@ void ReadConfig(void)
|
|||
iScanlineColor[3] = [scanColor alphaComponent];
|
||||
|
||||
iScanBlend = 0; // we always draw nice since it costs nothing.
|
||||
iUseMask = [[keyValues objectForKey:@"Z Mask Clipping"] boolValue]; // works, clips polygons with primitive "Z" buffer
|
||||
bUseLines = [[keyValues objectForKey:@"Wireframe Mode"] boolValue]; // works, aka "Wireframe" mode
|
||||
iOffscreenDrawing = [[keyValues objectForKey:@"Offscreen Drawing Level"] intValue]; // draw offscreen for texture building?
|
||||
iUseMask = [keyValues[@"Z Mask Clipping"] boolValue]; // works, clips polygons with primitive "Z" buffer
|
||||
bUseLines = [keyValues[@"Wireframe Mode"] boolValue]; // works, aka "Wireframe" mode
|
||||
iOffscreenDrawing = [keyValues[@"Offscreen Drawing Level"] intValue]; // draw offscreen for texture building?
|
||||
if (iOffscreenDrawing > 4) iOffscreenDrawing = 4;
|
||||
if (iOffscreenDrawing < 0) iOffscreenDrawing = 0;
|
||||
|
||||
|
||||
// texture quality, whatever that means (doesn't hurt), more like "texture handling" or "texture performance"
|
||||
iFrameTexType = [[keyValues objectForKey:@"Frame Buffer Level"] intValue];
|
||||
iFrameTexType = [keyValues[@"Frame Buffer Level"] intValue];
|
||||
if (iFrameTexType > 3) iFrameTexType = 3;
|
||||
if (iFrameTexType < 0) iFrameTexType = 0;
|
||||
|
||||
iTexQuality = [[keyValues objectForKey:@"Texture Color Depth Level"] intValue];
|
||||
iTexQuality = [keyValues[@"Texture Color Depth Level"] intValue];
|
||||
if (iTexQuality > 4) iTexQuality = 4;
|
||||
if (iTexQuality < 0) iTexQuality = 0;
|
||||
|
||||
// MAG_FILTER = LINEAR, etc.
|
||||
iFilterType = [[keyValues objectForKey:@"Texture Filter Level"] intValue];
|
||||
iFilterType = [keyValues[@"Texture Filter Level"] intValue];
|
||||
if (iFilterType > 2) iFilterType = 2;
|
||||
if (iFilterType < 0) iFilterType = 0;
|
||||
|
||||
// stretches textures (more detail). You'd think it would look great, but it's not massively better. NEEDS iFilterType to be of any use.
|
||||
iHiResTextures = [[keyValues objectForKey:@"Texture Enhancement Level"] intValue];
|
||||
iHiResTextures = [keyValues[@"Texture Enhancement Level"] intValue];
|
||||
if (iHiResTextures > 2) iHiResTextures = 2;
|
||||
if (iHiResTextures < 0) iHiResTextures = 0;
|
||||
|
||||
|
@ -263,9 +258,9 @@ void ReadConfig(void)
|
|||
if (iHiResTextures && !iFilterType)
|
||||
iFilterType = 1; // needed to see any real effect
|
||||
|
||||
bUseFastMdec = [[keyValues objectForKey:@"Emulate mjpeg decoder"] boolValue];
|
||||
bUse15bitMdec = [[keyValues objectForKey:@"Fast mjpeg decoder"] boolValue];
|
||||
bGteAccuracy = [[keyValues objectForKey:@"GteAccuracy"] boolValue];
|
||||
bUseFastMdec = [keyValues[@"Emulate mjpeg decoder"] boolValue];
|
||||
bUse15bitMdec = [keyValues[@"Fast mjpeg decoder"] boolValue];
|
||||
bGteAccuracy = [keyValues[@"GteAccuracy"] boolValue];
|
||||
|
||||
if (iShowFPS)
|
||||
ulKeybits |= KEY_SHOWFPS;
|
||||
|
@ -305,29 +300,29 @@ void ReadConfig(void)
|
|||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues];
|
||||
[writeDic setObject:([fpsCounter integerValue] ? @YES : @NO) forKey:kFPSCounter];
|
||||
[writeDic setObject:[NSArchiver archivedDataWithRootObject:[scanlineColorWell color]] forKey:@"Scanline Color"];
|
||||
[writeDic setObject:([frameSkipping integerValue] ? @YES : @NO) forKey:kFrameSkipping];
|
||||
[writeDic setObject:([autoFullScreen integerValue] ? @YES : @NO) forKey:kAutoFullScreen];
|
||||
writeDic[kFPSCounter] = ([fpsCounter integerValue] ? @YES : @NO);
|
||||
writeDic[@"Scanline Color"] = [NSArchiver archivedDataWithRootObject:[scanlineColorWell color]];
|
||||
writeDic[kFrameSkipping] = ([frameSkipping integerValue] ? @YES : @NO);
|
||||
writeDic[kAutoFullScreen] = ([autoFullScreen integerValue] ? @YES : @NO);
|
||||
//[writeDic setObject:([frameLimit integerValue] ? @YES : @NO) forKey:kFrameLimit];
|
||||
[writeDic setObject:([proportionalResize integerValue] ? @YES : @NO) forKey:@"Proportional Resize"];
|
||||
[writeDic setObject:@([ditherMode indexOfSelectedItem]) forKey:@"Dither Mode"];
|
||||
[writeDic setObject:@([offscreenDrawing indexOfSelectedItem]) forKey:@"Offscreen Drawing Level"];
|
||||
[writeDic setObject:@([texColorDepth indexOfSelectedItem]) forKey:@"Texture Color Depth Level"];
|
||||
[writeDic setObject:@([texEnhancment integerValue]) forKey:@"Texture Enhancement Level"];
|
||||
[writeDic setObject:@([texFiltering integerValue]) forKey:@"Texture Filter Level"];
|
||||
[writeDic setObject:@([frameBufferEffects indexOfSelectedItem]) forKey:@"Frame Buffer Level"];
|
||||
[writeDic setObject:([drawScanlines integerValue] ? @YES : @NO) forKey:@"Draw Scanlines"];
|
||||
[writeDic setObject:([advancedBlending integerValue] ? @YES : @NO) forKey:@"Advanced Blending"];
|
||||
[writeDic setObject:([opaquePass integerValue] ? @YES : @NO) forKey:@"Opaque Pass"];
|
||||
[writeDic setObject:([blurEffect integerValue] ? @YES : @NO) forKey:@"Blur"];
|
||||
[writeDic setObject:([zMaskClipping integerValue] ? @YES : @NO) forKey:@"Z Mask Clipping"];
|
||||
[writeDic setObject:([wireframeOnly integerValue] ? @YES : @NO) forKey:@"Wireframe Mode"];
|
||||
[writeDic setObject:([mjpegDecoder integerValue] ? @YES : @NO) forKey:@"Emulate mjpeg decoder"];
|
||||
[writeDic setObject:([mjpegDecoder15bit integerValue] ? @YES : @NO) forKey:@"Fast mjpeg decoder"];
|
||||
[writeDic setObject:([gteAccuracy integerValue] ? @YES : @NO) forKey:@"GteAccuracy"];
|
||||
[writeDic setObject:([vSync integerValue] ? @YES : @NO) forKey:kVSync];
|
||||
[writeDic setObject:NSStringFromSize(NSMakeSize([windowWidth integerValue], [windowHeighth integerValue])) forKey:kWindowSize];
|
||||
writeDic[@"Proportional Resize"] = ([proportionalResize integerValue] ? @YES : @NO);
|
||||
writeDic[@"Dither Mode"] = @([ditherMode indexOfSelectedItem]);
|
||||
writeDic[@"Offscreen Drawing Level"] = @([offscreenDrawing indexOfSelectedItem]);
|
||||
writeDic[@"Texture Color Depth Level"] = @([texColorDepth indexOfSelectedItem]);
|
||||
writeDic[@"Texture Enhancement Level"] = @([texEnhancment integerValue]);
|
||||
writeDic[@"Texture Filter Level"] = @([texFiltering integerValue]);
|
||||
writeDic[@"Frame Buffer Level"] = @([frameBufferEffects indexOfSelectedItem]);
|
||||
writeDic[@"Draw Scanlines"] = ([drawScanlines integerValue] ? @YES : @NO);
|
||||
writeDic[@"Advanced Blending"] = ([advancedBlending integerValue] ? @YES : @NO);
|
||||
writeDic[@"Opaque Pass"] = ([opaquePass integerValue] ? @YES : @NO);
|
||||
writeDic[@"Blur"] = ([blurEffect integerValue] ? @YES : @NO);
|
||||
writeDic[@"Z Mask Clipping"] = ([zMaskClipping integerValue] ? @YES : @NO);
|
||||
writeDic[@"Wireframe Mode"] = ([wireframeOnly integerValue] ? @YES : @NO);
|
||||
writeDic[@"Emulate mjpeg decoder"] = ([mjpegDecoder integerValue] ? @YES : @NO);
|
||||
writeDic[@"Fast mjpeg decoder"] = ([mjpegDecoder15bit integerValue] ? @YES : @NO);
|
||||
writeDic[@"GteAccuracy"] = ([gteAccuracy integerValue] ? @YES : @NO);
|
||||
writeDic[kVSync] = ([vSync integerValue] ? @YES : @NO);
|
||||
writeDic[kWindowSize] = NSStringFromSize(NSMakeSize([windowWidth integerValue], [windowHeighth integerValue]));
|
||||
|
||||
[defaults setObject:writeDic forKey:PrefsKey];
|
||||
[defaults synchronize];
|
||||
|
@ -355,8 +350,8 @@ void ReadConfig(void)
|
|||
|
||||
- (void)loadHacksValues
|
||||
{
|
||||
unsigned int hackValues = [[self.keyValues objectForKey:kHacks] unsignedIntValue];
|
||||
[hackEnable setIntegerValue:[[self.keyValues objectForKey:kHacksEnable] boolValue]];
|
||||
unsigned int hackValues = [(self.keyValues)[kHacks] unsignedIntValue];
|
||||
[hackEnable setIntegerValue:[(self.keyValues)[kHacksEnable] boolValue]];
|
||||
|
||||
// build refs to hacks checkboxes
|
||||
for (NSControl *control in [hacksMatrix cells]) {
|
||||
|
@ -379,30 +374,30 @@ void ReadConfig(void)
|
|||
|
||||
[self loadHacksValues];
|
||||
|
||||
[autoFullScreen setIntegerValue:[[keyValues objectForKey:kAutoFullScreen] boolValue]];
|
||||
[ditherMode selectItemAtIndex:[[keyValues objectForKey:@"Dither Mode"] integerValue]];
|
||||
[fpsCounter setIntegerValue:[[keyValues objectForKey:kFPSCounter] boolValue]];
|
||||
[scanlineColorWell setColor:[NSUnarchiver unarchiveObjectWithData: [keyValues objectForKey:@"Scanline Color"]]];
|
||||
[frameSkipping setIntegerValue:[[keyValues objectForKey:kFrameSkipping] boolValue]];
|
||||
[advancedBlending setIntegerValue:[[keyValues objectForKey:@"Advanced Blending"] boolValue]];
|
||||
[texFiltering setIntegerValue:[[keyValues objectForKey:@"Texture Filter Level"] integerValue]];
|
||||
[texEnhancment setIntegerValue:[[keyValues objectForKey:@"Texture Enhancement Level"] integerValue]];
|
||||
[zMaskClipping setIntegerValue:[[keyValues objectForKey:@"Z Mask Clipping"] integerValue]];
|
||||
[mjpegDecoder setIntegerValue:[[keyValues objectForKey:@"Emulate mjpeg decoder"] boolValue]];
|
||||
[mjpegDecoder15bit setIntegerValue:[[keyValues objectForKey:@"Fast mjpeg decoder"] boolValue]];
|
||||
[drawScanlines setIntegerValue:[[keyValues objectForKey:@"Draw Scanlines"] boolValue]];
|
||||
[offscreenDrawing selectItemAtIndex:[[keyValues objectForKey:@"Offscreen Drawing Level"] integerValue]];
|
||||
[advancedBlending setIntegerValue:[[keyValues objectForKey:@"Advanced Blending"] boolValue]];
|
||||
[opaquePass setIntegerValue:[[keyValues objectForKey:@"Opaque Pass"] boolValue]];
|
||||
[wireframeOnly setIntegerValue:[[keyValues objectForKey:@"Wireframe Mode"] boolValue]];
|
||||
[blurEffect setIntegerValue:[[keyValues objectForKey:@"Blur"] boolValue]];
|
||||
[texColorDepth selectItemAtIndex:[[keyValues objectForKey:@"Texture Color Depth Level"] integerValue]];
|
||||
[gteAccuracy setIntegerValue:[[keyValues objectForKey:@"GteAccuracy"] boolValue]];
|
||||
[scanlineColorWell setEnabled:[[keyValues objectForKey:@"Draw Scanlines"] boolValue]];
|
||||
[frameBufferEffects selectItemAtIndex:[[keyValues objectForKey:@"Frame Buffer Level"] integerValue]];
|
||||
[vSync setIntegerValue:[[keyValues objectForKey:kVSync] boolValue]];
|
||||
[proportionalResize setIntegerValue:[[keyValues objectForKey:@"Proportional Resize"] boolValue]];
|
||||
NSSize winSize = NSSizeFromString([keyValues objectForKey:kWindowSize]);
|
||||
[autoFullScreen setIntegerValue:[keyValues[kAutoFullScreen] boolValue]];
|
||||
[ditherMode selectItemAtIndex:[keyValues[@"Dither Mode"] integerValue]];
|
||||
[fpsCounter setIntegerValue:[keyValues[kFPSCounter] boolValue]];
|
||||
[scanlineColorWell setColor:[NSUnarchiver unarchiveObjectWithData: keyValues[@"Scanline Color"]]];
|
||||
[frameSkipping setIntegerValue:[keyValues[kFrameSkipping] boolValue]];
|
||||
[advancedBlending setIntegerValue:[keyValues[@"Advanced Blending"] boolValue]];
|
||||
[texFiltering setIntegerValue:[keyValues[@"Texture Filter Level"] integerValue]];
|
||||
[texEnhancment setIntegerValue:[keyValues[@"Texture Enhancement Level"] integerValue]];
|
||||
[zMaskClipping setIntegerValue:[keyValues[@"Z Mask Clipping"] integerValue]];
|
||||
[mjpegDecoder setIntegerValue:[keyValues[@"Emulate mjpeg decoder"] boolValue]];
|
||||
[mjpegDecoder15bit setIntegerValue:[keyValues[@"Fast mjpeg decoder"] boolValue]];
|
||||
[drawScanlines setIntegerValue:[keyValues[@"Draw Scanlines"] boolValue]];
|
||||
[offscreenDrawing selectItemAtIndex:[keyValues[@"Offscreen Drawing Level"] integerValue]];
|
||||
[advancedBlending setIntegerValue:[keyValues[@"Advanced Blending"] boolValue]];
|
||||
[opaquePass setIntegerValue:[keyValues[@"Opaque Pass"] boolValue]];
|
||||
[wireframeOnly setIntegerValue:[keyValues[@"Wireframe Mode"] boolValue]];
|
||||
[blurEffect setIntegerValue:[keyValues[@"Blur"] boolValue]];
|
||||
[texColorDepth selectItemAtIndex:[keyValues[@"Texture Color Depth Level"] integerValue]];
|
||||
[gteAccuracy setIntegerValue:[keyValues[@"GteAccuracy"] boolValue]];
|
||||
[scanlineColorWell setEnabled:[keyValues[@"Draw Scanlines"] boolValue]];
|
||||
[frameBufferEffects selectItemAtIndex:[keyValues[@"Frame Buffer Level"] integerValue]];
|
||||
[vSync setIntegerValue:[keyValues[kVSync] boolValue]];
|
||||
[proportionalResize setIntegerValue:[keyValues[@"Proportional Resize"] boolValue]];
|
||||
NSSize winSize = NSSizeFromString(keyValues[kWindowSize]);
|
||||
[windowWidth setIntegerValue:winSize.width];
|
||||
[windowHeighth setIntegerValue:winSize.height];
|
||||
}
|
||||
|
@ -424,8 +419,8 @@ void ReadConfig(void)
|
|||
hackValues |= [control intValue] << ([control tag] - 1);
|
||||
}
|
||||
NSMutableDictionary *writeDic = self.keyValues;
|
||||
[writeDic setObject:@(hackValues) forKey:kHacks];
|
||||
[writeDic setObject:([hackEnable integerValue] ? @YES : @NO) forKey:kHacksEnable];
|
||||
writeDic[kHacks] = @(hackValues);
|
||||
writeDic[kHacksEnable] = ([hackEnable integerValue] ? @YES : @NO);
|
||||
}
|
||||
[sheet orderOut:nil];
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination)
|
|||
[glInstance reshape];
|
||||
// [glView update];
|
||||
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[[gameWindow screen] deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[gameWindow screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
if (CGDisplayIsCaptured(display)) {
|
||||
[gameController setFullscreen:YES];
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination)
|
|||
- (NSRect) screenFrame
|
||||
{
|
||||
NSWindow* wind = [self window];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[[wind screen] deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[wind screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
|
||||
return NSMakeRect (0,0,CGDisplayPixelsWide(display), CGDisplayPixelsHigh(display));
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination)
|
|||
NSWindow *window = [self window];
|
||||
NSScreen *screen = [window screen];
|
||||
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[screen deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
|
||||
NSRect newPlace;
|
||||
|
||||
|
@ -358,7 +358,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination)
|
|||
NSWindow *window = [self window];
|
||||
NSScreen *screen = [window screen];
|
||||
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[screen deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
|
||||
if ([self fullscreen]){
|
||||
[window setLevel: NSScreenSaverWindowLevel];
|
||||
|
@ -371,7 +371,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination)
|
|||
// if in fullscreen, we must abdicate mouse hiding and level.
|
||||
NSWindow *window = [self window];
|
||||
NSScreen *screen = [window screen];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||
CGDirectDisplayID display = (CGDirectDisplayID)[[screen deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
|
||||
if ([self fullscreen]){
|
||||
[window setLevel: NSNormalWindowLevel];
|
||||
|
|
Loading…
Reference in New Issue
Block a user