-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdecode.c
More file actions
46 lines (44 loc) · 875 Bytes
/
decode.c
File metadata and controls
46 lines (44 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
// decode a pioneer .LNG file (old format with 16 bit index)
int main(int argc,char *argv[]) {
FILE *f;
int i;
f=fopen(argv[1],"rb");
fseek(f,0x40,SEEK_SET);
short nstrings;
int offset=0;
int next=0;
short ch;
fread(&nstrings, 2, 1, f);
nstrings=nstrings-3;
for(i=0;i<nstrings;i++) {
fseek(f,0x40+i*2,SEEK_SET);
offset=0;
fread(&offset, 2, 1, f);
offset=offset*2+0x40;
/* next=0;
fread(&next, 2, 1, f);
next=next*2+0x40;
*/
ch=1;
putchar('"');
putchar(0);
fseek(f,offset,SEEK_SET);
int ch1=1;
while(1) {
fread(&ch,1,1,f);
fread(&ch1,1,1,f);
if(ch==0 && ch1==0)
break;
putchar(ch&255);
putchar(ch1&255);
}
putchar('"');
putchar(0);
putchar(13);
putchar(0);
putchar(10);
putchar(0);
}
fprintf(stderr,"%d strings\n",nstrings);
}