Merge branch 'master' into timing

This commit is contained in:
Lior Halphon 2018-03-02 19:45:15 +02:00
commit 487c063d48
2 changed files with 7 additions and 5 deletions

View File

@ -174,11 +174,11 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
- (void) vblank - (void) vblank
{ {
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
[self.view flip]; [self.view flip];
GB_set_pixels_output(&gb, self.view.pixels); GB_set_pixels_output(&gb, self.view.pixels);
if (self.vramWindow.isVisible) { if (self.vramWindow.isVisible) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
[self reloadVRAMData: nil]; [self reloadVRAMData: nil];
}); });
} }
@ -196,7 +196,6 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
self.audioClient = [[GBAudioClient alloc] initWithRendererBlock:^(UInt32 sampleRate, UInt32 nFrames, GB_sample_t *buffer) { self.audioClient = [[GBAudioClient alloc] initWithRendererBlock:^(UInt32 sampleRate, UInt32 nFrames, GB_sample_t *buffer) {
GB_apu_copy_buffer(&gb, buffer, nFrames); GB_apu_copy_buffer(&gb, buffer, nFrames);
} andSampleRate:96000]; } andSampleRate:96000];
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"Mute"]) { if (![[NSUserDefaults standardUserDefaults] boolForKey:@"Mute"]) {
[self.audioClient start]; [self.audioClient start];
} }
@ -225,6 +224,7 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
- (void) start - (void) start
{ {
if (running) return; if (running) return;
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
[[[NSThread alloc] initWithTarget:self selector:@selector(run) object:nil] start]; [[[NSThread alloc] initWithTarget:self selector:@selector(run) object:nil] start];
} }

View File

@ -166,7 +166,9 @@
GB_set_clock_multiplier(_gb, clockMultiplier); GB_set_clock_multiplier(_gb, clockMultiplier);
} }
current_buffer = (current_buffer + 1) % self.numberOfBuffers; current_buffer = (current_buffer + 1) % self.numberOfBuffers;
[self setNeedsDisplay:YES]; dispatch_async(dispatch_get_main_queue(), ^{
[self setNeedsDisplay:YES];
});
} }
- (uint32_t *) pixels - (uint32_t *) pixels
@ -204,7 +206,7 @@
} }
} }
if (!handled) { if (!handled && [theEvent type] != NSEventTypeFlagsChanged) {
[super keyDown:theEvent]; [super keyDown:theEvent];
} }
} }
@ -238,7 +240,7 @@
} }
} }
if (!handled) { if (!handled && [theEvent type] != NSEventTypeFlagsChanged) {
[super keyUp:theEvent]; [super keyUp:theEvent];
} }
} }