History

very simple amiga mod parser

kemal committed 5 years ago

Commit 1ea45f31 parent f4bd0185 files · +51 −0Browse files

Unified · Split

5 files
  1. README.md +1 −0
  2. mkfile +1 −0
  3. mod.c +46 −0
  4. tags.c +2 −0
  5. tags.h +1 −0
README.md+1−0
@@ -16,6 +16,7 @@ Comparison to id3lib and taglib: · 15 unmodified lines
1616 | IT | yes | no | ??? |
1717 | XM | yes | no | ??? |
1818 | S3M | yes | no | ??? |
19+| MOD | yes | no | ??? |
1920 | replay gain | yes | no | ??? |
2021 | size | tiny | bloated | more bloated |
2122 | license | MIT | LGPL | LGPL/MPL |
mkfile+1−0
@@ -16,6 +16,7 @@ OFILES=\ · 15 unmodified lines
1616 vorbis.$O\
1717 wav.$O\
1818 xm.$O\
19+ mod.$O\
1920
2021 HFILES=\
2122 /sys/include/tags.h\
mod.c+46−0
@@ -0,0 +1,46 @@
1+#include "tagspriv.h"
2+
3+/* insane. */
4+static char* variants[] =
5+{
6+ "M.K.",
7+ "M!K!",
8+ "M&K!",
9+ "N.T.",
10+ "NSMS",
11+ "FLT4",
12+ "M\0\0\0",
13+ "8\0\0\0",
14+ "FEST",
15+ "FLT8",
16+ "CD81",
17+ "OCTA",
18+ "OKTA",
19+ "16CN",
20+ "32CN",
21+ nil,
22+};
23+
24+int
25+tagmod(Tagctx *ctx)
26+{
27+ char d[20+1];
28+ int i;
29+
30+ if (ctx->seek(ctx, 1080, 0) != 1080)
31+ return -1;
32+ if (ctx->read(ctx, d, 4) != 4)
33+ return -1;
34+ for (i = 0; ; i++)
35+ if (variants[i] == nil)
36+ return -1;
37+ else if (memcmp(d, variants[i], 4) == 0)
38+ break;
39+ memset(d, 0, sizeof d);
40+ if (ctx->seek(ctx, 0, 0) != 0)
41+ return -1;
42+ if (ctx->read(ctx, d, 20) != 20)
43+ return -1;
44+ txtcb(ctx, Ttitle, "", d);
45+ return 0;
46+}
tags.c+2−0
@@ -18,6 +18,7 @@ extern int tags3m(Tagctx *ctx); · 17 unmodified lines
1818 extern int tagvorbis(Tagctx *ctx);
1919 extern int tagwav(Tagctx *ctx);
2020 extern int tagxm(Tagctx *ctx);
21+extern int tagmod(Tagctx *ctx);
2122
2223 static const Getter g[] =
2324 {
@@ -31,6 +32,7 @@ static const Getter g[] = · 7 unmodified lines
3132 {tagit, Fit},
3233 {tagxm, Fxm},
3334 {tags3m, Fs3m},
35+ {tagmod, Fmod},
3436 };
3537
3638 void
tags.h+1−0
@@ -35,6 +35,7 @@ enum · 34 unmodified lines
3535 Fit,
3636 Fxm,
3737 Fs3m,
38+ Fmod,
3839
3940 Fmax,
4041 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t