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