Cocoa Port (OpenEmu Plug-in): Do a complete revamp of the OpenEmu plug-in, giving it the same performance level as the standalone app, plus most of the video display options as the standalone app!

- Includes native binaries for Intel 64-bit, Intel 64-bit Haswell, and ARM64.
- The Dynamic Recompiler engine for ARM64 processors is now enabled by default, greatly increasing performance on Apple Silicon Macs.
- Now includes the full suite of dual-screen display layouts, screen rotations, display gap options, and so on.
- The Heads Up Display is now included.
- Can use the latest features of OpenEmu v2.3.3 running on macOS Monterey, but is also backwards compatible with OpenEmu v2.0.9.1 running on macOS El Capitan.
- Also includes general stability improvements.
This commit is contained in:
rogerman 2022-05-03 13:24:24 -07:00
parent cc530c7a38
commit 6e26980d87
9 changed files with 1156 additions and 298 deletions

View File

@ -1482,6 +1482,37 @@
AB497A2027F2E97A00E8A244 /* README.MAC in Resources */ = {isa = PBXBuildFile; fileRef = AB3ACC3D14C24D5400D7D192 /* README.MAC */; };
AB497A2127F2E97A00E8A244 /* AppIcon_FirmwareConfig.icns in Resources */ = {isa = PBXBuildFile; fileRef = AB75226D14C7BB51009B97B3 /* AppIcon_FirmwareConfig.icns */; };
AB497A2227F2E97A00E8A244 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */; };
AB49B53A281687B90069F1D7 /* cff.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7B01BB4EC1000B08C25 /* cff.c */; };
AB49B53B281687B90069F1D7 /* ftbase.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7751BB4EC1000B08C25 /* ftbase.c */; };
AB49B53C281687B90069F1D7 /* ftbbox.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7771BB4EC1000B08C25 /* ftbbox.c */; };
AB49B53D281687B90069F1D7 /* ftbitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7791BB4EC1000B08C25 /* ftbitmap.c */; };
AB49B53E281687B90069F1D7 /* ftdebug.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA77D1BB4EC1000B08C25 /* ftdebug.c */; };
AB49B53F281687B90069F1D7 /* ftfntfmt.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA77E1BB4EC1000B08C25 /* ftfntfmt.c */; };
AB49B540281687B90069F1D7 /* ftfstype.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA77F1BB4EC1000B08C25 /* ftfstype.c */; };
AB49B541281687B90069F1D7 /* ftgasp.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7801BB4EC1000B08C25 /* ftgasp.c */; };
AB49B542281687B90069F1D7 /* ftglyph.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7821BB4EC1000B08C25 /* ftglyph.c */; };
AB49B543281687B90069F1D7 /* ftgxval.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7831BB4EC1000B08C25 /* ftgxval.c */; };
AB49B544281687B90069F1D7 /* ftinit.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7841BB4EC1000B08C25 /* ftinit.c */; };
AB49B545281687B90069F1D7 /* ftlcdfil.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7851BB4EC1000B08C25 /* ftlcdfil.c */; };
AB49B546281687B90069F1D7 /* ftmm.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7871BB4EC1000B08C25 /* ftmm.c */; };
AB49B547281687B90069F1D7 /* ftotval.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7891BB4EC1000B08C25 /* ftotval.c */; };
AB49B548281687B90069F1D7 /* ftpatent.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA78B1BB4EC1000B08C25 /* ftpatent.c */; };
AB49B549281687B90069F1D7 /* ftpfr.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA78C1BB4EC1000B08C25 /* ftpfr.c */; };
AB49B54A281687B90069F1D7 /* ftstroke.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7911BB4EC1000B08C25 /* ftstroke.c */; };
AB49B54B281687B90069F1D7 /* ftsynth.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7921BB4EC1000B08C25 /* ftsynth.c */; };
AB49B54C281687B90069F1D7 /* ftsystem.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7931BB4EC1000B08C25 /* ftsystem.c */; };
AB49B54D281687B90069F1D7 /* fttype1.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA731611BB51F6700B26147 /* fttype1.c */; };
AB49B54E281687B90069F1D7 /* psaux.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA731661BB51FDC00B26147 /* psaux.c */; };
AB49B54F281687B90069F1D7 /* pshinter.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA7315D1BB51E7000B26147 /* pshinter.c */; };
AB49B550281687B90069F1D7 /* psnames.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA731591BB51A8D00B26147 /* psnames.c */; };
AB49B551281687B90069F1D7 /* sfnt.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7C81BB4EC1000B08C25 /* sfnt.c */; };
AB49B552281687B90069F1D7 /* smooth.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7E41BB4EC1000B08C25 /* smooth.c */; };
AB49B553281687B90069F1D7 /* truetype.c in Sources */ = {isa = PBXBuildFile; fileRef = ABFEA7E61BB4EC1000B08C25 /* truetype.c */; };
AB49B554281687B90069F1D7 /* type1.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA731671BB51FDC00B26147 /* type1.c */; };
AB49B555281687B90069F1D7 /* type1cid.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA731651BB51FDC00B26147 /* type1cid.c */; };
AB49B556281707590069F1D7 /* OGLDisplayOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABE6840B189E33BC007FD69C /* OGLDisplayOutput.cpp */; };
AB49B5572817075D0069F1D7 /* OGLDisplayOutput_3_2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABB24F6B1A81EE92006C1108 /* OGLDisplayOutput_3_2.cpp */; };
AB49B558281707B90069F1D7 /* ClientDisplayView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABAD07DA1E19CAA6007867CA /* ClientDisplayView.cpp */; };
AB4C81E41B21676C00ACECD5 /* hq3x.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C81E31B21676C00ACECD5 /* hq3x.cpp */; };
AB4C81E61B21676C00ACECD5 /* hq3x.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C81E31B21676C00ACECD5 /* hq3x.cpp */; };
AB4C81E71B21677700ACECD5 /* hq3x.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C81E31B21676C00ACECD5 /* hq3x.cpp */; };
@ -1495,6 +1526,7 @@
AB53B0C7211E6407003D0ED9 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AB53B0BD211E63E8003D0ED9 /* libz.tbd */; };
AB54718B1E27610500508C5C /* MacMetalDisplayViewShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB54718A1E27610500508C5C /* MacMetalDisplayViewShaders.metal */; };
AB54718C1E27610500508C5C /* MacMetalDisplayViewShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB54718A1E27610500508C5C /* MacMetalDisplayViewShaders.metal */; };
AB552DC8281A079000F48ECD /* OEDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB49B5382816879E0069F1D7 /* OEDisplayView.mm */; };
AB5648FF186E6EA8002740F4 /* cocoa_slot2.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB5648FE186E6EA8002740F4 /* cocoa_slot2.mm */; };
AB564901186E6EA8002740F4 /* cocoa_slot2.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB5648FE186E6EA8002740F4 /* cocoa_slot2.mm */; };
AB564904186E6EBC002740F4 /* Slot2WindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB564903186E6EBC002740F4 /* Slot2WindowDelegate.mm */; };
@ -2168,7 +2200,6 @@
AB790294215B84F20082AE82 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABC570D4134431DA00E7B0B1 /* OpenGL.framework */; };
AB790295215B84F20082AE82 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4321E2562F2003E2B24 /* QuartzCore.framework */; };
AB790296215B84F20082AE82 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABAE1F6E1F6873E70080EFE3 /* CoreVideo.framework */; };
AB796C9F15CDCB0F00C59155 /* arm_jit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB796C9B15CDCB0F00C59155 /* arm_jit.cpp */; };
AB796CA715CDCBA200C59155 /* KeyNames.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB02475B13886BF300E9F9AB /* KeyNames.plist */; };
AB796CA815CDCBA200C59155 /* DefaultKeyMappings.plist in Resources */ = {isa = PBXBuildFile; fileRef = ABC719E1138CB25E002827A9 /* DefaultKeyMappings.plist */; };
AB796CA915CDCBA200C59155 /* DefaultUserPrefs.plist in Resources */ = {isa = PBXBuildFile; fileRef = ABBC0F8C1394B1AA0028B6BD /* DefaultUserPrefs.plist */; };
@ -2930,6 +2961,7 @@
ABC503AE1AAC2B90002FCD43 /* Icon_MicrophoneDarkGreen_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABC503AC1AAC2B71002FCD43 /* Icon_MicrophoneDarkGreen_256x256.png */; };
ABC503B01AAC42C2002FCD43 /* coreaudiosound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB1B9E5F1501A78000464647 /* coreaudiosound.cpp */; };
ABC503B11AAC4355002FCD43 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABB0FBC41A9E5CEA0060C55A /* CoreAudio.framework */; };
ABCC497B281B0684004BA9F0 /* SourceSansPro-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = ABA731281BB5104200B26147 /* SourceSansPro-Bold.otf */; };
ABCFA9F4178BDE920030C8BA /* encrypt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABCFA9F3178BDE920030C8BA /* encrypt.cpp */; };
ABCFA9F6178BDE920030C8BA /* encrypt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABCFA9F3178BDE920030C8BA /* encrypt.cpp */; };
ABD10AE71715FCDD00B5729D /* audiosamplegenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD10AE51715FCDD00B5729D /* audiosamplegenerator.cpp */; };
@ -3607,6 +3639,8 @@
AB47B52B18A3F722009A42AF /* xbrz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xbrz.h; sourceTree = "<group>"; };
AB47B52C18A3F722009A42AF /* xbrz.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xbrz.cpp; sourceTree = "<group>"; };
AB497B1227F2E97A00E8A244 /* DeSmuME.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeSmuME.app; sourceTree = BUILT_PRODUCTS_DIR; };
AB49B5372816879E0069F1D7 /* OEDisplayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OEDisplayView.h; sourceTree = "<group>"; };
AB49B5382816879E0069F1D7 /* OEDisplayView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OEDisplayView.mm; sourceTree = "<group>"; };
AB4C81E31B21676C00ACECD5 /* hq3x.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hq3x.cpp; sourceTree = "<group>"; };
AB4FCEBC1692AB82000F498F /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
AB53B0BC211E63E4003D0ED9 /* libpcap.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libpcap.tbd; path = usr/lib/libpcap.tbd; sourceTree = SDKROOT; };
@ -5073,6 +5107,8 @@
ABB3C63A1501BB8300E0C22E /* openemu */ = {
isa = PBXGroup;
children = (
AB49B5372816879E0069F1D7 /* OEDisplayView.h */,
AB49B5382816879E0069F1D7 /* OEDisplayView.mm */,
AB93384928132CD000851FEA /* OEBuildInterface.cpp */,
ABB3C63D1501BB8300E0C22E /* NDSGameCore.h */,
ABB3C63F1501BB8300E0C22E /* OENDSSystemResponderClient.h */,
@ -6997,6 +7033,7 @@
buildActionMask = 2147483647;
files = (
ABB3C6621501BF4E00E0C22E /* InfoPlist.strings in Resources */,
ABCC497B281B0684004BA9F0 /* SourceSansPro-Bold.otf in Resources */,
ABB3C6631501BF4E00E0C22E /* FileTypeInfo.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -9029,14 +9066,17 @@
ABCFA9F6178BDE920030C8BA /* encrypt.cpp in Sources */,
ABB3C66C1501C04F00E0C22E /* NDSGameCore.mm in Sources */,
ABB3C6701501C04F00E0C22E /* videofilter.cpp in Sources */,
AB49B54B281687B90069F1D7 /* ftsynth.c in Sources */,
ABB3C6721501C04F00E0C22E /* cocoa_file.mm in Sources */,
ABB3C6751501C04F00E0C22E /* cocoa_rom.mm in Sources */,
AB29B16418313AF5009B7982 /* slot2.cpp in Sources */,
ABB3C6781501C04F00E0C22E /* slot1_none.cpp in Sources */,
AB29B16818313C14009B7982 /* slot2_auto.cpp in Sources */,
AB9038B417C5ED2200F410BD /* slot1_retail_mcrom.cpp in Sources */,
AB49B546281687B90069F1D7 /* ftmm.c in Sources */,
ABB3C6791501C04F00E0C22E /* slot1_r4.cpp in Sources */,
AB2ABA3E1C9F9CFA00173B15 /* async_job.c in Sources */,
AB49B53A281687B90069F1D7 /* cff.c in Sources */,
ABB3C67A1501C04F00E0C22E /* slot1_retail_nand.cpp in Sources */,
ABB3C67C1501C04F00E0C22E /* slot2_expMemory.cpp in Sources */,
ABB3C67D1501C04F00E0C22E /* slot2_gbagame.cpp in Sources */,
@ -9046,17 +9086,26 @@
ABB3C6801501C04F00E0C22E /* slot2_none.cpp in Sources */,
ABB3C6811501C04F00E0C22E /* slot2_paddle.cpp in Sources */,
ABB3C6821501C04F00E0C22E /* slot2_piano.cpp in Sources */,
AB49B541281687B90069F1D7 /* ftgasp.c in Sources */,
ABB3C6831501C04F00E0C22E /* slot2_rumblepak.cpp in Sources */,
ABB3C6841501C04F00E0C22E /* 2xsai.cpp in Sources */,
ABC503B01AAC42C2002FCD43 /* coreaudiosound.cpp in Sources */,
ABB3C6851501C04F00E0C22E /* bilinear.cpp in Sources */,
AB49B54A281687B90069F1D7 /* ftstroke.c in Sources */,
AB49B53D281687B90069F1D7 /* ftbitmap.c in Sources */,
AB49B53B281687B90069F1D7 /* ftbase.c in Sources */,
ABB3C6861501C04F00E0C22E /* epx.cpp in Sources */,
ABB3C6871501C04F00E0C22E /* hq2x.cpp in Sources */,
ABB1C94B1F5281AE0004844F /* ClientExecutionControl.cpp in Sources */,
ABB3C6881501C04F00E0C22E /* hq4x.cpp in Sources */,
ABB3C6891501C04F00E0C22E /* lq2x.cpp in Sources */,
AB49B558281707B90069F1D7 /* ClientDisplayView.cpp in Sources */,
AB49B551281687B90069F1D7 /* sfnt.c in Sources */,
AB49B555281687B90069F1D7 /* type1cid.c in Sources */,
ABB3C68A1501C04F00E0C22E /* scanline.cpp in Sources */,
ABB3C68B1501C04F00E0C22E /* AAFilter.cpp in Sources */,
AB49B540281687B90069F1D7 /* ftfstype.c in Sources */,
AB49B53F281687B90069F1D7 /* ftfntfmt.c in Sources */,
ABB3C68C1501C04F00E0C22E /* cpu_detect_x86_gcc.cpp in Sources */,
ABB3C68D1501C04F00E0C22E /* FIFOSampleBuffer.cpp in Sources */,
AB9038A817C5ECFD00F410BD /* advanscene.cpp in Sources */,
@ -9083,16 +9132,21 @@
ABB3C69D1501C04F00E0C22E /* disc.cpp in Sources */,
ABB3C69E1501C04F00E0C22E /* fatdir.cpp in Sources */,
AB11AD8C1F6757F800CB298E /* ClientInputHandler.cpp in Sources */,
AB49B54E281687B90069F1D7 /* psaux.c in Sources */,
AB49B54D281687B90069F1D7 /* fttype1.c in Sources */,
ABB3C69F1501C04F00E0C22E /* fatfile.cpp in Sources */,
ABB3C6A01501C04F00E0C22E /* file_allocation_table.cpp in Sources */,
ABB3C6A11501C04F00E0C22E /* filetime.cpp in Sources */,
AB49B543281687B90069F1D7 /* ftgxval.c in Sources */,
ABB3C6A21501C04F00E0C22E /* libfat.cpp in Sources */,
ABB3C6A31501C04F00E0C22E /* libfat_public_api.cpp in Sources */,
ABB3C6A41501C04F00E0C22E /* lock.cpp in Sources */,
ABB3C6A51501C04F00E0C22E /* partition.cpp in Sources */,
ABB3C6A61501C04F00E0C22E /* tinystr.cpp in Sources */,
AB49B554281687B90069F1D7 /* type1.c in Sources */,
ABB3C6A71501C04F00E0C22E /* tinyxml.cpp in Sources */,
ABB3C6A81501C04F00E0C22E /* tinyxmlerror.cpp in Sources */,
AB49B552281687B90069F1D7 /* smooth.c in Sources */,
ABB3C6A91501C04F00E0C22E /* tinyxmlparser.cpp in Sources */,
ABADF11E1DEA4CFC00A142B1 /* features_cpu.c in Sources */,
ABB3C6AB1501C04F00E0C22E /* datetime.cpp in Sources */,
@ -9105,6 +9159,7 @@
ABB3C6B21501C04F00E0C22E /* xstring.cpp in Sources */,
ABB3C6B41501C04F00E0C22E /* arm_instructions.cpp in Sources */,
ABB3C6B51501C04F00E0C22E /* armcpu.cpp in Sources */,
AB49B54F281687B90069F1D7 /* pshinter.c in Sources */,
ABB3C6B61501C04F00E0C22E /* bios.cpp in Sources */,
ABB3C6B71501C04F00E0C22E /* cheatSystem.cpp in Sources */,
ABB3C6B81501C04F00E0C22E /* common.cpp in Sources */,
@ -9112,15 +9167,20 @@
AB407F371A6206FB00313213 /* xbrz.cpp in Sources */,
AB301BE21D9C8BCF00246A93 /* deposterize.cpp in Sources */,
ABB3C6BA1501C04F00E0C22E /* debug.cpp in Sources */,
AB49B545281687B90069F1D7 /* ftlcdfil.c in Sources */,
ABB3C6BB1501C04F00E0C22E /* Disassembler.cpp in Sources */,
ABB3C6BC1501C04F00E0C22E /* driver.cpp in Sources */,
ABB3C6BD1501C04F00E0C22E /* emufile.cpp in Sources */,
ABB3C6BE1501C04F00E0C22E /* FIFO.cpp in Sources */,
ABB3C6BF1501C04F00E0C22E /* firmware.cpp in Sources */,
ABB3C6C01501C04F00E0C22E /* gfx3d.cpp in Sources */,
AB49B5572817075D0069F1D7 /* OGLDisplayOutput_3_2.cpp in Sources */,
ABB3C6C11501C04F00E0C22E /* GPU.cpp in Sources */,
ABB3C6C31501C04F00E0C22E /* matrix.cpp in Sources */,
ABB3C6C41501C04F00E0C22E /* mc.cpp in Sources */,
AB49B548281687B90069F1D7 /* ftpatent.c in Sources */,
AB49B542281687B90069F1D7 /* ftglyph.c in Sources */,
AB552DC8281A079000F48ECD /* OEDisplayView.mm in Sources */,
ABB3C6C61501C04F00E0C22E /* MMU.cpp in Sources */,
ABB3C6C71501C04F00E0C22E /* movie.cpp in Sources */,
AB8B7AAE17CE8C440051CEBF /* slot1comp_protocol.cpp in Sources */,
@ -9130,34 +9190,42 @@
AB2ABA461C9F9CFA00173B15 /* rthreads.c in Sources */,
ABB3C6CB1501C04F00E0C22E /* rasterize.cpp in Sources */,
ABB3C6CC1501C04F00E0C22E /* readwrite.cpp in Sources */,
AB49B553281687B90069F1D7 /* truetype.c in Sources */,
ABB3C6CD1501C04F00E0C22E /* render3D.cpp in Sources */,
ABB3C6CE1501C04F00E0C22E /* ROMReader.cpp in Sources */,
ABB3C6CF1501C04F00E0C22E /* rtc.cpp in Sources */,
ABB3C6D01501C04F00E0C22E /* saves.cpp in Sources */,
AB49B54C281687B90069F1D7 /* ftsystem.c in Sources */,
AB49B544281687B90069F1D7 /* ftinit.c in Sources */,
ABB3C6D11501C04F00E0C22E /* slot1.cpp in Sources */,
ABB3C6D31501C04F00E0C22E /* SPU.cpp in Sources */,
ABB3C6D41501C04F00E0C22E /* texcache.cpp in Sources */,
AB49B53C281687B90069F1D7 /* ftbbox.c in Sources */,
ABADF1211DEA4D0000A142B1 /* Database.cpp in Sources */,
AB49B547281687B90069F1D7 /* ftotval.c in Sources */,
AB9038BA17C5ED2200F410BD /* slot1comp_rom.cpp in Sources */,
ABB3C6D51501C04F00E0C22E /* thumb_instructions.cpp in Sources */,
AB2EE13317D57F5000F68622 /* fsnitro.cpp in Sources */,
ABB3C6D61501C04F00E0C22E /* version.cpp in Sources */,
AB93384A28132CD000851FEA /* OEBuildInterface.cpp in Sources */,
AB35BD921DEBF41800844310 /* encoding_utf.c in Sources */,
AB49B550281687B90069F1D7 /* psnames.c in Sources */,
ABB3C6D71501C04F00E0C22E /* wifi.cpp in Sources */,
ABE9EEEA1501C6EB00D3FB19 /* cocoa_firmware.mm in Sources */,
AB1949DB15034F900098793E /* OESoundInterface.mm in Sources */,
AB796C9F15CDCB0F00C59155 /* arm_jit.cpp in Sources */,
AB2ABA421C9F9CFA00173B15 /* rsemaphore.c in Sources */,
AB000DD91CCC6B4300413F02 /* retro_stat.c in Sources */,
AB49B549281687B90069F1D7 /* ftpfr.c in Sources */,
AB68A0DD16B139BC00DE0546 /* OGLRender_3_2.cpp in Sources */,
AB9038B717C5ED2200F410BD /* slot1comp_mc.cpp in Sources */,
AB3A656316CC5438001F5D4A /* cocoa_GPU.mm in Sources */,
AB82445D1704AE9A00B8EE20 /* utilities.c in Sources */,
AB49B556281707590069F1D7 /* OGLDisplayOutput.cpp in Sources */,
ABD10AE91715FCDD00B5729D /* audiosamplegenerator.cpp in Sources */,
ABD10AEC1715FCDD00B5729D /* mic_ext.cpp in Sources */,
ABD10AED17160C9300B5729D /* ringbuffer.cpp in Sources */,
ABD10AEE17160CDD00B5729D /* cocoa_input.mm in Sources */,
AB49B53E281687B90069F1D7 /* ftdebug.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -9773,10 +9841,13 @@
"$(inherited)",
"\"$(SRCROOT)/openemu\"",
);
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = openemu/DeSmuME_Prefix_OpenEmu.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
_DEBUG,
"DEBUG=1",
METAL_DISABLE_FOR_BUILD_TARGET,
);
INFOPLIST_FILE = "openemu/Info (OpenEmu Plug-in).plist";
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_NAME = DeSmuME;
WRAPPER_EXTENSION = oecoreplugin;
@ -9799,8 +9870,11 @@
"$(inherited)",
"\"$(SRCROOT)/openemu\"",
);
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = openemu/DeSmuME_Prefix_OpenEmu.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
NDEBUG,
METAL_DISABLE_FOR_BUILD_TARGET,
);
INFOPLIST_FILE = "openemu/Info (OpenEmu Plug-in).plist";
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;

View File

@ -35,6 +35,8 @@
#ifdef ENABLE_APPLE_METAL
#import "userinterface/MacMetalDisplayView.h"
#endif
#else
#import "openemu/OEDisplayView.h"
#endif
#ifdef BOOL
@ -145,10 +147,13 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = {
}
#endif
#ifdef ENABLE_SHARED_FETCH_OBJECT
if (fetchObject == NULL)
{
#ifdef PORT_VERSION_OS_X_APP
fetchObject = new MacOGLClientFetchObject;
#else
fetchObject = new OE_OGLClientFetchObject;
#endif
GPU->SetFramebufferPageCount(OPENGL_FETCH_BUFFER_COUNT);
}
@ -156,7 +161,6 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = {
gpuEvent->SetFetchObject(fetchObject);
GPU->SetWillAutoResolveToCustomBuffer(false);
#endif
openglDeviceMaxMultisamples = 0;
render3DMultisampleSizeString = @"Off";
@ -164,7 +168,9 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = {
bool isTempContextCreated = OSXOpenGLRendererInit();
if (isTempContextCreated)
{
CGLContextObj prevContext = CGLGetCurrentContext();
OSXOpenGLRendererBegin();
GLint maxSamplesOGL = 0;
#if defined(GL_MAX_SAMPLES)
@ -177,6 +183,7 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = {
OSXOpenGLRendererEnd();
DestroyOpenGLRenderer();
CGLSetCurrentContext(prevContext);
}
return self;
@ -243,10 +250,9 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = {
#endif
GPU->SetCustomFramebufferSize(w, h);
#ifdef ENABLE_ASYNC_FETCH
fetchObject->SetFetchBuffers(GPU->GetDisplayInfo());
#ifdef ENABLE_ASYNC_FETCH
for (size_t i = maxPages - 1; i < maxPages; i--)
{
semaphore_signal( ((MacGPUFetchObjectAsync *)fetchObject)->SemaphoreFramebufferPageAtIndex(i) );
@ -315,10 +321,9 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = {
#endif
GPU->SetColorFormat((NDSColorFormat)colorFormat);
#ifdef ENABLE_ASYNC_FETCH
fetchObject->SetFetchBuffers(GPU->GetDisplayInfo());
#ifdef ENABLE_ASYNC_FETCH
for (size_t i = maxPages - 1; i < maxPages; i--)
{
semaphore_signal( ((MacGPUFetchObjectAsync *)fetchObject)->SemaphoreFramebufferPageAtIndex(i) );

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2012 DeSmuME team
Copyright (C) 2012-2022 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
@ -23,8 +23,9 @@
#define DESMUME_COCOA
#define HAVE_OPENGL
#define HAVE_LIBZ
#define FT2_BUILD_LIBRARY
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
#define HAVE_JIT
#endif

View File

@ -22,8 +22,15 @@
#include "../utilities.h"
#include <pthread.h>
#include "../ClientExecutionControl.h"
#include "OEDisplayView.h"
#define SILENCE_DEPRECATION_OPENEMU(expression) SILENCE_DEPRECATION(expression)
class ClientInputHandler;
class OE_OGLDisplayPresenter;
@class CocoaDSCheatManager;
@class CocoaDSController;
@class CocoaDSGPU;
@class CocoaDSFirmware;
@ -64,12 +71,22 @@
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCEMAIN_NONE "Main Display - None"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCEMAIN_NDS "Main Display - Let NDS Decide"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCEMAIN_FORCEMAIN "Main Display - Force Main Engine"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCEMAIN_FORCETOUCH "Main Display - Force Touch Engine"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCEMAIN_FORCESUB "Main Display - Force Sub Engine"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCETOUCH_NONE "Touch Display - None"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCETOUCH_NDS "Touch Display - Let NDS Decide"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCETOUCH_FORCEMAIN "Touch Display - Force Main Engine"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCETOUCH_FORCETOUCH "Touch Display - Force Touch Engine"
#define NDSDISPLAYMODE_NAMEKEY_VIDEOSOURCETOUCH_FORCESUB "Touch Display - Force Sub Engine"
#define NDSDISPLAYMODE_NAMEKEY_HUD_ENABLE "Enable HUD"
#define NDSDISPLAYMODE_NAMEKEY_HUD_EXECUTIONSPEED "Execution Speed"
#define NDSDISPLAYMODE_NAMEKEY_HUD_VIDEOFPS "Video FPS"
#define NDSDISPLAYMODE_NAMEKEY_HUD_3DRENDERERFPS "3D Renderer FPS"
#define NDSDISPLAYMODE_NAMEKEY_HUD_FRAMEINDEX "Frame Index"
#define NDSDISPLAYMODE_NAMEKEY_HUD_LAGFRAMECOUNTER "Lag Frame Counter"
#define NDSDISPLAYMODE_NAMEKEY_HUD_CPULOADAVERAGE "CPU Load Average"
#define NDSDISPLAYMODE_NAMEKEY_HUD_REALTIMECLOCK "Real-Time Clock"
#define NDSDISPLAYMODE_NAMEKEY_HUD_INPUT "Input"
#define NDSDISPLAYMODE_PREFKEY_DISPLAYMODE "displayMode"
#define NDSDISPLAYMODE_PREFKEY_LAYOUT "layout"
@ -78,6 +95,15 @@
#define NDSDISPLAYMODE_PREFKEY_SEPARATION "gap"
#define NDSDISPLAYMODE_PREFKEY_VIDEOSOURCE_MAIN "videosource_main"
#define NDSDISPLAYMODE_PREFKEY_VIDEOSOURCE_TOUCH "videosource_touch"
#define NDSDISPLAYMODE_PREFKEY_HUD_ENABLE "hud_enable"
#define NDSDISPLAYMODE_PREFKEY_HUD_EXECUTIONSPEED "hud_executionspeed"
#define NDSDISPLAYMODE_PREFKEY_HUD_VIDEOFPS "hud_videofps"
#define NDSDISPLAYMODE_PREFKEY_HUD_3DRENDERERFPS "hud_3drendererfps"
#define NDSDISPLAYMODE_PREFKEY_HUD_FRAMEINDEX "hud_frameindex"
#define NDSDISPLAYMODE_PREFKEY_HUD_LAGFRAMECOUNTER "hud_lagframecounter"
#define NDSDISPLAYMODE_PREFKEY_HUD_CPULOADAVERAGE "hud_cpuloadaverage"
#define NDSDISPLAYMODE_PREFKEY_HUD_REALTIMECLOCK "hud_realtimeclock"
#define NDSDISPLAYMODE_PREFKEY_HUD_INPUT "hud_input"
// These IDs are used to maintain the data associations for all of
// the display mode menu items.
@ -110,60 +136,137 @@ enum NDSDisplayOptionID
NDSDisplayOptionID_VideoSourceMain_None,
NDSDisplayOptionID_VideoSourceMain_NDS,
NDSDisplayOptionID_VideoSourceMain_ForceMain,
NDSDisplayOptionID_VideoSourceMain_ForceTouch,
NDSDisplayOptionID_VideoSourceMain_ForceSub,
NDSDisplayOptionID_VideoSourceTouch_None,
NDSDisplayOptionID_VideoSourceTouch_NDS,
NDSDisplayOptionID_VideoSourceTouch_ForceMain,
NDSDisplayOptionID_VideoSourceTouch_ForceTouch,
NDSDisplayOptionID_VideoSourceTouch_ForceSub,
NDSDisplayOptionID_HUD_Enable,
NDSDisplayOptionID_HUD_ExecutionSpeed,
NDSDisplayOptionID_HUD_VideoFPS,
NDSDisplayOptionID_HUD_3DRendererFPS,
NDSDisplayOptionID_HUD_FrameIndex,
NDSDisplayOptionID_HUD_LagFrameCounter,
NDSDisplayOptionID_HUD_CPULoadAverage,
NDSDisplayOptionID_HUD_RealTimeClock,
NDSDisplayOptionID_HUD_Input,
NDSDisplayOptionID_Count
};
// Used to track the bits that each option group uses, useful for clearing the
// entire group of bits prior to setting a single bit for that particular group.
enum NDSDisplayOptionStateBitmask
{
NDSDisplayOptionStateBitmask_DisplayMode = (1 << NDSDisplayOptionID_Mode_DualScreen) | (1 << NDSDisplayOptionID_Mode_Main) | (1 << NDSDisplayOptionID_Mode_Touch),
NDSDisplayOptionStateBitmask_Rotation = (1 << NDSDisplayOptionID_Rotation_0) | (1 << NDSDisplayOptionID_Rotation_90) | (1 << NDSDisplayOptionID_Rotation_180) | (1 << NDSDisplayOptionID_Rotation_270),
NDSDisplayOptionStateBitmask_Layout = (1 << NDSDisplayOptionID_Layout_Vertical) | (1 << NDSDisplayOptionID_Layout_Horizontal) | (1 << NDSDisplayOptionID_Layout_Hybrid_2_1) | (1 << NDSDisplayOptionID_Layout_Hybrid_16_9) | (1 << NDSDisplayOptionID_Layout_Hybrid_16_10),
NDSDisplayOptionStateBitmask_Order = (1 << NDSDisplayOptionID_Order_MainFirst) | (1 << NDSDisplayOptionID_Order_TouchFirst),
NDSDisplayOptionStateBitmask_Separation = (1 << NDSDisplayOptionID_Separation_0) | (1 << NDSDisplayOptionID_Separation_50) | (1 << NDSDisplayOptionID_Separation_100) | (1 << NDSDisplayOptionID_Separation_150) | (1 << NDSDisplayOptionID_Separation_200),
NDSDisplayOptionStateBitmask_VideoSourceMain = (1 << NDSDisplayOptionID_VideoSourceMain_None) | (1 << NDSDisplayOptionID_VideoSourceMain_NDS) | (1 << NDSDisplayOptionID_VideoSourceMain_ForceMain) | (1 << NDSDisplayOptionID_VideoSourceMain_ForceTouch),
NDSDisplayOptionStateBitmask_VideoSourceTouch = (1 << NDSDisplayOptionID_VideoSourceTouch_None) | (1 << NDSDisplayOptionID_VideoSourceTouch_NDS) | (1 << NDSDisplayOptionID_VideoSourceTouch_ForceMain) | (1 << NDSDisplayOptionID_VideoSourceTouch_ForceTouch)
};
// Bitmasks that define the groupings for certain display mode options.
#define NDSDISPLAYMODE_GROUPBITMASK_DISPLAYMODE ((1ULL << NDSDisplayOptionID_Mode_DualScreen) | \
(1ULL << NDSDisplayOptionID_Mode_Main) | \
(1ULL << NDSDisplayOptionID_Mode_Touch))
#define NDSDISPLAYMODE_GROUPBITMASK_ROTATION ((1ULL << NDSDisplayOptionID_Rotation_0) | \
(1ULL << NDSDisplayOptionID_Rotation_90) | \
(1ULL << NDSDisplayOptionID_Rotation_180) | \
(1ULL << NDSDisplayOptionID_Rotation_270))
#define NDSDISPLAYMODE_GROUPBITMASK_LAYOUT ((1ULL << NDSDisplayOptionID_Layout_Vertical) | \
(1ULL << NDSDisplayOptionID_Layout_Horizontal) | \
(1ULL << NDSDisplayOptionID_Layout_Hybrid_2_1) | \
(1ULL << NDSDisplayOptionID_Layout_Hybrid_16_9) | \
(1ULL << NDSDisplayOptionID_Layout_Hybrid_16_10))
#define NDSDISPLAYMODE_GROUPBITMASK_ORDER ((1ULL << NDSDisplayOptionID_Order_MainFirst) | \
(1ULL << NDSDisplayOptionID_Order_TouchFirst))
#define NDSDISPLAYMODE_GROUPBITMASK_SEPARATION ((1ULL << NDSDisplayOptionID_Separation_0) | \
(1ULL << NDSDisplayOptionID_Separation_50) | \
(1ULL << NDSDisplayOptionID_Separation_100) | \
(1ULL << NDSDisplayOptionID_Separation_150) | \
(1ULL << NDSDisplayOptionID_Separation_200))
#define NDSDISPLAYMODE_GROUPBITMASK_VIDEOSOURCEMAIN ((1ULL << NDSDisplayOptionID_VideoSourceMain_None) | \
(1ULL << NDSDisplayOptionID_VideoSourceMain_NDS) | \
(1ULL << NDSDisplayOptionID_VideoSourceMain_ForceMain) | \
(1ULL << NDSDisplayOptionID_VideoSourceMain_ForceSub))
#define NDSDISPLAYMODE_GROUPBITMASK_VIDEOSOURCETOUCH ((1ULL << NDSDisplayOptionID_VideoSourceTouch_None) | \
(1ULL << NDSDisplayOptionID_VideoSourceTouch_NDS) | \
(1ULL << NDSDisplayOptionID_VideoSourceTouch_ForceMain) | \
(1ULL << NDSDisplayOptionID_VideoSourceTouch_ForceSub))
// Describes the data associations for a single display mode menu item, used for generating
// the NSDictionary items that are part of the display mode menu descriptor. This struct
// represents the immutable portions of the data. The mutable parts, such as the menu item
// states, are handled elsewhere.
struct NDSDisplayMenuItem
struct OEMenuItemDesc
{
NSString *nameKey;
NSString *prefKey;
NSString *nameKey; // The displayed name of the menu item. Must conform to OEGameCoreDisplayModeNameKey.
NSString *prefKey; // The user defaults key of the menu item. Must conform to OEGameCoreDisplayModePrefKeyNameKey.
uint64_t groupBitmask; // The associated state bits of all menu items that belong in the same group.
// Assigning zero or non-zero controls the behavior of this menu item.
// Zero - Toggle type. This item can be toggled and/or selected all by itself.
// Non-zero - Group type. This item cannot be toggled, and selection is mutually exclusive
// with its associated group. The group is defined by using these bits.
// Note: Alternate menu item names are unsupported in OpenEmu. This feature is currently unimplemented.
//
// OpenEmu ties the presented menu item state, denoted by a check mark, with writing out that state
// to user defaults. In other words, using alternate names for presentation in lieu of a check mark
// will disrupt OpenEmu's user defaults system. And so to retain a consistent user defaults behavior,
// we cannot use alternate menu item names in OpenEmu.
//
// This item exists here just in case OpenEmu ever decides to decouple presentation with state. If
// they do, then we'll have another presentation option here.
NSString *altNameKey; // The alternate displayed name of the menu item. Must conform to OEGameCoreDisplayModeNameKey.
// Only used for toggle-type items and ignored for group-type items.
// nil value - Do not use altNameKey when toggle, but use a check mark to denote state.
// Assigned value - Switches between nameKey and altNameKey to denote state.
};
typedef NDSDisplayMenuItem NDSDisplayMenuItem;
typedef struct OEMenuItemDesc OEMenuItemDesc;
@interface NDSGameCore : OEGameCore
{
char _hudFontPath[4096]; // This should be plenty for storing a file path!
apple_unfairlock_t unfairlockDisplayMode;
pthread_rwlock_t rwlockCoreExecute;
NSPoint touchLocation;
NSMutableDictionary *addedCheatsDict;
CocoaDSCheatManager *cdsCheats;
CocoaDSController *cdsController;
CocoaDSGPU *cdsGPU;
CocoaDSFirmware *cdsFirmware;
MacInputHandler *_inputHandler;
OEIntPoint _lastTouchLocation;
bool _isInitialTouchPress;
bool _isTouchPressInMajorDisplay;
NSUInteger inputID[OENDSButtonCount]; // Key = OpenEmu's input ID, Value = DeSmuME's input ID
OEIntRect _displayRect;
OEIntSize _displayAspectRatio;
OEIntSize _displayBufferSize;
OEIntSize _OEViewSize;
CGLContextObj _videoContext;
OE_OGLDisplayPresenter *_cdp;
NSTimer *_fpsTimer;
BOOL _isTimerAtSecond;
apple_unfairlock_t _unfairlockReceivedFrameIndex;
apple_unfairlock_t _unfairlockNDSFrameInfo;
uint32_t _receivedFrameIndex;
uint32_t _currentReceivedFrameIndex;
uint32_t _receivedFrameCount;
double _executionSpeedAverageFramesCollected;
ClientFrameInfo _clientFrameInfo;
NDSFrameInfo _ndsFrameInfo;
// Records the display mode menu states on a per-bit basis. This only works because OpenEmu
// tracks only binary states for the menu items. Currently, there are 27 different states
// to keep track of, which leaves us another 37 states for future use.
uint64_t ndsDisplayMode;
uint64_t _displayModeStatesPending;
uint64_t _displayModeStatesApplied;
// For simplicity's sake, we use NDSDisplayOptionID numbers to maintain all of the internal data
// associations for display mode menu items. However, OpenEmu uses OEGameCoreDisplayModeNameKey
@ -177,11 +280,17 @@ typedef NDSDisplayMenuItem NDSDisplayMenuItem;
}
@property (retain) CocoaDSCheatManager *cdsCheats;
@property (retain) CocoaDSController *cdsController;
@property (retain) CocoaDSGPU *cdsGPU;
@property (retain) CocoaDSFirmware *cdsFirmware;
@property (assign) uint64_t ndsDisplayMode;
- (void) initVideoWithCurrentOpenEmuContext;
- (void) newFPSTimer;
- (void) getTimedEmulatorStatistics:(NSTimer *)timer;
- (uint64_t) switchDisplayModeState:(uint64_t)displayModeState nameKey:(NSString *)nameKey;
- (uint64_t) setDisplayModeState:(uint64_t)displayModeState optionID:(NDSDisplayOptionID)optionID state:(NSNumber *)stateObj;
- (NSDictionary<NSString *, id> *) generateDisplayModeItemByID:(NDSDisplayOptionID)optionID states:(const uint64_t)states;
@end

File diff suppressed because it is too large Load Diff

View File

@ -60,5 +60,8 @@
#include "../../utils/AsmJit/x86/x86func.cpp"
#include "../../utils/AsmJit/x86/x86operand.cpp"
#include "../../utils/AsmJit/x86/x86util.cpp"
#include "../../arm_jit.cpp"
#elif defined(__aarch64__)
#include "../../utils/arm_jit/arm_jit_arm.cpp"
#endif
#endif

View File

@ -0,0 +1,86 @@
/*
Copyright (C) 2022 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 <http://www.gnu.org/licenses/>.
*/
#ifndef _OPENEMU_DISPLAYOUTPUT_H_
#define _OPENEMU_DISPLAYOUTPUT_H_
#import <Cocoa/Cocoa.h>
#import <OpenGL/OpenGL.h>
#include "../utilities.h"
#import "../cocoa_GPU.h"
#import "../cocoa_util.h"
#include "../ClientDisplayView.h"
#include "../OGLDisplayOutput_3_2.h"
#ifdef BOOL
#undef BOOL
#endif
class OE_OGLClientSharedData : public OGLClientSharedData
{
protected:
apple_unfairlock_t _unfairlockTexFetch[2];
public:
OE_OGLClientSharedData();
~OE_OGLClientSharedData();
virtual GLuint GetFetchTexture(const NDSDisplayID displayID);
virtual void SetFetchTexture(const NDSDisplayID displayID, GLuint texID);
};
class OE_OGLClientFetchObject : public GPUClientFetchObject
{
protected:
CGLContextObj _context;
// GPUClientFetchObject methods
virtual void _FetchNativeDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex);
virtual void _FetchCustomDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex);
public:
OE_OGLClientFetchObject();
~OE_OGLClientFetchObject();
CGLContextObj GetContext() const;
// GPUClientFetchObject methods
virtual void Init();
virtual void SetFetchBuffers(const NDSDisplayInfo &currentDisplayInfo);
virtual void FetchFromBufferIndex(const u8 index);
};
class OE_OGLDisplayPresenter : public OGLVideoOutput
{
private:
void __InstanceInit(OE_OGLClientFetchObject *fetchObject);
protected:
CGLContextObj _context;
public:
OE_OGLDisplayPresenter();
OE_OGLDisplayPresenter(OE_OGLClientFetchObject *fetchObject);
virtual void Init();
CGLContextObj GetContext() const;
};
#endif // _OPENEMU_DISPLAYOUTPUT_H_

View File

@ -0,0 +1,172 @@
/*
Copyright (C) 2022 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 <http://www.gnu.org/licenses/>.
*/
#include <mach/semaphore.h>
#import "OEDisplayView.h"
#import "../cocoa_globals.h"
OE_OGLClientSharedData::OE_OGLClientSharedData()
{
_useDirectToCPUFilterPipeline = false;
_unfairlockTexFetch[NDSDisplayID_Main] = apple_unfairlock_create();
_unfairlockTexFetch[NDSDisplayID_Touch] = apple_unfairlock_create();
}
OE_OGLClientSharedData::~OE_OGLClientSharedData()
{
apple_unfairlock_destroy(this->_unfairlockTexFetch[NDSDisplayID_Main]);
this->_unfairlockTexFetch[NDSDisplayID_Main] = NULL;
apple_unfairlock_destroy(this->_unfairlockTexFetch[NDSDisplayID_Touch]);
this->_unfairlockTexFetch[NDSDisplayID_Touch] = NULL;
}
GLuint OE_OGLClientSharedData::GetFetchTexture(const NDSDisplayID displayID)
{
apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
const GLuint texFetchID = this->OGLClientSharedData::GetFetchTexture(displayID);
apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
return texFetchID;
}
void OE_OGLClientSharedData::SetFetchTexture(const NDSDisplayID displayID, GLuint texID)
{
apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
this->OGLClientSharedData::SetFetchTexture(displayID, texID);
apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
}
#pragma mark -
OE_OGLClientFetchObject::OE_OGLClientFetchObject()
{
_context = NULL;
_clientData = NULL;
_id = GPUClientFetchObjectID_OpenEmu;
}
OE_OGLClientFetchObject::~OE_OGLClientFetchObject()
{
delete (OE_OGLClientSharedData *)this->_clientData;
}
CGLContextObj OE_OGLClientFetchObject::GetContext() const
{
return this->_context;
}
void OE_OGLClientFetchObject::Init()
{
if (this->_clientData == NULL)
{
OGLContextInfo *newContextInfo = new OGLContextInfo_3_2;
snprintf(_name, sizeof(_name) - 1, "OpenEmu OpenGL v%i.%i", newContextInfo->GetVersionMajor(), newContextInfo->GetVersionMinor());
strlcpy(_description, newContextInfo->GetRendererString(), sizeof(_description) - 1);
this->_clientData = new OE_OGLClientSharedData;
((OE_OGLClientSharedData *)this->_clientData)->SetContextInfo(newContextInfo);
}
if ( this->_context != CGLGetCurrentContext() )
{
this->_context = CGLGetCurrentContext();
OE_OGLClientSharedData *sharedData = (OE_OGLClientSharedData *)this->_clientData;
sharedData->InitOGL();
}
}
void OE_OGLClientFetchObject::SetFetchBuffers(const NDSDisplayInfo &currentDisplayInfo)
{
OE_OGLClientSharedData *sharedData = (OE_OGLClientSharedData *)this->_clientData;
this->GPUClientFetchObject::SetFetchBuffers(currentDisplayInfo);
sharedData->SetFetchBuffersOGL(this->_fetchDisplayInfo, currentDisplayInfo);
}
void OE_OGLClientFetchObject::FetchFromBufferIndex(const u8 index)
{
OE_OGLClientSharedData *sharedData = (OE_OGLClientSharedData *)this->_clientData;
this->GPUClientFetchObject::FetchFromBufferIndex(index);
const NDSDisplayInfo &currentDisplayInfo = this->GetFetchDisplayInfoForBufferIndex(index);
sharedData->FetchFromBufferIndexOGL(index, currentDisplayInfo);
}
void OE_OGLClientFetchObject::_FetchNativeDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex)
{
// This method is called from OE_OGLClientFetchObject::FetchFromBufferIndex(), and so
// we should have already been assigned the current context.
OE_OGLClientSharedData *sharedData = (OE_OGLClientSharedData *)this->_clientData;
sharedData->FetchNativeDisplayByID_OGL(this->_fetchDisplayInfo, displayID, bufferIndex);
}
void OE_OGLClientFetchObject::_FetchCustomDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex)
{
// This method is called from OE_OGLClientFetchObject::FetchFromBufferIndex(), and so
// we should have already been assigned the current context.
OE_OGLClientSharedData *sharedData = (OE_OGLClientSharedData *)this->_clientData;
sharedData->FetchCustomDisplayByID_OGL(this->_fetchDisplayInfo, displayID, bufferIndex);
}
#pragma mark -
OE_OGLDisplayPresenter::OE_OGLDisplayPresenter()
{
__InstanceInit(NULL);
}
OE_OGLDisplayPresenter::OE_OGLDisplayPresenter(OE_OGLClientFetchObject *fetchObject)
{
__InstanceInit(fetchObject);
}
void OE_OGLDisplayPresenter::__InstanceInit(OE_OGLClientFetchObject *fetchObject)
{
if (fetchObject != NULL)
{
_context = fetchObject->GetContext();
_contextInfo = ((OGLClientSharedData *)fetchObject->GetClientData())->GetContextInfo();
}
else
{
_context = CGLGetCurrentContext();
_contextInfo = new OGLContextInfo_3_2;
}
SetFetchObject(fetchObject);
}
void OE_OGLDisplayPresenter::Init()
{
if (this->_fetchObject != NULL)
{
this->_context = ((OE_OGLClientFetchObject *)this->_fetchObject)->GetContext();
}
else
{
this->_context = CGLGetCurrentContext();
}
this->OGLVideoOutput::Init();
}
CGLContextObj OE_OGLDisplayPresenter::GetContext() const
{
return this->_context;
}

View File

@ -19,9 +19,11 @@
#import "../cocoa_globals.h"
#include <pthread.h>
#include "NDSGameCore.h"
OERingBuffer *openEmuSoundInterfaceBuffer = nil;
static BOOL kWillUseOldAPI = NO;
// Sound interface to the SPU
SoundInterface_struct SNDOpenEmu = {
@ -48,6 +50,7 @@ SoundInterface_struct *SNDCoreList[] = {
int SNDOpenEmuInit(int buffer_size)
{
[openEmuSoundInterfaceBuffer setLength:buffer_size * 4 / SPU_SAMPLE_SIZE];
kWillUseOldAPI = ![openEmuSoundInterfaceBuffer respondsToSelector:@selector(freeBytes)];
return 0;
}
@ -70,6 +73,11 @@ void SNDOpenEmuUpdateAudio(s16 *buffer, u32 num_samples)
u32 SNDOpenEmuGetAudioSpace()
{
if (kWillUseOldAPI)
{
SILENCE_DEPRECATION_OPENEMU( return (u32)[openEmuSoundInterfaceBuffer usedBytes] / SPU_SAMPLE_SIZE; )
}
return (u32)[openEmuSoundInterfaceBuffer freeBytes] / SPU_SAMPLE_SIZE;
}