diff --git a/desmume/src/frontend/cocoa/DeSmuME (Latest).xcodeproj/project.pbxproj b/desmume/src/frontend/cocoa/DeSmuME (Latest).xcodeproj/project.pbxproj index fe823a416..e0f27d053 100644 --- a/desmume/src/frontend/cocoa/DeSmuME (Latest).xcodeproj/project.pbxproj +++ b/desmume/src/frontend/cocoa/DeSmuME (Latest).xcodeproj/project.pbxproj @@ -140,6 +140,12 @@ AB3BF4021E22FE01003E2B24 /* MacOGLDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3BF4011E22FE01003E2B24 /* MacOGLDisplayView.mm */; }; AB3BF4031E22FE01003E2B24 /* MacOGLDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3BF4011E22FE01003E2B24 /* MacOGLDisplayView.mm */; }; AB3BF4041E22FE01003E2B24 /* MacOGLDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3BF4011E22FE01003E2B24 /* MacOGLDisplayView.mm */; }; + AB3BF4331E2562F2003E2B24 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4321E2562F2003E2B24 /* QuartzCore.framework */; }; + AB3BF4341E256309003E2B24 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4321E2562F2003E2B24 /* QuartzCore.framework */; }; + AB3BF4351E256309003E2B24 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4321E2562F2003E2B24 /* QuartzCore.framework */; }; + AB3BF4381E25D9AE003E2B24 /* DisplayViewCALayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3BF4371E25D9AE003E2B24 /* DisplayViewCALayer.mm */; }; + AB3BF4391E25D9AE003E2B24 /* DisplayViewCALayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3BF4371E25D9AE003E2B24 /* DisplayViewCALayer.mm */; }; + AB3BF43A1E25D9AE003E2B24 /* DisplayViewCALayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3BF4371E25D9AE003E2B24 /* DisplayViewCALayer.mm */; }; AB3E34C9134AF4500056477A /* cocoa_output.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E34C8134AF4500056477A /* cocoa_output.mm */; }; AB40562A169F5DBB0016AC3E /* assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB405600169F5DBB0016AC3E /* assembler.cpp */; }; AB40562B169F5DBB0016AC3E /* assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB405600169F5DBB0016AC3E /* assembler.cpp */; }; @@ -1352,6 +1358,9 @@ AB3ACC3D14C24D5400D7D192 /* README.MAC */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.MAC; path = ../../../README.MAC; sourceTree = SOURCE_ROOT; }; AB3BF4011E22FE01003E2B24 /* MacOGLDisplayView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MacOGLDisplayView.mm; sourceTree = ""; }; AB3BF4051E22FEA8003E2B24 /* MacOGLDisplayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MacOGLDisplayView.h; sourceTree = ""; }; + AB3BF4321E2562F2003E2B24 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + AB3BF4361E25D6B4003E2B24 /* DisplayViewCALayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayViewCALayer.h; sourceTree = ""; }; + AB3BF4371E25D9AE003E2B24 /* DisplayViewCALayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayViewCALayer.mm; sourceTree = ""; }; AB3E34C7134AF4500056477A /* cocoa_output.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_output.h; sourceTree = ""; }; AB3E34C8134AF4500056477A /* cocoa_output.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_output.mm; sourceTree = ""; }; AB4055ED169F59380016AC3E /* AsmJit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsmJit.h; sourceTree = ""; }; @@ -1894,6 +1903,7 @@ ABC572101344347000E7B0B1 /* Foundation.framework in Frameworks */, AB350BA51478AC96007165AC /* IOKit.framework in Frameworks */, ABC570D5134431DA00E7B0B1 /* OpenGL.framework in Frameworks */, + AB3BF4341E256309003E2B24 /* QuartzCore.framework in Frameworks */, AB4676F314AB12D60002FF94 /* libz.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1913,6 +1923,7 @@ AB796D6915CDCBA200C59155 /* Foundation.framework in Frameworks */, AB796D6A15CDCBA200C59155 /* IOKit.framework in Frameworks */, AB796D6B15CDCBA200C59155 /* OpenGL.framework in Frameworks */, + AB3BF4331E2562F2003E2B24 /* QuartzCore.framework in Frameworks */, AB796D6C15CDCBA200C59155 /* libz.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1932,6 +1943,7 @@ AB8F3D261A53AC2600A80BF6 /* Foundation.framework in Frameworks */, AB8F3D271A53AC2600A80BF6 /* IOKit.framework in Frameworks */, AB8F3D281A53AC2600A80BF6 /* OpenGL.framework in Frameworks */, + AB3BF4351E256309003E2B24 /* QuartzCore.framework in Frameworks */, AB8F3D291A53AC2600A80BF6 /* libz.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2021,6 +2033,7 @@ 29B97325FDCFA39411CA2CEA /* Foundation.framework */, AB350BA41478AC96007165AC /* IOKit.framework */, ABC570D4134431DA00E7B0B1 /* OpenGL.framework */, + AB3BF4321E2562F2003E2B24 /* QuartzCore.framework */, AB0A0D1914AACA9600E83E91 /* libz.dylib */, ); name = "Linked Frameworks"; @@ -2369,6 +2382,7 @@ children = ( AB3ACB6614C2361100D7D192 /* appDelegate.h */, AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */, + AB3BF4361E25D6B4003E2B24 /* DisplayViewCALayer.h */, AB8967D716D2ED0700F826F1 /* DisplayWindowController.h */, AB3A655C16CC5416001F5D4A /* EmuControllerDelegate.h */, ABD42045172319D1006A9B46 /* FileMigrationDelegate.h */, @@ -2382,6 +2396,7 @@ ABF2B9F81690412A000FF7C0 /* troubleshootingWindowDelegate.h */, AB3ACB6714C2361100D7D192 /* appDelegate.mm */, AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */, + AB3BF4371E25D9AE003E2B24 /* DisplayViewCALayer.mm */, AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */, AB3A655D16CC5421001F5D4A /* EmuControllerDelegate.mm */, ABD42046172319D1006A9B46 /* FileMigrationDelegate.mm */, @@ -3762,6 +3777,7 @@ ABD1FEE01345AC8400AF11D1 /* firmware.cpp in Sources */, AB2ABA3D1C9F9CFA00173B15 /* async_job.c in Sources */, ABD1FEE31345AC8400AF11D1 /* gfx3d.cpp in Sources */, + AB3BF43A1E25D9AE003E2B24 /* DisplayViewCALayer.mm in Sources */, ABD1FEE61345AC8400AF11D1 /* GPU.cpp in Sources */, ABD1FF5A1345ACBF00AF11D1 /* guid.cpp in Sources */, ABD1FF571345ACBF00AF11D1 /* header.cpp in Sources */, @@ -3970,6 +3986,7 @@ AB796D0115CDCBA200C59155 /* dlditool.cpp in Sources */, AB796D0215CDCBA200C59155 /* driver.cpp in Sources */, AB796D0315CDCBA200C59155 /* emufat.cpp in Sources */, + AB3BF4381E25D9AE003E2B24 /* DisplayViewCALayer.mm in Sources */, AB564904186E6EBC002740F4 /* Slot2WindowDelegate.mm in Sources */, AB9038B217C5ED2200F410BD /* slot1_retail_mcrom.cpp in Sources */, AB796D0415CDCBA200C59155 /* emufile.cpp in Sources */, @@ -4202,6 +4219,7 @@ ABAF0A431A96E67200B95B75 /* RomInfoPanel.mm in Sources */, AB2ABA3C1C9F9CFA00173B15 /* async_job.c in Sources */, AB8F3C851A53AC2600A80BF6 /* disc.cpp in Sources */, + AB3BF4391E25D9AE003E2B24 /* DisplayViewCALayer.mm in Sources */, AB8F3C861A53AC2600A80BF6 /* dlditool.cpp in Sources */, AB8F3C871A53AC2600A80BF6 /* driver.cpp in Sources */, AB8F3C881A53AC2600A80BF6 /* emufat.cpp in Sources */, diff --git a/desmume/src/frontend/cocoa/DeSmuME (XCode 3).xcodeproj/project.pbxproj b/desmume/src/frontend/cocoa/DeSmuME (XCode 3).xcodeproj/project.pbxproj index 324ccf3a8..4aff9a4a0 100644 --- a/desmume/src/frontend/cocoa/DeSmuME (XCode 3).xcodeproj/project.pbxproj +++ b/desmume/src/frontend/cocoa/DeSmuME (XCode 3).xcodeproj/project.pbxproj @@ -762,6 +762,16 @@ AB3E69121E231E9900D4CC75 /* MacOGLDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E690F1E231E9900D4CC75 /* MacOGLDisplayView.mm */; }; AB3E69131E231E9900D4CC75 /* MacOGLDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E690F1E231E9900D4CC75 /* MacOGLDisplayView.mm */; }; AB3E69141E231E9900D4CC75 /* MacOGLDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E690F1E231E9900D4CC75 /* MacOGLDisplayView.mm */; }; + AB3E69451E25FB8400D4CC75 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3E69441E25FB8400D4CC75 /* QuartzCore.framework */; }; + AB3E697D1E25FB9600D4CC75 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3E69441E25FB8400D4CC75 /* QuartzCore.framework */; }; + AB3E697E1E25FB9700D4CC75 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3E69441E25FB8400D4CC75 /* QuartzCore.framework */; }; + AB3E697F1E25FB9700D4CC75 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3E69441E25FB8400D4CC75 /* QuartzCore.framework */; }; + AB3E69801E25FB9800D4CC75 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3E69441E25FB8400D4CC75 /* QuartzCore.framework */; }; + AB3E69831E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */; }; + AB3E69841E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */; }; + AB3E69851E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */; }; + AB3E69861E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */; }; + AB3E69871E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */; }; AB43527217D5BA5E007417C8 /* slot1_retail_mcrom_debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB43527117D5BA5E007417C8 /* slot1_retail_mcrom_debug.cpp */; }; AB43527317D5BA5E007417C8 /* slot1_retail_mcrom_debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB43527117D5BA5E007417C8 /* slot1_retail_mcrom_debug.cpp */; }; AB43527417D5BA5E007417C8 /* slot1_retail_mcrom_debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB43527117D5BA5E007417C8 /* slot1_retail_mcrom_debug.cpp */; }; @@ -1881,6 +1891,9 @@ AB3E34C8134AF4500056477A /* cocoa_output.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_output.mm; sourceTree = ""; }; AB3E690E1E231E9900D4CC75 /* MacOGLDisplayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOGLDisplayView.h; sourceTree = ""; }; AB3E690F1E231E9900D4CC75 /* MacOGLDisplayView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MacOGLDisplayView.mm; sourceTree = ""; }; + AB3E69441E25FB8400D4CC75 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + AB3E69811E25FBBF00D4CC75 /* DisplayViewCALayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayViewCALayer.h; sourceTree = ""; }; + AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayViewCALayer.mm; sourceTree = ""; }; AB43527117D5BA5E007417C8 /* slot1_retail_mcrom_debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slot1_retail_mcrom_debug.cpp; sourceTree = ""; }; AB43528517D5BA95007417C8 /* fsnitro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fsnitro.h; sourceTree = ""; }; AB43528617D5BA95007417C8 /* fsnitro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fsnitro.cpp; sourceTree = ""; }; @@ -2271,6 +2284,7 @@ AB2A9A741725F00F0062C1A1 /* libz.dylib in Frameworks */, AB2A9A731725F00F0062C1A1 /* OpenGL.framework in Frameworks */, AB1CC8001AA509C2008B0A16 /* CoreAudio.framework in Frameworks */, + AB3E69801E25FB9800D4CC75 /* QuartzCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2290,6 +2304,7 @@ AB2F3C4115CF9C6000858373 /* libz.dylib in Frameworks */, AB2F3C4015CF9C6000858373 /* OpenGL.framework in Frameworks */, AB1CC80A1AA509DF008B0A16 /* CoreAudio.framework in Frameworks */, + AB3E697F1E25FB9700D4CC75 /* QuartzCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2309,6 +2324,7 @@ ABC3AFCF14B8D16700D5B13D /* libz.dylib in Frameworks */, AB711F761481C35F009011C8 /* OpenGL.framework in Frameworks */, AB1CC80D1AA509E1008B0A16 /* CoreAudio.framework in Frameworks */, + AB3E69451E25FB8400D4CC75 /* QuartzCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2328,6 +2344,7 @@ AB73AA2F1507C9F500A310C8 /* libz.dylib in Frameworks */, AB73AA2E1507C9F500A310C8 /* OpenGL.framework in Frameworks */, AB1CC80C1AA509E0008B0A16 /* CoreAudio.framework in Frameworks */, + AB3E697D1E25FB9600D4CC75 /* QuartzCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2347,6 +2364,7 @@ ABAD104515ACE7A00000EC47 /* libz.dylib in Frameworks */, ABAD104415ACE7A00000EC47 /* OpenGL.framework in Frameworks */, AB1CC80B1AA509E0008B0A16 /* CoreAudio.framework in Frameworks */, + AB3E697E1E25FB9700D4CC75 /* QuartzCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2414,6 +2432,7 @@ 29B97325FDCFA39411CA2CEA /* Foundation.framework */, AB350BA41478AC96007165AC /* IOKit.framework */, ABC570D4134431DA00E7B0B1 /* OpenGL.framework */, + AB3E69441E25FB8400D4CC75 /* QuartzCore.framework */, AB0A0D1914AACA9600E83E91 /* libz.dylib */, ); name = "Linked Frameworks"; @@ -2948,6 +2967,7 @@ children = ( AB3ACB6614C2361100D7D192 /* appDelegate.h */, AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */, + AB3E69811E25FBBF00D4CC75 /* DisplayViewCALayer.h */, AB700DDC16CDE4C300FBD336 /* DisplayWindowController.h */, AB6A187A16C9951C00384EED /* EmuControllerDelegate.h */, ABAAFBE8172122B6005DDDBE /* FileMigrationDelegate.h */, @@ -2961,6 +2981,7 @@ ABA0356E169127BB00817C69 /* troubleshootingWindowDelegate.h */, AB3ACB6714C2361100D7D192 /* appDelegate.mm */, AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */, + AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */, AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */, AB6A187B16C9951C00384EED /* EmuControllerDelegate.mm */, ABAAFBE9172122B6005DDDBE /* FileMigrationDelegate.mm */, @@ -4549,6 +4570,7 @@ AB2C25081DEBFBD400706BFC /* encoding_utf.c in Sources */, AB0F13931E1B7C320075684F /* ClientDisplayView.cpp in Sources */, AB3E69111E231E9900D4CC75 /* MacOGLDisplayView.mm in Sources */, + AB3E69841E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4732,6 +4754,7 @@ AB2C25091DEBFBD400706BFC /* encoding_utf.c in Sources */, AB0F13941E1B7C320075684F /* ClientDisplayView.cpp in Sources */, AB3E69121E231E9900D4CC75 /* MacOGLDisplayView.mm in Sources */, + AB3E69851E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4945,6 +4968,7 @@ AB2C25071DEBFBD400706BFC /* encoding_utf.c in Sources */, AB0F13921E1B7C320075684F /* ClientDisplayView.cpp in Sources */, AB3E69101E231E9900D4CC75 /* MacOGLDisplayView.mm in Sources */, + AB3E69831E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5158,6 +5182,7 @@ AB2C250B1DEBFBD400706BFC /* encoding_utf.c in Sources */, AB0F13961E1B7C320075684F /* ClientDisplayView.cpp in Sources */, AB3E69141E231E9900D4CC75 /* MacOGLDisplayView.mm in Sources */, + AB3E69871E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5341,6 +5366,7 @@ AB2C250A1DEBFBD400706BFC /* encoding_utf.c in Sources */, AB0F13951E1B7C320075684F /* ClientDisplayView.cpp in Sources */, AB3E69131E231E9900D4CC75 /* MacOGLDisplayView.mm in Sources */, + AB3E69861E25FBBF00D4CC75 /* DisplayViewCALayer.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp b/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp index df3aacf7d..411c408d2 100644 --- a/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp +++ b/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp @@ -5010,7 +5010,6 @@ void OGLVideoOutput::Init() // Set up clear attributes glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); } void OGLVideoOutput::SetOutputFilter(const OutputFilterTypeID filterID) diff --git a/desmume/src/frontend/cocoa/cocoa_output.h b/desmume/src/frontend/cocoa/cocoa_output.h index 9abc3271d..214c3dcc4 100644 --- a/desmume/src/frontend/cocoa/cocoa_output.h +++ b/desmume/src/frontend/cocoa/cocoa_output.h @@ -161,9 +161,9 @@ struct NDSFrameInfo; @property (assign) NSInteger pixelScaler; - (void) handleReceiveGPUFrame; -- (void) handleRedrawView; -- (void) handleReloadAndRedraw; -- (void) handleReprocessAndRedraw; +- (void) handleReloadReprocessRedraw; +- (void) handleReprocessRedraw; +- (void) handleRedraw; - (void) resetVideoBuffers; - (void) setScaleFactor:(float)theScaleFactor; diff --git a/desmume/src/frontend/cocoa/cocoa_output.mm b/desmume/src/frontend/cocoa/cocoa_output.mm index 6b157233f..0a9d272c4 100644 --- a/desmume/src/frontend/cocoa/cocoa_output.mm +++ b/desmume/src/frontend/cocoa/cocoa_output.mm @@ -549,7 +549,7 @@ _intermediateViewProps = viewProps; OSSpinLockUnlock(&spinlockViewProperties); - [CocoaDSUtil messageSendOneWay:[self receivePort] msgID:MESSAGE_CHANGE_VIEW_PROPERTIES]; + [self handleChangeViewProperties]; } - (NSSize) displaySize @@ -995,15 +995,15 @@ switch (message) { case MESSAGE_RELOAD_REPROCESS_REDRAW: - [self handleReloadAndRedraw]; + [self handleReloadReprocessRedraw]; break; case MESSAGE_REPROCESS_AND_REDRAW: - [self handleReprocessAndRedraw]; + [self handleReprocessRedraw]; break; case MESSAGE_REDRAW_VIEW: - [self handleRedrawView]; + [self handleRedraw]; break; default: @@ -1073,22 +1073,22 @@ _cdv->HandleGPUFrameEndEvent(isMainSizeNative, isTouchSizeNative); } -- (void) handleRedrawView -{ - _cdv->UpdateView(); -} - -- (void) handleReloadAndRedraw +- (void) handleReloadReprocessRedraw { [self handleReceiveGPUFrame]; [self handleEmuFrameProcessed]; } -- (void) handleReprocessAndRedraw +- (void) handleReprocessRedraw { [self handleEmuFrameProcessed]; } +- (void) handleRedraw +{ + _cdv->UpdateView(); +} + - (void) resetVideoBuffers { const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo(); diff --git a/desmume/src/frontend/cocoa/userinterface/DisplayViewCALayer.h b/desmume/src/frontend/cocoa/userinterface/DisplayViewCALayer.h new file mode 100644 index 000000000..59639c68d --- /dev/null +++ b/desmume/src/frontend/cocoa/userinterface/DisplayViewCALayer.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2017 DeSmuME team + + 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 + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the this software. If not, see . + */ + +#ifndef _DISPLAYVIEWCALAYER_H +#define _DISPLAYVIEWCALAYER_H + +#import +#import + +class ClientDisplay3DView; + +@protocol DisplayViewCALayer + +@required +- (ClientDisplay3DView *) clientDisplay3DView; + +@end + +class DisplayViewCALayerInterface +{ +private: + CALayer *_frontendLayer; + +public: + DisplayViewCALayerInterface(); + + CALayer* GetFrontendLayer() const; + void SetFrontendLayer(CALayer *layer); + void CALayerDisplay(); +}; + +#endif // _DISPLAYVIEWCALAYER_H diff --git a/desmume/src/frontend/cocoa/userinterface/DisplayViewCALayer.mm b/desmume/src/frontend/cocoa/userinterface/DisplayViewCALayer.mm new file mode 100644 index 000000000..709236e0c --- /dev/null +++ b/desmume/src/frontend/cocoa/userinterface/DisplayViewCALayer.mm @@ -0,0 +1,38 @@ +/* + Copyright (C) 2017 DeSmuME team + + 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 + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the this software. If not, see . + */ + +#import "DisplayViewCALayer.h" + +DisplayViewCALayerInterface::DisplayViewCALayerInterface() +{ + _frontendLayer = nil; +} + +CALayer* DisplayViewCALayerInterface::GetFrontendLayer() const +{ + return this->_frontendLayer; +} + +void DisplayViewCALayerInterface::SetFrontendLayer(CALayer *layer) +{ + this->_frontendLayer = layer; +} + +void DisplayViewCALayerInterface::CALayerDisplay() +{ + [this->_frontendLayer setNeedsDisplay]; +} diff --git a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.h b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.h index 92e0c1095..bd6686139 100644 --- a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.h +++ b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.h @@ -39,9 +39,7 @@ class OGLVideoOutput; { InputManager *inputManager; CocoaDSDisplayVideo *cdsVideoOutput; - ClientDisplay3DView *_cdv; - - NSOpenGLContext *localContext; + CALayer *localLayer; } @property (retain) InputManager *inputManager; @@ -61,7 +59,6 @@ class OGLVideoOutput; @property (assign) NSInteger outputFilter; @property (assign) NSInteger pixelScaler; -- (void) initContext; - (BOOL) handleKeyPress:(NSEvent *)theEvent keyPressed:(BOOL)keyPressed; - (BOOL) handleMouseButton:(NSEvent *)theEvent buttonPressed:(BOOL)buttonPressed; - (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType; diff --git a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm index 6c68d73ff..06181fcaa 100644 --- a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm +++ b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm @@ -1264,7 +1264,6 @@ static std::unordered_map _screenMap; // [[emuControl windowList] addObject:self]; [emuControl updateAllWindowTitles]; - [view initContext]; [view setInputManager:[emuControl inputManager]]; // Set up the scaling factor if this is a Retina window @@ -1610,8 +1609,15 @@ static std::unordered_map _screenMap; // inputManager = nil; cdsVideoOutput = nil; - _cdv = new MacOGLDisplayView(); - localContext = [[NSOpenGLContext alloc] initWithCGLContextObj:((MacOGLDisplayView *)_cdv)->GetContext()]; + localLayer = [[DisplayViewOpenGLLayer alloc] init]; + + ClientDisplay3DView *cdv = [(id)localLayer clientDisplay3DView]; + NSString *fontPath = [[NSBundle mainBundle] pathForResource:@"SourceSansPro-Bold" ofType:@"otf"]; + cdv->SetHUDFontUsingPath([fontPath cStringUsingEncoding:NSUTF8StringEncoding]); + + [self setLayer:localLayer]; + [self setWantsLayer:YES]; + [self setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawNever]; return self; } @@ -1620,10 +1626,9 @@ static std::unordered_map _screenMap; // { [self setInputManager:nil]; [self setCdsVideoOutput:nil]; - [localContext clearDrawable]; - [localContext release]; + [self setLayer:nil]; - delete _cdv; + [localLayer release]; [super dealloc]; } @@ -1632,7 +1637,7 @@ static std::unordered_map _screenMap; // - (ClientDisplay3DView *) clientDisplay3DView { - return _cdv; + return [(id)localLayer clientDisplay3DView]; } - (BOOL) canUseShaderBasedFilters @@ -1760,16 +1765,6 @@ static std::unordered_map _screenMap; // return [[self cdsVideoOutput] pixelScaler]; } -#pragma mark Class Methods -- (void) initContext -{ - [localContext setView:self]; - _cdv->Init(); - - NSString *fontPath = [[NSBundle mainBundle] pathForResource:@"SourceSansPro-Bold" ofType:@"otf"]; - _cdv->SetHUDFontUsingPath([fontPath cStringUsingEncoding:NSUTF8StringEncoding]); -} - #pragma mark InputHIDManagerTarget Protocol - (BOOL) handleHIDQueue:(IOHIDQueueRef)hidQueue hidManager:(InputHIDManager *)hidManager { @@ -1835,7 +1830,8 @@ static std::unordered_map _screenMap; // { BOOL isHandled = NO; DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; - const ClientDisplayMode displayMode = _cdv->GetMode(); + ClientDisplayView *cdv = [(id)localLayer clientDisplay3DView]; + const ClientDisplayMode displayMode = cdv->GetMode(); // Convert the clicked location from window coordinates, to view coordinates, // and finally to DS touchscreen coordinates. @@ -1850,7 +1846,7 @@ static std::unordered_map _screenMap; // // Convert the clicked location from window coordinates, to view coordinates, and finally to NDS touchscreen coordinates. const NSPoint clientLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil]; - _cdv->GetNDSPoint((int)buttonNumber, isInitialMouseDown, clientLoc.x, clientLoc.y, x, y); + cdv->GetNDSPoint((int)buttonNumber, isInitialMouseDown, clientLoc.x, clientLoc.y, x, y); } const InputAttributes inputAttr = InputManagerEncodeMouseButtonInput(buttonNumber, NSMakePoint(x, y), buttonPressed); @@ -1890,19 +1886,21 @@ static std::unordered_map _screenMap; // return NO; } -- (void)lockFocus +- (BOOL)wantsUpdateLayer { - [super lockFocus]; - - if ([localContext view] != self) - { - [localContext setView:self]; - } + return YES; +} + +- (void)updateLayer +{ + ClientDisplay3DView *cdv = [(id)localLayer clientDisplay3DView]; + cdv->UpdateView(); } - (void)drawRect:(NSRect)dirtyRect { - [CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_REDRAW_VIEW]; + ClientDisplay3DView *cdv = [(id)localLayer clientDisplay3DView]; + cdv->UpdateView(); } - (void)setFrame:(NSRect)rect @@ -1912,7 +1910,6 @@ static std::unordered_map _screenMap; // if (rect.size.width != oldFrame.size.width || rect.size.height != oldFrame.size.height) { - [localContext update]; DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; #if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) diff --git a/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.h b/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.h index 1c6040cb2..b495fbb85 100644 --- a/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.h +++ b/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.h @@ -21,15 +21,28 @@ #import #import +#import "DisplayViewCALayer.h" + #ifdef MAC_OS_X_VERSION_10_7 #include "../OGLDisplayOutput_3_2.h" #else #include "../OGLDisplayOutput.h" #endif -class MacOGLDisplayView : public OGLVideoOutput +#undef BOOL + +class MacOGLDisplayView; + +@interface DisplayViewOpenGLLayer : CAOpenGLLayer +{ + MacOGLDisplayView *_cdv; +} +@end + +class MacOGLDisplayView : public OGLVideoOutput, public DisplayViewCALayerInterface { protected: + CGLPixelFormatObj _pixelFormat; CGLContextObj _context; void _FrameRenderAndFlush(); @@ -40,9 +53,9 @@ public: virtual void Init(); + CGLPixelFormatObj GetPixelFormat() const; CGLContextObj GetContext() const; - void SetContext(CGLContextObj context); - + virtual void SetHUDFontUsingPath(const char *filePath); virtual void SetVideoBuffers(const uint32_t colorFormat, diff --git a/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.mm b/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.mm index 45916b766..2981aeaf2 100644 --- a/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.mm +++ b/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.mm @@ -18,8 +18,69 @@ #include "MacOGLDisplayView.h" #include "../utilities.h" +@implementation DisplayViewOpenGLLayer + +- (id)init +{ + self = [super init]; + if(self == nil) + { + return nil; + } + + _cdv = new MacOGLDisplayView(); + _cdv->SetFrontendLayer(self); + _cdv->Init(); + + [self setAsynchronous:NO]; + [self setOpaque:YES]; + + return self; +} + +- (void)dealloc +{ + delete _cdv; + + [super dealloc]; +} + +- (OGLContextInfo *) contextInfo +{ + return _cdv->GetContextInfo(); +} + +- (ClientDisplay3DView *)clientDisplay3DView +{ + return _cdv; +} + +- (BOOL)isAsynchronous +{ + return NO; +} + +- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask +{ + return _cdv->GetPixelFormat(); +} + +- (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat +{ + return _cdv->GetContext(); +} + +- (void)drawInCGLContext:(CGLContextObj)glContext pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp +{ + _cdv->FrameRender(); + [super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:timeInterval displayTime:timeStamp]; +} + +@end + void MacOGLDisplayView::operator delete(void *ptr) { + CGLPixelFormatObj pixelFormat = ((MacOGLDisplayView *)ptr)->GetPixelFormat(); CGLContextObj context = ((MacOGLDisplayView *)ptr)->GetContext(); OGLContextInfo *contextInfo = ((MacOGLDisplayView *)ptr)->GetContextInfo(); @@ -32,6 +93,7 @@ void MacOGLDisplayView::operator delete(void *ptr) delete contextInfo; CGLReleaseContext(context); + CGLReleasePixelFormat(pixelFormat); } } @@ -46,7 +108,8 @@ MacOGLDisplayView::MacOGLDisplayView() kCGLPFAStencilSize, (CGLPixelFormatAttribute)0, kCGLPFADoubleBuffer, (CGLPixelFormatAttribute)0, (CGLPixelFormatAttribute)0, - (CGLPixelFormatAttribute)0 }; + (CGLPixelFormatAttribute)0 + }; #ifdef _OGLDISPLAYOUTPUT_3_2_H_ // If we can support a 3.2 Core Profile context, then request that in our @@ -59,35 +122,33 @@ MacOGLDisplayView::MacOGLDisplayView() } #endif - CGLPixelFormatObj cglPixFormat = NULL; GLint virtualScreenCount = 0; - CGLChoosePixelFormat(attributes, &cglPixFormat, &virtualScreenCount); + CGLChoosePixelFormat(attributes, &_pixelFormat, &virtualScreenCount); - if (cglPixFormat == NULL) + if (_pixelFormat == NULL) { // If we can't get a 3.2 Core Profile context, then switch to using a // legacy context instead. useContext_3_2 = false; attributes[9] = (CGLPixelFormatAttribute)0; attributes[10] = (CGLPixelFormatAttribute)0; - CGLChoosePixelFormat(attributes, &cglPixFormat, &virtualScreenCount); + CGLChoosePixelFormat(attributes, &_pixelFormat, &virtualScreenCount); } - CGLCreateContext(cglPixFormat, NULL, &this->_context); - CGLReleasePixelFormat(cglPixFormat); + CGLCreateContext(_pixelFormat, NULL, &_context); CGLContextObj prevContext = CGLGetCurrentContext(); - CGLSetCurrentContext(this->_context); + CGLSetCurrentContext(_context); #ifdef _OGLDISPLAYOUTPUT_3_2_H_ if (useContext_3_2) { - this->_contextInfo = new OGLContextInfo_3_2; + _contextInfo = new OGLContextInfo_3_2; } else #endif { - this->_contextInfo = new OGLContextInfo_Legacy; + _contextInfo = new OGLContextInfo_Legacy; } CGLSetCurrentContext(prevContext); @@ -103,8 +164,12 @@ void MacOGLDisplayView::Init() void MacOGLDisplayView::_FrameRenderAndFlush() { - this->FrameRender(); - CGLFlushDrawable(this->_context); + this->CALayerDisplay(); +} + +CGLPixelFormatObj MacOGLDisplayView::GetPixelFormat() const +{ + return this->_pixelFormat; } CGLContextObj MacOGLDisplayView::GetContext() const @@ -112,11 +177,6 @@ CGLContextObj MacOGLDisplayView::GetContext() const return this->_context; } -void MacOGLDisplayView::SetContext(CGLContextObj context) -{ - this->_context = context; -} - void MacOGLDisplayView::SetHUDFontUsingPath(const char *filePath) { CGLLockContext(this->_context);