Cocoa Port:

- Oops! Missed some files that should've been committed in r5083. (Regression from r5083.)
This commit is contained in:
rogerman 2015-01-21 02:15:38 +00:00
parent d880c58f75
commit 81772f1906
4 changed files with 24 additions and 44 deletions

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013 DeSmuME team Copyright (C) 2013-2015 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -65,8 +65,6 @@ class OGLVideoOutput;
- (NSPoint) convertPointToDS:(NSPoint)clickLoc; - (NSPoint) convertPointToDS:(NSPoint)clickLoc;
- (BOOL) handleKeyPress:(NSEvent *)theEvent keyPressed:(BOOL)keyPressed; - (BOOL) handleKeyPress:(NSEvent *)theEvent keyPressed:(BOOL)keyPressed;
- (BOOL) handleMouseButton:(NSEvent *)theEvent buttonPressed:(BOOL)buttonPressed; - (BOOL) handleMouseButton:(NSEvent *)theEvent buttonPressed:(BOOL)buttonPressed;
- (void) clearToBlack;
- (void) clearToWhite;
- (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType; - (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType;
@end @end

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2014 DeSmuME team Copyright (C) 2013-2015 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -1079,6 +1079,9 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
cdsVideoOutput = [[CocoaDSDisplayVideo alloc] init]; cdsVideoOutput = [[CocoaDSDisplayVideo alloc] init];
[cdsVideoOutput setDelegate:view]; [cdsVideoOutput setDelegate:view];
// Add the video thread to the output list.
[emuControl addOutputToCore:cdsVideoOutput];
[NSThread detachNewThreadSelector:@selector(runThread:) toTarget:cdsVideoOutput withObject:nil]; [NSThread detachNewThreadSelector:@selector(runThread:) toTarget:cdsVideoOutput withObject:nil];
while ([cdsVideoOutput thread] == nil) while ([cdsVideoOutput thread] == nil)
{ {
@ -1087,9 +1090,6 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
// Setup default values per user preferences. // Setup default values per user preferences.
[self setupUserDefaults]; [self setupUserDefaults];
// Add the video thread to the output list.
[emuControl addOutputToCore:cdsVideoOutput];
} }
- (void)windowDidBecomeMain:(NSNotification *)notification - (void)windowDidBecomeMain:(NSNotification *)notification
@ -1598,18 +1598,6 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
return isHandled; return isHandled;
} }
- (void) clearToBlack
{
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
[CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_SET_VIEW_TO_BLACK];
}
- (void) clearToWhite
{
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
[CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_SET_VIEW_TO_WHITE];
}
- (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType - (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType
{ {
NSString *fileURLString = [fileURL absoluteString]; NSString *fileURLString = [fileURL absoluteString];
@ -1771,7 +1759,7 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
// No init needed, so do nothing. // No init needed, so do nothing.
} }
- (void)doProcessVideoFrame:(const void *)videoFrameData displayMode:(const NSInteger)frameDisplayMode width:(const NSInteger)frameWidth height:(const NSInteger)frameHeight - (void)doLoadVideoFrame:(const void *)videoFrameData displayMode:(const NSInteger)frameDisplayMode width:(const NSInteger)frameWidth height:(const NSInteger)frameHeight
{ {
OGLDisplayLayer *display = oglv->GetDisplayLayer(); OGLDisplayLayer *display = oglv->GetDisplayLayer();
@ -1782,7 +1770,15 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
CGLLockContext(cglDisplayContext); CGLLockContext(cglDisplayContext);
CGLSetCurrentContext(cglDisplayContext); CGLSetCurrentContext(cglDisplayContext);
oglv->ProcessOGL((uint16_t *)videoFrameData, frameWidth, frameHeight); display->LoadFrameOGL((uint16_t *)videoFrameData, frameWidth, frameHeight);
CGLUnlockContext(cglDisplayContext);
}
- (void)doProcessVideoFrame
{
CGLLockContext(cglDisplayContext);
CGLSetCurrentContext(cglDisplayContext);
oglv->ProcessOGL();
[self drawVideoFrame]; [self drawVideoFrame];
CGLUnlockContext(cglDisplayContext); CGLUnlockContext(cglDisplayContext);
} }

View File

@ -314,14 +314,7 @@
{ {
DisplayWindowController *newWindowController = [[DisplayWindowController alloc] initWithWindowNibName:@"DisplayWindow" emuControlDelegate:self]; DisplayWindowController *newWindowController = [[DisplayWindowController alloc] initWithWindowNibName:@"DisplayWindow" emuControlDelegate:self];
if ([self currentRom] == nil) [CocoaDSUtil messageSendOneWay:[[newWindowController cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
{
[[newWindowController view] clearToBlack];
}
else
{
[[newWindowController view] setNeedsDisplay:YES];
}
[[newWindowController window] makeKeyAndOrderFront:self]; [[newWindowController window] makeKeyAndOrderFront:self];
[[newWindowController window] makeMainWindow]; [[newWindowController window] makeMainWindow];
@ -1441,12 +1434,10 @@
} }
[cdsCore reset]; [cdsCore reset];
if ([cdsCore coreState] == CORESTATE_PAUSE)
for (DisplayWindowController *windowController in windowList)
{ {
for (DisplayWindowController *windowController in windowList) [CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
{
[[windowController view] clearToWhite];
}
} }
[self setStatusText:NSSTRING_STATUS_EMULATOR_RESET]; [self setStatusText:NSSTRING_STATUS_EMULATOR_RESET];
@ -1747,9 +1738,10 @@
// Update the UI to indicate that a ROM has indeed been loaded. // Update the UI to indicate that a ROM has indeed been loaded.
[self updateAllWindowTitles]; [self updateAllWindowTitles];
GPU_FillScreenWithBGRA5551(0xFFFF);
for (DisplayWindowController *windowController in windowList) for (DisplayWindowController *windowController in windowList)
{ {
[[windowController view] clearToWhite]; [CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
} }
[self setStatusText:NSSTRING_STATUS_ROM_LOADED]; [self setStatusText:NSSTRING_STATUS_ROM_LOADED];
@ -1824,9 +1816,10 @@
// Update the UI to indicate that the ROM has finished unloading. // Update the UI to indicate that the ROM has finished unloading.
[self updateAllWindowTitles]; [self updateAllWindowTitles];
GPU_FillScreenWithBGRA5551(0x8000);
for (DisplayWindowController *windowController in windowList) for (DisplayWindowController *windowController in windowList)
{ {
[[windowController view] clearToBlack]; [CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
} }
[self setStatusText:NSSTRING_STATUS_ROM_UNLOADED]; [self setStatusText:NSSTRING_STATUS_ROM_UNLOADED];

View File

@ -683,14 +683,7 @@
} }
// Draw the display view now so that we guarantee that its drawn at least once. // Draw the display view now so that we guarantee that its drawn at least once.
if ([emuControl currentRom] == nil) [CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
{
[[windowController view] clearToBlack];
}
else
{
[[windowController view] setNeedsDisplay:YES];
}
// If this window is set to full screen mode, its associated screen index must // If this window is set to full screen mode, its associated screen index must
// exist. If not, this window will not enter full screen mode. This is necessary, // exist. If not, this window will not enter full screen mode. This is necessary,