From 258ebfd6ea304b2dac955565cba465c7f69d0e70 Mon Sep 17 00:00:00 2001 From: rogerman Date: Mon, 27 Nov 2017 21:17:16 -0800 Subject: [PATCH] Cocoa Port: Synchronously force a framebuffer fetch on startup to guarantee that all display windows will appear black. --- desmume/src/frontend/cocoa/cocoa_GPU.h | 1 + desmume/src/frontend/cocoa/cocoa_GPU.mm | 7 +++++-- .../frontend/cocoa/userinterface/EmuControllerDelegate.mm | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/desmume/src/frontend/cocoa/cocoa_GPU.h b/desmume/src/frontend/cocoa/cocoa_GPU.h index 9a72c806a..fa3f7ad03 100644 --- a/desmume/src/frontend/cocoa/cocoa_GPU.h +++ b/desmume/src/frontend/cocoa/cocoa_GPU.h @@ -78,6 +78,7 @@ typedef std::map DisplayLinkFlushTimeLimitMap; - (void) displayLinkStartUsingID:(CGDirectDisplayID)displayID; - (void) displayLinkListUpdate; +- (void) fetchSynchronousAtIndex:(uint8_t)index; - (void) signalFetchAtIndex:(uint8_t)index; - (void) runFetchLoop; diff --git a/desmume/src/frontend/cocoa/cocoa_GPU.mm b/desmume/src/frontend/cocoa/cocoa_GPU.mm index 986e2ef96..662c592f2 100644 --- a/desmume/src/frontend/cocoa/cocoa_GPU.mm +++ b/desmume/src/frontend/cocoa/cocoa_GPU.mm @@ -196,8 +196,6 @@ public: GPU->SetWillAutoResolveToCustomBuffer(false); #endif - [self clearWithColor:0x8000]; - return self; } @@ -1197,6 +1195,11 @@ public: pthread_mutex_unlock(&_mutexDisplayLinkLists); } +- (void) fetchSynchronousAtIndex:(uint8_t)index +{ + GPUFetchObject->FetchFromBufferIndex(index); +} + - (void) signalFetchAtIndex:(uint8_t)index { pthread_mutex_lock(&_mutexFetchExecute); diff --git a/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm b/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm index 37338d167..697f52d71 100644 --- a/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm +++ b/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm @@ -2254,7 +2254,7 @@ [[cdsCore cdsGPU] setRender3DFragmentSamplingHack:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_FragmentSamplingHack"]]; [[cdsCore cdsGPU] setGpuScale:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_ScalingFactor"]]; [[cdsCore cdsGPU] setGpuColorFormat:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_ColorFormat"]]; - [[[cdsCore cdsGPU] sharedData] signalFetchAtIndex:0]; + [[[cdsCore cdsGPU] sharedData] fetchSynchronousAtIndex:0]; // Set the stylus options per user preferences. [[cdsCore cdsController] setStylusPressure:[[NSUserDefaults standardUserDefaults] integerForKey:@"Emulation_StylusPressure"]];