From da55e8a8889d0d2fea64b96ef9b3af78b016673e Mon Sep 17 00:00:00 2001 From: Olivier Goguel Date: Thu, 9 Nov 2017 23:49:52 +0100 Subject: [PATCH] Fix SetVideoFX not being called from the mainthread --- Common.iphone/KBDController.h | 1 + Common.iphone/activegsAppDelegate.mm | 6 ++++-- Common.iphone/activegsEmulatorController.h | 1 + Common.iphone/activegsEmulatorController.mm | 7 +++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Common.iphone/KBDController.h b/Common.iphone/KBDController.h index 177ed9b..2043e7e 100644 --- a/Common.iphone/KBDController.h +++ b/Common.iphone/KBDController.h @@ -133,6 +133,7 @@ enum -(void)resetSpecialKeys; -(void)unloadSpecialKeys; - (void) animateDisk:(id)_id ; +-(void) animateDiskEjection:(id)_id; -(void)refreshControls:(id)sender; - (void) detectHardwareKeyboard:(id)_id ; - (void)setLoading:(NSNumber*)_nsvisible; diff --git a/Common.iphone/activegsAppDelegate.mm b/Common.iphone/activegsAppDelegate.mm index f11f1c9..0c12638 100644 --- a/Common.iphone/activegsAppDelegate.mm +++ b/Common.iphone/activegsAppDelegate.mm @@ -70,12 +70,14 @@ void x_notify_eject() @autoreleasepool { [[pManager getEmulatorView].kbdc performSelectorOnMainThread:@selector(animateDiskEjection:) withObject:nil waitUntilDone:NO]; } - } void x_set_video_fx(videofxenum _vfx) { - [pManager getEmulatorView].zv.crt.hidden = (_vfx==VIDEOFX_CRT?0:1); + @autoreleasepool { + [[pManager getEmulatorView] performSelectorOnMainThread:@selector(setVideoFx:) withObject:[NSNumber numberWithInt:_vfx] waitUntilDone:NO]; + } + } diff --git a/Common.iphone/activegsEmulatorController.h b/Common.iphone/activegsEmulatorController.h index 2efc766..1ddc5c1 100644 --- a/Common.iphone/activegsEmulatorController.h +++ b/Common.iphone/activegsEmulatorController.h @@ -69,6 +69,7 @@ enum attachMode #endif -(void) updateView; +-(void)setVideoFx: (NSNumber*)_vfxNumber; @property (nonatomic, strong) customView* contentView; @property (nonatomic, strong) zoomEmulatorView* zv; diff --git a/Common.iphone/activegsEmulatorController.mm b/Common.iphone/activegsEmulatorController.mm index dd423ab..a0f7cb0 100644 --- a/Common.iphone/activegsEmulatorController.mm +++ b/Common.iphone/activegsEmulatorController.mm @@ -672,10 +672,13 @@ int x_lock_zoom = 0; } - (void)dealloc { - - self.zv; self.zv = nil; +} +- (void)setVideoFx: (NSNumber*)_vfxNumber +{ + int vfx = [_vfxNumber intValue]; + self.zv.crt.hidden = (vfx==VIDEOFX_CRT?0:1); } @end