1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 // HACK to allow building with the SDL backend on MinGW
24 // see bug #1800764 "TOOLS: MinGW tools building broken"
25 #ifdef main
26 #undef main
27 #endif // main
28 
29 // AsciiCptCompile.cpp
30 //
31 
32 #include "stdafx.h"
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <assert.h>
36 #include "TextFile.h"
37 
38 typedef unsigned char byte;
39 typedef unsigned char uint8;
40 typedef unsigned short uint16;
41 typedef unsigned long uint32;
42 typedef unsigned int uint;
43 typedef signed char int8;
44 typedef signed short int16;
45 typedef signed long int32;
46 
47 void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *sve);
48 
main(int argc,char * argv[])49 int main(int argc, char* argv[])
50 {
51 	uint8 testBuf[4] = { 0x11, 0x22, 0x33, 0x44 };
52 	if (*(uint32 *)testBuf != 0x44332211) {
53 		printf("Sorry, this program only works on little endian systems.\nGoodbye.\n");
54 		return 0;
55 	}
56 	TextFile *cptDef = new TextFile("COMPACT.TXT");
57 	FILE *inf = fopen("COMPACT.TXT", "r");
58 	FILE *dbg = fopen("compact.dbg", "wb");
59 	FILE *out = fopen("compact.bin", "wb");
60 	FILE *sve = fopen("savedata.txt", "r");
61 	assert(inf && dbg && out && sve);
62 	doCompile(inf, dbg, out, cptDef, sve);
63 	fclose(inf);
64 	fclose(dbg);
65 	fclose(out);
66 	fclose(sve);
67 	printf("done\n");
68 	return 0;
69 }
70