[PATCH 1/2] Mac OS X {x86_64|ppc64}: disable incompatible components and use 64-bit capable input API

SDL’s cdrom and SoundManager are not supported on 64-bit Mac OS X builds.

The input API used in SDL_cocoakeyboard.m was 32-bit only in parts,
because it used 32-bit Carbon instead of Cocoa. This has been
corrected, thanks to Matti Hameister!

Signed-off-by: Matti Hameister <m.hami at 42degreesoffreedom.com>
Signed-off-by: Steven Noonan <@Steven_Noonan>—
Xcode/SDL/SDL.xcodeproj/project.pbxproj | 3 +++
include/SDL_config_macosx.h | 6 ++++++
src/audio/macrom/SDL_romaudio.c | 6 ++++++
src/audio/macrom/SDL_romaudio.h | 6 ++++++
src/cdrom/macosx/AudioFilePlayer.c | 4 ++++
src/cdrom/macosx/AudioFileReaderThread.c | 4 ++++
src/cdrom/macosx/CDPlayer.c | 5 +++++
src/cdrom/macosx/SDL_syscdrom.c | 2 ±
src/video/cocoa/SDL_cocoakeyboard.m | 21 +++++++++++++++++++±
src/video/cocoa/SDL_cocoamodes.m | 4 ++++
10 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index 74851c5…e4db0f6 100644
— a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -2859,6 +2859,7 @@
MACOSX_DEPLOYMENT_TARGET = “”;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;

  •   		OTHER_CFLAGS = "-fno-strict-aliasing";
      		PREBINDING = NO;
      		SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
      		SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
    

@@ -2886,6 +2887,7 @@
MACOSX_DEPLOYMENT_TARGET = “”;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;

  •   		OTHER_CFLAGS = "-fno-strict-aliasing";
      		PREBINDING = NO;
      		SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
      		SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
    

@@ -2913,6 +2915,7 @@
MACOSX_DEPLOYMENT_TARGET = “”;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;

  •   		OTHER_CFLAGS = "-fno-strict-aliasing";
      		PREBINDING = NO;
      		SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
      		SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
    

diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h
index 1a43516…d1180e2 100644
— a/include/SDL_config_macosx.h
+++ b/include/SDL_config_macosx.h
@@ -102,12 +102,18 @@

/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
+#ifndef _LP64
#define SDL_AUDIO_DRIVER_SNDMGR 1
+#endif
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1

/* Enable various cdrom drivers */
+#ifndef _LP64
#define SDL_CDROM_MACOSX 1
+#else
+#define SDL_CDROM_DISABLED 1
+#endif

/* Enable various input drivers */
#define SDL_JOYSTICK_IOKIT 1
diff --git a/src/audio/macrom/SDL_romaudio.c b/src/audio/macrom/SDL_romaudio.c
index e9aaa5c…dae2413 100644
— a/src/audio/macrom/SDL_romaudio.c
+++ b/src/audio/macrom/SDL_romaudio.c
@@ -19,6 +19,9 @@
Sam Lantinga
slouken at libsdl.org
*/
+
+#ifndef _LP64
+
#include “SDL_config.h”

/* This should work on PowerPC and Intel Mac OS X, and Carbonized Mac OS 9. */
@@ -316,4 +319,7 @@ AudioBootStrap SNDMGR_bootstrap = {
“sndmgr”, SDL_MACOS_NAME " SoundManager", SNDMGR_Init, 0
};

+#endif
+
/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/audio/macrom/SDL_romaudio.h b/src/audio/macrom/SDL_romaudio.h
index 8dbbb1d…c955fcd 100644
— a/src/audio/macrom/SDL_romaudio.h
+++ b/src/audio/macrom/SDL_romaudio.h
@@ -19,6 +19,9 @@
Sam Lantinga
slouken at libsdl.org
*/
+
+#ifndef _LP64
+
#include “SDL_config.h”

#ifndef _SDL_romaudio_h
@@ -36,4 +39,7 @@ struct SDL_PrivateAudioData
};

#endif /* _SDL_romaudio_h /
+
+#endif
+
/
vi: set ts=4 sw=4 expandtab: */
diff --git a/src/cdrom/macosx/AudioFilePlayer.c b/src/cdrom/macosx/AudioFilePlayer.c
index f132b17…6782187 100644
— a/src/cdrom/macosx/AudioFilePlayer.c
+++ b/src/cdrom/macosx/AudioFilePlayer.c
@@ -24,6 +24,8 @@
*/
#include “SDL_config.h”

+#ifndef _LP64
+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AudioFilePlayer.cpp
*/
@@ -394,4 +396,6 @@ new_AudioFilePlayer(const FSRef * inFileRef)
return afp;
}

+#endif
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/cdrom/macosx/AudioFileReaderThread.c b/src/cdrom/macosx/AudioFileReaderThread.c
index bc30f4f…0ff66ff 100644
— a/src/cdrom/macosx/AudioFileReaderThread.c
+++ b/src/cdrom/macosx/AudioFileReaderThread.c
@@ -24,6 +24,8 @@
*/
#include “SDL_config.h”

+#ifndef _LP64
+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AudioFileManager.cpp
*/
@@ -654,4 +656,6 @@ new_AudioFileManager(AudioFilePlayer * inParent,
return afm;
}

+#endif
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/cdrom/macosx/CDPlayer.c b/src/cdrom/macosx/CDPlayer.c
index f4aecdb…52b4b02 100644
— a/src/cdrom/macosx/CDPlayer.c
+++ b/src/cdrom/macosx/CDPlayer.c
@@ -21,6 +21,8 @@
*/
#include “SDL_config.h”

+#ifdef SDL_CDROM_MACOSX
+
#include “CDPlayer.h”
#include “AudioFilePlayer.h”
#include “SDLOSXCAGuard.h”
@@ -666,4 +668,7 @@ RunCallBackThread(void *param)
}

/*}; // extern “C” /
+
+#endif /
SDL_CDROM_MACOSX /
+
/
vi: set ts=4 sw=4 expandtab: */
diff --git a/src/cdrom/macosx/SDL_syscdrom.c b/src/cdrom/macosx/SDL_syscdrom.c
index 909a6c4…e2293b0 100644
— a/src/cdrom/macosx/SDL_syscdrom.c
+++ b/src/cdrom/macosx/SDL_syscdrom.c
@@ -21,7 +21,7 @@
*/
#include “SDL_config.h”

-#ifdef SDL_CDROM_MACOSX
+#ifndef _LP64

#include “SDL_syscdrom_c.h”

diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m
index f9b01f3…fb06eca 100644
— a/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/src/video/cocoa/SDL_cocoakeyboard.m
@@ -28,7 +28,6 @@

