Skip to content

Commit 7b77f12

Browse files
committed
Initial checkin of MAME 0.121.
1 parent 3da7f47 commit 7b77f12

File tree

3,304 files changed

+2069565
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,304 files changed

+2069565
-0
lines changed

.gitattributes

Lines changed: 3303 additions & 0 deletions
Large diffs are not rendered by default.

makefile

Lines changed: 586 additions & 0 deletions
Large diffs are not rendered by default.

src/build/build.mak

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
###########################################################################
2+
#
3+
# build.mak
4+
#
5+
# MAME build tools makefile
6+
#
7+
# Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
8+
# Visit http://mamedev.org for licensing and usage restrictions.
9+
#
10+
###########################################################################
11+
12+
13+
BUILDSRC = $(SRC)/build
14+
BUILDOBJ = $(OBJ)/build
15+
BUILDOUT = $(BUILDOBJ)
16+
17+
OBJDIRS += \
18+
$(BUILDOBJ) \
19+
20+
21+
22+
#-------------------------------------------------
23+
# set of build targets
24+
#-------------------------------------------------
25+
26+
FILE2STR = $(BUILDOUT)/file2str$(EXE)
27+
PNG2BDC = $(BUILDOUT)/png2bdc$(EXE)
28+
29+
BUILD += \
30+
$(FILE2STR) \
31+
$(PNG2BDC) \
32+
33+
34+
35+
#-------------------------------------------------
36+
# file2str
37+
#-------------------------------------------------
38+
39+
FILE2STROBJS = \
40+
$(BUILDOBJ)/file2str.o \
41+
42+
$(FILE2STR): $(FILE2STROBJS) $(LIBOCORE)
43+
@echo Linking $@...
44+
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
45+
46+
47+
48+
#-------------------------------------------------
49+
# png2bdc
50+
#-------------------------------------------------
51+
52+
PNG2BDCOBJS = \
53+
$(BUILDOBJ)/png2bdc.o \
54+
55+
$(PNG2BDC): $(PNG2BDCOBJS) $(LIBUTIL) $(LIBOCORE) $(ZLIB) $(EXPAT)
56+
@echo Linking $@...
57+
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@

src/build/file2str.c

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/***************************************************************************
2+
3+
file2str.c
4+
5+
Simple file to string converter.
6+
7+
Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
8+
Visit http://mamedev.org for licensing and usage restrictions.
9+
10+
***************************************************************************/
11+
12+
#include <stdio.h>
13+
#include "osdcore.h"
14+
15+
16+
/*-------------------------------------------------
17+
main - primary entry point
18+
-------------------------------------------------*/
19+
20+
int main(int argc, char *argv[])
21+
{
22+
const char *srcfile, *dstfile, *varname, *type;
23+
FILE *src, *dst;
24+
UINT8 *buffer;
25+
int bytes, offs;
26+
int terminate = 1;
27+
28+
/* needs at least three arguments */
29+
if (argc < 4)
30+
{
31+
fprintf(stderr,
32+
"Usage:\n"
33+
" laytostr <source.lay> <output.h> <varname> [<type>]\n"
34+
"\n"
35+
"The default <type> is char, with an assumed NULL terminator\n"
36+
);
37+
return 0;
38+
}
39+
40+
/* extract arguments */
41+
srcfile = argv[1];
42+
dstfile = argv[2];
43+
varname = argv[3];
44+
type = (argc >= 5) ? argv[4] : "char";
45+
if (argc >= 5)
46+
terminate = 0;
47+
48+
/* open source file */
49+
src = fopen(srcfile, "rb");
50+
if (src == NULL)
51+
{
52+
fprintf(stderr, "Unable to open source file '%s'\n", srcfile);
53+
return 1;
54+
}
55+
56+
/* determine file size */
57+
fseek(src, 0, SEEK_END);
58+
bytes = ftell(src);
59+
fseek(src, 0, SEEK_SET);
60+
61+
/* allocate memory */
62+
buffer = malloc(bytes + 1);
63+
if (buffer == NULL)
64+
{
65+
fprintf(stderr, "Out of memory allocating %d byte buffer\n", bytes);
66+
return 1;
67+
}
68+
69+
/* read the source file */
70+
fread(buffer, 1, bytes, src);
71+
buffer[bytes] = 0;
72+
fclose(src);
73+
74+
/* open dest file */
75+
dst = fopen(dstfile, "w");
76+
if (dst == NULL)
77+
{
78+
fprintf(stderr, "Unable to open output file '%s'\n", dstfile);
79+
return 1;
80+
}
81+
82+
/* write the initial header */
83+
fprintf(dst, "const %s %s[] =\n{\n\t", type, varname);
84+
85+
/* write out the data */
86+
for (offs = 0; offs < bytes + terminate; offs++)
87+
{
88+
fprintf(dst, "0x%02x%s", buffer[offs], (offs != bytes + terminate - 1) ? "," : "");
89+
if (offs % 16 == 15)
90+
fprintf(dst, "\n\t");
91+
}
92+
fprintf(dst, "\n};\n");
93+
94+
/* close the files */
95+
free(buffer);
96+
fclose(dst);
97+
return 0;
98+
}

0 commit comments

Comments
 (0)