Update of /cvsroot/fink/dists/10.4/unstable/main/finkinfo/games
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20764

Modified Files:
        sdl-mixer.info 
Added Files:
        sdl-mixer.patch 
Log Message:
Added patch for building on Intel, thanks to Keith Conger.

--- NEW FILE: sdl-mixer.patch ---
diff -Naur SDL_mixer-1.2.6-orig/native_midi/native_midi_mac.c 
SDL_mixer-1.2.6/native_midi/native_midi_mac.c
--- SDL_mixer-1.2.6-orig/native_midi/native_midi_mac.c  2006-03-10 
10:48:19.000000000 -0500
+++ SDL_mixer-1.2.6/native_midi/native_midi_mac.c       2006-03-10 
10:48:55.000000000 -0500
@@ -95,13 +95,81 @@
        int                             part_poly_max[32];
        int                             numParts = 0;
        Uint16                  ppqn;
+       SDL_RWops               *rw;
 
        /* Init the arrays */
        memset(part_poly_max,0,sizeof(part_poly_max));
        memset(part_to_inst,-1,sizeof(part_to_inst));
        
        /* Attempt to load the midi file */
-       evntlist = CreateMIDIEventList(midifile, &ppqn);
+       rw = SDL_RWFromFile(midifile, "rb");
+       if (rw) {
+               evntlist = CreateMIDIEventList(rw, &ppqn);
+               SDL_RWclose(rw);
+               if (!evntlist)
+                       goto bail;
+       }
+
+       /* Allocate memory for the song struct */
+       song = malloc(sizeof(NativeMidiSong));
+       if (!song)
+               goto bail;
+
+       /* Build a tune sequence from the event list */
+       song->tuneSequence = BuildTuneSequence(evntlist, ppqn, part_poly_max, 
part_to_inst, &numParts);
+       if(!song->tuneSequence)
+               goto bail;
+
+       /* Now build a tune header from the data we collect above, create
+          all parts as needed and assign them the correct instrument.
+       */
+       song->tuneHeader = BuildTuneHeader(part_poly_max, part_to_inst, 
numParts);
+       if(!song->tuneHeader)
+               goto bail;
+       
+       /* Increment the instance count */
+       gInstaceCount++;
+       if (gTunePlayer == NULL)
+               gTunePlayer = OpenDefaultComponent(kTunePlayerComponentType, 0);
+
+       /* Finally, free the event list */
+       FreeMIDIEventList(evntlist);
+       
+       return song;
+       
+bail:
+       if (evntlist)
+               FreeMIDIEventList(evntlist);
+       
+       if (song)
+       {
+               if(song->tuneSequence)
+                       free(song->tuneSequence);
+               
+               if(song->tuneHeader)
+                       DisposePtr((Ptr)song->tuneHeader);
+
+               free(song);
+       }
+       
+       return NULL;
+}
+
+NativeMidiSong *native_midi_loadsong_RW(SDL_RWops *rw)
+{
+       NativeMidiSong  *song = NULL;
+       MIDIEvent               *evntlist = NULL;
+       int                             part_to_inst[32];
+       int                             part_poly_max[32];
+       int                             numParts = 0;
+       Uint16                  ppqn;
+
+       /* Init the arrays */
+       memset(part_poly_max,0,sizeof(part_poly_max));
+       memset(part_to_inst,-1,sizeof(part_to_inst));
+       
+       /* Attempt to load the midi file */
+       evntlist = CreateMIDIEventList(rw, &ppqn);
        if (!evntlist)
                goto bail;
 
@@ -591,8 +659,22 @@
                qtma_StuffGeneralEvent(*myPos1, *myPos2, part, 
kGeneralEventNoteRequest, kNoteRequestEventLength);
                myNoteRequest = (NoteRequest *)(myPos1 + 1);
                myNoteRequest->info.flags = 0;
+               /* I'm told by the Apple people that the Quicktime types were 
poorly designed and it was 
+                * too late to change them. On little endian, the 
BigEndian(Short|Fixed) types are structs
+                * while on big endian they are primitive types. Furthermore, 
Quicktime failed to 
+                * provide setter and getter functions. To get this to work, we 
need to case the 
+                * code for the two possible situations.
+                * My assumption is that the right-side value was always 
expected to be BigEndian
+                * as it was written way before the Universal Binary 
transition. So in the little endian
+                * case, OSSwap is used.
+                */
+#if __LITTLE_ENDIAN__
+               myNoteRequest->info.polyphony.bigEndianValue = 
OSSwapHostToBigInt16(part_poly_max[part]);
+               myNoteRequest->info.typicalPolyphony.bigEndianValue = 
OSSwapHostToBigInt32(0x00010000);
+#else
                myNoteRequest->info.polyphony = part_poly_max[part];
                myNoteRequest->info.typicalPolyphony = 0x00010000;
+#endif
                myErr = 
NAStuffToneDescription(myNoteAllocator,part_to_inst[part],&myNoteRequest->tone);
                if (myErr != noErr)
                        goto bail;

Index: sdl-mixer.info
===================================================================
RCS file: /cvsroot/fink/dists/10.4/unstable/main/finkinfo/games/sdl-mixer.info,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sdl-mixer.info      21 Feb 2006 14:57:23 -0000      1.2
+++ sdl-mixer.info      11 Mar 2006 23:48:19 -0000      1.3
@@ -1,7 +1,7 @@
 Package: sdl-mixer
 Version: 1.2.6
-Revision: 1012
-Architecture: powerpc
+Revision: 1013
+Patch: %N.patch
 Maintainer: Max Horn <[EMAIL PROTECTED]>
 Depends: %N-shlibs (= %v-%r)
 Conflicts: %N-bin (<< 1.2.5-1)
@@ -12,7 +12,7 @@
 Source-MD5: 2b8beffad9179d80e598c22c80efb135
 SetCPPFLAGS: -no-cpp-precomp
 GCC: 4.0
-ConfigureParams: --disable-sdltest
+ConfigureParams: --disable-sdltest --disable-dependency-tracking
 InstallScript: make install DESTDIR=%d
 SplitOff: <<
   Package: %N-shlibs
@@ -24,8 +24,5 @@
 <<
 Docfiles: CHANGES COPYING README
 Description: SDL multi-channel audio mixer library
-DescPort: <<
- Doesn't compile on intel; the code appears to need some tweaking.
-<<
 Homepage: http://www.libsdl.org/projects/SDL_mixer/
 License: LGPL



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to