Cocoa Port: Add new build targets for Apple Silicon, and also clean up Release Build targets.

- Apple Silicon builds target macOS 11.0 SDK, so almost all deprecation warning associated with this have also been fixed. (The remaining deprecation warnings in preferencesWindowDelegate.mm still need to be fixed in some other way.)
- Intel 64-bit developer builds now require macOS 10.12 SDK (Xcode 8 or later). Of note, this produces faster SSE4.1 code by default, but also requires a Penryn-era Core2Duo CPU or later. (Note that Intel 64-bit non-Haswell in release builds still use SSSE3.)
- Improves overall stability when running DeSmuME on macOS 10.5 Leopard.
- In addition, release builds running Intel 64-bit non-Haswell no longer require macOS 10.7 Lion. They can run on Leopard again!
- Finally fix some GUI issues in the About box when running Dark Mode on macOS 10.14 Mojave or later.
This commit is contained in:
rogerman 2022-04-02 13:52:17 -07:00
parent 407931288a
commit e9b3998fe8
60 changed files with 5477 additions and 4068 deletions

View File

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PostActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "#!/bin/sh&#10;&#10;# This script creates an application package that merges the ppc binary of an&#10;# Xcode 3 PowerPC release build, the i386 binary of an Xcode 9 x86 32-bit &#10;# release build, and the x86_64 binary of an Xcode 12 (or later) release build.&#10;#&#10;# It also replaces the .nib files with ones that are created specifically in&#10;# Xcode 6, which is the last version of Xcode that can compile Leopard-compatible&#10;# .nib files.&#10;#&#10;# Before you build this final stage of the DeSmuME release build, make sure that&#10;# you have already created the following builds of DeSmuME and that they are all&#10;# located in the ${SRCROOT}/build/Release directory:&#10;# - DeSmuME (PPC).app | Use Xcode 3&#10;# - DeSmuME (extract NIB).app | Use Xcode 6&#10;# - DeSmuME (32bit).app | Use Xcode 9&#10;&#10;# Create the Merged Release directory, plus a working copy of the .app.&#10;mkdir -p &quot;${SRCROOT}/build/Merged Release&quot;&#10;cd &quot;${SRCROOT}/build/Merged Release&quot;&#10;cp -a &quot;${SRCROOT}/build/Release/${PRODUCT_NAME}.app&quot; &quot;./&quot;&#10;&#10;if test -e &quot;${SRCROOT}/build/Release/DeSmuME (PPC).app/Contents/MacOS/DeSmuME (PPC)&quot;&#10;then&#10;&#10;cd &quot;${SRCROOT}/build/Release/${PRODUCT_NAME}.app/Contents/MacOS&quot;&#10;&#10;# Create the temp binaries for Intel.&#10;cp -a &quot;${SRCROOT}/build/Release/DeSmuME (32bit).app/Contents/MacOS/DeSmuME (32bit)&quot; &quot;./${EXECUTABLE_NAME}_i386&quot;&#10;lipo &quot;./${EXECUTABLE_NAME}&quot; -thin x86_64 -output &quot;./${EXECUTABLE_NAME}_x86_64&quot;&#10;lipo &quot;./${EXECUTABLE_NAME}&quot; -thin x86_64h -output &quot;./${EXECUTABLE_NAME}_x86_64h&quot;&#10;&#10;# Merge the separate temp binaries into a single binary package.&#10;rm -f &quot;${SRCROOT}/build/Merged Release/${PRODUCT_NAME}.app/Contents/MacOS/${EXECUTABLE_NAME}&quot;&#10;lipo &quot;${SRCROOT}/build/Release/DeSmuME (PPC).app/Contents/MacOS/DeSmuME (PPC)&quot; &quot;./${EXECUTABLE_NAME}_i386&quot; &quot;./${EXECUTABLE_NAME}_x86_64&quot; &quot;./${EXECUTABLE_NAME}_x86_64h&quot; -create -output &quot;${SRCROOT}/build/Merged Release/${PRODUCT_NAME}.app/Contents/MacOS/${EXECUTABLE_NAME}&quot;&#10;&#10;# Remove the temp binaries now that we&apos;re done with them.&#10;rm -f &quot;./${EXECUTABLE_NAME}_i386&quot;&#10;rm -f &quot;./${EXECUTABLE_NAME}_x86_64&quot;&#10;rm -f &quot;./${EXECUTABLE_NAME}_x86_64h&quot;&#10;&#10;fi&#10;&#10;# Copy the .nib files from an &quot;extract NIB&quot; .app to the Merged Release .app&#10;cd &quot;${SRCROOT}/build/Merged Release/${PRODUCT_NAME}.app/Contents/Resources/English.lproj&quot;&#10;rm -f &quot;./MainMenu.nib&quot;&#10;rm -f &quot;./DisplayWindow.nib&quot;&#10;cp -af &quot;${SRCROOT}/build/Release/DeSmuME (extract NIB).app/Contents/Resources/English.lproj/MainMenu.nib&quot; &quot;./&quot;&#10;cp -af &quot;${SRCROOT}/build/Release/DeSmuME (extract NIB).app/Contents/Resources/English.lproj/DisplayWindow.nib&quot; &quot;./&quot;&#10;&#10;# This final stage build sets the minimum system version to macOS v10.7, so we need to reset it to macOS v10.5 here.&#10;defaults write &quot;${SRCROOT}/build/Merged Release/${PRODUCT_NAME}.app/Contents/Info.plist&quot; LSMinimumSystemVersion -string &apos;10.5&apos;&#10;&#10;# We just modified stuff in the .app, so we need to code sign again. Since this is an&#10;# open source project, we&apos;ll just use ad hoc code signing here.&#10;codesign --force --deep -s - &quot;${SRCROOT}/build/Merged Release/${PRODUCT_NAME}.app&quot;&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App; Final Stage v10.5 Leopard Release Build -- Xcode 12)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App; Final Stage v10.5 Leopard Release Build -- Xcode 12)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App; Final Stage v10.5 Leopard Release Build -- Xcode 12)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "NO"
debugXPCServices = "NO"
debugServiceExtension = "internal"
enableGPUFrameCaptureMode = "3"
enableGPUValidationMode = "1"
allowLocationSimulation = "NO">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App; Final Stage v10.5 Leopard Release Build -- Xcode 12)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "NO">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App; Final Stage v10.5 Leopard Release Build -- Xcode 12)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1320"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PostActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "cd &quot;${PROJECT_DIR}&quot;&#10;&#10;if test -d &quot;build/Release/${PRODUCT_NAME}.app&quot; ; then&#10;&#10;DESCRIBE=`git describe --always --long --dirty=&quot;+&quot;`&#10;if [ &quot;$DESCRIBE&quot; == &quot;&quot; ] ; then&#10;DESCRIBE=&quot;0&quot;&#10;fi&#10;&#10;NEWBUILDNAME=&quot;${PRODUCT_NAME} git#$DESCRIBE.app&quot;&#10;cd &quot;build/Release&quot;&#10;&#10;if test -d &quot;$NEWBUILDNAME&quot; ; then&#10;rm -rf &quot;$NEWBUILDNAME&quot;&#10;fi&#10;&#10;mv -f &quot;${PRODUCT_NAME}.app&quot; &quot;$NEWBUILDNAME&quot;&#10;&#10;fi&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8C43E74327E3CD0100A35F65"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; AppleSilicon -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8C43E74327E3CD0100A35F65"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; AppleSilicon -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8C43E74327E3CD0100A35F65"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; AppleSilicon -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8C43E74327E3CD0100A35F65"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; AppleSilicon -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8C43E8A127E3CD4C00A35F65"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; AppleSilicon dev+ -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8C43E8A127E3CD4C00A35F65"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; AppleSilicon dev+ -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8C43E8A127E3CD4C00A35F65"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; AppleSilicon dev+ -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -16,7 +16,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82" BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App with 32-bit -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</EnvironmentBuildable> </EnvironmentBuildable>
@ -34,7 +34,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82" BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App with 32-bit -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
@ -45,17 +45,19 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82" BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App with 32-bit -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
<Testables> <AdditionalOptions>
</Testables> </AdditionalOptions>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
@ -73,10 +75,12 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82" BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App with 32-bit -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release" buildConfiguration = "Release"
@ -90,7 +94,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82" BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App with 32-bit -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>

View File

@ -16,7 +16,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79013F215B84F20082AE82" BlueprintIdentifier = "AB79013F215B84F20082AE82"
BuildableName = "DeSmuME (dev+).app" BuildableName = "DeSmuME (dev+).app"
BlueprintName = "DeSmuME (OS X App with 32-bit; dev+ -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 dev+ -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
@ -32,7 +32,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79013F215B84F20082AE82" BlueprintIdentifier = "AB79013F215B84F20082AE82"
BuildableName = "DeSmuME (dev+).app" BuildableName = "DeSmuME (dev+).app"
BlueprintName = "DeSmuME (OS X App with 32-bit; dev+ -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 dev+ -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
@ -55,7 +55,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79013F215B84F20082AE82" BlueprintIdentifier = "AB79013F215B84F20082AE82"
BuildableName = "DeSmuME (dev+).app" BuildableName = "DeSmuME (dev+).app"
BlueprintName = "DeSmuME (OS X App with 32-bit; dev+ -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 dev+ -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
@ -72,7 +72,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79013F215B84F20082AE82" BlueprintIdentifier = "AB79013F215B84F20082AE82"
BuildableName = "DeSmuME (dev+).app" BuildableName = "DeSmuME (dev+).app"
BlueprintName = "DeSmuME (OS X App with 32-bit; dev+ -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Intel32 Intel64 dev+ -- Xcode 9)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>

View File

@ -16,7 +16,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB796CA415CDCBA200C59155" BlueprintIdentifier = "AB796CA415CDCBA200C59155"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</EnvironmentBuildable> </EnvironmentBuildable>
@ -34,7 +34,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB796CA415CDCBA200C59155" BlueprintIdentifier = "AB796CA415CDCBA200C59155"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
@ -50,7 +50,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB796CA415CDCBA200C59155" BlueprintIdentifier = "AB796CA415CDCBA200C59155"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
@ -75,7 +75,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB796CA415CDCBA200C59155" BlueprintIdentifier = "AB796CA415CDCBA200C59155"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
@ -92,7 +92,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB796CA415CDCBA200C59155" BlueprintIdentifier = "AB796CA415CDCBA200C59155"
BuildableName = "DeSmuME.app" BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (OS X App -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>

View File

@ -16,7 +16,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB8F3C171A53AC2600A80BF6" BlueprintIdentifier = "AB8F3C171A53AC2600A80BF6"
BuildableName = "DeSmuME (dev+).app" BuildableName = "DeSmuME (dev+).app"
BlueprintName = "DeSmuME (OS X App; dev+ -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 dev+ -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
@ -32,7 +32,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB8F3C171A53AC2600A80BF6" BlueprintIdentifier = "AB8F3C171A53AC2600A80BF6"
BuildableName = "DeSmuME (dev+).app" BuildableName = "DeSmuME (dev+).app"
BlueprintName = "DeSmuME (OS X App; dev+ -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 dev+ -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
@ -55,7 +55,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB8F3C171A53AC2600A80BF6" BlueprintIdentifier = "AB8F3C171A53AC2600A80BF6"
BuildableName = "DeSmuME (dev+).app" BuildableName = "DeSmuME (dev+).app"
BlueprintName = "DeSmuME (OS X App; dev+ -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 dev+ -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
@ -72,7 +72,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "AB8F3C171A53AC2600A80BF6" BlueprintIdentifier = "AB8F3C171A53AC2600A80BF6"
BuildableName = "DeSmuME (dev+).app" BuildableName = "DeSmuME (dev+).app"
BlueprintName = "DeSmuME (OS X App; dev+ -- Latest Xcode)" BlueprintName = "DeSmuME (macOS App; Intel64 dev+ -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB4979BB27F2E97A00E8A244"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; Release Stage 2 Leopard NIB -- Xcode 6)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB4979BB27F2E97A00E8A244"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; Release Stage 2 Leopard NIB -- Xcode 6)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB4979BB27F2E97A00E8A244"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; Release Stage 2 Leopard NIB -- Xcode 6)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB4979BB27F2E97A00E8A244"
BuildableName = "DeSmuME.app"
BlueprintName = "DeSmuME (macOS App; Release Stage 2 Leopard NIB -- Xcode 6)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -7,16 +7,16 @@
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
<BuildActionEntries> <BuildActionEntries>
<BuildActionEntry <BuildActionEntry
buildForTesting = "NO" buildForTesting = "YES"
buildForRunning = "YES" buildForRunning = "YES"
buildForProfiling = "YES" buildForProfiling = "YES"
buildForArchiving = "NO" buildForArchiving = "YES"
buildForAnalyzing = "NO"> buildForAnalyzing = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "ABE144581FBBA71A0097A4A8" BlueprintIdentifier = "AB36C73527F2C8AE00C763C8"
BuildableName = "DeSmuME (extract NIB).app" BuildableName = "DeSmuME (i386 x86_64).app"
BlueprintName = "DeSmuME (OS X App; .NIB for v10.5 Leopard Release Build -- Xcode 6)" BlueprintName = "DeSmuME (macOS App; Release Stage 3 Intel32 Intel64 -- Xcode 8)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
@ -32,9 +32,9 @@
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "ABE144581FBBA71A0097A4A8" BlueprintIdentifier = "AB36C73527F2C8AE00C763C8"
BuildableName = "DeSmuME (extract NIB).app" BuildableName = "DeSmuME (i386 x86_64).app"
BlueprintName = "DeSmuME (OS X App; .NIB for v10.5 Leopard Release Build -- Xcode 6)" BlueprintName = "DeSmuME (macOS App; Release Stage 3 Intel32 Intel64 -- Xcode 8)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
@ -55,9 +55,9 @@
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "ABE144581FBBA71A0097A4A8" BlueprintIdentifier = "AB36C73527F2C8AE00C763C8"
BuildableName = "DeSmuME (extract NIB).app" BuildableName = "DeSmuME (i386 x86_64).app"
BlueprintName = "DeSmuME (OS X App; .NIB for v10.5 Leopard Release Build -- Xcode 6)" BlueprintName = "DeSmuME (macOS App; Release Stage 3 Intel32 Intel64 -- Xcode 8)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
@ -74,9 +74,9 @@
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "ABE144581FBBA71A0097A4A8" BlueprintIdentifier = "AB36C73527F2C8AE00C763C8"
BuildableName = "DeSmuME (extract NIB).app" BuildableName = "DeSmuME (i386 x86_64).app"
BlueprintName = "DeSmuME (OS X App; .NIB for v10.5 Leopard Release Build -- Xcode 6)" BlueprintName = "DeSmuME (macOS App; Release Stage 3 Intel32 Intel64 -- Xcode 8)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>

