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