summaryrefslogtreecommitdiff
path: root/macosx/plugins/DFSound/macsrc
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-22 23:53:37 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-22 23:53:37 +0000
commit531ad373b2c22e00a341a6635023cf8949571bd5 (patch)
tree029961f0aa19ec396f6d7cc09f3ff93987c9aa62 /macosx/plugins/DFSound/macsrc
parent9628a367530657e7fefb17be0a125dbe3f5d7614 (diff)
downloadpcsxr-531ad373b2c22e00a341a6635023cf8949571bd5.tar.gz
Moving most of the OS X preferences to auto layout, and all to 10.7.
Changing some lists of independent checkbox buttons to matrices. Fix a discrepancy between SDL versions 1.2 and 2.0 APIs in OS X's input preferences. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86849 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFSound/macsrc')
-rwxr-xr-xmacosx/plugins/DFSound/macsrc/PluginController.m40
-rw-r--r--macosx/plugins/DFSound/macsrc/SPUPluginController.h8
-rw-r--r--macosx/plugins/DFSound/macsrc/SPUPluginController.m18
3 files changed, 44 insertions, 22 deletions
diff --git a/macosx/plugins/DFSound/macsrc/PluginController.m b/macosx/plugins/DFSound/macsrc/PluginController.m
index 88d23d03..c323967d 100755
--- a/macosx/plugins/DFSound/macsrc/PluginController.m
+++ b/macosx/plugins/DFSound/macsrc/PluginController.m
@@ -44,6 +44,15 @@ extern char* PLUGLOC(char* toloc);
static SPUPluginController *pluginController = nil;
+static inline void RunOnMainThreadSync(dispatch_block_t block)
+{
+ if ([NSThread isMainThread]) {
+ block();
+ } else {
+ dispatch_sync(dispatch_get_main_queue(), block);
+ }
+}
+
void DoAbout()
{
// Get parent application instance
@@ -81,18 +90,20 @@ void DoAbout()
long DoConfiguration()
{
- NSWindow *window;
-
- if (pluginController == nil) {
- pluginController = [[PluginController alloc] initWithWindowNibName:@"NetSfPeopsSpuPluginMain"];
- }
- window = [pluginController window];
-
- /* load values */
- [pluginController loadValues];
-
- [window center];
- [window makeKeyAndOrderFront:nil];
+ RunOnMainThreadSync(^{
+ NSWindow *window;
+
+ if (pluginController == nil) {
+ pluginController = [[PluginController alloc] initWithWindowNibName:@"NetSfPeopsSpuPluginMain"];
+ }
+ window = [pluginController window];
+
+ /* load values */
+ [pluginController loadValues];
+
+ [window center];
+ [window makeKeyAndOrderFront:nil];
+ });
return 0;
}
@@ -137,7 +148,7 @@ void ReadConfig(void)
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues];
+ NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:self.keyValues];
[writeDic setObject:@((BOOL)[hiCompBox intValue]) forKey:@"High Compatibility Mode"];
[writeDic setObject:@((BOOL)[irqWaitBox intValue]) forKey:@"SPU IRQ Wait"];
[writeDic setObject:@((BOOL)[monoSoundBox intValue]) forKey:@"Mono Sound Output"];
@@ -172,8 +183,7 @@ void ReadConfig(void)
ReadConfig();
/* load from preferences */
- RELEASEOBJ(keyValues);
- keyValues = [[defaults dictionaryForKey:PrefsKey] mutableCopy];
+ self.keyValues = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:PrefsKey]];
[hiCompBox setIntValue:[[keyValues objectForKey:@"High Compatibility Mode"] boolValue]];
[irqWaitBox setIntValue:[[keyValues objectForKey:@"SPU IRQ Wait"] boolValue]];
diff --git a/macosx/plugins/DFSound/macsrc/SPUPluginController.h b/macosx/plugins/DFSound/macsrc/SPUPluginController.h
index e6a61308..53b64aec 100644
--- a/macosx/plugins/DFSound/macsrc/SPUPluginController.h
+++ b/macosx/plugins/DFSound/macsrc/SPUPluginController.h
@@ -8,13 +8,14 @@
#import <Cocoa/Cocoa.h>
#import "NamedSlider.h"
+#import "ARCBridge.h"
@interface SPUPluginController : NSWindowController
{
- IBOutlet NSControl *hiCompBox;
+ IBOutlet NSCell *hiCompBox;
IBOutlet NamedSlider *interpolValue;
- IBOutlet NSControl *irqWaitBox;
- IBOutlet NSControl *monoSoundBox;
+ IBOutlet NSCell *irqWaitBox;
+ IBOutlet NSCell *monoSoundBox;
IBOutlet NamedSlider *reverbValue;
IBOutlet NSControl *xaEnableBox;
IBOutlet NSControl *xaSpeedBox;
@@ -22,6 +23,7 @@
NSMutableDictionary *keyValues;
}
+@property (readwrite, arcretain) NSMutableDictionary *keyValues;
- (IBAction)cancel:(id)sender;
- (IBAction)ok:(id)sender;
- (IBAction)reset:(id)sender;
diff --git a/macosx/plugins/DFSound/macsrc/SPUPluginController.m b/macosx/plugins/DFSound/macsrc/SPUPluginController.m
index bb225b51..83598618 100644
--- a/macosx/plugins/DFSound/macsrc/SPUPluginController.m
+++ b/macosx/plugins/DFSound/macsrc/SPUPluginController.m
@@ -8,9 +8,7 @@
#import "SPUPluginController.h"
-@implementation SPUPluginController
-
-static Class GetSPUBaseClass()
+static inline Class GetSPUBaseClass()
{
static Class spuBaseClass;
if (!spuBaseClass) {
@@ -19,7 +17,7 @@ static Class GetSPUBaseClass()
return spuBaseClass;
}
-static inline void FuncNotAvailable(id sel, id sender, SEL theCmd)
+static void FuncNotAvailable(id sel, id sender, SEL theCmd)
{
#ifdef DEBUG
NSString *selString = NSStringFromSelector(theCmd);
@@ -39,6 +37,9 @@ static inline void FuncNotAvailable(id sel, id sender, SEL theCmd)
#define NotAvailableWarn(sender) FuncNotAvailable(self, sender, _cmd)
+@implementation SPUPluginController
+@synthesize keyValues;
+
- (IBAction)cancel:(id)sender
{
NotAvailableWarn(sender);
@@ -59,4 +60,13 @@ static inline void FuncNotAvailable(id sel, id sender, SEL theCmd)
NotAvailableWarn(nil);
}
+#if !__has_feature(objc_arc)
+- (void)dealloc
+{
+ self.keyValues = nil;
+
+ [super dealloc];
+}
+#endif
+
@end