summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-26 19:55:10 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-26 19:55:10 +0000
commitd663bbeb7c6958388d515c196bc73956b574ffbb (patch)
tree3093f1f1ecc383bfbef59a96e6e00056089daa46
parent13e08db872f4775ca23df12fcc03f1916ed9691e (diff)
downloadpcsxr-d663bbeb7c6958388d515c196bc73956b574ffbb.tar.gz
fixing the wrong project being non-arc.
Add a convinience function for running blocks on the main thread syncronously. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86262 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--macosx/Pcsxr.xcodeproj/project.pbxproj8
-rwxr-xr-xmacosx/main.m34
-rw-r--r--macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m52
-rwxr-xr-xmacosx/plugins/DFNet/macsrc/SockDialog.m12
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginConfigController.m3
-rwxr-xr-xmacosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m3
6 files changed, 60 insertions, 52 deletions
diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj
index b8e5f78b..90b764d9 100644
--- a/macosx/Pcsxr.xcodeproj/project.pbxproj
+++ b/macosx/Pcsxr.xcodeproj/project.pbxproj
@@ -917,8 +917,8 @@
children = (
55858D2F178652F90068B8FC /* Configs */,
08FB7795FE84155DC02AAC07 /* PCSXR */,
- 551A749D17868B110052D185 /* Frameworks */,
551A74AF17868BE90052D185 /* plugins */,
+ 551A749D17868B110052D185 /* Frameworks */,
1AB674ADFE9D54B511CA2CBB /* Products */,
2BB3D6CF05427FE200831ACB /* Info.plist */,
);
@@ -2998,7 +2998,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- "CLANG_ENABLE_OBJC_ARC[arch=x86_64]" = NO;
CLANG_WARN_EMPTY_BODY = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@@ -3017,7 +3016,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- "CLANG_ENABLE_OBJC_ARC[arch=x86_64]" = NO;
CLANG_WARN_EMPTY_BODY = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@@ -3144,6 +3142,7 @@
551A77C21786A2890052D185 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ "CLANG_ENABLE_OBJC_ARC[arch=x86_64]" = NO;
CLANG_WARN_EMPTY_BODY = YES;
DYLIB_COMPATIBILITY_VERSION = 150.2.50;
DYLIB_CURRENT_VERSION = 24;
@@ -3163,6 +3162,7 @@
551A77C31786A2890052D185 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ "CLANG_ENABLE_OBJC_ARC[arch=x86_64]" = NO;
CLANG_WARN_EMPTY_BODY = YES;
DYLIB_COMPATIBILITY_VERSION = 150.2.50;
DYLIB_CURRENT_VERSION = 24;
@@ -3231,7 +3231,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- "CLANG_ENABLE_OBJC_ARC[arch=x86_64]" = NO;
CLANG_WARN_EMPTY_BODY = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@@ -3248,6 +3247,7 @@
557649BC1786B09E007C4457 /* Instrument */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ "CLANG_ENABLE_OBJC_ARC[arch=x86_64]" = NO;
CLANG_WARN_EMPTY_BODY = YES;
DYLIB_COMPATIBILITY_VERSION = 150.2.50;
DYLIB_CURRENT_VERSION = 24;
diff --git a/macosx/main.m b/macosx/main.m
index 90771a93..5aaf13f2 100755
--- a/macosx/main.m
+++ b/macosx/main.m
@@ -18,6 +18,15 @@
#import "hotkeys.h"
#import "ARCBridge.h"
+static inline void RunOnMainThreadSync(dispatch_block_t block)
+{
+ if ([NSThread isMainThread]) {
+ block();
+ } else {
+ dispatch_sync(dispatch_get_main_queue(), block);
+ }
+}
+
static BOOL sysInited = NO;
//#define EMU_LOG
static IOPMAssertionID powerAssertion = kIOPMNullAssertionID;
@@ -129,22 +138,16 @@ void SysPrintf(const char *fmt, ...) {
va_start(list, fmt);
vsnprintf(msg, 512, fmt, list);
va_end(list);
-
-
- dispatch_block_t printfBlock = ^{
+
+ RunOnMainThreadSync(^{
if (Config.PsxOut) NSLog (@"%s", msg);
#ifdef EMU_LOG
#ifndef LOG_STDOUT
if (emuLog) fprintf(emuLog, "%s %s: %s",[[debugDateFormatter() stringFromDate:[NSDate date]] UTF8String],
- [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"] UTF8String], msg);
+ [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"] UTF8String], msg);
#endif
#endif
- };
- if ([NSThread isMainThread]) {
- printfBlock();
- } else {
- dispatch_sync(dispatch_get_main_queue(), printfBlock);
- }
+ });
free(msg);
}
@@ -160,16 +163,9 @@ void SysMessage(const char *fmt, ...) {
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:msg forKey:NSLocalizedFailureReasonErrorKey];
RELEASEOBJ(msg);
-
- dispatch_block_t sysBlock = ^{
+ RunOnMainThreadSync(^{
[NSApp presentError:[NSError errorWithDomain:@"Unknown Domain" code:-1 userInfo:userInfo]];
- };
-
- if ([NSThread isMainThread]) {
- sysBlock();
- } else {
- dispatch_sync(dispatch_get_main_queue(), sysBlock);
- }
+ });
}
void *SysLoadLibrary(const char *lib) {
diff --git a/macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m b/macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m
index 2f69bc9a..888c0820 100644
--- a/macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m
+++ b/macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m
@@ -12,31 +12,33 @@
*/
FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
{
- @autoreleasepool {
- FILE* fp = NULL;
-
- // If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
- if(strcmp("r", mode) && strcmp("rb", mode))
- {
- return fopen(file, mode);
- }
-
- NSFileManager* file_manager = [NSFileManager defaultManager];
- NSString* resource_path = [[NSBundle mainBundle] resourcePath];
-
- NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
-
- NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
- if([file_manager fileExistsAtPath:full_path_with_file_to_try])
- {
- fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
- }
- else
- {
- fp = fopen(file, mode);
- }
-
- return fp;
+ FILE* fp = NULL;
+
+ // If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
+ if(strcmp("r", mode) && strcmp("rb", mode))
+ {
+ return fopen(file, mode);
}
+
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
+ NSFileManager* file_manager = [NSFileManager defaultManager];
+ NSString* resource_path = [[NSBundle mainBundle] resourcePath];
+
+ NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
+
+ NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
+ if([file_manager fileExistsAtPath:full_path_with_file_to_try])
+ {
+ fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
+ }
+ else
+ {
+ fp = fopen(file, mode);
+ }
+
+ [pool drain];
+
+ return fp;
}
#endif
diff --git a/macosx/plugins/DFNet/macsrc/SockDialog.m b/macosx/plugins/DFNet/macsrc/SockDialog.m
index 065afc26..77a09f04 100755
--- a/macosx/plugins/DFNet/macsrc/SockDialog.m
+++ b/macosx/plugins/DFNet/macsrc/SockDialog.m
@@ -40,12 +40,20 @@ void SysMessage(const char *fmt, ...)
}
}
+static inline void RunOnMainThreadSync(dispatch_block_t block)
+{
+ if ([NSThread isMainThread]) {
+ block();
+ } else {
+ dispatch_sync(dispatch_get_main_queue(), block);
+ }
+}
static SockDialog *globalSock = nil;
void sockCreateWaitDlg()
{
- dispatch_sync(dispatch_get_main_queue(), ^{
+ RunOnMainThreadSync(^{
if (globalSock == nil) {
globalSock = [[SockDialog alloc] init];
}
@@ -70,7 +78,7 @@ long sockOpen()
void sockDestroyWaitDlg()
{
- dispatch_sync(dispatch_get_main_queue(), ^{
+ RunOnMainThreadSync(^{
if (globalSock != nil) {
[globalSock close];
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m
index deb52926..cd465939 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m
+++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m
@@ -66,7 +66,7 @@ void AboutDlgProc()
[icon setSize:size];
NSDictionary *infoPaneDict =
- [NSDictionary dictionaryWithObjectsAndKeys:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
icon, @"ApplicationIcon",
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
@@ -77,6 +77,7 @@ void AboutDlgProc()
dispatch_async(dispatch_get_main_queue(), ^{
[app orderFrontStandardAboutPanelWithOptions:infoPaneDict];
});
+ RELEASEOBJ(infoPaneDict);
}
void SoftDlgProc()
diff --git a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m
index 475c666b..af6ee458 100755
--- a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m
+++ b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m
@@ -71,7 +71,7 @@ void AboutDlgProc()
[icon setSize:size];
NSDictionary *infoPaneDict =
- [NSDictionary dictionaryWithObjectsAndKeys:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
[bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
icon, @"ApplicationIcon",
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
@@ -82,6 +82,7 @@ void AboutDlgProc()
dispatch_async(dispatch_get_main_queue(), ^{
[app orderFrontStandardAboutPanelWithOptions:infoPaneDict];
});
+ RELEASEOBJ(infoPaneDict);
}
void DlgProc()