summaryrefslogtreecommitdiff
path: root/audio/xmp
diff options
context:
space:
mode:
authortron <tron>2006-06-30 12:54:37 +0000
committertron <tron>2006-06-30 12:54:37 +0000
commit7665409177cda5e8922e06771483426c0358e48f (patch)
treed5cbb756b035c0de282cf88e8edcf17a7333a5c1 /audio/xmp
parent317238665715b81c18a778a1bf5e051f36a83921 (diff)
downloadpkgsrc-7665409177cda5e8922e06771483426c0358e48f.tar.gz
Fix a lot of horrible Spaghetti code which prevented this package from
building with GCC 4.1.x. While doing this fix some of the portability problems for big endian system. This package needs a lot of work before it will work with either big-endian or LP64. It should probably be removed because it seesm to be unmaintained since 2001.
Diffstat (limited to 'audio/xmp')
-rw-r--r--audio/xmp/distinfo6
-rw-r--r--audio/xmp/patches/patch-ak13
-rw-r--r--audio/xmp/patches/patch-al13
-rw-r--r--audio/xmp/patches/patch-am155
-rw-r--r--audio/xmp/patches/patch-an159
5 files changed, 345 insertions, 1 deletions
diff --git a/audio/xmp/distinfo b/audio/xmp/distinfo
index 89092403f0b..0a087add0b3 100644
--- a/audio/xmp/distinfo
+++ b/audio/xmp/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.8 2005/12/11 20:20:34 joerg Exp $
+$NetBSD: distinfo,v 1.9 2006/06/30 12:54:37 tron Exp $
SHA1 (xmp-2.0.4.tar.bz2) = 35c1578f2f6728aa2ec92f34ada050e328694167
RMD160 (xmp-2.0.4.tar.bz2) = c1c0c3af63d1f3e43fe6b47ca55725e0922fe2f1
@@ -13,3 +13,7 @@ SHA1 (patch-ag) = 431875a9a1889e0c63620c04a78473116c090fae
SHA1 (patch-ah) = d6119a1d0ef33bf58bd443b2f18d72cb9ea1956a
SHA1 (patch-ai) = 7882313a892f2043a051fdc2b49161ae209824ba
SHA1 (patch-aj) = 5364b5135e8e2bd60bbf6cbcd00adac99611f2ce
+SHA1 (patch-ak) = 93a9abfc66a526d52bd62ece5b9d8cd727f816e7
+SHA1 (patch-al) = 902a0c5311f560d5bf01e3946d785bca932131d3
+SHA1 (patch-am) = 601b55de29ca76ab4671fc3470181544b5770f1a
+SHA1 (patch-an) = bd021634555751a78cc1f5af61aa83c4d1e3287f
diff --git a/audio/xmp/patches/patch-ak b/audio/xmp/patches/patch-ak
new file mode 100644
index 00000000000..fa6ca4be397
--- /dev/null
+++ b/audio/xmp/patches/patch-ak
@@ -0,0 +1,13 @@
+$NetBSD: patch-ak,v 1.1 2006/06/30 12:54:38 tron Exp $
+
+--- src/drivers/file.c.orig 2000-12-29 18:08:07.000000000 +0000
++++ src/drivers/file.c 2006-06-30 11:43:38.000000000 +0100
+@@ -91,7 +91,7 @@
+ while (i) {
+ if ((j = write (audio_fd, b, i)) > 0) {
+ i -= j;
+- (char *)b += j;
++ b = (char *)b + j;
+ } else
+ break;
+ };
diff --git a/audio/xmp/patches/patch-al b/audio/xmp/patches/patch-al
new file mode 100644
index 00000000000..2e1d4820c23
--- /dev/null
+++ b/audio/xmp/patches/patch-al
@@ -0,0 +1,13 @@
+$NetBSD: patch-al,v 1.1 2006/06/30 12:54:38 tron Exp $
+
+--- src/drivers/netbsd.c.orig 2000-12-29 18:08:08.000000000 +0000
++++ src/drivers/netbsd.c 2006-06-30 12:11:46.000000000 +0100
+@@ -182,7 +182,7 @@
+ while (i) {
+ if ((j = write (audio_fd, b, i)) > 0) {
+ i -= j;
+- (char *)b += j;
++ b = (char *)b + j;
+ } else
+ break;
+ };
diff --git a/audio/xmp/patches/patch-am b/audio/xmp/patches/patch-am
new file mode 100644
index 00000000000..cb750c22ba1
--- /dev/null
+++ b/audio/xmp/patches/patch-am
@@ -0,0 +1,155 @@
+$NetBSD: patch-am,v 1.1 2006/06/30 12:54:38 tron Exp $
+
+--- src/loaders/mdl_load.c.orig 2000-12-29 18:08:33.000000000 +0000
++++ src/loaders/mdl_load.c 2006-06-30 12:57:09.000000000 +0100
+@@ -35,6 +35,35 @@
+ static struct mdl_envelope *v_env;
+ static struct mdl_envelope *p_env;
+
++static void *
++get_uint16_le(void *p, uint16_t *x16)
++{
++ uint8_t *bp;
++
++ bp = p;
++ *x16 = bp[0] | (bp[1] << 8);
++ return bp + sizeof(uint16);
++}
++
++static void *
++get_uint16_le_int(void *p, int *ip)
++{
++ uint8_t *bp;
++
++ bp = p;
++ *ip = bp[0] | (bp[1] << 8);
++ return bp + sizeof(uint16);
++}
++
++static void *
++get_uint32_le_int(void *p, int *ip)
++{
++ uint8_t *bp;
++
++ bp = p;
++ *ip = bp[0] | (bp[1] << 8) | (bp[2] << 16) | (bp[3] << 24);
++ return bp + sizeof(uint32);
++}
+
+ /* Effects 1-6 (note effects) can only be entered in the first effect
+ * column, G-L (volume-effects) only in the second column.
+@@ -130,7 +159,8 @@
+ unsigned int x;
+
+ if (i == 0) {
+- b = *((uint32 *)(*buf))++;
++ (void)memcpy(&b, *buf, sizeof(b));
++ *buf += sizeof(b);
+ n = 32;
+ return 0;
+ }
+@@ -268,8 +298,7 @@
+
+ buffer += 16; /* Skip pattern name */
+ for (j = 0; j < chn; j++) {
+- x16 = *((uint16 *)buffer)++;
+- L_ENDIAN16 (x16);
++ buffer = get_uint16_le(buffer, &x16);
+ xxp[i]->info[j].index = x16;
+ }
+ if (V (0))
+@@ -297,8 +326,7 @@
+ xxp[i]->rows = 64;
+
+ for (j = 0; j < 32; j++) {
+- x16 = *((uint16 *)buffer)++;
+- L_ENDIAN16 (x16);
++ buffer = get_uint16_le(buffer, &x16);
+ if (j < xxh->chn)
+ xxp[i]->info[j].index = x16;
+ }
+@@ -315,7 +343,8 @@
+ int i, j, k, row, len;
+ struct xxm_track *track;
+
+- xxh->trk = *((uint16 *) buffer)++ + 1;
++ buffer = get_uint16_le_int(buffer, &xxh->trk);
++ xxh->trk++;
+
+ if (V (0))
+ report ("Stored tracks : %d ", xxh->trk);
+@@ -330,7 +359,7 @@
+
+ for (i = 1; i < xxh->trk; i++) {
+ /* Length of the track in bytes */
+- len = *((uint16 *) buffer)++;
++ buffer = get_uint16_le_int(buffer, &len);
+
+ memset (track, 0, sizeof (struct xxm_track) +
+ sizeof (struct xxm_event) * 256);
+@@ -449,7 +478,7 @@
+ xxih[i].rls = *(uint16 *)buffer;
+ L_ENDIAN32 (xxih[i].rls);
+ }
+- ((uint16 *)buffer)++;
++ buffer += sizeof(uint16);
+
+ xxi[i][j].vra = *buffer++;
+ xxi[i][j].vde = *buffer++;
+@@ -498,15 +527,12 @@
+ buffer += 32; /* Sample name */
+ buffer += 8; /* Sample filename */
+
+- c2spd[i] = *((uint32 *)buffer)++;
++ (void)memcpy(&c2spd[i], buffer, sizeof(c2spd[i]));
++ buffer += sizeof(c2spd[i]);
+
+- xxs[i].len = *((uint32 *)buffer)++;
+- xxs[i].lps = *((uint32 *)buffer)++;
+- xxs[i].lpe = *((uint32 *)buffer)++;
+-
+- L_ENDIAN32 (xxs[i].len);
+- L_ENDIAN32 (xxs[i].lps);
+- L_ENDIAN32 (xxs[i].lpe);
++ buffer = get_uint32_le_int(buffer, &xxs[i].len);
++ buffer = get_uint32_le_int(buffer, &xxs[i].lps);
++ buffer = get_uint32_le_int(buffer, &xxs[i].lpe);
+
+ xxs[i].flg = xxs[i].lpe > 0 ? WAVE_LOOPING : 0;
+ xxs[i].lpe = xxs[i].lps + xxs[i].lpe;
+@@ -579,16 +605,11 @@
+ buffer += 32; /* Sample name */
+ buffer += 8; /* Sample filename */
+
+- c2spd[i] = *((uint16 *)buffer)++;
+- L_ENDIAN16 (c2spd[i]);
++ buffer = get_uint16_le_int(buffer, &c2spd[i]);
+
+- xxs[i].len = *((uint32 *)buffer)++;
+- xxs[i].lps = *((uint32 *)buffer)++;
+- xxs[i].lpe = *((uint32 *)buffer)++;
+-
+- L_ENDIAN32 (xxs[i].len);
+- L_ENDIAN32 (xxs[i].lps);
+- L_ENDIAN32 (xxs[i].lpe);
++ buffer = get_uint32_le_int(buffer, &xxs[i].len);
++ buffer = get_uint32_le_int(buffer, &xxs[i].lps);
++ buffer = get_uint32_le_int(buffer, &xxs[i].lpe);
+
+ xxs[i].flg = xxs[i].lpe > 0 ? WAVE_LOOPING : 0;
+ xxs[i].lpe = xxs[i].lps + xxs[i].lpe;
+@@ -648,12 +669,12 @@
+ buffer += xxs[i].len;
+ break;
+ case 1:
+- len = *((uint32 *)buffer)++;
++ buffer = get_uint32_le_int(buffer, &len);
+ unpack_sample8 (smpbuf, buffer, xxs[i].len);
+ buffer += len;
+ break;
+ case 2:
+- len = *((uint32 *)buffer)++;
++ buffer = get_uint32_le_int(buffer, &len);
+ unpack_sample16 ((uint16 *)smpbuf, buffer, xxs[i].len >> 1);
+ buffer += len;
+ break;
diff --git a/audio/xmp/patches/patch-an b/audio/xmp/patches/patch-an
new file mode 100644
index 00000000000..e5e1d05f25d
--- /dev/null
+++ b/audio/xmp/patches/patch-an
@@ -0,0 +1,159 @@
+$NetBSD: patch-an,v 1.1 2006/06/30 12:54:38 tron Exp $
+
+--- src/loaders/med_load.c.orig 2001-01-13 19:58:02.000000000 +0000
++++ src/loaders/med_load.c 2006-06-30 13:48:59.000000000 +0100
+@@ -31,6 +31,25 @@
+
+ static int bpmon, bpmlen;
+
++static void big_endian_uint16_t(void *p)
++{
++ uint16 *x16p, x16;
++
++ x16p = p;
++ x16 = *x16p;
++ B_ENDIAN16(x16);
++ *x16p = x16;
++}
++
++static void big_endian_uint32_t(void *p)
++{
++ uint32 *x32p, x32;
++
++ x32p = p;
++ x32 = *x32p;
++ B_ENDIAN32(x32);
++ *x32p = x32;
++}
+
+ static void xlat_fx (uint8 *fxt, uint8 *fxp)
+ {
+@@ -136,11 +155,11 @@
+
+ header = (struct MMD0 *)mmd;
+
+- B_ENDIAN32 ((uint32)header->modlen);
+- B_ENDIAN32 ((uint32)header->song);
+- B_ENDIAN32 ((uint32)header->blockarr);
+- B_ENDIAN32 ((uint32)header->smplarr);
+- B_ENDIAN32 ((uint32)header->expdata);
++ big_endian_uint32_t(&header->modlen);
++ big_endian_uint32_t(&header->song);
++ big_endian_uint32_t(&header->blockarr);
++ big_endian_uint32_t(&header->smplarr);
++ big_endian_uint32_t(&header->expdata);
+
+ song = (struct MMD0song *)(mmd + (uint32)header->song);
+ song2 = (struct MMD2song *)(mmd + (uint32)header->song);
+@@ -148,21 +167,21 @@
+ (uint32)header->expdata) : NULL;
+
+ if (expdata) {
+- B_ENDIAN32 ((uint32)expdata->nextmod);
+- B_ENDIAN32 ((uint32)expdata->exp_smp);
+- B_ENDIAN16 ((uint16)expdata->s_ext_entries);
+- B_ENDIAN16 ((uint16)expdata->s_ext_entrsz);
+- B_ENDIAN32 ((uint32)expdata->annotxt);
+- B_ENDIAN32 ((uint32)expdata->annolen);
+- B_ENDIAN32 ((uint32)expdata->iinfo);
+- B_ENDIAN16 ((uint16)expdata->i_ext_entries);
+- B_ENDIAN16 ((uint16)expdata->i_ext_entrsz);
+- B_ENDIAN32 ((uint32)expdata->jumpmask);
+- B_ENDIAN32 ((uint32)expdata->rgbtable);
+- B_ENDIAN32 ((uint32)expdata->n_info);
+- B_ENDIAN32 ((uint32)expdata->songname);
+- B_ENDIAN32 ((uint32)expdata->songnamelen);
+- B_ENDIAN32 ((uint32)expdata->dumps);
++ big_endian_uint32_t(&expdata->nextmod);
++ big_endian_uint32_t(&expdata->exp_smp);
++ big_endian_uint16_t(&expdata->s_ext_entries);
++ big_endian_uint16_t(&expdata->s_ext_entrsz);
++ big_endian_uint32_t(&expdata->annotxt);
++ big_endian_uint32_t(&expdata->annolen);
++ big_endian_uint32_t(&expdata->iinfo);
++ big_endian_uint16_t(&expdata->i_ext_entries);
++ big_endian_uint16_t(&expdata->i_ext_entrsz);
++ big_endian_uint32_t(&expdata->jumpmask);
++ big_endian_uint32_t(&expdata->rgbtable);
++ big_endian_uint32_t(&expdata->n_info);
++ big_endian_uint32_t(&expdata->songname);
++ big_endian_uint32_t(&expdata->songnamelen);
++ big_endian_uint32_t(&expdata->dumps);
+ }
+
+ for (i = 0; i < 63; i++) {
+@@ -198,7 +217,7 @@
+
+ for (i = 0; i < xxh->ins; i++) {
+ bytecopy(&instr, mmd + (uint32)header->smplarr + i * 4, 4);
+- B_ENDIAN32 ((uint32)instr);
++ big_endian_uint32_t(&instr);
+ if (!instr)
+ continue;
+ instr = (struct InstrHdr *)(mmd + (uint32)instr);
+@@ -225,16 +244,16 @@
+ if (ver < 2) {
+ memcpy (xxo, song->playseq, xxh->len);
+ } else {
+- B_ENDIAN32 ((uint32)song2->playseqtable);
++ big_endian_uint32_t(&song2->playseqtable);
+ playseq = (struct PlaySeq **)(mmd + (uint32)song2->playseqtable);
+- B_ENDIAN32 ((uint32)playseq[0]);
++ big_endian_uint32_t(&playseq[0]);
+ playseq[0] = (struct PlaySeq *)(mmd + (uint32)playseq[0]);
+- B_ENDIAN16 ((uint16)playseq[0]->length);
++ big_endian_uint16_t(&playseq[0]->length);
+ xxh->len = playseq[0]->length;
+ if (xxh->len > 0xff)
+ xxh->len = 0xff;
+ for (i = 0; i < xxh->len; i++) {
+- B_ENDIAN16 ((uint16)playseq[0]->seq[i]);
++ big_endian_uint16_t(&playseq[0]->seq[i]);
+ xxo[i] = playseq[0]->seq[i];
+ }
+ }
+@@ -243,7 +262,7 @@
+
+ for (i = 0; i < xxh->pat; i++) {
+ bytecopy(&block0, mmd + (uint32)header->blockarr + i * 4, 4);
+- B_ENDIAN32 ((uint32)block0);
++ big_endian_uint32_t(&block0);
+ block0 = (struct MMD0Block *)(mmd + (uint32)block0);
+ block1 = (struct MMD1Block *)block0;
+
+@@ -283,7 +302,7 @@
+
+ for (i = 0; i < xxh->pat; i++) {
+ bytecopy(&block0, mmd + (uint32)header->blockarr + i * 4, 4);
+- B_ENDIAN32 ((uint32)block0);
++ big_endian_uint32_t(&block0);
+ block0 = (struct MMD0Block *)(mmd + (uint32)block0);
+ block1 = (struct MMD1Block *)block0;
+
+@@ -345,7 +364,7 @@
+
+ for (smp_idx = i = 0; i < xxh->ins; i++) {
+ bytecopy(&instr, mmd + (uint32)header->smplarr + i * 4, 4);
+- B_ENDIAN32 ((uint32)instr);
++ big_endian_uint32_t(&instr);
+ if (!instr)
+ continue;
+ instr = (struct InstrHdr *)(mmd + (uint32)instr);
+@@ -381,7 +400,7 @@
+ xxih[i].vts = synth->volspeed;
+ xxih[i].wts = synth->wfspeed;
+
+- B_ENDIAN32 ((uint32)synth->wf[0]);
++ big_endian_uint32_t(&synth->wf[0]);
+ instr = (struct InstrHdr *)((char *)synth + (uint32)synth->wf[0]);
+ B_ENDIAN32 (instr->length);
+ B_ENDIAN16 (instr->type);
+@@ -438,7 +457,7 @@
+ xxih[i].wts = synth->wfspeed;
+
+ for (j = 0; j < synth->wforms; j++) {
+- B_ENDIAN32 ((uint32)synth->wf[j]);
++ big_endian_uint32_t(&synth->wf[j]);
+
+ xxi[i][j].pan = 0x80;
+ xxi[i][j].vol = song->sample[i].svol;