summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-21 23:19:04 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-21 23:19:04 +0000
commitde13f7dcbaa84255fa578aafe862f90c46225a01 (patch)
tree0da83fa6b6e634d1f3e4a7af7e629d5473cfd76e
parente57165ae3f1706afec533d7b3cae17555a0f38ad (diff)
downloadpcsxr-de13f7dcbaa84255fa578aafe862f90c46225a01.tar.gz
Fix OS X 10.8-only behavior in the XGL plug-in.
Remove some commented-out code on Cocoa code. Change some ints passed in Cocoa code to NSIntegers. Replace a deprecated function call to NSRunAlertPanelRelativeToWindow. Other minor fixes and improvements. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86808 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--macosx/CheatController.m43
-rwxr-xr-xmacosx/ConfigurationController.h4
-rwxr-xr-xmacosx/ConfigurationController.m15
-rwxr-xr-xmacosx/PcsxrMemoryObject.h18
-rwxr-xr-xmacosx/PcsxrMemoryObject.m8
-rwxr-xr-xmacosx/plugins/DFInput/macsrc/ControllerList.h2
-rwxr-xr-xmacosx/plugins/DFInput/macsrc/ControllerList.m2
-rw-r--r--macosx/plugins/PeopsXgl/English.lproj/NetSfPeopsOpenGLConfig.xib21
-rwxr-xr-xmacosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m66
9 files changed, 94 insertions, 85 deletions
diff --git a/macosx/CheatController.m b/macosx/CheatController.m
index 2e5976f2..4b91319d 100644
--- a/macosx/CheatController.m
+++ b/macosx/CheatController.m
@@ -314,28 +314,37 @@
[self setDocumentEdited:NO];
}
+- (void)sheetDidDismiss:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+ switch (returnCode) {
+ case NSAlertDefaultReturn:
+ [self reloadCheats];
+ [self close];
+ break;
+
+ default:
+ [self refreshNSCheatArray];
+ [self close];
+ break;
+
+ case NSAlertOtherReturn:
+ break;
+ }
+}
+
- (BOOL)windowShouldClose:(id)sender
{
if (![sender isDocumentEdited] || ![[self window] isEqual:sender]) {
return YES;
} else {
- //TODO: properly use a non-deprecated method here.
- NSInteger retVal = NSRunAlertPanelRelativeToWindow(NSLocalizedString(@"Unsaved Changes", @"Unsaved changes"), NSLocalizedString(@"The Cheat codes have not been applied. Unapplied cheats will not run nor be saved. Do you wish to save?",nil), NSLocalizedString(@"Save", @"Save"), NSLocalizedString(@"Don't Save",@"Don't Save"), NSLocalizedString(@"Cancel", @"Cancel"), sender);
- switch (retVal) {
- case NSAlertDefaultReturn:
- [self reloadCheats];
- return YES;
- break;
-
- default:
- [self refreshNSCheatArray];
- return YES;
- break;
-
- case NSAlertOtherReturn:
- return NO;
- break;
- }
+ NSBeginAlertSheet(NSLocalizedString(@"Unsaved Changes", @"Unsaved changes"),
+ NSLocalizedString(@"Save", @"Save"),
+ NSLocalizedString(@"Don't Save",@"Don't Save"),
+ NSLocalizedString(@"Cancel", @"Cancel"), [self window], self,
+ NULL, @selector(sheetDidDismiss:returnCode:contextInfo:), NULL,
+ NSLocalizedString(@"The cheat codes have not been applied. Unapplied cheats will not run nor be saved. Do you wish to save?",nil));
+
+ return NO;
}
}
diff --git a/macosx/ConfigurationController.h b/macosx/ConfigurationController.h
index 90547816..dea18c1d 100755
--- a/macosx/ConfigurationController.h
+++ b/macosx/ConfigurationController.h
@@ -48,8 +48,8 @@ extern NSString *const memCardChangeNumberKey;
- (IBAction)setVideoType:(id)sender;
- (NSString *)keyForSender:(id)sender;
-+ (void)setMemoryCard:(int)theCard toPath:(NSString *)theFile;
-+ (void)setMemoryCard:(int)theCard toURL:(NSURL *)theURL;
++ (void)setMemoryCard:(NSInteger)theCard toPath:(NSString *)theFile;
++ (void)setMemoryCard:(NSInteger)theCard toURL:(NSURL *)theURL;
+ (void)mcdNewClicked:(id)sender;
+ (void)mcdChangeClicked:(id)sender;
diff --git a/macosx/ConfigurationController.m b/macosx/ConfigurationController.m
index 186772f7..0c5265d9 100755
--- a/macosx/ConfigurationController.m
+++ b/macosx/ConfigurationController.m
@@ -13,7 +13,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
@implementation ConfigurationController
-+ (void)setMemoryCard:(int)theCard toURL:(NSURL *)theURL;
++ (void)setMemoryCard:(NSInteger)theCard toURL:(NSURL *)theURL;
{
if (theCard == 1) {
[[NSUserDefaults standardUserDefaults] setURL:theURL forKey:@"Mcd1"];
@@ -27,7 +27,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
[NSDictionary dictionaryWithObject:@(theCard) forKey:memCardChangeNumberKey]];
}
-+ (void)setMemoryCard:(int)theCard toPath:(NSString *)theFile
++ (void)setMemoryCard:(NSInteger)theCard toPath:(NSString *)theFile
{
[self setMemoryCard:theCard toURL:[NSURL fileURLWithPath:theFile isDirectory:NO]];
}
@@ -83,7 +83,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
if ([openDlg runModal] == NSFileHandlingPanelOKButton) {
NSURL *mcdURL = [[openDlg URLs] objectAtIndex:0];
- [ConfigurationController setMemoryCard:(int)tag toURL:mcdURL];
+ [ConfigurationController setMemoryCard:tag toURL:mcdURL];
}
RELEASEOBJ(openDlg);
}
@@ -114,7 +114,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
strlcpy(mcd, [[mcdURL path] fileSystemRepresentation], MAXPATHLEN);
CreateMcd(mcd);
- [ConfigurationController setMemoryCard:(int)tag toURL:mcdURL];
+ [ConfigurationController setMemoryCard:tag toURL:mcdURL];
}
RELEASEOBJ(openDlg);
}
@@ -223,9 +223,9 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
#if !__has_feature(objc_arc)
- (void)dealloc
{
- RELEASEOBJ(checkBoxDefaults);
+ [checkBoxDefaults release];
- SUPERDEALLOC;
+ [super dealloc];
}
#endif
@@ -233,9 +233,8 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
{
for (NSString *key in checkBoxDefaults) {
id object = [checkBoxDefaults objectForKey:key];
- if ([object isEqual:sender]) {
+ if ([object isEqual:sender])
return key;
- }
}
return nil;
diff --git a/macosx/PcsxrMemoryObject.h b/macosx/PcsxrMemoryObject.h
index e84b15d5..0e2e79d2 100755
--- a/macosx/PcsxrMemoryObject.h
+++ b/macosx/PcsxrMemoryObject.h
@@ -32,27 +32,27 @@ typedef enum _PCSXRMemFlags {
NSString *memName;
NSString *memID;
- NSArray *memImages;
- NSInteger memImageIndex;
- int startingIndex;
- int blockSize;
- PCSXRMemFlags flagNameIndex;
+ NSArray *memImages;
+ NSInteger memImageIndex;
+ uint8_t startingIndex;
+ uint8_t blockSize;
+ PCSXRMemFlags flagNameIndex;
}
+ (NSArray *)imagesFromMcd:(McdBlock *)block;
+ (NSString*)memoryLabelFromFlag:(PCSXRMemFlags)flagNameIndex;
+ (NSImage *)blankImage;
+ (PCSXRMemFlags)memFlagsFromBlockFlags:(unsigned char)blockFlags;
-- (id)initWithMcdBlock:(McdBlock *)infoBlockc startingIndex:(int)startIdx;
-- (id)initWithMcdBlock:(McdBlock *)infoBlockc startingIndex:(int)startIdx size:(int)memSize;
+- (id)initWithMcdBlock:(McdBlock *)infoBlockc startingIndex:(uint8_t)startIdx;
+- (id)initWithMcdBlock:(McdBlock *)infoBlockc startingIndex:(uint8_t)startIdx size:(uint8_t)memSize;
@property (readonly, arcstrong) NSString *englishName;
@property (readonly, arcstrong) NSString *sjisName;
@property (readonly, arcstrong) NSString *memName;
@property (readonly, arcstrong) NSString *memID;
@property (readonly) PCSXRMemFlags flagNameIndex;
-@property (readonly) int startingIndex;
-@property (readonly) int blockSize;
+@property (readonly) uint8_t startingIndex;
+@property (readonly) uint8_t blockSize;
@property (readonly, unsafe_unretained, nonatomic) NSImage *memImage;
@property (readonly, nonatomic) unsigned memIconCount;
diff --git a/macosx/PcsxrMemoryObject.m b/macosx/PcsxrMemoryObject.m
index b5414e38..675033b4 100755
--- a/macosx/PcsxrMemoryObject.m
+++ b/macosx/PcsxrMemoryObject.m
@@ -22,8 +22,8 @@ NSString *const memoryAnimateTimerKey = @"PCSXR Memory Card Image Animate";
@property (readwrite, arcstrong) NSString *sjisName;
@property (readwrite, arcstrong) NSString *memName;
@property (readwrite, arcstrong) NSString *memID;
-@property (readwrite) int startingIndex;
-@property (readwrite) int blockSize;
+@property (readwrite) uint8_t startingIndex;
+@property (readwrite) uint8_t blockSize;
@property (readwrite, nonatomic) NSInteger memImageIndex;
@property (arcstrong) NSArray *memImages;
@@ -124,7 +124,7 @@ static NSString *MemLabelEndLink;
return imageBlank;
}
-- (id)initWithMcdBlock:(McdBlock *)infoBlock startingIndex:(int)startIdx
+- (id)initWithMcdBlock:(McdBlock *)infoBlock startingIndex:(uint8_t)startIdx
{
return [self initWithMcdBlock:infoBlock startingIndex:startIdx size:1];
}
@@ -151,7 +151,7 @@ static NSString *MemLabelEndLink;
return memFlagFree;
}
-- (id)initWithMcdBlock:(McdBlock *)infoBlock startingIndex:(int)startIdx size:(int)memSize
+- (id)initWithMcdBlock:(McdBlock *)infoBlock startingIndex:(uint8_t)startIdx size:(uint8_t)memSize
{
if (self = [super init]) {
self.startingIndex = startIdx;
diff --git a/macosx/plugins/DFInput/macsrc/ControllerList.h b/macosx/plugins/DFInput/macsrc/ControllerList.h
index d0d1fb13..7eab9a54 100755
--- a/macosx/plugins/DFInput/macsrc/ControllerList.h
+++ b/macosx/plugins/DFInput/macsrc/ControllerList.h
@@ -33,7 +33,7 @@
+ (void)setCurrentController:(int)which;
+ (int)currentController;
-+ (int)buttonOfRow:(int)row;
++ (int)buttonOfRow:(NSInteger)row;
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex;
- (void)deleteRow:(NSInteger)which;
diff --git a/macosx/plugins/DFInput/macsrc/ControllerList.m b/macosx/plugins/DFInput/macsrc/ControllerList.m
index 4e208cab..a1d4deed 100755
--- a/macosx/plugins/DFInput/macsrc/ControllerList.m
+++ b/macosx/plugins/DFInput/macsrc/ControllerList.m
@@ -105,7 +105,7 @@ static const int DPad[DKEY_TOTAL] = {
DKEY_ANALOG
};
-+ (int)buttonOfRow:(int)row
++ (int)buttonOfRow:(NSInteger)row
{
return DPad[row];
}
diff --git a/macosx/plugins/PeopsXgl/English.lproj/NetSfPeopsOpenGLConfig.xib b/macosx/plugins/PeopsXgl/English.lproj/NetSfPeopsOpenGLConfig.xib
index 6e528364..9d08f139 100644
--- a/macosx/plugins/PeopsXgl/English.lproj/NetSfPeopsOpenGLConfig.xib
+++ b/macosx/plugins/PeopsXgl/English.lproj/NetSfPeopsOpenGLConfig.xib
@@ -102,7 +102,6 @@
<string key="NSFrame">{{413, 13}, {122, 32}}</string>
<reference key="NSSuperview" ref="675926718"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="972260448">
<int key="NSCellFlags">67108864</int>
@@ -656,7 +655,6 @@
<bytes key="NSWhite">MQA</bytes>
</object>
<reference key="NSFont" ref="917501388"/>
- <bool key="NSAutorecalculatesCellSize">YES</bool>
</object>
</object>
<string key="NSFrame">{{2, 2}, {510, 127}}</string>
@@ -1577,7 +1575,7 @@
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="713073715">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1596,7 +1594,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 13}, {420, 178}}</string>
<reference key="NSSuperview" ref="138033641"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="599923"/>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
@@ -1896,13 +1893,11 @@
</object>
<string key="NSFrame">{{2, 2}, {459, 202}}</string>
<reference key="NSSuperview" ref="671483095"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="232960397"/>
</object>
</object>
<string key="NSFrame">{{17, 57}, {463, 206}}</string>
<reference key="NSSuperview" ref="713073715"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="138033641"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
@@ -1927,7 +1922,6 @@
<int key="NSvFlags">269</int>
<string key="NSFrame">{{143, 269}, {211, 56}}</string>
<reference key="NSSuperview" ref="713073715"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="671483095"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="688135460">
@@ -1949,7 +1943,6 @@ A</string>
<int key="NSvFlags">269</int>
<string key="NSFrame">{{195, 331}, {106, 18}}</string>
<reference key="NSSuperview" ref="713073715"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="320711766"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="46903452">
@@ -1973,8 +1966,6 @@ A</string>
<int key="NSvFlags">269</int>
<string key="NSFrame">{{424, 13}, {59, 32}}</string>
<reference key="NSSuperview" ref="713073715"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
@@ -1999,7 +1990,6 @@ A</string>
<int key="NSvFlags">269</int>
<string key="NSFrame">{{342, 13}, {82, 32}}</string>
<reference key="NSSuperview" ref="713073715"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="91253578"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -2021,8 +2011,6 @@ A</string>
</object>
</object>
<string key="NSFrameSize">{497, 367}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1031376586"/>
<string key="NSReuseIdentifierKey">_NS:20</string>
</object>
@@ -4326,7 +4314,6 @@ A</string>
<string>texFiltering</string>
<string>vSync</string>
<string>windowHeighth</string>
- <string>windowSize</string>
<string>windowWidth</string>
<string>wireframeOnly</string>
<string>zMaskClipping</string>
@@ -4357,7 +4344,6 @@ A</string>
<string>NSSlider</string>
<string>NSControl</string>
<string>NSFormCell</string>
- <string>NSPopUpButton</string>
<string>NSFormCell</string>
<string>NSControl</string>
<string>NSControl</string>
@@ -4391,7 +4377,6 @@ A</string>
<string>texFiltering</string>
<string>vSync</string>
<string>windowHeighth</string>
- <string>windowSize</string>
<string>windowWidth</string>
<string>wireframeOnly</string>
<string>zMaskClipping</string>
@@ -4495,10 +4480,6 @@ A</string>
<string key="candidateClassName">NSFormCell</string>
</object>
<object class="IBToOneOutletInfo">
- <string key="name">windowSize</string>
- <string key="candidateClassName">NSPopUpButton</string>
- </object>
- <object class="IBToOneOutletInfo">
<string key="name">windowWidth</string>
<string key="candidateClassName">NSFormCell</string>
</object>
diff --git a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m
index c963c35a..12994a8e 100755
--- a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m
+++ b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m
@@ -48,12 +48,10 @@ extern char* PLUGLOC(char* toloc);
#define PrefsKey APP_ID @" Settings"
static NetSfPeopsOpenGLPluginConfigController *windowController = nil;
-char * pConfigFile=NULL;
void AboutDlgProc()
{
// Get parent application instance
- NSApplication *app = [NSApplication sharedApplication];
NSBundle *bundle = [NSBundle bundleWithIdentifier:APP_ID];
// Get Credits.rtf
@@ -80,7 +78,7 @@ void AboutDlgProc()
credits, @"Credits",
nil];
dispatch_async(dispatch_get_main_queue(), ^{
- [app orderFrontStandardAboutPanelWithOptions:infoPaneDict];
+ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict];
});
RELEASEOBJ(infoPaneDict);
}
@@ -110,6 +108,7 @@ void DlgProc()
#define kFrameLimit @"Frame Limit"
#define kVSync @"VSync"
#define kHacksEnable @"Enable Hacks"
+#define kWindowSize @"Window Size"
void PrepFactoryDefaultPreferences(void)
{
@@ -124,15 +123,25 @@ void PrepFactoryDefaultPreferences(void)
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary* keyValues = [defaults dictionaryForKey:PrefsKey];
-
- if (keyValues && [[keyValues objectForKey:@"Window Size"] isKindOfClass:[NSNumber class]]) {
+ BOOL windowSizeNeedsReset = NO;
+ if (keyValues) {
+ NSSize size = NSSizeFromString([keyValues objectForKey:kWindowSize]);
+ if (![keyValues objectForKey:kWindowSize]) {
+ windowSizeNeedsReset = YES;
+ } else if ([[keyValues objectForKey:kWindowSize] isKindOfClass:[NSNumber class]]) {
+ windowSizeNeedsReset = YES;
+ } else if (size.height == 0 || size.width == 0) {
+ windowSizeNeedsReset = YES;
+ }
+ }
+ if (windowSizeNeedsReset) {
NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc] initWithDictionary:keyValues];
- [tmpDict setObject:NSStringFromSize(NSMakeSize(800, 600)) forKey:@"Window Size"];
+ [tmpDict setObject:NSStringFromSize(NSMakeSize(800, 600)) forKey:kWindowSize];
[defaults setObject:tmpDict forKey:PrefsKey];
[defaults synchronize];
RELEASEOBJ(tmpDict);
}
-
+ keyValues = nil;
[defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
[NSDictionary dictionaryWithObjectsAndKeys:
@@ -143,7 +152,7 @@ void PrepFactoryDefaultPreferences(void)
@NO, kVSync,
@NO, kHacksEnable,
@0, @"Dither Mode",
- @((unsigned int)0), kHacks,
+ @0, kHacks,
@YES, @"Proportional Resize",
//[NSSize stringWithCString: @"default"], @"Fullscreen Resolution",
@@ -152,7 +161,7 @@ void PrepFactoryDefaultPreferences(void)
@0, @"Texture Enhancement Level",
@0, @"Texture Filter Level",
@0, @"Frame Buffer Level",
- NSStringFromSize(NSMakeSize(800, 600)), @"Window Size",
+ NSStringFromSize(NSMakeSize(800, 600)), kWindowSize,
@NO, @"Draw Scanlines",
// nasty:
[NSArchiver archivedDataWithRootObject: [NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.25]], @"Scanline Color",
@@ -202,7 +211,7 @@ void ReadConfig(void)
// we always start out at 800x600 (at least until resizing the window is implemented)
- NSSize winSize = NSSizeFromString([keyValues objectForKey:@"Window Size"]);
+ NSSize winSize = NSSizeFromString([keyValues objectForKey:kWindowSize]);
if (bChangeWinMode == 1) {
iResX = winSize.width;
iResY = winSize.height;
@@ -213,7 +222,7 @@ void ReadConfig(void)
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"]];
+ NSColor* scanColor = [NSUnarchiver unarchiveObjectWithData:[keyValues objectForKey:@"Scanline Color"]];
scanColor = [scanColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]];
iScanlineColor[0] = [scanColor redComponent];
iScanlineColor[1] = [scanColor greenComponent];
@@ -296,17 +305,19 @@ void ReadConfig(void)
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+#if 0
unsigned int hackValues = 0;
NSArray *views = [hacksMatrix cells];
for (NSControl *control in views) {
hackValues |= [control intValue] << ([control tag] - 1);
}
+#endif
- self.keyValues = [NSMutableDictionary dictionaryWithDictionary: [[NSUserDefaults standardUserDefaults] dictionaryForKey:PrefsKey]];
+ //self.keyValues = [NSMutableDictionary dictionaryWithDictionary: [[NSUserDefaults standardUserDefaults] dictionaryForKey:PrefsKey]];
NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues];
- [writeDic setObject:@(hackValues) forKey:kHacks];
+ //[writeDic setObject:@(hackValues) forKey:kHacks];
[writeDic setObject:([hackEnable integerValue] ? @YES : @NO) forKey:kHacksEnable];
[writeDic setObject:([fpsCounter integerValue] ? @YES : @NO) forKey:kFPSCounter];
[writeDic setObject:[NSArchiver archivedDataWithRootObject:[scanlineColorWell color]] forKey:@"Scanline Color"];
@@ -330,10 +341,8 @@ void ReadConfig(void)
[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:@"Window Size"];
- //[writeDic setObject:@([windowSize indexOfItem:[windowSize selectedItem]]) forKey:@"Window Size"];
-
-
+ [writeDic setObject:NSStringFromSize(NSMakeSize([windowWidth integerValue], [windowHeighth integerValue])) forKey:kWindowSize];
+
[defaults setObject:writeDic forKey:PrefsKey];
[defaults synchronize];
@@ -364,8 +373,7 @@ void ReadConfig(void)
[hackEnable setIntegerValue:[[self.keyValues objectForKey:kHacksEnable] boolValue]];
// build refs to hacks checkboxes
- NSArray *views = [hacksMatrix cells];
- for (NSControl *control in views) {
+ for (NSControl *control in [hacksMatrix cells]) {
[control setIntValue:(hackValues >> ([control tag] - 1)) & 1];
}
@@ -408,16 +416,13 @@ void ReadConfig(void)
[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:@"Window Size"]);
+ NSSize winSize = NSSizeFromString([keyValues objectForKey:kWindowSize]);
[windowWidth setIntegerValue:winSize.width];
[windowHeighth setIntegerValue:winSize.height];
-
- //[windowSize selectItemAtIndex:[[keyValues objectForKey:@"Window Size"] integerValue]];
}
- (void)awakeFromNib
{
- //hacksView = [[hacksView subviews] objectAtIndex:0];
[[NSColorPanel sharedColorPanel] setShowsAlpha:YES]; // eliminate dumb behavior!
}
@@ -427,6 +432,12 @@ void ReadConfig(void)
if (returnCode == NSCancelButton) {
//Reset hack preferences.
[self loadHacksValues];
+ } else {
+ unsigned int hackValues = 0;
+ for (NSControl *control in [hacksMatrix cells]) {
+ hackValues |= [control intValue] << ([control tag] - 1);
+ }
+ [self.keyValues setObject:@(hackValues) forKey:kHacks];
}
[sheet orderOut:nil];
}
@@ -453,6 +464,15 @@ void ReadConfig(void)
}
}
+#if !__has_feature(objc_arc)
+- (void)dealloc
+{
+ self.keyValues = nil;
+
+ [super dealloc];
+}
+#endif
+
@end
#import "OSXPlugLocalization.h"