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"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
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">
</BuildableReference>
</EnvironmentBuildable>
@ -34,7 +34,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
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">
</BuildableReference>
</BuildActionEntry>
@ -45,17 +45,19 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
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">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -73,10 +75,12 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
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">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@ -90,7 +94,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79FFE2215B84E50082AE82"
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">
</BuildableReference>
</BuildableProductRunnable>

View File

@ -16,7 +16,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79013F215B84F20082AE82"
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">
</BuildableReference>
</BuildActionEntry>
@ -32,7 +32,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79013F215B84F20082AE82"
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">
</BuildableReference>
</MacroExpansion>
@ -55,7 +55,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79013F215B84F20082AE82"
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">
</BuildableReference>
</BuildableProductRunnable>
@ -72,7 +72,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB79013F215B84F20082AE82"
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">
</BuildableReference>
</BuildableProductRunnable>

View File

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

View File

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

View File

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "2.0">
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "NO"
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090"
BuildableName = "DeSmuME (32bit).app"
BlueprintName = "DeSmuME (OS X App; 32-bit for v10.5 Leopard Release Build -- Xcode 9)"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME (x86_64h).app"
BlueprintName = "DeSmuME (macOS App; Release Stage 4 Intel64 Haswell -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -23,15 +23,15 @@
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090"
BuildableName = "DeSmuME (32bit).app"
BlueprintName = "DeSmuME (OS X App; 32-bit for v10.5 Leopard Release Build -- Xcode 9)"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME (x86_64h).app"
BlueprintName = "DeSmuME (macOS App; Release Stage 4 Intel64 Haswell -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</MacroExpansion>
@ -40,26 +40,21 @@
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
disableMainThreadChecker = "YES"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "NO"
debugXPCServices = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUFrameCaptureMode = "3"
enableGPUValidationMode = "1"
allowLocationSimulation = "NO"
queueDebuggingEnabled = "No">
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090"
BuildableName = "DeSmuME (32bit).app"
BlueprintName = "DeSmuME (OS X App; 32-bit for v10.5 Leopard Release Build -- Xcode 9)"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME (x86_64h).app"
BlueprintName = "DeSmuME (macOS App; Release Stage 4 Intel64 Haswell -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
@ -69,17 +64,17 @@
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "NO"
enableTestabilityWhenProfilingTests = "No">
<MacroExpansion>
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090"
BuildableName = "DeSmuME (32bit).app"
BlueprintName = "DeSmuME (OS X App; 32-bit for v10.5 Leopard Release Build -- Xcode 9)"
BlueprintIdentifier = "ABD2CCE926E05CB000FB15F7"
BuildableName = "DeSmuME (x86_64h).app"
BlueprintName = "DeSmuME (macOS App; Release Stage 4 Intel64 Haswell -- Latest Xcode)"
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference>
</MacroExpansion>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
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>"; };
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>"; };
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>"; };
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>"; };
@ -2561,7 +2561,7 @@
AB73AA331507C9F500A310C8 /* DeSmuME.app */,
ABAD104915ACE7A00000EC47 /* DeSmuME (PPC).app */,
AB2F3C4515CF9C6000858373 /* DeSmuME (PPC).app */,
AB2A9A791725F00F0062C1A1 /* DeSmuME (PPC).app */,
AB2A9A791725F00F0062C1A1 /* DeSmuME (ppc32).app */,
);
name = Products;
sourceTree = "<group>";
@ -3692,9 +3692,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
AB2A99A41725F00F0062C1A1 /* DeSmuME (OS X App; PowerPC Release Build) */ = {
AB2A99A41725F00F0062C1A1 /* DeSmuME (macOS App; Release Stage 1 PowerPC32 -- Xcode 3) */ = {
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 = (
AB2A99A51725F00F0062C1A1 /* ShellScript */,
AB2A99A61725F00F0062C1A1 /* Resources */,
@ -3706,15 +3706,15 @@
);
dependencies = (
);
name = "DeSmuME (OS X App; PowerPC Release Build)";
name = "DeSmuME (macOS App; Release Stage 1 PowerPC32 -- Xcode 3)";
productInstallPath = "$(HOME)/Applications";
productName = DeSmuME;
productReference = AB2A9A791725F00F0062C1A1 /* DeSmuME (PPC).app */;
productReference = AB2A9A791725F00F0062C1A1 /* DeSmuME (ppc32).app */;
productType = "com.apple.product-type.application";
};
AB2F3B7A15CF9C6000858373 /* DeSmuME (OS X App; PowerPC; LLVM-GCC) */ = {
AB2F3B7A15CF9C6000858373 /* DeSmuME (macOS App; PowerPC; LLVM-GCC) */ = {
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 = (
AB2F3B7B15CF9C6000858373 /* ShellScript */,
AB2F3B7C15CF9C6000858373 /* Resources */,
@ -3726,15 +3726,15 @@
);
dependencies = (
);
name = "DeSmuME (OS X App; PowerPC; LLVM-GCC)";
name = "DeSmuME (macOS App; PowerPC; LLVM-GCC)";
productInstallPath = "$(HOME)/Applications";
productName = DeSmuME;
productReference = AB2F3C4515CF9C6000858373 /* DeSmuME (PPC).app */;
productType = "com.apple.product-type.application";
};
AB711EBD1481C35F009011C8 /* DeSmuME (OS X App; Intel; LLVM-Clang) */ = {
AB711EBD1481C35F009011C8 /* DeSmuME (macOS App; Intel; LLVM-Clang) */ = {
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 = (
AB75222C14C799C1009B97B3 /* ShellScript */,
AB711EBE1481C35F009011C8 /* Resources */,
@ -3746,15 +3746,15 @@
);
dependencies = (
);
name = "DeSmuME (OS X App; Intel; LLVM-Clang)";
name = "DeSmuME (macOS App; Intel; LLVM-Clang)";
productInstallPath = "$(HOME)/Applications";
productName = DeSmuME;
productReference = AB711F7F1481C35F009011C8 /* DeSmuME.app */;
productType = "com.apple.product-type.application";
};
AB73A9671507C9F500A310C8 /* DeSmuME (OS X App; Intel; LLVM-GCC) */ = {
AB73A9671507C9F500A310C8 /* DeSmuME (macOS App; Intel; LLVM-GCC) */ = {
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 = (
AB73A9681507C9F500A310C8 /* ShellScript */,
AB73A9691507C9F500A310C8 /* Resources */,
@ -3766,15 +3766,15 @@
);
dependencies = (
);
name = "DeSmuME (OS X App; Intel; LLVM-GCC)";
name = "DeSmuME (macOS App; Intel; LLVM-GCC)";
productInstallPath = "$(HOME)/Applications";
productName = DeSmuME;
productReference = AB73AA331507C9F500A310C8 /* DeSmuME.app */;
productType = "com.apple.product-type.application";
};
ABAD0F7015ACE7A00000EC47 /* DeSmuME (OS X App; PowerPC; LLVM-Clang) */ = {
ABAD0F7015ACE7A00000EC47 /* DeSmuME (macOS App; PowerPC; LLVM-Clang) */ = {
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 = (
ABAD0F7115ACE7A00000EC47 /* ShellScript */,
ABAD0F7215ACE7A00000EC47 /* Resources */,
@ -3786,7 +3786,7 @@
);
dependencies = (
);
name = "DeSmuME (OS X App; PowerPC; LLVM-Clang)";
name = "DeSmuME (macOS App; PowerPC; LLVM-Clang)";
productInstallPath = "$(HOME)/Applications";
productName = DeSmuME;
productReference = ABAD104915ACE7A00000EC47 /* DeSmuME (PPC).app */;
@ -3818,11 +3818,11 @@
projectDirPath = "";
projectRoot = "";
targets = (
AB711EBD1481C35F009011C8 /* DeSmuME (OS X App; Intel; LLVM-Clang) */,
AB73A9671507C9F500A310C8 /* DeSmuME (OS X App; Intel; LLVM-GCC) */,
ABAD0F7015ACE7A00000EC47 /* DeSmuME (OS X App; PowerPC; LLVM-Clang) */,
AB2F3B7A15CF9C6000858373 /* DeSmuME (OS X App; PowerPC; LLVM-GCC) */,
AB2A99A41725F00F0062C1A1 /* DeSmuME (OS X App; PowerPC Release Build) */,
AB711EBD1481C35F009011C8 /* DeSmuME (macOS App; Intel; LLVM-Clang) */,
AB73A9671507C9F500A310C8 /* DeSmuME (macOS App; Intel; LLVM-GCC) */,
ABAD0F7015ACE7A00000EC47 /* DeSmuME (macOS App; PowerPC; LLVM-Clang) */,
AB2F3B7A15CF9C6000858373 /* DeSmuME (macOS App; PowerPC; LLVM-GCC) */,
AB2A99A41725F00F0062C1A1 /* DeSmuME (macOS App; Release Stage 1 PowerPC32 -- Xcode 3) */,
);
};
/* End PBXProject section */
@ -5604,9 +5604,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = ppc;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
"GCC_MODEL_TUNING[sdk=macosx10.5][arch=ppc]" = G5;
PRODUCT_NAME = "DeSmuME (Debug-PPC)";
PRODUCT_NAME = "DeSmuME (ppc)";
SDKROOT = macosx10.5;
SKIP_INSTALL = NO;
};
@ -5620,7 +5619,7 @@
NDEBUG,
PUBLIC_RELEASE,
);
PRODUCT_NAME = "DeSmuME (PPC)";
PRODUCT_NAME = "DeSmuME (ppc32)";
SDKROOT = macosx10.5;
};
name = Release;
@ -5632,7 +5631,6 @@
ppc,
ppc64,
);
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvmgcc42;
"GCC_VERSION[sdk=macosx10.5][arch=ppc64]" = 4.2;
PRODUCT_NAME = "DeSmuME (Debug-PPC)";
@ -5658,7 +5656,6 @@
AB711F7D1481C35F009011C8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
OTHER_LDFLAGS = (
"-weak_library",
/usr/lib/libSystem.B.dylib,
@ -5680,7 +5677,6 @@
AB73AA311507C9F500A310C8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvmgcc42;
"GCC_VERSION[sdk=macosx10.5][arch=ppc64]" = 4.2;
OTHER_LDFLAGS = (
@ -5710,7 +5706,6 @@
ppc,
ppc64,
);
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
PRODUCT_NAME = "DeSmuME (Debug-PPC)";
SDKROOT = macosx10.5;
SKIP_INSTALL = NO;
@ -5783,7 +5778,7 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-I./../../";
PRODUCT_NAME = "DeSmuME (Debug)";
SDKROOT = macosx;
SDKROOT = macosx10.6;
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
};
@ -5838,7 +5833,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_CFLAGS = "-I./../../";
PRODUCT_NAME = DeSmuME;
SDKROOT = macosx;
SDKROOT = macosx10.6;
STRIP_INSTALLED_PRODUCT = NO;
VALIDATE_PRODUCT = YES;
};
@ -5847,7 +5842,7 @@
/* End XCBuildConfiguration 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;
buildConfigurations = (
AB2A9A771725F00F0062C1A1 /* Debug */,
@ -5856,7 +5851,7 @@
defaultConfigurationIsVisible = 0;
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;
buildConfigurations = (
AB2F3C4315CF9C6000858373 /* Debug */,
@ -5865,7 +5860,7 @@
defaultConfigurationIsVisible = 0;
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;
buildConfigurations = (
AB711F7D1481C35F009011C8 /* Debug */,
@ -5874,7 +5869,7 @@
defaultConfigurationIsVisible = 0;
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;
buildConfigurations = (
AB73AA311507C9F500A310C8 /* Debug */,
@ -5883,7 +5878,7 @@
defaultConfigurationIsVisible = 0;
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;
buildConfigurations = (
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
it under the terms of the GNU General Public License as published by
@ -364,6 +364,10 @@ static const char *Sample1x1_VertShader_110 = {"\
}\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 = {"\
//---------------------------------------\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\
}\n\
"};
SILENCE_WARNING_UNUSED_VARIABLE_END
static const char *Sample3x3_VertShader_110 = {"\
//---------------------------------------\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
it under the terms of the GNU General Public License as published by
@ -18,12 +18,12 @@
#import <Foundation/Foundation.h>
#import <CoreVideo/CoreVideo.h>
#include <pthread.h>
#include <libkern/OSAtomic.h>
#include <mach/task.h>
#include <mach/semaphore.h>
#include <mach/sync_policy.h>
#include <map>
#include <vector>
#include "utilities.h"
#import "cocoa_util.h"
#include "../../GPU.h"
@ -70,7 +70,7 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
GPUClientFetchObject *GPUFetchObject;
task_t _taskEmulationLoop;
OSSpinLock _spinlockFramebufferStates[MAX_FRAMEBUFFER_PAGES];
apple_unfairlock_t _unfairlockFramebufferStates[MAX_FRAMEBUFFER_PAGES];
semaphore_t _semFramebuffer[MAX_FRAMEBUFFER_PAGES];
volatile ClientDisplayBufferState _framebufferState[MAX_FRAMEBUFFER_PAGES];
@ -82,7 +82,6 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
DisplayLinksActiveMap _displayLinksActiveList;
DisplayLinkFlushTimeLimitMap _displayLinkFlushTimeList;
OSSpinLock spinlockFetchSignal;
uint32_t _threadMessageID;
uint8_t _fetchIndex;
pthread_t _threadFetch;
@ -128,7 +127,7 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
BOOL isCPUCoreCountAuto;
BOOL _needRestoreRender3DLock;
OSSpinLock spinlockGpuState;
apple_unfairlock_t _unfairlockGpuState;
GPUEventHandlerOSX *gpuEvent;
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
it under the terms of the GNU General Public License as published by
@ -141,7 +141,7 @@ public:
return self;
}
spinlockGpuState = OS_SPINLOCK_INIT;
_unfairlockGpuState = apple_unfairlock_create();
_gpuScale = 1;
gpuStateFlags = GPUSTATE_MAIN_GPU_MASK |
@ -234,6 +234,8 @@ public:
[self setRender3DMultisampleSizeString:nil];
apple_unfairlock_destroy(_unfairlockGpuState);
[super dealloc];
}
@ -249,9 +251,9 @@ public:
- (void) setGpuStateFlags:(UInt32)flags
{
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = flags;
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
[self setLayerMainGPU:((flags & GPUSTATE_MAIN_GPU_MASK) != 0)];
[self setLayerMainBG0:((flags & GPUSTATE_MAIN_BG0_MASK) != 0)];
@ -270,9 +272,9 @@ public:
- (UInt32) gpuStateFlags
{
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
const UInt32 flags = gpuStateFlags;
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
return flags;
}
@ -814,9 +816,9 @@ public:
GPU->GetEngineMain()->SetEnableState((gpuState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (gpuState) ? (gpuStateFlags | GPUSTATE_MAIN_GPU_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_GPU_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerMainGPU
@ -834,9 +836,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG0, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG0_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG0_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerMainBG0
@ -854,9 +856,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG1, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG1_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG1_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerMainBG1
@ -874,9 +876,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG2, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG2_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG2_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerMainBG2
@ -894,9 +896,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_BG3, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_BG3_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_BG3_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerMainBG3
@ -914,9 +916,9 @@ public:
GPU->GetEngineMain()->SetLayerEnableState(GPULayerID_OBJ, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_MAIN_OBJ_MASK) : (gpuStateFlags & ~GPUSTATE_MAIN_OBJ_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerMainOBJ
@ -934,9 +936,9 @@ public:
GPU->GetEngineSub()->SetEnableState((gpuState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (gpuState) ? (gpuStateFlags | GPUSTATE_SUB_GPU_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_GPU_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerSubGPU
@ -954,9 +956,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG0, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG0_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG0_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerSubBG0
@ -974,9 +976,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG1, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG1_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG1_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerSubBG1
@ -994,9 +996,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG2, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG2_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG2_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerSubBG2
@ -1014,9 +1016,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_BG3, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_BG3_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_BG3_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerSubBG3
@ -1034,9 +1036,9 @@ public:
GPU->GetEngineSub()->SetLayerEnableState(GPULayerID_OBJ, (layerState) ? true : false);
gpuEvent->ApplyGPUSettingsUnlock();
OSSpinLockLock(&spinlockGpuState);
apple_unfairlock_lock(_unfairlockGpuState);
gpuStateFlags = (layerState) ? (gpuStateFlags | GPUSTATE_SUB_OBJ_MASK) : (gpuStateFlags & ~GPUSTATE_SUB_OBJ_MASK);
OSSpinLockUnlock(&spinlockGpuState);
apple_unfairlock_unlock(_unfairlockGpuState);
}
- (BOOL) layerSubOBJ
@ -1151,7 +1153,6 @@ public:
_displayLinkFlushTimeList.clear();
[self displayLinkListUpdate];
spinlockFetchSignal = OS_SPINLOCK_INIT;
_threadMessageID = MESSAGE_NONE;
_fetchIndex = 0;
pthread_cond_init(&_condSignalFetch, NULL);
@ -1175,7 +1176,7 @@ public:
{
_semFramebuffer[i] = 0;
_framebufferState[i] = ClientDisplayBufferState_Idle;
_spinlockFramebufferStates[i] = OS_SPINLOCK_INIT;
_unfairlockFramebufferStates[i] = apple_unfairlock_create();
}
[[NSNotificationCenter defaultCenter] addObserver:self
@ -1335,18 +1336,18 @@ public:
- (ClientDisplayBufferState) framebufferStateAtIndex:(uint8_t)index
{
OSSpinLockLock(&_spinlockFramebufferStates[index]);
apple_unfairlock_lock(_unfairlockFramebufferStates[index]);
const ClientDisplayBufferState bufferState = _framebufferState[index];
OSSpinLockUnlock(&_spinlockFramebufferStates[index]);
apple_unfairlock_unlock(_unfairlockFramebufferStates[index]);
return bufferState;
}
- (void) setFramebufferState:(ClientDisplayBufferState)bufferState index:(uint8_t)index
{
OSSpinLockLock(&_spinlockFramebufferStates[index]);
apple_unfairlock_lock(_unfairlockFramebufferStates[index]);
_framebufferState[index] = bufferState;
OSSpinLockUnlock(&_spinlockFramebufferStates[index]);
apple_unfairlock_unlock(_unfairlockFramebufferStates[index]);
}
- (void) setOutputList:(NSMutableArray *)theOutputList rwlock:(pthread_rwlock_t *)theRWLock
@ -1372,12 +1373,12 @@ public:
- (void) incrementViewsUsingDirectToCPUFiltering
{
OSAtomicIncrement32(&numberViewsUsingDirectToCPUFiltering);
atomic_inc_32(&numberViewsUsingDirectToCPUFiltering);
}
- (void) decrementViewsUsingDirectToCPUFiltering
{
OSAtomicDecrement32(&numberViewsUsingDirectToCPUFiltering);
atomic_dec_32(&numberViewsUsingDirectToCPUFiltering);
}
- (void) pushVideoDataToAllDisplayViews
@ -1759,11 +1760,7 @@ bool GPUEventHandlerOSX::GetRender3DNeedsFinish()
#pragma mark -
CGLContextObj OSXOpenGLRendererContext = NULL;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
CGLPBufferObj OSXOpenGLRendererPBuffer = NULL;
#pragma GCC diagnostic pop
SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj OSXOpenGLRendererPBuffer = NULL );
#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 result = false;
@ -1840,8 +1834,8 @@ bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w,
}
// Create a PBuffer if FBOs are not supported.
CGLPBufferObj newPBuffer = NULL;
CGLError error = CGLCreatePBuffer(w, h, GL_TEXTURE_2D, GL_RGBA, 0, &newPBuffer);
SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj newPBuffer = NULL );
SILENCE_DEPRECATION_MACOS_10_7( CGLError error = CGLCreatePBuffer(w, h, GL_TEXTURE_2D, GL_RGBA, 0, &newPBuffer) );
if ( (newPBuffer == NULL) || (error != kCGLNoError) )
{
@ -1852,19 +1846,17 @@ bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w,
{
GLint virtualScreenID = 0;
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;
CGLReleasePBuffer(oldPBuffer);
SILENCE_DEPRECATION_MACOS_10_7( CGLReleasePBuffer(oldPBuffer) );
result = true;
return result;
}
#pragma GCC diagnostic pop
bool CreateOpenGLRenderer()
{
bool result = false;
@ -1920,9 +1912,6 @@ bool CreateOpenGLRenderer()
return result;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void DestroyOpenGLRenderer()
{
if (OSXOpenGLRendererContext == NULL)
@ -1930,15 +1919,13 @@ void DestroyOpenGLRenderer()
return;
}
CGLReleasePBuffer(OSXOpenGLRendererPBuffer);
SILENCE_DEPRECATION_MACOS_10_7( CGLReleasePBuffer(OSXOpenGLRendererPBuffer) );
OSXOpenGLRendererPBuffer = NULL;
CGLReleaseContext(OSXOpenGLRendererContext);
OSXOpenGLRendererContext = NULL;
}
#pragma GCC diagnostic pop
void RequestOpenGLRenderer_3_2(bool request_3_2)
{
#ifdef OGLRENDER_3_2_H

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -18,7 +18,6 @@
#import <Cocoa/Cocoa.h>
#include <pthread.h>
#include <libkern/OSAtomic.h>
#include <string>
#import "cocoa_util.h"
@ -65,16 +64,15 @@ typedef struct
NSString *firmwareMACAddressSelectionString;
NSString *currentSessionMACAddressString;
OSSpinLock spinlockCdsController;
OSSpinLock spinlockMasterExecute;
apple_unfairlock_t _unfairlockMasterExecute;
}
@property (readonly, nonatomic) ClientExecutionControl *execControl;
@property (retain) CocoaDSController *cdsController;
@property (retain) CocoaDSFirmware *cdsFirmware;
@property (retain) CocoaDSGPU *cdsGPU;
@property (retain) NSMutableArray *cdsOutputList;
@property (readonly) CocoaDSController *cdsController;
@property (readonly) CocoaDSGPU *cdsGPU;
@property (readonly) NSMutableArray *cdsOutputList;
@property (assign) BOOL masterExecute;
@property (assign) BOOL isFrameSkipEnabled;

View File

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

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
*/
#import "cocoa_file.h"
#include <libkern/OSAtomic.h>
#import "cocoa_globals.h"
#import "cocoa_util.h"
@ -561,27 +560,27 @@ static NSMutableDictionary *_gURLDictionary = nil;
NSString *fileExt = nil;
switch (fileType)
{
case NSTIFFFileType:
case FILETYPE_TIFF:
fileExt = @"tiff";
break;
case NSBMPFileType:
case FILETYPE_BMP:
fileExt = @"bmp";
break;
case NSGIFFileType:
case FILETYPE_GIF:
fileExt = @"gif";
break;
case NSJPEGFileType:
case FILETYPE_JPEG:
fileExt = @"jpg";
break;
case NSPNGFileType:
case FILETYPE_PNG:
fileExt = @"png";
break;
case NSJPEG2000FileType:
case FILETYPE_JPEG2000:
fileExt = @"jp2";
break;

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -841,36 +841,39 @@
- (void) setBirthday:(NSDate *)theDate
{
int theMonth = 1;
int theDay = 1;
int theYear = 1970;
if (theDate != nil)
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"Y M d"];
[dateFormatter setDateFormat:@"M"];
NSInteger theMonth = [[dateFormatter stringFromDate:theDate] integerValue];
[dateFormatter setDateFormat:@"d"];
NSInteger theDay = [[dateFormatter stringFromDate:theDate] integerValue];
[dateFormatter setDateFormat:@"Y"];
NSInteger theYear = [[dateFormatter stringFromDate:theDate] integerValue];
[dateFormatter release];
_fwConfigInterface->SetBirthdayMonth((uint8_t)theMonth);
_fwConfigInterface->SetBirthdayDay((uint8_t)theDay);
_birth_year = theYear;
}
else
{
_fwConfigInterface->SetBirthdayMonth(1);
_fwConfigInterface->SetBirthdayDay(1);
_birth_year = 1970;
NSString *dateString = [df stringFromDate:theDate];
sscanf([dateString cStringUsingEncoding:NSUTF8StringEncoding], "%i %i %i", &theYear, &theMonth, &theDay);
[df release];
}
_fwConfigInterface->SetBirthdayMonth(theMonth);
_fwConfigInterface->SetBirthdayDay(theDay);
_birth_year = theYear;
}
- (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

View File

@ -1,6 +1,6 @@
/*
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
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_VOLUME NSLocalizedString(@"Volume: %1.1f%%", 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_SLOT1_UNKNOWN_STATE NSLocalizedString(@"Unknown state.", nil)

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -17,9 +17,6 @@
*/
#import <Cocoa/Cocoa.h>
#include <libkern/OSAtomic.h>
#include <vector>
#include "ClientInputHandler.h"
@class CocoaDSController;

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -107,9 +107,7 @@
if ( (delegate != nil) && [delegate respondsToSelector:@selector(doMicLevelUpdateFromController:)] )
{
NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init];
[[self delegate] doMicLevelUpdateFromController:self];
[tempPool release];
}
}

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
*/
#import <Cocoa/Cocoa.h>
#include <libkern/OSAtomic.h>
#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-2021 DeSmuME team
Copyright (C) 2011-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -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:@"arm9BinaryEntryAddress"] intValue]] forKey:@"arm9BinaryEntryAddress"];
[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:@"arm7BinaryEntryAddress"] intValue]] forKey:@"arm7BinaryEntryAddress"];
[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: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: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:@"iconOffset"] intValue]] forKey:@"iconOffset"];
[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, @"unitCode",
NSSTRING_STATUS_NO_ROM_LOADED, @"makerCode",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"romSize",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"romSize",
@"----------", @"arm9BinaryOffset",
@"----------", @"arm9BinaryEntryAddress",
@"----------", @"arm9BinaryStartAddress",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"arm9BinarySize",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"arm9BinarySize",
@"----------", @"arm7BinaryOffset",
@"----------", @"arm7BinaryEntryAddress",
@"----------", @"arm7BinaryStartAddress",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"arm7BinarySize",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"arm7BinarySize",
@"----------", @"fntOffset",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"fntTableSize",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"fntTableSize",
@"----------", @"fatOffset",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"fatSize",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"fatSize",
@"----------", @"iconOffset",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"usedRomSize",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0], @"unusedCapacity",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"usedRomSize",
[NSString stringWithFormat:NSSTRING_STATUS_SIZE_BYTES, 0ull], @"unusedCapacity",
iconImage, @"iconImage",
nil];
}
@ -618,7 +618,7 @@ static NSMutableDictionary *saveTypeValues = nil;
const float megabyteSize = byteSize / 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;
if (gigabyteSize > 1.0f)

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -18,13 +18,8 @@
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#include <libkern/OSAtomic.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
{
@ -34,6 +29,8 @@
+ (NSInteger) getIBActionSenderTag:(id)sender;
+ (BOOL) getIBActionSenderButtonStateBool:(id)sender;
+ (void) endSheet:(NSWindow *)sheet returnCode:(NSInteger)code;
+ (NSColor *) NSColorFromRGBA8888:(uint32_t)theColor;
+ (uint32_t) RGBA8888FromNSColor:(NSColor *)theColor;

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -53,14 +53,19 @@
+ (BOOL) getIBActionSenderButtonStateBool:(id)sender
{
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)])
{
buttonState = [sender state];
}
if (buttonState == NSOnState)
if (buttonState == GUI_STATE_ON)
{
theState = YES;
}
@ -68,6 +73,25 @@
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
{
#ifdef MSB_FIRST
@ -87,9 +111,9 @@
+ (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)
{
return 0x00000000;
@ -230,7 +254,14 @@
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;
}
@ -245,8 +276,18 @@
{
NSDragOperation dragOp = NSDragOperationNone;
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];
NSString *filePath = [fileURL path];
@ -271,9 +312,19 @@
NSWindow *window = [self window];
id <DirectoryURLDragDestTextFieldProtocol> delegate = (id <DirectoryURLDragDestTextFieldProtocol>)[window delegate];
NSPasteboard *pboard = [sender draggingPasteboard];
BOOL pboardHasURL = NO;
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];
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
it under the terms of the GNU General Public License as published by
@ -27,8 +27,7 @@
CoreAudioInput::CoreAudioInput()
{
_spinlockAUHAL = (OSSpinLock *)malloc(sizeof(OSSpinLock));
*_spinlockAUHAL = OS_SPINLOCK_INIT;
_unfairlockAUHAL = apple_unfairlock_create();
_hwStateChangedCallbackFunc = &CoreAudioInputDefaultHardwareStateChangedCallback;
_hwStateChangedCallbackParam1 = NULL;
@ -60,7 +59,7 @@ CoreAudioInput::CoreAudioInput()
_auOutputNode = 0;
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 formatConverterDesc;
AudioComponentDescription outputDesc;
@ -91,7 +90,7 @@ CoreAudioInput::CoreAudioInput()
NewAUGraph(&_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 *)&outputDesc, &_auOutputNode);
#else
@ -255,9 +254,9 @@ CoreAudioInput::CoreAudioInput()
CoreAudioInput::~CoreAudioInput()
{
OSSpinLockLock(_spinlockAUHAL);
apple_unfairlock_lock(this->_unfairlockAUHAL);
DestroyAudioUnitInstance(&_auHALInputDevice);
OSSpinLockUnlock(_spinlockAUHAL);
apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphClose(_auGraph);
AUGraphUninitialize(_auGraph);
@ -281,8 +280,7 @@ CoreAudioInput::~CoreAudioInput()
delete _samplesConverted;
_samplesConverted = NULL;
free(_spinlockAUHAL);
_spinlockAUHAL = NULL;
apple_unfairlock_destroy(this->_unfairlockAUHAL);
CFRelease(this->_hwDeviceInfo.name);
CFRelease(this->_hwDeviceInfo.manufacturer);
@ -480,7 +478,7 @@ void CoreAudioInput::Start()
&defaultInputDeviceID);
// Set the default input device to the audio unit.
OSSpinLockLock(this->_spinlockAUHAL);
apple_unfairlock_lock(this->_unfairlockAUHAL);
error = this->InitInputAUHAL(defaultInputDeviceID);
if (error == noErr)
@ -521,7 +519,7 @@ void CoreAudioInput::Start()
AudioOutputUnitStart(this->_auHALInputDevice);
}
OSSpinLockUnlock(this->_spinlockAUHAL);
apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphInitialize(_auGraph);
if (!this->GetPauseState())
@ -540,10 +538,10 @@ void CoreAudioInput::Start()
void CoreAudioInput::Stop()
{
OSSpinLockLock(this->_spinlockAUHAL);
apple_unfairlock_lock(this->_unfairlockAUHAL);
AudioOutputUnitStop(this->_auHALInputDevice);
AudioUnitUninitialize(this->_auHALInputDevice);
OSSpinLockUnlock(this->_spinlockAUHAL);
apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphStop(this->_auGraph);
AUGraphUninitialize(this->_auGraph);
@ -586,16 +584,16 @@ void CoreAudioInput::SetPauseState(bool pauseState)
{
if (pauseState && !this->GetPauseState())
{
OSSpinLockLock(this->_spinlockAUHAL);
apple_unfairlock_lock(this->_unfairlockAUHAL);
AudioOutputUnitStop(this->_auHALInputDevice);
OSSpinLockUnlock(this->_spinlockAUHAL);
apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphStop(this->_auGraph);
}
else if (!pauseState && this->GetPauseState() && !this->IsHardwareLocked())
{
OSSpinLockLock(this->_spinlockAUHAL);
apple_unfairlock_lock(this->_unfairlockAUHAL);
AudioOutputUnitStart(this->_auHALInputDevice);
OSSpinLockUnlock(this->_spinlockAUHAL);
apple_unfairlock_unlock(this->_unfairlockAUHAL);
AUGraphStart(this->_auGraph);
}
@ -612,14 +610,14 @@ void CoreAudioInput::SetGainAsNormalized(float normalizedGain)
Float32 gainValue = normalizedGain;
UInt32 gainPropSize = sizeof(gainValue);
OSSpinLockLock(this->_spinlockAUHAL);
apple_unfairlock_lock(this->_unfairlockAUHAL);
AudioUnitSetProperty(this->_auHALInputDevice,
kAudioDevicePropertyVolumeScalar,
kAudioUnitScope_Input,
this->_inputElement,
&gainValue,
gainPropSize);
OSSpinLockUnlock(this->_spinlockAUHAL);
apple_unfairlock_unlock(this->_unfairlockAUHAL);
}
void CoreAudioInput::UpdateHardwareGain(float normalizedGain)
@ -885,14 +883,13 @@ CoreAudioOutput::CoreAudioOutput(size_t bufferSamples, size_t sampleSize)
{
OSStatus error = noErr;
_spinlockAU = (OSSpinLock *)malloc(sizeof(OSSpinLock));
*_spinlockAU = OS_SPINLOCK_INIT;
_unfairlockAU = apple_unfairlock_create();
_buffer = new RingBuffer(bufferSamples, sampleSize);
_volume = 1.0f;
// 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))
{
AudioComponentDescription audioDesc;
@ -967,46 +964,45 @@ CoreAudioOutput::CoreAudioOutput(size_t bufferSamples, size_t sampleSize)
CoreAudioOutput::~CoreAudioOutput()
{
OSSpinLockLock(_spinlockAU);
DestroyAudioUnitInstance(&_au);
OSSpinLockUnlock(_spinlockAU);
apple_unfairlock_lock(this->_unfairlockAU);
DestroyAudioUnitInstance(&this->_au);
apple_unfairlock_unlock(this->_unfairlockAU);
delete _buffer;
_buffer = NULL;
delete this->_buffer;
this->_buffer = NULL;
free(_spinlockAU);
_spinlockAU = NULL;
apple_unfairlock_destroy(this->_unfairlockAU);
}
void CoreAudioOutput::start()
{
this->clearBuffer();
OSSpinLockLock(this->_spinlockAU);
apple_unfairlock_lock(this->_unfairlockAU);
AudioUnitReset(this->_au, kAudioUnitScope_Global, 0);
AudioOutputUnitStart(this->_au);
OSSpinLockUnlock(this->_spinlockAU);
apple_unfairlock_unlock(this->_unfairlockAU);
}
void CoreAudioOutput::pause()
{
OSSpinLockLock(this->_spinlockAU);
apple_unfairlock_lock(this->_unfairlockAU);
AudioOutputUnitStop(this->_au);
OSSpinLockUnlock(this->_spinlockAU);
apple_unfairlock_unlock(this->_unfairlockAU);
}
void CoreAudioOutput::unpause()
{
OSSpinLockLock(this->_spinlockAU);
apple_unfairlock_lock(this->_unfairlockAU);
AudioOutputUnitStart(this->_au);
OSSpinLockUnlock(this->_spinlockAU);
apple_unfairlock_unlock(this->_unfairlockAU);
}
void CoreAudioOutput::stop()
{
OSSpinLockLock(this->_spinlockAU);
apple_unfairlock_lock(this->_unfairlockAU);
AudioOutputUnitStop(this->_au);
OSSpinLockUnlock(this->_spinlockAU);
apple_unfairlock_unlock(this->_unfairlockAU);
this->clearBuffer();
}
@ -1029,16 +1025,16 @@ void CoreAudioOutput::clearBuffer()
void CoreAudioOutput::mute()
{
OSSpinLockLock(this->_spinlockAU);
apple_unfairlock_lock(this->_unfairlockAU);
AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, 0.0f, 0);
OSSpinLockUnlock(this->_spinlockAU);
apple_unfairlock_unlock(this->_unfairlockAU);
}
void CoreAudioOutput::unmute()
{
OSSpinLockLock(this->_spinlockAU);
apple_unfairlock_lock(this->_unfairlockAU);
AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, this->_volume, 0);
OSSpinLockUnlock(this->_spinlockAU);
apple_unfairlock_unlock(this->_unfairlockAU);
}
size_t CoreAudioOutput::getAvailableSamples() const
@ -1055,9 +1051,9 @@ void CoreAudioOutput::setVolume(float vol)
{
this->_volume = vol;
OSSpinLockLock(this->_spinlockAU);
apple_unfairlock_lock(this->_unfairlockAU);
AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0);
OSSpinLockUnlock(this->_spinlockAU);
apple_unfairlock_unlock(this->_unfairlockAU);
}
OSStatus CoreAudioOutputRenderCallback(void *inRefCon,
@ -1091,13 +1087,13 @@ bool CreateAudioUnitInstance(AudioUnit *au, ComponentDescription *auDescription)
return result;
}
Component theComponent = FindNextComponent(NULL, auDescription);
SILENCE_DEPRECATION_MACOS_10_8( Component theComponent = FindNextComponent(NULL, auDescription) );
if (theComponent == NULL)
{
return result;
}
OSErr error = OpenAComponent(theComponent, au);
SILENCE_DEPRECATION_MACOS_10_8( OSErr error = OpenAComponent(theComponent, au) );
if (error != noErr)
{
return result;
@ -1107,7 +1103,7 @@ bool CreateAudioUnitInstance(AudioUnit *au, ComponentDescription *auDescription)
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 result = false;
@ -1142,7 +1138,7 @@ void DestroyAudioUnitInstance(AudioUnit *au)
AudioOutputUnitStop(*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))
{
AudioComponentInstanceDispose(*au);
@ -1150,6 +1146,6 @@ void DestroyAudioUnitInstance(AudioUnit *au)
else
#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
it under the terms of the GNU General Public License as published by
@ -21,8 +21,8 @@
#include <CoreServices/CoreServices.h>
#include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioToolbox.h>
#include <libkern/OSAtomic.h>
#include "utilities.h"
#include "ringbuffer.h"
#include "audiosamplegenerator.h"
@ -48,7 +48,7 @@ typedef void (*CoreAudioInputHardwareGainChangedCallback)(float normalizedGain,
class CoreAudioInput : public AudioGenerator
{
private:
OSSpinLock *_spinlockAUHAL;
apple_unfairlock_t _unfairlockAUHAL;
CoreAudioInputHardwareStateChangedCallback _hwStateChangedCallbackFunc;
void *_hwStateChangedCallbackParam1;
@ -112,7 +112,7 @@ class CoreAudioOutput
private:
AudioUnit _au;
RingBuffer *_buffer;
OSSpinLock *_spinlockAU;
apple_unfairlock_t _unfairlockAU;
float _volume;
public:

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2007 Jeff Bland
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
it under the terms of the GNU General Public License as published by
@ -18,8 +18,11 @@
*/
#import <Cocoa/Cocoa.h>
#include "utilities.h"
int main(int argc, char *argv[])
{
AppleUnfairLockSystemInitialize();
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
it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
#import <OpenEmuBase/OEGameCore.h>
#import "OENDSSystemResponderClient.h"
#import "../cocoa_input.h"
#include <libkern/OSAtomic.h>
#include "../utilities.h"
#include <pthread.h>
@class CocoaDSCheatManager;
@ -41,7 +41,7 @@
OEIntSize displayAspectRatio;
NSUInteger inputID[OENDSButtonCount]; // Key = OpenEmu's input ID, Value = DeSmuME's input ID
OSSpinLock spinlockDisplayMode;
apple_unfairlock_t unfairlockDisplayMode;
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
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
spinlockDisplayMode = OS_SPINLOCK_INIT;
unfairlockDisplayMode = apple_unfairlock_create();
pthread_rwlock_init(&rwlockCoreExecute, NULL);
// Set up input handling
@ -136,15 +136,16 @@ volatile bool execute = true;
[self setCdsFirmware:nil];
pthread_rwlock_destroy(&rwlockCoreExecute);
apple_unfairlock_destroy(unfairlockDisplayMode);
[super dealloc];
}
- (NSInteger) displayMode
{
OSSpinLockLock(&spinlockDisplayMode);
apple_unfairlock_lock(unfairlockDisplayMode);
const NSInteger theMode = displayMode;
OSSpinLockUnlock(&spinlockDisplayMode);
apple_unfairlock_unlock(unfairlockDisplayMode);
return theMode;
}
@ -176,11 +177,11 @@ volatile bool execute = true;
break;
}
OSSpinLockLock(&spinlockDisplayMode);
apple_unfairlock_lock(unfairlockDisplayMode);
displayMode = theMode;
displayRect = newDisplayRect;
displayAspectRatio = newDisplayAspectRatio;
OSSpinLockUnlock(&spinlockDisplayMode);
apple_unfairlock_unlock(unfairlockDisplayMode);
}
#pragma mark - Plug-in Support
@ -289,18 +290,18 @@ volatile bool execute = true;
- (OEIntRect)screenRect
{
OSSpinLockLock(&spinlockDisplayMode);
apple_unfairlock_lock(unfairlockDisplayMode);
const OEIntRect theRect = displayRect;
OSSpinLockUnlock(&spinlockDisplayMode);
apple_unfairlock_unlock(unfairlockDisplayMode);
return theRect;
}
- (OEIntSize)aspectSize
{
OSSpinLockLock(&spinlockDisplayMode);
apple_unfairlock_lock(unfairlockDisplayMode);
const OEIntSize theAspectRatio = displayAspectRatio;
OSSpinLockUnlock(&spinlockDisplayMode);
apple_unfairlock_unlock(unfairlockDisplayMode);
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
it under the terms of the GNU General Public License as published by
@ -18,7 +18,7 @@
#include "ringbuffer.h"
#include <string.h>
#include <libkern/OSAtomic.h>
#include "types.h"
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;
// 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;
}
@ -170,7 +170,7 @@ size_t RingBuffer::write(const void *__restrict__ srcBuffer, size_t requestedNum
}
// 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.
if (requestedNumberElements <= hiElementsAvailable)
@ -240,7 +240,7 @@ size_t RingBuffer::drop(size_t requestedNumberElements)
this->_readPosition = inputDataReadPos;
// 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;
}

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
it under the terms of the GNU General Public License as published by
@ -30,7 +30,7 @@ private:
size_t _elementCapacity;
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 _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
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;
DisplayFullScreenWindow *newFullScreenWindow = [[[DisplayFullScreenWindow alloc] initWithContentRect:screenRect
styleMask:NSBorderlessWindowMask
styleMask:WINDOWSTYLEMASK_BORDERLESS
backing:NSBackingStoreBuffered
defer:NO
screen:targetScreen] autorelease];
@ -1015,7 +1015,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
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:))
@ -1031,16 +1031,16 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
viewRotation == 180 ||
viewRotation == 270)
{
[(NSMenuItem *)theItem setState:NSOffState];
[(NSMenuItem *)theItem setState:GUI_STATE_OFF];
}
else
{
[(NSMenuItem *)theItem setState:NSOnState];
[(NSMenuItem *)theItem setState:GUI_STATE_ON];
}
}
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]])
{
[(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:))
{
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:))
{
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:))
@ -1081,16 +1081,16 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
gapScalar == 150 ||
gapScalar == 200)
{
[(NSMenuItem *)theItem setState:NSOffState];
[(NSMenuItem *)theItem setState:GUI_STATE_OFF];
}
else
{
[(NSMenuItem *)theItem setState:NSOnState];
[(NSMenuItem *)theItem setState:GUI_STATE_ON];
}
}
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)
{
[(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
{
[(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]])
{
[(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];
}
}
@ -1121,7 +1121,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{
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];
@ -1130,14 +1130,14 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{
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:))
{
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 isSupportingShader = false;
@ -1150,63 +1150,63 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{
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:))
{
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:))
{
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:))
{
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:))
{
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:))
{
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:))
{
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:))
{
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:))
{
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:))
@ -1232,7 +1232,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{
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])
@ -1701,7 +1701,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
const ClientDisplayPresenterProperties &props = cdv->Get3DPresenter()->GetPresenterProperties();
const double scaleFactor = cdv->Get3DPresenter()->GetScaleFactor();
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.
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 ([self respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)])
{
[self setWantsBestResolutionOpenGLSurface:YES];
SILENCE_DEPRECATION_MACOS_10_14([self setWantsBestResolutionOpenGLSurface:YES])
}
#endif
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
it under the terms of the GNU General Public License as published by
@ -16,8 +16,8 @@
*/
#import <Cocoa/Cocoa.h>
#include <libkern/OSAtomic.h>
#import "../cocoa_input.h"
#include "../utilities.h"
@class InputManager;
@class CocoaDSRom;
@ -120,8 +120,8 @@ class AudioSampleBlockGenerator;
DisplayWindowController *mainWindow;
NSMutableArray *windowList;
OSSpinLock spinlockFirmware;
OSSpinLock spinlockSpeaker;
apple_unfairlock_t _unfairlockFirmware;
apple_unfairlock_t _unfairlockSpeaker;
}
@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
it under the terms of the GNU General Public License as published by
@ -111,8 +111,8 @@
return nil;
}
spinlockFirmware = OS_SPINLOCK_INIT;
spinlockSpeaker = OS_SPINLOCK_INIT;
_unfairlockFirmware = apple_unfairlock_create();
_unfairlockSpeaker = apple_unfairlock_create();
mainWindow = nil;
windowList = [[NSMutableArray alloc] initWithCapacity:32];
@ -222,6 +222,9 @@
[self setMainWindow:nil];
[windowList release];
apple_unfairlock_destroy(_unfairlockFirmware);
apple_unfairlock_destroy(_unfairlockSpeaker);
[super dealloc];
}
@ -229,11 +232,11 @@
- (void) setCdsFirmware:(CocoaDSFirmware *)theFirmware
{
OSSpinLockLock(&spinlockFirmware);
apple_unfairlock_lock(_unfairlockFirmware);
if (theFirmware == cdsFirmware)
{
OSSpinLockUnlock(&spinlockFirmware);
apple_unfairlock_unlock(_unfairlockFirmware);
return;
}
@ -250,25 +253,25 @@
[cdsFirmware release];
cdsFirmware = theFirmware;
OSSpinLockUnlock(&spinlockFirmware);
apple_unfairlock_unlock(_unfairlockFirmware);
}
- (CocoaDSFirmware *) cdsFirmware
{
OSSpinLockLock(&spinlockFirmware);
apple_unfairlock_lock(_unfairlockFirmware);
CocoaDSFirmware *theFirmware = cdsFirmware;
OSSpinLockUnlock(&spinlockFirmware);
apple_unfairlock_unlock(_unfairlockFirmware);
return theFirmware;
}
- (void) setCdsSpeaker:(CocoaDSSpeaker *)theSpeaker
{
OSSpinLockLock(&spinlockSpeaker);
apple_unfairlock_lock(_unfairlockSpeaker);
if (theSpeaker == cdsSpeaker)
{
OSSpinLockUnlock(&spinlockSpeaker);
apple_unfairlock_unlock(_unfairlockSpeaker);
return;
}
@ -282,14 +285,14 @@
[cdsSpeaker release];
cdsSpeaker = theSpeaker;
OSSpinLockUnlock(&spinlockSpeaker);
apple_unfairlock_unlock(_unfairlockSpeaker);
}
- (CocoaDSSpeaker *) cdsSpeaker
{
OSSpinLockLock(&spinlockSpeaker);
apple_unfairlock_lock(_unfairlockSpeaker);
CocoaDSSpeaker *theSpeaker = cdsSpeaker;
OSSpinLockUnlock(&spinlockSpeaker);
apple_unfairlock_unlock(_unfairlockSpeaker);
return theSpeaker;
}
@ -361,6 +364,7 @@
}
NSURL *selectedFile = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO];
@ -370,16 +374,24 @@
[panel setTitle:NSSTRING_TITLE_OPEN_ROM_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_ROM_DS, @FILE_EXT_ROM_GBA, nil];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types:
// is deprecated in Mac OS X v10.6.
// While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// 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
[panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal];
#else
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
buttonClicked = [panel runModal];
}
else
#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];
if(selectedFile == nil)
@ -420,6 +432,7 @@
- (IBAction) openEmuSaveState:(id)sender
{
NSURL *selectedFile = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO];
@ -429,16 +442,24 @@
[panel setTitle:NSSTRING_TITLE_OPEN_STATE_FILE_PANEL];
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_SAVE_STATE, nil];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types:
// is deprecated in Mac OS X v10.6.
// While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// 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
[panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal];
#else
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
buttonClicked = [panel runModal];
}
else
#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];
if(selectedFile == nil)
@ -507,17 +528,24 @@
[panel setCanCreateDirectories:YES];
[panel setTitle:NSSTRING_TITLE_SAVE_STATE_FILE_PANEL];
// The NSSavePanel method -(void)setRequiredFileType:
// is deprecated in Mac OS X v10.6.
// While [NSSavePanel setAllowedFileTypes:] is 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
// [NSSavePanel setRequiredFileType:] instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_SAVE_STATE, nil];
[panel setAllowedFileTypes:fileTypes];
#else
[panel setRequiredFileType:@FILE_EXT_SAVE_STATE];
if (IsOSXVersionSupported(10, 6, 0))
{
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_SAVE_STATE, nil];
[panel setAllowedFileTypes:fileTypes];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel setRequiredFileType:@FILE_EXT_SAVE_STATE] );
}
const NSInteger buttonClicked = [panel runModal];
if(buttonClicked == NSOKButton)
if (buttonClicked == GUI_RESPONSE_OK)
{
NSURL *saveFileURL = [panel URL];
@ -582,6 +610,7 @@
- (IBAction) openReplay:(id)sender
{
NSURL *selectedFile = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO];
@ -591,16 +620,24 @@
[panel setTitle:@"Load Replay"];
NSArray *fileTypes = [NSArray arrayWithObjects:@"dsm", nil];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types:
// is deprecated in Mac OS X v10.6.
// While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// 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
[panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal];
#else
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
buttonClicked = [panel runModal];
}
else
#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];
if(selectedFile == nil)
@ -621,17 +658,24 @@
[panel setCanCreateDirectories:YES];
[panel setTitle:@"Record Replay"];
// The NSSavePanel method -(void)setRequiredFileType:
// is deprecated in Mac OS X v10.6.
// While [NSSavePanel setAllowedFileTypes:] is 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
// [NSSavePanel setRequiredFileType:] instead.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
NSArray *fileTypes = [NSArray arrayWithObjects:@"dsm", nil];
[panel setAllowedFileTypes:fileTypes];
#else
[panel setRequiredFileType:@"dsm"];
if (IsOSXVersionSupported(10, 6, 0))
{
NSArray *fileTypes = [NSArray arrayWithObjects:@"dsm", nil];
[panel setAllowedFileTypes:fileTypes];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel setRequiredFileType:@"dsm"] );
}
const NSInteger buttonClicked = [panel runModal];
if (buttonClicked == NSFileHandlingPanelOKButton)
if (buttonClicked == GUI_RESPONSE_OK)
{
NSURL *fileURL = [panel URL];
if(fileURL == nil)
@ -666,6 +710,7 @@
- (IBAction) importRomSave:(id)sender
{
NSURL *selectedFile = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO];
@ -682,16 +727,24 @@
[self pauseCore];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types:
// is deprecated in Mac OS X v10.6.
// While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// 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
[panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal];
#else
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
buttonClicked = [panel runModal];
}
else
#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];
if(selectedFile == nil)
@ -716,7 +769,7 @@
[self pauseCore];
const NSInteger buttonClicked = [panel runModal];
if(buttonClicked == NSOKButton)
if (buttonClicked == GUI_RESPONSE_OK)
{
NSURL *romSaveURL = [CocoaDSFile fileURLFromRomURL:[[self currentRom] fileURL] toKind:@"ROM Save"];
if (romSaveURL != nil)
@ -914,22 +967,25 @@
[panel setAllowsMultipleSelection:NO];
[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
[panel beginSheetModalForWindow:slot1ManagerWindow
completionHandler:^(NSInteger result) {
[self didEndChooseSlot1R4Directory:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:nil
modalForWindow:slot1ManagerWindow
modalDelegate:self
didEndSelector:@selector(didEndChooseSlot1R4Directory:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel beginSheetModalForWindow:slot1ManagerWindow
completionHandler:^(NSInteger result) {
[self didEndChooseSlot1R4Directory:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:nil
modalForWindow:slot1ManagerWindow
modalDelegate:self
didEndSelector:@selector(didEndChooseSlot1R4Directory:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (IBAction) slot1Eject:(id)sender
@ -1116,7 +1172,7 @@
NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [(NSControl *)sender tag];
[NSApp endSheet:sheet returnCode:code];
[CocoaDSUtil endSheet:sheet returnCode:code];
}
#pragma mark Class Methods
@ -1643,11 +1699,25 @@
[self setIsUserInterfaceBlockingExecution:YES];
[self setIsShowingFileMigrationDialog:YES];
[NSApp beginSheet:saveFileMigrationSheet
modalForWindow:[[windowList objectAtIndex:0] window]
modalDelegate:self
didEndSelector:@selector(didEndFileMigrationSheet:returnCode:contextInfo:)
contextInfo:fileURL];
NSWindow *window = [[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
didEndSelector:@selector(didEndFileMigrationSheet:returnCode:contextInfo:)
contextInfo:fileURL] );
}
}
else
{
@ -1690,11 +1760,41 @@
[self setIsUserInterfaceBlockingExecution:YES];
[self setIsShowingSaveStateDialog:YES];
[NSApp beginSheet:saveStatePrecloseSheet
modalForWindow:(NSWindow *)[[windowList objectAtIndex:0] window]
modalDelegate:self
didEndSelector:endSheetSelector
contextInfo:romURL];
NSWindow *window = [[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
didEndSelector:endSheetSelector
contextInfo:romURL] );
}
}
else
{
@ -2015,11 +2115,25 @@
newTextFieldRect.size.height = 16.0f * lineCount;
[ndsErrorStatusTextField setFrame:newTextFieldRect];
[NSApp beginSheet:ndsErrorSheet
modalForWindow:(NSWindow *)[[windowList objectAtIndex:0] window]
modalDelegate:self
didEndSelector:@selector(didEndErrorSheet:returnCode:contextInfo:)
contextInfo:nil];
NSWindow *window = [[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
didEndSelector:@selector(didEndErrorSheet:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (void) handleEmulatorExecutionState:(NSNotification *)aNotification
@ -2133,7 +2247,7 @@
switch (returnCode)
{
case NSOKButton:
case GUI_RESPONSE_OK:
[CocoaDSFile moveFileToCurrentDirectory:romSaveURL];
break;
@ -2155,7 +2269,7 @@
switch (returnCode)
{
case NSCancelButton: // Cancel
case GUI_RESPONSE_CANCEL: // Cancel
[self restoreCoreState];
[self setIsUserInterfaceBlockingExecution:NO];
[self setIsShowingSaveStateDialog:NO];
@ -2199,7 +2313,7 @@
{
[self didEndSaveStateSheet:sheet returnCode:returnCode contextInfo:contextInfo];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
[NSApp replyToApplicationShouldTerminate:NO];
}
@ -2216,7 +2330,7 @@
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
return;
}
@ -2244,7 +2358,7 @@
[self reset:self];
break;
case NSCancelButton: // Stop
case GUI_RESPONSE_CANCEL: // Stop
default:
break;
}
@ -2814,11 +2928,11 @@
{
if ([CocoaDSFile saveStateExistsForSlot:[[self currentRom] fileURL] slotNumber:[theItem tag] + 1])
{
[(NSMenuItem*)theItem setState:NSOnState];
[(NSMenuItem*)theItem setState:GUI_STATE_ON];
}
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_DOUBLE * 100.0))
{
[(NSMenuItem*)theItem setState:NSOffState];
[(NSMenuItem*)theItem setState:GUI_STATE_OFF];
}
else
{
[(NSMenuItem*)theItem setState:NSOnState];
[(NSMenuItem*)theItem setState:GUI_STATE_ON];
}
}
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]])
@ -2906,7 +3020,7 @@
{
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:))
@ -2920,7 +3034,7 @@
{
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:) ||
@ -2946,7 +3060,7 @@
{
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
it under the terms of the GNU General Public License as published by
@ -18,6 +18,7 @@
#import "FileMigrationDelegate.h"
#import "cocoa_file.h"
#import "cocoa_globals.h"
#include "../utilities.h"
@implementation FileMigrationDelegate
@ -348,7 +349,7 @@
{
if (willMigrateFileCount > 0)
{
return [NSNumber numberWithInteger:NSMixedState];
return [NSNumber numberWithInteger:GUI_STATE_MIXED];
}
}
}
@ -357,7 +358,7 @@
{
if (willMigrateKindCount > 0)
{
return [NSNumber numberWithInteger:NSMixedState];
return [NSNumber numberWithInteger:GUI_STATE_MIXED];
}
}
else if (willMigrateFileCount == fileCount)
@ -366,21 +367,21 @@
}
else
{
return [NSNumber numberWithInteger:NSMixedState];
return [NSNumber numberWithInteger:GUI_STATE_MIXED];
}
}
if (willMigrateKindCount == 0)
{
return [NSNumber numberWithInteger:NSOffState];
return [NSNumber numberWithInteger:GUI_STATE_OFF];
}
else if (willMigrateKindCount == kindCount)
{
return [NSNumber numberWithInteger:NSOnState];
return [NSNumber numberWithInteger:GUI_STATE_ON];
}
else
{
return [NSNumber numberWithInteger:NSMixedState];
return [NSNumber numberWithInteger:GUI_STATE_MIXED];
}
}
}
@ -400,22 +401,22 @@
{
if (willMigrateFileCount > 0)
{
return [NSNumber numberWithInteger:NSMixedState];
return [NSNumber numberWithInteger:GUI_STATE_MIXED];
}
}
}
if (willMigrateFileCount == 0)
{
return [NSNumber numberWithInteger:NSOffState];
return [NSNumber numberWithInteger:GUI_STATE_OFF];
}
else if (willMigrateFileCount == fileCount)
{
return [NSNumber numberWithInteger:NSOnState];
return [NSNumber numberWithInteger:GUI_STATE_ON];
}
else
{
return [NSNumber numberWithInteger:NSMixedState];
return [NSNumber numberWithInteger:GUI_STATE_MIXED];
}
}
else if ([item isKindOfClass:[NSDictionary class]])
@ -463,7 +464,7 @@
if ([item isKindOfClass:[NSString class]])
{
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)
{
@ -500,7 +501,7 @@
}
else if ([item isKindOfClass:[NSArray class]])
{
const BOOL newSelectState = !([itemCell state] == NSOnState);
const BOOL newSelectState = !([itemCell state] == GUI_STATE_ON);
NSArray *fileList = (NSArray *)item;
if ([outlineView isItemExpanded:item])
@ -523,7 +524,7 @@
}
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];
[outlineView reloadItem:[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
it under the terms of the GNU General Public License as published by
@ -16,7 +16,6 @@
*/
#import <Cocoa/Cocoa.h>
#include <libkern/OSAtomic.h>
#include <IOKit/hid/IOHIDManager.h>
#include <ForceFeedback/ForceFeedback.h>
@ -32,6 +31,7 @@
#include "../audiosamplegenerator.h"
#include "../ClientInputHandler.h"
#include "../utilities.h"
struct ClientCommandAttributes;
struct ClientInputDeviceProperties;
@ -82,7 +82,7 @@ typedef std::unordered_map<int32_t, std::string> KeyboardKeyNameMap; // Key = Ke
BOOL isForceFeedbackEnabled;
NSRunLoop *runLoop;
OSSpinLock spinlockRunLoop;
apple_unfairlock_t _unfairlockRunLoop;
}
@property (retain) InputHIDManager *hidManager;
@ -127,8 +127,9 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
NSRunLoop *runLoop;
NSArrayController *deviceListController;
id<InputHIDManagerTarget> target;
uint32_t _pmAssertionID;
OSSpinLock spinlockRunLoop;
apple_unfairlock_t _unfairlockRunLoop;
}
@property (retain) NSArrayController *deviceListController;
@ -138,6 +139,7 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
@property (retain) NSRunLoop *runLoop;
- (id) initWithInputManager:(InputManager *)theInputManager;
- (void) reportUserActivity;
@end

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -23,6 +23,10 @@
#import "cocoa_input.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>
/*
@ -116,7 +120,7 @@ static NSDictionary *hidUsageTable = nil;
CFRelease(elementArray);
// 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))
{
ioService = IOHIDDeviceGetService(hidDeviceRef);
@ -126,7 +130,7 @@ static NSDictionary *hidUsageTable = nil;
}
}
else
#else
#endif
{
ioService = MACH_PORT_NULL;
@ -149,7 +153,6 @@ static NSDictionary *hidUsageTable = nil;
}
}
}
#endif
ffDevice = NULL;
ffEffect = NULL;
@ -219,7 +222,7 @@ static NSDictionary *hidUsageTable = nil;
[identifier retain];
spinlockRunLoop = OS_SPINLOCK_INIT;
_unfairlockRunLoop = apple_unfairlock_create();
[self setRunLoop:[NSRunLoop currentRunLoop]];
return self;
@ -232,6 +235,8 @@ static NSDictionary *hidUsageTable = nil;
[self setRunLoop:nil];
[self setHidManager:nil];
apple_unfairlock_destroy(_unfairlockRunLoop);
if (hidQueueRef != NULL)
{
CFRelease(hidQueueRef);
@ -310,11 +315,11 @@ static NSDictionary *hidUsageTable = nil;
- (void) setRunLoop:(NSRunLoop *)theRunLoop
{
OSSpinLockLock(&spinlockRunLoop);
apple_unfairlock_lock(_unfairlockRunLoop);
if (theRunLoop == runLoop)
{
OSSpinLockUnlock(&spinlockRunLoop);
apple_unfairlock_unlock(_unfairlockRunLoop);
return;
}
@ -332,14 +337,14 @@ static NSDictionary *hidUsageTable = nil;
[runLoop release];
runLoop = theRunLoop;
OSSpinLockUnlock(&spinlockRunLoop);
apple_unfairlock_unlock(_unfairlockRunLoop);
}
- (NSRunLoop *) runLoop
{
OSSpinLockLock(&spinlockRunLoop);
apple_unfairlock_lock(_unfairlockRunLoop);
NSRunLoop *theRunLoop = runLoop;
OSSpinLockUnlock(&spinlockRunLoop);
apple_unfairlock_unlock(_unfairlockRunLoop);
return theRunLoop;
}
@ -527,7 +532,7 @@ ClientInputDevicePropertiesList InputListFromHIDValue(IOHIDValueRef hidValueRef,
// IOHIDValueGetIntegerValue() will crash if the value length is too large.
// 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.
if(IOHIDValueGetLength(hidValueRef) > 2)
if (IOHIDValueGetLength(hidValueRef) > 2)
{
return inputPropertyList;
}
@ -791,13 +796,6 @@ size_t ClearHIDQueue(const IOHIDQueueRef hidQueue)
hidInputClearCount++;
} 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;
}
@ -817,7 +815,12 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
else
{
// 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;
}
// kIOPMNullAssertionID isn't available on macOS v10.6 Snow Leopard,
// so just initialize the ID directly to 0.
_pmAssertionID = 0;
target = nil;
deviceListController = nil;
inputManager = [theInputManager retain];
@ -848,7 +855,7 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
[self release];
return nil;
}
CFMutableDictionaryRef cfJoystickMatcher = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(cfJoystickMatcher, CFSTR(kIOHIDDeviceUsagePageKey), (CFNumberRef)[NSNumber numberWithInteger:kHIDPage_GenericDesktop]);
CFDictionarySetValue(cfJoystickMatcher, CFSTR(kIOHIDDeviceUsageKey), (CFNumberRef)[NSNumber numberWithInteger:kHIDUsage_GD_Joystick]);
@ -870,7 +877,7 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
CFRelease(cfGamepadMatcher);
CFRelease(cfGenericControllerMatcher);
spinlockRunLoop = OS_SPINLOCK_INIT;
_unfairlockRunLoop = apple_unfairlock_create();
IOReturn result = IOHIDManagerOpen(hidManagerRef, kIOHIDOptionsTypeNone);
if (result != kIOReturnSuccess)
@ -896,16 +903,26 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
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];
}
- (void) setRunLoop:(NSRunLoop *)theRunLoop
{
OSSpinLockLock(&spinlockRunLoop);
apple_unfairlock_lock(_unfairlockRunLoop);
if (theRunLoop == runLoop)
{
OSSpinLockUnlock(&spinlockRunLoop);
apple_unfairlock_unlock(_unfairlockRunLoop);
return;
}
@ -926,18 +943,52 @@ void HandleQueueValueAvailableCallback(void *inContext, IOReturn inResult, void
[runLoop release];
runLoop = theRunLoop;
OSSpinLockUnlock(&spinlockRunLoop);
apple_unfairlock_unlock(_unfairlockRunLoop);
}
- (NSRunLoop *) runLoop
{
OSSpinLockLock(&spinlockRunLoop);
apple_unfairlock_lock(_unfairlockRunLoop);
NSRunLoop *theRunLoop = runLoop;
OSSpinLockUnlock(&spinlockRunLoop);
apple_unfairlock_unlock(_unfairlockRunLoop);
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
void HandleDeviceMatchingCallback(void *inContext, IOReturn inResult, void *inSender, IOHIDDeviceRef inIOHIDDeviceRef)
@ -2347,9 +2398,7 @@ ClientInputDevicePropertiesList MacInputDevicePropertiesEncoder::EncodeHIDQueue(
if (!inputPropertyList.empty())
{
// HID input devices don't register events, so we need to manually prevent
// sleep and screensaver whenever we detect an input.
UpdateSystemActivity(UsrActivity);
[[inputManager hidManager] reportUserActivity];
}
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
it under the terms of the GNU General Public License as published by
@ -84,26 +84,31 @@
[panel setTitle:NSSTRING_TITLE_SAVE_SCREENSHOT_PANEL];
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
[panel beginSheetModalForWindow:[self window]
completionHandler:^(NSInteger result) {
[self chooseDirectoryPathDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:nil
modalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(chooseDirectoryPathDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel beginSheetModalForWindow:[self window]
completionHandler:^(NSInteger result) {
[self chooseDirectoryPathDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:nil
modalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(chooseDirectoryPathDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (void) chooseDirectoryPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
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
it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
#import <Cocoa/Cocoa.h>
#import <Metal/Metal.h>
#include <libkern/OSAtomic.h>
#include "../utilities.h"
#include <mach/task.h>
#include <mach/semaphore.h>
@ -209,7 +209,7 @@ typedef DisplayViewShaderProperties DisplayViewShaderProperties;
BOOL needsScreenVerticesUpdate;
BOOL needsHUDVerticesUpdate;
OSSpinLock _spinlockRenderBufferStates[RENDER_BUFFER_COUNT];
apple_unfairlock_t _unfairlockRenderBufferStates[RENDER_BUFFER_COUNT];
dispatch_semaphore_t _semRenderBuffers[RENDER_BUFFER_COUNT];
volatile ClientDisplayBufferState _renderBufferState[RENDER_BUFFER_COUNT];
@ -359,7 +359,7 @@ private:
void __InstanceInit(MacClientSharedObject *sharedObject);
protected:
OSSpinLock _spinlockViewNeedsFlush;
apple_unfairlock_t _unfairlockViewNeedsFlush;
public:
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
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/>.
*/
#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 "../cocoa_globals.h"
@ -87,7 +91,7 @@
[computePipelineDesc setComputeFunction:[defaultLibrary newFunctionWithName:@"src_filter_deposterize"]];
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, *))
{
[[[computePipelineDesc buffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable];
@ -142,7 +146,7 @@
[hudPipelineDesc setVertexFunction:[defaultLibrary newFunctionWithName:@"hud_vertex"]];
[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, *))
{
[[[hudPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable];
@ -866,7 +870,7 @@
{
_semRenderBuffers[i] = dispatch_semaphore_create(1);
_renderBufferState[i] = ClientDisplayBufferState_Idle;
_spinlockRenderBufferStates[i] = OS_SPINLOCK_INIT;
_unfairlockRenderBufferStates[i] = apple_unfairlock_create();
}
MTLViewport newViewport;
@ -927,6 +931,7 @@
for (size_t i = 0; i < RENDER_BUFFER_COUNT; i++)
{
dispatch_release(_semRenderBuffers[i]);
apple_unfairlock_destroy(_unfairlockRenderBufferStates[i]);
}
[super dealloc];
@ -1155,7 +1160,7 @@
[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, *))
{
[[[outputPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable];
@ -1181,7 +1186,7 @@
[outputPipelineDesc setVertexFunction:[[sharedData defaultLibrary] newFunctionWithName:@"display_output_vertex"]];
[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, *))
{
[[[outputPipelineDesc vertexBuffers] objectAtIndexedSubscript:0] setMutability:MTLMutabilityImmutable];
@ -2117,18 +2122,18 @@
- (ClientDisplayBufferState) renderBufferStateAtIndex:(uint8_t)index
{
OSSpinLockLock(&_spinlockRenderBufferStates[index]);
apple_unfairlock_lock(_unfairlockRenderBufferStates[index]);
const ClientDisplayBufferState bufferState = _renderBufferState[index];
OSSpinLockUnlock(&_spinlockRenderBufferStates[index]);
apple_unfairlock_unlock(_unfairlockRenderBufferStates[index]);
return bufferState;
}
- (void) setRenderBufferState:(ClientDisplayBufferState)bufferState index:(uint8_t)index
{
OSSpinLockLock(&_spinlockRenderBufferStates[index]);
apple_unfairlock_lock(_unfairlockRenderBufferStates[index]);
_renderBufferState[index] = bufferState;
OSSpinLockUnlock(&_spinlockRenderBufferStates[index]);
apple_unfairlock_unlock(_unfairlockRenderBufferStates[index]);
}
- (void) renderToBuffer:(uint32_t *)dstBuffer
@ -2705,12 +2710,13 @@ MacMetalDisplayView::MacMetalDisplayView(MacClientSharedObject *sharedObject)
MacMetalDisplayView::~MacMetalDisplayView()
{
[this->_caLayer release];
apple_unfairlock_destroy(_unfairlockViewNeedsFlush);
}
void MacMetalDisplayView::__InstanceInit(MacClientSharedObject *sharedObject)
{
_allowViewUpdates = false;
_spinlockViewNeedsFlush = OS_SPINLOCK_INIT;
_unfairlockViewNeedsFlush = apple_unfairlock_create();
MacMetalDisplayPresenter *newMetalPresenter = new MacMetalDisplayPresenter(sharedObject);
_presenter = newMetalPresenter;
@ -2727,9 +2733,9 @@ void MacMetalDisplayView::Init()
bool MacMetalDisplayView::GetViewNeedsFlush()
{
OSSpinLockLock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
const bool viewNeedsFlush = this->_viewNeedsFlush;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
return viewNeedsFlush;
}
@ -2754,9 +2760,9 @@ void MacMetalDisplayView::SetViewNeedsFlush()
this->SetAllowViewFlushes(true);
this->_presenter->UpdateLayout();
OSSpinLockLock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
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)
{
OSSpinLockLock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
this->_viewNeedsFlush = false;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
[(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
it under the terms of the GNU General Public License as published by
@ -18,6 +18,12 @@
#include <metal_stdlib>
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"
#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
it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
#import <Cocoa/Cocoa.h>
#import <OpenGL/OpenGL.h>
#include <libkern/OSAtomic.h>
#include "../utilities.h"
#import "DisplayViewCALayer.h"
#import "../cocoa_GPU.h"
@ -50,11 +50,12 @@ protected:
NSOpenGLContext *_nsContext;
CGLContextObj _context;
OSSpinLock _spinlockTexFetch[2];
apple_unfairlock_t _unfairlockTexFetch[2];
public:
void operator delete(void *ptr);
MacOGLClientFetchObject();
~MacOGLClientFetchObject();
NSOpenGLContext* GetNSContext() const;
CGLContextObj GetContext() const;
@ -77,12 +78,13 @@ protected:
NSOpenGLPixelFormat *_nsPixelFormat;
CGLContextObj _context;
CGLPixelFormatObj _pixelFormat;
OSSpinLock _spinlockProcessedInfo;
apple_unfairlock_t _unfairlockProcessedInfo;
public:
void operator delete(void *ptr);
MacOGLDisplayPresenter();
MacOGLDisplayPresenter(MacClientSharedObject *sharedObject);
~MacOGLDisplayPresenter();
virtual void Init();
@ -118,7 +120,7 @@ private:
void __InstanceInit(MacClientSharedObject *sharedObject);
protected:
OSSpinLock _spinlockViewNeedsFlush;
apple_unfairlock_t _unfairlockViewNeedsFlush;
public:
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
it under the terms of the GNU General Public License as published by
@ -158,8 +158,16 @@ MacOGLClientFetchObject::MacOGLClientFetchObject()
_clientData = [[MacClientSharedObject alloc] init];
_spinlockTexFetch[NDSDisplayID_Main] = OS_SPINLOCK_INIT;
_spinlockTexFetch[NDSDisplayID_Touch] = OS_SPINLOCK_INIT;
_unfairlockTexFetch[NDSDisplayID_Main] = apple_unfairlock_create();
_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
@ -209,18 +217,18 @@ void MacOGLClientFetchObject::FetchFromBufferIndex(const u8 index)
GLuint MacOGLClientFetchObject::GetFetchTexture(const NDSDisplayID displayID)
{
OSSpinLockLock(&this->_spinlockTexFetch[displayID]);
apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
const GLuint texFetchID = this->OGLClientFetchObject::GetFetchTexture(displayID);
OSSpinLockUnlock(&this->_spinlockTexFetch[displayID]);
apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
return texFetchID;
}
void MacOGLClientFetchObject::SetFetchTexture(const NDSDisplayID displayID, GLuint texID)
{
OSSpinLockLock(&this->_spinlockTexFetch[displayID]);
apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
this->OGLClientFetchObject::SetFetchTexture(displayID, texID);
OSSpinLockUnlock(&this->_spinlockTexFetch[displayID]);
apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
}
#pragma mark -
@ -297,7 +305,7 @@ void MacOGLDisplayPresenter::__InstanceInit(MacClientSharedObject *sharedObject)
_nsContext = nil;
_context = nil;
_spinlockProcessedInfo = OS_SPINLOCK_INIT;
_unfairlockProcessedInfo = apple_unfairlock_create();
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()
{
this->_nsContext = [[NSOpenGLContext alloc] initWithFormat:this->_nsPixelFormat
@ -419,18 +433,18 @@ void MacOGLDisplayPresenter::CopyFrameToBuffer(uint32_t *dstBuffer)
const OGLProcessedFrameInfo& MacOGLDisplayPresenter::GetProcessedFrameInfo()
{
OSSpinLockLock(&this->_spinlockProcessedInfo);
apple_unfairlock_lock(this->_unfairlockProcessedInfo);
const OGLProcessedFrameInfo &processedInfo = this->OGLVideoOutput::GetProcessedFrameInfo();
OSSpinLockUnlock(&this->_spinlockProcessedInfo);
apple_unfairlock_unlock(this->_unfairlockProcessedInfo);
return processedInfo;
}
void MacOGLDisplayPresenter::SetProcessedFrameInfo(const OGLProcessedFrameInfo &processedInfo)
{
OSSpinLockLock(&this->_spinlockProcessedInfo);
apple_unfairlock_lock(this->_unfairlockProcessedInfo);
this->OGLVideoOutput::SetProcessedFrameInfo(processedInfo);
OSSpinLockUnlock(&this->_spinlockProcessedInfo);
apple_unfairlock_unlock(this->_unfairlockProcessedInfo);
}
void MacOGLDisplayPresenter::WriteLockEmuFramebuffer(const uint8_t bufferIndex)
@ -472,12 +486,15 @@ MacOGLDisplayView::MacOGLDisplayView(MacClientSharedObject *sharedObject)
MacOGLDisplayView::~MacOGLDisplayView()
{
[this->_caLayer release];
apple_unfairlock_destroy(this->_unfairlockViewNeedsFlush);
this->_unfairlockViewNeedsFlush = NULL;
}
void MacOGLDisplayView::__InstanceInit(MacClientSharedObject *sharedObject)
{
_allowViewUpdates = false;
_spinlockViewNeedsFlush = OS_SPINLOCK_INIT;
_unfairlockViewNeedsFlush = apple_unfairlock_create();
MacOGLDisplayPresenter *newOpenGLPresenter = new MacOGLDisplayPresenter(sharedObject);
_presenter = newOpenGLPresenter;
@ -488,9 +505,9 @@ void MacOGLDisplayView::__InstanceInit(MacClientSharedObject *sharedObject)
bool MacOGLDisplayView::GetViewNeedsFlush()
{
OSSpinLockLock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
const bool viewNeedsFlush = this->_viewNeedsFlush;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
return viewNeedsFlush;
}
@ -513,9 +530,9 @@ void MacOGLDisplayView::SetViewNeedsFlush()
// will eventually get flushed.
this->SetAllowViewFlushes(true);
OSSpinLockLock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
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)
{
OSSpinLockLock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_lock(this->_unfairlockViewNeedsFlush);
this->_viewNeedsFlush = false;
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush);
apple_unfairlock_unlock(this->_unfairlockViewNeedsFlush);
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
it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@
return nil;
}
formatID = NSTIFFFileType;
formatID = FILETYPE_TIFF;
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
it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@
- (void) setIsExpanded:(BOOL)theState
{
[disclosureButton setState:(theState) ? NSOnState : NSOffState];
[disclosureButton setState:(theState) ? GUI_STATE_ON : GUI_STATE_OFF];
NSRect newFrame = [self frame];
newFrame.size.height = (theState) ? expandedHeight : collapsedHeight;
@ -53,7 +53,7 @@
- (BOOL) isExpanded
{
return ([disclosureButton state] == NSOnState);
return ([disclosureButton state] == GUI_STATE_ON);
}
- (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
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:
// 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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseMPCFPathDidEnd:panel returnCode:result contextInfo:mpcfOptionNumber];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseMPCFPathDidEnd:returnCode:contextInfo:)
contextInfo:mpcfOptionNumber];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseMPCFPathDidEnd:panel returnCode:result contextInfo:mpcfOptionNumber];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseMPCFPathDidEnd:returnCode:contextInfo:)
contextInfo:mpcfOptionNumber] );
}
}
- (void) chooseMPCFPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
@ -397,7 +400,7 @@
[[NSUserDefaults standardUserDefaults] setInteger:mpcfOptionTag forKey:@"Slot2_MPCF_PathOption"];
[[NSUserDefaults standardUserDefaults] synchronize];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
[[NSUserDefaults standardUserDefaults] setInteger:prevMpcfOption forKey:@"Slot2_MPCF_PathOption"];
return;
@ -509,30 +512,33 @@
[panel setCanChooseFiles:YES];
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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseGbaCartridgePathDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseGbaCartridgePathDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseGbaCartridgePathDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseGbaCartridgePathDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (void) chooseGbaCartridgePathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
return;
}
@ -568,30 +574,33 @@
[panel setCanChooseFiles:YES];
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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseGbaSRamPathDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseGbaSRamPathDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseGbaSRamPathDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseGbaSRamPathDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (void) chooseGbaSRamPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
return;
}

View File

@ -1,6 +1,6 @@
/*
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
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"]];
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];
return;
}
@ -171,10 +176,10 @@
[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
// 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:)])
{
[NSWindow setAllowsAutomaticWindowTabbing:NO];
@ -192,15 +197,23 @@
buildInfoStr = [[buildInfoStr stringByAppendingString:@"\nOperating System: "] stringByAppendingString:[CocoaDSUtil operatingSystemString]];
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:
[[NSBundle mainBundle] pathForResource:@FILENAME_README ofType:@""], @"readMePath",
[[NSBundle mainBundle] pathForResource:@FILENAME_COPYING ofType:@""], @"licensePath",
[[NSBundle mainBundle] pathForResource:@FILENAME_AUTHORS ofType:@""], @"authorsPath",
[[NSBundle mainBundle] pathForResource:@FILENAME_CHANGELOG ofType:@""], @"changeLogPath",
[[[NSAttributedString alloc] initWithString:readMeTextData attributes:aboutTextAttr] autorelease], @"readMeTextData",
[[[NSAttributedString alloc] initWithString:licenseTextData attributes:aboutTextAttr] autorelease], @"licenseTextData",
[[[NSAttributedString alloc] initWithString:authorsTextData attributes:aboutTextAttr] autorelease], @"authorsTextData",
[[[NSAttributedString alloc] initWithString:changeLogTextData attributes:aboutTextAttr] autorelease], @"changeLogTextData",
descriptionStr, @"descriptionString",
buildInfoStr, @"buildInfoString",
aboutTextFilesFont, @"aboutTextFilesFont",
nil];
[aboutWindowController setContent:aboutWindowProperties];
@ -452,7 +465,7 @@
[loadItem setAction:@selector(loadEmuSaveStateSlot:)];
saveItem = [self addSlotMenuItem:mSaveStateSlot slotNumber:(NSUInteger)(i + 1)];
[saveItem setKeyEquivalentModifierMask:NSShiftKeyMask];
[saveItem setKeyEquivalentModifierMask:EVENT_MODIFIERFLAG_SHIFT];
[saveItem setTag:i];
[saveItem setAction:@selector(saveEmuSaveStateSlot:)];
}

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -187,11 +187,23 @@
- (IBAction) viewDatabase:(id)sender
{
[NSApp beginSheet:cheatDatabaseSheet
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(didEndCheatDatabaseSheet:returnCode:contextInfo:)
contextInfo:nil];
#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
modalDelegate:self
didEndSelector:@selector(didEndCheatDatabaseSheet:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (IBAction) setInternalCheatValue:(id)sender
@ -463,9 +475,9 @@
- (IBAction) closeCheatDatabaseSheet:(id)sender
{
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
@ -474,11 +486,11 @@
switch (returnCode)
{
case NSCancelButton:
case GUI_RESPONSE_CANCEL:
return;
break;
case NSOKButton:
case GUI_RESPONSE_OK:
[self addSelectedFromCheatDatabase];
break;

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -403,7 +403,7 @@
- (void) didEndSettingsSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
[sheet orderOut:self];
NSOutlineView *outlineView = (NSOutlineView *)contextInfo;
NSMutableDictionary *editedDeviceInfo = (NSMutableDictionary *)[inputSettingsController content];
@ -411,10 +411,10 @@
switch (returnCode)
{
case NSCancelButton:
case GUI_RESPONSE_CANCEL:
break;
case NSOKButton:
case GUI_RESPONSE_OK:
[deviceInfoInEdit setDictionary:editedDeviceInfo];
[self setMappingUsingDeviceInfoDictionary:deviceInfoInEdit];
[outlineView reloadItem:deviceInfoInEdit reloadChildren:NO];
@ -446,7 +446,12 @@
if (cmdTagTarget == nil)
{
ClearHIDQueue(hidQueue);
size_t hidInputClearCount = ClearHIDQueue(hidQueue);
if (hidInputClearCount > 0)
{
[hidManager reportUserActivity];
}
return isHandled;
}
@ -828,18 +833,42 @@
[self updateCustomTurboPatternControls:turboPatternControl];
}
[NSApp beginSheet:theSheet
modalForWindow:prefWindow
modalDelegate:self
didEndSelector:@selector(didEndSettingsSheet:returnCode:contextInfo:)
contextInfo:outlineView];
#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
modalDelegate:self
didEndSelector:@selector(didEndSettingsSheet:returnCode:contextInfo:)
contextInfo:outlineView] );
}
}
- (IBAction) closeSettingsSheet:(id)sender
{
NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender];
[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
@ -1000,11 +1029,23 @@
- (IBAction) profileView:(id)sender
{
[NSApp beginSheet:inputProfileSheet
modalForWindow:prefWindow
modalDelegate:self
didEndSelector:@selector(didEndProfileSheet:returnCode:contextInfo:)
contextInfo:nil];
#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
modalDelegate:self
didEndSelector:@selector(didEndProfileSheet:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (IBAction) profileApply:(id)sender
@ -1026,11 +1067,23 @@
- (IBAction) profileRename:(id)sender
{
[NSApp beginSheet:inputProfileRenameSheet
modalForWindow:prefWindow
modalDelegate:self
didEndSelector:@selector(didEndProfileRenameSheet:returnCode:contextInfo:)
contextInfo:nil];
#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
modalDelegate:self
didEndSelector:@selector(didEndProfileRenameSheet:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (IBAction) profileSave:(id)sender
@ -1110,20 +1163,25 @@
- (IBAction) closeProfileSheet:(id)sender
{
NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender];
[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
{
NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender];
[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
{
NSURL *selectedFileURL = nil;
NSInteger buttonClicked = 0;
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO];
@ -1155,16 +1213,24 @@
@"wav",
nil];
// The NSOpenPanel method -(NSInt)runModalForDirectory:file:types:
// is deprecated in Mac OS X v10.6.
// While [NSOpenPanel setAllowedFileTypes:] and [NSOpenPanel runModal]
// 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
[panel setAllowedFileTypes:fileTypes];
const NSInteger buttonClicked = [panel runModal];
#else
const NSInteger buttonClicked = [panel runModalForDirectory:nil file:nil types:fileTypes];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
buttonClicked = [panel runModal];
}
else
#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];
if(selectedFileURL == nil)

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -218,7 +218,7 @@
{
const uint32_t color = bitmapData[i];
#if defined(__i386__) || defined(__x86_64__)
#ifndef MSB_FIRST
bitmapData[i] = 0xFF000000 | // lA
((color & 0x00FF0000) >> 16) | // lB -> lR
(color & 0x0000FF00) | // lG
@ -410,23 +410,26 @@
[panel setTitle:NSSTRING_TITLE_SELECT_ROM_PANEL];
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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseRomForAutoloadDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseRomForAutoloadDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseRomForAutoloadDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseRomForAutoloadDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (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] synchronize];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
[[NSUserDefaults standardUserDefaults] setInteger:ROMAUTOLOADOPTION_LOAD_NONE forKey:@"General_AutoloadROMOption"];
return;
@ -468,30 +471,33 @@
[panel setTitle:NSSTRING_TITLE_SELECT_ADVANSCENE_DB_PANEL];
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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseAdvansceneDatabaseDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseAdvansceneDatabaseDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseAdvansceneDatabaseDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseAdvansceneDatabaseDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (void) chooseAdvansceneDatabaseDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
return;
}
@ -521,27 +527,32 @@
// 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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseCheatDatabaseDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseCheatDatabaseDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseCheatDatabaseDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseCheatDatabaseDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (void) chooseCheatDatabaseDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
return;
}
@ -727,23 +738,26 @@
[panel setTitle:NSSTRING_TITLE_SELECT_ARM9_IMAGE_PANEL];
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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseArm9BiosImageDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseArm9BiosImageDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseArm9BiosImageDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseArm9BiosImageDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (IBAction) chooseARM7BiosImage:(id)sender
@ -756,23 +770,26 @@
[panel setTitle:NSSTRING_TITLE_SELECT_ARM7_IMAGE_PANEL];
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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseArm7BiosImageDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseArm7BiosImageDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseArm7BiosImageDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseArm7BiosImageDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (IBAction) chooseFirmwareImage:(id)sender
@ -785,30 +802,33 @@
[panel setTitle:NSSTRING_TITLE_SELECT_FIRMWARE_IMAGE_PANEL];
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
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseFirmwareImageDidEnd:panel returnCode:result contextInfo:nil];
} ];
#else
[panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseFirmwareImageDidEnd:returnCode:contextInfo:)
contextInfo:nil];
if (IsOSXVersionSupported(10, 6, 0))
{
[panel setAllowedFileTypes:fileTypes];
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
[self chooseFirmwareImageDidEnd:panel returnCode:result contextInfo:nil];
} ];
}
else
#endif
{
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
file:nil
types:fileTypes
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(chooseFirmwareImageDidEnd:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (void) chooseArm9BiosImageDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
return;
}
@ -832,7 +852,7 @@
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
return;
}
@ -856,7 +876,7 @@
{
[sheet orderOut:self];
if (returnCode == NSCancelButton)
if (returnCode == GUI_RESPONSE_CANCEL)
{
return;
}
@ -878,11 +898,23 @@
- (IBAction) configureInternalFirmware:(id)sender
{
[NSApp beginSheet:firmwareConfigSheet
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(didEndFirmwareConfigSheet:returnCode:contextInfo:)
contextInfo:nil];
#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
modalDelegate:self
didEndSelector:@selector(didEndFirmwareConfigSheet:returnCode:contextInfo:)
contextInfo:nil] );
}
}
- (IBAction) closeFirmwareConfigSheet:(id)sender
@ -890,10 +922,8 @@
NSWindow *sheet = [(NSControl *)sender window];
const NSInteger code = [CocoaDSUtil getIBActionSenderTag:sender];
// Force end of editing of any text fields.
[sheet makeFirstResponder:nil];
[NSApp endSheet:sheet returnCode:code];
[sheet makeFirstResponder:nil]; // Force end of editing of any text fields.
[CocoaDSUtil endSheet:sheet returnCode:code];
}
- (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
it under the terms of the GNU General Public License as published by
@ -202,8 +202,8 @@
- (IBAction) copyInfoToPasteboard:(id)sender
{
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:self];
[pboard setString:(NSString *)[bindings valueForKey:@"finalFormText"] forType:NSStringPboardType];
[pboard declareTypes:[NSArray arrayWithObjects:PASTEBOARDTYPE_STRING, nil] owner:self];
[pboard setString:(NSString *)[bindings valueForKey:@"finalFormText"] forType:PASTEBOARDTYPE_STRING];
}
- (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
it under the terms of the GNU General Public License as published by
@ -17,6 +17,11 @@
#include "utilities.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 OSXProductVersion = NULL;
@ -30,21 +35,53 @@ static bool isSystemVersionAlreadyRead = false;
static void ReadSystemVersionPListFile()
{
Boolean status = 0;
bool isXMLFileFormat = false;
CFDictionaryRef systemDict = NULL;
// Read the SystemVersion.plist file.
CFDataRef resourceData = NULL;
CFURLRef systemPListURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR("/System/Library/CoreServices/SystemVersion.plist"), kCFURLPOSIXPathStyle, false);
Boolean status = CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, systemPListURL, &resourceData, NULL, NULL, NULL);
if (!status)
CFReadStreamRef theStream = CFReadStreamCreateWithFile(kCFAllocatorDefault, systemPListURL);
CFRelease(systemPListURL);
systemPListURL = NULL;
if (theStream == NULL)
{
CFRelease(systemPListURL);
return;
}
CFDictionaryRef systemDict = (CFDictionaryRef)CFPropertyListCreateFromXMLData(kCFAllocatorDefault, resourceData, kCFPropertyListImmutable, NULL);
if (systemDict == NULL)
CFPropertyListFormat *xmlFormat = (CFPropertyListFormat *)malloc(sizeof(CFPropertyListFormat));
*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;
}
@ -89,13 +126,13 @@ static void ReadSystemVersionPListFile()
CFRetain(OSXProductBuildVersion);
}
// Release all resources now that the system version string has been copied.
CFRelease(resourceData);
CFRelease(systemPListURL);
// Release all resources now that the system version strings have been copied.
CFRelease(systemDict);
systemDict = NULL;
// Mark that we've already read the SystemVersion.plist file so that we don't
// have to do this again.
// Mark that we've already read the SystemVersion.plist file so that we don't 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;
}
@ -132,6 +169,77 @@ bool IsOSXVersion(const unsigned int major, const unsigned int minor, const unsi
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()

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
it under the terms of the GNU General Public License as published by
@ -20,12 +20,128 @@
#include <stdbool.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
extern "C"
{
#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 IsOSXVersion(const unsigned int major, const unsigned int minor, const unsigned int revision);
uint32_t GetNearestPositivePOT(uint32_t value);

View File

@ -1,6 +1,6 @@
/*
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
it under the terms of the GNU General Public License as published by
@ -23,6 +23,10 @@
#include <retro_inline.h>
#include <math/fxp.h>
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#endif
//analyze microsoft compilers
#ifdef _MSC_VER
#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_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>
#define atomic_add_32(V,M) OSAtomicAdd32((M),(V))