-
Notifications
You must be signed in to change notification settings - Fork 1
/
hints.c
79 lines (69 loc) · 1.34 KB
/
hints.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <stdlib.h>
#include <stdio.h>
#define NAMETABLE_SIZE 1024
const char *nametableFiles [] = {
"hintA",
"hintB",
"hintC",
"hintD",
"hintE",
"hintF",
"hintG",
"hintH",
"hintI",
"hintJ",
"hintK",
"hintL",
"hintM",
"hintN",
"hintO",
"hintP",
"hintQ",
"hintR",
"hintS",
"hintT",
"hintU",
"hintV",
"hintW",
"hintX",
"hintY",
"hintZ"
};
const char *pathName = "nametables/";
int getFileSize (FILE *file)
{
int size;
fseek(file, 0, SEEK_END);
size = ftell(file);
fseek(file, 0, SEEK_SET);
return size;
}
int main (int argc, const char * argv[])
{
int i;
unsigned int x;
int length = sizeof(nametableFiles) / sizeof(nametableFiles[0]);
unsigned char lineBuffer [14];
FILE *inputFile;
FILE *outputFile;
char inputFileName[50];
char outputFileName[50];
for (i=0;i<length;i++)
{
sprintf(inputFileName, "%s%s.nam", pathName, nametableFiles[i]);
printf("%s\n",inputFileName);
inputFile = fopen(inputFileName, "rb");
//Output window
sprintf(outputFileName, "%s%s.bin", pathName, nametableFiles[i]);
outputFile = fopen(outputFileName, "wb");
for (x=0;x<8;x++)
{
fseek(inputFile, (x * 32), SEEK_SET);
fread(lineBuffer,1,14,inputFile);
fwrite(lineBuffer,1,14,outputFile);
//printf("%d\n",x);
}
fclose(outputFile);
}
return 0;
}