Mercurial > hg > dmlib
annotate tools/dumpmod.c @ 2255:92385f9b7384
More cross-build fixing ..
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 15 Jun 2019 21:54:14 +0300 |
parents | e3f0eaf23f4f |
children | b7cd5dd0b82e |
rev | line source |
---|---|
0 | 1 /* |
942
38cad00b41dd
Rename viewmod utility to dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
860
diff
changeset
|
2 * dumpmod - View information about given module file |
0 | 3 * Programmed and designed by Matti 'ccr' Hamalainen |
942
38cad00b41dd
Rename viewmod utility to dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
860
diff
changeset
|
4 * (C) Copyright 2006-2015 Tecnic Software productions (TNSP) |
0 | 5 * |
6 * Please read file 'COPYING' for information on license and distribution. | |
7 */ | |
1432
a9516570cc26
Improve build, so that we can build the tools and tests with minimal
Matti Hamalainen <ccr@tnsp.org>
parents:
1413
diff
changeset
|
8 #include "dmtool.h" |
0 | 9 #include "jss.h" |
10 #include "jssmod.h" | |
11 #include "dmargs.h" | |
285
245b15cd1919
Don't link libSDL uselessly to utilities that do not actually use it.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
12 #include "dmmutex.h" |
0 | 13 |
14 | |
15 char *optFilename = NULL; | |
16 BOOL optViewPatterns = FALSE, | |
17 optViewInstruments = FALSE, | |
18 optViewExtInstruments = FALSE, | |
795 | 19 optViewGeneralInfo = FALSE, |
20 optDump = FALSE; | |
0 | 21 |
22 | |
860
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
797
diff
changeset
|
23 static const DMOptArg optList[] = |
0 | 24 { |
1345 | 25 { 0, '?', "help", "Show this help and exit", OPT_NONE }, |
26 { 1, 'p', "patterns", "View patterns", OPT_NONE }, | |
27 { 2, 'i', "instruments", "View instruments", OPT_NONE }, | |
28 { 3, 'e', "extinstruments", "View extended instruments", OPT_NONE }, | |
29 { 4, 'g', "general", "General information", OPT_NONE }, | |
30 { 5, 'v', "verbose", "Be more verbose", OPT_NONE }, | |
31 { 6, 'd', "dump", "Dump mode", OPT_NONE }, | |
1346
3f0fb57d58aa
Add -a/--all option to show all information about the module.
Matti Hamalainen <ccr@tnsp.org>
parents:
1345
diff
changeset
|
32 { 7, 'a', "all", "Dump all information (pat, ext, gen, inst)", OPT_NONE }, |
0 | 33 }; |
34 | |
35 const int optListN = sizeof(optList) / sizeof(optList[0]); | |
36 | |
37 | |
38 void argShowHelp() | |
39 { | |
40 dmPrintBanner(stdout, dmProgName, "[options] [modfile]"); | |
860
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
797
diff
changeset
|
41 dmArgsPrintHelp(stdout, optList, optListN, 0); |
0 | 42 } |
43 | |
44 | |
45 BOOL argHandleOpt(const int optN, char *optArg, char *currArg) | |
46 { | |
47 (void) optArg; | |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
48 |
0 | 49 switch (optN) |
50 { | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
51 case 0: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
52 argShowHelp(); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
53 exit(0); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
54 break; |
0 | 55 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
56 case 1: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
57 optViewPatterns = TRUE; |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
58 break; |
0 | 59 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
60 case 2: |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
61 optViewInstruments = TRUE; |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
62 break; |
0 | 63 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
64 case 3: |
1399
30c888dfec9f
Fix commandline option mixup -g vs -e
Matti Hamalainen <ccr@tnsp.org>
parents:
1348
diff
changeset
|
65 optViewExtInstruments = TRUE; |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
66 break; |
0 | 67 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
68 case 4: |
1399
30c888dfec9f
Fix commandline option mixup -g vs -e
Matti Hamalainen <ccr@tnsp.org>
parents:
1348
diff
changeset
|
69 optViewGeneralInfo = TRUE; |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
70 break; |
0 | 71 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
72 case 5: |
1345 | 73 dmVerbosity++; |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
74 break; |
0 | 75 |
795 | 76 case 6: |
77 optDump = TRUE; | |
78 break; | |
79 | |
1346
3f0fb57d58aa
Add -a/--all option to show all information about the module.
Matti Hamalainen <ccr@tnsp.org>
parents:
1345
diff
changeset
|
80 case 7: |
3f0fb57d58aa
Add -a/--all option to show all information about the module.
Matti Hamalainen <ccr@tnsp.org>
parents:
1345
diff
changeset
|
81 optViewPatterns = TRUE; |
3f0fb57d58aa
Add -a/--all option to show all information about the module.
Matti Hamalainen <ccr@tnsp.org>
parents:
1345
diff
changeset
|
82 optViewInstruments = TRUE; |
3f0fb57d58aa
Add -a/--all option to show all information about the module.
Matti Hamalainen <ccr@tnsp.org>
parents:
1345
diff
changeset
|
83 optViewGeneralInfo = TRUE; |
3f0fb57d58aa
Add -a/--all option to show all information about the module.
Matti Hamalainen <ccr@tnsp.org>
parents:
1345
diff
changeset
|
84 optViewExtInstruments = TRUE; |
3f0fb57d58aa
Add -a/--all option to show all information about the module.
Matti Hamalainen <ccr@tnsp.org>
parents:
1345
diff
changeset
|
85 break; |
3f0fb57d58aa
Add -a/--all option to show all information about the module.
Matti Hamalainen <ccr@tnsp.org>
parents:
1345
diff
changeset
|
86 |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
87 default: |
2183
e3f0eaf23f4f
Change the error message for unimplemented option argument.
Matti Hamalainen <ccr@tnsp.org>
parents:
1606
diff
changeset
|
88 dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
89 return FALSE; |
0 | 90 } |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
91 |
0 | 92 return TRUE; |
93 } | |
94 | |
95 | |
96 BOOL argHandleFile(char *currArg) | |
97 { | |
98 // Was not option argument | |
99 if (!optFilename) | |
100 optFilename = currArg; | |
1345 | 101 else |
102 { | |
103 dmErrorMsg("Oh noes, we can only hand one file and '%s' looks like a second one!\n", currArg); | |
0 | 104 return FALSE; |
105 } | |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
106 |
0 | 107 return TRUE; |
108 } | |
109 | |
110 | |
111 const char patNoteTable[12][3] = | |
112 { | |
113 "C-", "C#", "D-", | |
114 "D#", "E-", "F-", | |
115 "F#", "G-", "G#", | |
116 "A-", "A#", "B-" | |
117 }; | |
118 | |
1200 | 119 |
120 #define jmpNMODEffectTable (36) | |
0 | 121 static const char jmpMODEffectTable[jmpNMODEffectTable] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
122 | |
123 | |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
124 void printEscaped(FILE *f, const char *str) |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
125 { |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
126 while (*str) |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
127 { |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
128 fputc(isprint(*str) ? *str : '*', f); |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
129 str++; |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
130 } |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
131 } |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
132 |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
133 |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
134 const char *getNote(const int note) |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
135 { |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
136 static char tmp[16]; |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
137 snprintf(tmp, sizeof(tmp), "%s%d", |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
138 patNoteTable[note % 12], note / 12); |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
139 return tmp; |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
140 } |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
141 |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
142 |
0 | 143 /* Print a given pattern |
144 */ | |
1345 | 145 void printPattern(FILE *f, const JSSPattern *p) |
0 | 146 { |
147 int i, j; | |
148 char c; | |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
149 JSSNote *n = p->data; |
0 | 150 |
151 for (i = 0; i < p->nrows; i++) | |
152 { | |
153 fprintf(f, "%.2x: ", i); | |
154 | |
155 for (j = 0; j < p->nchannels; j++) | |
156 { | |
157 switch (n->note) | |
158 { | |
159 case jsetNotSet: | |
160 fprintf(f, "... "); | |
161 break; | |
162 case jsetNoteOff: | |
163 fprintf(f, "=== "); | |
164 break; | |
165 default: | |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
166 fprintf(f, "%s ", getNote(n->note)); |
0 | 167 break; |
168 } | |
169 | |
170 if (n->instrument != jsetNotSet) | |
171 fprintf(f, "%.2x ", n->instrument + 1); // Because FT2 is 1-based and we use 0 internally | |
172 else | |
173 fprintf(f, ".. "); | |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
174 |
0 | 175 if (n->volume == jsetNotSet) |
176 fprintf(f, ".. "); | |
177 else if (n->volume >= 0x00 && n->volume <= 0x40) | |
178 fprintf(f, "%.2x ", n->volume); | |
179 else | |
180 { | |
181 switch (n->volume & 0xf0) | |
182 { | |
183 case 0x50: c = '-'; break; | |
184 case 0x60: c = '+'; break; | |
185 case 0x70: c = '/'; break; | |
186 case 0x80: c = '\\'; break; | |
187 case 0x90: c = 'S'; break; | |
188 case 0xa0: c = 'V'; break; | |
189 case 0xb0: c = 'P'; break; | |
190 case 0xc0: c = '<'; break; | |
191 case 0xd0: c = '>'; break; | |
192 case 0xe0: c = 'M'; break; | |
193 default: c = '?'; break; | |
194 } | |
195 fprintf(f, "%c%x ", c, (n->volume & 0x0f)); | |
196 } | |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
197 |
0 | 198 if (n->effect >= 0 && n->effect < jmpNMODEffectTable) |
199 fprintf(f, "%c", jmpMODEffectTable[n->effect]); | |
200 else if (n->effect == jsetNotSet) | |
201 fprintf(f, "."); | |
202 else | |
203 fprintf(f, "?"); | |
204 | |
205 if (n->param != jsetNotSet) | |
206 fprintf(f, "%.2x|", n->param); | |
207 else | |
208 fprintf(f, "..|"); | |
209 | |
210 n++; | |
211 } | |
212 | |
213 fprintf(f, "\n"); | |
214 } | |
215 } | |
216 | |
217 | |
218 /* | |
219 * Print given extended instrument | |
220 */ | |
1345 | 221 void printEnvelope(FILE *f, const JSSEnvelope *e, const char *name) |
0 | 222 { |
223 int i; | |
224 | |
225 fprintf(f, | |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
226 " %s-envelope:\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
227 " flags......: %.4x%s%s%s\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
228 " npoints....: %d\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
229 " sustain....: %d\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
230 " loop.......: %d - %d\n", |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
231 name, e->flags, |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
232 (e->flags & jenvfUsed) ? " [used]" : "", |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
233 (e->flags & jenvfSustain) ? " [sust]" : "", |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
234 (e->flags & jenvfLooped) ? " [loop]" : "", |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
235 e->npoints, e->sustain, |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
236 e->loopS, e->loopE); |
0 | 237 |
238 if (dmVerbosity >= 2) | |
239 { | |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
240 fprintf(f, |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
241 " Points.....:"); |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
242 |
0 | 243 for (i = 0; i < e->npoints; i++) |
244 { | |
245 fprintf(f, " [%i:%i]", | |
246 e->points[i].frame, e->points[i].value); | |
247 } | |
248 | |
249 fprintf(f, "\n"); | |
250 } | |
251 } | |
252 | |
253 | |
1345 | 254 void printExtInstrument(FILE *f, const JSSExtInstrument *inst) |
0 | 255 { |
256 #ifndef JSS_LIGHT | |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
257 if (inst->desc && !optDump) |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
258 { |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
259 fprintf(f, "'"); |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
260 printEscaped(f, inst->desc); |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
261 fprintf(f, "'"); |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
262 } |
0 | 263 #endif |
264 fprintf(f, | |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
265 "\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
266 " nsamples.......: %i\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
267 " vibratoType....: %i\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
268 " vibratoSweep...: %i\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
269 " vibratoDepth...: %i\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
270 " vibratoRate....: %i\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
271 " fadeOut........: %i\n", |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
272 inst->nsamples, inst->vibratoType, inst->vibratoSweep, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
273 inst->vibratoDepth, inst->vibratoRate, inst->fadeOut); |
0 | 274 |
275 if (dmVerbosity >= 1) | |
276 { | |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
277 printEnvelope(f, &inst->volumeEnv, "Volume"); |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
278 printEnvelope(f, &inst->panningEnv, "Panning"); |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
279 } |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
280 |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
281 if (dmVerbosity >= 2) |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
282 { |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
283 int n; |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
284 fprintf(f, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
285 " sNumForNotes: "); |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
286 for (n = 0; n < jsetNNotes; n++) |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
287 { |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
288 int snum = inst->sNumForNotes[n]; |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
289 if (snum != jsetNotSet) |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
290 { |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
291 fprintf(f, "%s:%d ", getNote(n), snum); |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
292 } |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
293 } |
0 | 294 } |
295 fprintf(f, "\n"); | |
296 } | |
297 | |
298 | |
1345 | 299 void printInstrument(FILE *f, const JSSInstrument *inst) |
0 | 300 { |
301 if (dmVerbosity >= 1) | |
302 { | |
303 #ifndef JSS_LIGHT | |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
304 if (inst->desc && !optDump) |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
305 { |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
306 fprintf(f, "'"); |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
307 printEscaped(f, inst->desc); |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
308 fprintf(f, "'"); |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
309 } |
0 | 310 #endif |
311 fprintf(f, | |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
312 "\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
313 " size...........: %ld (0x%lx)\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
314 " loop...........: %ld - %ld (0x%lx - 0x%lx)\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
315 " volume.........: %d (0x%x)\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
316 " flags..........: 0x%x %s%s%s\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
317 " C4BaseSpeed....: %d (0x%x)\n" |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
318 " ERelNote.......: %s (%d)\n" |
1112
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
319 " EFineTune......: %d\n" |
14bd24790929
Various improvements in dumpmod output.
Matti Hamalainen <ccr@tnsp.org>
parents:
1110
diff
changeset
|
320 " EPanning.......: %d (0x%x)\n\n", |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
321 (unsigned long) inst->size, (unsigned long) inst->size, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
322 (unsigned long) inst->loopS, (unsigned long) inst->loopE, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
323 (unsigned long) inst->loopS, (unsigned long) inst->loopE, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
324 inst->volume, inst->volume, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
325 inst->flags, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
326 (inst->flags & jsfLooped) ? "[loop]" : "", |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
327 (inst->flags & jsfBiDi) ? "[bi-di]" : "", |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
328 (inst->flags & jsf16bit) ? "[16 bit]" : "[8 bit]", |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
329 inst->C4BaseSpeed, inst->C4BaseSpeed, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
330 getNote(inst->ERelNote + 48), inst->ERelNote, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
331 inst->EFineTune, inst->EPanning, inst->EPanning); |
0 | 332 } |
333 else | |
334 { | |
335 #ifndef JSS_LIGHT | |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
336 if (inst->desc && !optDump) |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
337 { |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
338 printEscaped(f, inst->desc); |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
339 fprintf(f, "|"); |
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
340 } |
0 | 341 #endif |
342 fprintf(f, | |
1092
03322ee5bb32
Change dumpmod short format sample instrument output.
Matti Hamalainen <ccr@tnsp.org>
parents:
958
diff
changeset
|
343 "%8ld|%8ld..%-8ld|%03d|%-2s %-2s %-2s|" |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
344 "%4d|%s%d|%4d|%4d\n", |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
345 (unsigned long) inst->size, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
346 (unsigned long) inst->loopS, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
347 (unsigned long) inst->loopE, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
348 inst->volume, |
1092
03322ee5bb32
Change dumpmod short format sample instrument output.
Matti Hamalainen <ccr@tnsp.org>
parents:
958
diff
changeset
|
349 |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
350 (inst->flags & jsfLooped) ? "lp" : "", |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
351 (inst->flags & jsfBiDi) ? "bi" : "", |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
352 (inst->flags & jsf16bit) ? "16" : "8", |
1092
03322ee5bb32
Change dumpmod short format sample instrument output.
Matti Hamalainen <ccr@tnsp.org>
parents:
958
diff
changeset
|
353 |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
354 inst->C4BaseSpeed, |
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
355 patNoteTable[(48 + inst->ERelNote) % 12], |
1348 | 356 (48 + inst->ERelNote) / 12, |
357 inst->EFineTune, | |
1117
378e5914be1e
Improve dumpmod output some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
1112
diff
changeset
|
358 inst->EPanning); |
0 | 359 } |
360 } | |
361 | |
362 | |
1345 | 363 void printGeneralInfo(FILE *f, const JSSModule *m) |
0 | 364 { |
365 int i; | |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
366 |
0 | 367 if (!m) |
368 return; | |
369 | |
795 | 370 if (!optDump) |
371 { | |
0 | 372 fprintf(f, "Module type.....: %i\n", m->moduleType); |
373 #ifndef JSS_LIGHT | |
374 if (m->moduleName) | |
375 fprintf(f, "Module name.....: '%s'\n", m->moduleName); | |
376 if (m->trackerName) | |
377 fprintf(f, "Tracker name....: '%s'\n", m->trackerName); | |
378 #endif | |
795 | 379 } |
0 | 380 fprintf(f, |
381 "Speed...........: %d ticks\n" | |
382 "Tempo...........: %d bpm\n" | |
383 "Flags...........: %x ", | |
384 m->defSpeed, m->defTempo, m->defFlags); | |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
385 |
0 | 386 if (m->defFlags & jmdfAmigaPeriods) fprintf(f, "[Amiga periods] "); |
387 if (m->defFlags & jmdfAmigaLimits) fprintf(f, "[Amiga limits] "); | |
388 if (m->defFlags & jmdfStereo) fprintf(f, "[stereo] "); | |
389 if (m->defFlags & jmdfFT2Replay) fprintf(f, "[FT2 replay] "); | |
390 if (m->defFlags & jmdfST300Slides) fprintf(f, "[ST300 slides] "); | |
391 if (m->defFlags & jmdfByteLStart) fprintf(f, "[ByteStart] "); | |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
392 |
0 | 393 fprintf(f, "\n" |
394 "Restart pos.....: %d (order)\n" | |
395 "IntVersion......: %x\n" | |
396 "Channels........: %d\n" | |
397 "Instruments.....: %d\n" | |
398 "Ext.instruments.: %d\n" | |
399 "Patterns........: %d\n" | |
400 "Orders..........: %d\n", | |
401 m->defRestartPos, m->intVersion, m->nchannels, | |
402 m->ninstruments, m->nextInstruments, m->npatterns, | |
403 m->norders); | |
404 | |
405 if (dmVerbosity >= 1) | |
406 { | |
407 fprintf(f, "Orderlist: "); | |
408 for (i = 0; i < m->norders - 1; i++) | |
409 fprintf(f, "%d, ", m->orderList[i]); | |
410 if (i < m->norders) | |
411 fprintf(f, "%d", m->orderList[i]); | |
412 fprintf(f, "\n"); | |
413 } | |
414 } | |
415 | |
416 | |
417 | |
418 int main(int argc, char *argv[]) | |
419 { | |
420 int result = -1, i; | |
777
ed60a7ee3ebb
Change JSSMOD loader to use DMResources.
Matti Hamalainen <ccr@tnsp.org>
parents:
730
diff
changeset
|
421 DMResource *file = NULL; |
ed60a7ee3ebb
Change JSSMOD loader to use DMResources.
Matti Hamalainen <ccr@tnsp.org>
parents:
730
diff
changeset
|
422 JSSModule *mod = NULL; |
0 | 423 |
942
38cad00b41dd
Rename viewmod utility to dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
860
diff
changeset
|
424 dmInitProg("dumpmod", "miniJSS Module Viewer", "0.4", NULL, NULL); |
0 | 425 dmVerbosity = 0; |
426 | |
427 // Parse arguments | |
428 if (!dmArgsProcess(argc, argv, optList, optListN, | |
860
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
797
diff
changeset
|
429 argHandleOpt, argHandleFile, OPTH_BAILOUT)) |
0 | 430 exit(1); |
431 | |
432 // Initialize miniJSS | |
433 jssInit(); | |
434 | |
435 // Open the file | |
436 dmMsg(1, "Reading module file '%s'\n", optFilename); | |
437 if (optFilename == NULL) | |
1606
93d1050eac99
Rename dmf_create_*() functions to dmf_open_*().
Matti Hamalainen <ccr@tnsp.org>
parents:
1432
diff
changeset
|
438 result = dmf_open_stdio_stream(stdin, &file); |
730
3d813c81f33c
More work on resources API.
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
439 else |
1606
93d1050eac99
Rename dmf_create_*() functions to dmf_open_*().
Matti Hamalainen <ccr@tnsp.org>
parents:
1432
diff
changeset
|
440 result = dmf_open_stdio(optFilename, "rb", &file); |
1235
5b8245e5f785
Remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1200
diff
changeset
|
441 |
730
3d813c81f33c
More work on resources API.
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
442 if (result != DMERR_OK) |
0 | 443 { |
958
985225a93aeb
Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents:
942
diff
changeset
|
444 dmErrorMsg("Error opening input file '%s', #%d: %s\n", |
730
3d813c81f33c
More work on resources API.
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
445 optFilename, result, dmErrorStr(result)); |
0 | 446 return 1; |
447 } | |
448 | |
449 // Read module file | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
450 dmMsg(1, "Reading file: %s\n", optFilename); |
0 | 451 #ifdef JSS_SUP_XM |
797
f066e9dccf29
Oops, fix some inverted booleans.
Matti Hamalainen <ccr@tnsp.org>
parents:
796
diff
changeset
|
452 result = jssLoadXM(file, &mod, TRUE); |
0 | 453 #endif |
454 #ifdef JSS_SUP_JSSMOD | |
1199
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
455 dmfreset(file); |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
456 if (result != DMERR_OK) |
0 | 457 { |
777
ed60a7ee3ebb
Change JSSMOD loader to use DMResources.
Matti Hamalainen <ccr@tnsp.org>
parents:
730
diff
changeset
|
458 dmMsg(1, "* Trying JSSMOD ...\n"); |
796 | 459 result = jssLoadJSSMOD(file, &mod, TRUE); |
1199
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
460 dmfreset(file); |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
461 if (result == DMERR_OK) |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
462 result = jssLoadJSSMOD(file, &mod, FALSE); |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
463 } |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
464 else |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
465 { |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
466 dmMsg(2, "* Trying XM...\n"); |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
467 result = jssLoadXM(file, &mod, FALSE); |
0 | 468 } |
469 #endif | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
470 dmf_close(file); |
1199
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
471 |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
472 // Check for errors, we still might have some data tho |
8
fc097f7717df
Fix JSSMod loading in viewmod and testpl.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
473 if (result != DMERR_OK) |
0 | 474 { |
958
985225a93aeb
Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents:
942
diff
changeset
|
475 dmErrorMsg("Error loading module file, %d: %s\n", |
8
fc097f7717df
Fix JSSMod loading in viewmod and testpl.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
476 result, dmErrorStr(result)); |
1199
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
477 } |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
478 |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
479 // Check if we have anything |
a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
Matti Hamalainen <ccr@tnsp.org>
parents:
1169
diff
changeset
|
480 if (mod == NULL) |
0 | 481 return 3; |
482 | |
483 // Print out information | |
484 if (optViewGeneralInfo) | |
79
d6c2efa25aa4
Oops, missed one s/m/mod/ .. fixed.
Matti Hamalainen <ccr@tnsp.org>
parents:
77
diff
changeset
|
485 printGeneralInfo(stdout, mod); |
0 | 486 |
487 if (optViewPatterns) | |
488 { | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
489 for (i = 0; i < mod->npatterns; i++) |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
490 if (mod->patterns[i] != NULL) |
0 | 491 { |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
492 printf("\nPattern #%02x:\n", i); |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
493 printPattern(stdout, mod->patterns[i]); |
0 | 494 } |
495 } | |
496 | |
497 if (optViewExtInstruments) | |
498 { | |
499 printf("\n" | |
500 "ExtInstruments:\n" | |
501 "---------------\n" | |
502 ); | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
503 for (i = 0; i < mod->nextInstruments; i++) |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
504 if (mod->extInstruments[i] != NULL) |
0 | 505 { |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
506 printf("#%02x: ", i + 1); |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
507 printExtInstrument(stdout, mod->extInstruments[i]); |
0 | 508 } |
509 } | |
510 | |
511 if (optViewInstruments) | |
512 { | |
513 printf("\n" | |
514 "Instruments:\n" | |
515 "------------\n" | |
516 ); | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
517 for (i = 0; i < mod->ninstruments; i++) |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
518 if (mod->instruments[i] != NULL) |
0 | 519 { |
1110
ea2cc4932714
Improve output of dumpmod.
Matti Hamalainen <ccr@tnsp.org>
parents:
1092
diff
changeset
|
520 printf("#%02x: ", i + 1); |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
521 printInstrument(stdout, mod->instruments[i]); |
0 | 522 } |
523 } | |
524 | |
525 // Free module data | |
77
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
526 jssFreeModule(mod); |
c6cdaa675801
Add the file mode parameter to dmf_create_stdio() calls, and throw in some
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
527 jssClose(); |
0 | 528 |
529 return 0; | |
530 } |