annotate playercode/load_m15.c @ 6:d14fd386d182

Initial entry of mikmod into the CVS tree.
author darius
date Fri, 23 Jan 1998 16:05:09 +0000
parents 5d614bcc4287
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
1 /*
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
2
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
3 Name: LOAD_M15.C
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
4
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
5 Description:
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
6 15 instrument MOD loader
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
7 Also supports Ultimate Sound Tracker (old M15 format)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
8
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
9 Portability:
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
10 All systems - all compilers (hopefully)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
11
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
12 If this module is found to not be portable to any particular platform,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
13 please contact Jake Stine at dracoirs@epix.net (see MIKMOD.TXT for
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
14 more information on contacting the author).
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
15
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
16 */
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
17
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
18 #include <string.h>
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
19 #include "mikmod.h"
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
20
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
21 /*************************************************************************
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
22 *************************************************************************/
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
23
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
24
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
25 typedef struct MSAMPINFO // sample header as it appears in a module
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
26 { CHAR samplename[22];
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
27 UWORD length;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
28 UBYTE finetune;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
29 UBYTE volume;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
30 UWORD reppos;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
31 UWORD replen;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
32 } MSAMPINFO;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
33
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
34
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
35 typedef struct MODULEHEADER // verbatim module header
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
36 { CHAR songname[20]; // the songname..
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
37 MSAMPINFO samples[15]; // all sampleinfo
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
38 UBYTE songlength; // number of patterns used
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
39 UBYTE magic1; // should be 127
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
40 UBYTE positions[128]; // which pattern to play at pos
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
41 } MODULEHEADER;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
42
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
43
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
44 typedef struct MODNOTE
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
45 { UBYTE a,b,c,d;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
46 } MODNOTE;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
47
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
48
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
49 /*************************************************************************
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
50 *************************************************************************/
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
51
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
52 static MODULEHEADER *mh = NULL; // raw as-is module header
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
53 static MODNOTE *patbuf = NULL;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
54 static BOOL ust_loader = 0; // if TRUE, load as a ust module.
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
55 static CHAR nulls[3] = {0,0,0};
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
56
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
57 static BOOL LoadModuleHeader(MODULEHEADER *mh)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
58 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
59 int t;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
60
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
61 _mm_read_string(mh->songname,20,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
62
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
63 for(t=0; t<15; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
64 { MSAMPINFO *s = &mh->samples[t];
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
65 _mm_read_string(s->samplename,22,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
66 s->length =_mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
67 s->finetune =_mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
68 s->volume =_mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
69 s->reppos =_mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
70 s->replen =_mm_read_M_UWORD(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
71 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
72
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
73 mh->songlength =_mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
74 mh->magic1 =_mm_read_UBYTE(modfp); // should be 127
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
75 _mm_read_UBYTES(mh->positions,128,modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
76
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
77 return(!feof(modfp));
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
78 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
79
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
80
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
81 static int CheckPatternType(int numpat)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
82
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
83 // Checks the patterns in the modfile for UST / 15-inst indications.
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
84 // For example, if an effect 3xx is found, it is assumed that the song
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
85 // is 15-inst. If a 1xx effect has dat greater than 0x20, it is UST.
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
86 // Returns: 0 indecisive; 1 = UST; 2 = 15-inst
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
87
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
88 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
89 int t;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
90 UBYTE eff, dat;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
91
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
92 ust_loader = 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
93
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
94 for(t=0; t<numpat*(64U*4); t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
95 { // Load the pattern into the temp buffer
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
96 // and convert it
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
97
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
98 _mm_read_UBYTE(modfp); // read note
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
99 _mm_read_UBYTE(modfp); // read inst
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
100 eff = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
101 dat = _mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
102
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
103 if((eff==3) && (dat!=0) || (eff >= 2)) return 2;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
104 if(eff==1)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
105 { if(dat > 0x1f) return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
106 if(dat < 0x3) return 2;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
107 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
108 if((eff==2) && (dat > 0x1f)) return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
109 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
110
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
111 return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
112 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
113
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
114
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
115 BOOL M15_Test(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
116 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
117 int t, numpat;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
118 MODULEHEADER mh;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
119
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
120 ust_loader = 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
121
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
122 if(!LoadModuleHeader(&mh)) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
123 if(mh.magic1>127) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
124
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
125 for(t=0; t<15; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
126 { // all finetunes should be zero
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
127 if(mh.samples[t].finetune != 0) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
128
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
129 // all volumes should be <= 64
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
130 if(mh.samples[t].volume > 64) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
131
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
132 // all instrument names should begin with s, st-, or a number
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
133 if(mh.samples[t].samplename[0] == 's')
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
134 { if((memcmp(mh.samples[t].samplename,"st-",3) != 0) &&
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
135 (memcmp(mh.samples[t].samplename,"ST-",3) != 0) &&
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
136 (memcmp(mh.samples[t].samplename,nulls,3) != 0))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
137 ust_loader = 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
138 } else if((mh.samples[t].samplename[0] < '0') || (mh.samples[t].samplename[0] > '9'))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
139 ust_loader = 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
140
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
141 if(mh.samples[t].length > 4999)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
142 { ust_loader = 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
143 if(mh.samples[t].length > 32768) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
144 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
145
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
146 if(!ust_loader) return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
147
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
148 if(((mh.samples[t].reppos) + mh.samples[t].replen) > (mh.samples[t].length + 10))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
149 { ust_loader = 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
150 return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
151 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
152
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
153 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
154
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
155 for(numpat=0, t=0; t<mh.songlength; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
156 { if(mh.positions[t] > numpat)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
157 numpat = mh.positions[t];
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
158 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
159
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
160 numpat++;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
161 switch(CheckPatternType(numpat))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
162 { case 0: // indecisive, so check more clues...
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
163
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
164 break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
165
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
166 case 1: ust_loader = 1; break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
167 case 2: ust_loader = 0; break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
168 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
169
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
170 return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
171 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
172
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
173
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
174 BOOL M15_Init(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
175 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
176 if(!(mh=(MODULEHEADER *)_mm_calloc(1,sizeof(MODULEHEADER)))) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
177 return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
178 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
179
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
180
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
181 void M15_Cleanup(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
182 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
183 if(mh!=NULL) free(mh);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
184 if(patbuf!=NULL) free(patbuf);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
185
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
186 mh = NULL;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
187 patbuf = NULL;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
188 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
189
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
190
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
191 /*
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
192 Old (amiga) noteinfo:
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
193
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
194 _____byte 1_____ byte2_ _____byte 3_____ byte4_
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
195 / \ / \ / \ / \
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
196 0000 0000-00000000 0000 0000-00000000
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
197
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
198 Upper four 12 bits for Lower four Effect command.
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
199 bits of sam- note period. bits of sam-
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
200 ple number. ple number.
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
201
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
202 */
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
203
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
204
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
205 static void M15_ConvertNote(MODNOTE *n)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
206 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
207 UBYTE instrument,effect,effdat,note;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
208 UWORD period;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
209
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
210 // extract the various information from the 4 bytes that
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
211 // make up a single note
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
212
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
213 instrument = (n->a&0x10)|(n->c>>4);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
214 period = (((UWORD)n->a&0xf)<<8)+n->b;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
215 effect = n->c&0xf;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
216 effdat = n->d;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
217
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
218 // Convert the period to a note number
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
219
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
220 note=0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
221 if(period != 0)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
222 { for(note=0; note<60; note++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
223 if(period >= npertab[note]) break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
224 note++;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
225 if(note==61) note = 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
226 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
227
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
228 if(instrument!=0) UniInstrument(instrument-1);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
229 if(note!=0) UniNote(note+23);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
230
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
231 // Convert pattern jump from Dec to Hex
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
232 if(effect == 0xd)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
233 effdat = (((effdat&0xf0)>>4)*10)+(effdat&0xf);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
234
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
235 if(ust_loader)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
236 { switch(effect)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
237 { case 0: break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
238 case 1:
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
239 UniPTEffect(0,effdat);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
240 break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
241
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
242 case 2:
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
243 if(effdat&0xf) UniPTEffect(1,effdat&0xf);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
244 if(effdat>>2) UniPTEffect(2,effdat>>2);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
245 break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
246
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
247 case 3: break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
248
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
249 default:
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
250 UniPTEffect(effect,effdat);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
251 break;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
252 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
253 } else UniPTEffect(effect,effdat);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
254 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
255
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
256
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
257 static UBYTE *M15_ConvertTrack(MODNOTE *n)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
258 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
259 int t;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
260
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
261 UniReset();
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
262 for(t=0; t<64; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
263 { M15_ConvertNote(n);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
264 UniNewline();
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
265 n += 4;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
266 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
267 return UniDup();
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
268 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
269
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
270
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
271
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
272 static BOOL M15_LoadPatterns(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
273 // Loads all patterns of a modfile and converts them into the
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
274 // 3 byte format.
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
275 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
276 int t,s,tracks=0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
277
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
278 if(!AllocPatterns()) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
279 if(!AllocTracks()) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
280
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
281 // Allocate temporary buffer for loading
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
282 // and converting the patterns
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
283
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
284 if(!(patbuf=(MODNOTE *)_mm_calloc(64U*4,sizeof(MODNOTE)))) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
285
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
286 for(t=0; t<of.numpat; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
287 { // Load the pattern into the temp buffer
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
288 // and convert it
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
289
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
290 for(s=0; s<(64U*4); s++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
291 { patbuf[s].a=_mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
292 patbuf[s].b=_mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
293 patbuf[s].c=_mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
294 patbuf[s].d=_mm_read_UBYTE(modfp);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
295 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
296
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
297 for(s=0; s<4; s++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
298 if(!(of.tracks[tracks++]=M15_ConvertTrack(patbuf+s))) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
299 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
300
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
301 return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
302 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
303
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
304
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
305 BOOL M15_Load(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
306 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
307 int t;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
308 SAMPLE *q;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
309 MSAMPINFO *s; // old module sampleinfo
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
310
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
311 // try to read module header
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
312
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
313 if(!LoadModuleHeader(mh))
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
314 { _mm_errno = MMERR_LOADING_HEADER;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
315 return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
316 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
317
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
318
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
319 if(ust_loader)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
320 of.modtype = strdup("Ultimate Soundtracker");
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
321 else
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
322 of.modtype = strdup("Soundtracker");
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
323
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
324 // set module variables
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
325
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
326 of.initspeed = 6;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
327 of.inittempo = 125;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
328 of.numchn = 4; // get number of channels
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
329 of.songname = DupStr(mh->songname,20); // make a cstr of songname
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
330 of.numpos = mh->songlength; // copy the songlength
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
331
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
332 if(!AllocPositions(of.numpos)) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
333 for(t=0; t<of.numpos; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
334 of.positions[t] = mh->positions[t];
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
335
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
336
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
337 // Count the number of patterns
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
338
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
339 of.numpat = 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
340
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
341 for(t=0; t<of.numpos; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
342 { if(of.positions[t] > of.numpat)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
343 of.numpat = of.positions[t];
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
344 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
345 of.numpat++;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
346 of.numtrk = of.numpat*4;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
347
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
348 // Finally, init the sampleinfo structures
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
349
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
350 of.numins = of.numsmp = 15;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
351 if(!AllocSamples()) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
352
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
353 s = mh->samples; // init source pointer
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
354 q = of.samples;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
355
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
356 for(t=0; t<of.numins; t++)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
357 { // convert the samplename
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
358 q->samplename = DupStr(s->samplename,22);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
359
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
360 // init the sampleinfo variables and
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
361 // convert the size pointers to longword format
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
362
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
363 q->speed = finetune[s->finetune&0xf];
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
364 q->volume = s->volume;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
365 if(ust_loader)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
366 q->loopstart = s->reppos;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
367 else
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
368 q->loopstart = s->reppos<<1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
369 q->loopend = q->loopstart+(s->replen<<1);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
370 q->length = s->length<<1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
371
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
372 q->flags = SF_SIGNED | SF_UST_LOOP;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
373 if(s->replen>1) q->flags |= SF_LOOP;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
374
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
375 // fix replen if repend>length
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
376
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
377 if(q->loopend>q->length) q->loopend = q->length;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
378
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
379 s++; // point to next source sampleinfo
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
380 q++;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
381 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
382
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
383 if(!M15_LoadPatterns()) return 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
384
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
385 ust_loader = 0;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
386 return 1;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
387 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
388
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
389
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
390 CHAR *M15_LoadTitle(void)
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
391 {
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
392 CHAR s[20];
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
393
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
394 fseek(modfp,0,SEEK_SET);
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
395 if(!fread(s,22,1,modfp)) return NULL;
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
396
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
397 return(DupStr(s,20));
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
398 }
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
399
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
400
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
401 MLOADER load_m15 =
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
402 { NULL,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
403 "15-instrument module",
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
404 "Portable MOD-15 loader v0.1",
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
405 M15_Init,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
406 M15_Test,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
407 M15_Load,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
408 M15_Cleanup,
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
409 M15_LoadTitle
5d614bcc4287 Initial entry of mikmod into the CVS tree.
darius
parents:
diff changeset
410 };