Update of /cvsroot/fink/dists/10.4/stable/main/finkinfo/games In directory vz-cvs-3.sog:/tmp/cvs-serv32545/stable/main/finkinfo/games
Modified Files: sdl.info sdl.patch Log Message: Move latest sdl.info to 10.4/stable Index: sdl.patch =================================================================== RCS file: /cvsroot/fink/dists/10.4/stable/main/finkinfo/games/sdl.patch,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- sdl.patch 1 Feb 2010 12:38:56 -0000 1.5 +++ sdl.patch 17 Oct 2011 12:26:46 -0000 1.6 @@ -1,21 +1,103 @@ -diff -ru SDL-1.2.14/src/cpuinfo/SDL_cpuinfo.c /Users/mhorn/Projekte/foreign/SDL/SDL-1.2/src/cpuinfo/SDL_cpuinfo.c ---- SDL-1.2.14/src/cpuinfo/SDL_cpuinfo.c 2009-10-13 01:07:14.000000000 +0200 -+++ /Users/mhorn/Projekte/foreign/SDL/SDL-1.2/src/cpuinfo/SDL_cpuinfo.c 2009-11-01 20:30:29.000000000 +0100 -@@ -148,7 +148,7 @@ +diff -ru SDL-1.2.14/build-scripts/fatbuild.sh SDL-1.2.14-patched/build-scripts/fatbuild.sh +--- SDL-1.2.14/build-scripts/fatbuild.sh 2009-10-13 00:07:12.000000000 +0100 ++++ SDL-1.2.14-patched/build-scripts/fatbuild.sh 2011-07-11 10:23:52.000000000 +0100 +@@ -70,6 +70,17 @@ + CONFIG_X86="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \ + --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib" + ++# They changed this to "darwin10" in Xcode 3.2 (Snow Leopard). ++GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1" ++if [ ! -d "$GCCUSRPATH" ]; then ++ GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1" ++fi ++ ++if [ ! -d "$GCCUSRPATH" ]; then ++ echo "Couldn't find any GCC usr path" ++ exit 1 ++fi ++ + # Intel compiler flags + CC_X86="gcc-4.0 -arch i386" + CXX_X86="g++-4.0 -arch i386" +@@ -77,12 +88,12 @@ + CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ + -nostdinc \ + -F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \ +--I$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include \ ++-I$GCCUSRPATH/include \ + -isystem $SDK_PATH/MacOSX10.4u.sdk/usr/include" + + # Intel linker flags + LFLAGS_X86="-Wl,-headerpad_max_install_names -arch i386 -mmacosx-version-min=10.4 \ +--L$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1 \ ++-L$GCCUSRPATH \ + -Wl,-syslibroot,$SDK_PATH/MacOSX10.4u.sdk" + + # +diff -ru SDL-1.2.14/build-scripts/makedep.sh SDL-1.2.14-patched/build-scripts/makedep.sh +--- SDL-1.2.14/build-scripts/makedep.sh 2009-10-13 00:07:12.000000000 +0100 ++++ SDL-1.2.14-patched/build-scripts/makedep.sh 2011-07-11 10:23:52.000000000 +0100 +@@ -69,7 +69,7 @@ + ;; + asm) cat >>${output}.new <<__EOF__ + +- \$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) $src -o \$@ ++ \$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) -I\$(srcdir)/src/hermes/ $src -o \$@ + + __EOF__ + ;; +diff -ru SDL-1.2.14/include/SDL_endian.h SDL-1.2.14-patched/include/SDL_endian.h +--- SDL-1.2.14/include/SDL_endian.h 2009-10-13 00:07:19.000000000 +0100 ++++ SDL-1.2.14-patched/include/SDL_endian.h 2011-07-11 10:23:52.000000000 +0100 +@@ -94,7 +94,7 @@ + } + #else + static __inline__ Uint16 SDL_Swap16(Uint16 x) { +- return((x<<8)|(x>>8)); ++ return SDL_static_cast(Uint16, ((x<<8)|(x>>8))); + } + #endif + +@@ -129,7 +129,7 @@ + } + #else + static __inline__ Uint32 SDL_Swap32(Uint32 x) { +- return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24)); ++ return SDL_static_cast(Uint32, ((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24))); + } + #endif + +diff -ru SDL-1.2.14/src/cpuinfo/SDL_cpuinfo.c SDL-1.2.14-patched/src/cpuinfo/SDL_cpuinfo.c +--- SDL-1.2.14/src/cpuinfo/SDL_cpuinfo.c 2009-10-13 00:07:14.000000000 +0100 ++++ SDL-1.2.14-patched/src/cpuinfo/SDL_cpuinfo.c 2011-07-11 10:23:52.000000000 +0100 +@@ -26,7 +26,7 @@ + #include "SDL.h" + #include "SDL_cpuinfo.h" + +-#if defined(__MACOSX__) && defined(__ppc__) ++#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) + #include <sys/sysctl.h> /* For AltiVec check */ + #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP + #include <signal.h> +@@ -148,67 +148,77 @@ int features = 0; #if defined(__GNUC__) && defined(i386) __asm__ ( -" movl %%ebx,%%edi\n" -+" pushl %%ebx\n" " xorl %%eax,%%eax # Set up for CPUID instruction \n" ++" pushl %%ebx \n" " cpuid # Get and save vendor ID \n" ++" popl %%ebx \n" " cmpl $1,%%eax # Make sure 1 is valid input for CPUID\n" -@@ -158,14 +158,14 @@ + " jl 1f # We dont have the CPUID instruction\n" + " xorl %%eax,%%eax \n" + " incl %%eax \n" ++" pushl %%ebx \n" " cpuid # Get family/model/stepping/features\n" ++" popl %%ebx \n" " movl %%edx,%0 \n" "1: \n" -" movl %%edi,%%ebx\n" -+" popl %%ebx\n" : "=m" (features) : - : "%eax", "%ecx", "%edx", "%edi" @@ -24,16 +106,20 @@ #elif defined(__GNUC__) && defined(__x86_64__) __asm__ ( -" movq %%rbx,%%rdi\n" -+" pushq %%rbx\n" " xorl %%eax,%%eax # Set up for CPUID instruction \n" ++" pushq %%rbx \n" " cpuid # Get and save vendor ID \n" ++" popq %%rbx \n" " cmpl $1,%%eax # Make sure 1 is valid input for CPUID\n" -@@ -175,10 +175,10 @@ + " jl 1f # We dont have the CPUID instruction\n" + " xorl %%eax,%%eax \n" + " incl %%eax \n" ++" pushq %%rbx \n" " cpuid # Get family/model/stepping/features\n" ++" popq %%rbx \n" " movl %%edx,%0 \n" "1: \n" -" movq %%rdi,%%rbx\n" -+" popq %%rbx\n" : "=m" (features) : - : "%rax", "%rbx", "%rcx", "%rdx", "%rdi" @@ -41,39 +127,62 @@ ); #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) __asm { -@@ -194,7 +194,7 @@ + xor eax, eax ; Set up for CPUID instruction ++ push ebx + cpuid ; Get and save vendor ID ++ pop ebx + cmp eax, 1 ; Make sure 1 is valid input for CPUID + jl done ; We dont have the CPUID instruction + xor eax, eax + inc eax ++ push ebx + cpuid ; Get family/model/stepping/features ++ pop ebx + mov features, edx + done: } #elif defined(__sun) && (defined(__i386) || defined(__amd64)) __asm( -" movl %ebx,%edi\n" -+" pushl %ebx\n" " xorl %eax,%eax \n" ++" pushl %ebx \n" " cpuid \n" ++" popl %ebx \n" " cmpl $1,%eax \n" -@@ -208,7 +208,7 @@ + " jl 1f \n" + " xorl %eax,%eax \n" + " incl %eax \n" ++" pushl %ebx \n" + " cpuid \n" ++" popl %ebx \n" + #ifdef __i386 + " movl %edx,-8(%ebp) \n" + #else " movl %edx,-8(%rbp) \n" #endif "1: \n" -" movl %edi,%ebx\n" ); -+" popl %ebx\n" ); #endif return features; } -@@ -218,7 +218,7 @@ +@@ -218,63 +228,73 @@ int features = 0; #if defined(__GNUC__) && defined(i386) __asm__ ( -" movl %%ebx,%%edi\n" -+" pushl %%ebx\n" " movl $0x80000000,%%eax # Query for extended functions \n" ++" pushl %%ebx \n" " cpuid # Get extended function limit \n" ++" popl %%ebx \n" " cmpl $0x80000001,%%eax \n" -@@ -227,14 +227,14 @@ + " jl 1f # Nope, we dont have function 800000001h\n" + " movl $0x80000001,%%eax # Setup extended function 800000001h\n" ++" pushl %%ebx \n" " cpuid # and get the information \n" ++" popl %%ebx \n" " movl %%edx,%0 \n" "1: \n" -" movl %%edi,%%ebx\n" -+" popl %%ebx\n" : "=m" (features) : - : "%eax", "%ecx", "%edx", "%edi" @@ -82,16 +191,19 @@ #elif defined(__GNUC__) && defined (__x86_64__) __asm__ ( -" movq %%rbx,%%rdi\n" -+" pushq %%rbx\n" " movl $0x80000000,%%eax # Query for extended functions \n" ++" pushq %%rbx \n" " cpuid # Get extended function limit \n" ++" popq %%rbx \n" " cmpl $0x80000001,%%eax \n" -@@ -243,10 +243,10 @@ + " jl 1f # Nope, we dont have function 800000001h\n" + " movl $0x80000001,%%eax # Setup extended function 800000001h\n" ++" pushq %%rbx \n" " cpuid # and get the information \n" ++" popq %%rbx \n" " movl %%edx,%0 \n" "1: \n" -" movq %%rdi,%%rbx\n" -+" popq %%rbx\n" : "=m" (features) : - : "%rax", "%rbx", "%rcx", "%rdx", "%rdi" @@ -99,27 +211,249 @@ ); #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) __asm { -@@ -261,7 +261,7 @@ + mov eax,80000000h ; Query for extended functions ++ push ebx + cpuid ; Get extended function limit ++ pop ebx + cmp eax,80000001h + jl done ; Nope, we dont have function 800000001h + mov eax,80000001h ; Setup extended function 800000001h ++ push ebx + cpuid ; and get the information ++ pop ebx + mov features,edx + done: } #elif defined(__sun) && ( defined(__i386) || defined(__amd64) ) __asm ( -" movl %ebx,%edi\n" -+" pushl %ebx\n" " movl $0x80000000,%eax \n" ++" pushl %ebx \n" " cpuid \n" ++" popl %ebx \n" " cmpl $0x80000001,%eax \n" -@@ -274,7 +274,7 @@ + " jl 1f \n" + " movl $0x80000001,%eax \n" ++" pushl %ebx \n" + " cpuid \n" ++" popl %ebx \n" + #ifdef __i386 + " movl %edx,-8(%ebp) \n" + #else " movl %edx,-8(%rbp) \n" #endif "1: \n" -" movl %edi,%ebx\n" -+" popl %ebx\n" ); #endif return features; -diff -ru SDL-1.2.14/src/video/quartz/SDL_QuartzGL.m /Users/mhorn/Projekte/foreign/SDL/SDL-1.2/src/video/quartz/SDL_QuartzGL.m ---- SDL-1.2.14/src/video/quartz/SDL_QuartzGL.m 2009-10-13 01:07:14.000000000 +0200 -+++ /Users/mhorn/Projekte/foreign/SDL/SDL-1.2/src/video/quartz/SDL_QuartzGL.m 2009-10-23 14:52:29.000000000 +0200 +@@ -339,7 +359,7 @@ + static __inline__ int CPU_haveAltiVec(void) + { + volatile int altivec = 0; +-#if defined(__MACOSX__) && defined(__ppc__) ++#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) + int selectors[2] = { CTL_HW, HW_VECTORUNIT }; + int hasVectorUnit = 0; + size_t length = sizeof(hasVectorUnit); +diff -ru SDL-1.2.14/src/events/SDL_quit.c SDL-1.2.14-patched/src/events/SDL_quit.c +--- SDL-1.2.14/src/events/SDL_quit.c 2009-10-13 00:07:14.000000000 +0100 ++++ SDL-1.2.14-patched/src/events/SDL_quit.c 2011-07-11 10:23:52.000000000 +0100 +@@ -45,7 +45,19 @@ + /* Public functions */ + int SDL_QuitInit(void) + { +-#ifdef HAVE_SIGNAL_H ++#ifdef HAVE_SIGACTION ++ struct sigaction action; ++ sigaction(SIGINT, NULL, &action); ++ if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { ++ action.sa_handler = SDL_HandleSIG; ++ sigaction(SIGINT, &action, NULL); ++ } ++ sigaction(SIGTERM, NULL, &action); ++ if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { ++ action.sa_handler = SDL_HandleSIG; ++ sigaction(SIGTERM, &action, NULL); ++ } ++#elif HAVE_SIGNAL_H + void (*ohandler)(int); + + /* Both SIGINT and SIGTERM are translated into quit interrupts */ +@@ -62,7 +74,19 @@ + } + void SDL_QuitQuit(void) + { +-#ifdef HAVE_SIGNAL_H ++#ifdef HAVE_SIGACTION ++ struct sigaction action; ++ sigaction(SIGINT, NULL, &action); ++ if ( action.sa_handler == SDL_HandleSIG ) { ++ action.sa_handler = SIG_DFL; ++ sigaction(SIGINT, &action, NULL); ++ } ++ sigaction(SIGTERM, NULL, &action); ++ if ( action.sa_handler == SDL_HandleSIG ) { ++ action.sa_handler = SIG_DFL; ++ sigaction(SIGTERM, &action, NULL); ++ } ++#elif HAVE_SIGNAL_H + void (*ohandler)(int); + + ohandler = signal(SIGINT, SIG_DFL); +diff -ru SDL-1.2.14/src/joystick/SDL_joystick.c SDL-1.2.14-patched/src/joystick/SDL_joystick.c +--- SDL-1.2.14/src/joystick/SDL_joystick.c 2009-10-13 00:07:13.000000000 +0100 ++++ SDL-1.2.14-patched/src/joystick/SDL_joystick.c 2011-07-11 10:23:52.000000000 +0100 +@@ -113,6 +113,7 @@ + /* Create and initialize the joystick */ + joystick = (SDL_Joystick *)SDL_malloc((sizeof *joystick)); + if ( !joystick ) { ++ SDL_OutOfMemory(); + return(NULL); + } + +diff -ru SDL-1.2.14/src/stdlib/SDL_iconv.c SDL-1.2.14-patched/src/stdlib/SDL_iconv.c +--- SDL-1.2.14/src/stdlib/SDL_iconv.c 2009-10-13 00:07:13.000000000 +0100 ++++ SDL-1.2.14-patched/src/stdlib/SDL_iconv.c 2011-07-11 10:23:52.000000000 +0100 +@@ -383,7 +383,7 @@ + */ + ch = UNKNOWN_UNICODE; + } else { +- if ( (p[0] & 0xCE) == 0xC0 ) { ++ if ( (p[0] & 0xDE) == 0xC0 ) { + overlong = SDL_TRUE; + } + ch = (Uint32)(p[0] & 0x1F); +diff -ru SDL-1.2.14/src/thread/pthread/SDL_syssem.c SDL-1.2.14-patched/src/thread/pthread/SDL_syssem.c +--- SDL-1.2.14/src/thread/pthread/SDL_syssem.c 2009-10-13 00:07:16.000000000 +0100 ++++ SDL-1.2.14-patched/src/thread/pthread/SDL_syssem.c 2011-07-11 10:23:52.000000000 +0100 +@@ -97,6 +97,8 @@ + int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) + { + int retval; ++ struct timeval now; ++ struct timespec ts_timeout; + + if ( ! sem ) { + SDL_SetError("Passed a NULL semaphore"); +@@ -111,16 +113,33 @@ + return SDL_SemWait(sem); + } + +- /* Ack! We have to busy wait... */ +- /* FIXME: Use sem_timedwait()? */ +- timeout += SDL_GetTicks(); +- do { +- retval = SDL_SemTryWait(sem); +- if ( retval == 0 ) { +- break; +- } +- SDL_Delay(1); +- } while ( SDL_GetTicks() < timeout ); ++ /* Setup the timeout. sem_timedwait doesn't wait for ++ * a lapse of time, but until we reach a certain time. ++ * This time is now plus the timeout. ++ */ ++ gettimeofday(&now, NULL); ++ ++ /* Add our timeout to current time */ ++ now.tv_usec += (timeout % 1000) * 1000; ++ now.tv_sec += timeout / 1000; ++ ++ /* Wrap the second if needed */ ++ if ( now.tv_usec >= 1000000 ) { ++ now.tv_usec -= 1000000; ++ now.tv_sec ++; ++ } ++ ++ /* Convert to timespec */ ++ ts_timeout.tv_sec = now.tv_sec; ++ ts_timeout.tv_nsec = now.tv_usec * 1000; ++ ++ /* Wait. */ ++ do ++ retval = sem_timedwait(&sem->sem, &ts_timeout); ++ while (retval == -1 && errno == EINTR); ++ ++ if (retval == -1) ++ SDL_SetError(strerror(errno)); + + return retval; + } +diff -ru SDL-1.2.14/src/video/SDL_blit.c SDL-1.2.14-patched/src/video/SDL_blit.c +--- SDL-1.2.14/src/video/SDL_blit.c 2009-10-13 00:07:15.000000000 +0100 ++++ SDL-1.2.14-patched/src/video/SDL_blit.c 2011-07-11 10:23:52.000000000 +0100 +@@ -214,7 +214,7 @@ + dstskip = w+info->d_skip; + if ( dst < src ) { + while ( h-- ) { +- SDL_memcpy(dst, src, w); ++ SDL_memmove(dst, src, w); + src += srcskip; + dst += dstskip; + } +diff -ru SDL-1.2.14/src/video/SDL_stretch.c SDL-1.2.14-patched/src/video/SDL_stretch.c +--- SDL-1.2.14/src/video/SDL_stretch.c 2009-10-19 09:08:00.000000000 +0100 ++++ SDL-1.2.14-patched/src/video/SDL_stretch.c 2011-07-11 10:23:52.000000000 +0100 +@@ -78,7 +78,7 @@ + + int i; + int pos, inc; +- unsigned char *eip; ++ unsigned char *eip, *fence; + unsigned char load, store; + + /* See if we need to regenerate the copy buffer */ +@@ -115,14 +115,21 @@ + pos = 0x10000; + inc = (src_w << 16) / dst_w; + eip = copy_row; +- for ( i=0; i<dst_w; ++i ) { ++ fence = copy_row+sizeof(copy_row)-2; ++ for ( i=0; i<dst_w && eip < end; ++i ) { + while ( pos >= 0x10000L ) { ++ if ( eip == fence ) { ++ return -1; ++ } + if ( bpp == 2 ) { + *eip++ = PREFIX16; + } + *eip++ = load; + pos -= 0x10000L; + } ++ if ( eip == fence ) { ++ return -1; ++ } + if ( bpp == 2 ) { + *eip++ = PREFIX16; + } +@@ -131,11 +138,6 @@ + } + *eip++ = RETURN; + +- /* Verify that we didn't overflow (too late!!!) */ +- if ( eip > (copy_row+sizeof(copy_row)) ) { +- SDL_SetError("Copy buffer overflow"); +- return(-1); +- } + #ifdef HAVE_MPROTECT + /* Make the code executable but not writeable */ + if ( mprotect(copy_row, sizeof(copy_row), PROT_READ|PROT_EXEC) < 0 ) { +diff -ru SDL-1.2.14/src/video/mmx.h SDL-1.2.14-patched/src/video/mmx.h +--- SDL-1.2.14/src/video/mmx.h 2009-10-13 00:07:15.000000000 +0100 ++++ SDL-1.2.14-patched/src/video/mmx.h 2011-07-11 10:23:52.000000000 +0100 +@@ -355,7 +355,7 @@ + + #define mmx_r2m(op, reg, mem) \ + __asm__ __volatile__ (#op " %%" #reg ", %0" \ +- : "=X" (mem) \ ++ : "=m" (mem) \ + : /* nothing */ ) + + #define mmx_r2r(op, regs, regd) \ +diff -ru SDL-1.2.14/src/video/quartz/SDL_QuartzGL.m SDL-1.2.14-patched/src/video/quartz/SDL_QuartzGL.m +--- SDL-1.2.14/src/video/quartz/SDL_QuartzGL.m 2009-10-13 00:07:14.000000000 +0100 ++++ SDL-1.2.14-patched/src/video/quartz/SDL_QuartzGL.m 2011-07-11 10:23:52.000000000 +0100 @@ -153,7 +153,7 @@ * http://lists.apple.com/archives/mac-opengl/2006/Jan/msg00080.html ) */ @@ -156,3 +490,499 @@ [ gl_context getValues: &val forParameter: NSOpenGLCPSwapInterval ]; *value = val; return 0; +diff -ru SDL-1.2.14/src/video/quartz/SDL_QuartzVideo.m SDL-1.2.14-patched/src/video/quartz/SDL_QuartzVideo.m +--- SDL-1.2.14/src/video/quartz/SDL_QuartzVideo.m 2009-10-17 08:45:42.000000000 +0100 ++++ SDL-1.2.14-patched/src/video/quartz/SDL_QuartzVideo.m 2011-08-02 21:47:57.000000000 +0100 +@@ -24,7 +24,7 @@ + #include "SDL_QuartzVideo.h" + #include "SDL_QuartzWindow.h" + +-#ifdef __powerpc__ /* I'm gambling they fixed this by 10.4. --ryan. */ ++#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 /* Fixed in Snow Leopard */ + /* + Add methods to get at private members of NSScreen. + Since there is a bug in Apple's screen switching code +@@ -84,25 +84,13 @@ + static int QZ_SetColors (_THIS, int first_color, + int num_colors, SDL_Color *colors); + +-static int QZ_LockDoubleBuffer (_THIS, SDL_Surface *surface); +-static void QZ_UnlockDoubleBuffer (_THIS, SDL_Surface *surface); +-static int QZ_ThreadFlip (_THIS); +-static int QZ_FlipDoubleBuffer (_THIS, SDL_Surface *surface); +-static void QZ_DoubleBufferUpdate (_THIS, int num_rects, SDL_Rect *rects); +- +-static void QZ_DirectUpdate (_THIS, int num_rects, SDL_Rect *rects); + static void QZ_UpdateRects (_THIS, int num_rects, SDL_Rect *rects); + static void QZ_VideoQuit (_THIS); + +-/* Hardware surface functions (for fullscreen mode only) */ +-#if 0 /* Not used (apparently, it's really slow) */ +-static int QZ_FillHWRect (_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color); +-#endif + static int QZ_LockHWSurface(_THIS, SDL_Surface *surface); + static void QZ_UnlockHWSurface(_THIS, SDL_Surface *surface); + static int QZ_AllocHWSurface(_THIS, SDL_Surface *surface); + static void QZ_FreeHWSurface (_THIS, SDL_Surface *surface); +-/* static int QZ_FlipHWSurface (_THIS, SDL_Surface *surface); */ + + /* Bootstrap binding, enables entry point into the driver */ + VideoBootStrap QZ_bootstrap = { +@@ -140,14 +128,13 @@ + device->ToggleFullScreen = QZ_ToggleFullScreen; + device->UpdateMouse = QZ_UpdateMouse; + device->SetColors = QZ_SetColors; +- /* device->UpdateRects = QZ_UpdateRects; this is determined by SetVideoMode() */ ++ device->UpdateRects = QZ_UpdateRects; + device->VideoQuit = QZ_VideoQuit; + + device->LockHWSurface = QZ_LockHWSurface; + device->UnlockHWSurface = QZ_UnlockHWSurface; + device->AllocHWSurface = QZ_AllocHWSurface; + device->FreeHWSurface = QZ_FreeHWSurface; +- /* device->FlipHWSurface = QZ_FlipHWSurface */; + + device->SetGamma = QZ_SetGamma; + device->GetGamma = QZ_GetGamma; +@@ -398,10 +385,6 @@ + { + /* Reset values that may change between switches */ + this->info.blit_fill = 0; +- this->FillHWRect = NULL; +- this->UpdateRects = NULL; +- this->LockHWSurface = NULL; +- this->UnlockHWSurface = NULL; + + if (cg_context) { + CGContextFlush (cg_context); +@@ -414,16 +397,6 @@ + + NSRect screen_rect; + +- /* Release double buffer stuff */ +- if ( mode_flags & SDL_DOUBLEBUF) { +- quit_thread = YES; +- SDL_SemPost (sem1); +- SDL_WaitThread (thread, NULL); +- SDL_DestroySemaphore (sem1); +- SDL_DestroySemaphore (sem2); +- SDL_free (sw_buffers[0]); +- } +- + /* If we still have a valid window, close it. */ + if ( qz_window ) { + NSCAssert([ qz_window delegate ] == nil, @"full screen window shouldn't have a delegate"); /* if that should ever change, we'd have to release it here */ +@@ -479,6 +452,12 @@ + NSRect contentRect; + CGDisplayFadeReservationToken fade_token = kCGDisplayFadeReservationInvalidToken; + ++ current->flags = SDL_FULLSCREEN; ++ current->w = width; ++ current->h = height; ++ ++ contentRect = NSMakeRect (0, 0, width, height); ++ + /* Fade to black to hide resolution-switching flicker (and garbage + that is displayed by a destroyed OpenGL context, if applicable) */ + if ( CGAcquireDisplayFadeReservation (5, &fade_token) == kCGErrorSuccess ) { +@@ -522,72 +501,19 @@ + goto ERR_NO_SWITCH; + } + +- current->pixels = (Uint32*) CGDisplayBaseAddress (display_id); +- current->pitch = CGDisplayBytesPerRow (display_id); +- +- current->flags = 0; +- current->w = width; +- current->h = height; +- current->flags |= SDL_FULLSCREEN; +- current->flags |= SDL_HWSURFACE; +- current->flags |= SDL_PREALLOC; +- /* current->hwdata = (void *) CGDisplayGetDrawingContext (display_id); */ +- +- this->UpdateRects = QZ_DirectUpdate; +- this->LockHWSurface = QZ_LockHWSurface; +- this->UnlockHWSurface = QZ_UnlockHWSurface; +- +- /* Setup double-buffer emulation */ +- if ( flags & SDL_DOUBLEBUF ) { +- +- /* +- Setup a software backing store for reasonable results when +- double buffering is requested (since a single-buffered hardware +- surface looks hideous). +- +- The actual screen blit occurs in a separate thread to allow +- other blitting while waiting on the VBL (and hence results in higher framerates). +- */ +- this->LockHWSurface = NULL; +- this->UnlockHWSurface = NULL; +- this->UpdateRects = NULL; +- +- current->flags |= (SDL_HWSURFACE|SDL_DOUBLEBUF); +- this->UpdateRects = QZ_DoubleBufferUpdate; +- this->LockHWSurface = QZ_LockDoubleBuffer; +- this->UnlockHWSurface = QZ_UnlockDoubleBuffer; +- this->FlipHWSurface = QZ_FlipDoubleBuffer; +- +- current->pixels = SDL_malloc (current->pitch * current->h * 2); +- if (current->pixels == NULL) { +- SDL_OutOfMemory (); +- goto ERR_DOUBLEBUF; +- } +- +- sw_buffers[0] = current->pixels; +- sw_buffers[1] = (Uint8*)current->pixels + current->pitch * current->h; +- +- quit_thread = NO; +- sem1 = SDL_CreateSemaphore (0); +- sem2 = SDL_CreateSemaphore (1); +- thread = SDL_CreateThread ((int (*)(void *))QZ_ThreadFlip, this); +- } +- +- if ( CGDisplayCanSetPalette (display_id) ) +- current->flags |= SDL_HWPALETTE; +- + /* Check if we should recreate the window */ + if (qz_window == nil) { + /* Manually create a window, avoids having a nib file resource */ + qz_window = [ [ SDL_QuartzWindow alloc ] + initWithContentRect:contentRect +- styleMask:0 ++ styleMask:NSBorderlessWindowMask + backing:NSBackingStoreBuffered + defer:NO ]; + + if (qz_window != nil) { + [ qz_window setAcceptsMouseMovedEvents:YES ]; + [ qz_window setViewsNeedDisplay:NO ]; ++ [ qz_window setContentView: [ [ [ SDL_QuartzView alloc ] init ] autorelease ] ]; + } + } + /* We already have a window, just change its size */ +@@ -603,6 +529,9 @@ + CGLError err; + CGLContextObj ctx; + ++ /* CGLSetFullScreen() will handle this for us. */ ++ [ qz_window setLevel:NSNormalWindowLevel ]; ++ + if ( ! QZ_SetupOpenGL (this, bpp, flags) ) { + goto ERR_NO_GL; + } +@@ -629,6 +558,38 @@ + + current->flags |= SDL_OPENGL; + } ++ /* For 2D, we build a CGBitmapContext */ ++ else { ++ CGColorSpaceRef cgColorspace; ++ ++ /* Only recreate the view if it doesn't already exist */ ++ if (window_view == nil) { ++ window_view = [ [ NSView alloc ] initWithFrame:contentRect ]; ++ [ window_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ]; ++ [ [ qz_window contentView ] addSubview:window_view ]; ++ [ window_view release ]; ++ } ++ ++ cgColorspace = CGColorSpaceCreateDeviceRGB(); ++ current->pitch = 4 * current->w; ++ current->pixels = SDL_malloc (current->h * current->pitch); ++ ++ cg_context = CGBitmapContextCreate (current->pixels, current->w, current->h, ++ 8, current->pitch, cgColorspace, ++ kCGImageAlphaNoneSkipFirst); ++ CGColorSpaceRelease (cgColorspace); ++ ++ current->flags |= SDL_SWSURFACE; ++ current->flags |= SDL_ASYNCBLIT; ++ current->hwdata = (void *) cg_context; ++ ++ /* Force this window to draw above _everything_. */ ++ [ qz_window setLevel:CGShieldingWindowLevel() ]; ++ } ++ ++ [ qz_window setHasShadow:NO]; ++ [ qz_window setOpaque:YES]; ++ [ qz_window makeKeyAndOrderFront:nil ]; + + /* If we don't hide menu bar, it will get events and interrupt the program */ + HideMenuBar (); +@@ -819,10 +780,6 @@ + current->flags |= SDL_SWSURFACE; + current->flags |= SDL_ASYNCBLIT; + current->hwdata = (void *) cg_context; +- +- this->UpdateRects = QZ_UpdateRects; +- this->LockHWSurface = QZ_LockHWSurface; +- this->UnlockHWSurface = QZ_UnlockHWSurface; + } + + /* Save flags to ensure correct teardown */ +@@ -843,6 +800,9 @@ + current->flags = 0; + current->pixels = NULL; + ++ /* Force bpp to 32 */ ++ bpp = 32; ++ + /* Setup full screen video */ + if ( flags & SDL_FULLSCREEN ) { + current = QZ_SetVideoFullScreen (this, current, width, height, bpp, flags ); +@@ -851,8 +811,6 @@ + } + /* Setup windowed video */ + else { +- /* Force bpp to 32 */ +- bpp = 32; + current = QZ_SetVideoWindowed (this, current, width, height, &bpp, flags); + if (current == NULL) + return NULL; +@@ -877,14 +835,6 @@ + return NULL; + case 32: /* (8)-8-8-8 ARGB */ + amask = 0x00000000; +- if ( flags & SDL_FULLSCREEN ) +- { +- rmask = 0x00FF0000; +- gmask = 0x0000FF00; +- bmask = 0x000000FF; +- } +- else +- { + #if SDL_BYTEORDER == SDL_LIL_ENDIAN + rmask = 0x0000FF00; + gmask = 0x00FF0000; +@@ -894,7 +844,6 @@ + gmask = 0x0000FF00; + bmask = 0x000000FF; + #endif +- } + break; + } + +@@ -940,164 +889,6 @@ + return 1; + } + +-static int QZ_LockDoubleBuffer (_THIS, SDL_Surface *surface) +-{ +- return 1; +-} +- +-static void QZ_UnlockDoubleBuffer (_THIS, SDL_Surface *surface) +-{ +-} +- +-/* The VBL delay is based on code by Ian R Ollmann's RezLib <i...@cco.caltech.edu> */ +-static AbsoluteTime QZ_SecondsToAbsolute ( double seconds ) +-{ +- union +- { +- UInt64 i; +- Nanoseconds ns; +- } temp; +- +- temp.i = seconds * 1000000000.0; +- +- return NanosecondsToAbsolute ( temp.ns ); +-} +- +-static int QZ_ThreadFlip (_THIS) +-{ +- Uint8 *src, *dst; +- int skip, len, h; +- +- /* +- Give this thread the highest scheduling priority possible, +- in the hopes that it will immediately run after the VBL delay +- */ +- { +- pthread_t current_thread; +- int policy; +- struct sched_param param; +- +- current_thread = pthread_self (); +- pthread_getschedparam (current_thread, &policy, ¶m); +- policy = SCHED_RR; +- param.sched_priority = sched_get_priority_max (policy); +- pthread_setschedparam (current_thread, policy, ¶m); +- } +- +- while (1) { +- +- SDL_SemWait (sem1); +- if (quit_thread) +- return 0; +- +- /* +- * We have to add SDL_VideoSurface->offset here, since we might be a +- * smaller surface in the center of the framebuffer (you asked for +- * a fullscreen resolution smaller than the hardware could supply +- * so SDL is centering it in a bigger resolution)... +- */ +- dst = (Uint8 *)CGDisplayBaseAddress (display_id) + SDL_VideoSurface->offset; +- src = current_buffer + SDL_VideoSurface->offset; +- len = SDL_VideoSurface->w * SDL_VideoSurface->format->BytesPerPixel; +- h = SDL_VideoSurface->h; +- skip = SDL_VideoSurface->pitch; +- +- /* Wait for the VBL to occur (estimated since we don't have a hardware interrupt) */ +- { +- +- /* The VBL delay is based on Ian Ollmann's RezLib <i...@cco.caltech.edu> */ +- double refreshRate; +- double linesPerSecond; +- double target; +- double position; +- double adjustment; +- AbsoluteTime nextTime; +- CFNumberRef refreshRateCFNumber; +- +- refreshRateCFNumber = CFDictionaryGetValue (mode, kCGDisplayRefreshRate); +- if ( NULL == refreshRateCFNumber ) { +- SDL_SetError ("Mode has no refresh rate"); +- goto ERROR; +- } +- +- if ( 0 == CFNumberGetValue (refreshRateCFNumber, kCFNumberDoubleType, &refreshRate) ) { +- SDL_SetError ("Error getting refresh rate"); +- goto ERROR; +- } +- +- if ( 0 == refreshRate ) { +- +- SDL_SetError ("Display has no refresh rate, using 60hz"); +- +- /* ok, for LCD's we'll emulate a 60hz refresh, which may or may not look right */ +- refreshRate = 60.0; +- } +- +- linesPerSecond = refreshRate * h; +- target = h; +- +- /* Figure out the first delay so we start off about right */ +- position = CGDisplayBeamPosition (display_id); +- if (position > target) +- position = 0; +- +- adjustment = (target - position) / linesPerSecond; +- +- nextTime = AddAbsoluteToAbsolute (UpTime (), QZ_SecondsToAbsolute (adjustment)); +- +- MPDelayUntil (&nextTime); +- } +- +- +- /* On error, skip VBL delay */ +- ERROR: +- +- /* TODO: use CGContextDrawImage here too! Create two CGContextRefs the same way we +- create two buffers, replace current_buffer with current_context and set it +- appropriately in QZ_FlipDoubleBuffer. */ +- while ( h-- ) { +- +- SDL_memcpy (dst, src, len); +- src += skip; +- dst += skip; +- } +- +- /* signal flip completion */ +- SDL_SemPost (sem2); +- } +- +- return 0; +-} +- +-static int QZ_FlipDoubleBuffer (_THIS, SDL_Surface *surface) +-{ +- /* wait for previous flip to complete */ +- SDL_SemWait (sem2); +- +- current_buffer = surface->pixels; +- +- if (surface->pixels == sw_buffers[0]) +- surface->pixels = sw_buffers[1]; +- else +- surface->pixels = sw_buffers[0]; +- +- /* signal worker thread to do the flip */ +- SDL_SemPost (sem1); +- +- return 0; +-} +- +-static void QZ_DoubleBufferUpdate (_THIS, int num_rects, SDL_Rect *rects) +-{ +- /* perform a flip if someone calls updaterects on a doublebuferred surface */ +- this->FlipHWSurface (this, SDL_VideoSurface); +-} +- +-static void QZ_DirectUpdate (_THIS, int num_rects, SDL_Rect *rects) +-{ +-#pragma unused(this,num_rects,rects) +-} +- + + /* Resize icon, BMP format */ + static const unsigned char QZ_ResizeIcon[] = { +@@ -1192,7 +983,6 @@ + CGContextDrawImage (cgc, rectangle, image); + CGImageRelease(image); + CGContextFlush (cgc); +- CGContextRelease (cgc); + } + } + +@@ -1236,15 +1026,6 @@ + } + } + +-#if 0 /* Not used (apparently, it's really slow) */ +-static int QZ_FillHWRect (_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color) +-{ +- CGSDisplayHWFill (display_id, rect->x, rect->y, rect->w, rect->h, color); +- +- return 0; +-} +-#endif +- + static int QZ_LockHWSurface(_THIS, SDL_Surface *surface) + { + return 1; +@@ -1263,12 +1044,6 @@ + { + } + +-/* +- int QZ_FlipHWSurface (_THIS, SDL_Surface *surface) { +- return 0; +- } +- */ +- + /* Gamma functions */ + int QZ_SetGamma (_THIS, float red, float green, float blue) + { +diff -ru SDL-1.2.14/src/video/quartz/SDL_QuartzWM.m SDL-1.2.14-patched/src/video/quartz/SDL_QuartzWM.m +--- SDL-1.2.14/src/video/quartz/SDL_QuartzWM.m 2009-10-13 00:07:14.000000000 +0100 ++++ SDL-1.2.14-patched/src/video/quartz/SDL_QuartzWM.m 2011-07-11 10:23:52.000000000 +0100 +@@ -151,14 +151,16 @@ + /* Convert Cocoa screen coordinate to Cocoa window coordinate */ + void QZ_PrivateGlobalToLocal (_THIS, NSPoint *p) { + +- *p = [ qz_window convertScreenToBase:*p ]; ++ if ( ! CGDisplayIsCaptured (display_id) ) ++ *p = [ qz_window convertScreenToBase:*p ]; + } + + + /* Convert Cocoa window coordinate to Cocoa screen coordinate */ + void QZ_PrivateLocalToGlobal (_THIS, NSPoint *p) { + +- *p = [ qz_window convertBaseToScreen:*p ]; ++ if ( ! CGDisplayIsCaptured (display_id) ) ++ *p = [ qz_window convertBaseToScreen:*p ]; + } + + /* Convert SDL coordinate to Cocoa coordinate */ Index: sdl.info =================================================================== RCS file: /cvsroot/fink/dists/10.4/stable/main/finkinfo/games/sdl.info,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- sdl.info 9 May 2010 01:55:34 -0000 1.11 +++ sdl.info 17 Oct 2011 12:26:46 -0000 1.12 @@ -16,15 +16,15 @@ Package: sdl Version: 1.2.14 -Revision: 5 +Revision: 8 BuildDependsOnly: True Depends: %N-shlibs (= %v-%r) -BuildDepends: x11-dev, fink (>= 0.24.12), (%m = x86_64) gcc4.2 +BuildDepends: x11-dev, fink (>= 0.24.12) Maintainer: Max Horn <m...@quendi.de> Source: http://www.libsdl.org/release/SDL-%v.tar.gz Source-MD5: e52086d1b508fa0b76c52ee30b55bec4 PatchFile: %n.patch -PatchFile-MD5: a4d66600e3a1d5394efe492d26330446 +PatchFile-MD5: 0f88d799bcb4af8c6632614cb49efe7c ConfigureParams: --mandir=%p/share/man CompileScript: ./configure %c; DISTCC_HOSTS='' MAKEFLAGS='-j1' make InstallScript: make install DESTDIR=%d @@ -39,9 +39,14 @@ Added DISTCC_HOSTS='' MAKEFLAGS='-j1' to avoid the -fconstant-cfstrings warning when building with distcc (-- rangerr...@fink.sourceforge.net). - Fix problem in SDL_cpuinfo.c by backporting fix from SDL SVN. - - Fix some warnings occuring on x86_64 in SDL_QuartzGL.m, from SDL SVN. + Backported several fixes from the SDL 1.2 Mercurial repository: + * Fix problems in SDL_cpuinfo.c + * Fix incompatibility with clang + * Fix some warnings occuring on x86_64 in Quartz video driver + * Fix double release of graphics context in Quartz video driver + * Fix issue with multi-screen setups resp. with hardware that can + switch between multiple graphics chips (like recent MBP). + * Various other fixes and improvments << DocFiles: BUGS COPYING CREDITS README README-SDL.txt README.MacOSX TODO Description: Cross-platform multimedia library ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ Fink-commits mailing list Fink-commits@lists.sourceforge.net http://news.gmane.org/gmane.os.apple.fink.cvs