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