OS X 64bit SDL 1.3 Patch please check

Hello. I’m new to such mailing lists and SDL development, so sorry
when I break some rules.

My exports to compile the code with my patch are:
export CFLAGS=’-m64 -arch x86_64 -mmacosx-version-min=10.5’; export
LDFLAGS=$CFLAGS; export CXXFLAGS=$CFLAGS;

The configure call is
./configure --disable-video-carbon --enable-video-cocoa --disable-
assembly --disable-cdrom --enable-coreaudio

After this, you must change the line
#define SDL_AUDIO_DRIVER_SNDMGR
to
/*#define SDL_AUDIO_DRIVER_SNDMGR */
in include/SDL_config.h
(Sorry, my knowledge about autotools are quite small, so there is no
patch for this)

It works fine:—
file libSDL.dylib
libSDL.dylib: Mach-O 64-bit dynamically linked shared library x86_64

Here is the patch (based on Revision: 4509)
#########################from
here#######################################
diff -crB SDL32/src/audio/macrom/SDL_romaudio.c SDL/src/audio/macrom/
SDL_romaudio.c
*** SDL32/src/audio/macrom/SDL_romaudio.c 2009-05-09
18:16:02.000000000 +0200
— SDL/src/audio/macrom/SDL_romaudio.c 2009-05-09 18:13:51.000000000
+0200


*** 19,24 ****
— 19,25 ----
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. */


*** 317,319 ****
— 318,321 ----
};

/* vi: set ts=4 sw=4 expandtab: */

  • #endif
    \ No newline at end of file
    diff -crB SDL32/src/audio/macrom/SDL_romaudio.h SDL/src/audio/macrom/
    SDL_romaudio.h
    *** SDL32/src/audio/macrom/SDL_romaudio.h 2009-05-09
    18:16:02.000000000 +0200
    — SDL/src/audio/macrom/SDL_romaudio.h 2009-05-09 18:13:37.000000000
    +0200

*** 19,24 ****
— 19,25 ----
Sam Lantinga
slouken at libsdl.org
*/

  • #ifndef LP64
    #include “SDL_config.h”

    #ifndef _SDL_romaudio_h


*** 37,39 ****
— 38,41 ----

#endif /* _SDL_romaudio_h /
/
vi: set ts=4 sw=4 expandtab: */

  • #endif
    \ No newline at end of file
    Only in SDL/src/video: .DS_Store
    diff -crB SDL32/src/video/cocoa/SDL_cocoakeyboard.m SDL/src/video/
    cocoa/SDL_cocoakeyboard.m
    *** SDL32/src/video/cocoa/SDL_cocoakeyboard.m 2009-05-09
    18:16:08.000000000 +0200
    — SDL/src/video/cocoa/SDL_cocoakeyboard.m 2009-05-09
    17:59:20.000000000 +0200

