-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_tileset.cpp
More file actions
42 lines (34 loc) · 878 Bytes
/
convert_tileset.cpp
File metadata and controls
42 lines (34 loc) · 878 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
#include <stdio.h>
#include <stdlib.h>
int main (int argc,char *argv[]) {
if (argc<3) {
printf ("use %s charset new_charset\n",argv[0]);
return 0x80;
}
FILE *fin = fopen (argv[1],"rb");
if (!fin) {
printf ("missing file '%s'\n",argv[1]);
return 0x80;
}
FILE *fout = fopen (argv[2],"wb");
if (!fout) {
printf ("cannot create file '%s'\n",argv[2]);
return 0x80;
}
while (!feof (fin)) {
int i=0;
unsigned char b[32];
unsigned char d[32];
fread (b,sizeof(b),1,fin);
for (i=0;i<8;i++) {
d[i] = b[i];
d[i+8] = b[i+16];
d[i+16] = b[i+8];
d[i+24] = b[i+24];
}
fwrite (d,sizeof (d),1,fout);
}
fclose (fout);
fclose(fin);
return 0;
}