[Scummvm-git-logs] scummvm master -> 4578c4a6fc596386220fd69d759082c5dea7b708
dwatteau
noreply at scummvm.org
Wed Nov 9 11:27:58 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5db6e27eca MACOSX: Fix NSUInteger definition on macOS 10.4
4578c4a6fc MACOSX: Simplify detection conditions for the older CoreAudio API
Commit: 5db6e27ecaf33aceb6dd56191843e1334ebf0550
https://github.com/scummvm/scummvm/commit/5db6e27ecaf33aceb6dd56191843e1334ebf0550
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-11-09T12:27:51+01:00
Commit Message:
MACOSX: Fix NSUInteger definition on macOS 10.4
NSUInteger should be an `unsigned int` on 32-bit Tiger, and an
`unsigned long` on 64-bit Tiger. In practice, this wasn't really a
problem since we were always using `unsigned long` which has the same
width on 32-bit Tiger, but still it's more correct to do what the
official 10.5 SDK does.
The preprocessor defines come from Apple's documentation and from
their SDK. We can use it as-is, since we're in the backend code, and
already in an ifdef only targeting Tiger (where I've tested this
change).
Also fix a small GCC warning while there.
Changed paths:
backends/platform/sdl/macosx/appmenu_osx.mm
backends/platform/sdl/macosx/macosx_wrapper.mm
diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm
index 2631a7565ec..51774b77c2f 100644
--- a/backends/platform/sdl/macosx/appmenu_osx.mm
+++ b/backends/platform/sdl/macosx/appmenu_osx.mm
@@ -40,7 +40,12 @@
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
+// https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Cocoa64BitGuide/64BitChangesCocoa/64BitChangesCocoa.html
+#if __LP64__ || NS_BUILD_32_LIKE_64
typedef unsigned long NSUInteger;
+#else
+typedef unsigned int NSUInteger;
+#endif
// Those are not defined in the 10.4 SDK, but they are defined when targeting
// Mac OS X 10.4 or above in the 10.5 SDK, and they do work with 10.4.
@@ -140,7 +145,7 @@ static void openFromBundle(NSString *file) {
NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:bundlePath error:nil];
NSEnumerator *dirEnum = [dirContents objectEnumerator];
NSString *file;
- while (file = [dirEnum nextObject]) {
+ while ((file = [dirEnum nextObject])) {
if ([file hasPrefix:@"ScummVM Manual"] && [file hasSuffix:@".pdf"]) {
[[NSWorkspace sharedWorkspace] openFile:[bundlePath stringByAppendingPathComponent:file]];
return;
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.mm b/backends/platform/sdl/macosx/macosx_wrapper.mm
index 08dc432d9e7..f3ad6414b2d 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.mm
+++ b/backends/platform/sdl/macosx/macosx_wrapper.mm
@@ -37,7 +37,12 @@
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
+// https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Cocoa64BitGuide/64BitChangesCocoa/64BitChangesCocoa.html
+#if __LP64__ || NS_BUILD_32_LIKE_64
typedef unsigned long NSUInteger;
+#else
+typedef unsigned int NSUInteger;
+#endif
// Those are not defined in the 10.4 SDK, but they are defined when targeting
// Mac OS X 10.4 or above in the 10.5 SDK, and they do work with 10.4.
Commit: 4578c4a6fc596386220fd69d759082c5dea7b708
https://github.com/scummvm/scummvm/commit/4578c4a6fc596386220fd69d759082c5dea7b708
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-11-09T12:27:51+01:00
Commit Message:
MACOSX: Simplify detection conditions for the older CoreAudio API
The current code checked for the CPU type to determine if we were
building for the older macOS releases requiring this older API, but
we can just check MAC_OS_X_VERSION_MAX_ALLOWED which is clearer and
more accurate.
Apart from simplification, this also lets one build ScummVM for x86
again on Tiger. I haven't checked this case, though :)
Note that the ComponentDescription -> AudioComponentDescription change
was done in macOS 10.6 and not macOS 10.5, so this also fixes this
case.
Tested on macOS 10.4, 10.5, 10.5 with the 10.4 SDK, and on 12.6.
Changed paths:
backends/midi/coreaudio.cpp
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index 13a51dd9c0c..e94b2045639 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -26,40 +26,21 @@
#ifdef MACOSX
-#include <AvailabilityMacros.h>
+#include "backends/platform/sdl/macosx/macosx-compat.h"
// With the release of Mac OS X 10.5 in October 2007, Apple deprecated the
// AUGraphNewNode & AUGraphGetNodeInfo APIs in favor of the new AUGraphAddNode &
// AUGraphNodeInfo APIs. While it is easy to switch to those, it breaks
-// compatibility with all pre-10.5 systems.
-//
-// Since 10.5 was the last system to support PowerPC, we use the old, deprecated
-// APIs on PowerPC based systems by default. On all other systems (such as macOS
-// running on Intel hardware, or iOS running on ARM), we use the new API by
-// default.
-//
-// This leaves Mac OS X 10.4 running on x86 processors as the only system
-// combination that this code will not support by default. It seems quite
-// reasonable to assume that anybody with an Intel system has since then moved
-// on to a newer macOS release. But if for some reason you absolutely need to
-// build an x86 version of this code using the old, deprecated API, you can
-// simply do so by manually enable the USE_DEPRECATED_COREAUDIO_API switch (e.g.
-// by adding setting it suitably in CPPFLAGS).
-#if !defined(USE_DEPRECATED_COREAUDIO_API)
- #if TARGET_CPU_PPC || TARGET_CPU_PPC64 || !defined(MAC_OS_X_VERSION_10_6)
- #define USE_DEPRECATED_COREAUDIO_API 1
- #else
- #define USE_DEPRECATED_COREAUDIO_API 0
- #endif
-#endif
-
-#if USE_DEPRECATED_COREAUDIO_API
+// compatibility with 10.4, for which we need to use the older APIs.
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
+ #define USE_DEPRECATED_COREAUDIO_API 1
// Try to silence warnings about use of deprecated APIs
#undef DEPRECATED_ATTRIBUTE
#define DEPRECATED_ATTRIBUTE
+#else
+ #define USE_DEPRECATED_COREAUDIO_API 0
#endif
-
#include "common/config-manager.h"
#include "common/error.h"
#include "common/textconsole.h"
@@ -129,7 +110,7 @@ int MidiDriver_CORE::open() {
RequireNoErr(NewAUGraph(&_auGraph));
AUNode outputNode, synthNode;
-#if USE_DEPRECATED_COREAUDIO_API
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
ComponentDescription desc;
#else
AudioComponentDescription desc;
More information about the Scummvm-git-logs
mailing list