main
Line | |
---|
1 | #include <stdint.h>
|
---|
2 | #include <inttypes.h>
|
---|
3 | #include <stdio.h>
|
---|
4 | #include <stdlib.h>
|
---|
5 |
|
---|
6 | int main(int argc, char* argv[]) {
|
---|
7 | FILE *sap, *fd;
|
---|
8 | int c, k, j;
|
---|
9 | puts("sap2fd - Thomson diskimage converter\nPulkoMandy / Shinra - 2010\n"
|
---|
10 | "wtfpl Licance\n");
|
---|
11 |
|
---|
12 | if (argc != 2) {
|
---|
13 | printf("%s file.sap\n",argv[0]);
|
---|
14 | exit(1);
|
---|
15 | }
|
---|
16 |
|
---|
17 | if (strcasecmp(argv[1] + strlen(argv[1]) - 4,".sap")) {
|
---|
18 | printf("%s is no sap\n",argv[1]);
|
---|
19 | exit(2);
|
---|
20 | }
|
---|
21 |
|
---|
22 | printf("Infile : %s\n",argv[1]);
|
---|
23 |
|
---|
24 | sap = fopen(argv[1], "rb");
|
---|
25 | strcpy((argv[1] + strlen(argv[1]) - 4),".fd");
|
---|
26 | fd = fopen(argv[1], "wb");
|
---|
27 |
|
---|
28 | printf("Outfile : %s\n",argv[1]);
|
---|
29 |
|
---|
30 | for (c = 0; c < 0x40; c++)
|
---|
31 | getc(sap);
|
---|
32 |
|
---|
33 | k = 0;
|
---|
34 | while((c=getc(sap)) != EOF) {
|
---|
35 | if (k % 256 == 0)
|
---|
36 | for (j = 0; j <= 5; j++) c = getc(sap);
|
---|
37 | if (c == EOF) break;
|
---|
38 | putc(c^0xB3,fd);
|
---|
39 | k++;
|
---|
40 | }
|
---|
41 |
|
---|
42 |
|
---|
43 | fclose(sap);
|
---|
44 | fclose(fd);
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.