summaryrefslogtreecommitdiff
path: root/macosx/plugins
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 /macosx/plugins
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
Diffstat (limited to 'macosx/plugins')
-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
4 files changed, 41 insertions, 29 deletions
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()