#include <Carbon/Carbon.h>

#ifndef NX_DEVICERCTLKEYMASK
#define NX_DEVICELCTLKEYMASK 0x00000001
#endif
@@ -351,14 +350,23 @@ HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
static void
UpdateKeymap(SDL_VideoData *data)
{
+#ifdef _LP64

  • TISInputSourceRef key_layout;

  • const void *chr_data = NULL;
    +#else
    KeyboardLayoutRef key_layout;
    const void *chr_data;
    +#endif
    int i;
    SDL_scancode scancode;
    SDLKey keymap[SDL_NUM_SCANCODES];

    /* See if the keymap needs to be updated */
    +#ifdef _LP64

  • key_layout = TISCopyCurrentKeyboardLayoutInputSource();
    +#else
    KLGetCurrentKeyboardLayout(&key_layout);
    +#endif
    if (key_layout == data->key_layout) {
    return;
    }
    @@ -367,8 +375,17 @@ UpdateKeymap(SDL_VideoData *data)
    SDL_GetDefaultKeymap(keymap);

    /* Try Unicode data first (preferred as of Mac OS X 10.5) */
    +#ifdef _LP64

  • CFDataRef currentKeyLayoutDataRef = (CFDataRef) TISGetInputSourceProperty (key_layout, kTISPropertyUnicodeKeyLayoutData);

  • if (currentKeyLayoutDataRef) {

  •    chr_data = CFDataGetBytePtr (currentKeyLayoutDataRef);
    
  • }

  • if (chr_data) {
    +#else
    KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data);
    if (chr_data) {
    +#endif
    UInt32 keyboard_type = LMGetKbdType();
    OSStatus err;

@@ -400,6 +417,7 @@ UpdateKeymap(SDL_VideoData *data)
return;
}

+#ifndef _LP64
/* Fall back to older style key map data */
KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
if (chr_data) {
@@ -449,6 +467,7 @@ UpdateKeymap(SDL_VideoData *data)
SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
return;
}
+#endif
}

void
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index 115abc3…d656be3 100644
— a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -30,6 +30,7 @@
to fullscreen, we’ll set it manually (but only for the
main screen).
*/
+#ifndef _LP64
@interface NSScreen (NSScreenAccess)

  • (void) setFrame:(NSRect)frame;
    @end
    @@ -40,6 +41,7 @@
    _frame = frame;
    }
    @end
    +#endif

static void
CG_SetError(const char *prefix, CGDisplayErr result)
@@ -255,7 +257,9 @@ Cocoa_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
We can hack around this bug by setting the screen rect
ourselves. This hack should be removed if/when the bug is fixed.
*/
+#ifndef _LP64
[[NSScreen mainScreen] setFrame:NSMakeRect(0,0,mode->w,mode->h)];
+#endif

 return 0;


1.6.3.1

Without this, Xcode complains that SDL_revision.h is missing, because
Xcode doesn’t know to generate it.

