New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #20235: macports-libsdl-1.2.13-10.6.patch

File macports-libsdl-1.2.13-10.6.patch, 60.7 KB (added by kenny@…, 3 years ago)

Patch that contains backport of enough of 1.2.14 to compile in 64-bit

  • release/ports/devel/libsdl/Portfile

    diff -urN release/ports/devel/libsdl/Portfile release/ports/devel/libsdl/Portfile
     
    3333    port:xorg-libXrandr \ 
    3434    port:xrender 
    3535 
    36 patchfiles      patch-SDL_x11gl_c.h.diff 
     36patchfiles      patch-SDL_x11gl_c.h.diff \ 
     37                patch-SDL_snow_leopard.diff \ 
     38                patch-SDL_1.2.13_14_backport.diff 
    3739 
    3840configure.args  --enable-shared \ 
     41                --disable-nasm \ 
    3942                --mandir=${prefix}/share/man \ 
    4043                --x-include=${prefix}/include \ 
    4144                --x-lib=${prefix}/lib 
     
    100103    } 
    101104} 
    102105 
    103 platform darwin 10 { 
    104         # This doesn't build correctly against the 10.6 SDK due to using deprecated (10.5) and removed (10.6) API 
    105         macosx_deployment_target 10.5 
    106         configure.cppflags-append -isysroot /Developer/SDKs/MacOSX10.5.sdk 
    107         configure.cflags-append -isysroot /Developer/SDKs/MacOSX10.5.sdk 
    108 } 
    109  
    110106livecheck.type  regex 
    111107livecheck.url   ${homepage}download.php 
    112108livecheck.regex ${my_name}-(\\d+(?:\\.\\d+)*) 
  • release/ports/devel/libsdl/files/patch-SDL_snow_leopard.diff

    diff -urN release/ports/devel/libsdl/files/patch-SDL_snow_leopard.diff release/ports/devel/libsdl/files/patch-SDL_snow_leopard.diff
     
     1Index: src/cdrom/macosx/CDPlayer.h 
     2=================================================================== 
     3--- src/cdrom/macosx/CDPlayer.h (revision 4718) 
     4+++ src/cdrom/macosx/CDPlayer.h (working copy) 
     5@@ -34,6 +34,10 @@ 
     6 #include "SDL_thread.h" 
     7 #include "SDL_mutex.h" 
     8  
     9+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050 
     10+typedef SInt16 FSIORefNum; 
     11+#endif 
     12+ 
     13 #ifdef __cplusplus 
     14 extern "C" { 
     15 #endif 
     16Index: src/video/quartz/SDL_QuartzVideo.h 
     17=================================================================== 
     18--- src/video/quartz/SDL_QuartzVideo.h  (revision 4718) 
     19+++ src/video/quartz/SDL_QuartzVideo.h  (working copy) 
     20@@ -93,7 +93,8 @@ 
     21     Uint32             warp_flag;          /* boolean; notify to event loop that a warp just occured */ 
     22     Uint32             warp_ticks;         /* timestamp when the warp occured */ 
     23     NSWindow           *window;            /* Cocoa window to implement the SDL window */ 
     24-    NSQuickDrawView    *view;              /* the window's view; draw 2D and OpenGL into this view */ 
     25+    NSView             *view;              /* the window's view; draw 2D and OpenGL into this view */ 
     26+    CGContextRef       cg_context;         /* CoreGraphics rendering context */ 
     27     SDL_Surface        *resize_icon;       /* icon for the resize badge, we have to draw it by hand */ 
     28     SDL_GrabMode       current_grab_mode;  /* default value is SDL_GRAB_OFF */ 
     29     SDL_Rect           **client_mode_list; /* resolution list to pass back to client */ 
     30@@ -113,7 +114,8 @@ 
     31     Uint8              *current_buffer;    /* the buffer being copied to the screen */ 
     32     BOOL               quit_thread;        /* used to quit the async blitting thread */ 
     33     SInt32             system_version;     /* used to dis-/enable workarounds depending on the system version */ 
     34-     
     35+ 
     36+#if SDL_LEGACY_QUICKDRAW 
     37     ImageDescriptionHandle yuv_idh; 
     38     MatrixRecordPtr        yuv_matrix; 
     39     DecompressorComponent  yuv_codec; 
     40@@ -121,6 +123,7 @@ 
     41     PlanarPixmapInfoYUV420 *yuv_pixmap; 
     42     Sint16                  yuv_width, yuv_height; 
     43     CGrafPtr                yuv_port; 
     44+#endif 
     45  
     46     void *opengl_library;    /* dynamically loaded OpenGL library. */ 
     47 } SDL_PrivateVideoData; 
     48@@ -139,6 +142,7 @@ 
     49 #define mode_flags (this->hidden->flags) 
     50 #define qz_window (this->hidden->window) 
     51 #define window_view (this->hidden->view) 
     52+#define cg_context (this->hidden->cg_context) 
     53 #define video_set (this->hidden->video_set) 
     54 #define warp_ticks (this->hidden->warp_ticks) 
     55 #define warp_flag (this->hidden->warp_flag) 
     56@@ -156,6 +160,7 @@ 
     57 #define cursor_should_be_visible (this->hidden->cursor_should_be_visible) 
     58 #define cursor_visible (this->hidden->cursor_visible) 
     59 #define sw_buffers (this->hidden->sw_buffers) 
     60+#define sw_contexts (this->hidden->sw_contexts) 
     61 #define thread (this->hidden->thread) 
     62 #define sem1 (this->hidden->sem1) 
     63 #define sem2 (this->hidden->sem2) 
     64Index: src/video/quartz/SDL_QuartzGL.m 
     65=================================================================== 
     66--- src/video/quartz/SDL_QuartzGL.m     (revision 4718) 
     67+++ src/video/quartz/SDL_QuartzGL.m     (working copy) 
     68@@ -45,7 +45,8 @@ 
     69 @implementation NSOpenGLContext (CGLContextAccess) 
     70 - (CGLContextObj) cglContext; 
     71 { 
     72-    return _contextAuxiliary; 
     73+return NULL;  // !!! FIXME 
     74+    //return _contextAuxiliary; 
     75 } 
     76 @end 
     77  
     78Index: src/video/quartz/SDL_QuartzWindow.h 
     79=================================================================== 
     80--- src/video/quartz/SDL_QuartzWindow.h (revision 4718) 
     81+++ src/video/quartz/SDL_QuartzWindow.h (working copy) 
     82@@ -21,6 +21,10 @@ 
     83 */ 
     84 #include "SDL_config.h" 
     85  
     86+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050 
     87+typedef unsigned int NSUInteger; 
     88+#endif 
     89+ 
     90 /* Subclass of NSWindow to fix genie effect and support resize events  */ 
     91 @interface SDL_QuartzWindow : NSWindow 
     92 - (void)miniaturize:(id)sender; 
     93@@ -29,7 +33,7 @@ 
     94 - (void)appDidHide:(NSNotification*)note; 
     95 - (void)appWillUnhide:(NSNotification*)note; 
     96 - (void)appDidUnhide:(NSNotification*)note; 
     97-- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag; 
     98+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag; 
     99 @end 
     100  
     101 /* Delegate for our NSWindow to send SDLQuit() on close */ 
     102Index: src/video/quartz/SDL_QuartzWM.m 
     103=================================================================== 
     104--- src/video/quartz/SDL_QuartzWM.m     (revision 4718) 
     105+++ src/video/quartz/SDL_QuartzWM.m     (working copy) 
     106@@ -171,11 +171,7 @@ 
     107     else { 
     108         
     109         *p = [ window_view convertPoint:*p toView: nil ]; 
     110-         
     111-        /* We need a workaround in OpenGL mode */ 
     112-        if ( SDL_VideoSurface->flags & SDL_OPENGL ) { 
     113-            p->y = [window_view frame].size.height - p->y; 
     114-        } 
     115+        p->y = [window_view frame].size.height - p->y; 
     116     } 
     117 } 
     118  
     119@@ -189,11 +185,7 @@ 
     120     else { 
     121  
     122         *p = [ window_view convertPoint:*p fromView: nil ]; 
     123-         
     124-        /* We need a workaround in OpenGL mode */ 
     125-        if ( SDL_VideoSurface != NULL && (SDL_VideoSurface->flags & SDL_OPENGL) ) { 
     126-            p->y = [window_view frame].size.height - p->y; 
     127-        } 
     128+        p->y = [window_view frame].size.height - p->y; 
     129     } 
     130 } 
     131  
     132Index: src/video/quartz/SDL_QuartzYUV.m 
     133=================================================================== 
     134--- src/video/quartz/SDL_QuartzYUV.m    (revision 4718) 
     135+++ src/video/quartz/SDL_QuartzYUV.m    (working copy) 
     136@@ -48,10 +48,15 @@ 
     137 } 
     138  
     139 static int QZ_DisplayYUV (_THIS, SDL_Overlay *overlay, SDL_Rect *src, SDL_Rect *dst) { 
     140- 
     141+#if SDL_LEGACY_QUICKDRAW 
     142     OSErr err; 
     143     CodecFlags flags; 
     144+    int h; 
     145+    char *p_dst, *p_src; 
     146+    PixMapHandle           hPixMap; 
     147+    long                   theRowBytes; 
     148  
     149+ 
     150     if (dst->x != 0 || dst->y != 0) { 
     151  
     152         SDL_SetError ("Need a dst at (0,0)"); 
     153@@ -81,27 +86,40 @@ 
     154                                          codecFlagUseImageBuffer, &flags, nil ) != noErr ) ) 
     155     { 
     156         SDL_SetError ("DecompressSequenceFrameS failed"); 
     157+        return TRUE; 
     158     } 
     159  
     160-    return err != noErr; 
     161+    /* TODO: use CGContextDrawImage here too!  Create two CGContextRefs the same way we 
     162+       create two buffers, replace current_buffer with current_context and set it 
     163+       appropriately in QZ_FlipDoubleBuffer.  Use CTM instead of the above 
     164+       SetIdentityMatrix thing.  */ 
     165+    hPixMap     = GetGWorldPixMap(yuv_port); 
     166+    p_src       = GetPixBaseAddr(hPixMap); 
     167+    theRowBytes = QTGetPixMapHandleRowBytes(hPixMap); 
     168+    p_dst       = SDL_VideoSurface->pixels + SDL_VideoSurface->offset; 
     169+    for (h = dst->h; h--; ) { 
     170+        SDL_memcpy (p_dst, p_src, dst->w * 4); 
     171+        p_src += theRowBytes; 
     172+        p_dst += SDL_VideoSurface->pitch; 
     173+    } 
     174+    SDL_Flip (SDL_VideoSurface); 
     175+#endif 
     176+    return FALSE; 
     177 } 
     178  
     179 static void QZ_FreeHWYUV (_THIS, SDL_Overlay *overlay) { 
     180- 
     181+#if SDL_LEGACY_QUICKDRAW 
     182     CDSequenceEnd (yuv_seq); 
     183     ExitMovies(); 
     184+    DisposeGWorld(yuv_port); 
     185  
     186     SDL_free (overlay->hwfuncs); 
     187     SDL_free (overlay->pitches); 
     188     SDL_free (overlay->pixels); 
     189  
     190-    if (SDL_VideoSurface->flags & SDL_FULLSCREEN) { 
     191-        [ qz_window close ]; 
     192-        qz_window = nil; 
     193-    } 
     194- 
     195     SDL_free (yuv_matrix); 
     196     DisposeHandle ((Handle)yuv_idh); 
     197+#endif 
     198 } 
     199  
     200 /* check for 16 byte alignment, bail otherwise */ 
     201@@ -112,11 +130,12 @@ 
     202  
     203 SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height, 
     204                                          Uint32 format, SDL_Surface *display) { 
     205- 
     206+    SDL_Overlay *overlay = NULL; 
     207+#if SDL_LEGACY_QUICKDRAW 
     208     Uint32 codec; 
     209     OSStatus err; 
     210     CGrafPtr port; 
     211-    SDL_Overlay *overlay; 
     212+    Rect  theBounds = {0, 0}; 
     213  
     214     if (format == SDL_YV12_OVERLAY || 
     215         format == SDL_IYUV_OVERLAY) { 
     216@@ -150,50 +169,21 @@ 
     217         SDL_SetError ("Could not find QuickTime codec for format"); 
     218         return NULL; 
     219     } 
     220- 
     221-    if (SDL_VideoSurface->flags & SDL_FULLSCREEN) { 
     222- 
     223-        /* 
     224-          Acceleration requires a window to be present. 
     225-          A CGrafPtr that points to the screen isn't good enough 
     226-        */ 
     227-        NSRect content = NSMakeRect (0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h); 
     228- 
     229-        qz_window = [ [ SDL_QuartzWindow alloc ] 
     230-                            initWithContentRect:content 
     231-                            styleMask:NSBorderlessWindowMask 
     232-                            backing:NSBackingStoreBuffered defer:NO ]; 
     233- 
     234-        if (qz_window == nil) { 
     235-            SDL_SetError ("Could not create the Cocoa window"); 
     236-            return NULL; 
     237-        } 
     238- 
     239-        [ qz_window setContentView:[ [ NSQuickDrawView alloc ] init ] ]; 
     240-        [ qz_window setReleasedWhenClosed:YES ]; 
     241-        [ qz_window center ]; 
     242-        [ qz_window setAcceptsMouseMovedEvents:YES ]; 
     243-        [ qz_window setLevel:CGShieldingWindowLevel() ]; 
     244-        [ qz_window makeKeyAndOrderFront:nil ]; 
     245- 
     246-        port = [ [ qz_window contentView ] qdPort ]; 
     247-        SetPort (port); 
     248-         
     249-        /* 
     250-            BUG: would like to remove white flash when window kicks in 
     251-            { 
     252-                Rect r; 
     253-                SetRect (&r, 0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h); 
     254-                PaintRect (&r); 
     255-                QDFlushPortBuffer (port, nil); 
     256-            } 
     257-        */ 
     258+     
     259+    theBounds.right  = width; 
     260+    theBounds.bottom = height; 
     261+    yuv_port = NULL; 
     262+     
     263+    err = QTNewGWorld(&yuv_port, k32ARGBPixelFormat, &theBounds, 
     264+                      NULL, NULL, 0); 
     265+     
     266+    if (err != noErr) { 
     267+        SDL_SetError ("Could not init QuickTime world"); 
     268+        return NULL; 
     269     } 
     270-    else { 
     271-        port = [ window_view qdPort ]; 
     272-        SetPort (port); 
     273-    } 
     274      
     275+    LockPixels(GetGWorldPixMap(yuv_port)); 
     276+     
     277     SetIdentityMatrix (yuv_matrix); 
     278      
     279     HLock ((Handle)yuv_idh); 
     280@@ -219,7 +209,7 @@ 
     281                                     yuv_idh, 
     282                                     NULL, 
     283                                     0, 
     284-                                    port, 
     285+                                    yuv_port, 
     286                                     NULL, 
     287                                     NULL, 
     288                                     yuv_matrix, 
     289@@ -231,11 +221,13 @@ 
     290      
     291     if (err != noErr) { 
     292         SDL_SetError ("Error trying to start YUV codec."); 
     293+        DisposeGWorld(yuv_port); 
     294         return NULL; 
     295     } 
     296      
     297     overlay = (SDL_Overlay*) SDL_malloc (sizeof(*overlay)); 
     298     if (overlay == NULL) { 
     299+        DisposeGWorld(yuv_port); 
     300         SDL_OutOfMemory(); 
     301         return NULL; 
     302     } 
     303@@ -263,6 +255,7 @@ 
     304             plane3 = 1; /* V plane maps to plane 2 */ 
     305         } 
     306         else { 
     307+            DisposeGWorld(yuv_port); 
     308             SDL_SetError("Unsupported YUV format"); 
     309             return NULL; 
     310         } 
     311@@ -270,6 +263,7 @@ 
     312         pixels = (Uint8**) SDL_malloc (sizeof(*pixels) * 3); 
     313         pitches = (Uint16*) SDL_malloc (sizeof(*pitches) * 3); 
     314         if (pixels == NULL || pitches == NULL) { 
     315+            DisposeGWorld(yuv_port); 
     316             SDL_OutOfMemory(); 
     317             return NULL; 
     318         } 
     319@@ -280,6 +274,7 @@ 
     320             SDL_malloc (sizeof(PlanarPixmapInfoYUV420) + 
     321                     (width * height * 2)); 
     322         if (yuv_pixmap == NULL) { 
     323+            DisposeGWorld(yuv_port); 
     324             SDL_OutOfMemory (); 
     325             return NULL; 
     326         } 
     327@@ -314,6 +309,7 @@ 
     328  
     329     overlay->hwfuncs = SDL_malloc (sizeof(*overlay->hwfuncs)); 
     330     if (overlay->hwfuncs == NULL) { 
     331+               DisposeGWorld(yuv_port); 
     332         SDL_OutOfMemory(); 
     333         return NULL; 
     334     } 
     335@@ -325,6 +321,7 @@ 
     336  
     337     yuv_width = overlay->w; 
     338     yuv_height = overlay->h; 
     339+#endif 
     340      
     341     return overlay; 
     342 } 
     343Index: src/video/quartz/SDL_QuartzVideo.m 
     344=================================================================== 
     345--- src/video/quartz/SDL_QuartzVideo.m  (revision 4718) 
     346+++ src/video/quartz/SDL_QuartzVideo.m  (working copy) 
     347@@ -38,7 +38,8 @@ 
     348 @implementation NSScreen (NSScreenAccess) 
     349 - (void) setFrame:(NSRect)frame; 
     350 { 
     351-    _frame = frame; 
     352+// !!! FIXME 
     353+//    _frame = frame; 
     354 } 
     355 @end 
     356  
     357@@ -52,6 +53,8 @@ 
     358 - (void) doCommandBySelector:(SEL) myselector {} 
     359 @end 
     360  
     361+/* absent in 10.3.9.  */ 
     362+CG_EXTERN CGImageRef CGBitmapContextCreateImage (CGContextRef); 
     363  
     364 /* Bootstrap functions */ 
     365 static int              QZ_Available (); 
     366@@ -79,8 +82,6 @@ 
     367 static void         QZ_DoubleBufferUpdate (_THIS, int num_rects, SDL_Rect *rects); 
     368  
     369 static void         QZ_DirectUpdate     (_THIS, int num_rects, SDL_Rect *rects); 
     370-static int          QZ_LockWindow       (_THIS, SDL_Surface *surface); 
     371-static void         QZ_UnlockWindow     (_THIS, SDL_Surface *surface); 
     372 static void         QZ_UpdateRects      (_THIS, int num_rects, SDL_Rect *rects); 
     373 static void         QZ_VideoQuit        (_THIS); 
     374  
     375@@ -371,6 +372,12 @@ 
     376     this->LockHWSurface   = NULL; 
     377     this->UnlockHWSurface = NULL; 
     378      
     379+    if (cg_context) { 
     380+        CGContextFlush (cg_context); 
     381+        CGContextRelease (cg_context); 
     382+        cg_context = nil; 
     383+    } 
     384+     
     385     /* Release fullscreen resources */ 
     386     if ( mode_flags & SDL_FULLSCREEN ) { 
     387  
     388@@ -487,7 +494,8 @@ 
     389     current->flags |= SDL_FULLSCREEN; 
     390     current->flags |= SDL_HWSURFACE; 
     391     current->flags |= SDL_PREALLOC; 
     392-     
     393+    /* current->hwdata = (void *) CGDisplayGetDrawingContext (display_id); */ 
     394+ 
     395     this->UpdateRects     = QZ_DirectUpdate; 
     396     this->LockHWSurface   = QZ_LockHWSurface; 
     397     this->UnlockHWSurface = QZ_UnlockHWSurface; 
     398@@ -538,6 +546,7 @@ 
     399        and with no valid window/view in FULLSCREEN, SDL wouldn't update its cursor. ) 
     400     */ 
     401        /* Check for user-specified window and view */ 
     402+#if SDL_LEGACY_QUICKDRAW 
     403     { 
     404         char *windowPtrString = getenv ("SDL_NSWindowPointer"); 
     405         char *viewPtrString = getenv ("SDL_NSQuickDrawViewPointer"); 
     406@@ -561,12 +570,13 @@ 
     407             [ qz_window retain ]; 
     408         } 
     409     } 
     410+#endif 
     411     /* Check if we should recreate the window */ 
     412     if (qz_window == nil) { 
     413         /* Manually create a window, avoids having a nib file resource */ 
     414         qz_window = [ [ SDL_QuartzWindow alloc ]  
     415             initWithContentRect:contentRect 
     416-                styleMask:nil  
     417+                styleMask:0 
     418                     backing:NSBackingStoreBuffered 
     419                         defer:NO ]; 
     420  
     421@@ -695,6 +705,7 @@ 
     422     } 
     423      
     424     /* Check for user-specified window and view */ 
     425+#if SDL_LEGACY_QUICKDRAW 
     426     { 
     427         char *windowPtrString = getenv ("SDL_NSWindowPointer"); 
     428         char *viewPtrString = getenv ("SDL_NSQuickDrawViewPointer"); 
     429@@ -727,7 +738,8 @@ 
     430                 current->flags |= SDL_NOFRAME; 
     431         } 
     432     } 
     433-     
     434+#endif 
     435+ 
     436     /* Check if we should recreate the window */ 
     437     if (qz_window == nil) { 
     438      
     439@@ -809,46 +821,34 @@ 
     440     } 
     441     /* For 2D, we set the subview to an NSQuickDrawView */ 
     442     else { 
     443-        short qdbpp = 0; 
     444+        CGColorSpaceRef cgColorspace; 
     445  
     446         /* Only recreate the view if it doesn't already exist */ 
     447         if (window_view == nil) { 
     448          
     449-            window_view = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ]; 
     450+            window_view = [ [ NSView alloc ] initWithFrame:contentRect ]; 
     451             [ window_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ]; 
     452             [ [ qz_window contentView ] addSubview:window_view ]; 
     453             [ window_view release ]; 
     454             [ qz_window makeKeyAndOrderFront:nil ]; 
     455         } 
     456          
     457-        LockPortBits ( [ window_view qdPort ] ); 
     458-        current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ window_view qdPort ] ) ); 
     459-        current->pitch  = GetPixRowBytes ( GetPortPixMap ( [ window_view qdPort ] ) ); 
     460-        qdbpp           = GetPixDepth ( GetPortPixMap ( [ window_view qdPort ] ) ); 
     461-        UnlockPortBits ( [ window_view qdPort ] ); 
     462- 
     463-        /* QuickDraw may give a 16-bit shadow surface on 8-bit displays! */ 
     464-        *bpp = qdbpp; 
     465- 
     466+        cgColorspace = CGColorSpaceCreateDeviceRGB(); 
     467+        current->pitch = 4 * current->w; 
     468+        current->pixels = SDL_malloc (current->h * current->pitch); 
     469+         
     470+        cg_context = CGBitmapContextCreate (current->pixels, current->w, current->h, 
     471+                        8, current->pitch, cgColorspace, 
     472+                        kCGImageAlphaNoneSkipFirst); 
     473+        CGColorSpaceRelease (cgColorspace); 
     474+         
     475         current->flags |= SDL_SWSURFACE; 
     476-        current->flags |= SDL_PREALLOC; 
     477         current->flags |= SDL_ASYNCBLIT; 
     478+        current->hwdata = (void *) cg_context; 
     479          
     480-        /*  
     481-            current->pixels now points to the window's pixels 
     482-            We want it to point to the *view's* pixels  
     483-        */ 
     484-        {  
     485-            int vOffset = [ qz_window frame ].size.height -  
     486-                [ window_view frame ].size.height - [ window_view frame ].origin.y; 
     487-             
     488-            int hOffset = [ window_view frame ].origin.x; 
     489-                     
     490-            current->pixels = (Uint8 *)current->pixels + (vOffset * current->pitch) + hOffset * (qdbpp/8); 
     491-        } 
     492         this->UpdateRects     = QZ_UpdateRects; 
     493-        this->LockHWSurface   = QZ_LockWindow; 
     494-        this->UnlockHWSurface = QZ_UnlockWindow; 
     495+        this->LockHWSurface   = QZ_LockHWSurface; 
     496+        this->UnlockHWSurface = QZ_UnlockHWSurface; 
     497     } 
     498  
     499     /* Save flags to ensure correct teardown */ 
     500@@ -877,8 +877,8 @@ 
     501     } 
     502     /* Setup windowed video */ 
     503     else { 
     504-        /* Force bpp to the device's bpp */ 
     505-        bpp = device_bpp; 
     506+        /* Force bpp to 32 */ 
     507+        bpp = 32; 
     508         current = QZ_SetVideoWindowed (this, current, width, height, &bpp, flags); 
     509         if (current == NULL) 
     510             return NULL; 
     511@@ -903,9 +903,15 @@ 
     512                 return NULL; 
     513             case 32:   /* (8)-8-8-8 ARGB */ 
     514                 amask = 0x00000000; 
     515+#ifdef __LITTLE_ENDIAN__ 
     516+                rmask = 0x0000FF00; 
     517+                gmask = 0x00FF0000; 
     518+                bmask = 0xFF000000; 
     519+#else 
     520                 rmask = 0x00FF0000; 
     521                 gmask = 0x0000FF00; 
     522                 bmask = 0x000000FF; 
     523+#endif 
     524                 break; 
     525         } 
     526  
     527@@ -1062,6 +1068,9 @@ 
     528         /* On error, skip VBL delay */ 
     529         ERROR: 
     530          
     531+        /* TODO: use CGContextDrawImage here too!  Create two CGContextRefs the same way we 
     532+           create two buffers, replace current_buffer with current_context and set it 
     533+           appropriately in QZ_FlipDoubleBuffer.  */ 
     534         while ( h-- ) { 
     535          
     536             SDL_memcpy (dst, src, len); 
     537@@ -1105,254 +1114,7 @@ 
     538 #pragma unused(this,num_rects,rects) 
     539 } 
     540  
     541-/* 
     542-    The obscured code is based on work by Matt Slot fprefect@ambrosiasw.com, 
     543-    who supplied sample code for Carbon. 
     544-*/ 
     545  
     546-/*#define TEST_OBSCURED 1*/ 
     547- 
     548-#if TEST_OBSCURED 
     549-#include "CGS.h" 
     550-#endif 
     551- 
     552-static int QZ_IsWindowObscured (NSWindow *window) { 
     553- 
     554- 
     555-#if TEST_OBSCURED 
     556- 
     557-    /*   
     558-        In order to determine if a direct copy to the screen is possible, 
     559-        we must figure out if there are any windows covering ours (including shadows). 
     560-        This can be done by querying the window server about the on screen 
     561-        windows for their screen rectangle and window level. 
     562-        The procedure used below is puts accuracy before speed; however, it aims to call 
     563-        the window server the fewest number of times possible to keep things reasonable. 
     564-        In my testing on a 300mhz G3, this routine typically takes < 2 ms. -DW 
     565-     
     566-    Notes: 
     567-        -Calls into the Window Server involve IPC which is slow. 
     568-        -Getting a rectangle seems slower than getting the window level 
     569-        -The window list we get back is in sorted order, top to bottom 
     570-        -On average, I suspect, most windows above ours are dock icon windows (hence optimization) 
     571-        -Some windows above ours are always there, and cannot move or obscure us (menu bar) 
     572-     
     573-    Bugs: 
     574-        -no way (yet) to deactivate direct drawing when a window is dragged, 
     575-        or suddenly obscured, so drawing continues and can produce garbage 
     576-        We need some kind of locking mechanism on window movement to prevent this 
     577-     
     578-        -deactivated normal windows use activated normal 
     579-        window shadows (slight inaccuraccy) 
     580-    */ 
     581- 
     582-    /* Cache the connection to the window server */ 
     583-    static CGSConnectionID    cgsConnection = (CGSConnectionID) -1; 
     584- 
     585-    /* Cache the dock icon windows */ 
     586-    static CGSWindowID          dockIcons[kMaxWindows]; 
     587-    static int                  numCachedDockIcons = 0; 
     588- 
     589-    CGSWindowID                windows[kMaxWindows]; 
     590-    CGSWindowCount             i, count; 
     591-    CGSWindowLevel             winLevel; 
     592-    CGSRect                    winRect; 
     593- 
     594-    CGSRect contentRect; 
     595-    int     windowNumber; 
     596-    int     firstDockIcon; 
     597-    int     dockIconCacheMiss; 
     598-    int     windowContentOffset; 
     599- 
     600-    int     obscured = SDL_TRUE; 
     601- 
     602-    if ( [ window isVisible ] ) { 
     603- 
     604-        /*   
     605-            walk the window list looking for windows over top of 
     606-            (or casting a shadow on) ours  
     607-        */ 
     608- 
     609-        /*  
     610-           Get a connection to the window server 
     611-           Should probably be moved out into SetVideoMode() or InitVideo() 
     612-        */ 
     613-        if (cgsConnection == (CGSConnectionID) -1) { 
     614-            cgsConnection = (CGSConnectionID) 0; 
     615-            cgsConnection = _CGSDefaultConnection (); 
     616-        } 
     617- 
     618-        if (cgsConnection) { 
     619- 
     620-            if ( ! [ window styleMask ] & NSBorderlessWindowMask ) 
     621-                windowContentOffset = 22; 
     622-            else 
     623-                windowContentOffset = 0; 
     624- 
     625-            windowNumber = [ window windowNumber ]; 
     626- 
     627-            /* The window list is sorted according to order on the screen */ 
     628-            count = 0; 
     629-            CGSGetOnScreenWindowList (cgsConnection, 0, kMaxWindows, windows, &count); 
     630-            CGSGetScreenRectForWindow (cgsConnection, windowNumber, &contentRect); 
     631- 
     632-            /* adjust rect for window title bar (if present) */ 
     633-            contentRect.origin.y    += windowContentOffset; 
     634-            contentRect.size.height -= windowContentOffset; 
     635- 
     636-            firstDockIcon = -1; 
     637-            dockIconCacheMiss = SDL_FALSE; 
     638- 
     639-            /*  
     640-                The first window is always an empty window with level kCGSWindowLevelTop 
     641-                so start at index 1 
     642-            */ 
     643-            for (i = 1; i < count; i++) { 
     644- 
     645-                /* If we reach our window in the list, it cannot be obscured */ 
     646-                if (windows[i] == windowNumber) { 
     647- 
     648-                    obscured = SDL_FALSE; 
     649-                    break; 
     650-                } 
     651-                else { 
     652- 
     653-                    float shadowSide; 
     654-                    float shadowTop; 
     655-                    float shadowBottom; 
     656- 
     657-                    CGSGetWindowLevel (cgsConnection, windows[i], &winLevel); 
     658- 
     659-                    if (winLevel == kCGSWindowLevelDockIcon) { 
     660- 
     661-                        int j; 
     662- 
     663-                        if (firstDockIcon < 0) { 
     664- 
     665-                            firstDockIcon = i; 
     666- 
     667-                            if (numCachedDockIcons > 0) { 
     668- 
     669-                                for (j = 0; j < numCachedDockIcons; j++) { 
     670- 
     671-                                    if (windows[i] == dockIcons[j]) 
     672-                                        i++; 
     673-                                    else 
     674-                                        break; 
     675-                                } 
     676- 
     677-                                if (j != 0) { 
     678- 
     679-                                    i--; 
     680- 
     681-                                    if (j < numCachedDockIcons) { 
     682- 
     683-                                        dockIconCacheMiss = SDL_TRUE; 
     684-                                    } 
     685-                                } 
     686- 
     687-                            } 
     688-                        } 
     689- 
     690-                        continue; 
     691-                    } 
     692-                    else if (winLevel == kCGSWindowLevelMenuIgnore 
     693-                             /* winLevel == kCGSWindowLevelTop */) { 
     694- 
     695-                        continue; /* cannot obscure window */ 
     696-                    } 
     697-                    else if (winLevel == kCGSWindowLevelDockMenu || 
     698-                             winLevel == kCGSWindowLevelMenu) { 
     699- 
     700-                        shadowSide = 18; 
     701-                        shadowTop = 4; 
     702-                        shadowBottom = 22; 
     703-                    } 
     704-                    else if (winLevel == kCGSWindowLevelUtility) { 
     705- 
     706-                        shadowSide = 8; 
     707-                        shadowTop = 4; 
     708-                        shadowBottom = 12; 
     709-                    } 
     710-                    else if (winLevel == kCGSWindowLevelNormal) { 
     711- 
     712-                        /*  
     713-                            These numbers are for foreground windows, 
     714-                            they are too big (but will work) for background windows  
     715-                        */ 
     716-                        shadowSide = 20; 
     717-                        shadowTop = 10; 
     718-                        shadowBottom = 24; 
     719-                    } 
     720-                    else if (winLevel == kCGSWindowLevelDock) { 
     721- 
     722-                        /* Create dock icon cache */ 
     723-                        if (numCachedDockIcons != (i-firstDockIcon) || 
     724-                            dockIconCacheMiss) { 
     725- 
     726-                            numCachedDockIcons = i - firstDockIcon; 
     727-                            SDL_memcpy (dockIcons, &(windows[firstDockIcon]), 
     728-                                    numCachedDockIcons * sizeof(*windows)); 
     729-                        } 
     730- 
     731-                        /* no shadow */ 
     732-                        shadowSide = 0; 
     733-                        shadowTop = 0; 
     734-                        shadowBottom = 0; 
     735-                    } 
     736-                    else { 
     737- 
     738-                        /* 
     739-                            kCGSWindowLevelDockLabel, 
     740-                            kCGSWindowLevelDock, 
     741-                            kOther??? 
     742-                        */ 
     743- 
     744-                        /* no shadow */ 
     745-                        shadowSide = 0; 
     746-                        shadowTop = 0; 
     747-                        shadowBottom = 0; 
     748-                    } 
     749- 
     750-                    CGSGetScreenRectForWindow (cgsConnection, windows[i], &winRect); 
     751- 
     752-                    winRect.origin.x -= shadowSide; 
     753-                    winRect.origin.y -= shadowTop; 
     754-                    winRect.size.width += shadowSide; 
     755-                    winRect.size.height += shadowBottom; 
     756- 
     757-                    if (NSIntersectsRect (contentRect, winRect)) { 
     758- 
     759-                        obscured = SDL_TRUE; 
     760-                        break; 
     761-                    } 
     762- 
     763-                } /* window was not our window */ 
     764- 
     765-            } /* iterate over windows */ 
     766- 
     767-        } /* get cgsConnection */ 
     768- 
     769-    } /* window is visible */ 
     770-     
     771-    return obscured; 
     772-#else 
     773-    return SDL_TRUE; 
     774-#endif 
     775-} 
     776- 
     777- 
     778-/* Locking functions for the software window buffer */ 
     779-static int QZ_LockWindow (_THIS, SDL_Surface *surface) { 
     780-     
     781-    return LockPortBits ( [ window_view qdPort ] ); 
     782-} 
     783- 
     784-static void QZ_UnlockWindow (_THIS, SDL_Surface *surface) { 
     785- 
     786-    UnlockPortBits ( [ window_view qdPort ] ); 
     787-} 
     788- 
     789 /* Resize icon, BMP format */ 
     790 static const unsigned char QZ_ResizeIcon[] = { 
     791     0x42,0x4d,0x31,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00, 
     792@@ -1393,41 +1155,34 @@ 
     793     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0b 
     794 }; 
     795  
     796-static void QZ_DrawResizeIcon (_THIS, RgnHandle dirtyRegion) { 
     797+static void QZ_DrawResizeIcon (_THIS) { 
     798  
     799     /* Check if we should draw the resize icon */ 
     800     if (SDL_VideoSurface->flags & SDL_RESIZABLE) { 
     801      
     802-        Rect    icon; 
     803-        SetRect (&icon, SDL_VideoSurface->w - 13, SDL_VideoSurface->h - 13,  
     804-                    SDL_VideoSurface->w, SDL_VideoSurface->h); 
     805-                     
     806-        if (RectInRgn (&icon, dirtyRegion)) { 
     807+        SDL_Rect icon_rect; 
     808          
     809-            SDL_Rect icon_rect; 
     810+        /* Create the icon image */ 
     811+        if (resize_icon == NULL) { 
     812+         
     813+            SDL_RWops *rw; 
     814+            SDL_Surface *tmp; 
     815              
     816-            /* Create the icon image */ 
     817-            if (resize_icon == NULL) { 
     818+            rw = SDL_RWFromConstMem (QZ_ResizeIcon, sizeof(QZ_ResizeIcon)); 
     819+            tmp = SDL_LoadBMP_RW (rw, SDL_TRUE); 
     820+                                                             
     821+            resize_icon = SDL_ConvertSurface (tmp, SDL_VideoSurface->format, SDL_SRCCOLORKEY); 
     822+            SDL_SetColorKey (resize_icon, SDL_SRCCOLORKEY, 0xFFFFFF); 
     823              
     824-                SDL_RWops *rw; 
     825-                SDL_Surface *tmp; 
     826-                 
     827-                rw = SDL_RWFromConstMem (QZ_ResizeIcon, sizeof(QZ_ResizeIcon)); 
     828-                tmp = SDL_LoadBMP_RW (rw, SDL_TRUE); 
     829-                                                                 
     830-                resize_icon = SDL_ConvertSurface (tmp, SDL_VideoSurface->format, SDL_SRCCOLORKEY); 
     831-                SDL_SetColorKey (resize_icon, SDL_SRCCOLORKEY, 0xFFFFFF); 
     832-                 
     833-                SDL_FreeSurface (tmp); 
     834-            } 
     835+            SDL_FreeSurface (tmp); 
     836+        } 
     837              
     838-            icon_rect.x = SDL_VideoSurface->w - 13; 
     839-            icon_rect.y = SDL_VideoSurface->h - 13; 
     840-            icon_rect.w = 13; 
     841-            icon_rect.h = 13; 
     842+        icon_rect.x = SDL_VideoSurface->w - 13; 
     843+        icon_rect.y = SDL_VideoSurface->h - 13; 
     844+        icon_rect.w = 13; 
     845+        icon_rect.h = 13; 
     846              
     847-            SDL_BlitSurface (resize_icon, NULL, SDL_VideoSurface, &icon_rect); 
     848-        } 
     849+        SDL_BlitSurface (resize_icon, NULL, SDL_VideoSurface, &icon_rect); 
     850     } 
     851 } 
     852  
     853@@ -1441,75 +1196,19 @@ 
     854         /* Do nothing if miniaturized */ 
     855     } 
     856      
     857-    else if ( ! QZ_IsWindowObscured (qz_window) ) { 
     858- 
     859-        /* Use direct copy to flush contents to the display */ 
     860-        CGrafPtr savePort; 
     861-        CGrafPtr dstPort, srcPort; 
     862-        const BitMap  *dstBits, *srcBits; 
     863-        Rect     dstRect, srcRect; 
     864-        Point    offset; 
     865-        int i; 
     866- 
     867-        GetPort (&savePort); 
     868- 
     869-        dstPort = CreateNewPortForCGDisplayID ((UInt32)display_id); 
     870-        srcPort = [ window_view qdPort ]; 
     871- 
     872-        offset.h = 0; 
     873-        offset.v = 0; 
     874-        SetPort (srcPort); 
     875-        LocalToGlobal (&offset); 
     876- 
     877-        SetPort (dstPort); 
     878- 
     879-        LockPortBits (dstPort); 
     880-        LockPortBits (srcPort); 
     881- 
     882-        dstBits = GetPortBitMapForCopyBits (dstPort); 
     883-        srcBits = GetPortBitMapForCopyBits (srcPort); 
     884- 
     885-        for (i = 0; i < numRects; i++) { 
     886- 
     887-            SetRect (&srcRect, rects[i].x, rects[i].y, 
     888-                     rects[i].x + rects[i].w, 
     889-                     rects[i].y + rects[i].h); 
     890- 
     891-            SetRect (&dstRect, 
     892-                     rects[i].x + offset.h, 
     893-                     rects[i].y + offset.v, 
     894-                     rects[i].x + rects[i].w + offset.h, 
     895-                     rects[i].y + rects[i].h + offset.v); 
     896- 
     897-            CopyBits (srcBits, dstBits, 
     898-                      &srcRect, &dstRect, srcCopy, NULL); 
     899- 
     900-        } 
     901- 
     902-        SetPort (savePort); 
     903-    } 
     904     else { 
     905-        /* Use QDFlushPortBuffer() to flush content to display */ 
     906-        int i; 
     907-        RgnHandle dirty = NewRgn (); 
     908-        RgnHandle temp  = NewRgn (); 
     909- 
     910-        SetEmptyRgn (dirty); 
     911- 
     912-        /* Build the region of dirty rectangles */ 
     913-        for (i = 0; i < numRects; i++) { 
     914- 
     915-            MacSetRectRgn (temp, rects[i].x, rects[i].y, 
     916-                        rects[i].x + rects[i].w, rects[i].y + rects[i].h); 
     917-            MacUnionRgn (dirty, temp, dirty); 
     918-        } 
     919- 
     920-        QZ_DrawResizeIcon (this, dirty); 
     921+        CGContextRef cgc = (CGContextRef) 
     922+            [[NSGraphicsContext graphicsContextWithWindow: qz_window] 
     923+                graphicsPort]; 
     924+        QZ_DrawResizeIcon (this); 
     925+        CGContextFlush (cg_context); 
     926+        CGImageRef image = CGBitmapContextCreateImage (cg_context); 
     927+        CGRect rectangle = CGRectMake (0,0,[window_view frame].size.width,[window_view frame].size.height); 
     928          
     929-        /* Flush the dirty region */ 
     930-        QDFlushPortBuffer ( [ window_view qdPort ], dirty ); 
     931-        DisposeRgn (dirty); 
     932-        DisposeRgn (temp); 
     933+        CGContextDrawImage (cgc, rectangle, image); 
     934+        CGImageRelease(image); 
     935+        CGContextFlush (cgc); 
     936+        CGContextRelease (cgc); 
     937     } 
     938 } 
     939  
     940Index: src/video/quartz/SDL_QuartzWindow.m 
     941=================================================================== 
     942--- src/video/quartz/SDL_QuartzWindow.m (revision 4718) 
     943+++ src/video/quartz/SDL_QuartzWindow.m (working copy) 
     944@@ -125,31 +125,6 @@ 
     945         newViewFrame = [ window_view frame ]; 
     946          
     947         SDL_PrivateResize (newViewFrame.size.width, newViewFrame.size.height); 
     948- 
     949-        /* If not OpenGL, we have to update the pixels and pitch */ 
     950-        if ( ! ( SDL_VideoSurface->flags & SDL_OPENGL ) ) { 
     951-             
     952-            CGrafPtr thePort = [ window_view qdPort ]; 
     953-            LockPortBits ( thePort ); 
     954-             
     955-            SDL_VideoSurface->pixels = GetPixBaseAddr ( GetPortPixMap ( thePort ) ); 
     956-            SDL_VideoSurface->pitch  = GetPixRowBytes ( GetPortPixMap ( thePort ) ); 
     957-                         
     958-            /*  
     959-                SDL_VideoSurface->pixels now points to the window's pixels 
     960-                We want it to point to the *view's* pixels  
     961-            */ 
     962-            {  
     963-                int vOffset = [ qz_window frame ].size.height -  
     964-                    newViewFrame.size.height - newViewFrame.origin.y; 
     965-                 
     966-                int hOffset = newViewFrame.origin.x; 
     967-                         
     968-                SDL_VideoSurface->pixels = (Uint8 *)SDL_VideoSurface->pixels + (vOffset * SDL_VideoSurface->pitch) + hOffset * (device_bpp/8); 
     969-            } 
     970-             
     971-            UnlockPortBits ( thePort ); 
     972-        } 
     973     } 
     974 } 
     975  
     976@@ -183,7 +158,7 @@ 
     977     SDL_PrivateAppActive (1, SDL_APPACTIVE); 
     978 } 
     979  
     980-- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag 
     981+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag 
     982 { 
     983     /* Make our window subclass receive these application notifications */ 
     984     [ [ NSNotificationCenter defaultCenter ] addObserver:self 
     985Index: configure.in 
     986=================================================================== 
     987--- configure.in        (revision 4718) 
     988+++ configure.in        (working copy) 
     989@@ -2697,7 +2697,8 @@ 
     990         fi 
     991         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then 
     992             # The Cocoa backend still needs Carbon, and the YUV code QuickTime 
     993-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices" 
     994+            dnl EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices" 
     995+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ApplicationServices" 
     996             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" 
     997         fi 
     998         # If either the audio or CD driver is used, add the AudioUnit framework 
  • release/ports/devel/libsdl/files/patch-SDL_1.2.13_14_backport.diff

    diff -urN release/ports/devel/libsdl/files/patch-SDL_1.2.13_14_backport.diff release/ports/devel/libsdl/files/patch-SDL_1.2.13_14_backport.diff
     
     1--- configure.in        2009-09-18 23:15:04.000000000 -0500 
     2+++ configure.in        2009-09-18 23:33:14.000000000 -0500 
     3@@ -2553,8 +2553,6 @@ 
     4         if test x$enable_audio = xyes; then 
     5             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO) 
     6             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c" 
     7-            AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR) 
     8-            SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c" 
     9             have_audio=yes 
     10         fi 
     11         # Set up files for the joystick library 
     12--- configure   2007-12-30 23:09:39.000000000 -0600 
     13+++ configure   2009-09-19 09:15:17.000000000 -0500 
     14@@ -33970,11 +33970,6 @@ 
     15 _ACEOF 
     16  
     17             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c" 
     18-            cat >>confdefs.h <<\_ACEOF 
     19-#define SDL_AUDIO_DRIVER_SNDMGR 1 
     20-_ACEOF 
     21- 
     22-            SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c" 
     23             have_audio=yes 
     24         fi 
     25         # Set up files for the joystick library 
     26--- src/audio/macosx/SDL_coreaudio.c    (.../tags/SDL/release-1.2.13)   (revisio 4719) 
     27+++ src/audio/macosx/SDL_coreaudio.c    (.../branches/SDL-1.2)  (revision 4719) 
     28@@ -21,8 +21,10 @@ 
     29 */ 
     30 #include "SDL_config.h" 
     31  
     32+#include <CoreAudio/CoreAudio.h> 
     33+#include <CoreServices/CoreServices.h> 
     34 #include <AudioUnit/AudioUnit.h> 
     35-#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER 
     36+#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 
     37 #include <AudioUnit/AUNTComponent.h> 
     38 #endif 
     39  
     40@@ -91,19 +93,25 @@ 
     41 }; 
     42  
     43 /* The CoreAudio callback */ 
     44-static OSStatus     audioCallback (void                             *inRefCon,  
     45-                                    AudioUnitRenderActionFlags      inActionFlags, 
     46-                                    const AudioTimeStamp            *inTimeStamp,  
     47-                                    UInt32                          inBusNumber,  
     48-                                    AudioBuffer                     *ioData) 
     49+static OSStatus     audioCallback (void                            *inRefCon, 
     50+                                   AudioUnitRenderActionFlags      *ioActionFlags, 
     51+                                   const AudioTimeStamp            *inTimeStamp, 
     52+                                   UInt32                          inBusNumber, 
     53+                                   UInt32                          inNumberFrames, 
     54+                                   AudioBufferList                 *ioData) 
     55 { 
     56     SDL_AudioDevice *this = (SDL_AudioDevice *)inRefCon; 
     57     UInt32 remaining, len; 
     58+    AudioBuffer *abuf; 
     59     void *ptr; 
     60+    UInt32 i; 
     61  
     62     /* Only do anything if audio is enabled and not paused */ 
     63     if ( ! this->enabled || this->paused ) { 
     64-        SDL_memset(ioData->mData, this->spec.silence, ioData->mDataByteSize); 
     65+        for (i = 0; i < ioData->mNumberBuffers; i++) { 
     66+            abuf = &ioData->mBuffers[i]; 
     67+            SDL_memset(abuf->mData, this->spec.silence, abuf->mDataByteSize); 
     68+        } 
     69         return 0; 
     70     } 
     71      
     72@@ -114,29 +122,32 @@ 
     73     assert(!this->convert.needed); 
     74     assert(this->spec.channels == ioData->mNumberChannels); 
     75      */ 
     76-     
     77-    remaining = ioData->mDataByteSize; 
     78-    ptr = ioData->mData; 
     79-    while (remaining > 0) { 
     80-        if (bufferOffset >= bufferSize) { 
     81-            /* Generate the data */ 
     82-            SDL_memset(buffer, this->spec.silence, bufferSize); 
     83-            SDL_mutexP(this->mixer_lock); 
     84-            (*this->spec.callback)(this->spec.userdata, 
     85-                        buffer, bufferSize); 
     86-            SDL_mutexV(this->mixer_lock); 
     87-            bufferOffset = 0; 
     88-        } 
     89+ 
     90+    for (i = 0; i < ioData->mNumberBuffers; i++) { 
     91+        abuf = &ioData->mBuffers[i]; 
     92+        remaining = abuf->mDataByteSize; 
     93+        ptr = abuf->mData; 
     94+        while (remaining > 0) { 
     95+            if (bufferOffset >= bufferSize) { 
     96+                /* Generate the data */ 
     97+                SDL_memset(buffer, this->spec.silence, bufferSize); 
     98+                SDL_mutexP(this->mixer_lock); 
     99+                (*this->spec.callback)(this->spec.userdata, 
     100+                            buffer, bufferSize); 
     101+                SDL_mutexV(this->mixer_lock); 
     102+                bufferOffset = 0; 
     103+            } 
     104          
     105-        len = bufferSize - bufferOffset; 
     106-        if (len > remaining) 
     107-            len = remaining; 
     108-        SDL_memcpy(ptr, (char *)buffer + bufferOffset, len); 
     109-        ptr = (char *)ptr + len; 
     110-        remaining -= len; 
     111-        bufferOffset += len; 
     112+            len = bufferSize - bufferOffset; 
     113+            if (len > remaining) 
     114+                len = remaining; 
     115+            SDL_memcpy(ptr, (char *)buffer + bufferOffset, len); 
     116+            ptr = (char *)ptr + len; 
     117+            remaining -= len; 
     118+            bufferOffset += len; 
     119+        } 
     120     } 
     121-     
     122+ 
     123     return 0; 
     124 } 
     125  
     126@@ -159,7 +170,7 @@ 
     127 void Core_CloseAudio(_THIS) 
     128 { 
     129     OSStatus result; 
     130-    struct AudioUnitInputCallback callback; 
     131+    struct AURenderCallbackStruct callback; 
     132  
     133     /* stop processing the audio unit */ 
     134     result = AudioOutputUnitStop (outputAudioUnit); 
     135@@ -172,7 +183,7 @@ 
     136     callback.inputProc = 0; 
     137     callback.inputProcRefCon = 0; 
     138     result = AudioUnitSetProperty (outputAudioUnit,  
     139-                        kAudioUnitProperty_SetInputCallback,  
     140+                        kAudioUnitProperty_SetRenderCallback, 
     141                         kAudioUnitScope_Input,  
     142                         0, 
     143                         &callback,  
     144@@ -203,7 +214,7 @@ 
     145     OSStatus result = noErr; 
     146     Component comp; 
     147     ComponentDescription desc; 
     148-    struct AudioUnitInputCallback callback; 
     149+    struct AURenderCallbackStruct callback; 
     150     AudioStreamBasicDescription requestedDesc; 
     151  
     152     /* Setup a AudioStreamBasicDescription with the requested format */ 
     153@@ -224,9 +235,9 @@ 
     154  
     155  
     156     /* Locate the default output audio unit */ 
     157-    desc.componentType = kAudioUnitComponentType; 
     158-    desc.componentSubType = kAudioUnitSubType_Output; 
     159-    desc.componentManufacturer = kAudioUnitID_DefaultOutput; 
     160+    desc.componentType = kAudioUnitType_Output; 
     161+    desc.componentSubType = kAudioUnitSubType_DefaultOutput; 
     162+    desc.componentManufacturer = kAudioUnitManufacturer_Apple; 
     163     desc.componentFlags = 0; 
     164     desc.componentFlagsMask = 0; 
     165      
     166@@ -256,7 +267,7 @@ 
     167     callback.inputProc = audioCallback; 
     168     callback.inputProcRefCon = this; 
     169     result = AudioUnitSetProperty (outputAudioUnit,  
     170-                        kAudioUnitProperty_SetInputCallback,  
     171+                        kAudioUnitProperty_SetRenderCallback, 
     172                         kAudioUnitScope_Input,  
     173                         0, 
     174                         &callback,  
     175diff -ur src/cdrom/macosx/AudioFilePlayer.c src/cdrom/macosx/AudioFilePlayer.c 
     176--- src/cdrom/macosx/AudioFilePlayer.c  2007-12-30 22:48:00.000000000 -0600 
     177+++ src/cdrom/macosx/AudioFilePlayer.c  2009-09-15 16:45:29.000000000 -0500 
     178@@ -1,6 +1,6 @@ 
     179 /* 
     180     SDL - Simple DirectMedia Layer 
     181-    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga 
     182+    Copyright (C) 1997-2009 Sam Lantinga 
     183  
     184     This library is free software; you can redistribute it and/or 
     185     modify it under the terms of the GNU Library General Public 
     186@@ -23,6 +23,7 @@ 
     187     so if you want to see the original search for it on apple.com/developer 
     188 */ 
     189 #include "SDL_config.h" 
     190+#include "SDL_endian.h" 
     191  
     192 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     193     AudioFilePlayer.cpp 
     194@@ -78,7 +79,7 @@ 
     195         /* we're going to use this to know which convert routine to call 
     196            a v1 audio unit will have a type of 'aunt' 
     197            a v2 audio unit will have one of several different types. */ 
     198-    if (desc.componentType != kAudioUnitComponentType) { 
     199+    if (desc.componentType != kAudioUnitType_Output) { 
     200         result = badComponentInstance; 
     201         /*THROW_RESULT("BAD COMPONENT")*/ 
     202         if (result) return 0; 
     203@@ -175,7 +176,7 @@ 
     204         afp->mInputCallback.inputProcRefCon = afp->mAudioFileManager; 
     205  
     206         OSStatus result = AudioUnitSetProperty (afp->mPlayUnit,  
     207-                            kAudioUnitProperty_SetInputCallback,  
     208+                            kAudioUnitProperty_SetRenderCallback, 
     209                             kAudioUnitScope_Input,  
     210                             0, 
     211                             &afp->mInputCallback,  
     212@@ -215,7 +216,7 @@ 
     213         afp->mInputCallback.inputProc = 0; 
     214         afp->mInputCallback.inputProcRefCon = 0; 
     215         OSStatus result = AudioUnitSetProperty (afp->mPlayUnit,  
     216-                                        kAudioUnitProperty_SetInputCallback,  
     217+                                        kAudioUnitProperty_SetRenderCallback, 
     218                                         kAudioUnitScope_Input,  
     219                                         0, 
     220                                         &afp->mInputCallback,  
     221@@ -254,12 +255,12 @@ 
     222     result = FSReadFork(afp->mForkRefNum, fsAtMark, 0, sizeof(chunkHeader), &chunkHeader, &actual); 
     223        if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/ 
     224  
     225-    if (chunkHeader.ckID != 'FORM') { 
     226+    if (SDL_SwapBE32(chunkHeader.ckID) != 'FORM') { 
     227         result = -1; 
     228         if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): chunk id is not 'FORM'");*/ 
     229     } 
     230  
     231-    if (chunkHeader.formType != 'AIFC') { 
     232+    if (SDL_SwapBE32(chunkHeader.formType) != 'AIFC') { 
     233         result = -1; 
     234         if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): file format is not 'AIFC'");*/ 
     235     } 
     236@@ -272,8 +273,11 @@ 
     237     offset = 0; 
     238     do { 
     239         result = FSReadFork(afp->mForkRefNum, fsFromMark, offset, sizeof(chunk), &chunk, &actual); 
     240-           if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/ 
     241-             
     242+        if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/ 
     243+ 
     244+        chunk.ckID = SDL_SwapBE32(chunk.ckID); 
     245+        chunk.ckSize = SDL_SwapBE32(chunk.ckSize); 
     246+ 
     247         /* Skip the chunk data */ 
     248         offset = chunk.ckSize; 
     249     } while (chunk.ckID != 'SSND'); 
     250@@ -281,10 +285,12 @@ 
     251     /* Read the header of the SSND chunk. After this, we are positioned right 
     252        at the start of the audio data. */ 
     253     result = FSReadFork(afp->mForkRefNum, fsAtMark, 0, sizeof(ssndData), &ssndData, &actual); 
     254-       if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/ 
     255+    if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/ 
     256+ 
     257+    ssndData.offset = SDL_SwapBE32(ssndData.offset); 
     258  
     259     result = FSSetForkPosition(afp->mForkRefNum, fsFromMark, ssndData.offset); 
     260-       if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSSetForkPosition")*/ 
     261+    if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSSetForkPosition")*/ 
     262  
     263     /* Data size */ 
     264     *outFileDataSize = chunk.ckSize - ssndData.offset - 8; 
     265diff -ur src/cdrom/macosx/AudioFilePlayer.h src/cdrom/macosx/AudioFilePlayer.h 
     266--- src/cdrom/macosx/AudioFilePlayer.h  2007-12-30 22:48:00.000000000 -0600 
     267+++ src/cdrom/macosx/AudioFilePlayer.h  2009-09-15 16:45:29.000000000 -0500 
     268@@ -1,6 +1,6 @@ 
     269 /* 
     270     SDL - Simple DirectMedia Layer 
     271-    Copyright (C) 1997-2004 Sam Lantinga 
     272+    Copyright (C) 1997-2009 Sam Lantinga 
     273  
     274     This library is free software; you can redistribute it and/or 
     275     modify it under the terms of the GNU Library General Public 
     276@@ -33,7 +33,7 @@ 
     277 #include <CoreServices/CoreServices.h> 
     278  
     279 #include <AudioUnit/AudioUnit.h> 
     280-#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER 
     281+#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 
     282 #include <AudioUnit/AUNTComponent.h> 
     283 #endif 
     284  
     285@@ -82,7 +82,7 @@ 
     286     AudioUnit                       mPlayUnit; 
     287     SInt16                          mForkRefNum; 
     288      
     289-    AudioUnitInputCallback          mInputCallback; 
     290+    AURenderCallbackStruct          mInputCallback; 
     291  
     292     AudioStreamBasicDescription     mFileDescription; 
     293      
     294@@ -114,7 +114,7 @@ 
     295            as it is called by the parent's Disconnect() method */ 
     296     void                (*Disconnect)(struct S_AudioFileManager *afm); 
     297     int                 (*DoConnect)(struct S_AudioFileManager *afm); 
     298-    OSStatus            (*Read)(struct S_AudioFileManager *afm, char *buffer, UInt32 *len); 
     299+    OSStatus            (*Read)(struct S_AudioFileManager *afm, char *buffer, ByteCount *len); 
     300     const char*         (*GetFileBuffer)(struct S_AudioFileManager *afm); 
     301     const AudioFilePlayer *(*GetParent)(struct S_AudioFileManager *afm); 
     302     void                (*SetPosition)(struct S_AudioFileManager *afm, SInt64 pos);  /* seek/rewind in the file */ 
     303@@ -148,17 +148,18 @@ 
     304     int                 mFinishedReadingData; 
     305  
     306 /*protected:*/ 
     307-    OSStatus            (*Render)(struct S_AudioFileManager *afm, AudioBuffer *ioData); 
     308+    OSStatus            (*Render)(struct S_AudioFileManager *afm, AudioBufferList *ioData); 
     309     OSStatus            (*GetFileData)(struct S_AudioFileManager *afm, void** inOutData, UInt32 *inOutDataSize); 
     310     void                (*AfterRender)(struct S_AudioFileManager *afm); 
     311  
     312 /*public:*/ 
     313     /*static*/ 
     314-    OSStatus            (*FileInputProc)(void                             *inRefCon, 
     315-                                         AudioUnitRenderActionFlags      inActionFlags, 
     316+    OSStatus            (*FileInputProc)(void                            *inRefCon, 
     317+                                         AudioUnitRenderActionFlags      *ioActionFlags, 
     318                                          const AudioTimeStamp            *inTimeStamp, 
     319                                          UInt32                          inBusNumber, 
     320-                                         AudioBuffer                     *ioData); 
     321+                                         UInt32                          inNumberFrames, 
     322+                                         AudioBufferList                 *ioData); 
     323 } AudioFileManager; 
     324  
     325  
     326diff -ur src/cdrom/macosx/AudioFileReaderThread.c src/cdrom/macosx/AudioFileReaderThread.c 
     327--- src/cdrom/macosx/AudioFileReaderThread.c    2007-12-30 22:48:00.000000000 -0600 
     328+++ src/cdrom/macosx/AudioFileReaderThread.c    2009-09-15 16:45:29.000000000 -0500 
     329@@ -1,6 +1,6 @@ 
     330 /* 
     331     SDL - Simple DirectMedia Layer 
     332-    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga 
     333+    Copyright (C) 1997-2009 Sam Lantinga 
     334  
     335     This library is free software; you can redistribute it and/or 
     336     modify it under the terms of the GNU Library General Public 
     337@@ -245,7 +245,7 @@ 
     338 static void    FileReaderThread_ReadNextChunk (FileReaderThread *frt) 
     339 { 
     340     OSStatus result; 
     341-    UInt32  dataChunkSize; 
     342+    ByteCount dataChunkSize; 
     343     AudioFileManager* theItem = 0; 
     344  
     345     for (;;)  
     346@@ -380,7 +380,7 @@ 
     347         afm->mNumTimesAskedSinceFinished = 0; 
     348         afm->mLockUnsuccessful = 0; 
     349          
     350-        UInt32 dataChunkSize; 
     351+        ByteCount dataChunkSize; 
     352          
     353         if ((afm->mFileLength - afm->mReadFilePosition) < afm->mChunkSize) 
     354             dataChunkSize = afm->mFileLength - afm->mReadFilePosition; 
     355@@ -415,7 +415,7 @@ 
     356     } 
     357 } 
     358  
     359-static OSStatus AudioFileManager_Read(AudioFileManager *afm, char *buffer, UInt32 *len) 
     360+static OSStatus AudioFileManager_Read(AudioFileManager *afm, char *buffer, ByteCount *len) 
     361 { 
     362     return FSReadFork (afm->mForkRefNum, 
     363                        fsFromStart, 
     364@@ -508,39 +508,44 @@ 
     365     return afm->mByteCounter; 
     366 } 
     367  
     368- 
     369-static OSStatus    AudioFileManager_FileInputProc (void                       *inRefCon, 
     370-                                             AudioUnitRenderActionFlags inActionFlags, 
     371-                                             const AudioTimeStamp       *inTimeStamp,  
     372-                                             UInt32                     inBusNumber,  
     373-                                             AudioBuffer                *ioData) 
     374+static OSStatus    AudioFileManager_FileInputProc (void                  *inRefCon, 
     375+                                         AudioUnitRenderActionFlags      *ioActionFlags, 
     376+                                         const AudioTimeStamp            *inTimeStamp, 
     377+                                         UInt32                          inBusNumber, 
     378+                                         UInt32                          inNumberFrames, 
     379+                                         AudioBufferList                 *ioData) 
     380 { 
     381     AudioFileManager* afm = (AudioFileManager*)inRefCon; 
     382     return afm->Render(afm, ioData); 
     383 } 
     384  
     385-static OSStatus    AudioFileManager_Render (AudioFileManager *afm, AudioBuffer *ioData) 
     386+static OSStatus    AudioFileManager_Render (AudioFileManager *afm, AudioBufferList *ioData) 
     387 { 
     388     OSStatus result = noErr; 
     389+    AudioBuffer *abuf; 
     390+    UInt32 i; 
     391+ 
     392+    for (i = 0; i < ioData->mNumberBuffers; i++) { 
     393+        abuf = &ioData->mBuffers[i]; 
     394+        if (afm->mBufferOffset >= afm->mBufferSize) { 
     395+            result = afm->GetFileData(afm, &afm->mTmpBuffer, &afm->mBufferSize); 
     396+            if (result) { 
     397+                SDL_SetError ("AudioConverterFillBuffer:%ld\n", result); 
     398+                afm->mParent->DoNotification(afm->mParent, result); 
     399+                return result; 
     400+            } 
     401+ 
     402+            afm->mBufferOffset = 0; 
     403+        } 
     404+ 
     405+        if (abuf->mDataByteSize > afm->mBufferSize - afm->mBufferOffset) 
     406+            abuf->mDataByteSize = afm->mBufferSize - afm->mBufferOffset; 
     407+        abuf->mData = (char *)afm->mTmpBuffer + afm->mBufferOffset; 
     408+        afm->mBufferOffset += abuf->mDataByteSize; 
     409      
     410-       if (afm->mBufferOffset >= afm->mBufferSize) { 
     411-               result = afm->GetFileData(afm, &afm->mTmpBuffer, &afm->mBufferSize); 
     412-               if (result) { 
     413-                       SDL_SetError ("AudioConverterFillBuffer:%ld\n", result); 
     414-                       afm->mParent->DoNotification(afm->mParent, result); 
     415-                       return result; 
     416-               } 
     417- 
     418-               afm->mBufferOffset = 0; 
     419-       } 
     420-        
     421-    if (ioData->mDataByteSize > afm->mBufferSize - afm->mBufferOffset) 
     422-       ioData->mDataByteSize = afm->mBufferSize - afm->mBufferOffset; 
     423-    ioData->mData = (char *)afm->mTmpBuffer + afm->mBufferOffset; 
     424-    afm->mBufferOffset += ioData->mDataByteSize; 
     425-     
     426-       afm->mByteCounter += ioData->mDataByteSize; 
     427-       afm->AfterRender(afm); 
     428+        afm->mByteCounter += abuf->mDataByteSize; 
     429+        afm->AfterRender(afm); 
     430+    } 
     431     return result; 
     432 } 
     433  
     434diff -ur src/cdrom/macosx/CDPlayer.c src/cdrom/macosx/CDPlayer.c 
     435--- src/cdrom/macosx/CDPlayer.c 2007-12-30 22:48:00.000000000 -0600 
     436+++ src/cdrom/macosx/CDPlayer.c 2009-09-18 07:04:01.000000000 -0500 
     437@@ -1,6 +1,6 @@ 
     438 /* 
     439     SDL - Simple DirectMedia Layer 
     440-    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga 
     441+    Copyright (C) 1997-2009 Sam Lantinga 
     442  
     443     This library is free software; you can redistribute it and/or 
     444     modify it under the terms of the GNU Library General Public 
     445@@ -134,28 +134,37 @@ 
     446 { 
     447     HFSUniStr255      dataForkName; 
     448     OSStatus          theErr; 
     449-    SInt16            forkRefNum; 
     450+    FSIORefNum        forkRefNum; 
     451     SInt64            forkSize; 
     452     Ptr               forkData = 0; 
     453     ByteCount         actualRead; 
     454     CFDataRef         dataRef = 0; 
     455     CFPropertyListRef propertyListRef = 0; 
     456- 
     457+    int               i; 
     458     FSRefParam      fsRefPB; 
     459     FSRef           tocPlistFSRef; 
     460-     
     461+    FSRef           rootRef; 
     462     const char* error = "Unspecified Error"; 
     463-     
     464+    const UniChar uniName[] = { '.','T','O','C','.','p','l','i','s','t' }; 
     465+ 
     466+    theErr = FSGetVolumeInfo(theVolume, 0, 0, kFSVolInfoNone, 0, 0, &rootRef); 
     467+    if(theErr != noErr) { 
     468+        error = "FSGetVolumeInfo"; 
     469+        goto bail; 
     470+    } 
     471+ 
     472+    SDL_memset(&fsRefPB, '\0', sizeof (fsRefPB)); 
     473+ 
     474     /* get stuff from .TOC.plist */ 
     475-    fsRefPB.ioCompletion = NULL; 
     476-    fsRefPB.ioNamePtr = "\p.TOC.plist"; 
     477-    fsRefPB.ioVRefNum = theVolume; 
     478-    fsRefPB.ioDirID = 0; 
     479+    fsRefPB.ref = &rootRef; 
     480     fsRefPB.newRef = &tocPlistFSRef; 
     481-     
     482-    theErr = PBMakeFSRefSync (&fsRefPB); 
     483+    fsRefPB.nameLength = sizeof (uniName) / sizeof (uniName[0]); 
     484+    fsRefPB.name = uniName; 
     485+    fsRefPB.textEncodingHint = kTextEncodingUnknown; 
     486+ 
     487+    theErr = PBMakeFSRefUnicodeSync (&fsRefPB); 
     488     if(theErr != noErr) { 
     489-        error = "PBMakeFSRefSync"; 
     490+        error = "PBMakeFSRefUnicodeSync"; 
     491         goto bail; 
     492     } 
     493      
     494@@ -551,9 +560,9 @@ 
     495     { /*try {*/ 
     496         ComponentDescription desc; 
     497      
     498-        desc.componentType = kAudioUnitComponentType; 
     499-        desc.componentSubType = kAudioUnitSubType_Output; 
     500-        desc.componentManufacturer = kAudioUnitID_DefaultOutput; 
     501+        desc.componentType = kAudioUnitType_Output; 
     502+        desc.componentSubType = kAudioUnitSubType_DefaultOutput; 
     503+        desc.componentManufacturer = kAudioUnitManufacturer_Apple; 
     504         desc.componentFlags = 0; 
     505         desc.componentFlagsMask = 0; 
     506          
     507diff -ur src/cdrom/macosx/CDPlayer.h src/cdrom/macosx/CDPlayer.h 
     508--- src/cdrom/macosx/CDPlayer.h 2009-09-19 09:17:23.000000000 -0500 
     509+++ src/cdrom/macosx/CDPlayer.h 2009-09-18 07:01:02.000000000 -0500 
     510@@ -1,6 +1,6 @@ 
     511 /* 
     512     SDL - Simple DirectMedia Layer 
     513-    Copyright (C) 1997-2004 Sam Lantinga 
     514+    Copyright (C) 1997-2009 Sam Lantinga 
     515  
     516     This library is free software; you can redistribute it and/or 
     517     modify it under the terms of the GNU Library General Public 
     518diff -ur src/cdrom/macosx/SDLOSXCAGuard.c src/cdrom/macosx/SDLOSXCAGuard.c 
     519--- src/cdrom/macosx/SDLOSXCAGuard.c    2007-12-30 22:48:00.000000000 -0600 
     520+++ src/cdrom/macosx/SDLOSXCAGuard.c    2009-09-15 16:45:29.000000000 -0500 
     521@@ -1,6 +1,6 @@ 
     522 /* 
     523     SDL - Simple DirectMedia Layer 
     524-    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga 
     525+    Copyright (C) 1997-2009 Sam Lantinga 
     526  
     527     This library is free software; you can redistribute it and/or 
     528     modify it under the terms of the GNU Library General Public 
     529diff -ur src/cdrom/macosx/SDLOSXCAGuard.h src/cdrom/macosx/SDLOSXCAGuard.h 
     530--- src/cdrom/macosx/SDLOSXCAGuard.h    2007-12-30 22:48:00.000000000 -0600 
     531+++ src/cdrom/macosx/SDLOSXCAGuard.h    2009-09-15 16:45:29.000000000 -0500 
     532@@ -1,6 +1,6 @@ 
     533 /* 
     534     SDL - Simple DirectMedia Layer 
     535-    Copyright (C) 1997-2004 Sam Lantinga 
     536+    Copyright (C) 1997-2009 Sam Lantinga 
     537  
     538     This library is free software; you can redistribute it and/or 
     539     modify it under the terms of the GNU Library General Public 
     540diff -ur src/cdrom/macosx/SDL_syscdrom.c src/cdrom/macosx/SDL_syscdrom.c 
     541--- src/cdrom/macosx/SDL_syscdrom.c     2007-12-30 22:48:00.000000000 -0600 
     542+++ src/cdrom/macosx/SDL_syscdrom.c     2009-09-18 07:04:20.000000000 -0500 
     543@@ -1,6 +1,6 @@ 
     544 /* 
     545     SDL - Simple DirectMedia Layer 
     546-    Copyright (C) 1997-2006 Sam Lantinga 
     547+    Copyright (C) 1997-2009 Sam Lantinga 
     548  
     549     This library is free software; you can redistribute it and/or 
     550     modify it under the terms of the GNU Lesser General Public 
     551@@ -263,6 +263,14 @@ 
     552 /* Get the Unix disk name of the volume */ 
     553 static const char *SDL_SYS_CDName (int drive) 
     554 { 
     555+    /* 
     556+     * !!! FIXME: PBHGetVolParmsSync() is gone in 10.6, 
     557+     * !!! FIXME:  replaced with FSGetVolumeParms(), which 
     558+     * !!! FIXME:  isn't available before 10.5.  :/ 
     559+     */ 
     560+    return "Mac OS X CD-ROM Device"; 
     561+ 
     562+#if 0 
     563     OSStatus     err = noErr; 
     564     HParamBlockRec  pb; 
     565     GetVolParmsInfoBuffer   volParmsInfo; 
     566@@ -282,6 +290,7 @@ 
     567     } 
     568  
     569     return volParmsInfo.vMDeviceID; 
     570+#endif 
     571 } 
     572  
     573 /* Open the "device" */ 
     574diff -ur src/cdrom/macosx/SDL_syscdrom_c.h src/cdrom/macosx/SDL_syscdrom_c.h 
     575--- src/cdrom/macosx/SDL_syscdrom_c.h   2007-12-30 22:48:00.000000000 -0600 
     576+++ src/cdrom/macosx/SDL_syscdrom_c.h   2009-09-15 16:45:29.000000000 -0500 
     577@@ -1,6 +1,6 @@ 
     578 /* 
     579     SDL - Simple DirectMedia Layer 
     580-    Copyright (C) 1997-2004 Sam Lantinga 
     581+    Copyright (C) 1997-2009 Sam Lantinga 
     582  
     583     This library is free software; you can redistribute it and/or 
     584     modify it under the terms of the GNU Library General Public