*** 351,389 ****
static void
UpdateKeymap(SDL_VideoData *data)
{
! KeyboardLayoutRef key_layout;
! const void chr_data;
int i;
SDL_scancode scancode;
SDLKey keymap[SDL_NUM_SCANCODES];
!
/
See if the keymap needs to be updated /
! KLGetCurrentKeyboardLayout(&key_layout);
if (key_layout == data->key_layout) {
return;
}
data->key_layout = key_layout;
!
SDL_GetDefaultKeymap(keymap);
!
/
Try Unicode data first (preferred as of Mac OS X 10.5) /
! KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data);
! if (chr_data) {
UInt32 keyboard_type = LMGetKbdType();
OSStatus err;
!
for (i = 0; i < SDL_arraysize(darwin_scancode_table); i++) {
UniChar s[8];
UniCharCount len;
UInt32 dead_key_state;
!
/
Make sure this scancode is a valid character
scancode */
scancode = darwin_scancode_table[i];
if (scancode == SDL_SCANCODE_UNKNOWN ||
(keymap[scancode] & SDLK_SCANCODE_MASK)) {
continue;
}
!
dead_key_state = 0;
err = UCKeyTranslate (chr_data, i, kUCKeyActionDown,
0, keyboard_type,
— 351,393 ----
static void
UpdateKeymap(SDL_VideoData *data)
{
! TISInputSourceRef key_layout;
! const void chr_data = NULL;
int i;
SDL_scancode scancode;
SDLKey keymap[SDL_NUM_SCANCODES];
!
/
See if the keymap needs to be updated /
! key_layout = TISCopyCurrentKeyboardLayoutInputSource();
if (key_layout == data->key_layout) {
return;
}
data->key_layout = key_layout;
!
SDL_GetDefaultKeymap(keymap);
!
/
Try Unicode data first (preferred as of Mac OS X 10.5) /
! CFDataRef currentKeyLayoutDataRef = (CFDataRef)
TISGetInputSourceProperty (key_layout,
kTISPropertyUnicodeKeyLayoutData);
! if (currentKeyLayoutDataRef) {
! chr_data = CFDataGetBytePtr (currentKeyLayoutDataRef);
! }
!
! if (chr_data) {
UInt32 keyboard_type = LMGetKbdType();
OSStatus err;
!
for (i = 0; i < SDL_arraysize(darwin_scancode_table); i++) {
UniChar s[8];
UniCharCount len;
UInt32 dead_key_state;
!
/
Make sure this scancode is a valid character
scancode */
scancode = darwin_scancode_table[i];
if (scancode == SDL_SCANCODE_UNKNOWN ||
(keymap[scancode] & SDLK_SCANCODE_MASK)) {
continue;
}
!
dead_key_state = 0;
err = UCKeyTranslate (chr_data, i, kUCKeyActionDown,
0, keyboard_type,


*** 391,397 ****
&dead_key_state, 8, &len, s);
if (err != noErr)
continue;
!
if (len > 0 && s[0] != 0x10) {
keymap[scancode] = s[0];
}
— 395,401 ----
&dead_key_state, 8, &len, s);
if (err != noErr)
continue;
!
if (len > 0 && s[0] != 0x10) {
keymap[scancode] = s[0];
}


*** 399,424 ****
SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
return;
}
!
/* Fall back to older style key map data /
KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
if (chr_data) {
for (i = 0; i < 128; i++) {
UInt32 c, state = 0;
!
/
Make sure this scancode is a valid character
scancode /
scancode = darwin_scancode_table[i];
if (scancode == SDL_SCANCODE_UNKNOWN ||
(keymap[scancode] & SDLK_SCANCODE_MASK)) {
continue;
}
!
c = KeyTranslate (chr_data, i, &state) & 255;
if (state) {
/
Dead key, process key up /
c = KeyTranslate (chr_data, i | 128, &state) & 255;
}
!
if (c != 0 && c != 0x10) {
/
MacRoman to Unicode table, taken from X.org
sources /
static const unsigned short macroman_table[128] = {
— 403,429 ----
SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
return;
}
!
! #ifndef LP64
/
Fall back to older style key map data /
KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
if (chr_data) {
for (i = 0; i < 128; i++) {
UInt32 c, state = 0;
!
/
Make sure this scancode is a valid character
scancode /
scancode = darwin_scancode_table[i];
if (scancode == SDL_SCANCODE_UNKNOWN ||
(keymap[scancode] & SDLK_SCANCODE_MASK)) {
continue;
}
!
c = KeyTranslate (chr_data, i, &state) & 255;
if (state) {
/
Dead key, process key up /
c = KeyTranslate (chr_data, i | 128, &state) & 255;
}
!
if (c != 0 && c != 0x10) {
/
MacRoman to Unicode table, taken from X.org
sources */
static const unsigned short macroman_table[128] = {


*** 439,445 ****
0xf8ff, 0xd2, 0xda, 0xdb, 0xd9, 0x131, 0x2c6,
0x2dc,
0xaf, 0x2d8, 0x2d9, 0x2da, 0xb8, 0x2dd, 0x2db,
0x2c7,
};
!
if (c >= 128) {
c = macroman_table[c - 128];
}
— 444,450 ----
0xf8ff, 0xd2, 0xda, 0xdb, 0xd9, 0x131, 0x2c6,
0x2dc,
0xaf, 0x2d8, 0x2d9, 0x2da, 0xb8, 0x2dd, 0x2db,
0x2c7,
};
!
if (c >= 128) {
c = macroman_table[c - 128];
}


*** 449,454 ****
— 454,460 ----
SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
return;
}

  • #endif
    }

    void
    diff -crB SDL32/src/video/cocoa/SDL_cocoamodes.m SDL/src/video/cocoa/
    SDL_cocoamodes.m
    *** SDL32/src/video/cocoa/SDL_cocoamodes.m 2009-05-09
    18:16:08.000000000 +0200
    — SDL/src/video/cocoa/SDL_cocoamodes.m 2009-05-09 18:03:11.000000000
    +0200


*** 30,35 ****
— 30,36 ----
to fullscreen, we’ll set it manually (but only for the
main screen).
*/

  • #ifndef LP64
    @interface NSScreen (NSScreenAccess)
    • (void) setFrame:(NSRect)frame;
      @end

*** 40,45 ****
— 41,47 ----
_frame = frame;
}
@end

  • #endif

    static void
    CG_SetError(const char *prefix, CGDisplayErr result)


*** 255,262 ****
We can hack around this bug by setting the screen rect
ourselves. This hack should be removed if/when the bug is
fixed.
*/
[[NSScreen mainScreen] setFrame:NSMakeRect(0,0,mode->w,mode->h)];
!
return 0;

   /* Since the blanking window covers *all* windows (even force  

quit) correct recovery is crucial */
— 257,265 ----
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;

     /* Since the blanking window covers *all* windows (even force  
    

quit) correct recovery is crucial */

##################to here###########################

-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL64.patch
Type: application/octet-stream
Size: 9103 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090510/32fbded0/attachment.obj
-------------- next part --------------