Signed-off-by: Steven Noonan <@Steven_Noonan>—
Xcode/SDL/SDL.xcodeproj/project.pbxproj | 32 ++++++++++++++±--------------
1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index e4db0f6…3661b81 100644
— a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -1798,7 +1798,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 0014B9A409C0E585003A99D5 /* Build configuration list for PBXNativeTarget “Framework Without X11 Stuff (for those who didn’t install the X11 headers with Xcode)” */;
buildPhases = (

  •   		00D55F0A0A1114960030ED2A /* Run Script to Create SDL_config.h */,
    
  •   		00D55F0A0A1114960030ED2A /* Create SDL_config.h and SDL_revision.h */,
      		0014B91A09C0E585003A99D5 /* Headers */,
      		0014B94209C0E585003A99D5 /* Resources */,
      		0014B94409C0E585003A99D5 /* Sources */,
    

@@ -1820,7 +1820,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 002F327209CA02D800EBEB88 /* Build configuration list for PBXNativeTarget “Static Library Without X11 Stuff (for those who didn’t install the X11 headers with Xcode)” */;
buildPhases = (

  •   		00D55F0C0A1114AF0030ED2A /* Run Script to Create SDL_config.h */,
    
  •   		00D55F0C0A1114AF0030ED2A /* Create SDL_config.h and SDL_revision.h */,
      		002F31EA09CA02D800EBEB88 /* Headers */,
      		002F321209CA02D800EBEB88 /* Sources */,
      		002F326809CA02D800EBEB88 /* Frameworks */,
    

@@ -1841,7 +1841,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 0073177A0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget “Framework” */;
buildPhases = (

  •   		00D55F050A11143E0030ED2A /* Run Script to Create SDL_config.h */,
    
  •   		00D55F050A11143E0030ED2A /* Create SDL_config.h and SDL_revision.h */,
      		BECDF5FF0761BA81005FE872 /* Headers */,
      		BECDF62A0761BA81005FE872 /* Resources */,
      		BECDF62C0761BA81005FE872 /* Sources */,
    

@@ -1863,7 +1863,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 0073177E0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget “Static Library” */;
buildPhases = (

  •   		00D55F080A11147F0030ED2A /* Run Script to Create SDL_config.h */,
    
  •   		00D55F080A11147F0030ED2A /* Create SDL_config.h and SDL_revision.h */,
      		BECDF66E0761BA81005FE872 /* Headers */,
      		BECDF6790761BA81005FE872 /* Sources */,
      		BECDF6B10761BA81005FE872 /* Frameworks */,
    

@@ -1985,61 +1985,61 @@
/* End PBXRezBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */

  •   00D55F050A11143E0030ED2A /* Run Script to Create SDL_config.h */ = {
    
  •   00D55F050A11143E0030ED2A /* Create SDL_config.h and SDL_revision.h */ = {
      	isa = PBXShellScriptBuildPhase;
      	buildActionMask = 2147483647;
      	files = (
      	);
      	inputPaths = (
      	);
    
  •   	name = "Run Script to Create SDL_config.h";
    
  •   	name = "Create SDL_config.h and SDL_revision.h";
      	outputPaths = (
      	);
      	runOnlyForDeploymentPostprocessing = 0;
      	shellPath = /bin/sh;
    
  •   	shellScript = "# Make sure that include/SDL_config.h is a symlink to SDL_config.h.default.\n# If it exists and is not a symlink, it was probably generated by configure and\n# we move it aside.\nif [ ! -L ../../include/SDL_config.h ]; then\n        if [ -e ../../include/SDL_config.h ]; then\n                mv ../../include/SDL_config.h ../../include/SDL_config.h.generated\n        fi\n        ln -s SDL_config.h.default ../../include/SDL_config.h\nfi\n";
    
  •   	shellScript = "# Make sure that include/SDL_config.h is a symlink to SDL_config.h.default.\n# If it exists and is not a symlink, it was probably generated by configure and\n# we move it aside.\nif [ ! -L ../../include/SDL_config.h ]; then\n        if [ -e ../../include/SDL_config.h ]; then\n                mv ../../include/SDL_config.h ../../include/SDL_config.h.generated\n        fi\n        ln -s SDL_config.h.default ../../include/SDL_config.h\nfi\n\ncd ../.. && build-scripts/updaterev.sh";
      };
    
  •   00D55F080A11147F0030ED2A /* Run Script to Create SDL_config.h */ = {
    
  •   00D55F080A11147F0030ED2A /* Create SDL_config.h and SDL_revision.h */ = {
      	isa = PBXShellScriptBuildPhase;
      	buildActionMask = 2147483647;
      	files = (
      	);
      	inputPaths = (
      	);
    
  •   	name = "Run Script to Create SDL_config.h";
    
  •   	name = "Create SDL_config.h and SDL_revision.h";
      	outputPaths = (
      	);
      	runOnlyForDeploymentPostprocessing = 0;
      	shellPath = /bin/sh;
    
  •   	shellScript = "# Make sure that include/SDL_config.h is a symlink to SDL_config.h.default.\n# If it exists and is not a symlink, it was probably generated by configure and\n# we move it aside.\nif [ ! -L ../../include/SDL_config.h ]; then\n        if [ -e ../../include/SDL_config.h ]; then\n                mv ../../include/SDL_config.h ../../include/SDL_config.h.generated\n        fi\n        ln -s SDL_config.h.default ../../include/SDL_config.h\nfi\n";
    
  •   	shellScript = "# Make sure that include/SDL_config.h is a symlink to SDL_config.h.default.\n# If it exists and is not a symlink, it was probably generated by configure and\n# we move it aside.\nif [ ! -L ../../include/SDL_config.h ]; then\n        if [ -e ../../include/SDL_config.h ]; then\n                mv ../../include/SDL_config.h ../../include/SDL_config.h.generated\n        fi\n        ln -s SDL_config.h.default ../../include/SDL_config.h\nfi\n\ncd ../.. && build-scripts/updaterev.sh";
      };
    
  •   00D55F0A0A1114960030ED2A /* Run Script to Create SDL_config.h */ = {
    
  •   00D55F0A0A1114960030ED2A /* Create SDL_config.h and SDL_revision.h */ = {
      	isa = PBXShellScriptBuildPhase;
      	buildActionMask = 2147483647;
      	files = (
      	);
      	inputPaths = (
      	);
    
  •   	name = "Run Script to Create SDL_config.h";
    
  •   	name = "Create SDL_config.h and SDL_revision.h";
      	outputPaths = (
      	);
      	runOnlyForDeploymentPostprocessing = 0;
      	shellPath = /bin/sh;
    
  •   	shellScript = "# Make sure that include/SDL_config.h is a symlink to SDL_config.h.default.\n# If it exists and is not a symlink, it was probably generated by configure and\n# we move it aside.\nif [ ! -L ../../include/SDL_config.h ]; then\n        if [ -e ../../include/SDL_config.h ]; then\n                mv ../../include/SDL_config.h ../../include/SDL_config.h.generated\n        fi\n        ln -s SDL_config.h.default ../../include/SDL_config.h\nfi\n";
    
  •   	shellScript = "# Make sure that include/SDL_config.h is a symlink to SDL_config.h.default.\n# If it exists and is not a symlink, it was probably generated by configure and\n# we move it aside.\nif [ ! -L ../../include/SDL_config.h ]; then\n        if [ -e ../../include/SDL_config.h ]; then\n                mv ../../include/SDL_config.h ../../include/SDL_config.h.generated\n        fi\n        ln -s SDL_config.h.default ../../include/SDL_config.h\nfi\n\ncd ../.. && build-scripts/updaterev.sh";
      };
    
  •   00D55F0C0A1114AF0030ED2A /* Run Script to Create SDL_config.h */ = {
    
  •   00D55F0C0A1114AF0030ED2A /* Create SDL_config.h and SDL_revision.h */ = {
      	isa = PBXShellScriptBuildPhase;
      	buildActionMask = 2147483647;
      	files = (
      	);
      	inputPaths = (
      	);
    
  •   	name = "Run Script to Create SDL_config.h";
    
  •   	name = "Create SDL_config.h and SDL_revision.h";
      	outputPaths = (
      	);
      	runOnlyForDeploymentPostprocessing = 0;
      	shellPath = /bin/sh;
    
  •   	shellScript = "# Make sure that include/SDL_config.h is a symlink to SDL_config.h.default.\n# If it exists and is not a symlink, it was probably generated by configure and\n# we move it aside.\nif [ ! -L ../../include/SDL_config.h ]; then\n        if [ -e ../../include/SDL_config.h ]; then\n                mv ../../include/SDL_config.h ../../include/SDL_config.h.generated\n        fi\n        ln -s SDL_config.h.default ../../include/SDL_config.h\nfi\n";
    
  •   	shellScript = "# Make sure that include/SDL_config.h is a symlink to SDL_config.h.default.\n# If it exists and is not a symlink, it was probably generated by configure and\n# we move it aside.\nif [ ! -L ../../include/SDL_config.h ]; then\n        if [ -e ../../include/SDL_config.h ]; then\n                mv ../../include/SDL_config.h ../../include/SDL_config.h.generated\n        fi\n        ln -s SDL_config.h.default ../../include/SDL_config.h\nfi\n\ncd ../.. && build-scripts/updaterev.sh";
      };
      BECDF6BD0761BA81005FE872 /* ShellScript */ = {
      	isa = PBXShellScriptBuildPhase;
    


1.6.3.1

Whoops, accidentally poisoned this patch with adding the
-fno-strict-aliasing flag to the compiler options.

  • StevenOn Wed, May 13, 2009 at 2:13 PM, Steven Noonan <@Steven_Noonan> wrote:

SDL’s cdrom and SoundManager are not supported on 64-bit Mac OS X builds.

The input API used in SDL_cocoakeyboard.m was 32-bit only in parts,
because it used 32-bit Carbon instead of Cocoa. This has been
corrected, thanks to Matti Hameister!

Signed-off-by: Matti Hameister <m.hami at 42degreesoffreedom.com>
Signed-off-by: Steven Noonan <@Steven_Noonan>

?Xcode/SDL/SDL.xcodeproj/project.pbxproj ?| ? ?3 +++
?include/SDL_config_macosx.h ? ? ? ? ? ? ?| ? ?6 ++++++
?src/audio/macrom/SDL_romaudio.c ? ? ? ? ?| ? ?6 ++++++
?src/audio/macrom/SDL_romaudio.h ? ? ? ? ?| ? ?6 ++++++
?src/cdrom/macosx/AudioFilePlayer.c ? ? ? | ? ?4 ++++
?src/cdrom/macosx/AudioFileReaderThread.c | ? ?4 ++++
?src/cdrom/macosx/CDPlayer.c ? ? ? ? ? ? ?| ? ?5 +++++
?src/cdrom/macosx/SDL_syscdrom.c ? ? ? ? ?| ? ?2 ±
?src/video/cocoa/SDL_cocoakeyboard.m ? ? ?| ? 21 +++++++++++++++++++±
?src/video/cocoa/SDL_cocoamodes.m ? ? ? ? | ? ?4 ++++
?10 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index 74851c5…e4db0f6 100644
— a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -2859,6 +2859,7 @@
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET = “”;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;

  • ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OTHER_CFLAGS = “-fno-strict-aliasing”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PREBINDING = NO;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
    @@ -2886,6 +2887,7 @@
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET = “”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
  • ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OTHER_CFLAGS = “-fno-strict-aliasing”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PREBINDING = NO;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
    @@ -2913,6 +2915,7 @@
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET = “”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
  • ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OTHER_CFLAGS = “-fno-strict-aliasing”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PREBINDING = NO;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
    diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h
    index 1a43516…d1180e2 100644
    — a/include/SDL_config_macosx.h
    +++ b/include/SDL_config_macosx.h
    @@ -102,12 +102,18 @@

?/* Enable various audio drivers */
?#define SDL_AUDIO_DRIVER_COREAUDIO ? ? 1
+#ifndef _LP64
?#define SDL_AUDIO_DRIVER_SNDMGR ? ? ? ?1
+#endif
?#define SDL_AUDIO_DRIVER_DISK ?1
?#define SDL_AUDIO_DRIVER_DUMMY 1

?/* Enable various cdrom drivers */
+#ifndef _LP64
?#define SDL_CDROM_MACOSX ? ? ? 1
+#else
+#define SDL_CDROM_DISABLED ? ? 1
+#endif

?/* Enable various input drivers /
?#define SDL_JOYSTICK_IOKIT ? ? 1
diff --git a/src/audio/macrom/SDL_romaudio.c b/src/audio/macrom/SDL_romaudio.c
index e9aaa5c…dae2413 100644
— a/src/audio/macrom/SDL_romaudio.c
+++ b/src/audio/macrom/SDL_romaudio.c
@@ -19,6 +19,9 @@
? ? Sam Lantinga
? ? slouken at libsdl.org
?
/
+
+#ifndef _LP64
+
?#include “SDL_config.h”

?/* This should work on PowerPC and Intel Mac OS X, and Carbonized Mac OS 9. */
@@ -316,4 +319,7 @@ AudioBootStrap SNDMGR_bootstrap = {
? ? “sndmgr”, SDL_MACOS_NAME " SoundManager", SNDMGR_Init, 0
?};

+#endif
+
?/* vi: set ts=4 sw=4 expandtab: /
+
diff --git a/src/audio/macrom/SDL_romaudio.h b/src/audio/macrom/SDL_romaudio.h
index 8dbbb1d…c955fcd 100644
— a/src/audio/macrom/SDL_romaudio.h
+++ b/src/audio/macrom/SDL_romaudio.h
@@ -19,6 +19,9 @@
? ? Sam Lantinga
? ? slouken at libsdl.org
?
/
+
+#ifndef ? ? ? ?_LP64
+
?#include “SDL_config.h”

?#ifndef _SDL_romaudio_h
@@ -36,4 +39,7 @@ struct SDL_PrivateAudioData
?};

?#endif /* _SDL_romaudio_h /
+
+#endif
+
?/
vi: set ts=4 sw=4 expandtab: /
diff --git a/src/cdrom/macosx/AudioFilePlayer.c b/src/cdrom/macosx/AudioFilePlayer.c
index f132b17…6782187 100644
— a/src/cdrom/macosx/AudioFilePlayer.c
+++ b/src/cdrom/macosx/AudioFilePlayer.c
@@ -24,6 +24,8 @@
?
/
?#include “SDL_config.h”

+#ifndef _LP64
+
?/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
? ? AudioFilePlayer.cpp
?*/
@@ -394,4 +396,6 @@ new_AudioFilePlayer(const FSRef * inFileRef)
? ? return afp;
?}

+#endif
+
?/* vi: set ts=4 sw=4 expandtab: /
diff --git a/src/cdrom/macosx/AudioFileReaderThread.c b/src/cdrom/macosx/AudioFileReaderThread.c
index bc30f4f…0ff66ff 100644
— a/src/cdrom/macosx/AudioFileReaderThread.c
+++ b/src/cdrom/macosx/AudioFileReaderThread.c
@@ -24,6 +24,8 @@
?
/
?#include “SDL_config.h”

+#ifndef _LP64
+
?/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
? ?AudioFileManager.cpp
?*/
@@ -654,4 +656,6 @@ new_AudioFileManager(AudioFilePlayer * inParent,
? ? return afm;
?}

+#endif
+
?/* vi: set ts=4 sw=4 expandtab: /
diff --git a/src/cdrom/macosx/CDPlayer.c b/src/cdrom/macosx/CDPlayer.c
index f4aecdb…52b4b02 100644
— a/src/cdrom/macosx/CDPlayer.c
+++ b/src/cdrom/macosx/CDPlayer.c
@@ -21,6 +21,8 @@
?
/
?#include “SDL_config.h”

+#ifdef SDL_CDROM_MACOSX
+
?#include “CDPlayer.h”
?#include “AudioFilePlayer.h”
?#include “SDLOSXCAGuard.h”
@@ -666,4 +668,7 @@ RunCallBackThread(void *param)
?}

?/*}; // extern “C” /
+
+#endif /
SDL_CDROM_MACOSX /
+
?/
vi: set ts=4 sw=4 expandtab: /
diff --git a/src/cdrom/macosx/SDL_syscdrom.c b/src/cdrom/macosx/SDL_syscdrom.c
index 909a6c4…e2293b0 100644
— a/src/cdrom/macosx/SDL_syscdrom.c
+++ b/src/cdrom/macosx/SDL_syscdrom.c
@@ -21,7 +21,7 @@
?
/
?#include “SDL_config.h”

-#ifdef SDL_CDROM_MACOSX
+#ifndef _LP64

?#include “SDL_syscdrom_c.h”

diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m
index f9b01f3…fb06eca 100644
— a/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/src/video/cocoa/SDL_cocoakeyboard.m
@@ -28,7 +28,6 @@

?#include <Carbon/Carbon.h>

?#ifndef NX_DEVICERCTLKEYMASK
? ? #define NX_DEVICELCTLKEYMASK ? ?0x00000001
?#endif
@@ -351,14 +350,23 @@ HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
?static void
?UpdateKeymap(SDL_VideoData *data)
?{
+#ifdef _LP64

  • ? ?TISInputSourceRef key_layout;
  • ? ?const void *chr_data = NULL;
    +#else
    ? ? KeyboardLayoutRef key_layout;
    ? ? const void *chr_data;
    +#endif
    ? ? int i;
    ? ? SDL_scancode scancode;
    ? ? SDLKey keymap[SDL_NUM_SCANCODES];

? ? /* See if the keymap needs to be updated */
+#ifdef _LP64

  • ? ?key_layout = TISCopyCurrentKeyboardLayoutInputSource();
    +#else
    ? ? KLGetCurrentKeyboardLayout(&key_layout);
    +#endif
    ? ? if (key_layout == data->key_layout) {
    ? ? ? ? return;
    ? ? }
    @@ -367,8 +375,17 @@ UpdateKeymap(SDL_VideoData *data)
    ? ? SDL_GetDefaultKeymap(keymap);

? ? /* Try Unicode data first (preferred as of Mac OS X 10.5) */
+#ifdef _LP64

  • ? ?CFDataRef currentKeyLayoutDataRef = (CFDataRef) TISGetInputSourceProperty (key_layout, kTISPropertyUnicodeKeyLayoutData);
  • ? ?if (currentKeyLayoutDataRef) {
  • ? ? ? ?chr_data = CFDataGetBytePtr (currentKeyLayoutDataRef);
  • ? ?}
  • ? ?if (chr_data) {
    +#else
    ? ? KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data);
    ? ? if (chr_data) {
    +#endif
    ? ? ? ? UInt32 keyboard_type = LMGetKbdType();
    ? ? ? ? OSStatus err;

@@ -400,6 +417,7 @@ UpdateKeymap(SDL_VideoData *data)
? ? ? ? return;
? ? }

+#ifndef _LP64
? ? /* Fall back to older style key map data */
? ? KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
? ? if (chr_data) {
@@ -449,6 +467,7 @@ UpdateKeymap(SDL_VideoData *data)
? ? ? ? SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
? ? ? ? return;
? ? }
+#endif
?}

?void
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index 115abc3…d656be3 100644
— a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -30,6 +30,7 @@
? ? to fullscreen, we’ll set it manually (but only for the
? ? main screen).
?*/
+#ifndef ? ? ? ?_LP64
?@interface NSScreen (NSScreenAccess)
?- (void) setFrame:(NSRect)frame;
?@end
@@ -40,6 +41,7 @@
? ? _frame = frame;
?}
?@end
+#endif

?static void
?CG_SetError(const char *prefix, CGDisplayErr result)
@@ -255,7 +257,9 @@ Cocoa_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
? ? ? ? We can hack around this bug by setting the screen rect
? ? ? ? ourselves. This hack should be removed if/when the bug is fixed.
? ? */
+#ifndef ? ? ? ?_LP64
? ? [[NSScreen mainScreen] setFrame:NSMakeRect(0,0,mode->w,mode->h)];
+#endif

? ? return 0;


1.6.3.1

Hi Steven-

Is there any chance of CD support being added in any time soon? Mac OS
X I believe supports a filesystem which shows tracks of CDs as wav
files, would this be useable?On 13 May 2009, at 22:14, Steven Noonan wrote:

Whoops, accidentally poisoned this patch with adding the
-fno-strict-aliasing flag to the compiler options.

  • Steven

On Wed, May 13, 2009 at 2:13 PM, Steven Noonan wrote:

SDL’s cdrom and SoundManager are not supported on 64-bit Mac OS X
builds.

The input API used in SDL_cocoakeyboard.m was 32-bit only in parts,
because it used 32-bit Carbon instead of Cocoa. This has been
corrected, thanks to Matti Hameister!

Signed-off-by: Matti Hameister <m.hami at 42degreesoffreedom.com>
Signed-off-by: Steven Noonan

Xcode/SDL/SDL.xcodeproj/project.pbxproj | 3 +++
include/SDL_config_macosx.h | 6 ++++++
src/audio/macrom/SDL_romaudio.c | 6 ++++++
src/audio/macrom/SDL_romaudio.h | 6 ++++++
src/cdrom/macosx/AudioFilePlayer.c | 4 ++++
src/cdrom/macosx/AudioFileReaderThread.c | 4 ++++
src/cdrom/macosx/CDPlayer.c | 5 +++++
src/cdrom/macosx/SDL_syscdrom.c | 2 ±
src/video/cocoa/SDL_cocoakeyboard.m | 21 +++++++++++++++++++
±
src/video/cocoa/SDL_cocoamodes.m | 4 ++++
10 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/
SDL.xcodeproj/project.pbxproj
index 74851c5…e4db0f6 100644
— a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -2859,6 +2859,7 @@
MACOSX_DEPLOYMENT_TARGET = “”;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;

  •                           OTHER_CFLAGS = "-fno-strict- 
    

aliasing";
PREBINDING = NO;
SDKROOT = /Developer/SDKs/
MacOSX10.4u.sdk;
SDKROOT_i386 = /Developer/SDKs/
MacOSX10.4u.sdk;
@@ -2886,6 +2887,7 @@
MACOSX_DEPLOYMENT_TARGET = “”;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;

  •                           OTHER_CFLAGS = "-fno-strict- 
    

aliasing";
PREBINDING = NO;
SDKROOT = /Developer/SDKs/
MacOSX10.4u.sdk;
SDKROOT_i386 = /Developer/SDKs/
MacOSX10.4u.sdk;
@@ -2913,6 +2915,7 @@
MACOSX_DEPLOYMENT_TARGET = “”;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;

  •                           OTHER_CFLAGS = "-fno-strict- 
    

aliasing";
PREBINDING = NO;
SDKROOT = /Developer/SDKs/
MacOSX10.4u.sdk;
SDKROOT_i386 = /Developer/SDKs/
MacOSX10.4u.sdk;
diff --git a/include/SDL_config_macosx.h b/include/
SDL_config_macosx.h
index 1a43516…d1180e2 100644
— a/include/SDL_config_macosx.h
+++ b/include/SDL_config_macosx.h
@@ -102,12 +102,18 @@

/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
+#ifndef _LP64
#define SDL_AUDIO_DRIVER_SNDMGR 1
+#endif
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1

/* Enable various cdrom drivers */
+#ifndef _LP64
#define SDL_CDROM_MACOSX 1
+#else
+#define SDL_CDROM_DISABLED 1
+#endif

/* Enable various input drivers */
#define SDL_JOYSTICK_IOKIT 1
diff --git a/src/audio/macrom/SDL_romaudio.c b/src/audio/macrom/
SDL_romaudio.c
index e9aaa5c…dae2413 100644
— a/src/audio/macrom/SDL_romaudio.c
+++ b/src/audio/macrom/SDL_romaudio.c
@@ -19,6 +19,9 @@
Sam Lantinga
slouken at libsdl.org
*/
+
+#ifndef _LP64
+
#include “SDL_config.h”

/* This should work on PowerPC and Intel Mac OS X, and Carbonized
Mac OS 9. */
@@ -316,4 +319,7 @@ AudioBootStrap SNDMGR_bootstrap = {
“sndmgr”, SDL_MACOS_NAME " SoundManager", SNDMGR_Init, 0
};

+#endif
+
/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/audio/macrom/SDL_romaudio.h b/src/audio/macrom/
SDL_romaudio.h
index 8dbbb1d…c955fcd 100644
— a/src/audio/macrom/SDL_romaudio.h
+++ b/src/audio/macrom/SDL_romaudio.h
@@ -19,6 +19,9 @@
Sam Lantinga
slouken at libsdl.org
*/
+
+#ifndef _LP64
+
#include “SDL_config.h”

#ifndef _SDL_romaudio_h
@@ -36,4 +39,7 @@ struct SDL_PrivateAudioData
};

#endif /* _SDL_romaudio_h /
+
+#endif
+
/
vi: set ts=4 sw=4 expandtab: */
diff --git a/src/cdrom/macosx/AudioFilePlayer.c b/src/cdrom/macosx/
AudioFilePlayer.c
index f132b17…6782187 100644
— a/src/cdrom/macosx/AudioFilePlayer.c
+++ b/src/cdrom/macosx/AudioFilePlayer.c
@@ -24,6 +24,8 @@
*/
#include “SDL_config.h”

+#ifndef _LP64
+
/
*~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~

    AudioFilePlayer.cpp
 */
@@ -394,4 +396,6 @@ new_AudioFilePlayer(const FSRef * inFileRef)
    return afp;
 }

+#endif
+
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/cdrom/macosx/AudioFileReaderThread.c b/src/cdrom/ 
macosx/AudioFileReaderThread.c
index bc30f4f..0ff66ff 100644
--- a/src/cdrom/macosx/AudioFileReaderThread.c
+++ b/src/cdrom/macosx/AudioFileReaderThread.c
@@ -24,6 +24,8 @@
 */
 #include "SDL_config.h"

+#ifndef _LP64
+
 / 
*~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 
~ 

AudioFileManager.cpp
*/
@@ -654,4 +656,6 @@ new_AudioFileManager(AudioFilePlayer * inParent,
return afm;
}

+#endif
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/cdrom/macosx/CDPlayer.c b/src/cdrom/macosx/
CDPlayer.c
index f4aecdb…52b4b02 100644
— a/src/cdrom/macosx/CDPlayer.c
+++ b/src/cdrom/macosx/CDPlayer.c
@@ -21,6 +21,8 @@
*/
#include “SDL_config.h”

+#ifdef SDL_CDROM_MACOSX
+
#include “CDPlayer.h”
#include “AudioFilePlayer.h”
#include “SDLOSXCAGuard.h”
@@ -666,4 +668,7 @@ RunCallBackThread(void *param)
}

/*}; // extern “C” /
+
+#endif /
SDL_CDROM_MACOSX /
+
/
vi: set ts=4 sw=4 expandtab: */
diff --git a/src/cdrom/macosx/SDL_syscdrom.c b/src/cdrom/macosx/
SDL_syscdrom.c
index 909a6c4…e2293b0 100644
— a/src/cdrom/macosx/SDL_syscdrom.c
+++ b/src/cdrom/macosx/SDL_syscdrom.c
@@ -21,7 +21,7 @@
*/
#include “SDL_config.h”

-#ifdef SDL_CDROM_MACOSX
+#ifndef _LP64

#include “SDL_syscdrom_c.h”

diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/
SDL_cocoakeyboard.m
index f9b01f3…fb06eca 100644
— a/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/src/video/cocoa/SDL_cocoakeyboard.m
@@ -28,7 +28,6 @@

#include <Carbon/Carbon.h>

#ifndef NX_DEVICERCTLKEYMASK
#define NX_DEVICELCTLKEYMASK 0x00000001
#endif
@@ -351,14 +350,23 @@ HandleModifiers(_THIS, unsigned short
scancode, unsigned int modifierFlags)
static void
UpdateKeymap(SDL_VideoData *data)
{
+#ifdef _LP64

  • TISInputSourceRef key_layout;
  • const void *chr_data = NULL;
    +#else
    KeyboardLayoutRef key_layout;
    const void *chr_data;
    +#endif
    int i;
    SDL_scancode scancode;
    SDLKey keymap[SDL_NUM_SCANCODES];
/* See if the keymap needs to be updated */

+#ifdef _LP64

  • key_layout = TISCopyCurrentKeyboardLayoutInputSource();
    +#else
    KLGetCurrentKeyboardLayout(&key_layout);
    +#endif
    if (key_layout == data->key_layout) {
    return;
    }
    @@ -367,8 +375,17 @@ UpdateKeymap(SDL_VideoData *data)
    SDL_GetDefaultKeymap(keymap);
/* Try Unicode data first (preferred as of Mac OS X 10.5) */

+#ifdef _LP64

  • CFDataRef currentKeyLayoutDataRef = (CFDataRef)
    TISGetInputSourceProperty (key_layout,
    kTISPropertyUnicodeKeyLayoutData);
  • if (currentKeyLayoutDataRef) {
  •    chr_data = CFDataGetBytePtr (currentKeyLayoutDataRef);
    
  • }
  • if (chr_data) {
    +#else
    KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data);
    if (chr_data) {
    +#endif
    UInt32 keyboard_type = LMGetKbdType();
    OSStatus err;

@@ -400,6 +417,7 @@ UpdateKeymap(SDL_VideoData *data)
return;
}

+#ifndef _LP64
/* Fall back to older style key map data */
KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
if (chr_data) {
@@ -449,6 +467,7 @@ UpdateKeymap(SDL_VideoData *data)
SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
return;
}
+#endif
}

void
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/
SDL_cocoamodes.m
index 115abc3…d656be3 100644
— a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -30,6 +30,7 @@
to fullscreen, we’ll set it manually (but only for the
main screen).
*/
+#ifndef _LP64
@interface NSScreen (NSScreenAccess)

  • (void) setFrame:(NSRect)frame;
    @end
    @@ -40,6 +41,7 @@
    _frame = frame;
    }
    @end
    +#endif

static void
CG_SetError(const char *prefix, CGDisplayErr result)
@@ -255,7 +257,9 @@ Cocoa_SetDisplayMode(_THIS, SDL_DisplayMode *
mode)
We can hack around this bug by setting the screen rect
ourselves. This hack should be removed if/when the bug is
fixed.
*/
+#ifndef _LP64
[[NSScreen mainScreen] setFrame:NSMakeRect(0,0,mode->w,mode->h)];
+#endif

return 0;


1.6.3.1


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3912 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090514/a0dba62e/attachment.bin

Hi Alastair,

It’s not something I’ll do. This patch is just to make 64-bit builds
possible, retaining most functionality.

  • StevenOn Wed, May 13, 2009 at 4:19 PM, Alastair Lynn wrote:

Hi Steven-

Is there any chance of CD support being added in any time soon? Mac OS X I
believe supports a filesystem which shows tracks of CDs as wav files, would
this be useable?

On 13 May 2009, at 22:14, Steven Noonan wrote:

Whoops, accidentally poisoned this patch with adding the
-fno-strict-aliasing flag to the compiler options.

  • Steven

On Wed, May 13, 2009 at 2:13 PM, Steven Noonan <@Steven_Noonan> wrote:

SDL’s cdrom and SoundManager are not supported on 64-bit Mac OS X builds.

The input API used in SDL_cocoakeyboard.m was 32-bit only in parts,
because it used 32-bit Carbon instead of Cocoa. This has been
corrected, thanks to Matti Hameister!

Signed-off-by: Matti Hameister <m.hami at 42degreesoffreedom.com>
Signed-off-by: Steven Noonan <@Steven_Noonan>

?Xcode/SDL/SDL.xcodeproj/project.pbxproj ?| ? ?3 +++
?include/SDL_config_macosx.h ? ? ? ? ? ? ?| ? ?6 ++++++
?src/audio/macrom/SDL_romaudio.c ? ? ? ? ?| ? ?6 ++++++
?src/audio/macrom/SDL_romaudio.h ? ? ? ? ?| ? ?6 ++++++
?src/cdrom/macosx/AudioFilePlayer.c ? ? ? | ? ?4 ++++
?src/cdrom/macosx/AudioFileReaderThread.c | ? ?4 ++++
?src/cdrom/macosx/CDPlayer.c ? ? ? ? ? ? ?| ? ?5 +++++
?src/cdrom/macosx/SDL_syscdrom.c ? ? ? ? ?| ? ?2 ±
?src/video/cocoa/SDL_cocoakeyboard.m ? ? ?| ? 21 +++++++++++++++++++±
?src/video/cocoa/SDL_cocoamodes.m ? ? ? ? | ? ?4 ++++
?10 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index 74851c5…e4db0f6 100644
— a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -2859,6 +2859,7 @@
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET = “”;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;

  • ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OTHER_CFLAGS = “-fno-strict-aliasing”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PREBINDING = NO;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SDKROOT_i386 =
    /Developer/SDKs/MacOSX10.4u.sdk;
    @@ -2886,6 +2887,7 @@
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET = “”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
  • ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OTHER_CFLAGS = “-fno-strict-aliasing”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PREBINDING = NO;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SDKROOT_i386 =
    /Developer/SDKs/MacOSX10.4u.sdk;
    @@ -2913,6 +2915,7 @@
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET = “”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
  • ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OTHER_CFLAGS = “-fno-strict-aliasing”;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PREBINDING = NO;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SDKROOT_i386 =
    /Developer/SDKs/MacOSX10.4u.sdk;
    diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h
    index 1a43516…d1180e2 100644
    — a/include/SDL_config_macosx.h
    +++ b/include/SDL_config_macosx.h
    @@ -102,12 +102,18 @@

?/* Enable various audio drivers */
?#define SDL_AUDIO_DRIVER_COREAUDIO ? ? 1
+#ifndef _LP64
?#define SDL_AUDIO_DRIVER_SNDMGR ? ? ? ?1
+#endif
?#define SDL_AUDIO_DRIVER_DISK ?1
?#define SDL_AUDIO_DRIVER_DUMMY 1

?/* Enable various cdrom drivers */
+#ifndef _LP64
?#define SDL_CDROM_MACOSX ? ? ? 1
+#else
+#define SDL_CDROM_DISABLED ? ? 1
+#endif

?/* Enable various input drivers /
?#define SDL_JOYSTICK_IOKIT ? ? 1
diff --git a/src/audio/macrom/SDL_romaudio.c
b/src/audio/macrom/SDL_romaudio.c
index e9aaa5c…dae2413 100644
— a/src/audio/macrom/SDL_romaudio.c
+++ b/src/audio/macrom/SDL_romaudio.c
@@ -19,6 +19,9 @@
? ?Sam Lantinga
? ?slouken at libsdl.org
?
/
+
+#ifndef _LP64
+
?#include “SDL_config.h”

?/* This should work on PowerPC and Intel Mac OS X, and Carbonized Mac OS
9. */
@@ -316,4 +319,7 @@ AudioBootStrap SNDMGR_bootstrap = {
? ?“sndmgr”, SDL_MACOS_NAME " SoundManager", SNDMGR_Init, 0
?};

+#endif
+
?/* vi: set ts=4 sw=4 expandtab: /
+
diff --git a/src/audio/macrom/SDL_romaudio.h
b/src/audio/macrom/SDL_romaudio.h
index 8dbbb1d…c955fcd 100644
— a/src/audio/macrom/SDL_romaudio.h
+++ b/src/audio/macrom/SDL_romaudio.h
@@ -19,6 +19,9 @@
? ?Sam Lantinga
? ?slouken at libsdl.org
?
/
+
+#ifndef ? ? ? ?_LP64
+
?#include “SDL_config.h”

?#ifndef _SDL_romaudio_h
@@ -36,4 +39,7 @@ struct SDL_PrivateAudioData
?};

?#endif /* _SDL_romaudio_h /
+
+#endif
+
?/
vi: set ts=4 sw=4 expandtab: /
diff --git a/src/cdrom/macosx/AudioFilePlayer.c
b/src/cdrom/macosx/AudioFilePlayer.c
index f132b17…6782187 100644
— a/src/cdrom/macosx/AudioFilePlayer.c
+++ b/src/cdrom/macosx/AudioFilePlayer.c
@@ -24,6 +24,8 @@
?
/
?#include “SDL_config.h”

+#ifndef _LP64
+

?/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
? ?AudioFilePlayer.cpp
?*/
@@ -394,4 +396,6 @@ new_AudioFilePlayer(const FSRef * inFileRef)
? ?return afp;
?}

+#endif
+
?/* vi: set ts=4 sw=4 expandtab: /
diff --git a/src/cdrom/macosx/AudioFileReaderThread.c
b/src/cdrom/macosx/AudioFileReaderThread.c
index bc30f4f…0ff66ff 100644
— a/src/cdrom/macosx/AudioFileReaderThread.c
+++ b/src/cdrom/macosx/AudioFileReaderThread.c
@@ -24,6 +24,8 @@
?
/
?#include “SDL_config.h”

+#ifndef _LP64
+

?/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
? AudioFileManager.cpp
?*/
@@ -654,4 +656,6 @@ new_AudioFileManager(AudioFilePlayer * inParent,
? ?return afm;
?}

+#endif
+
?/* vi: set ts=4 sw=4 expandtab: /
diff --git a/src/cdrom/macosx/CDPlayer.c b/src/cdrom/macosx/CDPlayer.c
index f4aecdb…52b4b02 100644
— a/src/cdrom/macosx/CDPlayer.c
+++ b/src/cdrom/macosx/CDPlayer.c
@@ -21,6 +21,8 @@
?
/
?#include “SDL_config.h”

+#ifdef SDL_CDROM_MACOSX
+
?#include “CDPlayer.h”
?#include “AudioFilePlayer.h”
?#include “SDLOSXCAGuard.h”
@@ -666,4 +668,7 @@ RunCallBackThread(void *param)
?}

?/*}; // extern “C” /
+
+#endif /
SDL_CDROM_MACOSX /
+
?/
vi: set ts=4 sw=4 expandtab: /
diff --git a/src/cdrom/macosx/SDL_syscdrom.c
b/src/cdrom/macosx/SDL_syscdrom.c
index 909a6c4…e2293b0 100644
— a/src/cdrom/macosx/SDL_syscdrom.c
+++ b/src/cdrom/macosx/SDL_syscdrom.c
@@ -21,7 +21,7 @@
?
/
?#include “SDL_config.h”

-#ifdef SDL_CDROM_MACOSX
+#ifndef _LP64

?#include “SDL_syscdrom_c.h”

diff --git a/src/video/cocoa/SDL_cocoakeyboard.m
b/src/video/cocoa/SDL_cocoakeyboard.m
index f9b01f3…fb06eca 100644
— a/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/src/video/cocoa/SDL_cocoakeyboard.m
@@ -28,7 +28,6 @@

?#include <Carbon/Carbon.h>

?#ifndef NX_DEVICERCTLKEYMASK
? ?#define NX_DEVICELCTLKEYMASK ? ?0x00000001
?#endif
@@ -351,14 +350,23 @@ HandleModifiers(_THIS, unsigned short scancode,
unsigned int modifierFlags)
?static void
?UpdateKeymap(SDL_VideoData *data)
?{
+#ifdef _LP64

  • ? ?TISInputSourceRef key_layout;
  • ? ?const void *chr_data = NULL;
    +#else
    ? ?KeyboardLayoutRef key_layout;
    ? ?const void *chr_data;
    +#endif
    ? ?int i;
    ? ?SDL_scancode scancode;
    ? ?SDLKey keymap[SDL_NUM_SCANCODES];

? ?/* See if the keymap needs to be updated */
+#ifdef _LP64

  • ? ?key_layout = TISCopyCurrentKeyboardLayoutInputSource();
    +#else
    ? ?KLGetCurrentKeyboardLayout(&key_layout);
    +#endif
    ? ?if (key_layout == data->key_layout) {
    ? ? ? ?return;
    ? ?}
    @@ -367,8 +375,17 @@ UpdateKeymap(SDL_VideoData *data)
    ? ?SDL_GetDefaultKeymap(keymap);

? ?/* Try Unicode data first (preferred as of Mac OS X 10.5) */
+#ifdef _LP64

  • ? ?CFDataRef currentKeyLayoutDataRef = (CFDataRef)
    TISGetInputSourceProperty (key_layout, kTISPropertyUnicodeKeyLayoutData);
  • ? ?if (currentKeyLayoutDataRef) {
  • ? ? ? ?chr_data = CFDataGetBytePtr (currentKeyLayoutDataRef);
  • ? ?}
  • ? ?if (chr_data) {
    +#else
    ? ?KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data);
    ? ?if (chr_data) {
    +#endif
    ? ? ? ?UInt32 keyboard_type = LMGetKbdType();
    ? ? ? ?OSStatus err;

@@ -400,6 +417,7 @@ UpdateKeymap(SDL_VideoData *data)
? ? ? ?return;
? ?}

+#ifndef _LP64
? ?/* Fall back to older style key map data */
? ?KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
? ?if (chr_data) {
@@ -449,6 +467,7 @@ UpdateKeymap(SDL_VideoData *data)
? ? ? ?SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
? ? ? ?return;
? ?}
+#endif
?}

