diff options
Diffstat (limited to 'macosx/plugins/DFXVideo/macsrc')
| -rwxr-xr-x | macosx/plugins/DFXVideo/macsrc/PluginGLView.h | 9 | ||||
| -rwxr-xr-x | macosx/plugins/DFXVideo/macsrc/PluginGLView.m | 2 | ||||
| -rwxr-xr-x | macosx/plugins/DFXVideo/macsrc/drawgl.m | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.h b/macosx/plugins/DFXVideo/macsrc/PluginGLView.h index fe2e5f78..77fe06c9 100755 --- a/macosx/plugins/DFXVideo/macsrc/PluginGLView.h +++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.h @@ -24,6 +24,15 @@ #define IMAGE_COUNT 2 +static inline void RunOnMainThreadSync(dispatch_block_t block) +{ + if ([NSThread isMainThread]) { + block(); + } else { + dispatch_sync(dispatch_get_main_queue(), block); + } +} + @interface PluginGLView : NSOpenGLView { GLubyte *image_base; diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m index 39cfb5ad..778721fb 100755 --- a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m @@ -606,7 +606,7 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) //printf("y=%i",PSXDisplay.DisplayPosition.y); - dispatch_sync(dispatch_get_main_queue(), ^{ + RunOnMainThreadSync(^{ unsigned char * surf; long x = PSXDisplay.DisplayPosition.x; long y = PSXDisplay.DisplayPosition.y; diff --git a/macosx/plugins/DFXVideo/macsrc/drawgl.m b/macosx/plugins/DFXVideo/macsrc/drawgl.m index fd127469..efccb132 100755 --- a/macosx/plugins/DFXVideo/macsrc/drawgl.m +++ b/macosx/plugins/DFXVideo/macsrc/drawgl.m @@ -114,7 +114,7 @@ unsigned long ulInitDisplay(void) // OPEN GAME WINDOW BuildDispMenu(0); } __block NSWindow *window = nil; - dispatch_sync(dispatch_get_main_queue(), ^{ + RunOnMainThreadSync(^{ PluginWindowController *windowController = [PluginWindowController openGameView]; glView = [windowController openGLView]; |