View File

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
version = "2.0"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
<BuildActionEntries> <BuildActionEntries>
<BuildActionEntry <BuildActionEntry
buildForTesting = "NO" buildForTesting = "YES"
buildForRunning = "YES" buildForRunning = "YES"
buildForProfiling = "YES" buildForProfiling = "YES"
buildForArchiving = "NO" buildForArchiving = "YES"
buildForAnalyzing = "NO"> buildForAnalyzing = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090" BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME (32bit).app" BuildableName = "DeSmuME (x86_64h).app"
BlueprintName = "DeSmuME (OS X App; 32-bit for v10.5 Leopard Release Build -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Release Stage 4 Intel64 Haswell -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
@ -23,15 +23,15 @@
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090" BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME (32bit).app" BuildableName = "DeSmuME (x86_64h).app"
BlueprintName = "DeSmuME (OS X App; 32-bit for v10.5 Leopard Release Build -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Release Stage 4 Intel64 Haswell -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
@ -40,26 +40,21 @@
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
disableMainThreadChecker = "YES"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "NO" debugDocumentVersioning = "YES"
debugXPCServices = "NO"
debugServiceExtension = "internal" debugServiceExtension = "internal"
enableGPUFrameCaptureMode = "3" allowLocationSimulation = "YES">
enableGPUValidationMode = "1"
allowLocationSimulation = "NO"
queueDebuggingEnabled = "No">
<BuildableProductRunnable <BuildableProductRunnable
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090" BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME (32bit).app" BuildableName = "DeSmuME (x86_64h).app"
BlueprintName = "DeSmuME (OS X App; 32-bit for v10.5 Leopard Release Build -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Release Stage 4 Intel64 Haswell -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
@ -69,17 +64,17 @@
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "NO" debugDocumentVersioning = "YES">
enableTestabilityWhenProfilingTests = "No"> <BuildableProductRunnable
<MacroExpansion> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090" BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME (32bit).app" BuildableName = "DeSmuME (x86_64h).app"
BlueprintName = "DeSmuME (OS X App; 32-bit for v10.5 Leopard Release Build -- Xcode 9)" BlueprintName = "DeSmuME (macOS App; Release Stage 4 Intel64 Haswell -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </BuildableProductRunnable>
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug"> buildConfiguration = "Debug">

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PostActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "#!/bin/sh&#10;&#10;# This script creates an application package that merges the ppc32 binary of a&#10;# PowerPC release build, the i386 binary of an Intel 32-bit release build, the&#10;# x86_64/x86_64h binaries of an Intel 64-bit release build, and the arm64 binary&#10;# of an Apple Silicon release build.&#10;#&#10;# It also replaces the .nib files with ones that are created specifically in&#10;# Xcode 6, which is the last version of Xcode that can compile Leopard-compatible&#10;# .nib files. This script also ensures that the Minimum System Version is reduced&#10;# to v10.5.&#10;#&#10;# Finally, code-signing is redone to account for all of the .app changes that&#10;# we&apos;re doing here.&#10;#&#10;# Before you build this final stage of the DeSmuME release build, make sure that&#10;# you have already created the following builds of DeSmuME and that they are all&#10;# located in the ${SRCROOT}/build/Release directory:&#10;# 1. DeSmuME (PPC).app | PowerPC 32-bit, use Xcode 3&#10;# 2. DeSmuME.app | Leopard NIB, use Xcode 6&#10;# 3. DeSmuME (i386 x86_64).app | Intel 32-bit and 64-bit, use Xcode 8&#10;# 4. DeSmuME (x86_64h).app | Intel 64-bit Haswell, use latest Xcode&#10;# 5. DeSmuME (arm64).app | Apple Silicon, use latest Xcode&#10;&#10;# Create the Merged Release directory, plus a working copy of the .app.&#10;mkdir -p &quot;${SRCROOT}/build/Merged Release&quot;&#10;cd &quot;${SRCROOT}/build/Merged Release&quot;&#10;cp -a &quot;${SRCROOT}/build/Release/DeSmuME.app&quot; &quot;./&quot;&#10;&#10;if test -e &quot;${SRCROOT}/build/Release/DeSmuME (ppc32).app/Contents/MacOS/DeSmuME (ppc32)&quot;&#10;then&#10;&#10;mkdir -p &quot;${SRCROOT}/build/Merged Release/DeSmuME.app/Contents/MacOS&quot;&#10;cd &quot;${SRCROOT}/build/Merged Release/DeSmuME.app/Contents/MacOS&quot;&#10;&#10;# Create the temp binaries for Intel.&#10;lipo &quot;${SRCROOT}/build/Release/DeSmuME (i386 x86_64).app/Contents/MacOS/DeSmuME (i386 x86_64)&quot; -thin i386 -output &quot;./DeSmuME_i386&quot;&#10;lipo &quot;${SRCROOT}/build/Release/DeSmuME (i386 x86_64).app/Contents/MacOS/DeSmuME (i386 x86_64)&quot; -thin x86_64 -output &quot;./DeSmuME_x86_64&quot;&#10;&#10;# Merge the separate temp binaries into a single binary package.&#10;lipo &quot;${SRCROOT}/build/Release/DeSmuME (arm64).app/Contents/MacOS/DeSmuME (arm64)&quot; &quot;${SRCROOT}/build/Release/DeSmuME (x86_64h).app/Contents/MacOS/DeSmuME (x86_64h)&quot; &quot;./DeSmuME_x86_64&quot; &quot;./DeSmuME_i386&quot; &quot;${SRCROOT}/build/Release/DeSmuME (ppc32).app/Contents/MacOS/DeSmuME (ppc32)&quot; -create -output &quot;./DeSmuME&quot;&#10;&#10;# Remove the temp binaries now that we&apos;re done with them.&#10;rm -f &quot;./DeSmuME_i386&quot;&#10;rm -f &quot;./DeSmuME_x86_64&quot;&#10;&#10;fi&#10;&#10;cd &quot;${SRCROOT}/build/Merged Release/DeSmuME.app/Contents/Resources&quot;&#10;cp -af &quot;${SRCROOT}/build/Release/DeSmuME (x86_64h).app/Contents/Resources/default.metallib&quot; &quot;./&quot;&#10;&#10;# We just modified stuff in the .app, so we need to code sign again. Since this is an&#10;# open source project, we&apos;ll just use ad hoc code signing here.&#10;codesign --force --deep -s - &quot;${SRCROOT}/build/Merged Release/DeSmuME.app&quot;&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8CCD83B527E40B730024BDD5"
BuildableName = "DeSmuME (arm64).app"
BlueprintName = "DeSmuME (macOS App; Release Stage Final AppleSilicon -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8CCD83B527E40B730024BDD5"
BuildableName = "DeSmuME (arm64).app"
BlueprintName = "DeSmuME (macOS App; Release Stage Final AppleSilicon -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8CCD83B527E40B730024BDD5"
BuildableName = "DeSmuME (arm64).app"
BlueprintName = "DeSmuME (macOS App; Release Stage Final AppleSilicon -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8CCD83B527E40B730024BDD5"
BuildableName = "DeSmuME (arm64).app"
BlueprintName = "DeSmuME (macOS App; Release Stage Final AppleSilicon -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1918,7 +1918,7 @@
AB27CD3C1F99169300396812 /* lvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lvm.h; sourceTree = "<group>"; }; AB27CD3C1F99169300396812 /* lvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lvm.h; sourceTree = "<group>"; };
AB27CD3D1F99169300396812 /* lzio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzio.c; sourceTree = "<group>"; }; AB27CD3D1F99169300396812 /* lzio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzio.c; sourceTree = "<group>"; };
AB27CD3E1F99169300396812 /* lzio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lzio.h; sourceTree = "<group>"; }; AB27CD3E1F99169300396812 /* lzio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lzio.h; sourceTree = "<group>"; };
AB2A9A791725F00F0062C1A1 /* DeSmuME (PPC).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (PPC).app"; sourceTree = BUILT_PRODUCTS_DIR; }; AB2A9A791725F00F0062C1A1 /* DeSmuME (ppc32).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (ppc32).app"; sourceTree = BUILT_PRODUCTS_DIR; };
AB2C25061DEBFBD400706BFC /* encoding_utf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = encoding_utf.c; sourceTree = "<group>"; }; AB2C25061DEBFBD400706BFC /* encoding_utf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = encoding_utf.c; sourceTree = "<group>"; };
AB2F3C4515CF9C6000858373 /* DeSmuME (PPC).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (PPC).app"; sourceTree = BUILT_PRODUCTS_DIR; }; AB2F3C4515CF9C6000858373 /* DeSmuME (PPC).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (PPC).app"; sourceTree = BUILT_PRODUCTS_DIR; };
AB2F56EE1704C86900E28885 /* utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utilities.h; sourceTree = "<group>"; }; AB2F56EE1704C86900E28885 /* utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utilities.h; sourceTree = "<group>"; };
@ -2561,7 +2561,7 @@
AB73AA331507C9F500A310C8 /* DeSmuME.app */, AB73AA331507C9F500A310C8 /* DeSmuME.app */,
ABAD104915ACE7A00000EC47 /* DeSmuME (PPC).app */, ABAD104915ACE7A00000EC47 /* DeSmuME (PPC).app */,
AB2F3C4515CF9C6000858373 /* DeSmuME (PPC).app */, AB2F3C4515CF9C6000858373 /* DeSmuME (PPC).app */,
AB2A9A791725F00F0062C1A1 /* DeSmuME (PPC).app */, AB2A9A791725F00F0062C1A1 /* DeSmuME (ppc32).app */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -3692,9 +3692,9 @@
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
AB2A99A41725F00F0062C1A1 /* DeSmuME (OS X App; PowerPC Release Build) */ = { AB2A99A41725F00F0062C1A1 /* DeSmuME (macOS App; Release Stage 1 PowerPC32 -- Xcode 3) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = AB2A9A761725F00F0062C1A1 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; PowerPC Release Build)" */; buildConfigurationList = AB2A9A761725F00F0062C1A1 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; Release Stage 1 PowerPC32 -- Xcode 3)" */;
buildPhases = ( buildPhases = (
AB2A99A51725F00F0062C1A1 /* ShellScript */, AB2A99A51725F00F0062C1A1 /* ShellScript */,
AB2A99A61725F00F0062C1A1 /* Resources */, AB2A99A61725F00F0062C1A1 /* Resources */,
@ -3706,15 +3706,15 @@
); );
dependencies = ( dependencies = (
); );
name = "DeSmuME (OS X App; PowerPC Release Build)"; name = "DeSmuME (macOS App; Release Stage 1 PowerPC32 -- Xcode 3)";
productInstallPath = "$(HOME)/Applications"; productInstallPath = "$(HOME)/Applications";
productName = DeSmuME; productName = DeSmuME;
productReference = AB2A9A791725F00F0062C1A1 /* DeSmuME (PPC).app */; productReference = AB2A9A791725F00F0062C1A1 /* DeSmuME (ppc32).app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
AB2F3B7A15CF9C6000858373 /* DeSmuME (OS X App; PowerPC; LLVM-GCC) */ = { AB2F3B7A15CF9C6000858373 /* DeSmuME (macOS App; PowerPC; LLVM-GCC) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = AB2F3C4215CF9C6000858373 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; PowerPC; LLVM-GCC)" */; buildConfigurationList = AB2F3C4215CF9C6000858373 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; PowerPC; LLVM-GCC)" */;
buildPhases = ( buildPhases = (
AB2F3B7B15CF9C6000858373 /* ShellScript */, AB2F3B7B15CF9C6000858373 /* ShellScript */,
AB2F3B7C15CF9C6000858373 /* Resources */, AB2F3B7C15CF9C6000858373 /* Resources */,
@ -3726,15 +3726,15 @@
); );
dependencies = ( dependencies = (
); );
name = "DeSmuME (OS X App; PowerPC; LLVM-GCC)"; name = "DeSmuME (macOS App; PowerPC; LLVM-GCC)";
productInstallPath = "$(HOME)/Applications"; productInstallPath = "$(HOME)/Applications";
productName = DeSmuME; productName = DeSmuME;
productReference = AB2F3C4515CF9C6000858373 /* DeSmuME (PPC).app */; productReference = AB2F3C4515CF9C6000858373 /* DeSmuME (PPC).app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
AB711EBD1481C35F009011C8 /* DeSmuME (OS X App; Intel; LLVM-Clang) */ = { AB711EBD1481C35F009011C8 /* DeSmuME (macOS App; Intel; LLVM-Clang) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = AB711F7C1481C35F009011C8 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; Intel; LLVM-Clang)" */; buildConfigurationList = AB711F7C1481C35F009011C8 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; Intel; LLVM-Clang)" */;
buildPhases = ( buildPhases = (
AB75222C14C799C1009B97B3 /* ShellScript */, AB75222C14C799C1009B97B3 /* ShellScript */,
AB711EBE1481C35F009011C8 /* Resources */, AB711EBE1481C35F009011C8 /* Resources */,
@ -3746,15 +3746,15 @@
); );
dependencies = ( dependencies = (
); );
name = "DeSmuME (OS X App; Intel; LLVM-Clang)"; name = "DeSmuME (macOS App; Intel; LLVM-Clang)";
productInstallPath = "$(HOME)/Applications"; productInstallPath = "$(HOME)/Applications";
productName = DeSmuME; productName = DeSmuME;
productReference = AB711F7F1481C35F009011C8 /* DeSmuME.app */; productReference = AB711F7F1481C35F009011C8 /* DeSmuME.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
AB73A9671507C9F500A310C8 /* DeSmuME (OS X App; Intel; LLVM-GCC) */ = { AB73A9671507C9F500A310C8 /* DeSmuME (macOS App; Intel; LLVM-GCC) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = AB73AA301507C9F500A310C8 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; Intel; LLVM-GCC)" */; buildConfigurationList = AB73AA301507C9F500A310C8 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; Intel; LLVM-GCC)" */;
buildPhases = ( buildPhases = (
AB73A9681507C9F500A310C8 /* ShellScript */, AB73A9681507C9F500A310C8 /* ShellScript */,
AB73A9691507C9F500A310C8 /* Resources */, AB73A9691507C9F500A310C8 /* Resources */,
@ -3766,15 +3766,15 @@
); );
dependencies = ( dependencies = (
); );
name = "DeSmuME (OS X App; Intel; LLVM-GCC)"; name = "DeSmuME (macOS App; Intel; LLVM-GCC)";
productInstallPath = "$(HOME)/Applications"; productInstallPath = "$(HOME)/Applications";
productName = DeSmuME; productName = DeSmuME;
productReference = AB73AA331507C9F500A310C8 /* DeSmuME.app */; productReference = AB73AA331507C9F500A310C8 /* DeSmuME.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
ABAD0F7015ACE7A00000EC47 /* DeSmuME (OS X App; PowerPC; LLVM-Clang) */ = { ABAD0F7015ACE7A00000EC47 /* DeSmuME (macOS App; PowerPC; LLVM-Clang) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = ABAD104615ACE7A00000EC47 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; PowerPC; LLVM-Clang)" */; buildConfigurationList = ABAD104615ACE7A00000EC47 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; PowerPC; LLVM-Clang)" */;
buildPhases = ( buildPhases = (
ABAD0F7115ACE7A00000EC47 /* ShellScript */, ABAD0F7115ACE7A00000EC47 /* ShellScript */,
ABAD0F7215ACE7A00000EC47 /* Resources */, ABAD0F7215ACE7A00000EC47 /* Resources */,
@ -3786,7 +3786,7 @@
); );
dependencies = ( dependencies = (
); );
name = "DeSmuME (OS X App; PowerPC; LLVM-Clang)"; name = "DeSmuME (macOS App; PowerPC; LLVM-Clang)";
productInstallPath = "$(HOME)/Applications"; productInstallPath = "$(HOME)/Applications";
productName = DeSmuME; productName = DeSmuME;
productReference = ABAD104915ACE7A00000EC47 /* DeSmuME (PPC).app */; productReference = ABAD104915ACE7A00000EC47 /* DeSmuME (PPC).app */;
@ -3818,11 +3818,11 @@
projectDirPath = ""; projectDirPath = "";
projectRoot = ""; projectRoot = "";
targets = ( targets = (
AB711EBD1481C35F009011C8 /* DeSmuME (OS X App; Intel; LLVM-Clang) */, AB711EBD1481C35F009011C8 /* DeSmuME (macOS App; Intel; LLVM-Clang) */,
AB73A9671507C9F500A310C8 /* DeSmuME (OS X App; Intel; LLVM-GCC) */, AB73A9671507C9F500A310C8 /* DeSmuME (macOS App; Intel; LLVM-GCC) */,
ABAD0F7015ACE7A00000EC47 /* DeSmuME (OS X App; PowerPC; LLVM-Clang) */, ABAD0F7015ACE7A00000EC47 /* DeSmuME (macOS App; PowerPC; LLVM-Clang) */,
AB2F3B7A15CF9C6000858373 /* DeSmuME (OS X App; PowerPC; LLVM-GCC) */, AB2F3B7A15CF9C6000858373 /* DeSmuME (macOS App; PowerPC; LLVM-GCC) */,
AB2A99A41725F00F0062C1A1 /* DeSmuME (OS X App; PowerPC Release Build) */, AB2A99A41725F00F0062C1A1 /* DeSmuME (macOS App; Release Stage 1 PowerPC32 -- Xcode 3) */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
@ -5604,9 +5604,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ARCHS = ppc; ARCHS = ppc;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
"GCC_MODEL_TUNING[sdk=macosx10.5][arch=ppc]" = G5; "GCC_MODEL_TUNING[sdk=macosx10.5][arch=ppc]" = G5;
PRODUCT_NAME = "DeSmuME (Debug-PPC)"; PRODUCT_NAME = "DeSmuME (ppc)";
SDKROOT = macosx10.5; SDKROOT = macosx10.5;
SKIP_INSTALL = NO; SKIP_INSTALL = NO;
}; };
@ -5620,7 +5619,7 @@
NDEBUG, NDEBUG,
PUBLIC_RELEASE, PUBLIC_RELEASE,
); );
PRODUCT_NAME = "DeSmuME (PPC)"; PRODUCT_NAME = "DeSmuME (ppc32)";
SDKROOT = macosx10.5; SDKROOT = macosx10.5;
}; };
name = Release; name = Release;
@ -5632,7 +5631,6 @@
ppc, ppc,
ppc64, ppc64,
); );
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_VERSION = com.apple.compilers.llvmgcc42;
"GCC_VERSION[sdk=macosx10.5][arch=ppc64]" = 4.2; "GCC_VERSION[sdk=macosx10.5][arch=ppc64]" = 4.2;
PRODUCT_NAME = "DeSmuME (Debug-PPC)"; PRODUCT_NAME = "DeSmuME (Debug-PPC)";
@ -5658,7 +5656,6 @@
AB711F7D1481C35F009011C8 /* Debug */ = { AB711F7D1481C35F009011C8 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"-weak_library", "-weak_library",
/usr/lib/libSystem.B.dylib, /usr/lib/libSystem.B.dylib,
@ -5680,7 +5677,6 @@
AB73AA311507C9F500A310C8 /* Debug */ = { AB73AA311507C9F500A310C8 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_VERSION = com.apple.compilers.llvmgcc42;
"GCC_VERSION[sdk=macosx10.5][arch=ppc64]" = 4.2; "GCC_VERSION[sdk=macosx10.5][arch=ppc64]" = 4.2;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
@ -5710,7 +5706,6 @@
ppc, ppc,
ppc64, ppc64,
); );
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
PRODUCT_NAME = "DeSmuME (Debug-PPC)"; PRODUCT_NAME = "DeSmuME (Debug-PPC)";
SDKROOT = macosx10.5; SDKROOT = macosx10.5;
SKIP_INSTALL = NO; SKIP_INSTALL = NO;
@ -5783,7 +5778,7 @@
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-I./../../"; OTHER_CFLAGS = "-I./../../";
PRODUCT_NAME = "DeSmuME (Debug)"; PRODUCT_NAME = "DeSmuME (Debug)";
SDKROOT = macosx; SDKROOT = macosx10.6;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO; STRIP_INSTALLED_PRODUCT = NO;
}; };
@ -5838,7 +5833,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.5; MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_CFLAGS = "-I./../../"; OTHER_CFLAGS = "-I./../../";
PRODUCT_NAME = DeSmuME; PRODUCT_NAME = DeSmuME;
SDKROOT = macosx; SDKROOT = macosx10.6;
STRIP_INSTALLED_PRODUCT = NO; STRIP_INSTALLED_PRODUCT = NO;
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
}; };
@ -5847,7 +5842,7 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
AB2A9A761725F00F0062C1A1 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; PowerPC Release Build)" */ = { AB2A9A761725F00F0062C1A1 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; Release Stage 1 PowerPC32 -- Xcode 3)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
AB2A9A771725F00F0062C1A1 /* Debug */, AB2A9A771725F00F0062C1A1 /* Debug */,
@ -5856,7 +5851,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
AB2F3C4215CF9C6000858373 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; PowerPC; LLVM-GCC)" */ = { AB2F3C4215CF9C6000858373 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; PowerPC; LLVM-GCC)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
AB2F3C4315CF9C6000858373 /* Debug */, AB2F3C4315CF9C6000858373 /* Debug */,
@ -5865,7 +5860,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
AB711F7C1481C35F009011C8 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; Intel; LLVM-Clang)" */ = { AB711F7C1481C35F009011C8 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; Intel; LLVM-Clang)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
AB711F7D1481C35F009011C8 /* Debug */, AB711F7D1481C35F009011C8 /* Debug */,
@ -5874,7 +5869,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
AB73AA301507C9F500A310C8 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; Intel; LLVM-GCC)" */ = { AB73AA301507C9F500A310C8 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; Intel; LLVM-GCC)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
AB73AA311507C9F500A310C8 /* Debug */, AB73AA311507C9F500A310C8 /* Debug */,
@ -5883,7 +5878,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
ABAD104615ACE7A00000EC47 /* Build configuration list for PBXNativeTarget "DeSmuME (OS X App; PowerPC; LLVM-Clang)" */ = { ABAD104615ACE7A00000EC47 /* Build configuration list for PBXNativeTarget "DeSmuME (macOS App; PowerPC; LLVM-Clang)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
ABAD104715ACE7A00000EC47 /* Debug */, ABAD104715ACE7A00000EC47 /* Debug */,

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2014-2021 DeSmuME team Copyright (C) 2014-2022 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
@ -364,6 +364,10 @@ static const char *Sample1x1_VertShader_110 = {"\
}\n\ }\n\
"}; "};
// For the sake of completeness, we need a 2x2 version of this vertex
// shader just in case a future fragment shader needs it. Therefore,
// silencing the unused variable warning is justified here.
SILENCE_WARNING_UNUSED_VARIABLE_BEGIN
static const char *Sample2x2_VertShader_110 = {"\ static const char *Sample2x2_VertShader_110 = {"\
//---------------------------------------\n\ //---------------------------------------\n\
// Input Pixel Mapping: 00|01\n\ // Input Pixel Mapping: 00|01\n\
@ -383,6 +387,7 @@ static const char *Sample2x2_VertShader_110 = {"\
gl_Position = vec4(inPosition, 0.0, 1.0);\n\ gl_Position = vec4(inPosition, 0.0, 1.0);\n\
}\n\ }\n\
"}; "};
SILENCE_WARNING_UNUSED_VARIABLE_END
static const char *Sample3x3_VertShader_110 = {"\ static const char *Sample3x3_VertShader_110 = {"\
//---------------------------------------\n\ //---------------------------------------\n\

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2018 DeSmuME team Copyright (C) 2013-2022 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
@ -18,12 +18,12 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <CoreVideo/CoreVideo.h> #import <CoreVideo/CoreVideo.h>
#include <pthread.h> #include <pthread.h>
#include <libkern/OSAtomic.h>
#include <mach/task.h> #include <mach/task.h>
#include <mach/semaphore.h> #include <mach/semaphore.h>
#include <mach/sync_policy.h> #include <mach/sync_policy.h>
#include <map> #include <map>
#include <vector> #include <vector>
#include "utilities.h"
#import "cocoa_util.h" #import "cocoa_util.h"
#include "../../GPU.h" #include "../../GPU.h"
@ -70,7 +70,7 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
GPUClientFetchObject *GPUFetchObject; GPUClientFetchObject *GPUFetchObject;
task_t _taskEmulationLoop; task_t _taskEmulationLoop;
OSSpinLock _spinlockFramebufferStates[MAX_FRAMEBUFFER_PAGES]; apple_unfairlock_t _unfairlockFramebufferStates[MAX_FRAMEBUFFER_PAGES];
semaphore_t _semFramebuffer[MAX_FRAMEBUFFER_PAGES]; semaphore_t _semFramebuffer[MAX_FRAMEBUFFER_PAGES];
volatile ClientDisplayBufferState _framebufferState[MAX_FRAMEBUFFER_PAGES]; volatile ClientDisplayBufferState _framebufferState[MAX_FRAMEBUFFER_PAGES];
@ -82,7 +82,6 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
DisplayLinksActiveMap _displayLinksActiveList; DisplayLinksActiveMap _displayLinksActiveList;
DisplayLinkFlushTimeLimitMap _displayLinkFlushTimeList; DisplayLinkFlushTimeLimitMap _displayLinkFlushTimeList;
OSSpinLock spinlockFetchSignal;
uint32_t _threadMessageID; uint32_t _threadMessageID;
uint8_t _fetchIndex; uint8_t _fetchIndex;
pthread_t _threadFetch; pthread_t _threadFetch;
@ -128,7 +127,7 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
BOOL isCPUCoreCountAuto; BOOL isCPUCoreCountAuto;
BOOL _needRestoreRender3DLock; BOOL _needRestoreRender3DLock;
OSSpinLock spinlockGpuState; apple_unfairlock_t _unfairlockGpuState;
GPUEventHandlerOSX *gpuEvent; GPUEventHandlerOSX *gpuEvent;
GPUClientFetchObject *fetchObject; GPUClientFetchObject *fetchObject;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2021 DeSmuME team Copyright (C) 2013-2022 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
@ -141,7 +141,7 @@ public:
return self; return self;
} }
spinlockGpuState = OS_SPINLOCK_INIT; _unfairlockGpuState = apple_unfairlock_create();
_gpuScale = 1; _gpuScale = 1;
gpuStateFlags = GPUSTATE_MAIN_GPU_MASK | gpuStateFlags = GPUSTATE_MAIN_GPU_MASK |
@ -234,6 +234,8 @@ public:
[self setRender3DMultisampleSizeString:nil]; [self setRender3DMultisampleSizeString:nil];
apple_unfairlock_destroy(_unfairlockGpuState);
[super dealloc]; [super dealloc];
} }
@ -249,9 +251,9 @@ public:
- (void) setGpuStateFlags:(UInt32)flags - (void) setGpuStateFlags:(UInt32)flags
{ {
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = flags; gpuStateFlags = flags;
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
[self setLayerMainGPU:((flags & GPUSTATE_MAIN_GPU_MASK) != 0)]; [self setLayerMainGPU:((flags & GPUSTATE_MAIN_GPU_MASK) != 0)];
[self setLayerMainBG0:((flags & GPUSTATE_MAIN_BG0_MASK) != 0)]; [self setLayerMainBG0:((flags & GPUSTATE_MAIN_BG0_MASK) != 0)];
@ -270,9 +272,9 @@ public:
- (UInt32) gpuStateFlags - (UInt32) gpuStateFlags
{ {
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
const UInt32 flags = gpuStateFlags; const UInt32 flags = gpuStateFlags;
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
return flags; return flags;
} }
@ -814,9 +816,9 @@ public:
GPU->GetEngineMain()->SetEnableState((gpuState) ? true : false); GPU->GetEngineMain()->SetEnableState((gpuState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (gpuState) ? (gpuStateFlags | GPUSTATE_MAIN_GPU_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_GPU_MASK); gpuStateFlags = (gpuState) ? (gpuStateFlags | GPUSTATE_MAIN_GPU_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_GPU_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerMainGPU - (BOOL) layerMainGPU
@ -834,9 +836,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG0, (layerState) ? true : false); GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG0, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG0_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG0_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG0_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG0_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerMainBG0 - (BOOL) layerMainBG0
@ -854,9 +856,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG1, (layerState) ? true : false); GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG1, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG1_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG1_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG1_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG1_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerMainBG1 - (BOOL) layerMainBG1
@ -874,9 +876,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG2, (layerState) ? true : false); GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG2, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG2_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG2_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG2_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG2_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerMainBG2 - (BOOL) layerMainBG2
@ -894,9 +896,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG3, (layerState) ? true : false); GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG3, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG3_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG3_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG3_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG3_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerMainBG3 - (BOOL) layerMainBG3
@ -914,9 +916,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_OBJ, (layerState) ? true : false); GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_OBJ, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_OBJ_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_OBJ_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_OBJ_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_OBJ_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerMainOBJ - (BOOL) layerMainOBJ
@ -934,9 +936,9 @@ public:
GPU->GetEngineSub()->SetEnableState((gpuState) ? true : false); GPU->GetEngineSub()->SetEnableState((gpuState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (gpuState) ? (gpuStateFlags | GPUSTATE_SUB_GPU_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_GPU_MASK); gpuStateFlags = (gpuState) ? (gpuStateFlags | GPUSTATE_SUB_GPU_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_GPU_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerSubGPU - (BOOL) layerSubGPU
@ -954,9 +956,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG0, (layerState) ? true : false); GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG0, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG0_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG0_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG0_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG0_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerSubBG0 - (BOOL) layerSubBG0
@ -974,9 +976,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG1, (layerState) ? true : false); GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG1, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG1_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG1_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG1_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG1_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerSubBG1 - (BOOL) layerSubBG1
@ -994,9 +996,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG2, (layerState) ? true : false); GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG2, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG2_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG2_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG2_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG2_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerSubBG2 - (BOOL) layerSubBG2
@ -1014,9 +1016,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG3, (layerState) ? true : false); GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG3, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG3_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG3_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG3_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG3_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerSubBG3 - (BOOL) layerSubBG3
@ -1034,9 +1036,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_OBJ, (layerState) ? true : false); GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_OBJ, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock(); gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState); apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_OBJ_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_OBJ_MASK); gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_OBJ_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_OBJ_MASK);
OSSpinLockUnlock(&spinlockGpuState); apple_unfairlock_unlock(_unfairlockGpuState);
} }
- (BOOL) layerSubOBJ - (BOOL) layerSubOBJ
@ -1151,7 +1153,6 @@ public:
_displayLinkFlushTimeList.clear(); _displayLinkFlushTimeList.clear();
[self displayLinkListUpdate]; [self displayLinkListUpdate];
spinlockFetchSignal = OS_SPINLOCK_INIT;
_threadMessageID = MESSAGE_NONE; _threadMessageID = MESSAGE_NONE;
_fetchIndex = 0; _fetchIndex = 0;
pthread_cond_init(&_condSignalFetch, NULL); pthread_cond_init(&_condSignalFetch, NULL);
@ -1175,7 +1176,7 @@ public:
{ {
_semFramebuffer[i] = 0; _semFramebuffer[i] = 0;
_framebufferState[i] = ClientDisplayBufferState_Idle; _framebufferState[i] = ClientDisplayBufferState_Idle;
_spinlockFramebufferStates[i] = OS_SPINLOCK_INIT; _unfairlockFramebufferStates[i] = apple_unfairlock_create();
} }
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
@ -1335,18 +1336,18 @@ public:
- (ClientDisplayBufferState) framebufferStateAtIndex:(uint8_t)index - (ClientDisplayBufferState) framebufferStateAtIndex:(uint8_t)index
{ {
OSSpinLockLock(&_spinlockFramebufferStates[index]); apple_unfairlock_lock(_unfairlockFramebufferStates[index]);
const ClientDisplayBufferState bufferState = _framebufferState[index]; const ClientDisplayBufferState bufferState = _framebufferState[index];
OSSpinLockUnlock(&_spinlockFramebufferStates[index]); apple_unfairlock_unlock(_unfairlockFramebufferStates[index]);
return bufferState; return bufferState;
} }
- (void) setFramebufferState:(ClientDisplayBufferState)bufferState index:(uint8_t)index - (void) setFramebufferState:(ClientDisplayBufferState)bufferState index:(uint8_t)index
{ {
OSSpinLockLock(&_spinlockFramebufferStates[index]); apple_unfairlock_lock(_unfairlockFramebufferStates[index]);
_framebufferState[index] = bufferState; _framebufferState[index] = bufferState;
OSSpinLockUnlock(&_spinlockFramebufferStates[index]); apple_unfairlock_unlock(_unfairlockFramebufferStates[index]);
} }
- (void) setOutputList:(NSMutableArray *)theOutputList rwlock:(pthread_rwlock_t *)theRWLock - (void) setOutputList:(NSMutableArray *)theOutputList rwlock:(pthread_rwlock_t *)theRWLock
@ -1372,12 +1373,12 @@ public:
- (void) incrementViewsUsingDirectToCPUFiltering - (void) incrementViewsUsingDirectToCPUFiltering
{ {
OSAtomicIncrement32(&numberViewsUsingDirectToCPUFiltering); atomic_inc_32(&numberViewsUsingDirectToCPUFiltering);
} }
- (void) decrementViewsUsingDirectToCPUFiltering - (void) decrementViewsUsingDirectToCPUFiltering
{ {
OSAtomicDecrement32(&numberViewsUsingDirectToCPUFiltering); atomic_dec_32(&numberViewsUsingDirectToCPUFiltering);
} }
- (void) pushVideoDataToAllDisplayViews - (void) pushVideoDataToAllDisplayViews
@ -1759,11 +1760,7 @@ bool GPUEventHandlerOSX::GetRender3DNeedsFinish()
#pragma mark - #pragma mark -
CGLContextObj OSXOpenGLRendererContext = NULL; CGLContextObj OSXOpenGLRendererContext = NULL;
SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj OSXOpenGLRendererPBuffer = NULL );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
CGLPBufferObj OSXOpenGLRendererPBuffer = NULL;
#pragma GCC diagnostic pop
#ifdef ENABLE_SHARED_FETCH_OBJECT #ifdef ENABLE_SHARED_FETCH_OBJECT
@ -1820,9 +1817,6 @@ void OSXOpenGLRendererEnd()
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w, size_t h) bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w, size_t h)
{ {
bool result = false; bool result = false;
@ -1840,8 +1834,8 @@ bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w,
} }
// Create a PBuffer if FBOs are not supported. // Create a PBuffer if FBOs are not supported.
CGLPBufferObj newPBuffer = NULL; SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj newPBuffer = NULL );
CGLError error = CGLCreatePBuffer(w, h, GL_TEXTURE_2D, GL_RGBA, 0, &newPBuffer); SILENCE_DEPRECATION_MACOS_10_7( CGLError error = CGLCreatePBuffer(w, h, GL_TEXTURE_2D, GL_RGBA, 0, &newPBuffer) );
if ( (newPBuffer == NULL) || (error != kCGLNoError) ) if ( (newPBuffer == NULL) || (error != kCGLNoError) )
{ {
@ -1852,19 +1846,17 @@ bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w,
{ {
GLint virtualScreenID = 0; GLint virtualScreenID = 0;
CGLGetVirtualScreen(OSXOpenGLRendererContext, &virtualScreenID); CGLGetVirtualScreen(OSXOpenGLRendererContext, &virtualScreenID);
CGLSetPBuffer(OSXOpenGLRendererContext, newPBuffer, 0, 0, virtualScreenID); SILENCE_DEPRECATION_MACOS_10_7( CGLSetPBuffer(OSXOpenGLRendererContext, newPBuffer, 0, 0, virtualScreenID) );
} }
CGLPBufferObj oldPBuffer = OSXOpenGLRendererPBuffer; SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj oldPBuffer = OSXOpenGLRendererPBuffer );
OSXOpenGLRendererPBuffer = newPBuffer; OSXOpenGLRendererPBuffer = newPBuffer;
CGLReleasePBuffer(oldPBuffer); SILENCE_DEPRECATION_MACOS_10_7( CGLReleasePBuffer(oldPBuffer) );
result = true; result = true;
return result; return result;
} }
#pragma GCC diagnostic pop
bool CreateOpenGLRenderer() bool CreateOpenGLRenderer()
{ {
bool result = false; bool result = false;
@ -1920,9 +1912,6 @@ bool CreateOpenGLRenderer()
return result; return result;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void DestroyOpenGLRenderer() void DestroyOpenGLRenderer()
{ {
if (OSXOpenGLRendererContext == NULL) if (OSXOpenGLRendererContext == NULL)
@ -1930,15 +1919,13 @@ void DestroyOpenGLRenderer()
return; return;
} }
CGLReleasePBuffer(OSXOpenGLRendererPBuffer); SILENCE_DEPRECATION_MACOS_10_7( CGLReleasePBuffer(OSXOpenGLRendererPBuffer) );
OSXOpenGLRendererPBuffer = NULL; OSXOpenGLRendererPBuffer = NULL;
CGLReleaseContext(OSXOpenGLRendererContext); CGLReleaseContext(OSXOpenGLRendererContext);
OSXOpenGLRendererContext = NULL; OSXOpenGLRendererContext = NULL;
} }
#pragma GCC diagnostic pop
void RequestOpenGLRenderer_3_2(bool request_3_2) void RequestOpenGLRenderer_3_2(bool request_3_2)
{ {
#ifdef OGLRENDER_3_2_H #ifdef OGLRENDER_3_2_H

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2021 DeSmuME team Copyright (C) 2011-2022 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
@ -18,7 +18,6 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <pthread.h> #include <pthread.h>
#include <libkern/OSAtomic.h>
#include <string> #include <string>
#import "cocoa_util.h" #import "cocoa_util.h"
@ -65,16 +64,15 @@ typedef struct
NSString *firmwareMACAddressSelectionString; NSString *firmwareMACAddressSelectionString;
NSString *currentSessionMACAddressString; NSString *currentSessionMACAddressString;
OSSpinLock spinlockCdsController; apple_unfairlock_t _unfairlockMasterExecute;
OSSpinLock spinlockMasterExecute;
} }
@property (readonly, nonatomic) ClientExecutionControl *execControl; @property (readonly, nonatomic) ClientExecutionControl *execControl;
@property (retain) CocoaDSController *cdsController;
@property (retain) CocoaDSFirmware *cdsFirmware; @property (retain) CocoaDSFirmware *cdsFirmware;
@property (retain) CocoaDSGPU *cdsGPU; @property (readonly) CocoaDSController *cdsController;
@property (retain) NSMutableArray *cdsOutputList; @property (readonly) CocoaDSGPU *cdsGPU;
@property (readonly) NSMutableArray *cdsOutputList;
@property (assign) BOOL masterExecute; @property (assign) BOOL masterExecute;
@property (assign) BOOL isFrameSkipEnabled; @property (assign) BOOL isFrameSkipEnabled;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2021 DeSmuME team Copyright (C) 2011-2022 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
@ -35,6 +35,7 @@
#include "../../slot1.h" #include "../../slot1.h"
#include "../../slot2.h" #include "../../slot2.h"
#include "../../SPU.h" #include "../../SPU.h"
#include "../../wifi.h"
#undef BOOL #undef BOOL
//accessed from other files //accessed from other files
@ -44,8 +45,8 @@ volatile bool execute = true;
@synthesize execControl; @synthesize execControl;
@dynamic cdsController;
@synthesize cdsFirmware; @synthesize cdsFirmware;
@synthesize cdsController;
@synthesize cdsGPU; @synthesize cdsGPU;
@synthesize cdsOutputList; @synthesize cdsOutputList;
@ -119,17 +120,16 @@ volatile bool execute = true;
_isTimerAtSecond = NO; _isTimerAtSecond = NO;
cdsFirmware = nil; cdsFirmware = nil;
cdsGPU = [[[[CocoaDSGPU alloc] init] autorelease] retain]; cdsController = [[CocoaDSController alloc] init];
cdsController = [[[[CocoaDSController alloc] init] autorelease] retain]; cdsGPU = [[CocoaDSGPU alloc] init];
cdsOutputList = [[[[NSMutableArray alloc] initWithCapacity:32] autorelease] retain]; cdsOutputList = [[NSMutableArray alloc] initWithCapacity:32];
ClientInputHandler *inputHandler = [cdsController inputHandler]; ClientInputHandler *inputHandler = [cdsController inputHandler];
inputHandler->SetClientExecutionController(execControl); inputHandler->SetClientExecutionController(execControl);
execControl->SetClientInputHandler(inputHandler); execControl->SetClientInputHandler(inputHandler);
execControl->SetWifiEmulationMode(WifiEmulationLevel_Off); execControl->SetWifiEmulationMode(WifiEmulationLevel_Off);
spinlockMasterExecute = OS_SPINLOCK_INIT; _unfairlockMasterExecute = apple_unfairlock_create();
spinlockCdsController = OS_SPINLOCK_INIT;
threadParam.cdsCore = self; threadParam.cdsCore = self;
@ -190,15 +190,24 @@ volatile bool execute = true;
[[cdsGPU sharedData] semaphoreFramebufferDestroy]; [[cdsGPU sharedData] semaphoreFramebufferDestroy];
[self setCdsController:nil];
[self setCdsFirmware:nil]; [self setCdsFirmware:nil];
[self setCdsGPU:nil];
[self setCdsOutputList:nil]; [cdsController release];
cdsController = nil;
[cdsGPU release];
cdsGPU = nil;
[cdsOutputList release];
cdsOutputList = nil;
[self setErrorStatus:nil]; [self setErrorStatus:nil];
[self setExtFirmwareMACAddressString:nil]; [self setExtFirmwareMACAddressString:nil];
[self setFirmwareMACAddressSelectionString:nil]; [self setFirmwareMACAddressSelectionString:nil];
[self setCurrentSessionMACAddressString:nil]; [self setCurrentSessionMACAddressString:nil];
apple_unfairlock_destroy(_unfairlockMasterExecute);
pthread_cancel(coreThread); pthread_cancel(coreThread);
pthread_join(coreThread, NULL); pthread_join(coreThread, NULL);
coreThread = NULL; coreThread = NULL;
@ -218,7 +227,7 @@ volatile bool execute = true;
- (void) setMasterExecute:(BOOL)theState - (void) setMasterExecute:(BOOL)theState
{ {
OSSpinLockLock(&spinlockMasterExecute); apple_unfairlock_lock(_unfairlockMasterExecute);
if (theState) if (theState)
{ {
@ -229,50 +238,18 @@ volatile bool execute = true;
emu_halt(EMUHALT_REASON_UNKNOWN, NDSErrorTag_BothCPUs); emu_halt(EMUHALT_REASON_UNKNOWN, NDSErrorTag_BothCPUs);
} }
OSSpinLockUnlock(&spinlockMasterExecute); apple_unfairlock_unlock(_unfairlockMasterExecute);
} }
- (BOOL) masterExecute - (BOOL) masterExecute
{ {
OSSpinLockLock(&spinlockMasterExecute); apple_unfairlock_lock(_unfairlockMasterExecute);
const BOOL theState = (execute) ? YES : NO; const BOOL theState = (execute) ? YES : NO;
OSSpinLockUnlock(&spinlockMasterExecute); apple_unfairlock_unlock(_unfairlockMasterExecute);
return theState; return theState;
} }
- (void) setCdsController:(CocoaDSController *)theController
{
OSSpinLockLock(&spinlockCdsController);
if (theController == cdsController)
{
OSSpinLockUnlock(&spinlockCdsController);
return;
}
if (theController != nil)
{
[theController retain];
}
pthread_mutex_lock(&threadParam.mutexThreadExecute);
[cdsController release];
cdsController = theController;
pthread_mutex_unlock(&threadParam.mutexThreadExecute);
OSSpinLockUnlock(&spinlockCdsController);
}
- (CocoaDSController *) cdsController
{
OSSpinLockLock(&spinlockCdsController);
CocoaDSController *theController = cdsController;
OSSpinLockUnlock(&spinlockCdsController);
return theController;
}
- (void) setIsFrameSkipEnabled:(BOOL)enable - (void) setIsFrameSkipEnabled:(BOOL)enable
{ {
execControl->SetEnableFrameSkip((enable) ? true : false); execControl->SetEnableFrameSkip((enable) ? true : false);
@ -595,8 +572,6 @@ volatile bool execute = true;
- (void) setCoreState:(NSInteger)coreState - (void) setCoreState:(NSInteger)coreState
{ {
NSString *newFrameStatus = nil;
if (coreState == ExecutionBehavior_FrameJump) if (coreState == ExecutionBehavior_FrameJump)
{ {
uint64_t frameIndex = [self frameNumber]; uint64_t frameIndex = [self frameNumber];
@ -628,6 +603,8 @@ volatile bool execute = true;
execControl->SetExecutionBehavior((ExecutionBehavior)coreState); execControl->SetExecutionBehavior((ExecutionBehavior)coreState);
pthread_rwlock_rdlock(&threadParam.rwlockOutputList); pthread_rwlock_rdlock(&threadParam.rwlockOutputList);
char frameStatusCStr[128] = {0};
switch ((ExecutionBehavior)coreState) switch ((ExecutionBehavior)coreState)
{ {
case ExecutionBehavior_Pause: case ExecutionBehavior_Pause:
@ -637,7 +614,8 @@ volatile bool execute = true;
[cdsOutput setIdle:YES]; [cdsOutput setIdle:YES];
} }
newFrameStatus = [NSString stringWithFormat:@"%llu", (unsigned long long)[self frameNumber]]; sprintf(frameStatusCStr, "%llu", (unsigned long long)[self frameNumber]);
[_fpsTimer invalidate]; [_fpsTimer invalidate];
_fpsTimer = nil; _fpsTimer = nil;
break; break;
@ -650,7 +628,8 @@ volatile bool execute = true;
[cdsOutput setIdle:NO]; [cdsOutput setIdle:NO];
} }
newFrameStatus = [NSString stringWithFormat:@"%llu", (unsigned long long)[self frameNumber]]; sprintf(frameStatusCStr, "%llu", (unsigned long long)[self frameNumber]);
[_fpsTimer invalidate]; [_fpsTimer invalidate];
_fpsTimer = nil; _fpsTimer = nil;
break; break;
@ -663,7 +642,7 @@ volatile bool execute = true;
[cdsOutput setIdle:NO]; [cdsOutput setIdle:NO];
} }
newFrameStatus = @"Executing..."; sprintf(frameStatusCStr, "%s", "Executing...");
if (_fpsTimer == nil) if (_fpsTimer == nil)
{ {
@ -690,7 +669,8 @@ volatile bool execute = true;
} }
} }
newFrameStatus = [NSString stringWithFormat:@"Jumping to frame %llu.", (unsigned long long)execControl->GetFrameJumpTarget()]; sprintf(frameStatusCStr, "Jumping to frame %llu.", (unsigned long long)execControl->GetFrameJumpTarget());
[_fpsTimer invalidate]; [_fpsTimer invalidate];
_fpsTimer = nil; _fpsTimer = nil;
break; break;
@ -716,7 +696,7 @@ volatile bool execute = true;
NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys: NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInteger:coreState], @"ExecutionState", [NSNumber numberWithInteger:coreState], @"ExecutionState",
newFrameStatus, @"FrameStatusString", [NSString stringWithCString:frameStatusCStr encoding:NSUTF8StringEncoding], @"FrameStatusString",
nil]; nil];
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"org.desmume.DeSmuME.handleEmulatorExecutionState" object:self userInfo:userInfo]; [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"org.desmume.DeSmuME.handleEmulatorExecutionState" object:self userInfo:userInfo];
[userInfo release]; [userInfo release];
@ -1020,10 +1000,14 @@ volatile bool execute = true;
std::string sramPath = (sramURL != nil) ? [[sramURL path] cStringUsingEncoding:NSUTF8StringEncoding] : ""; std::string sramPath = (sramURL != nil) ? [[sramURL path] cStringUsingEncoding:NSUTF8StringEncoding] : "";
const char *fileName = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding]; const char *fileName = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding];
NSDate *currentDate = [NSDate date]; NSDateFormatter *df = [[NSDateFormatter alloc] init];
NSString *currentDateStr = [currentDate descriptionWithCalendarFormat:@"%Y %m %d %H %M %S %F" [df setDateFormat:@"Y M d H m s SSS"];
timeZone:nil
locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]; // Copy the current date into a formatted string.
NSString *dateString = [df stringFromDate:[NSDate date]];
[df release];
df = nil;
int dateYear = 2009; int dateYear = 2009;
int dateMonth = 1; int dateMonth = 1;
@ -1032,8 +1016,8 @@ volatile bool execute = true;
int dateMinute = 0; int dateMinute = 0;
int dateSecond = 0; int dateSecond = 0;
int dateMillisecond = 0; int dateMillisecond = 0;
const char *dateCStr = [currentDateStr cStringUsingEncoding:NSUTF8StringEncoding]; sscanf([dateString cStringUsingEncoding:NSUTF8StringEncoding], "%i %i %i %i %i %i %i",
sscanf(dateCStr, "%i %i %i %i %i %i %i", &dateYear, &dateMonth, &dateDay, &dateHour, &dateMinute, &dateSecond, &dateMillisecond); &dateYear, &dateMonth, &dateDay, &dateHour, &dateMinute, &dateSecond, &dateMillisecond);
DateTime rtcDate = DateTime(dateYear, DateTime rtcDate = DateTime(dateYear,
dateMonth, dateMonth,
@ -1171,6 +1155,7 @@ static void* RunCoreThread(void *arg)
CoreThreadParam *param = (CoreThreadParam *)arg; CoreThreadParam *param = (CoreThreadParam *)arg;
CocoaDSCore *cdsCore = (CocoaDSCore *)param->cdsCore; CocoaDSCore *cdsCore = (CocoaDSCore *)param->cdsCore;
CocoaDSGPU *cdsGPU = [cdsCore cdsGPU];
ClientExecutionControl *execControl = [cdsCore execControl]; ClientExecutionControl *execControl = [cdsCore execControl];
ClientInputHandler *inputHandler = execControl->GetClientInputHandler(); ClientInputHandler *inputHandler = execControl->GetClientInputHandler();
NSMutableArray *cdsOutputList = [cdsCore cdsOutputList]; NSMutableArray *cdsOutputList = [cdsCore cdsOutputList];
@ -1194,7 +1179,7 @@ static void* RunCoreThread(void *arg)
ExecutionBehavior lastBehavior = ExecutionBehavior_Pause; ExecutionBehavior lastBehavior = ExecutionBehavior_Pause;
uint64_t frameJumpTarget = 0; uint64_t frameJumpTarget = 0;
[[[cdsCore cdsGPU] sharedData] semaphoreFramebufferCreate]; [[cdsGPU sharedData] semaphoreFramebufferCreate];
do do
{ {
@ -1204,7 +1189,7 @@ static void* RunCoreThread(void *arg)
execControl->ApplySettingsOnExecutionLoopStart(); execControl->ApplySettingsOnExecutionLoopStart();
behavior = execControl->GetExecutionBehaviorApplied(); behavior = execControl->GetExecutionBehaviorApplied();
[[cdsCore cdsGPU] respondToPauseState:(behavior == ExecutionBehavior_Pause)]; [cdsGPU respondToPauseState:(behavior == ExecutionBehavior_Pause)];
while (!(behavior != ExecutionBehavior_Pause && execute)) while (!(behavior != ExecutionBehavior_Pause && execute))
{ {
@ -1215,7 +1200,7 @@ static void* RunCoreThread(void *arg)
behavior = execControl->GetExecutionBehaviorApplied(); behavior = execControl->GetExecutionBehaviorApplied();
} }
[[cdsCore cdsGPU] respondToPauseState:(behavior == ExecutionBehavior_Pause)]; [cdsGPU respondToPauseState:(behavior == ExecutionBehavior_Pause)];
if ( (lastBehavior == ExecutionBehavior_Run) && (behavior != ExecutionBehavior_Run) ) if ( (lastBehavior == ExecutionBehavior_Run) && (behavior != ExecutionBehavior_Run) )
{ {
@ -1264,7 +1249,10 @@ static void* RunCoreThread(void *arg)
inputHandler->SetHardwareMicPause(true); inputHandler->SetHardwareMicPause(true);
inputHandler->ClearAverageMicLevel(); inputHandler->ClearAverageMicLevel();
NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init];
inputHandler->ReportAverageMicLevel(); inputHandler->ReportAverageMicLevel();
[tempPool release];
[cdsCore postNDSError:ndsError]; [cdsCore postNDSError:ndsError];
continue; continue;
@ -1279,7 +1267,10 @@ static void* RunCoreThread(void *arg)
// of whether the NDS actually reads the mic or not. // of whether the NDS actually reads the mic or not.
if ((ndsFrameInfo.frameIndex & 0x07) == 0x07) if ((ndsFrameInfo.frameIndex & 0x07) == 0x07)
{ {
NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init];
inputHandler->ReportAverageMicLevel(); inputHandler->ReportAverageMicLevel();
[tempPool release];
inputHandler->ClearAverageMicLevel(); inputHandler->ClearAverageMicLevel();
} }

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2015 DeSmuME team Copyright (C) 2012-2022 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
@ -17,7 +17,6 @@
*/ */
#import "cocoa_file.h" #import "cocoa_file.h"
#include <libkern/OSAtomic.h>
#import "cocoa_globals.h" #import "cocoa_globals.h"
#import "cocoa_util.h" #import "cocoa_util.h"
@ -561,27 +560,27 @@ static NSMutableDictionary *_gURLDictionary = nil;
NSString *fileExt = nil; NSString *fileExt = nil;
switch (fileType) switch (fileType)
{ {
case NSTIFFFileType: case FILETYPE_TIFF:
fileExt = @"tiff"; fileExt = @"tiff";
break; break;
case NSBMPFileType: case FILETYPE_BMP:
fileExt = @"bmp"; fileExt = @"bmp";
break; break;
case NSGIFFileType: case FILETYPE_GIF:
fileExt = @"gif"; fileExt = @"gif";
break; break;
case NSJPEGFileType: case FILETYPE_JPEG:
fileExt = @"jpg"; fileExt = @"jpg";
break; break;
case NSPNGFileType: case FILETYPE_PNG:
fileExt = @"png"; fileExt = @"png";
break; break;
case NSJPEG2000FileType: case FILETYPE_JPEG2000:
fileExt = @"jp2"; fileExt = @"jp2";
break; break;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2018 DeSmuME team Copyright (C) 2012-2022 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
@ -841,36 +841,39 @@
- (void) setBirthday:(NSDate *)theDate - (void) setBirthday:(NSDate *)theDate
{ {
int theMonth = 1;
int theDay = 1;
int theYear = 1970;
if (theDate != nil) if (theDate != nil)
{ {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"Y M d"];
[dateFormatter setDateFormat:@"M"]; NSString *dateString = [df stringFromDate:theDate];
NSInteger theMonth = [[dateFormatter stringFromDate:theDate] integerValue]; sscanf([dateString cStringUsingEncoding:NSUTF8StringEncoding], "%i %i %i", &theYear, &theMonth, &theDay);
[df release];
}
[dateFormatter setDateFormat:@"d"]; _fwConfigInterface->SetBirthdayMonth(theMonth);
NSInteger theDay = [[dateFormatter stringFromDate:theDate] integerValue]; _fwConfigInterface->SetBirthdayDay(theDay);
[dateFormatter setDateFormat:@"Y"];
NSInteger theYear = [[dateFormatter stringFromDate:theDate] integerValue];
[dateFormatter release];
_fwConfigInterface->SetBirthdayMonth((uint8_t)theMonth);
_fwConfigInterface->SetBirthdayDay((uint8_t)theDay);
_birth_year = theYear; _birth_year = theYear;
}
else
{
_fwConfigInterface->SetBirthdayMonth(1);
_fwConfigInterface->SetBirthdayDay(1);
_birth_year = 1970;
}
} }
- (NSDate *) birthday - (NSDate *) birthday
{ {
return [NSDate dateWithString:[NSString stringWithFormat:@"%ld-%ld-%ld 12:00:00 +0000", (unsigned long)_birth_year, (unsigned long)_fwConfigInterface->GetBirthdayMonth(), (unsigned long)_fwConfigInterface->GetBirthdayDay()]]; int theMonth = _fwConfigInterface->GetBirthdayMonth();
int theDay = _fwConfigInterface->GetBirthdayDay();
int theYear = (int)_birth_year;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"YYYY-MM-dd HH:mm:ss Z"];
NSString *dateString = [NSString stringWithFormat:@"%i-%i-%i 12:00:00 +0000", theYear, theMonth, theDay];
NSDate *birthdayDate = [df dateFromString:dateString];
[df release];
return birthdayDate;
} }
- (void) setLanguage:(NSInteger)languageID - (void) setLanguage:(NSInteger)languageID

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2021 DeSmuME Team Copyright (C) 2012-2022 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
@ -106,7 +106,7 @@
#define NSSTRING_STATUS_HUD_ENABLED NSLocalizedString(@"HUD enabled.", nil) #define NSSTRING_STATUS_HUD_ENABLED NSLocalizedString(@"HUD enabled.", nil)
#define NSSTRING_STATUS_VOLUME NSLocalizedString(@"Volume: %1.1f%%", nil) #define NSSTRING_STATUS_VOLUME NSLocalizedString(@"Volume: %1.1f%%", nil)
#define NSSTRING_STATUS_NO_ROM_LOADED NSLocalizedString(@"No ROM loaded.", nil) #define NSSTRING_STATUS_NO_ROM_LOADED NSLocalizedString(@"No ROM loaded.", nil)
#define NSSTRING_STATUS_SIZE_BYTES NSLocalizedString(@"%i bytes", nil) #define NSSTRING_STATUS_SIZE_BYTES NSLocalizedString(@"%llu bytes", nil)
#define NSSTRING_STATUS_EMULATION_NOT_RUNNING NSLocalizedString(@"Emulation is not running.", nil) #define NSSTRING_STATUS_EMULATION_NOT_RUNNING NSLocalizedString(@"Emulation is not running.", nil)
#define NSSTRING_STATUS_SLOT1_UNKNOWN_STATE NSLocalizedString(@"Unknown state.", nil) #define NSSTRING_STATUS_SLOT1_UNKNOWN_STATE NSLocalizedString(@"Unknown state.", nil)

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2017 DeSmuME Team Copyright (C) 2012-2022 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
@ -17,9 +17,6 @@
*/ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <libkern/OSAtomic.h>
#include <vector>
#include "ClientInputHandler.h" #include "ClientInputHandler.h"
@class CocoaDSController; @class CocoaDSController;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2017 DeSmuME team Copyright (C) 2012-2022 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
@ -107,9 +107,7 @@
if ( (delegate != nil) && [delegate respondsToSelector:@selector(doMicLevelUpdateFromController:)] ) if ( (delegate != nil) && [delegate respondsToSelector:@selector(doMicLevelUpdateFromController:)] )
{ {
NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init];
[[self delegate] doMicLevelUpdateFromController:self]; [[self delegate] doMicLevelUpdateFromController:self];
[tempPool release];
} }
} }

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2018 DeSmuME team Copyright (C) 2011-2022 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
@ -18,7 +18,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <pthread.h> #include <pthread.h>
#include <libkern/OSAtomic.h> #include "utilities.h"
#import "cocoa_util.h" #import "cocoa_util.h"
#include "ClientDisplayView.h" #include "ClientDisplayView.h"
@ -45,7 +45,7 @@ class ClientAVCaptureObject;
pthread_rwlock_t *rwlockProducer; pthread_rwlock_t *rwlockProducer;
BOOL _idleState; BOOL _idleState;
OSSpinLock spinlockIdle; apple_unfairlock_t _unfairlockIdle;
} }
@property (readonly) NSMutableDictionary *property; @property (readonly) NSMutableDictionary *property;
@ -67,12 +67,12 @@ class ClientAVCaptureObject;
{ {
NSUInteger bufferSize; NSUInteger bufferSize;
OSSpinLock spinlockAudioOutputEngine; apple_unfairlock_t _unfairlockAudioOutputEngine;
OSSpinLock spinlockVolume; apple_unfairlock_t _unfairlockVolume;
OSSpinLock spinlockSpuAdvancedLogic; apple_unfairlock_t _unfairlockSpuAdvancedLogic;
OSSpinLock spinlockSpuInterpolationMode; apple_unfairlock_t _unfairlockSpuInterpolationMode;
OSSpinLock spinlockSpuSyncMode; apple_unfairlock_t _unfairlockSpuSyncMode;
OSSpinLock spinlockSpuSyncMethod; apple_unfairlock_t _unfairlockSpuSyncMethod;
} }
@property (assign) NSUInteger bufferSize; @property (assign) NSUInteger bufferSize;
@ -112,8 +112,8 @@ class ClientAVCaptureObject;
NDSFrameInfo _ndsFrameInfo; NDSFrameInfo _ndsFrameInfo;
OSSpinLock spinlockReceivedFrameIndex; apple_unfairlock_t _unfairlockReceivedFrameIndex;
OSSpinLock spinlockNDSFrameInfo; apple_unfairlock_t _unfairlockNDSFrameInfo;
} }
- (void) handleReceiveGPUFrame; - (void) handleReceiveGPUFrame;
@ -144,15 +144,15 @@ class ClientAVCaptureObject;
ClientDisplay3DView *_cdv; ClientDisplay3DView *_cdv;
ClientDisplayPresenterProperties _intermediateViewProps; ClientDisplayPresenterProperties _intermediateViewProps;
OSSpinLock spinlockViewProperties; apple_unfairlock_t _unfairlockViewProperties;
OSSpinLock spinlockIsHUDVisible; apple_unfairlock_t _unfairlockIsHUDVisible;
OSSpinLock spinlockUseVerticalSync; apple_unfairlock_t _unfairlockUseVerticalSync;
OSSpinLock spinlockVideoFiltersPreferGPU; apple_unfairlock_t _unfairlockVideoFiltersPreferGPU;
OSSpinLock spinlockOutputFilter; apple_unfairlock_t _unfairlockOutputFilter;
OSSpinLock spinlockSourceDeposterize; apple_unfairlock_t _unfairlockSourceDeposterize;
OSSpinLock spinlockPixelScaler; apple_unfairlock_t _unfairlockPixelScaler;
OSSpinLock spinlockDisplayVideoSource; apple_unfairlock_t _unfairlockDisplayVideoSource;
OSSpinLock spinlockDisplayID; apple_unfairlock_t _unfairlockDisplayID;
} }
@property (assign, nonatomic, getter=clientDisplay3DView, setter=setClientDisplay3DView:) ClientDisplay3DView *_cdv; @property (assign, nonatomic, getter=clientDisplay3DView, setter=setClientDisplay3DView:) ClientDisplay3DView *_cdv;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2021 DeSmuME team Copyright (C) 2011-2022 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
@ -63,7 +63,7 @@
_pthread = NULL; _pthread = NULL;
_idleState = NO; _idleState = NO;
spinlockIdle = OS_SPINLOCK_INIT; _unfairlockIdle = apple_unfairlock_create();
return self; return self;
} }
@ -73,22 +73,23 @@
[self exitThread]; [self exitThread];
[property release]; [property release];
apple_unfairlock_destroy(_unfairlockIdle);
[super dealloc]; [super dealloc];
} }
- (void) setIdle:(BOOL)theState - (void) setIdle:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIdle); apple_unfairlock_lock(_unfairlockIdle);
_idleState = theState; _idleState = theState;
OSSpinLockUnlock(&spinlockIdle); apple_unfairlock_unlock(_unfairlockIdle);
} }
- (BOOL) idle - (BOOL) idle
{ {
OSSpinLockLock(&spinlockIdle); apple_unfairlock_lock(_unfairlockIdle);
const BOOL theState = _idleState; const BOOL theState = _idleState;
OSSpinLockUnlock(&spinlockIdle); apple_unfairlock_unlock(_unfairlockIdle);
return theState; return theState;
} }
@ -202,12 +203,12 @@
return self; return self;
} }
spinlockAudioOutputEngine = OS_SPINLOCK_INIT; _unfairlockAudioOutputEngine = apple_unfairlock_create();
spinlockVolume = OS_SPINLOCK_INIT; _unfairlockVolume = apple_unfairlock_create();
spinlockSpuAdvancedLogic = OS_SPINLOCK_INIT; _unfairlockSpuAdvancedLogic = apple_unfairlock_create();
spinlockSpuInterpolationMode = OS_SPINLOCK_INIT; _unfairlockSpuInterpolationMode = apple_unfairlock_create();
spinlockSpuSyncMode = OS_SPINLOCK_INIT; _unfairlockSpuSyncMode = apple_unfairlock_create();
spinlockSpuSyncMethod = OS_SPINLOCK_INIT; _unfairlockSpuSyncMethod = apple_unfairlock_create();
_idleState = YES; _idleState = YES;
bufferSize = 0; bufferSize = 0;
@ -225,6 +226,18 @@
return self; return self;
} }
- (void)dealloc
{
apple_unfairlock_destroy(_unfairlockAudioOutputEngine);
apple_unfairlock_destroy(_unfairlockVolume);
apple_unfairlock_destroy(_unfairlockSpuAdvancedLogic);
apple_unfairlock_destroy(_unfairlockSpuInterpolationMode);
apple_unfairlock_destroy(_unfairlockSpuSyncMode);
apple_unfairlock_destroy(_unfairlockSpuSyncMethod);
[super dealloc];
}
- (void) setIdle:(BOOL)theState - (void) setIdle:(BOOL)theState
{ {
if (theState) if (theState)
@ -250,27 +263,27 @@
vol = MAX_VOLUME; vol = MAX_VOLUME;
} }
OSSpinLockLock(&spinlockVolume); apple_unfairlock_lock(_unfairlockVolume);
[property setValue:[NSNumber numberWithFloat:vol] forKey:@"volume"]; [property setValue:[NSNumber numberWithFloat:vol] forKey:@"volume"];
OSSpinLockUnlock(&spinlockVolume); apple_unfairlock_unlock(_unfairlockVolume);
SPU_SetVolume((int)vol); SPU_SetVolume((int)vol);
} }
- (float) volume - (float) volume
{ {
OSSpinLockLock(&spinlockVolume); apple_unfairlock_lock(_unfairlockVolume);
float vol = [(NSNumber *)[property valueForKey:@"volume"] floatValue]; float vol = [(NSNumber *)[property valueForKey:@"volume"] floatValue];
OSSpinLockUnlock(&spinlockVolume); apple_unfairlock_unlock(_unfairlockVolume);
return vol; return vol;
} }
- (void) setAudioOutputEngine:(NSInteger)methodID - (void) setAudioOutputEngine:(NSInteger)methodID
{ {
OSSpinLockLock(&spinlockAudioOutputEngine); apple_unfairlock_lock(_unfairlockAudioOutputEngine);
[property setValue:[NSNumber numberWithInteger:methodID] forKey:@"audioOutputEngine"]; [property setValue:[NSNumber numberWithInteger:methodID] forKey:@"audioOutputEngine"];
OSSpinLockUnlock(&spinlockAudioOutputEngine); apple_unfairlock_unlock(_unfairlockAudioOutputEngine);
pthread_rwlock_wrlock(self.rwlockProducer); pthread_rwlock_wrlock(self.rwlockProducer);
@ -294,18 +307,18 @@
- (NSInteger) audioOutputEngine - (NSInteger) audioOutputEngine
{ {
OSSpinLockLock(&spinlockAudioOutputEngine); apple_unfairlock_lock(_unfairlockAudioOutputEngine);
NSInteger methodID = [(NSNumber *)[property valueForKey:@"audioOutputEngine"] integerValue]; NSInteger methodID = [(NSNumber *)[property valueForKey:@"audioOutputEngine"] integerValue];
OSSpinLockUnlock(&spinlockAudioOutputEngine); apple_unfairlock_unlock(_unfairlockAudioOutputEngine);
return methodID; return methodID;
} }
- (void) setSpuAdvancedLogic:(BOOL)state - (void) setSpuAdvancedLogic:(BOOL)state
{ {
OSSpinLockLock(&spinlockSpuAdvancedLogic); apple_unfairlock_lock(_unfairlockSpuAdvancedLogic);
[property setValue:[NSNumber numberWithBool:state] forKey:@"spuAdvancedLogic"]; [property setValue:[NSNumber numberWithBool:state] forKey:@"spuAdvancedLogic"];
OSSpinLockUnlock(&spinlockSpuAdvancedLogic); apple_unfairlock_unlock(_unfairlockSpuAdvancedLogic);
pthread_rwlock_wrlock(self.rwlockProducer); pthread_rwlock_wrlock(self.rwlockProducer);
CommonSettings.spu_advanced = state; CommonSettings.spu_advanced = state;
@ -314,18 +327,18 @@
- (BOOL) spuAdvancedLogic - (BOOL) spuAdvancedLogic
{ {
OSSpinLockLock(&spinlockSpuAdvancedLogic); apple_unfairlock_lock(_unfairlockSpuAdvancedLogic);
BOOL state = [(NSNumber *)[property valueForKey:@"spuAdvancedLogic"] boolValue]; BOOL state = [(NSNumber *)[property valueForKey:@"spuAdvancedLogic"] boolValue];
OSSpinLockUnlock(&spinlockSpuAdvancedLogic); apple_unfairlock_unlock(_unfairlockSpuAdvancedLogic);
return state; return state;
} }
- (void) setSpuInterpolationMode:(NSInteger)modeID - (void) setSpuInterpolationMode:(NSInteger)modeID
{ {
OSSpinLockLock(&spinlockSpuInterpolationMode); apple_unfairlock_lock(_unfairlockSpuInterpolationMode);
[property setValue:[NSNumber numberWithInteger:modeID] forKey:@"spuInterpolationMode"]; [property setValue:[NSNumber numberWithInteger:modeID] forKey:@"spuInterpolationMode"];
OSSpinLockUnlock(&spinlockSpuInterpolationMode); apple_unfairlock_unlock(_unfairlockSpuInterpolationMode);
pthread_rwlock_wrlock(self.rwlockProducer); pthread_rwlock_wrlock(self.rwlockProducer);
CommonSettings.spuInterpolationMode = (SPUInterpolationMode)modeID; CommonSettings.spuInterpolationMode = (SPUInterpolationMode)modeID;
@ -334,18 +347,18 @@
- (NSInteger) spuInterpolationMode - (NSInteger) spuInterpolationMode
{ {
OSSpinLockLock(&spinlockSpuInterpolationMode); apple_unfairlock_lock(_unfairlockSpuInterpolationMode);
NSInteger modeID = [(NSNumber *)[property valueForKey:@"spuInterpolationMode"] integerValue]; NSInteger modeID = [(NSNumber *)[property valueForKey:@"spuInterpolationMode"] integerValue];
OSSpinLockUnlock(&spinlockSpuInterpolationMode); apple_unfairlock_unlock(_unfairlockSpuInterpolationMode);
return modeID; return modeID;
} }
- (void) setSpuSyncMode:(NSInteger)modeID - (void) setSpuSyncMode:(NSInteger)modeID
{ {
OSSpinLockLock(&spinlockSpuSyncMode); apple_unfairlock_lock(_unfairlockSpuSyncMode);
[property setValue:[NSNumber numberWithInteger:modeID] forKey:@"spuSyncMode"]; [property setValue:[NSNumber numberWithInteger:modeID] forKey:@"spuSyncMode"];
OSSpinLockUnlock(&spinlockSpuSyncMode); apple_unfairlock_unlock(_unfairlockSpuSyncMode);
pthread_rwlock_wrlock(self.rwlockProducer); pthread_rwlock_wrlock(self.rwlockProducer);
CommonSettings.SPU_sync_mode = (int)modeID; CommonSettings.SPU_sync_mode = (int)modeID;
@ -355,18 +368,18 @@
- (NSInteger) spuSyncMode - (NSInteger) spuSyncMode
{ {
OSSpinLockLock(&spinlockSpuSyncMode); apple_unfairlock_lock(_unfairlockSpuSyncMode);
NSInteger modeID = [(NSNumber *)[property valueForKey:@"spuSyncMode"] integerValue]; NSInteger modeID = [(NSNumber *)[property valueForKey:@"spuSyncMode"] integerValue];
OSSpinLockUnlock(&spinlockSpuSyncMode); apple_unfairlock_unlock(_unfairlockSpuSyncMode);
return modeID; return modeID;
} }
- (void) setSpuSyncMethod:(NSInteger)methodID - (void) setSpuSyncMethod:(NSInteger)methodID
{ {
OSSpinLockLock(&spinlockSpuSyncMethod); apple_unfairlock_lock(_unfairlockSpuSyncMethod);
[property setValue:[NSNumber numberWithInteger:methodID] forKey:@"spuSyncMethod"]; [property setValue:[NSNumber numberWithInteger:methodID] forKey:@"spuSyncMethod"];
OSSpinLockUnlock(&spinlockSpuSyncMethod); apple_unfairlock_unlock(_unfairlockSpuSyncMethod);
pthread_rwlock_wrlock(self.rwlockProducer); pthread_rwlock_wrlock(self.rwlockProducer);
CommonSettings.SPU_sync_method = (int)methodID; CommonSettings.SPU_sync_method = (int)methodID;
@ -376,9 +389,9 @@
- (NSInteger) spuSyncMethod - (NSInteger) spuSyncMethod
{ {
OSSpinLockLock(&spinlockSpuSyncMethod); apple_unfairlock_lock(_unfairlockSpuSyncMethod);
NSInteger methodID = [(NSNumber *)[property valueForKey:@"spuSyncMethod"] integerValue]; NSInteger methodID = [(NSNumber *)[property valueForKey:@"spuSyncMethod"] integerValue];
OSSpinLockUnlock(&spinlockSpuSyncMethod); apple_unfairlock_unlock(_unfairlockSpuSyncMethod);
return methodID; return methodID;
} }
@ -505,8 +518,8 @@
return self; return self;
} }
spinlockReceivedFrameIndex = OS_SPINLOCK_INIT; _unfairlockReceivedFrameIndex = apple_unfairlock_create();
spinlockNDSFrameInfo = OS_SPINLOCK_INIT; _unfairlockNDSFrameInfo = apple_unfairlock_create();
_ndsFrameInfo.clear(); _ndsFrameInfo.clear();
@ -519,6 +532,14 @@
return self; return self;
} }
- (void)dealloc
{
apple_unfairlock_destroy(_unfairlockReceivedFrameIndex);
apple_unfairlock_destroy(_unfairlockNDSFrameInfo);
[super dealloc];
}
- (void) handleSignalMessageID:(int32_t)messageID - (void) handleSignalMessageID:(int32_t)messageID
{ {
switch (messageID) switch (messageID)
@ -535,24 +556,24 @@
- (void) handleReceiveGPUFrame - (void) handleReceiveGPUFrame
{ {
OSSpinLockLock(&spinlockReceivedFrameIndex); apple_unfairlock_lock(_unfairlockReceivedFrameIndex);
_receivedFrameIndex++; _receivedFrameIndex++;
OSSpinLockUnlock(&spinlockReceivedFrameIndex); apple_unfairlock_unlock(_unfairlockReceivedFrameIndex);
} }
- (void) takeFrameCount - (void) takeFrameCount
{ {
OSSpinLockLock(&spinlockReceivedFrameIndex); apple_unfairlock_lock(_unfairlockReceivedFrameIndex);
_receivedFrameCount = _receivedFrameIndex - _currentReceivedFrameIndex; _receivedFrameCount = _receivedFrameIndex - _currentReceivedFrameIndex;
_currentReceivedFrameIndex = _receivedFrameIndex; _currentReceivedFrameIndex = _receivedFrameIndex;
OSSpinLockUnlock(&spinlockReceivedFrameIndex); apple_unfairlock_unlock(_unfairlockReceivedFrameIndex);
} }
- (void) setNDSFrameInfo:(const NDSFrameInfo &)ndsFrameInfo - (void) setNDSFrameInfo:(const NDSFrameInfo &)ndsFrameInfo
{ {
OSSpinLockLock(&spinlockNDSFrameInfo); apple_unfairlock_lock(_unfairlockNDSFrameInfo);
_ndsFrameInfo.copyFrom(ndsFrameInfo); _ndsFrameInfo.copyFrom(ndsFrameInfo);
OSSpinLockUnlock(&spinlockNDSFrameInfo); apple_unfairlock_unlock(_unfairlockNDSFrameInfo);
} }
@end @end
@ -664,24 +685,39 @@
_cdv = NULL; _cdv = NULL;
spinlockViewProperties = OS_SPINLOCK_INIT; _unfairlockViewProperties = apple_unfairlock_create();
spinlockIsHUDVisible = OS_SPINLOCK_INIT; _unfairlockIsHUDVisible = apple_unfairlock_create();
spinlockUseVerticalSync = OS_SPINLOCK_INIT; _unfairlockUseVerticalSync = apple_unfairlock_create();
spinlockVideoFiltersPreferGPU = OS_SPINLOCK_INIT; _unfairlockVideoFiltersPreferGPU = apple_unfairlock_create();
spinlockOutputFilter = OS_SPINLOCK_INIT; _unfairlockOutputFilter = apple_unfairlock_create();
spinlockSourceDeposterize = OS_SPINLOCK_INIT; _unfairlockSourceDeposterize = apple_unfairlock_create();
spinlockPixelScaler = OS_SPINLOCK_INIT; _unfairlockPixelScaler = apple_unfairlock_create();
spinlockDisplayVideoSource = OS_SPINLOCK_INIT; _unfairlockDisplayVideoSource = apple_unfairlock_create();
spinlockDisplayID = OS_SPINLOCK_INIT; _unfairlockDisplayID = apple_unfairlock_create();
return self; return self;
} }
- (void)dealloc
{
apple_unfairlock_destroy(_unfairlockViewProperties);
apple_unfairlock_destroy(_unfairlockIsHUDVisible);
apple_unfairlock_destroy(_unfairlockUseVerticalSync);
apple_unfairlock_destroy(_unfairlockVideoFiltersPreferGPU);
apple_unfairlock_destroy(_unfairlockOutputFilter);
apple_unfairlock_destroy(_unfairlockSourceDeposterize);
apple_unfairlock_destroy(_unfairlockPixelScaler);
apple_unfairlock_destroy(_unfairlockDisplayVideoSource);
apple_unfairlock_destroy(_unfairlockDisplayID);
[super dealloc];
}
- (void) commitPresenterProperties:(const ClientDisplayPresenterProperties &)viewProps - (void) commitPresenterProperties:(const ClientDisplayPresenterProperties &)viewProps
{ {
OSSpinLockLock(&spinlockViewProperties); apple_unfairlock_lock(_unfairlockViewProperties);
_intermediateViewProps = viewProps; _intermediateViewProps = viewProps;
OSSpinLockUnlock(&spinlockViewProperties); apple_unfairlock_unlock(_unfairlockViewProperties);
[self handleChangeViewProperties]; [self handleChangeViewProperties];
} }
@ -698,470 +734,470 @@
- (void) setIsHUDVisible:(BOOL)theState - (void) setIsHUDVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDVisibility((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDVisibility((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDVisible - (BOOL) isHUDVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDVisibility()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDVisibility()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setIsHUDExecutionSpeedVisible:(BOOL)theState - (void) setIsHUDExecutionSpeedVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDShowExecutionSpeed((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDShowExecutionSpeed((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDExecutionSpeedVisible - (BOOL) isHUDExecutionSpeedVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowExecutionSpeed()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowExecutionSpeed()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setIsHUDVideoFPSVisible:(BOOL)theState - (void) setIsHUDVideoFPSVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDShowVideoFPS((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDShowVideoFPS((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDVideoFPSVisible - (BOOL) isHUDVideoFPSVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowVideoFPS()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowVideoFPS()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setIsHUDRender3DFPSVisible:(BOOL)theState - (void) setIsHUDRender3DFPSVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDShowRender3DFPS((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDShowRender3DFPS((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDRender3DFPSVisible - (BOOL) isHUDRender3DFPSVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowRender3DFPS()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowRender3DFPS()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setIsHUDFrameIndexVisible:(BOOL)theState - (void) setIsHUDFrameIndexVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDShowFrameIndex((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDShowFrameIndex((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDFrameIndexVisible - (BOOL) isHUDFrameIndexVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowFrameIndex()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowFrameIndex()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setIsHUDLagFrameCountVisible:(BOOL)theState - (void) setIsHUDLagFrameCountVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDShowLagFrameCount((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDShowLagFrameCount((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDLagFrameCountVisible - (BOOL) isHUDLagFrameCountVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowLagFrameCount()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowLagFrameCount()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setIsHUDCPULoadAverageVisible:(BOOL)theState - (void) setIsHUDCPULoadAverageVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDShowCPULoadAverage((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDShowCPULoadAverage((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDCPULoadAverageVisible - (BOOL) isHUDCPULoadAverageVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowCPULoadAverage()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowCPULoadAverage()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setIsHUDRealTimeClockVisible:(BOOL)theState - (void) setIsHUDRealTimeClockVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDShowRTC((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDShowRTC((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDRealTimeClockVisible - (BOOL) isHUDRealTimeClockVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowRTC()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowRTC()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setIsHUDInputVisible:(BOOL)theState - (void) setIsHUDInputVisible:(BOOL)theState
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDShowInput((theState) ? true : false); _cdv->Get3DPresenter()->SetHUDShowInput((theState) ? true : false);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (BOOL) isHUDInputVisible - (BOOL) isHUDInputVisible
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowInput()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowInput()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return theState; return theState;
} }
- (void) setHudColorExecutionSpeed:(uint32_t)theColor - (void) setHudColorExecutionSpeed:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorExecutionSpeed(theColor); _cdv->Get3DPresenter()->SetHUDColorExecutionSpeed(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorExecutionSpeed - (uint32_t) hudColorExecutionSpeed
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorExecutionSpeed(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorExecutionSpeed();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorVideoFPS:(uint32_t)theColor - (void) setHudColorVideoFPS:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorVideoFPS(theColor); _cdv->Get3DPresenter()->SetHUDColorVideoFPS(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorVideoFPS - (uint32_t) hudColorVideoFPS
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorVideoFPS(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorVideoFPS();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorRender3DFPS:(uint32_t)theColor - (void) setHudColorRender3DFPS:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorRender3DFPS(theColor); _cdv->Get3DPresenter()->SetHUDColorRender3DFPS(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorRender3DFPS - (uint32_t) hudColorRender3DFPS
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorRender3DFPS(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorRender3DFPS();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorFrameIndex:(uint32_t)theColor - (void) setHudColorFrameIndex:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorFrameIndex(theColor); _cdv->Get3DPresenter()->SetHUDColorFrameIndex(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorFrameIndex - (uint32_t) hudColorFrameIndex
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorFrameIndex(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorFrameIndex();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorLagFrameCount:(uint32_t)theColor - (void) setHudColorLagFrameCount:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorLagFrameCount(theColor); _cdv->Get3DPresenter()->SetHUDColorLagFrameCount(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorLagFrameCount - (uint32_t) hudColorLagFrameCount
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorLagFrameCount(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorLagFrameCount();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorCPULoadAverage:(uint32_t)theColor - (void) setHudColorCPULoadAverage:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorCPULoadAverage(theColor); _cdv->Get3DPresenter()->SetHUDColorCPULoadAverage(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorCPULoadAverage - (uint32_t) hudColorCPULoadAverage
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorCPULoadAverage(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorCPULoadAverage();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorRTC:(uint32_t)theColor - (void) setHudColorRTC:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorRTC(theColor); _cdv->Get3DPresenter()->SetHUDColorRTC(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorRTC - (uint32_t) hudColorRTC
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorRTC(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorRTC();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorInputPendingAndApplied:(uint32_t)theColor - (void) setHudColorInputPendingAndApplied:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorInputPendingAndApplied(theColor); _cdv->Get3DPresenter()->SetHUDColorInputPendingAndApplied(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorInputPendingAndApplied - (uint32_t) hudColorInputPendingAndApplied
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputPendingAndApplied(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputPendingAndApplied();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorInputAppliedOnly:(uint32_t)theColor - (void) setHudColorInputAppliedOnly:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorInputAppliedOnly(theColor); _cdv->Get3DPresenter()->SetHUDColorInputAppliedOnly(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorInputAppliedOnly - (uint32_t) hudColorInputAppliedOnly
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputAppliedOnly(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputAppliedOnly();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setHudColorInputPendingOnly:(uint32_t)theColor - (void) setHudColorInputPendingOnly:(uint32_t)theColor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetHUDColorInputPendingOnly(theColor); _cdv->Get3DPresenter()->SetHUDColorInputPendingOnly(theColor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
} }
- (uint32_t) hudColorInputPendingOnly - (uint32_t) hudColorInputPendingOnly
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputPendingOnly(); const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputPendingOnly();
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
return color32; return color32;
} }
- (void) setDisplayMainVideoSource:(NSInteger)displaySourceID - (void) setDisplayMainVideoSource:(NSInteger)displaySourceID
{ {
OSSpinLockLock(&spinlockDisplayVideoSource); apple_unfairlock_lock(_unfairlockDisplayVideoSource);
_cdv->Get3DPresenter()->SetDisplayVideoSource(NDSDisplayID_Main, (ClientDisplaySource)displaySourceID); _cdv->Get3DPresenter()->SetDisplayVideoSource(NDSDisplayID_Main, (ClientDisplaySource)displaySourceID);
OSSpinLockUnlock(&spinlockDisplayVideoSource); apple_unfairlock_unlock(_unfairlockDisplayVideoSource);
} }
- (NSInteger) displayMainVideoSource - (NSInteger) displayMainVideoSource
{ {
OSSpinLockLock(&spinlockDisplayVideoSource); apple_unfairlock_lock(_unfairlockDisplayVideoSource);
const NSInteger displayVideoSource = _cdv->Get3DPresenter()->GetDisplayVideoSource(NDSDisplayID_Main); const NSInteger displayVideoSource = _cdv->Get3DPresenter()->GetDisplayVideoSource(NDSDisplayID_Main);
OSSpinLockUnlock(&spinlockDisplayVideoSource); apple_unfairlock_unlock(_unfairlockDisplayVideoSource);
return displayVideoSource; return displayVideoSource;
} }
- (void) setDisplayTouchVideoSource:(NSInteger)displaySourceID - (void) setDisplayTouchVideoSource:(NSInteger)displaySourceID
{ {
OSSpinLockLock(&spinlockDisplayVideoSource); apple_unfairlock_lock(_unfairlockDisplayVideoSource);
_cdv->Get3DPresenter()->SetDisplayVideoSource(NDSDisplayID_Touch, (ClientDisplaySource)displaySourceID); _cdv->Get3DPresenter()->SetDisplayVideoSource(NDSDisplayID_Touch, (ClientDisplaySource)displaySourceID);
OSSpinLockUnlock(&spinlockDisplayVideoSource); apple_unfairlock_unlock(_unfairlockDisplayVideoSource);
} }
- (NSInteger) displayTouchVideoSource - (NSInteger) displayTouchVideoSource
{ {
OSSpinLockLock(&spinlockDisplayVideoSource); apple_unfairlock_lock(_unfairlockDisplayVideoSource);
const NSInteger displayVideoSource = _cdv->Get3DPresenter()->GetDisplayVideoSource(NDSDisplayID_Touch); const NSInteger displayVideoSource = _cdv->Get3DPresenter()->GetDisplayVideoSource(NDSDisplayID_Touch);
OSSpinLockUnlock(&spinlockDisplayVideoSource); apple_unfairlock_unlock(_unfairlockDisplayVideoSource);
return displayVideoSource; return displayVideoSource;
} }
- (void) setCurrentDisplayID:(uint32_t)theDisplayID - (void) setCurrentDisplayID:(uint32_t)theDisplayID
{ {
OSSpinLockLock(&spinlockDisplayID); apple_unfairlock_lock(_unfairlockDisplayID);
_cdv->SetDisplayViewID((int64_t)theDisplayID); _cdv->SetDisplayViewID((int64_t)theDisplayID);
OSSpinLockUnlock(&spinlockDisplayID); apple_unfairlock_unlock(_unfairlockDisplayID);
} }
- (uint32_t) currentDisplayID - (uint32_t) currentDisplayID
{ {
OSSpinLockLock(&spinlockDisplayID); apple_unfairlock_lock(_unfairlockDisplayID);
const uint32_t displayID = (uint32_t)_cdv->GetDisplayViewID(); const uint32_t displayID = (uint32_t)_cdv->GetDisplayViewID();
OSSpinLockUnlock(&spinlockDisplayID); apple_unfairlock_unlock(_unfairlockDisplayID);
return displayID; return displayID;
} }
- (void) setUseVerticalSync:(BOOL)theState - (void) setUseVerticalSync:(BOOL)theState
{ {
OSSpinLockLock(&spinlockUseVerticalSync); apple_unfairlock_lock(_unfairlockUseVerticalSync);
_cdv->SetUseVerticalSync((theState) ? true : false); _cdv->SetUseVerticalSync((theState) ? true : false);
OSSpinLockUnlock(&spinlockUseVerticalSync); apple_unfairlock_unlock(_unfairlockUseVerticalSync);
} }
- (BOOL) useVerticalSync - (BOOL) useVerticalSync
{ {
OSSpinLockLock(&spinlockUseVerticalSync); apple_unfairlock_lock(_unfairlockUseVerticalSync);
const BOOL theState = (_cdv->GetUseVerticalSync()) ? YES : NO; const BOOL theState = (_cdv->GetUseVerticalSync()) ? YES : NO;
OSSpinLockUnlock(&spinlockUseVerticalSync); apple_unfairlock_unlock(_unfairlockUseVerticalSync);
return theState; return theState;
} }
- (void) setVideoFiltersPreferGPU:(BOOL)theState - (void) setVideoFiltersPreferGPU:(BOOL)theState
{ {
OSSpinLockLock(&spinlockVideoFiltersPreferGPU); apple_unfairlock_lock(_unfairlockVideoFiltersPreferGPU);
_cdv->Get3DPresenter()->SetFiltersPreferGPU((theState) ? true : false); _cdv->Get3DPresenter()->SetFiltersPreferGPU((theState) ? true : false);
OSSpinLockUnlock(&spinlockVideoFiltersPreferGPU); apple_unfairlock_unlock(_unfairlockVideoFiltersPreferGPU);
} }
- (BOOL) videoFiltersPreferGPU - (BOOL) videoFiltersPreferGPU
{ {
OSSpinLockLock(&spinlockVideoFiltersPreferGPU); apple_unfairlock_lock(_unfairlockVideoFiltersPreferGPU);
const BOOL theState = (_cdv->Get3DPresenter()->GetFiltersPreferGPU()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetFiltersPreferGPU()) ? YES : NO;
OSSpinLockUnlock(&spinlockVideoFiltersPreferGPU); apple_unfairlock_unlock(_unfairlockVideoFiltersPreferGPU);
return theState; return theState;
} }
- (void) setSourceDeposterize:(BOOL)theState - (void) setSourceDeposterize:(BOOL)theState
{ {
OSSpinLockLock(&spinlockSourceDeposterize); apple_unfairlock_lock(_unfairlockSourceDeposterize);
_cdv->Get3DPresenter()->SetSourceDeposterize((theState) ? true : false); _cdv->Get3DPresenter()->SetSourceDeposterize((theState) ? true : false);
OSSpinLockUnlock(&spinlockSourceDeposterize); apple_unfairlock_unlock(_unfairlockSourceDeposterize);
} }
- (BOOL) sourceDeposterize - (BOOL) sourceDeposterize
{ {
OSSpinLockLock(&spinlockSourceDeposterize); apple_unfairlock_lock(_unfairlockSourceDeposterize);
const BOOL theState = (_cdv->Get3DPresenter()->GetSourceDeposterize()) ? YES : NO; const BOOL theState = (_cdv->Get3DPresenter()->GetSourceDeposterize()) ? YES : NO;
OSSpinLockUnlock(&spinlockSourceDeposterize); apple_unfairlock_unlock(_unfairlockSourceDeposterize);
return theState; return theState;
} }
- (void) setOutputFilter:(NSInteger)filterID - (void) setOutputFilter:(NSInteger)filterID
{ {
OSSpinLockLock(&spinlockOutputFilter); apple_unfairlock_lock(_unfairlockOutputFilter);
_cdv->Get3DPresenter()->SetOutputFilter((OutputFilterTypeID)filterID); _cdv->Get3DPresenter()->SetOutputFilter((OutputFilterTypeID)filterID);
OSSpinLockUnlock(&spinlockOutputFilter); apple_unfairlock_unlock(_unfairlockOutputFilter);
} }
- (NSInteger) outputFilter - (NSInteger) outputFilter
{ {
OSSpinLockLock(&spinlockOutputFilter); apple_unfairlock_lock(_unfairlockOutputFilter);
const NSInteger filterID = _cdv->Get3DPresenter()->GetOutputFilter(); const NSInteger filterID = _cdv->Get3DPresenter()->GetOutputFilter();
OSSpinLockUnlock(&spinlockOutputFilter); apple_unfairlock_unlock(_unfairlockOutputFilter);
return filterID; return filterID;
} }
- (void) setPixelScaler:(NSInteger)filterID - (void) setPixelScaler:(NSInteger)filterID
{ {
OSSpinLockLock(&spinlockPixelScaler); apple_unfairlock_lock(_unfairlockPixelScaler);
_cdv->Get3DPresenter()->SetPixelScaler((VideoFilterTypeID)filterID); _cdv->Get3DPresenter()->SetPixelScaler((VideoFilterTypeID)filterID);
OSSpinLockUnlock(&spinlockPixelScaler); apple_unfairlock_unlock(_unfairlockPixelScaler);
} }
- (NSInteger) pixelScaler - (NSInteger) pixelScaler
{ {
OSSpinLockLock(&spinlockPixelScaler); apple_unfairlock_lock(_unfairlockPixelScaler);
const NSInteger filterID = _cdv->Get3DPresenter()->GetPixelScaler(); const NSInteger filterID = _cdv->Get3DPresenter()->GetPixelScaler();
OSSpinLockUnlock(&spinlockPixelScaler); apple_unfairlock_unlock(_unfairlockPixelScaler);
return filterID; return filterID;
} }
@ -1205,9 +1241,9 @@
- (void) handleChangeViewProperties - (void) handleChangeViewProperties
{ {
OSSpinLockLock(&spinlockViewProperties); apple_unfairlock_lock(_unfairlockViewProperties);
_cdv->Get3DPresenter()->CommitPresenterProperties(_intermediateViewProps); _cdv->Get3DPresenter()->CommitPresenterProperties(_intermediateViewProps);
OSSpinLockUnlock(&spinlockViewProperties); apple_unfairlock_unlock(_unfairlockViewProperties);
_cdv->Get3DPresenter()->SetupPresenterProperties(); _cdv->Get3DPresenter()->SetupPresenterProperties();
_cdv->SetViewNeedsFlush(); _cdv->SetViewNeedsFlush();
@ -1249,27 +1285,27 @@
} }
NSPasteboard *pboard = [NSPasteboard generalPasteboard]; NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard declareTypes:[NSArray arrayWithObjects:NSTIFFPboardType, nil] owner:self]; [pboard declareTypes:[NSArray arrayWithObjects:PASTEBOARDTYPE_TIFF, nil] owner:self];
[pboard setData:[screenshot TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0f] forType:NSTIFFPboardType]; [pboard setData:[screenshot TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0f] forType:PASTEBOARDTYPE_TIFF];
} }
- (void) setScaleFactor:(float)theScaleFactor - (void) setScaleFactor:(float)theScaleFactor
{ {
OSSpinLockLock(&spinlockIsHUDVisible); apple_unfairlock_lock(_unfairlockIsHUDVisible);
_cdv->Get3DPresenter()->SetScaleFactor(theScaleFactor); _cdv->Get3DPresenter()->SetScaleFactor(theScaleFactor);
OSSpinLockUnlock(&spinlockIsHUDVisible); apple_unfairlock_unlock(_unfairlockIsHUDVisible);
} }
- (void) hudUpdate - (void) hudUpdate
{ {
OSSpinLockLock(&spinlockReceivedFrameIndex); apple_unfairlock_lock(_unfairlockReceivedFrameIndex);
ClientFrameInfo clientFrameInfo; ClientFrameInfo clientFrameInfo;
clientFrameInfo.videoFPS = _receivedFrameCount; clientFrameInfo.videoFPS = _receivedFrameCount;
OSSpinLockUnlock(&spinlockReceivedFrameIndex); apple_unfairlock_unlock(_unfairlockReceivedFrameIndex);
OSSpinLockLock(&spinlockNDSFrameInfo); apple_unfairlock_lock(_unfairlockNDSFrameInfo);
_cdv->Get3DPresenter()->SetHUDInfo(clientFrameInfo, _ndsFrameInfo); _cdv->Get3DPresenter()->SetHUDInfo(clientFrameInfo, _ndsFrameInfo);
OSSpinLockUnlock(&spinlockNDSFrameInfo); apple_unfairlock_unlock(_unfairlockNDSFrameInfo);
} }
- (NSImage *) image - (NSImage *) image

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2013 DeSmuME team Copyright (C) 2011-2022 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
@ -17,7 +17,6 @@
*/ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <libkern/OSAtomic.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2021 DeSmuME team Copyright (C) 2011-2022 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
@ -202,15 +202,15 @@ static NSMutableDictionary *saveTypeValues = nil;
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm9BinaryOffset"] intValue]] forKey:@"arm9BinaryOffset"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm9BinaryOffset"] intValue]] forKey:@"arm9BinaryOffset"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm9BinaryEntryAddress"] intValue]] forKey:@"arm9BinaryEntryAddress"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm9BinaryEntryAddress"] intValue]] forKey:@"arm9BinaryEntryAddress"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm9BinaryStartAddress"] intValue]] forKey:@"arm9BinaryStartAddress"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm9BinaryStartAddress"] intValue]] forKey:@"arm9BinaryStartAddress"];
[self.bindings setValue:[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, [[self.header objectForKey:@"arm9BinarySize"] intValue]] forKey:@"arm9BinarySize"]; [self.bindings setValue:[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, (unsigned long long)[[self.header objectForKey:@"arm9BinarySize"] intValue]] forKey:@"arm9BinarySize"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm7BinaryOffset"] intValue]] forKey:@"arm7BinaryOffset"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm7BinaryOffset"] intValue]] forKey:@"arm7BinaryOffset"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm7BinaryEntryAddress"] intValue]] forKey:@"arm7BinaryEntryAddress"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm7BinaryEntryAddress"] intValue]] forKey:@"arm7BinaryEntryAddress"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm7BinaryStartAddress"] intValue]] forKey:@"arm7BinaryStartAddress"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"arm7BinaryStartAddress"] intValue]] forKey:@"arm7BinaryStartAddress"];
[self.bindings setValue:[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, [[self.header objectForKey:@"arm7BinarySize"] intValue]] forKey:@"arm7BinarySize"]; [self.bindings setValue:[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, (unsigned long long)[[self.header objectForKey:@"arm7BinarySize"] intValue]] forKey:@"arm7BinarySize"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"fntOffset"] intValue]] forKey:@"fntOffset"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"fntOffset"] intValue]] forKey:@"fntOffset"];
[self.bindings setValue:[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, [[self.header objectForKey:@"fntTableSize"] intValue]] forKey:@"fntTableSize"]; [self.bindings setValue:[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, (unsigned long long)[[self.header objectForKey:@"fntTableSize"] intValue]] forKey:@"fntTableSize"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"fatOffset"] intValue]] forKey:@"fatOffset"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"fatOffset"] intValue]] forKey:@"fatOffset"];
[self.bindings setValue:[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, [[self.header objectForKey:@"fatSize"] intValue]] forKey:@"fatSize"]; [self.bindings setValue:[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, (unsigned long long)[[self.header objectForKey:@"fatSize"] intValue]] forKey:@"fatSize"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"fatOffset"] intValue]] forKey:@"fatOffset"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"fatOffset"] intValue]] forKey:@"fatOffset"];
[self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"iconOffset"] intValue]] forKey:@"iconOffset"]; [self.bindings setValue:[NSString stringWithFormat:@"0x%08X", [[self.header objectForKey:@"iconOffset"] intValue]] forKey:@"iconOffset"];
[self.bindings setValue:[CocoaDSRom byteSizeStringWithLargerUnit:[[self.header objectForKey:@"usedRomSize"] intValue]] forKey:@"usedRomSize"]; [self.bindings setValue:[CocoaDSRom byteSizeStringWithLargerUnit:[[self.header objectForKey:@"usedRomSize"] intValue]] forKey:@"usedRomSize"];
@ -592,22 +592,22 @@ static NSMutableDictionary *saveTypeValues = nil;
NSSTRING_STATUS_NO_ROM_LOADED, @"gameDeveloperWithCode", NSSTRING_STATUS_NO_ROM_LOADED, @"gameDeveloperWithCode",
NSSTRING_STATUS_NO_ROM_LOADED, @"unitCode", NSSTRING_STATUS_NO_ROM_LOADED, @"unitCode",
NSSTRING_STATUS_NO_ROM_LOADED, @"makerCode", NSSTRING_STATUS_NO_ROM_LOADED, @"makerCode",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"romSize", [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"romSize",
@"----------", @"arm9BinaryOffset", @"----------", @"arm9BinaryOffset",
@"----------", @"arm9BinaryEntryAddress", @"----------", @"arm9BinaryEntryAddress",
@"----------", @"arm9BinaryStartAddress", @"----------", @"arm9BinaryStartAddress",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"arm9BinarySize", [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"arm9BinarySize",
@"----------", @"arm7BinaryOffset", @"----------", @"arm7BinaryOffset",
@"----------", @"arm7BinaryEntryAddress", @"----------", @"arm7BinaryEntryAddress",
@"----------", @"arm7BinaryStartAddress", @"----------", @"arm7BinaryStartAddress",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"arm7BinarySize", [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"arm7BinarySize",
@"----------", @"fntOffset", @"----------", @"fntOffset",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"fntTableSize", [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"fntTableSize",
@"----------", @"fatOffset", @"----------", @"fatOffset",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"fatSize", [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"fatSize",
@"----------", @"iconOffset", @"----------", @"iconOffset",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"usedRomSize", [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"usedRomSize",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"unusedCapacity", [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"unusedCapacity",
iconImage, @"iconImage", iconImage, @"iconImage",
nil]; nil];
} }
@ -618,7 +618,7 @@ static NSMutableDictionary *saveTypeValues = nil;
const float megabyteSize = byteSize / 1024.0f / 1024.0f; const float megabyteSize = byteSize / 1024.0f / 1024.0f;
const float gigabyteSize = byteSize / 1024.0f / 1024.0f / 1024.0f; const float gigabyteSize = byteSize / 1024.0f / 1024.0f / 1024.0f;
NSString *byteString = [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, byteSize]; NSString *byteString = [NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, (unsigned long long)byteSize];
NSString *unitString = byteString; NSString *unitString = byteString;
if (gigabyteSize > 1.0f) if (gigabyteSize > 1.0f)

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2018 DeSmuME team Copyright (C) 2012-2022 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
@ -18,13 +18,8 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#include <libkern/OSAtomic.h>
#include "utilities.h" #include "utilities.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
#include "macosx_10_4_compat.h"
#endif
@interface CocoaDSUtil : NSObject @interface CocoaDSUtil : NSObject
{ {
@ -34,6 +29,8 @@
+ (NSInteger) getIBActionSenderTag:(id)sender; + (NSInteger) getIBActionSenderTag:(id)sender;
+ (BOOL) getIBActionSenderButtonStateBool:(id)sender; + (BOOL) getIBActionSenderButtonStateBool:(id)sender;
+ (void) endSheet:(NSWindow *)sheet returnCode:(NSInteger)code;
+ (NSColor *) NSColorFromRGBA8888:(uint32_t)theColor; + (NSColor *) NSColorFromRGBA8888:(uint32_t)theColor;
+ (uint32_t) RGBA8888FromNSColor:(NSColor *)theColor; + (uint32_t) RGBA8888FromNSColor:(NSColor *)theColor;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2018 DeSmuME team Copyright (C) 2012-2022 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
@ -53,14 +53,19 @@
+ (BOOL) getIBActionSenderButtonStateBool:(id)sender + (BOOL) getIBActionSenderButtonStateBool:(id)sender
{ {
BOOL theState = NO; BOOL theState = NO;
NSInteger buttonState = NSOffState;
#if defined(MAC_OS_X_VERSION_10_14) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14)
NSControlStateValue buttonState = GUI_STATE_OFF;
#else
NSInteger buttonState = GUI_STATE_OFF;
#endif
if ([sender respondsToSelector:@selector(state)]) if ([sender respondsToSelector:@selector(state)])
{ {
buttonState = [sender state]; buttonState = [sender state];
} }
if (buttonState == NSOnState) if (buttonState == GUI_STATE_ON)
{ {
theState = YES; theState = YES;
} }
@ -68,6 +73,25 @@
return theState; return theState;
} }
+ (void) endSheet:(NSWindow *)sheet returnCode:(NSInteger)code
{
if (sheet == nil)
{
return;
}
#if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([[sheet sheetParent] respondsToSelector:@selector(endSheet:returnCode:)])
{
[[sheet sheetParent] endSheet:sheet returnCode:code];
}
else
#endif
{
[NSApp endSheet:sheet returnCode:code];
}
}
+ (NSColor *) NSColorFromRGBA8888:(uint32_t)theColor + (NSColor *) NSColorFromRGBA8888:(uint32_t)theColor
{ {
#ifdef MSB_FIRST #ifdef MSB_FIRST
@ -87,9 +111,9 @@
+ (uint32_t) RGBA8888FromNSColor:(NSColor *)theColor + (uint32_t) RGBA8888FromNSColor:(NSColor *)theColor
{ {
if (![[theColor colorSpaceName] isEqualToString:NSDeviceRGBColorSpace]) if ([theColor colorSpace] != [NSColorSpace deviceRGBColorSpace])
{ {
theColor = [theColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]; theColor = [theColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]];
if (theColor == nil) if (theColor == nil)
{ {
return 0x00000000; return 0x00000000;
@ -230,7 +254,14 @@
return self; return self;
} }
[self registerForDraggedTypes:[NSArray arrayWithObjects: NSURLPboardType, nil]]; #if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
// We need to use @available here when compiling against macOS v10.13 SDK and later in order to
// silence a silly warning.
if (@available(macOS 10_13, *))
#endif
{
[self registerForDraggedTypes:[NSArray arrayWithObjects:PASTEBOARDTYPE_URL, nil]];
}
return self; return self;
} }
@ -245,8 +276,18 @@
{ {
NSDragOperation dragOp = NSDragOperationNone; NSDragOperation dragOp = NSDragOperationNone;
NSPasteboard *pboard = [sender draggingPasteboard]; NSPasteboard *pboard = [sender draggingPasteboard];
BOOL pboardHasURL = NO;
if ([[pboard types] containsObject:NSURLPboardType]) #if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
// We need to use @available here when compiling against macOS v10.13 SDK and later in order to
// silence a silly warning.
if (@available(macOS 10_13, *))
#endif
{
pboardHasURL = [[pboard types] containsObject:PASTEBOARDTYPE_URL];
}
if (pboardHasURL)
{ {
NSURL *fileURL = [NSURL URLFromPasteboard:pboard]; NSURL *fileURL = [NSURL URLFromPasteboard:pboard];
NSString *filePath = [fileURL path]; NSString *filePath = [fileURL path];
@ -271,9 +312,19 @@
NSWindow *window = [self window]; NSWindow *window = [self window];
id <DirectoryURLDragDestTextFieldProtocol> delegate = (id <DirectoryURLDragDestTextFieldProtocol>)[window delegate]; id <DirectoryURLDragDestTextFieldProtocol> delegate = (id <DirectoryURLDragDestTextFieldProtocol>)[window delegate];
NSPasteboard *pboard = [sender draggingPasteboard]; NSPasteboard *pboard = [sender draggingPasteboard];
BOOL pboardHasURL = NO;
NSString *filePath = NULL; NSString *filePath = NULL;
if ([[pboard types] containsObject:NSURLPboardType]) #if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
// We need to use @available here when compiling against macOS v10.13 SDK and later in order to
// silence a silly warning.
if (@available(macOS 10_13, *))
#endif
{
pboardHasURL = [[pboard types] containsObject:PASTEBOARDTYPE_URL];
}
if (pboardHasURL)
{ {
NSURL *fileURL = [NSURL URLFromPasteboard:pboard]; NSURL *fileURL = [NSURL URLFromPasteboard:pboard];
filePath = [fileURL path]; filePath = [fileURL path];

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2012-2017 DeSmuME team Copyright (C) 2012-2022 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
@ -27,8 +27,7 @@
CoreAudioInput::CoreAudioInput() CoreAudioInput::CoreAudioInput()
{ {
_spinlockAUHAL = (OSSpinLock *)malloc(sizeof(OSSpinLock)); _unfairlockAUHAL = apple_unfairlock_create();
*_spinlockAUHAL = OS_SPINLOCK_INIT;
_hwStateChangedCallbackFunc = &CoreAudioInputDefaultHardwareStateChangedCallback; _hwStateChangedCallbackFunc = &CoreAudioInputDefaultHardwareStateChangedCallback;
_hwStateChangedCallbackParam1 = NULL; _hwStateChangedCallbackParam1 = NULL;
@ -60,7 +59,7 @@ CoreAudioInput::CoreAudioInput()
_auOutputNode = 0; _auOutputNode = 0;
memset(&_timeStamp, 0, sizeof(AudioTimeStamp)); memset(&_timeStamp, 0, sizeof(AudioTimeStamp));
#if !defined(FORCE_AUDIOCOMPONENT_10_5) && defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
AudioComponentDescription halInputDeviceDesc; AudioComponentDescription halInputDeviceDesc;
AudioComponentDescription formatConverterDesc; AudioComponentDescription formatConverterDesc;
AudioComponentDescription outputDesc; AudioComponentDescription outputDesc;
@ -91,7 +90,7 @@ CoreAudioInput::CoreAudioInput()
NewAUGraph(&_auGraph); NewAUGraph(&_auGraph);
AUGraphOpen(_auGraph); AUGraphOpen(_auGraph);
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
AUGraphAddNode(_auGraph, (AudioComponentDescription *)&formatConverterDesc, &_auFormatConverterNode); AUGraphAddNode(_auGraph, (AudioComponentDescription *)&formatConverterDesc, &_auFormatConverterNode);
AUGraphAddNode(_auGraph, (AudioComponentDescription *)&outputDesc, &_auOutputNode); AUGraphAddNode(_auGraph, (AudioComponentDescription *)&outputDesc, &_auOutputNode);
#else #else
@ -255,9 +254,9 @@ CoreAudioInput::CoreAudioInput()
CoreAudioInput::~CoreAudioInput() CoreAudioInput::~CoreAudioInput()
{ {
OSSpinLockLock(_spinlockAUHAL); apple_unfairlock_lock(this->_unfairlockAUHAL);
DestroyAudioUnitInstance(&_auHALInputDevice); DestroyAudioUnitInstance(&_auHALInputDevice);
OSSpinLockUnlock(_spinlockAUHAL); apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphClose(_auGraph); AUGraphClose(_auGraph);
AUGraphUninitialize(_auGraph); AUGraphUninitialize(_auGraph);
@ -281,8 +280,7 @@ CoreAudioInput::~CoreAudioInput()
delete _samplesConverted; delete _samplesConverted;
_samplesConverted = NULL; _samplesConverted = NULL;
free(_spinlockAUHAL); apple_unfairlock_destroy(this->_unfairlockAUHAL);
_spinlockAUHAL = NULL;
CFRelease(this->_hwDeviceInfo.name); CFRelease(this->_hwDeviceInfo.name);
CFRelease(this->_hwDeviceInfo.manufacturer); CFRelease(this->_hwDeviceInfo.manufacturer);
@ -480,7 +478,7 @@ void CoreAudioInput::Start()
&defaultInputDeviceID); &defaultInputDeviceID);
// Set the default input device to the audio unit. // Set the default input device to the audio unit.
OSSpinLockLock(this->_spinlockAUHAL); apple_unfairlock_lock(this->_unfairlockAUHAL);
error = this->InitInputAUHAL(defaultInputDeviceID); error = this->InitInputAUHAL(defaultInputDeviceID);
if (error == noErr) if (error == noErr)
@ -521,7 +519,7 @@ void CoreAudioInput::Start()
AudioOutputUnitStart(this->_auHALInputDevice); AudioOutputUnitStart(this->_auHALInputDevice);
} }
OSSpinLockUnlock(this->_spinlockAUHAL); apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphInitialize(_auGraph); AUGraphInitialize(_auGraph);
if (!this->GetPauseState()) if (!this->GetPauseState())
@ -540,10 +538,10 @@ void CoreAudioInput::Start()
void CoreAudioInput::Stop() void CoreAudioInput::Stop()
{ {
OSSpinLockLock(this->_spinlockAUHAL); apple_unfairlock_lock(this->_unfairlockAUHAL);
AudioOutputUnitStop(this->_auHALInputDevice); AudioOutputUnitStop(this->_auHALInputDevice);
AudioUnitUninitialize(this->_auHALInputDevice); AudioUnitUninitialize(this->_auHALInputDevice);
OSSpinLockUnlock(this->_spinlockAUHAL); apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphStop(this->_auGraph); AUGraphStop(this->_auGraph);
AUGraphUninitialize(this->_auGraph); AUGraphUninitialize(this->_auGraph);
@ -586,16 +584,16 @@ void CoreAudioInput::SetPauseState(bool pauseState)
{ {
if (pauseState && !this->GetPauseState()) if (pauseState && !this->GetPauseState())
{ {
OSSpinLockLock(this->_spinlockAUHAL); apple_unfairlock_lock(this->_unfairlockAUHAL);
AudioOutputUnitStop(this->_auHALInputDevice); AudioOutputUnitStop(this->_auHALInputDevice);
OSSpinLockUnlock(this->_spinlockAUHAL); apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphStop(this->_auGraph); AUGraphStop(this->_auGraph);
} }
else if (!pauseState && this->GetPauseState() && !this->IsHardwareLocked()) else if (!pauseState && this->GetPauseState() && !this->IsHardwareLocked())
{ {
OSSpinLockLock(this->_spinlockAUHAL); apple_unfairlock_lock(this->_unfairlockAUHAL);
AudioOutputUnitStart(this->_auHALInputDevice); AudioOutputUnitStart(this->_auHALInputDevice);
OSSpinLockUnlock(this->_spinlockAUHAL); apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphStart(this->_auGraph); AUGraphStart(this->_auGraph);
} }
@ -612,14 +610,14 @@ void CoreAudioInput::SetGainAsNormalized(float normalizedGain)
Float32 gainValue = normalizedGain; Float32 gainValue = normalizedGain;
UInt32 gainPropSize = sizeof(gainValue); UInt32 gainPropSize = sizeof(gainValue);
OSSpinLockLock(this->_spinlockAUHAL); apple_unfairlock_lock(this->_unfairlockAUHAL);
AudioUnitSetProperty(this->_auHALInputDevice, AudioUnitSetProperty(this->_auHALInputDevice,
kAudioDevicePropertyVolumeScalar, kAudioDevicePropertyVolumeScalar,
kAudioUnitScope_Input, kAudioUnitScope_Input,
this->_inputElement, this->_inputElement,
&gainValue, &gainValue,
gainPropSize); gainPropSize);
OSSpinLockUnlock(this->_spinlockAUHAL); apple_unfairlock_unlock(this->_unfairlockAUHAL);
} }
void CoreAudioInput::UpdateHardwareGain(float normalizedGain) void CoreAudioInput::UpdateHardwareGain(float normalizedGain)
@ -885,14 +883,13 @@ CoreAudioOutput::CoreAudioOutput(size_t bufferSamples, size_t sampleSize)
{ {
OSStatus error = noErr; OSStatus error = noErr;
_spinlockAU = (OSSpinLock *)malloc(sizeof(OSSpinLock)); _unfairlockAU = apple_unfairlock_create();
*_spinlockAU = OS_SPINLOCK_INIT;
_buffer = new RingBuffer(bufferSamples, sampleSize); _buffer = new RingBuffer(bufferSamples, sampleSize);
_volume = 1.0f; _volume = 1.0f;
// Create a new audio unit // Create a new audio unit
#if !defined(FORCE_AUDIOCOMPONENT_10_5) && defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #if !defined(FORCE_AUDIOCOMPONENT_10_5) && defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if (IsOSXVersionSupported(10, 6, 0)) if (IsOSXVersionSupported(10, 6, 0))
{ {
AudioComponentDescription audioDesc; AudioComponentDescription audioDesc;
@ -967,46 +964,45 @@ CoreAudioOutput::CoreAudioOutput(size_t bufferSamples, size_t sampleSize)
CoreAudioOutput::~CoreAudioOutput() CoreAudioOutput::~CoreAudioOutput()
{ {
OSSpinLockLock(_spinlockAU); apple_unfairlock_lock(this->_unfairlockAU);
DestroyAudioUnitInstance(&_au); DestroyAudioUnitInstance(&this->_au);
OSSpinLockUnlock(_spinlockAU); apple_unfairlock_unlock(this->_unfairlockAU);
delete _buffer; delete this->_buffer;
_buffer = NULL; this->_buffer = NULL;
free(_spinlockAU); apple_unfairlock_destroy(this->_unfairlockAU);
_spinlockAU = NULL;
} }
void CoreAudioOutput::start() void CoreAudioOutput::start()
{ {
this->clearBuffer(); this->clearBuffer();
OSSpinLockLock(this->_spinlockAU); apple_unfairlock_lock(this->_unfairlockAU);
AudioUnitReset(this->_au, kAudioUnitScope_Global, 0); AudioUnitReset(this->_au, kAudioUnitScope_Global, 0);
AudioOutputUnitStart(this->_au); AudioOutputUnitStart(this->_au);
OSSpinLockUnlock(this->_spinlockAU); apple_unfairlock_unlock(this->_unfairlockAU);
} }
void CoreAudioOutput::pause() void CoreAudioOutput::pause()
{ {
OSSpinLockLock(this->_spinlockAU); apple_unfairlock_lock(this->_unfairlockAU);
AudioOutputUnitStop(this->_au); AudioOutputUnitStop(this->_au);
OSSpinLockUnlock(this->_spinlockAU); apple_unfairlock_unlock(this->_unfairlockAU);
} }
void CoreAudioOutput::unpause() void CoreAudioOutput::unpause()
{ {
OSSpinLockLock(this->_spinlockAU); apple_unfairlock_lock(this->_unfairlockAU);
AudioOutputUnitStart(this->_au); AudioOutputUnitStart(this->_au);
OSSpinLockUnlock(this->_spinlockAU); apple_unfairlock_unlock(this->_unfairlockAU);
} }
void CoreAudioOutput::stop() void CoreAudioOutput::stop()
{ {
OSSpinLockLock(this->_spinlockAU); apple_unfairlock_lock(this->_unfairlockAU);
AudioOutputUnitStop(this->_au); AudioOutputUnitStop(this->_au);
OSSpinLockUnlock(this->_spinlockAU); apple_unfairlock_unlock(this->_unfairlockAU);
this->clearBuffer(); this->clearBuffer();
} }
@ -1029,16 +1025,16 @@ void CoreAudioOutput::clearBuffer()
void CoreAudioOutput::mute() void CoreAudioOutput::mute()
{ {
OSSpinLockLock(this->_spinlockAU); apple_unfairlock_lock(this->_unfairlockAU);
AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, 0.0f, 0); AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, 0.0f, 0);
OSSpinLockUnlock(this->_spinlockAU); apple_unfairlock_unlock(this->_unfairlockAU);
} }
void CoreAudioOutput::unmute() void CoreAudioOutput::unmute()
{ {
OSSpinLockLock(this->_spinlockAU); apple_unfairlock_lock(this->_unfairlockAU);
AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, this->_volume, 0); AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, this->_volume, 0);
OSSpinLockUnlock(this->_spinlockAU); apple_unfairlock_unlock(this->_unfairlockAU);
} }
size_t CoreAudioOutput::getAvailableSamples() const size_t CoreAudioOutput::getAvailableSamples() const
@ -1055,9 +1051,9 @@ void CoreAudioOutput::setVolume(float vol)
{ {
this->_volume = vol; this->_volume = vol;
OSSpinLockLock(this->_spinlockAU); apple_unfairlock_lock(this->_unfairlockAU);
AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0); AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0);
OSSpinLockUnlock(this->_spinlockAU); apple_unfairlock_unlock(this->_unfairlockAU);
} }
OSStatus CoreAudioOutputRenderCallback(void *inRefCon, OSStatus CoreAudioOutputRenderCallback(void *inRefCon,
@ -1091,13 +1087,13 @@ bool CreateAudioUnitInstance(AudioUnit *au, ComponentDescription *auDescription)
return result; return result;
} }
Component theComponent = FindNextComponent(NULL, auDescription); SILENCE_DEPRECATION_MACOS_10_8( Component theComponent = FindNextComponent(NULL, auDescription) );
if (theComponent == NULL) if (theComponent == NULL)
{ {
return result; return result;
} }
OSErr error = OpenAComponent(theComponent, au); SILENCE_DEPRECATION_MACOS_10_8( OSErr error = OpenAComponent(theComponent, au) );
if (error != noErr) if (error != noErr)
{ {
return result; return result;
@ -1107,7 +1103,7 @@ bool CreateAudioUnitInstance(AudioUnit *au, ComponentDescription *auDescription)
return result; return result;
} }
#if !defined(FORCE_AUDIOCOMPONENT_10_5) && defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
bool CreateAudioUnitInstance(AudioUnit *au, AudioComponentDescription *auDescription) bool CreateAudioUnitInstance(AudioUnit *au, AudioComponentDescription *auDescription)
{ {
bool result = false; bool result = false;
@ -1142,7 +1138,7 @@ void DestroyAudioUnitInstance(AudioUnit *au)
AudioOutputUnitStop(*au); AudioOutputUnitStop(*au);
AudioUnitUninitialize(*au); AudioUnitUninitialize(*au);
#if !defined(FORCE_AUDIOCOMPONENT_10_5) && defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #if !defined(FORCE_AUDIOCOMPONENT_10_5) && defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if (IsOSXVersionSupported(10, 6, 0)) if (IsOSXVersionSupported(10, 6, 0))
{ {
AudioComponentInstanceDispose(*au); AudioComponentInstanceDispose(*au);
@ -1150,6 +1146,6 @@ void DestroyAudioUnitInstance(AudioUnit *au)
else else
#endif #endif
{ {
CloseComponent(*au); SILENCE_DEPRECATION_MACOS_10_8( CloseComponent(*au) );
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2012-2015 DeSmuME team Copyright (C) 2012-2022 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
@ -21,8 +21,8 @@
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#include <AudioUnit/AudioUnit.h> #include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioToolbox.h> #include <AudioToolbox/AudioToolbox.h>
#include <libkern/OSAtomic.h>
#include "utilities.h"
#include "ringbuffer.h" #include "ringbuffer.h"
#include "audiosamplegenerator.h" #include "audiosamplegenerator.h"
@ -48,7 +48,7 @@ typedef void (*CoreAudioInputHardwareGainChangedCallback)(float normalizedGain,
class CoreAudioInput : public AudioGenerator class CoreAudioInput : public AudioGenerator
{ {
private: private:
OSSpinLock *_spinlockAUHAL; apple_unfairlock_t _unfairlockAUHAL;
CoreAudioInputHardwareStateChangedCallback _hwStateChangedCallbackFunc; CoreAudioInputHardwareStateChangedCallback _hwStateChangedCallbackFunc;
void *_hwStateChangedCallbackParam1; void *_hwStateChangedCallbackParam1;
@ -112,7 +112,7 @@ class CoreAudioOutput
private: private:
AudioUnit _au; AudioUnit _au;
RingBuffer *_buffer; RingBuffer *_buffer;
OSSpinLock *_spinlockAU; apple_unfairlock_t _unfairlockAU;
float _volume; float _volume;
public: public:

View File

@ -1,7 +1,7 @@
/* /*
Copyright (C) 2007 Jeff Bland Copyright (C) 2007 Jeff Bland
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012 DeSmuME team Copyright (C) 2012-2022 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
@ -18,8 +18,11 @@
*/ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include "utilities.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
AppleUnfairLockSystemInitialize();
return NSApplicationMain(argc, (const char **) argv); return NSApplicationMain(argc, (const char **) argv);
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2012-2017 DeSmuME team Copyright (C) 2012-2022 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
@ -19,7 +19,7 @@
#import <OpenEmuBase/OEGameCore.h> #import <OpenEmuBase/OEGameCore.h>
#import "OENDSSystemResponderClient.h" #import "OENDSSystemResponderClient.h"
#import "../cocoa_input.h" #import "../cocoa_input.h"
#include <libkern/OSAtomic.h> #include "../utilities.h"
#include <pthread.h> #include <pthread.h>
@class CocoaDSCheatManager; @class CocoaDSCheatManager;
@ -41,7 +41,7 @@
OEIntSize displayAspectRatio; OEIntSize displayAspectRatio;
NSUInteger inputID[OENDSButtonCount]; // Key = OpenEmu's input ID, Value = DeSmuME's input ID NSUInteger inputID[OENDSButtonCount]; // Key = OpenEmu's input ID, Value = DeSmuME's input ID
OSSpinLock spinlockDisplayMode; apple_unfairlock_t unfairlockDisplayMode;
pthread_rwlock_t rwlockCoreExecute; pthread_rwlock_t rwlockCoreExecute;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2012-2021 DeSmuME team Copyright (C) 2012-2022 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
@ -52,7 +52,7 @@ volatile bool execute = true;
} }
// Set up threading locks // Set up threading locks
spinlockDisplayMode = OS_SPINLOCK_INIT; unfairlockDisplayMode = apple_unfairlock_create();
pthread_rwlock_init(&rwlockCoreExecute, NULL); pthread_rwlock_init(&rwlockCoreExecute, NULL);
// Set up input handling // Set up input handling
@ -136,15 +136,16 @@ volatile bool execute = true;
[self setCdsFirmware:nil]; [self setCdsFirmware:nil];
pthread_rwlock_destroy(&rwlockCoreExecute); pthread_rwlock_destroy(&rwlockCoreExecute);
apple_unfairlock_destroy(unfairlockDisplayMode);
[super dealloc]; [super dealloc];
} }
- (NSInteger) displayMode - (NSInteger) displayMode
{ {
OSSpinLockLock(&spinlockDisplayMode); apple_unfairlock_lock(unfairlockDisplayMode);
const NSInteger theMode = displayMode; const NSInteger theMode = displayMode;
OSSpinLockUnlock(&spinlockDisplayMode); apple_unfairlock_unlock(unfairlockDisplayMode);
return theMode; return theMode;
} }
@ -176,11 +177,11 @@ volatile bool execute = true;
break; break;
} }
OSSpinLockLock(&spinlockDisplayMode); apple_unfairlock_lock(unfairlockDisplayMode);
displayMode = theMode; displayMode = theMode;
displayRect = newDisplayRect; displayRect = newDisplayRect;
displayAspectRatio = newDisplayAspectRatio; displayAspectRatio = newDisplayAspectRatio;
OSSpinLockUnlock(&spinlockDisplayMode); apple_unfairlock_unlock(unfairlockDisplayMode);
} }
#pragma mark - Plug-in Support #pragma mark - Plug-in Support
@ -289,18 +290,18 @@ volatile bool execute = true;
- (OEIntRect)screenRect - (OEIntRect)screenRect
{ {
OSSpinLockLock(&spinlockDisplayMode); apple_unfairlock_lock(unfairlockDisplayMode);
const OEIntRect theRect = displayRect; const OEIntRect theRect = displayRect;
OSSpinLockUnlock(&spinlockDisplayMode); apple_unfairlock_unlock(unfairlockDisplayMode);
return theRect; return theRect;
} }
- (OEIntSize)aspectSize - (OEIntSize)aspectSize
{ {
OSSpinLockLock(&spinlockDisplayMode); apple_unfairlock_lock(unfairlockDisplayMode);
const OEIntSize theAspectRatio = displayAspectRatio; const OEIntSize theAspectRatio = displayAspectRatio;
OSSpinLockUnlock(&spinlockDisplayMode); apple_unfairlock_unlock(unfairlockDisplayMode);
return theAspectRatio; return theAspectRatio;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2015 DeSmuME team Copyright (C) 2013-2022 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
@ -18,7 +18,7 @@
#include "ringbuffer.h" #include "ringbuffer.h"
#include <string.h> #include <string.h>
#include <libkern/OSAtomic.h> #include "types.h"
RingBuffer::RingBuffer(const size_t numberElements, const size_t elementSize) RingBuffer::RingBuffer(const size_t numberElements, const size_t elementSize)
@ -123,7 +123,7 @@ size_t RingBuffer::read(void *__restrict__ destBuffer, size_t requestedNumberEle
this->_readPosition = inputDataReadPos; this->_readPosition = inputDataReadPos;
// Decrease the fill size now that we're done reading. // Decrease the fill size now that we're done reading.
OSAtomicAdd32Barrier(-(int32_t)requestedNumberElements, &this->_elementFillCount); atomic_add_barrier32(&this->_elementFillCount, -(s32)requestedNumberElements);
return requestedNumberElements; return requestedNumberElements;
} }
@ -170,7 +170,7 @@ size_t RingBuffer::write(const void *__restrict__ srcBuffer, size_t requestedNum
} }
// Increase the fill size before writing anything. // Increase the fill size before writing anything.
OSAtomicAdd32Barrier((int32_t)requestedNumberElements, &this->_elementFillCount); atomic_add_barrier32(&this->_elementFillCount, (s32)requestedNumberElements);
// Copy source buffer to ring buffer. // Copy source buffer to ring buffer.
if (requestedNumberElements <= hiElementsAvailable) if (requestedNumberElements <= hiElementsAvailable)
@ -240,7 +240,7 @@ size_t RingBuffer::drop(size_t requestedNumberElements)
this->_readPosition = inputDataReadPos; this->_readPosition = inputDataReadPos;
// Decrease the fill size now that we're done reading. // Decrease the fill size now that we're done reading.
OSAtomicAdd32Barrier(-(int32_t)requestedNumberElements, &this->_elementFillCount); atomic_add_barrier32(&this->_elementFillCount, -(s32)requestedNumberElements);
return requestedNumberElements; return requestedNumberElements;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013 DeSmuME team Copyright (C) 2013-2022 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
@ -30,7 +30,7 @@ private:
size_t _elementCapacity; size_t _elementCapacity;
size_t _elementSize; size_t _elementSize;
int32_t _elementFillCount; // need to use int32_t for OSAtomicAdd32Barrier() int32_t _elementFillCount; // need to use int32_t for atomic_add_barrier32()
size_t _readPosition; size_t _readPosition;
size_t _writePosition; size_t _writePosition;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2021 DeSmuME team Copyright (C) 2013-2022 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
@ -592,7 +592,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
screenRect.origin.y = 0.0; screenRect.origin.y = 0.0;
DisplayFullScreenWindow *newFullScreenWindow = [[[DisplayFullScreenWindow alloc] initWithContentRect:screenRect DisplayFullScreenWindow *newFullScreenWindow = [[[DisplayFullScreenWindow alloc] initWithContentRect:screenRect
styleMask:NSBorderlessWindowMask styleMask:WINDOWSTYLEMASK_BORDERLESS
backing:NSBackingStoreBuffered backing:NSBackingStoreBuffered
defer:NO defer:NO
screen:targetScreen] autorelease]; screen:targetScreen] autorelease];
@ -1015,7 +1015,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:(viewScale == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:(viewScale == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(changeRotation:)) else if (theAction == @selector(changeRotation:))
@ -1031,16 +1031,16 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
viewRotation == 180 || viewRotation == 180 ||
viewRotation == 270) viewRotation == 270)
{ {
[(NSMenuItem *)theItem setState:NSOffState]; [(NSMenuItem *)theItem setState:GUI_STATE_OFF];
} }
else else
{ {
[(NSMenuItem *)theItem setState:NSOnState]; [(NSMenuItem *)theItem setState:GUI_STATE_ON];
} }
} }
else else
{ {
[(NSMenuItem *)theItem setState:(viewRotation == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:(viewRotation == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
} }
@ -1048,21 +1048,21 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([self displayMode] == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([self displayMode] == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(changeDisplayOrientation:)) else if (theAction == @selector(changeDisplayOrientation:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([self displayOrientation] == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([self displayOrientation] == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(changeDisplayOrder:)) else if (theAction == @selector(changeDisplayOrder:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([self displayOrder] == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([self displayOrder] == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(changeDisplayGap:)) else if (theAction == @selector(changeDisplayGap:))
@ -1081,16 +1081,16 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
gapScalar == 150 || gapScalar == 150 ||
gapScalar == 200) gapScalar == 200)
{ {
[(NSMenuItem *)theItem setState:NSOffState]; [(NSMenuItem *)theItem setState:GUI_STATE_OFF];
} }
else else
{ {
[(NSMenuItem *)theItem setState:NSOnState]; [(NSMenuItem *)theItem setState:GUI_STATE_ON];
} }
} }
else else
{ {
[(NSMenuItem *)theItem setState:(gapScalar == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:(gapScalar == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
} }
@ -1101,11 +1101,11 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{ {
if ([theItem tag] >= DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE) if ([theItem tag] >= DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE)
{ {
[(NSMenuItem *)theItem setState:([[self view] displayTouchVideoSource] == ([theItem tag]-DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE)) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] displayTouchVideoSource] == ([theItem tag]-DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE)) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
else else
{ {
[(NSMenuItem *)theItem setState:([[self view] displayMainVideoSource] == ([theItem tag]-DISPLAY_VIDEO_SOURCE_MAIN_TAG_BASE)) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] displayMainVideoSource] == ([theItem tag]-DISPLAY_VIDEO_SOURCE_MAIN_TAG_BASE)) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
} }
@ -1113,7 +1113,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] outputFilter] == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] outputFilter] == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
enable = ([theItem tag] == OutputFilterTypeID_NearestNeighbor || [theItem tag] == OutputFilterTypeID_Bilinear) || [[self view] canUseShaderBasedFilters]; enable = ([theItem tag] == OutputFilterTypeID_NearestNeighbor || [theItem tag] == OutputFilterTypeID_Bilinear) || [[self view] canUseShaderBasedFilters];
} }
} }
@ -1121,7 +1121,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] sourceDeposterize]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] sourceDeposterize]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
enable = [[self view] canUseShaderBasedFilters]; enable = [[self view] canUseShaderBasedFilters];
@ -1130,14 +1130,14 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] videoFiltersPreferGPU]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] videoFiltersPreferGPU]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(changeVideoPixelScaler:)) else if (theAction == @selector(changeVideoPixelScaler:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] pixelScaler] == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] pixelScaler] == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
bool isSupportingCPU = false; bool isSupportingCPU = false;
bool isSupportingShader = false; bool isSupportingShader = false;
@ -1150,63 +1150,63 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleShowHUDExecutionSpeed:)) else if (theAction == @selector(toggleShowHUDExecutionSpeed:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDExecutionSpeedVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDExecutionSpeedVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleShowHUDVideoFPS:)) else if (theAction == @selector(toggleShowHUDVideoFPS:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDVideoFPSVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDVideoFPSVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleShowHUDRender3DFPS:)) else if (theAction == @selector(toggleShowHUDRender3DFPS:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDRender3DFPSVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDRender3DFPSVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleShowHUDFrameIndex:)) else if (theAction == @selector(toggleShowHUDFrameIndex:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDFrameIndexVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDFrameIndexVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleShowHUDLagFrameCount:)) else if (theAction == @selector(toggleShowHUDLagFrameCount:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDLagFrameCountVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDLagFrameCountVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleShowHUDCPULoadAverage:)) else if (theAction == @selector(toggleShowHUDCPULoadAverage:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDCPULoadAverageVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDCPULoadAverageVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleShowHUDRealTimeClock:)) else if (theAction == @selector(toggleShowHUDRealTimeClock:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDRealTimeClockVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDRealTimeClockVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleShowHUDInput:)) else if (theAction == @selector(toggleShowHUDInput:))
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([[self view] isHUDInputVisible]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([[self view] isHUDInputVisible]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleStatusBar:)) else if (theAction == @selector(toggleStatusBar:))
@ -1232,7 +1232,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem *)theItem setState:([self isMinSizeNormal]) ? NSOnState : NSOffState]; [(NSMenuItem *)theItem setState:([self isMinSizeNormal]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
if ([self isFullScreen]) if ([self isFullScreen])
@ -1701,7 +1701,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
const ClientDisplayPresenterProperties &props = cdv->Get3DPresenter()->GetPresenterProperties(); const ClientDisplayPresenterProperties &props = cdv->Get3DPresenter()->GetPresenterProperties();
const double scaleFactor = cdv->Get3DPresenter()->GetScaleFactor(); const double scaleFactor = cdv->Get3DPresenter()->GetScaleFactor();
const NSEventType eventType = [theEvent type]; const NSEventType eventType = [theEvent type];
const bool isInitialMouseDown = (eventType == NSLeftMouseDown) || (eventType == NSRightMouseDown) || (eventType == NSOtherMouseDown); const bool isInitialMouseDown = (eventType == EVENT_MOUSEDOWN_LEFT) || (eventType == EVENT_MOUSEDOWN_RIGHT) || (eventType == EVENT_MOUSEDOWN_OTHER);
// Convert the clicked location from window coordinates, to view coordinates, and finally to NDS touchscreen coordinates. // 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]; const NSPoint clientLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
@ -2113,7 +2113,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
#if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) #if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
if ([self respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) if ([self respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)])
{ {
[self setWantsBestResolutionOpenGLSurface:YES]; SILENCE_DEPRECATION_MACOS_10_14([self setWantsBestResolutionOpenGLSurface:YES])
} }
#endif #endif
localOGLContext = ((MacOGLDisplayPresenter *)macOGLCDV->Get3DPresenter())->GetNSContext(); localOGLContext = ((MacOGLDisplayPresenter *)macOGLCDV->Get3DPresenter())->GetNSContext();

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2021 DeSmuME Team Copyright (C) 2013-2022 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
@ -16,8 +16,8 @@
*/ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <libkern/OSAtomic.h>
#import "../cocoa_input.h" #import "../cocoa_input.h"
#include "../utilities.h"
@class InputManager; @class InputManager;
@class CocoaDSRom; @class CocoaDSRom;
@ -120,8 +120,8 @@ class AudioSampleBlockGenerator;
DisplayWindowController *mainWindow; DisplayWindowController *mainWindow;
NSMutableArray *windowList; NSMutableArray *windowList;
OSSpinLock spinlockFirmware; apple_unfairlock_t _unfairlockFirmware;
OSSpinLock spinlockSpeaker; apple_unfairlock_t _unfairlockSpeaker;
} }
@property (readonly) IBOutlet InputManager *inputManager; @property (readonly) IBOutlet InputManager *inputManager;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2021 DeSmuME Team Copyright (C) 2013-2022 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
@ -111,8 +111,8 @@
return nil; return nil;
} }
spinlockFirmware = OS_SPINLOCK_INIT; _unfairlockFirmware = apple_unfairlock_create();
spinlockSpeaker = OS_SPINLOCK_INIT; _unfairlockSpeaker = apple_unfairlock_create();
mainWindow = nil; mainWindow = nil;
windowList = [[NSMutableArray alloc] initWithCapacity:32]; windowList = [[NSMutableArray alloc] initWithCapacity:32];
@ -222,6 +222,9 @@
[self setMainWindow:nil]; [self setMainWindow:nil];
[windowList release]; [windowList release];
apple_unfairlock_destroy(_unfairlockFirmware);
apple_unfairlock_destroy(_unfairlockSpeaker);
[super dealloc]; [super dealloc];
} }
@ -229,11 +232,11 @@
- (void) setCdsFirmware:(CocoaDSFirmware *)theFirmware - (void) setCdsFirmware:(CocoaDSFirmware *)theFirmware
{ {
OSSpinLockLock(&spinlockFirmware); apple_unfairlock_lock(_unfairlockFirmware);
if (theFirmware == cdsFirmware) if (theFirmware == cdsFirmware)
{ {
OSSpinLockUnlock(&spinlockFirmware); apple_unfairlock_unlock(_unfairlockFirmware);
return; return;
} }
@ -250,25 +253,25 @@
[cdsFirmware release]; [cdsFirmware release];
cdsFirmware = theFirmware; cdsFirmware = theFirmware;
OSSpinLockUnlock(&spinlockFirmware); apple_unfairlock_unlock(_unfairlockFirmware);
} }
- (CocoaDSFirmware *) cdsFirmware - (CocoaDSFirmware *) cdsFirmware
{ {
OSSpinLockLock(&spinlockFirmware); apple_unfairlock_lock(_unfairlockFirmware);
CocoaDSFirmware *theFirmware = cdsFirmware; CocoaDSFirmware *theFirmware = cdsFirmware;
OSSpinLockUnlock(&spinlockFirmware); apple_unfairlock_unlock(_unfairlockFirmware);
return theFirmware; return theFirmware;
} }
- (void) setCdsSpeaker:(CocoaDSSpeaker *)theSpeaker - (void) setCdsSpeaker:(CocoaDSSpeaker *)theSpeaker
{ {
OSSpinLockLock(&spinlockSpeaker); apple_unfairlock_lock(_unfairlockSpeaker);
if (theSpeaker == cdsSpeaker) if (theSpeaker == cdsSpeaker)
{ {
OSSpinLockUnlock(&spinlockSpeaker); apple_unfairlock_unlock(_unfairlockSpeaker);
return; return;
} }
@ -282,14 +285,14 @@
[cdsSpeaker release]; [cdsSpeaker release];
cdsSpeaker = theSpeaker; cdsSpeaker = theSpeaker;
OSSpinLockUnlock(&spinlockSpeaker); apple_unfairlock_unlock(_unfairlockSpeaker);
} }
- (CocoaDSSpeaker *) cdsSpeaker - (CocoaDSSpeaker *) cdsSpeaker
{ {
OSSpinLockLock(&spinlockSpeaker); apple_unfairlock_lock(_unfairlockSpeaker);
CocoaDSSpeaker *theSpeaker = cdsSpeaker; CocoaDSSpeaker *theSpeaker = cdsSpeaker;
OSSpinLockUnlock(&spinlockSpeaker); apple_unfairlock_unlock(_unfairlockSpeaker);
return theSpeaker; return theSpeaker;
} }
@ -361,6 +364,7 @@
} }
NSURL *selectedFile = nil; NSURL *selectedFile = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel]; NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO]; [panel setCanChooseDirectories:NO];
@ -370,16 +374,24 @@
[panel setTitle:NSSTRING_TITLE_OPEN_ROM_PANEL]; [panel setTitle:NSSTRING_TITLE_OPEN_ROM_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_ROM_DS, @FILE_EXT_ROM_GBA, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_ROM_DS, @FILE_EXT_ROM_GBA, nil];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types: // While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// is deprecated in Mac OS X v10.6. // are available in Leopard, the allowedFileTypes property is ignored on
// that version of macOS. To maintain compatibility with Leopard, we need
// to call the deprecated method [NSOpenPanel runModalForDirectory:file:types]
// instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal]; buttonClicked = [panel runModal];
#else }
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes]; else
#endif #endif
{
SILENCE_DEPRECATION_MACOS_10_6( buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes] );
}
if (buttonClicked == NSFileHandlingPanelOKButton) if (buttonClicked == GUI_RESPONSE_OK)
{ {
selectedFile = [[panel URLs] lastObject]; selectedFile = [[panel URLs] lastObject];
if(selectedFile == nil) if(selectedFile == nil)
@ -420,6 +432,7 @@
- (IBAction) openEmuSaveState:(id)sender - (IBAction) openEmuSaveState:(id)sender
{ {
NSURL *selectedFile = nil; NSURL *selectedFile = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel]; NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO]; [panel setCanChooseDirectories:NO];
@ -429,16 +442,24 @@
[panel setTitle:NSSTRING_TITLE_OPEN_STATE_FILE_PANEL]; [panel setTitle:NSSTRING_TITLE_OPEN_STATE_FILE_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_SAVE_STATE, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_SAVE_STATE, nil];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types: // While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// is deprecated in Mac OS X v10.6. // are available in Leopard, the allowedFileTypes property is ignored on
// that version of macOS. To maintain compatibility with Leopard, we need
// to call the deprecated method [NSOpenPanel runModalForDirectory:file:types]
// instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal]; buttonClicked = [panel runModal];
#else }
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes]; else
#endif #endif
{
SILENCE_DEPRECATION_MACOS_10_6( buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes] );
}
if (buttonClicked == NSFileHandlingPanelOKButton) if (buttonClicked == GUI_RESPONSE_OK)
{ {
selectedFile = [[panel URLs] lastObject]; selectedFile = [[panel URLs] lastObject];
if(selectedFile == nil) if(selectedFile == nil)
@ -507,17 +528,24 @@
[panel setCanCreateDirectories:YES]; [panel setCanCreateDirectories:YES];
[panel setTitle:NSSTRING_TITLE_SAVE_STATE_FILE_PANEL]; [panel setTitle:NSSTRING_TITLE_SAVE_STATE_FILE_PANEL];
// The NSSavePanel method -(void)setRequiredFileType: // While [NSSavePanel setAllowedFileTypes:] is available in Leopard, the
// is deprecated in Mac OS X v10.6. // allowedFileTypes property is ignored on that version of macOS. To maintain
// compatibility with Leopard, we need to call the deprecated method
// [NSSavePanel setRequiredFileType:] instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_SAVE_STATE, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_SAVE_STATE, nil];
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
#else }
[panel setRequiredFileType:@FILE_EXT_SAVE_STATE]; else
#endif #endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel setRequiredFileType:@FILE_EXT_SAVE_STATE] );
}
const NSInteger buttonClicked = [panel runModal]; const NSInteger buttonClicked = [panel runModal];
if(buttonClicked == NSOKButton) if (buttonClicked == GUI_RESPONSE_OK)
{ {
NSURL *saveFileURL = [panel URL]; NSURL *saveFileURL = [panel URL];
@ -582,6 +610,7 @@
- (IBAction) openReplay:(id)sender - (IBAction) openReplay:(id)sender
{ {
NSURL *selectedFile = nil; NSURL *selectedFile = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel]; NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO]; [panel setCanChooseDirectories:NO];
@ -591,16 +620,24 @@
[panel setTitle:@"Load Replay"]; [panel setTitle:@"Load Replay"];
NSArray *fileTypes = [NSArray arrayWithObjects:@"dsm", nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@"dsm", nil];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types: // While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// is deprecated in Mac OS X v10.6. // are available in Leopard, the allowedFileTypes property is ignored on
// that version of macOS. To maintain compatibility with Leopard, we need
// to call the deprecated method [NSOpenPanel runModalForDirectory:file:types]
// instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal]; buttonClicked = [panel runModal];
#else }
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes]; else
#endif #endif
{
SILENCE_DEPRECATION_MACOS_10_6( buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes] );
}
if (buttonClicked == NSFileHandlingPanelOKButton) if (buttonClicked == GUI_RESPONSE_OK)
{ {
selectedFile = [[panel URLs] lastObject]; selectedFile = [[panel URLs] lastObject];
if(selectedFile == nil) if(selectedFile == nil)
@ -621,17 +658,24 @@
[panel setCanCreateDirectories:YES]; [panel setCanCreateDirectories:YES];
[panel setTitle:@"Record Replay"]; [panel setTitle:@"Record Replay"];
// The NSSavePanel method -(void)setRequiredFileType: // While [NSSavePanel setAllowedFileTypes:] is available in Leopard, the
// is deprecated in Mac OS X v10.6. // allowedFileTypes property is ignored on that version of macOS. To maintain
// compatibility with Leopard, we need to call the deprecated method
// [NSSavePanel setRequiredFileType:] instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
NSArray *fileTypes = [NSArray arrayWithObjects:@"dsm", nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@"dsm", nil];
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
#else }
[panel setRequiredFileType:@"dsm"]; else
#endif #endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel setRequiredFileType:@"dsm"] );
}
const NSInteger buttonClicked = [panel runModal]; const NSInteger buttonClicked = [panel runModal];
if (buttonClicked == NSFileHandlingPanelOKButton) if (buttonClicked == GUI_RESPONSE_OK)
{ {
NSURL *fileURL = [panel URL]; NSURL *fileURL = [panel URL];
if(fileURL == nil) if(fileURL == nil)
@ -666,6 +710,7 @@
- (IBAction) importRomSave:(id)sender - (IBAction) importRomSave:(id)sender
{ {
NSURL *selectedFile = nil; NSURL *selectedFile = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel]; NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO]; [panel setCanChooseDirectories:NO];
@ -682,16 +727,24 @@
[self pauseCore]; [self pauseCore];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types: // While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// is deprecated in Mac OS X v10.6. // are available in Leopard, the allowedFileTypes property is ignored on
// that version of macOS. To maintain compatibility with Leopard, we need
// to call the deprecated method [NSOpenPanel runModalForDirectory:file:types]
// instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal]; buttonClicked = [panel runModal];
#else }
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes]; else
#endif #endif
{
SILENCE_DEPRECATION_MACOS_10_6( buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes] );
}
if (buttonClicked == NSFileHandlingPanelOKButton) if (buttonClicked == GUI_RESPONSE_OK)
{ {
selectedFile = [[panel URLs] lastObject]; selectedFile = [[panel URLs] lastObject];
if(selectedFile == nil) if(selectedFile == nil)
@ -716,7 +769,7 @@
[self pauseCore]; [self pauseCore];
const NSInteger buttonClicked = [panel runModal]; const NSInteger buttonClicked = [panel runModal];
if(buttonClicked == NSOKButton) if (buttonClicked == GUI_RESPONSE_OK)
{ {
NSURL *romSaveURL = [CocoaDSFile fileURLFromRomURL:[[self currentRom] fileURL] toKind:@"ROM Save"]; NSURL *romSaveURL = [CocoaDSFile fileURLFromRomURL:[[self currentRom] fileURL] toKind:@"ROM Save"];
if (romSaveURL != nil) if (romSaveURL != nil)
@ -914,22 +967,25 @@
[panel setAllowsMultipleSelection:NO]; [panel setAllowsMultipleSelection:NO];
[panel setTitle:@"Select R4 Directory"]; [panel setTitle:@"Select R4 Directory"];
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel beginSheetModalForWindow:slot1ManagerWindow [panel beginSheetModalForWindow:slot1ManagerWindow
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self didEndChooseSlot1R4Directory:panel returnCode:result contextInfo:nil]; [self didEndChooseSlot1R4Directory:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:nil types:nil
modalForWindow:slot1ManagerWindow modalForWindow:slot1ManagerWindow
modalDelegate:self modalDelegate:self
didEndSelector:@selector(didEndChooseSlot1R4Directory:returnCode:contextInfo:) didEndSelector:@selector(didEndChooseSlot1R4Directory:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (IBAction) slot1Eject:(id)sender - (IBAction) slot1Eject:(id)sender
@ -1116,7 +1172,7 @@
NSWindow *sheet = [(NSControl *)sender window]; NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [(NSControl *)sender tag]; const NSInteger code = [(NSControl *)sender tag];
[NSApp endSheet:sheet returnCode:code]; [CocoaDSUtil endSheet:sheet returnCode:code];
} }
#pragma mark Class Methods #pragma mark Class Methods
@ -1643,11 +1699,25 @@
[self setIsUserInterfaceBlockingExecution:YES]; [self setIsUserInterfaceBlockingExecution:YES];
[self setIsShowingFileMigrationDialog:YES]; [self setIsShowingFileMigrationDialog:YES];
[NSApp beginSheet:saveFileMigrationSheet NSWindow *window = [[windowList objectAtIndex:0] window];
modalForWindow:[[windowList objectAtIndex:0] window]
#if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([window respondsToSelector:@selector(beginSheet:completionHandler:)])
{
[window beginSheet:saveFileMigrationSheet
completionHandler:^(NSModalResponse response) {
[self didEndFileMigrationSheet:nil returnCode:response contextInfo:fileURL];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:saveFileMigrationSheet
modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(didEndFileMigrationSheet:returnCode:contextInfo:) didEndSelector:@selector(didEndFileMigrationSheet:returnCode:contextInfo:)
contextInfo:fileURL]; contextInfo:fileURL] );
}
} }
else else
{ {
@ -1690,11 +1760,41 @@
[self setIsUserInterfaceBlockingExecution:YES]; [self setIsUserInterfaceBlockingExecution:YES];
[self setIsShowingSaveStateDialog:YES]; [self setIsShowingSaveStateDialog:YES];
[NSApp beginSheet:saveStatePrecloseSheet NSWindow *window = [[windowList objectAtIndex:0] window];
modalForWindow:(NSWindow *)[[windowList objectAtIndex:0] window]
#if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([window respondsToSelector:@selector(beginSheet:completionHandler:)])
{
[window beginSheet:saveStatePrecloseSheet
completionHandler:^(NSModalResponse response) {
switch (reasonID)
{
case REASONFORCLOSE_NORMAL:
[self didEndSaveStateSheet:nil returnCode:response contextInfo:romURL];
break;
case REASONFORCLOSE_OPEN:
[self didEndSaveStateSheetOpen:nil returnCode:response contextInfo:romURL];
break;
case REASONFORCLOSE_TERMINATE:
[self didEndSaveStateSheetTerminate:nil returnCode:response contextInfo:romURL];
break;
default:
break;
}
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:saveStatePrecloseSheet
modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:endSheetSelector didEndSelector:endSheetSelector
contextInfo:romURL]; contextInfo:romURL] );
}
} }
else else
{ {
@ -2015,11 +2115,25 @@
newTextFieldRect.size.height = 16.0f * lineCount; newTextFieldRect.size.height = 16.0f * lineCount;
[ndsErrorStatusTextField setFrame:newTextFieldRect]; [ndsErrorStatusTextField setFrame:newTextFieldRect];
[NSApp beginSheet:ndsErrorSheet NSWindow *window = [[windowList objectAtIndex:0] window];
modalForWindow:(NSWindow *)[[windowList objectAtIndex:0] window]
#if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([window respondsToSelector:@selector(beginSheet:completionHandler:)])
{
[window beginSheet:ndsErrorSheet
completionHandler:^(NSModalResponse response) {
[self didEndErrorSheet:nil returnCode:response contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:ndsErrorSheet
modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(didEndErrorSheet:returnCode:contextInfo:) didEndSelector:@selector(didEndErrorSheet:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
}
} }
- (void) handleEmulatorExecutionState:(NSNotification *)aNotification - (void) handleEmulatorExecutionState:(NSNotification *)aNotification
@ -2133,7 +2247,7 @@
switch (returnCode) switch (returnCode)
{ {
case NSOKButton: case GUI_RESPONSE_OK:
[CocoaDSFile moveFileToCurrentDirectory:romSaveURL]; [CocoaDSFile moveFileToCurrentDirectory:romSaveURL];
break; break;
@ -2155,7 +2269,7 @@
switch (returnCode) switch (returnCode)
{ {
case NSCancelButton: // Cancel case GUI_RESPONSE_CANCEL: // Cancel
[self restoreCoreState]; [self restoreCoreState];
[self setIsUserInterfaceBlockingExecution:NO]; [self setIsUserInterfaceBlockingExecution:NO];
[self setIsShowingSaveStateDialog:NO]; [self setIsShowingSaveStateDialog:NO];
@ -2199,7 +2313,7 @@
{ {
[self didEndSaveStateSheet:sheet returnCode:returnCode contextInfo:contextInfo]; [self didEndSaveStateSheet:sheet returnCode:returnCode contextInfo:contextInfo];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
[NSApp replyToApplicationShouldTerminate:NO]; [NSApp replyToApplicationShouldTerminate:NO];
} }
@ -2216,7 +2330,7 @@
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }
@ -2244,7 +2358,7 @@
[self reset:self]; [self reset:self];
break; break;
case NSCancelButton: // Stop case GUI_RESPONSE_CANCEL: // Stop
default: default:
break; break;
} }
@ -2814,11 +2928,11 @@
{ {
if ([CocoaDSFile saveStateExistsForSlot:[[self currentRom] fileURL] slotNumber:[theItem tag] + 1]) if ([CocoaDSFile saveStateExistsForSlot:[[self currentRom] fileURL] slotNumber:[theItem tag] + 1])
{ {
[(NSMenuItem*)theItem setState:NSOnState]; [(NSMenuItem*)theItem setState:GUI_STATE_ON];
} }
else else
{ {
[(NSMenuItem*)theItem setState:NSOffState]; [(NSMenuItem*)theItem setState:GUI_STATE_OFF];
} }
} }
} }
@ -2855,16 +2969,16 @@
speedScalar == (NSInteger)(SPEED_SCALAR_NORMAL * 100.0) || speedScalar == (NSInteger)(SPEED_SCALAR_NORMAL * 100.0) ||
speedScalar == (NSInteger)(SPEED_SCALAR_DOUBLE * 100.0)) speedScalar == (NSInteger)(SPEED_SCALAR_DOUBLE * 100.0))
{ {
[(NSMenuItem*)theItem setState:NSOffState]; [(NSMenuItem*)theItem setState:GUI_STATE_OFF];
} }
else else
{ {
[(NSMenuItem*)theItem setState:NSOnState]; [(NSMenuItem*)theItem setState:GUI_STATE_ON];
} }
} }
else else
{ {
[(NSMenuItem*)theItem setState:(speedScalar == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem*)theItem setState:(speedScalar == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if ([(id)theItem isMemberOfClass:[NSToolbarItem class]]) else if ([(id)theItem isMemberOfClass:[NSToolbarItem class]])
@ -2906,7 +3020,7 @@
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem*)theItem setState:([cdsCore framesToSkipSetting] == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem*)theItem setState:([cdsCore framesToSkipSetting] == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(toggleCheats:)) else if (theAction == @selector(toggleCheats:))
@ -2920,7 +3034,7 @@
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem*)theItem setState:([self selectedRomSaveTypeID] == [theItem tag]) ? NSOnState : NSOffState]; [(NSMenuItem*)theItem setState:([self selectedRomSaveTypeID] == [theItem tag]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }
else if (theAction == @selector(openEmuSaveState:) || else if (theAction == @selector(openEmuSaveState:) ||
@ -2946,7 +3060,7 @@
{ {
if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{ {
[(NSMenuItem*)theItem setState:([cdsCore.cdsGPU gpuStateByBit:[theItem tag]]) ? NSOnState : NSOffState]; [(NSMenuItem*)theItem setState:([[cdsCore cdsGPU] gpuStateByBit:[theItem tag]]) ? GUI_STATE_ON : GUI_STATE_OFF];
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2015 DeSmuME team Copyright (C) 2013-2022 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
@ -18,6 +18,7 @@
#import "FileMigrationDelegate.h" #import "FileMigrationDelegate.h"
#import "cocoa_file.h" #import "cocoa_file.h"
#import "cocoa_globals.h" #import "cocoa_globals.h"
#include "../utilities.h"
@implementation FileMigrationDelegate @implementation FileMigrationDelegate
@ -348,7 +349,7 @@
{ {
if (willMigrateFileCount > 0) if (willMigrateFileCount > 0)
{ {
return [NSNumber numberWithInteger:NSMixedState]; return [NSNumber numberWithInteger:GUI_STATE_MIXED];
} }
} }
} }
@ -357,7 +358,7 @@
{ {
if (willMigrateKindCount > 0) if (willMigrateKindCount > 0)
{ {
return [NSNumber numberWithInteger:NSMixedState]; return [NSNumber numberWithInteger:GUI_STATE_MIXED];
} }
} }
else if (willMigrateFileCount == fileCount) else if (willMigrateFileCount == fileCount)
@ -366,21 +367,21 @@
} }
else else
{ {
return [NSNumber numberWithInteger:NSMixedState]; return [NSNumber numberWithInteger:GUI_STATE_MIXED];
} }
} }
if (willMigrateKindCount == 0) if (willMigrateKindCount == 0)
{ {
return [NSNumber numberWithInteger:NSOffState]; return [NSNumber numberWithInteger:GUI_STATE_OFF];
} }
else if (willMigrateKindCount == kindCount) else if (willMigrateKindCount == kindCount)
{ {
return [NSNumber numberWithInteger:NSOnState]; return [NSNumber numberWithInteger:GUI_STATE_ON];
} }
else else
{ {
return [NSNumber numberWithInteger:NSMixedState]; return [NSNumber numberWithInteger:GUI_STATE_MIXED];
} }
} }
} }
@ -400,22 +401,22 @@
{ {
if (willMigrateFileCount > 0) if (willMigrateFileCount > 0)
{ {
return [NSNumber numberWithInteger:NSMixedState]; return [NSNumber numberWithInteger:GUI_STATE_MIXED];
} }
} }
} }
if (willMigrateFileCount == 0) if (willMigrateFileCount == 0)
{ {
return [NSNumber numberWithInteger:NSOffState]; return [NSNumber numberWithInteger:GUI_STATE_OFF];
} }
else if (willMigrateFileCount == fileCount) else if (willMigrateFileCount == fileCount)
{ {
return [NSNumber numberWithInteger:NSOnState]; return [NSNumber numberWithInteger:GUI_STATE_ON];
} }
else else
{ {
return [NSNumber numberWithInteger:NSMixedState]; return [NSNumber numberWithInteger:GUI_STATE_MIXED];
} }
} }
else if ([item isKindOfClass:[NSDictionary class]]) else if ([item isKindOfClass:[NSDictionary class]])
@ -463,7 +464,7 @@
if ([item isKindOfClass:[NSString class]]) if ([item isKindOfClass:[NSString class]])
{ {
NSMutableDictionary *versionDict = (NSMutableDictionary *)[_fileTree objectForKey:(NSString *)item]; NSMutableDictionary *versionDict = (NSMutableDictionary *)[_fileTree objectForKey:(NSString *)item];
const BOOL newSelectState = !([itemCell state] == NSOnState); const BOOL newSelectState = !([itemCell state] == GUI_STATE_ON);
for (NSString *kindKey in versionDict) for (NSString *kindKey in versionDict)
{ {
@ -500,7 +501,7 @@
} }
else if ([item isKindOfClass:[NSArray class]]) else if ([item isKindOfClass:[NSArray class]])
{ {
const BOOL newSelectState = !([itemCell state] == NSOnState); const BOOL newSelectState = !([itemCell state] == GUI_STATE_ON);
NSArray *fileList = (NSArray *)item; NSArray *fileList = (NSArray *)item;
if ([outlineView isItemExpanded:item]) if ([outlineView isItemExpanded:item])
@ -523,7 +524,7 @@
} }
else if ([item isKindOfClass:[NSDictionary class]]) else if ([item isKindOfClass:[NSDictionary class]])
{ {
const BOOL newSelectState = !([itemCell state] == NSOnState); const BOOL newSelectState = !([itemCell state] == GUI_STATE_ON);
[self setFileSelectionInOutlineView:outlineView file:(NSMutableDictionary *)item isSelected:newSelectState]; [self setFileSelectionInOutlineView:outlineView file:(NSMutableDictionary *)item isSelected:newSelectState];
[outlineView reloadItem:[outlineView parentForItem:item]]; [outlineView reloadItem:[outlineView parentForItem:item]];
[outlineView reloadItem:[outlineView parentForItem:[outlineView parentForItem:item]]]; [outlineView reloadItem:[outlineView parentForItem:[outlineView parentForItem:item]]];

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2017 DeSmuME Team Copyright (C) 2013-2022 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
@ -16,7 +16,6 @@
*/ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <libkern/OSAtomic.h>
#include <IOKit/hid/IOHIDManager.h> #include <IOKit/hid/IOHIDManager.h>
#include <ForceFeedback/ForceFeedback.h> #include <ForceFeedback/ForceFeedback.h>
@ -32,6 +31,7 @@
#include "../audiosamplegenerator.h" #include "../audiosamplegenerator.h"
#include "../ClientInputHandler.h" #include "../ClientInputHandler.h"
#include "../utilities.h"
struct ClientCommandAttributes; struct ClientCommandAttributes;
struct ClientInputDeviceProperties; struct ClientInputDeviceProperties;
@ -82,7 +82,7 @@ typedef std::unordered_map<int32_t, std::string> KeyboardKeyNameMap; // Key = Ke
BOOL isForceFeedbackEnabled; BOOL isForceFeedbackEnabled;
NSRunLoop *runLoop; NSRunLoop *runLoop;
OSSpinLock spinlockRunLoop; apple_unfairlock_t _unfairlockRunLoop;
} }
@property (retain) InputHIDManager *hidManager; @property (retain) InputHIDManager *hidManager;
@ -127,8 +127,9 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
NSRunLoop *runLoop; NSRunLoop *runLoop;
NSArrayController *deviceListController; NSArrayController *deviceListController;
id<InputHIDManagerTarget> target; id<InputHIDManagerTarget> target;
uint32_t _pmAssertionID;
OSSpinLock spinlockRunLoop; apple_unfairlock_t _unfairlockRunLoop;
} }
@property (retain) NSArrayController *deviceListController; @property (retain) NSArrayController *deviceListController;
@ -138,6 +139,7 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
@property (retain) NSRunLoop *runLoop; @property (retain) NSRunLoop *runLoop;
- (id) initWithInputManager:(InputManager *)theInputManager; - (id) initWithInputManager:(InputManager *)theInputManager;
- (void) reportUserActivity;
@end @end

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2018 DeSmuME Team Copyright (C) 2012-2022 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
@ -23,6 +23,10 @@
#import "cocoa_input.h" #import "cocoa_input.h"
#import "cocoa_util.h" #import "cocoa_util.h"
#if defined(MAC_OS_X_VERSION_10_8) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8)
#include <IOKit/pwr_mgt/IOPMLib.h>
#endif
#include <AudioToolbox/AudioToolbox.h> #include <AudioToolbox/AudioToolbox.h>
/* /*
@ -116,7 +120,7 @@ static NSDictionary *hidUsageTable = nil;
CFRelease(elementArray); CFRelease(elementArray);
// Set up force feedback. // Set up force feedback.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if (IsOSXVersionSupported(10, 6, 0)) if (IsOSXVersionSupported(10, 6, 0))
{ {
ioService = IOHIDDeviceGetService(hidDeviceRef); ioService = IOHIDDeviceGetService(hidDeviceRef);
@ -126,7 +130,7 @@ static NSDictionary *hidUsageTable = nil;
} }
} }
else else
#else #endif
{ {
ioService = MACH_PORT_NULL; ioService = MACH_PORT_NULL;
@ -149,7 +153,6 @@ static NSDictionary *hidUsageTable = nil;
} }
} }
} }
#endif
ffDevice = NULL; ffDevice = NULL;
ffEffect = NULL; ffEffect = NULL;
@ -219,7 +222,7 @@ static NSDictionary *hidUsageTable = nil;
[identifier retain]; [identifier retain];
spinlockRunLoop = OS_SPINLOCK_INIT; _unfairlockRunLoop = apple_unfairlock_create();
[self setRunLoop:[NSRunLoop currentRunLoop]]; [self setRunLoop:[NSRunLoop currentRunLoop]];
return self; return self;
@ -232,6 +235,8 @@ static NSDictionary *hidUsageTable = nil;
[self setRunLoop:nil]; [self setRunLoop:nil];
[self setHidManager:nil]; [self setHidManager:nil];
apple_unfairlock_destroy(_unfairlockRunLoop);
if (hidQueueRef != NULL) if (hidQueueRef != NULL)
{ {
CFRelease(hidQueueRef); CFRelease(hidQueueRef);
@ -310,11 +315,11 @@ static NSDictionary *hidUsageTable = nil;
- (void) setRunLoop:(NSRunLoop *)theRunLoop - (void) setRunLoop:(NSRunLoop *)theRunLoop
{ {
OSSpinLockLock(&spinlockRunLoop); apple_unfairlock_lock(_unfairlockRunLoop);
if (theRunLoop == runLoop) if (theRunLoop == runLoop)
{ {
OSSpinLockUnlock(&spinlockRunLoop); apple_unfairlock_unlock(_unfairlockRunLoop);
return; return;
} }
@ -332,14 +337,14 @@ static NSDictionary *hidUsageTable = nil;
[runLoop release]; [runLoop release];
runLoop = theRunLoop; runLoop = theRunLoop;
OSSpinLockUnlock(&spinlockRunLoop); apple_unfairlock_unlock(_unfairlockRunLoop);
} }
- (NSRunLoop *) runLoop - (NSRunLoop *) runLoop
{ {
OSSpinLockLock(&spinlockRunLoop); apple_unfairlock_lock(_unfairlockRunLoop);
NSRunLoop *theRunLoop = runLoop; NSRunLoop *theRunLoop = runLoop;
OSSpinLockUnlock(&spinlockRunLoop); apple_unfairlock_unlock(_unfairlockRunLoop);
return theRunLoop; return theRunLoop;
} }
@ -527,7 +532,7 @@ ClientInputDevicePropertiesList InputListFromHIDValue(IOHIDValueRef hidValueRef,
// IOHIDValueGetIntegerValue() will crash if the value length is too large. // IOHIDValueGetIntegerValue() will crash if the value length is too large.
// Do a bounds check here to prevent crashing. This workaround makes the PS3 // Do a bounds check here to prevent crashing. This workaround makes the PS3
// controller usable, since it returns a length of 39 on some elements. // controller usable, since it returns a length of 39 on some elements.
if(IOHIDValueGetLength(hidValueRef) > 2) if (IOHIDValueGetLength(hidValueRef) > 2)
{ {
return inputPropertyList; return inputPropertyList;
} }
@ -791,13 +796,6 @@ size_t ClearHIDQueue(const IOHIDQueueRef hidQueue)
hidInputClearCount++; hidInputClearCount++;
} while (1); } while (1);
if (hidInputClearCount > 0)
{
// HID input devices don't register events, so we need to manually prevent
// sleep and screensaver whenever we detect an input.
UpdateSystemActivity(UsrActivity);
}
return hidInputClearCount; return hidInputClearCount;
} }
@ -817,7 +815,12 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
else else
{ {
// We must make sure the HID queue is emptied or else HID input will stall. // We must make sure the HID queue is emptied or else HID input will stall.
ClearHIDQueue(hidQueue); size_t hidInputClearCount = ClearHIDQueue(hidQueue);
if (hidInputClearCount > 0)
{
[hidManager reportUserActivity];
}
} }
} }
@ -838,6 +841,10 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
return self; return self;
} }
// kIOPMNullAssertionID isn't available on macOS v10.6 Snow Leopard,
// so just initialize the ID directly to 0.
_pmAssertionID = 0;
target = nil; target = nil;
deviceListController = nil; deviceListController = nil;
inputManager = [theInputManager retain]; inputManager = [theInputManager retain];
@ -870,7 +877,7 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
CFRelease(cfGamepadMatcher); CFRelease(cfGamepadMatcher);
CFRelease(cfGenericControllerMatcher); CFRelease(cfGenericControllerMatcher);
spinlockRunLoop = OS_SPINLOCK_INIT; _unfairlockRunLoop = apple_unfairlock_create();
IOReturn result = IOHIDManagerOpen(hidManagerRef, kIOHIDOptionsTypeNone); IOReturn result = IOHIDManagerOpen(hidManagerRef, kIOHIDOptionsTypeNone);
if (result != kIOReturnSuccess) if (result != kIOReturnSuccess)
@ -896,16 +903,26 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
hidManagerRef = NULL; hidManagerRef = NULL;
} }
if (_pmAssertionID > 0)
{
#if defined(MAC_OS_X_VERSION_10_8) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8)
IOPMAssertionRelease((IOPMAssertionID)_pmAssertionID);
#endif
_pmAssertionID = 0;
}
apple_unfairlock_destroy(_unfairlockRunLoop);
[super dealloc]; [super dealloc];
} }
- (void) setRunLoop:(NSRunLoop *)theRunLoop - (void) setRunLoop:(NSRunLoop *)theRunLoop
{ {
OSSpinLockLock(&spinlockRunLoop); apple_unfairlock_lock(_unfairlockRunLoop);
if (theRunLoop == runLoop) if (theRunLoop == runLoop)
{ {
OSSpinLockUnlock(&spinlockRunLoop); apple_unfairlock_unlock(_unfairlockRunLoop);
return; return;
} }
@ -926,18 +943,52 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
[runLoop release]; [runLoop release];
runLoop = theRunLoop; runLoop = theRunLoop;
OSSpinLockUnlock(&spinlockRunLoop); apple_unfairlock_unlock(_unfairlockRunLoop);
} }
- (NSRunLoop *) runLoop - (NSRunLoop *) runLoop
{ {
OSSpinLockLock(&spinlockRunLoop); apple_unfairlock_lock(_unfairlockRunLoop);
NSRunLoop *theRunLoop = runLoop; NSRunLoop *theRunLoop = runLoop;
OSSpinLockUnlock(&spinlockRunLoop); apple_unfairlock_unlock(_unfairlockRunLoop);
return theRunLoop; return theRunLoop;
} }
// HID input devices don't register events, so we need to manually prevent
// sleep and screensaver whenever we detect an input.
- (void) reportUserActivity
{
// Even though Apple deprecates UpdateSystemActivity(), it is still mandatory that we use it
// because there is no other way to prevent the screensaver without pushing fake events to
// the OS. UpdateSystemActivity() is amazingly useful for its ability to prevent both sleep
// and screensaver in one simple function, but it does not have the ability to wake up the
// the host if it is already in sleep mode. Therefore, IOPMAssertionDeclareUserActivity(),
// with its ability to wake up the host, still has usefulness and will be called if the OS
// version supports it.
#if defined(MAC_OS_X_VERSION_10_8) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8)
if (IsOSXVersionSupported(10, 7, 3))
{
// IOPMAssertionDeclareUserActivity() lets us prevent sleep and can wake up the host
// if it is already in sleep mode. But unfortunately, IOPMAssertionDeclareUserActivity()
// DOES NOT prevent the screensaver, so we'll call UpdateSystemActivity() to do that.
IOPMAssertionID thePMAssertionID = (IOPMAssertionID)_pmAssertionID;
IOReturn result = IOPMAssertionDeclareUserActivity(CFSTR("DeSmuME: User activated HID input device."), kIOPMUserActiveLocal, &thePMAssertionID);
if (result == kIOReturnSuccess)
{
_pmAssertionID = thePMAssertionID;
}
}
#endif
// UpdateSystemActivity() lets us prevent sleep and the screensaver, but it DOES NOT have
// the ability to wake up the host if it is already in sleep mode. Wake up is a lesser
// priority than preventing sleep in the first place, but wake up is still a useful
// feature, and so we'll call IOPMAssertionDeclareUserActivity() to do that.
SILENCE_DEPRECATION_MACOS_10_8( UpdateSystemActivity(UsrActivity) );
}
@end @end
void HandleDeviceMatchingCallback(void *inContext, IOReturn inResult, void *inSender, IOHIDDeviceRef inIOHIDDeviceRef) void HandleDeviceMatchingCallback(void *inContext, IOReturn inResult, void *inSender, IOHIDDeviceRef inIOHIDDeviceRef)
@ -2347,9 +2398,7 @@ ClientInputDevicePropertiesList MacInputDevicePropertiesEncoder::EncodeHIDQueue(
if (!inputPropertyList.empty()) if (!inputPropertyList.empty())
{ {
// HID input devices don't register events, so we need to manually prevent [[inputManager hidManager] reportUserActivity];
// sleep and screensaver whenever we detect an input.
UpdateSystemActivity(UsrActivity);
} }
return inputPropertyList; return inputPropertyList;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 DeSmuME team Copyright (C) 2018-2022 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
@ -84,26 +84,31 @@
[panel setTitle:NSSTRING_TITLE_SAVE_SCREENSHOT_PANEL]; [panel setTitle:NSSTRING_TITLE_SAVE_SCREENSHOT_PANEL];
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel beginSheetModalForWindow:[self window] [panel beginSheetModalForWindow:[self window]
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseDirectoryPathDidEnd:panel returnCode:result contextInfo:nil]; [self chooseDirectoryPathDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:nil types:nil
modalForWindow:[self window] modalForWindow:[self window]
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseDirectoryPathDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseDirectoryPathDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (void) chooseDirectoryPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void) chooseDirectoryPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2017-2021 DeSmuME team Copyright (C) 2017-2022 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
@ -20,7 +20,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <Metal/Metal.h> #import <Metal/Metal.h>
#include <libkern/OSAtomic.h> #include "../utilities.h"
#include <mach/task.h> #include <mach/task.h>
#include <mach/semaphore.h> #include <mach/semaphore.h>
@ -209,7 +209,7 @@ typedef DisplayViewShaderProperties DisplayViewShaderProperties;
BOOL needsScreenVerticesUpdate; BOOL needsScreenVerticesUpdate;
BOOL needsHUDVerticesUpdate; BOOL needsHUDVerticesUpdate;
OSSpinLock _spinlockRenderBufferStates[RENDER_BUFFER_COUNT]; apple_unfairlock_t _unfairlockRenderBufferStates[RENDER_BUFFER_COUNT];
dispatch_semaphore_t _semRenderBuffers[RENDER_BUFFER_COUNT]; dispatch_semaphore_t _semRenderBuffers[RENDER_BUFFER_COUNT];
volatile ClientDisplayBufferState _renderBufferState[RENDER_BUFFER_COUNT]; volatile ClientDisplayBufferState _renderBufferState[RENDER_BUFFER_COUNT];
@ -359,7 +359,7 @@ private:
void __InstanceInit(MacClientSharedObject *sharedObject); void __InstanceInit(MacClientSharedObject *sharedObject);
protected: protected:
OSSpinLock _spinlockViewNeedsFlush; apple_unfairlock_t _unfairlockViewNeedsFlush;
public: public:
MacMetalDisplayView(); MacMetalDisplayView();

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2017-2021 DeSmuME team Copyright (C) 2017-2022 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
@ -15,6 +15,10 @@
along with the this software. If not, see <http://www.gnu.org/licenses/>. along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/ */
#if defined(__clang__) && (__clang_major__ < 8)
#error Metal support requires Metal Shader Language v1.1 from Xcode 8.0 or later.
#endif
#include "MacMetalDisplayView.h" #include "MacMetalDisplayView.h"
#include "../cocoa_globals.h" #include "../cocoa_globals.h"
@ -87,7 +91,7 @@
[computePipelineDesc setComputeFunction:[defaultLibrary newFunctionWithName:@"src_filter_deposterize"]]; [computePipelineDesc setComputeFunction:[defaultLibrary newFunctionWithName:@"src_filter_deposterize"]];
deposterizePipeline = [[device newComputePipelineStateWithDescriptor:computePipelineDesc options:MTLPipelineOptionNone reflection:nil error:nil] retain]; deposterizePipeline = [[device newComputePipelineStateWithDescriptor:computePipelineDesc options:MTLPipelineOptionNone reflection:nil error:nil] retain];
#if defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13) #if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
if (@available(macOS 10.13, *)) if (@available(macOS 10.13, *))
{ {
[[[computePipelineDesc buffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable]; [[[computePipelineDesc buffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable];
@ -142,7 +146,7 @@
[hudPipelineDesc setVertexFunction:[defaultLibrary newFunctionWithName:@"hud_vertex"]]; [hudPipelineDesc setVertexFunction:[defaultLibrary newFunctionWithName:@"hud_vertex"]];
[hudPipelineDesc setFragmentFunction:hudFragmentFunction]; [hudPipelineDesc setFragmentFunction:hudFragmentFunction];
#if defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13) #if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
if (@available(macOS 10.13, *)) if (@available(macOS 10.13, *))
{ {
[[[hudPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable]; [[[hudPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable];
@ -866,7 +870,7 @@
{ {
_semRenderBuffers[i] = dispatch_semaphore_create(1); _semRenderBuffers[i] = dispatch_semaphore_create(1);
_renderBufferState[i] = ClientDisplayBufferState_Idle; _renderBufferState[i] = ClientDisplayBufferState_Idle;
_spinlockRenderBufferStates[i] = OS_SPINLOCK_INIT; _unfairlockRenderBufferStates[i] = apple_unfairlock_create();
} }
MTLViewport newViewport; MTLViewport newViewport;
@ -927,6 +931,7 @@
for (size_t i = 0; i < RENDER_BUFFER_COUNT; i++) for (size_t i = 0; i < RENDER_BUFFER_COUNT; i++)
{ {
dispatch_release(_semRenderBuffers[i]); dispatch_release(_semRenderBuffers[i]);
apple_unfairlock_destroy(_unfairlockRenderBufferStates[i]);
} }
[super dealloc]; [super dealloc];
@ -1155,7 +1160,7 @@
[self setOutputDrawablePipeline:[[sharedData device] newRenderPipelineStateWithDescriptor:outputPipelineDesc error:nil]]; [self setOutputDrawablePipeline:[[sharedData device] newRenderPipelineStateWithDescriptor:outputPipelineDesc error:nil]];
} }
#if defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13) #if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
if (@available(macOS 10.13, *)) if (@available(macOS 10.13, *))
{ {
[[[outputPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable]; [[[outputPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable];
@ -1181,7 +1186,7 @@
[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_vertex"]]; [outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_vertex"]];
[outputPipelineDesc setFragmentFunction:[[sharedData defaultLibrary] newFunctionWithName:@"output_filter_bilinear"]]; [outputPipelineDesc setFragmentFunction:[[sharedData defaultLibrary] newFunctionWithName:@"output_filter_bilinear"]];
#if defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13) #if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
if (@available(macOS 10.13, *)) if (@available(macOS 10.13, *))
{ {
[[[outputPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable]; [[[outputPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable];
@ -2117,18 +2122,18 @@
- (ClientDisplayBufferState) renderBufferStateAtIndex:(uint8_t)index - (ClientDisplayBufferState) renderBufferStateAtIndex:(uint8_t)index
{ {
OSSpinLockLock(&_spinlockRenderBufferStates[index]); apple_unfairlock_lock(_unfairlockRenderBufferStates[index]);
const ClientDisplayBufferState bufferState = _renderBufferState[index]; const ClientDisplayBufferState bufferState = _renderBufferState[index];
OSSpinLockUnlock(&_spinlockRenderBufferStates[index]); apple_unfairlock_unlock(_unfairlockRenderBufferStates[index]);
return bufferState; return bufferState;
} }
- (void) setRenderBufferState:(ClientDisplayBufferState)bufferState index:(uint8_t)index - (void) setRenderBufferState:(ClientDisplayBufferState)bufferState index:(uint8_t)index
{ {
OSSpinLockLock(&_spinlockRenderBufferStates[index]); apple_unfairlock_lock(_unfairlockRenderBufferStates[index]);
_renderBufferState[index] = bufferState; _renderBufferState[index] = bufferState;
OSSpinLockUnlock(&_spinlockRenderBufferStates[index]); apple_unfairlock_unlock(_unfairlockRenderBufferStates[index]);
} }
- (void) renderToBuffer:(uint32_t *)dstBuffer - (void) renderToBuffer:(uint32_t *)dstBuffer
@ -2705,12 +2710,13 @@ MacMetalDisplayView::MacMetalDisplayView(MacClientSharedObject *sharedObject)
MacMetalDisplayView::~MacMetalDisplayView() MacMetalDisplayView::~MacMetalDisplayView()
{ {
[this->_caLayer release]; [this->_caLayer release];
apple_unfairlock_destroy(_unfairlockViewNeedsFlush);
} }
void MacMetalDisplayView::__InstanceInit(MacClientSharedObject *sharedObject) void MacMetalDisplayView::__InstanceInit(MacClientSharedObject *sharedObject)
{ {
_allowViewUpdates = false; _allowViewUpdates = false;
_spinlockViewNeedsFlush = OS_SPINLOCK_INIT; _unfairlockViewNeedsFlush = apple_unfairlock_create();
MacMetalDisplayPresenter *newMetalPresenter = new MacMetalDisplayPresenter(sharedObject); MacMetalDisplayPresenter *newMetalPresenter = new MacMetalDisplayPresenter(sharedObject);
_presenter = newMetalPresenter; _presenter = newMetalPresenter;
@ -2727,9 +2733,9 @@ void MacMetalDisplayView::Init()
bool MacMetalDisplayView::GetViewNeedsFlush() bool MacMetalDisplayView::GetViewNeedsFlush()
{ {
OSSpinLockLock(&this->_spinlockViewNeedsFlush); apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
const bool viewNeedsFlush = this->_viewNeedsFlush; const bool viewNeedsFlush = this->_viewNeedsFlush;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush); apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
return viewNeedsFlush; return viewNeedsFlush;
} }
@ -2754,9 +2760,9 @@ void MacMetalDisplayView::SetViewNeedsFlush()
this->SetAllowViewFlushes(true); this->SetAllowViewFlushes(true);
this->_presenter->UpdateLayout(); this->_presenter->UpdateLayout();
OSSpinLockLock(&this->_spinlockViewNeedsFlush); apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
this->_viewNeedsFlush = true; this->_viewNeedsFlush = true;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush); apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
} }
} }
@ -2769,9 +2775,9 @@ void MacMetalDisplayView::SetAllowViewFlushes(bool allowFlushes)
void MacMetalDisplayView::FlushView(void *userData) void MacMetalDisplayView::FlushView(void *userData)
{ {
OSSpinLockLock(&this->_spinlockViewNeedsFlush); apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
this->_viewNeedsFlush = false; this->_viewNeedsFlush = false;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush); apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
[(DisplayViewMetalLayer *)this->_caLayer renderToDrawableUsingCommandBuffer:(id<MTLCommandBuffer>)userData]; [(DisplayViewMetalLayer *)this->_caLayer renderToDrawableUsingCommandBuffer:(id<MTLCommandBuffer>)userData];
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2017-2021 DeSmuME team Copyright (C) 2017-2022 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
@ -18,6 +18,12 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
// For some reason, the Clang major version here has to be 4 instead of 8 (Xcode's version)
// or 3 (LLVM's version). Seems like Clang's Metal compiler has its own version too.
#if defined(__clang__) && (__clang_major__ < 4)
#error Metal support requires Metal Shader Language v1.1 from Xcode 8.0 and later.
#endif
#include "../MetalRendererCommonShaders.h" #include "../MetalRendererCommonShaders.h"
#define LANCZOS_FIX(c) max(abs(c), 1e-5) #define LANCZOS_FIX(c) max(abs(c), 1e-5)

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2017 DeSmuME team Copyright (C) 2017-2022 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
@ -20,7 +20,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <OpenGL/OpenGL.h> #import <OpenGL/OpenGL.h>
#include <libkern/OSAtomic.h> #include "../utilities.h"
#import "DisplayViewCALayer.h" #import "DisplayViewCALayer.h"
#import "../cocoa_GPU.h" #import "../cocoa_GPU.h"
@ -50,11 +50,12 @@ protected:
NSOpenGLContext *_nsContext; NSOpenGLContext *_nsContext;
CGLContextObj _context; CGLContextObj _context;
OSSpinLock _spinlockTexFetch[2]; apple_unfairlock_t _unfairlockTexFetch[2];
public: public:
void operator delete(void *ptr); void operator delete(void *ptr);
MacOGLClientFetchObject(); MacOGLClientFetchObject();
~MacOGLClientFetchObject();
NSOpenGLContext* GetNSContext() const; NSOpenGLContext* GetNSContext() const;
CGLContextObj GetContext() const; CGLContextObj GetContext() const;
@ -77,12 +78,13 @@ protected:
NSOpenGLPixelFormat *_nsPixelFormat; NSOpenGLPixelFormat *_nsPixelFormat;
CGLContextObj _context; CGLContextObj _context;
CGLPixelFormatObj _pixelFormat; CGLPixelFormatObj _pixelFormat;
OSSpinLock _spinlockProcessedInfo; apple_unfairlock_t _unfairlockProcessedInfo;
public: public:
void operator delete(void *ptr); void operator delete(void *ptr);
MacOGLDisplayPresenter(); MacOGLDisplayPresenter();
MacOGLDisplayPresenter(MacClientSharedObject *sharedObject); MacOGLDisplayPresenter(MacClientSharedObject *sharedObject);
~MacOGLDisplayPresenter();
virtual void Init(); virtual void Init();
@ -118,7 +120,7 @@ private:
void __InstanceInit(MacClientSharedObject *sharedObject); void __InstanceInit(MacClientSharedObject *sharedObject);
protected: protected:
OSSpinLock _spinlockViewNeedsFlush; apple_unfairlock_t _unfairlockViewNeedsFlush;
public: public:
MacOGLDisplayView(); MacOGLDisplayView();

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2017-2018 DeSmuME team Copyright (C) 2017-2022 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
@ -158,8 +158,16 @@ MacOGLClientFetchObject::MacOGLClientFetchObject()
_clientData = [[MacClientSharedObject alloc] init]; _clientData = [[MacClientSharedObject alloc] init];
_spinlockTexFetch[NDSDisplayID_Main] = OS_SPINLOCK_INIT; _unfairlockTexFetch[NDSDisplayID_Main] = apple_unfairlock_create();
_spinlockTexFetch[NDSDisplayID_Touch] = OS_SPINLOCK_INIT; _unfairlockTexFetch[NDSDisplayID_Touch] = apple_unfairlock_create();
}
MacOGLClientFetchObject::~MacOGLClientFetchObject()
{
apple_unfairlock_destroy(this->_unfairlockTexFetch[NDSDisplayID_Main]);
this->_unfairlockTexFetch[NDSDisplayID_Main] = NULL;
apple_unfairlock_destroy(this->_unfairlockTexFetch[NDSDisplayID_Touch]);
this->_unfairlockTexFetch[NDSDisplayID_Touch] = NULL;
} }
NSOpenGLContext* MacOGLClientFetchObject::GetNSContext() const NSOpenGLContext* MacOGLClientFetchObject::GetNSContext() const
@ -209,18 +217,18 @@ void MacOGLClientFetchObject::FetchFromBufferIndex(const u8 index)
GLuint MacOGLClientFetchObject::GetFetchTexture(const NDSDisplayID displayID) GLuint MacOGLClientFetchObject::GetFetchTexture(const NDSDisplayID displayID)
{ {
OSSpinLockLock(&this->_spinlockTexFetch[displayID]); apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
const GLuint texFetchID = this->OGLClientFetchObject::GetFetchTexture(displayID); const GLuint texFetchID = this->OGLClientFetchObject::GetFetchTexture(displayID);
OSSpinLockUnlock(&this->_spinlockTexFetch[displayID]); apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
return texFetchID; return texFetchID;
} }
void MacOGLClientFetchObject::SetFetchTexture(const NDSDisplayID displayID, GLuint texID) void MacOGLClientFetchObject::SetFetchTexture(const NDSDisplayID displayID, GLuint texID)
{ {
OSSpinLockLock(&this->_spinlockTexFetch[displayID]); apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
this->OGLClientFetchObject::SetFetchTexture(displayID, texID); this->OGLClientFetchObject::SetFetchTexture(displayID, texID);
OSSpinLockUnlock(&this->_spinlockTexFetch[displayID]); apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
} }
#pragma mark - #pragma mark -
@ -297,7 +305,7 @@ void MacOGLDisplayPresenter::__InstanceInit(MacClientSharedObject *sharedObject)
_nsContext = nil; _nsContext = nil;
_context = nil; _context = nil;
_spinlockProcessedInfo = OS_SPINLOCK_INIT; _unfairlockProcessedInfo = apple_unfairlock_create();
if (sharedObject != nil) if (sharedObject != nil)
{ {
@ -305,6 +313,12 @@ void MacOGLDisplayPresenter::__InstanceInit(MacClientSharedObject *sharedObject)
} }
} }
MacOGLDisplayPresenter::~MacOGLDisplayPresenter()
{
apple_unfairlock_destroy(this->_unfairlockProcessedInfo);
this->_unfairlockProcessedInfo = NULL;
}
void MacOGLDisplayPresenter::Init() void MacOGLDisplayPresenter::Init()
{ {
this->_nsContext = [[NSOpenGLContext alloc] initWithFormat:this->_nsPixelFormat this->_nsContext = [[NSOpenGLContext alloc] initWithFormat:this->_nsPixelFormat
@ -419,18 +433,18 @@ void MacOGLDisplayPresenter::CopyFrameToBuffer(uint32_t *dstBuffer)
const OGLProcessedFrameInfo& MacOGLDisplayPresenter::GetProcessedFrameInfo() const OGLProcessedFrameInfo& MacOGLDisplayPresenter::GetProcessedFrameInfo()
{ {
OSSpinLockLock(&this->_spinlockProcessedInfo); apple_unfairlock_lock(this->_unfairlockProcessedInfo);
const OGLProcessedFrameInfo &processedInfo = this->OGLVideoOutput::GetProcessedFrameInfo(); const OGLProcessedFrameInfo &processedInfo = this->OGLVideoOutput::GetProcessedFrameInfo();
OSSpinLockUnlock(&this->_spinlockProcessedInfo); apple_unfairlock_unlock(this->_unfairlockProcessedInfo);
return processedInfo; return processedInfo;
} }
void MacOGLDisplayPresenter::SetProcessedFrameInfo(const OGLProcessedFrameInfo &processedInfo) void MacOGLDisplayPresenter::SetProcessedFrameInfo(const OGLProcessedFrameInfo &processedInfo)
{ {
OSSpinLockLock(&this->_spinlockProcessedInfo); apple_unfairlock_lock(this->_unfairlockProcessedInfo);
this->OGLVideoOutput::SetProcessedFrameInfo(processedInfo); this->OGLVideoOutput::SetProcessedFrameInfo(processedInfo);
OSSpinLockUnlock(&this->_spinlockProcessedInfo); apple_unfairlock_unlock(this->_unfairlockProcessedInfo);
} }
void MacOGLDisplayPresenter::WriteLockEmuFramebuffer(const uint8_t bufferIndex) void MacOGLDisplayPresenter::WriteLockEmuFramebuffer(const uint8_t bufferIndex)
@ -472,12 +486,15 @@ MacOGLDisplayView::MacOGLDisplayView(MacClientSharedObject *sharedObject)
MacOGLDisplayView::~MacOGLDisplayView() MacOGLDisplayView::~MacOGLDisplayView()
{ {
[this->_caLayer release]; [this->_caLayer release];
apple_unfairlock_destroy(this->_unfairlockViewNeedsFlush);
this->_unfairlockViewNeedsFlush = NULL;
} }
void MacOGLDisplayView::__InstanceInit(MacClientSharedObject *sharedObject) void MacOGLDisplayView::__InstanceInit(MacClientSharedObject *sharedObject)
{ {
_allowViewUpdates = false; _allowViewUpdates = false;
_spinlockViewNeedsFlush = OS_SPINLOCK_INIT; _unfairlockViewNeedsFlush = apple_unfairlock_create();
MacOGLDisplayPresenter *newOpenGLPresenter = new MacOGLDisplayPresenter(sharedObject); MacOGLDisplayPresenter *newOpenGLPresenter = new MacOGLDisplayPresenter(sharedObject);
_presenter = newOpenGLPresenter; _presenter = newOpenGLPresenter;
@ -488,9 +505,9 @@ void MacOGLDisplayView::__InstanceInit(MacClientSharedObject *sharedObject)
bool MacOGLDisplayView::GetViewNeedsFlush() bool MacOGLDisplayView::GetViewNeedsFlush()
{ {
OSSpinLockLock(&this->_spinlockViewNeedsFlush); apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
const bool viewNeedsFlush = this->_viewNeedsFlush; const bool viewNeedsFlush = this->_viewNeedsFlush;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush); apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
return viewNeedsFlush; return viewNeedsFlush;
} }
@ -513,9 +530,9 @@ void MacOGLDisplayView::SetViewNeedsFlush()
// will eventually get flushed. // will eventually get flushed.
this->SetAllowViewFlushes(true); this->SetAllowViewFlushes(true);
OSSpinLockLock(&this->_spinlockViewNeedsFlush); apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
this->_viewNeedsFlush = true; this->_viewNeedsFlush = true;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush); apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
} }
} }
@ -540,9 +557,9 @@ void MacOGLDisplayView::SetUseVerticalSync(const bool useVerticalSync)
void MacOGLDisplayView::FlushView(void *userData) void MacOGLDisplayView::FlushView(void *userData)
{ {
OSSpinLockLock(&this->_spinlockViewNeedsFlush); apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
this->_viewNeedsFlush = false; this->_viewNeedsFlush = false;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush); apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
CGLContextObj context = ((MacOGLDisplayPresenter *)this->_presenter)->GetContext(); CGLContextObj context = ((MacOGLDisplayPresenter *)this->_presenter)->GetContext();

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2017-2021 DeSmuME team Copyright (C) 2017-2022 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
@ -37,7 +37,7 @@
return nil; return nil;
} }
formatID = NSTIFFFileType; formatID = FILETYPE_TIFF;
return self; return self;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2015 DeSmuME Team Copyright (C) 2015-2022 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
@ -44,7 +44,7 @@
- (void) setIsExpanded:(BOOL)theState - (void) setIsExpanded:(BOOL)theState
{ {
[disclosureButton setState:(theState) ? NSOnState : NSOffState]; [disclosureButton setState:(theState) ? GUI_STATE_ON : GUI_STATE_OFF];
NSRect newFrame = [self frame]; NSRect newFrame = [self frame];
newFrame.size.height = (theState) ? expandedHeight : collapsedHeight; newFrame.size.height = (theState) ? expandedHeight : collapsedHeight;
@ -53,7 +53,7 @@
- (BOOL) isExpanded - (BOOL) isExpanded
{ {
return ([disclosureButton state] == NSOnState); return ([disclosureButton state] == GUI_STATE_ON);
} }
- (NSString *) stringFromSectionLabel - (NSString *) stringFromSectionLabel

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2014 DeSmuME Team Copyright (C) 2014-2022 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
@ -365,23 +365,26 @@
NSNumber *mpcfOptionNumber = [[NSNumber numberWithInteger:mpcfOptionTag] retain]; // Released in chooseMPCFPathDidEnd:returnCode:contextInfo: NSNumber *mpcfOptionNumber = [[NSNumber numberWithInteger:mpcfOptionTag] retain]; // Released in chooseMPCFPathDidEnd:returnCode:contextInfo:
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseMPCFPathDidEnd:panel returnCode:result contextInfo:mpcfOptionNumber]; [self chooseMPCFPathDidEnd:panel returnCode:result contextInfo:mpcfOptionNumber];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseMPCFPathDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseMPCFPathDidEnd:returnCode:contextInfo:)
contextInfo:mpcfOptionNumber]; contextInfo:mpcfOptionNumber] );
#endif }
} }
- (void) chooseMPCFPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void) chooseMPCFPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
@ -397,7 +400,7 @@
[[NSUserDefaults standardUserDefaults] setInteger:mpcfOptionTag forKey:@"Slot2_MPCF_PathOption"]; [[NSUserDefaults standardUserDefaults] setInteger:mpcfOptionTag forKey:@"Slot2_MPCF_PathOption"];
[[NSUserDefaults standardUserDefaults] synchronize]; [[NSUserDefaults standardUserDefaults] synchronize];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
[[NSUserDefaults standardUserDefaults] setInteger:prevMpcfOption forKey:@"Slot2_MPCF_PathOption"]; [[NSUserDefaults standardUserDefaults] setInteger:prevMpcfOption forKey:@"Slot2_MPCF_PathOption"];
return; return;
@ -509,30 +512,33 @@
[panel setCanChooseFiles:YES]; [panel setCanChooseFiles:YES];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_GBA_ROM, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_GBA_ROM, nil];
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseGbaCartridgePathDidEnd:panel returnCode:result contextInfo:nil]; [self chooseGbaCartridgePathDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseGbaCartridgePathDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseGbaCartridgePathDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (void) chooseGbaCartridgePathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void) chooseGbaCartridgePathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }
@ -568,30 +574,33 @@
[panel setCanChooseFiles:YES]; [panel setCanChooseFiles:YES];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_GBA_SRAM, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_GBA_SRAM, nil];
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseGbaSRamPathDidEnd:panel returnCode:result contextInfo:nil]; [self chooseGbaSRamPathDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseGbaSRamPathDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseGbaSRamPathDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (void) chooseGbaSRamPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void) chooseGbaSRamPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2018 DeSmuME Team Copyright (C) 2011-2022 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
@ -151,7 +151,12 @@
NSDictionary *prefsDict = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"DefaultUserPrefs" ofType:@"plist"]]; NSDictionary *prefsDict = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"DefaultUserPrefs" ofType:@"plist"]];
if (prefsDict == nil) if (prefsDict == nil)
{ {
[[NSAlert alertWithMessageText:NSSTRING_ALERT_CRITICAL_FILE_MISSING_PRI defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:NSSTRING_ALERT_CRITICAL_FILE_MISSING_SEC] runModal]; NSAlert *criticalErrorAlert = [[[NSAlert alloc] init] autorelease];
[criticalErrorAlert setAlertStyle:ALERTSTYLE_CRITICAL];
[criticalErrorAlert setMessageText:NSSTRING_ALERT_CRITICAL_FILE_MISSING_PRI];
[criticalErrorAlert setInformativeText:NSSTRING_ALERT_CRITICAL_FILE_MISSING_SEC];
[criticalErrorAlert runModal];
[NSApp terminate:nil]; [NSApp terminate:nil];
return; return;
} }
@ -171,10 +176,10 @@
[CocoaDSFile setupAllFilePaths]; [CocoaDSFile setupAllFilePaths];
// On macOS v10.13 and later, some unwanted menu items will show up in the View menu. // On macOS v10.12 and later, some unwanted menu items will show up in the View menu.
// Disable automatic window tabbing for all NSWindows in order to rid ourselves of // Disable automatic window tabbing for all NSWindows in order to rid ourselves of
// these unwanted menu items. // these unwanted menu items.
#if defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13) #if defined(MAC_OS_X_VERSION_10_12) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12)
if ([[NSWindow class] respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)]) if ([[NSWindow class] respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)])
{ {
[NSWindow setAllowsAutomaticWindowTabbing:NO]; [NSWindow setAllowsAutomaticWindowTabbing:NO];
@ -192,15 +197,23 @@
buildInfoStr = [[buildInfoStr stringByAppendingString:@"\nOperating System: "] stringByAppendingString:[CocoaDSUtil operatingSystemString]]; buildInfoStr = [[buildInfoStr stringByAppendingString:@"\nOperating System: "] stringByAppendingString:[CocoaDSUtil operatingSystemString]];
buildInfoStr = [[buildInfoStr stringByAppendingString:@"\nModel Identifier: "] stringByAppendingString:[CocoaDSUtil modelIdentifierString]]; buildInfoStr = [[buildInfoStr stringByAppendingString:@"\nModel Identifier: "] stringByAppendingString:[CocoaDSUtil modelIdentifierString]];
NSFont *aboutTextFilesFont = [NSFont fontWithName:@"Monaco" size:10]; NSString *readMeTextData = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@FILENAME_README ofType:@""] encoding:NSUTF8StringEncoding error:NULL];
NSString *licenseTextData = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@FILENAME_COPYING ofType:@""] encoding:NSUTF8StringEncoding error:NULL];
NSString *authorsTextData = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@FILENAME_AUTHORS ofType:@""] encoding:NSMacOSRomanStringEncoding error:NULL];
NSString *changeLogTextData = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@FILENAME_CHANGELOG ofType:@""] encoding:NSMacOSRomanStringEncoding error:NULL];
NSDictionary *aboutTextAttr = [NSDictionary dictionaryWithObjectsAndKeys:
[NSColor controlTextColor], NSForegroundColorAttributeName,
[NSFont fontWithName:@"Monaco" size:10], NSFontAttributeName,
nil];
NSMutableDictionary *aboutWindowProperties = [NSMutableDictionary dictionaryWithObjectsAndKeys: NSMutableDictionary *aboutWindowProperties = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[[NSBundle mainBundle] pathForResource:@FILENAME_README ofType:@""], @"readMePath", [[[NSAttributedString alloc] initWithString:readMeTextData attributes:aboutTextAttr] autorelease], @"readMeTextData",
[[NSBundle mainBundle] pathForResource:@FILENAME_COPYING ofType:@""], @"licensePath", [[[NSAttributedString alloc] initWithString:licenseTextData attributes:aboutTextAttr] autorelease], @"licenseTextData",
[[NSBundle mainBundle] pathForResource:@FILENAME_AUTHORS ofType:@""], @"authorsPath", [[[NSAttributedString alloc] initWithString:authorsTextData attributes:aboutTextAttr] autorelease], @"authorsTextData",
[[NSBundle mainBundle] pathForResource:@FILENAME_CHANGELOG ofType:@""], @"changeLogPath", [[[NSAttributedString alloc] initWithString:changeLogTextData attributes:aboutTextAttr] autorelease], @"changeLogTextData",
descriptionStr, @"descriptionString", descriptionStr, @"descriptionString",
buildInfoStr, @"buildInfoString", buildInfoStr, @"buildInfoString",
aboutTextFilesFont, @"aboutTextFilesFont",
nil]; nil];
[aboutWindowController setContent:aboutWindowProperties]; [aboutWindowController setContent:aboutWindowProperties];
@ -452,7 +465,7 @@
[loadItem setAction:@selector(loadEmuSaveStateSlot:)]; [loadItem setAction:@selector(loadEmuSaveStateSlot:)];
saveItem = [self addSlotMenuItem:mSaveStateSlot slotNumber:(NSUInteger)(i + 1)]; saveItem = [self addSlotMenuItem:mSaveStateSlot slotNumber:(NSUInteger)(i + 1)];
[saveItem setKeyEquivalentModifierMask:NSShiftKeyMask]; [saveItem setKeyEquivalentModifierMask:EVENT_MODIFIERFLAG_SHIFT];
[saveItem setTag:i]; [saveItem setTag:i];
[saveItem setAction:@selector(saveEmuSaveStateSlot:)]; [saveItem setAction:@selector(saveEmuSaveStateSlot:)];
} }

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012 DeSmuME team Copyright (C) 2012-2022 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
@ -187,11 +187,23 @@
- (IBAction) viewDatabase:(id)sender - (IBAction) viewDatabase:(id)sender
{ {
[NSApp beginSheet:cheatDatabaseSheet #if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([window respondsToSelector:@selector(beginSheet:completionHandler:)])
{
[window beginSheet:cheatDatabaseSheet
completionHandler:^(NSModalResponse response) {
[self didEndCheatDatabaseSheet:nil returnCode:response contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:cheatDatabaseSheet
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(didEndCheatDatabaseSheet:returnCode:contextInfo:) didEndSelector:@selector(didEndCheatDatabaseSheet:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
}
} }
- (IBAction) setInternalCheatValue:(id)sender - (IBAction) setInternalCheatValue:(id)sender
@ -463,9 +475,9 @@
- (IBAction) closeCheatDatabaseSheet:(id)sender - (IBAction) closeCheatDatabaseSheet:(id)sender
{ {
NSWindow *sheet = [(NSControl *)sender window]; NSWindow *sheet = [(NSControl *)sender window];
NSInteger code = [(NSControl *)sender tag]; const NSInteger code = [(NSControl *)sender tag];
[NSApp endSheet:sheet returnCode:code]; [CocoaDSUtil endSheet:sheet returnCode:code];
} }
- (void) didEndCheatDatabaseSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo - (void) didEndCheatDatabaseSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
@ -474,11 +486,11 @@
switch (returnCode) switch (returnCode)
{ {
case NSCancelButton: case GUI_RESPONSE_CANCEL:
return; return;
break; break;
case NSOKButton: case GUI_RESPONSE_OK:
[self addSelectedFromCheatDatabase]; [self addSelectedFromCheatDatabase];
break; break;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2014 DeSmuME Team Copyright (C) 2012-2022 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
@ -411,10 +411,10 @@
switch (returnCode) switch (returnCode)
{ {
case NSCancelButton: case GUI_RESPONSE_CANCEL:
break; break;
case NSOKButton: case GUI_RESPONSE_OK:
[deviceInfoInEdit setDictionary:editedDeviceInfo]; [deviceInfoInEdit setDictionary:editedDeviceInfo];
[self setMappingUsingDeviceInfoDictionary:deviceInfoInEdit]; [self setMappingUsingDeviceInfoDictionary:deviceInfoInEdit];
[outlineView reloadItem:deviceInfoInEdit reloadChildren:NO]; [outlineView reloadItem:deviceInfoInEdit reloadChildren:NO];
@ -446,7 +446,12 @@
if (cmdTagTarget == nil) if (cmdTagTarget == nil)
{ {
ClearHIDQueue(hidQueue); size_t hidInputClearCount = ClearHIDQueue(hidQueue);
if (hidInputClearCount > 0)
{
[hidManager reportUserActivity];
}
return isHandled; return isHandled;
} }
@ -828,18 +833,42 @@
[self updateCustomTurboPatternControls:turboPatternControl]; [self updateCustomTurboPatternControls:turboPatternControl];
} }
[NSApp beginSheet:theSheet #if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([prefWindow respondsToSelector:@selector(beginSheet:completionHandler:)])
{
[prefWindow beginSheet:theSheet
completionHandler:^(NSModalResponse response) {
[self didEndSettingsSheet:nil returnCode:response contextInfo:outlineView];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:theSheet
modalForWindow:prefWindow modalForWindow:prefWindow
modalDelegate:self modalDelegate:self
didEndSelector:@selector(didEndSettingsSheet:returnCode:contextInfo:) didEndSelector:@selector(didEndSettingsSheet:returnCode:contextInfo:)
contextInfo:outlineView]; contextInfo:outlineView] );
}
} }
- (IBAction) closeSettingsSheet:(id)sender - (IBAction) closeSettingsSheet:(id)sender
{ {
NSWindow *sheet = [(NSControl *)sender window]; NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender];
[sheet makeFirstResponder:nil]; // Force end of editing of any text fields. [sheet makeFirstResponder:nil]; // Force end of editing of any text fields.
[NSApp endSheet:sheet returnCode:[CocoaDSUtil getIBActionSenderTag:sender]];
#if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([[sheet sheetParent] respondsToSelector:@selector(endSheet:returnCode:)])
{
[[sheet sheetParent] endSheet:sheet returnCode:code];
}
else
#endif
{
[NSApp endSheet:sheet returnCode:code];
}
} }
- (IBAction) updateCustomTurboPatternControls:(id)sender - (IBAction) updateCustomTurboPatternControls:(id)sender
@ -1000,11 +1029,23 @@
- (IBAction) profileView:(id)sender - (IBAction) profileView:(id)sender
{ {
[NSApp beginSheet:inputProfileSheet #if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([prefWindow respondsToSelector:@selector(beginSheet:completionHandler:)])
{
[prefWindow beginSheet:inputProfileSheet
completionHandler:^(NSModalResponse response) {
// Do nothing.
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:inputProfileSheet
modalForWindow:prefWindow modalForWindow:prefWindow
modalDelegate:self modalDelegate:self
didEndSelector:@selector(didEndProfileSheet:returnCode:contextInfo:) didEndSelector:@selector(didEndProfileSheet:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
}
} }
- (IBAction) profileApply:(id)sender - (IBAction) profileApply:(id)sender
@ -1026,11 +1067,23 @@
- (IBAction) profileRename:(id)sender - (IBAction) profileRename:(id)sender
{ {
[NSApp beginSheet:inputProfileRenameSheet #if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([prefWindow respondsToSelector:@selector(beginSheet:completionHandler:)])
{
[prefWindow beginSheet:inputProfileRenameSheet
completionHandler:^(NSModalResponse response) {
// Do nothing.
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:inputProfileRenameSheet
modalForWindow:prefWindow modalForWindow:prefWindow
modalDelegate:self modalDelegate:self
didEndSelector:@selector(didEndProfileRenameSheet:returnCode:contextInfo:) didEndSelector:@selector(didEndProfileRenameSheet:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
}
} }
- (IBAction) profileSave:(id)sender - (IBAction) profileSave:(id)sender
@ -1110,20 +1163,25 @@
- (IBAction) closeProfileSheet:(id)sender - (IBAction) closeProfileSheet:(id)sender
{ {
NSWindow *sheet = [(NSControl *)sender window]; NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender];
[sheet makeFirstResponder:nil]; // Force end of editing of any text fields. [sheet makeFirstResponder:nil]; // Force end of editing of any text fields.
[NSApp endSheet:sheet returnCode:[CocoaDSUtil getIBActionSenderTag:sender]]; [CocoaDSUtil endSheet:sheet returnCode:code];
} }
- (IBAction) closeProfileRenameSheet:(id)sender - (IBAction) closeProfileRenameSheet:(id)sender
{ {
NSWindow *sheet = [(NSControl *)sender window]; NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender];
[sheet makeFirstResponder:nil]; // Force end of editing of any text fields. [sheet makeFirstResponder:nil]; // Force end of editing of any text fields.
[NSApp endSheet:sheet returnCode:[CocoaDSUtil getIBActionSenderTag:sender]]; [CocoaDSUtil endSheet:sheet returnCode:code];
} }
- (IBAction) audioFileChoose:(id)sender - (IBAction) audioFileChoose:(id)sender
{ {
NSURL *selectedFileURL = nil; NSURL *selectedFileURL = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel]; NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO]; [panel setCanChooseDirectories:NO];
@ -1155,16 +1213,24 @@
@"wav", @"wav",
nil]; nil];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types: // While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// is deprecated in Mac OS X v10.6. // are available in Leopard, the allowedFileTypes property is ignored on
// that version of macOS. To maintain compatibility with Leopard, we need
// to call the deprecated method [NSOpenPanel runModalForDirectory:file:types]
// instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal]; buttonClicked = [panel runModal];
#else }
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes]; else
#endif #endif
{
SILENCE_DEPRECATION_MACOS_10_6( buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes] );
}
if (buttonClicked == NSFileHandlingPanelOKButton) if (buttonClicked == GUI_RESPONSE_OK)
{ {
selectedFileURL = [[panel URLs] lastObject]; selectedFileURL = [[panel URLs] lastObject];
if(selectedFileURL == nil) if(selectedFileURL == nil)

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2021 DeSmuME Team Copyright (C) 2012-2022 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
@ -218,7 +218,7 @@
{ {
const uint32_t color = bitmapData[i]; const uint32_t color = bitmapData[i];
#if defined(__i386__) || defined(__x86_64__) #ifndef MSB_FIRST
bitmapData[i] = 0xFF000000 | // lA bitmapData[i] = 0xFF000000 | // lA
((color & 0x00FF0000) >> 16) | // lB -> lR ((color & 0x00FF0000) >> 16) | // lB -> lR
(color & 0x0000FF00) | // lG (color & 0x0000FF00) | // lG
@ -410,23 +410,26 @@
[panel setTitle:NSSTRING_TITLE_SELECT_ROM_PANEL]; [panel setTitle:NSSTRING_TITLE_SELECT_ROM_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_ROM_DS, @FILE_EXT_ROM_GBA, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_ROM_DS, @FILE_EXT_ROM_GBA, nil];
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseRomForAutoloadDidEnd:panel returnCode:result contextInfo:nil]; [self chooseRomForAutoloadDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseRomForAutoloadDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseRomForAutoloadDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (void) chooseRomForAutoloadDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void) chooseRomForAutoloadDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
@ -438,7 +441,7 @@
[[NSUserDefaults standardUserDefaults] setInteger:ROMAUTOLOADOPTION_CHOOSE_ROM forKey:@"General_AutoloadROMOption"]; [[NSUserDefaults standardUserDefaults] setInteger:ROMAUTOLOADOPTION_CHOOSE_ROM forKey:@"General_AutoloadROMOption"];
[[NSUserDefaults standardUserDefaults] synchronize]; [[NSUserDefaults standardUserDefaults] synchronize];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
[[NSUserDefaults standardUserDefaults] setInteger:ROMAUTOLOADOPTION_LOAD_NONE forKey:@"General_AutoloadROMOption"]; [[NSUserDefaults standardUserDefaults] setInteger:ROMAUTOLOADOPTION_LOAD_NONE forKey:@"General_AutoloadROMOption"];
return; return;
@ -468,30 +471,33 @@
[panel setTitle:NSSTRING_TITLE_SELECT_ADVANSCENE_DB_PANEL]; [panel setTitle:NSSTRING_TITLE_SELECT_ADVANSCENE_DB_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_ADVANSCENE_DB, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_ADVANSCENE_DB, nil];
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseAdvansceneDatabaseDidEnd:panel returnCode:result contextInfo:nil]; [self chooseAdvansceneDatabaseDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseAdvansceneDatabaseDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseAdvansceneDatabaseDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (void) chooseAdvansceneDatabaseDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void) chooseAdvansceneDatabaseDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }
@ -521,27 +527,32 @@
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo // The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6. // is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseCheatDatabaseDidEnd:panel returnCode:result contextInfo:nil]; [self chooseCheatDatabaseDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseCheatDatabaseDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseCheatDatabaseDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (void) chooseCheatDatabaseDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void) chooseCheatDatabaseDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }
@ -727,23 +738,26 @@
[panel setTitle:NSSTRING_TITLE_SELECT_ARM9_IMAGE_PANEL]; [panel setTitle:NSSTRING_TITLE_SELECT_ARM9_IMAGE_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_HW_IMAGE_FILE, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_HW_IMAGE_FILE, nil];
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseArm9BiosImageDidEnd:panel returnCode:result contextInfo:nil]; [self chooseArm9BiosImageDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseArm9BiosImageDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseArm9BiosImageDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (IBAction) chooseARM7BiosImage:(id)sender - (IBAction) chooseARM7BiosImage:(id)sender
@ -756,23 +770,26 @@
[panel setTitle:NSSTRING_TITLE_SELECT_ARM7_IMAGE_PANEL]; [panel setTitle:NSSTRING_TITLE_SELECT_ARM7_IMAGE_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_HW_IMAGE_FILE, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_HW_IMAGE_FILE, nil];
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseArm7BiosImageDidEnd:panel returnCode:result contextInfo:nil]; [self chooseArm7BiosImageDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseArm7BiosImageDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseArm7BiosImageDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (IBAction) chooseFirmwareImage:(id)sender - (IBAction) chooseFirmwareImage:(id)sender
@ -785,30 +802,33 @@
[panel setTitle:NSSTRING_TITLE_SELECT_FIRMWARE_IMAGE_PANEL]; [panel setTitle:NSSTRING_TITLE_SELECT_FIRMWARE_IMAGE_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_HW_IMAGE_FILE, nil]; NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_HW_IMAGE_FILE, nil];
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
// is deprecated in Mac OS X v10.6.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window [panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) { completionHandler:^(NSInteger result) {
[self chooseFirmwareImageDidEnd:panel returnCode:result contextInfo:nil]; [self chooseFirmwareImageDidEnd:panel returnCode:result contextInfo:nil];
} ]; } ];
#else }
[panel beginSheetForDirectory:nil else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil file:nil
types:fileTypes types:fileTypes
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(chooseFirmwareImageDidEnd:returnCode:contextInfo:) didEndSelector:@selector(chooseFirmwareImageDidEnd:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
#endif }
} }
- (void) chooseArm9BiosImageDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void) chooseArm9BiosImageDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }
@ -832,7 +852,7 @@
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }
@ -856,7 +876,7 @@
{ {
[sheet orderOut:self]; [sheet orderOut:self];
if (returnCode == NSCancelButton) if (returnCode == GUI_RESPONSE_CANCEL)
{ {
return; return;
} }
@ -878,11 +898,23 @@
- (IBAction) configureInternalFirmware:(id)sender - (IBAction) configureInternalFirmware:(id)sender
{ {
[NSApp beginSheet:firmwareConfigSheet #if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
if ([window respondsToSelector:@selector(beginSheet:completionHandler:)])
{
[window beginSheet:firmwareConfigSheet
completionHandler:^(NSModalResponse response) {
// Do nothing.
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:firmwareConfigSheet
modalForWindow:window modalForWindow:window
modalDelegate:self modalDelegate:self
didEndSelector:@selector(didEndFirmwareConfigSheet:returnCode:contextInfo:) didEndSelector:@selector(didEndFirmwareConfigSheet:returnCode:contextInfo:)
contextInfo:nil]; contextInfo:nil] );
}
} }
- (IBAction) closeFirmwareConfigSheet:(id)sender - (IBAction) closeFirmwareConfigSheet:(id)sender
@ -890,10 +922,8 @@
NSWindow *sheet = [(NSControl *)sender window]; NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender]; const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender];
// Force end of editing of any text fields. [sheet makeFirstResponder:nil]; // Force end of editing of any text fields.
[sheet makeFirstResponder:nil]; [CocoaDSUtil endSheet:sheet returnCode:code];
[NSApp endSheet:sheet returnCode:code];
} }
- (void) didEndFirmwareConfigSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo - (void) didEndFirmwareConfigSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2012-2018 DeSmuME team Copyright (C) 2012-2022 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
@ -202,8 +202,8 @@
- (IBAction) copyInfoToPasteboard:(id)sender - (IBAction) copyInfoToPasteboard:(id)sender
{ {
NSPasteboard *pboard = [NSPasteboard generalPasteboard]; NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:self]; [pboard declareTypes:[NSArray arrayWithObjects:PASTEBOARDTYPE_STRING, nil] owner:self];
[pboard setString:(NSString *)[bindings valueForKey:@"finalFormText"] forType:NSStringPboardType]; [pboard setString:(NSString *)[bindings valueForKey:@"finalFormText"] forType:PASTEBOARDTYPE_STRING];
} }
- (IBAction) goToWebpage:(id)sender - (IBAction) goToWebpage:(id)sender

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2017 DeSmuME team Copyright (C) 2013-2022 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
@ -17,6 +17,11 @@
#include "utilities.h" #include "utilities.h"
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#include <libkern/OSAtomic.h>
#ifdef HAS_SIERRA_UNFAIR_LOCK
#include <os/lock.h>
#endif
static CFStringRef OSXProductName = NULL; static CFStringRef OSXProductName = NULL;
static CFStringRef OSXProductVersion = NULL; static CFStringRef OSXProductVersion = NULL;
@ -30,21 +35,53 @@ static bool isSystemVersionAlreadyRead = false;
static void ReadSystemVersionPListFile() static void ReadSystemVersionPListFile()
{ {
Boolean status = 0;
bool isXMLFileFormat = false;
CFDictionaryRef systemDict = NULL;
// Read the SystemVersion.plist file. // Read the SystemVersion.plist file.
CFDataRef resourceData = NULL;
CFURLRef systemPListURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR("/System/Library/CoreServices/SystemVersion.plist"), kCFURLPOSIXPathStyle, false); CFURLRef systemPListURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR("/System/Library/CoreServices/SystemVersion.plist"), kCFURLPOSIXPathStyle, false);
Boolean status = CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, systemPListURL, &resourceData, NULL, NULL, NULL); CFReadStreamRef theStream = CFReadStreamCreateWithFile(kCFAllocatorDefault, systemPListURL);
if (!status)
{
CFRelease(systemPListURL); CFRelease(systemPListURL);
systemPListURL = NULL;
if (theStream == NULL)
{
return; return;
} }
CFDictionaryRef systemDict = (CFDictionaryRef)CFPropertyListCreateFromXMLData(kCFAllocatorDefault, resourceData, kCFPropertyListImmutable, NULL); CFPropertyListFormat *xmlFormat = (CFPropertyListFormat *)malloc(sizeof(CFPropertyListFormat));
if (systemDict == NULL) *xmlFormat = 0;
status = CFReadStreamOpen(theStream);
if (!status)
{
CFRelease(theStream);
free(xmlFormat);
return;
}
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6)
{
systemDict = CFPropertyListCreateWithStream(kCFAllocatorDefault, theStream, 0, kCFPropertyListImmutable, xmlFormat, NULL);
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_10( systemDict = CFPropertyListCreateFromStream(kCFAllocatorDefault, theStream, 0, kCFPropertyListImmutable, xmlFormat, NULL) );
}
CFReadStreamClose(theStream);
CFRelease(theStream);
theStream = NULL;
isXMLFileFormat = (*xmlFormat == kCFPropertyListXMLFormat_v1_0);
free(xmlFormat);
xmlFormat = NULL;
if ( (systemDict == NULL) || !isXMLFileFormat )
{ {
CFRelease(resourceData);
CFRelease(systemPListURL);
return; return;
} }
@ -89,13 +126,13 @@ static void ReadSystemVersionPListFile()
CFRetain(OSXProductBuildVersion); CFRetain(OSXProductBuildVersion);
} }
// Release all resources now that the system version string has been copied. // Release all resources now that the system version strings have been copied.
CFRelease(resourceData);
CFRelease(systemPListURL);
CFRelease(systemDict); CFRelease(systemDict);
systemDict = NULL;
// Mark that we've already read the SystemVersion.plist file so that we don't // Mark that we've already read the SystemVersion.plist file so that we don't have to do this again.
// have to do this again. // However, this function can be called again at any time to force reload the system version strings
// from the system file.
isSystemVersionAlreadyRead = true; isSystemVersionAlreadyRead = true;
} }
@ -132,6 +169,77 @@ bool IsOSXVersion(const unsigned int major, const unsigned int minor, const unsi
return result; return result;
} }
#ifdef HAS_SIERRA_UNFAIR_LOCK
static apple_unfairlock_t apple_unfairlock_create_sierra()
{
apple_unfairlock_t theLock = (apple_unfairlock_t)malloc(sizeof(os_unfair_lock));
*(os_unfair_lock *)theLock = OS_UNFAIR_LOCK_INIT;
return theLock;
}
static void apple_unfairlock_destroy_sierra(apple_unfairlock_t theLock)
{
free(theLock);
}
static inline void apple_unfairlock_lock_sierra(apple_unfairlock_t theLock)
{
os_unfair_lock_lock((os_unfair_lock_t)theLock);
}
static inline void apple_unfairlock_unlock_sierra(apple_unfairlock_t theLock)
{
os_unfair_lock_unlock((os_unfair_lock_t)theLock);
}
#endif
static apple_unfairlock_t apple_unfairlock_create_legacy()
{
SILENCE_DEPRECATION_MACOS_10_12( apple_unfairlock_t theLock = (apple_unfairlock_t)malloc(sizeof(OSSpinLock)) );
SILENCE_DEPRECATION_MACOS_10_12( *(OSSpinLock *)theLock = OS_SPINLOCK_INIT );
return theLock;
}
static void apple_unfairlock_destroy_legacy(apple_unfairlock_t theLock)
{
free(theLock);
}
static inline void apple_unfairlock_lock_legacy(apple_unfairlock_t theLock)
{
SILENCE_DEPRECATION_MACOS_10_12( OSSpinLockLock((OSSpinLock *)theLock) );
}
static inline void apple_unfairlock_unlock_legacy(apple_unfairlock_t theLock)
{
SILENCE_DEPRECATION_MACOS_10_12( OSSpinLockUnlock((OSSpinLock *)theLock) );
}
apple_unfairlock_t (*apple_unfairlock_create)() = &apple_unfairlock_create_legacy;
void (*apple_unfairlock_destroy)(apple_unfairlock_t theLock) = &apple_unfairlock_destroy_legacy;
void (*apple_unfairlock_lock)(apple_unfairlock_t theLock) = &apple_unfairlock_lock_legacy;
void (*apple_unfairlock_unlock)(apple_unfairlock_t theLock) = &apple_unfairlock_unlock_legacy;
void AppleUnfairLockSystemInitialize()
{
#ifdef HAS_SIERRA_UNFAIR_LOCK
if (IsOSXVersionSupported(10, 12, 0))
{
apple_unfairlock_create = &apple_unfairlock_create_sierra;
apple_unfairlock_destroy = &apple_unfairlock_destroy_sierra;
apple_unfairlock_lock = &apple_unfairlock_lock_sierra;
apple_unfairlock_unlock = &apple_unfairlock_unlock_sierra;
}
else
#endif
{
apple_unfairlock_create = &apple_unfairlock_create_legacy;
apple_unfairlock_destroy = &apple_unfairlock_destroy_legacy;
apple_unfairlock_lock = &apple_unfairlock_lock_legacy;
apple_unfairlock_unlock = &apple_unfairlock_unlock_legacy;
}
}
/******************************************************************************************** /********************************************************************************************
GetNearestPositivePOT() GetNearestPositivePOT()

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2017 DeSmuME team Copyright (C) 2013-2022 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
@ -20,12 +20,128 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <AvailabilityMacros.h>
// GCC diagnostic pragmas require at least GCC v4.6 (not normally available in Xcode)
// or Xcode Clang v3.0 or later from Xcode v4.2.
#if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))) || (__clang_major__ >= 3)
#define SILENCE_WARNING_UNUSED_VARIABLE_BEGIN \
_Pragma("GCC diagnostic push")\
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
#define SILENCE_WARNING_UNUSED_VARIABLE_END _Pragma("GCC diagnostic pop")
#define SILENCE_DEPRECATION(expression) \
_Pragma("GCC diagnostic push")\
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")\
expression;\
_Pragma("GCC diagnostic pop")
#else
#define SILENCE_WARNING_UNUSED_VARIABLE_BEGIN
#define SILENCE_WARNING_UNUSED_VARIABLE_END
#define SILENCE_DEPRECATION(expression) expression;
#endif
#define SILENCE_DEPRECATION_MACOS_10_6(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_7(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_8(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_9(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_10(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_11(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_12(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_13(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_14(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_10_15(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_11_0(expression) SILENCE_DEPRECATION(expression)
#define SILENCE_DEPRECATION_MACOS_12_0(expression) SILENCE_DEPRECATION(expression)
#if defined(__clang__) && (__clang_major__ >= 9)
#define HAVE_OSAVAILABLE 1
#else
#define HAVE_OSAVAILABLE 0
#endif
#if defined(MAC_OS_X_VERSION_10_10) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10)
#define GUI_RESPONSE_OK NSModalResponseOK
#define GUI_RESPONSE_CANCEL NSModalResponseCancel
#else
#define GUI_RESPONSE_OK NSOKButton
#define GUI_RESPONSE_CANCEL NSCancelButton
#endif
#if defined(MAC_OS_X_VERSION_10_12) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12)
#ifndef HAS_SIERRA_UNFAIR_LOCK
#define HAS_SIERRA_UNFAIR_LOCK
#endif
#define ALERTSTYLE_CRITICAL NSAlertStyleCritical
#define EVENT_MOUSEDOWN_LEFT NSEventTypeLeftMouseDown
#define EVENT_MOUSEDOWN_RIGHT NSEventTypeRightMouseDown
#define EVENT_MOUSEDOWN_OTHER NSEventTypeOtherMouseDown
#define EVENT_MODIFIERFLAG_SHIFT NSEventModifierFlagShift
#define WINDOWSTYLEMASK_BORDERLESS NSWindowStyleMaskBorderless
#else
#define ALERTSTYLE_CRITICAL NSCriticalAlertStyle
#define EVENT_MOUSEDOWN_LEFT NSLeftMouseDown
#define EVENT_MOUSEDOWN_RIGHT NSRightMouseDown
#define EVENT_MOUSEDOWN_OTHER NSOtherMouseDown
#define EVENT_MODIFIERFLAG_SHIFT NSShiftKeyMask
#define WINDOWSTYLEMASK_BORDERLESS NSBorderlessWindowMask
#endif
#if defined(MAC_OS_X_VERSION_10_14) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14)
#define GUI_STATE_MIXED NSControlStateValueMixed
#define GUI_STATE_OFF NSControlStateValueOff
#define GUI_STATE_ON NSControlStateValueOn
#define PASTEBOARDTYPE_TIFF NSPasteboardTypeTIFF
#define PASTEBOARDTYPE_STRING NSPasteboardTypeString
#define PASTEBOARDTYPE_URL NSPasteboardTypeURL
#define FILETYPE_TIFF NSBitmapImageFileTypeTIFF
#define FILETYPE_BMP NSBitmapImageFileTypeBMP
#define FILETYPE_GIF NSBitmapImageFileTypeGIF
#define FILETYPE_JPEG NSBitmapImageFileTypeJPEG
#define FILETYPE_PNG NSBitmapImageFileTypePNG
#define FILETYPE_JPEG2000 NSBitmapImageFileTypeJPEG2000
#else
#define GUI_STATE_MIXED NSMixedState
#define GUI_STATE_OFF NSOffState
#define GUI_STATE_ON NSOnState
#define PASTEBOARDTYPE_TIFF NSTIFFPboardType
#define PASTEBOARDTYPE_STRING NSStringPboardType
#define PASTEBOARDTYPE_URL NSURLPboardType
#define FILETYPE_TIFF NSTIFFFileType
#define FILETYPE_BMP NSBMPFileType
#define FILETYPE_GIF NSGIFFileType
#define FILETYPE_JPEG NSJPEGFileType
#define FILETYPE_PNG NSPNGFileType
#define FILETYPE_JPEG2000 NSJPEG2000FileType
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#endif #endif
typedef void* apple_unfairlock_t;
void AppleUnfairLockSystemInitialize();
extern apple_unfairlock_t (*apple_unfairlock_create)();
extern void (*apple_unfairlock_destroy)(apple_unfairlock_t theLock);
extern void (*apple_unfairlock_lock)(apple_unfairlock_t theLock);
extern void (*apple_unfairlock_unlock)(apple_unfairlock_t theLock);
bool IsOSXVersionSupported(const unsigned int major, const unsigned int minor, const unsigned int revision); bool IsOSXVersionSupported(const unsigned int major, const unsigned int minor, const unsigned int revision);
bool IsOSXVersion(const unsigned int major, const unsigned int minor, const unsigned int revision); bool IsOSXVersion(const unsigned int major, const unsigned int minor, const unsigned int revision);
uint32_t GetNearestPositivePOT(uint32_t value); uint32_t GetNearestPositivePOT(uint32_t value);

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2005 Guillaume Duhamel Copyright (C) 2005 Guillaume Duhamel
Copyright (C) 2008-2021 DeSmuME team Copyright (C) 2008-2022 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
@ -23,6 +23,10 @@
#include <retro_inline.h> #include <retro_inline.h>
#include <math/fxp.h> #include <math/fxp.h>
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#endif
//analyze microsoft compilers //analyze microsoft compilers
#ifdef _MSC_VER #ifdef _MSC_VER
#define HOST_WINDOWS #define HOST_WINDOWS
@ -366,7 +370,7 @@ inline bool atomic_test_and_set_barrier32(volatile s32 *V, s32 M) { return (_in
inline bool atomic_test_and_clear_32(volatile s32 *V, s32 M) { return (_interlockedbittestandreset((volatile LONG *)V, (LONG)M)) ? true : false; } inline bool atomic_test_and_clear_32(volatile s32 *V, s32 M) { return (_interlockedbittestandreset((volatile LONG *)V, (LONG)M)) ? true : false; }
inline bool atomic_test_and_clear_barrier32(volatile s32 *V, s32 M) { return (_interlockedbittestandreset((volatile LONG *)V, (LONG)M)) ? true : false; } inline bool atomic_test_and_clear_barrier32(volatile s32 *V, s32 M) { return (_interlockedbittestandreset((volatile LONG *)V, (LONG)M)) ? true : false; }
#elif defined(DESMUME_COCOA) #elif defined(DESMUME_COCOA) && ( !defined(__clang__) || (__clang_major__ < 9) || !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7) )
#include <libkern/OSAtomic.h> #include <libkern/OSAtomic.h>
#define atomic_add_32(V,M) OSAtomicAdd32((M),(V)) #define atomic_add_32(V,M) OSAtomicAdd32((M),(V))