?void
diff --git a/src/video/cocoa/SDL_cocoamodes.m
b/src/video/cocoa/SDL_cocoamodes.m
index 115abc3…d656be3 100644
— a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -30,6 +30,7 @@
? ?to fullscreen, we’ll set it manually (but only for the
? ?main screen).
?*/
+#ifndef ? ? ? ?_LP64
?@interface NSScreen (NSScreenAccess)
?- (void) setFrame:(NSRect)frame;
?@end
@@ -40,6 +41,7 @@
? ?_frame = frame;
?}
?@end
+#endif

?static void
?CG_SetError(const char prefix, CGDisplayErr result)
@@ -255,7 +257,9 @@ Cocoa_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
? ? ? ?We can hack around this bug by setting the screen rect
? ? ? ?ourselves. This hack should be removed if/when the bug is fixed.
? ?
/
+#ifndef ? ? ? ?_LP64
? ?[[NSScreen mainScreen] setFrame:NSMakeRect(0,0,mode->w,mode->h)];
+#endif

? ?return 0;


1.6.3.1


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Is there any chance of CD support being added in any time soon? Mac OS X I
believe supports a filesystem which shows tracks of CDs as wav files, would
this be useable?

The future of CD support doesn’t look too good:

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2008-October/066914.html

I’m not quite sure what Ryan means by “having drop-in code”, though.On Wed, May 13, 2009 at 7:19 PM, Alastair Lynn wrote:


http://pphaneuf.livejournal.com/