-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3da7f47
commit 7b77f12
Showing
3,304 changed files
with
2,069,565 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
########################################################################### | ||
# | ||
# build.mak | ||
# | ||
# MAME build tools makefile | ||
# | ||
# Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. | ||
# Visit http://mamedev.org for licensing and usage restrictions. | ||
# | ||
########################################################################### | ||
|
||
|
||
BUILDSRC = $(SRC)/build | ||
BUILDOBJ = $(OBJ)/build | ||
BUILDOUT = $(BUILDOBJ) | ||
|
||
OBJDIRS += \ | ||
$(BUILDOBJ) \ | ||
|
||
|
||
|
||
#------------------------------------------------- | ||
# set of build targets | ||
#------------------------------------------------- | ||
|
||
FILE2STR = $(BUILDOUT)/file2str$(EXE) | ||
PNG2BDC = $(BUILDOUT)/png2bdc$(EXE) | ||
|
||
BUILD += \ | ||
$(FILE2STR) \ | ||
$(PNG2BDC) \ | ||
|
||
|
||
|
||
#------------------------------------------------- | ||
# file2str | ||
#------------------------------------------------- | ||
|
||
FILE2STROBJS = \ | ||
$(BUILDOBJ)/file2str.o \ | ||
|
||
$(FILE2STR): $(FILE2STROBJS) $(LIBOCORE) | ||
@echo Linking $@... | ||
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@ | ||
|
||
|
||
|
||
#------------------------------------------------- | ||
# png2bdc | ||
#------------------------------------------------- | ||
|
||
PNG2BDCOBJS = \ | ||
$(BUILDOBJ)/png2bdc.o \ | ||
|
||
$(PNG2BDC): $(PNG2BDCOBJS) $(LIBUTIL) $(LIBOCORE) $(ZLIB) $(EXPAT) | ||
@echo Linking $@... | ||
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/*************************************************************************** | ||
file2str.c | ||
Simple file to string converter. | ||
Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. | ||
Visit http://mamedev.org for licensing and usage restrictions. | ||
***************************************************************************/ | ||
|
||
#include <stdio.h> | ||
#include "osdcore.h" | ||
|
||
|
||
/*------------------------------------------------- | ||
main - primary entry point | ||
-------------------------------------------------*/ | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
const char *srcfile, *dstfile, *varname, *type; | ||
FILE *src, *dst; | ||
UINT8 *buffer; | ||
int bytes, offs; | ||
int terminate = 1; | ||
|
||
/* needs at least three arguments */ | ||
if (argc < 4) | ||
{ | ||
fprintf(stderr, | ||
"Usage:\n" | ||
" laytostr <source.lay> <output.h> <varname> [<type>]\n" | ||
"\n" | ||
"The default <type> is char, with an assumed NULL terminator\n" | ||
); | ||
return 0; | ||
} | ||
|
||
/* extract arguments */ | ||
srcfile = argv[1]; | ||
dstfile = argv[2]; | ||
varname = argv[3]; | ||
type = (argc >= 5) ? argv[4] : "char"; | ||
if (argc >= 5) | ||
terminate = 0; | ||
|
||
/* open source file */ | ||
src = fopen(srcfile, "rb"); | ||
if (src == NULL) | ||
{ | ||
fprintf(stderr, "Unable to open source file '%s'\n", srcfile); | ||
return 1; | ||
} | ||
|
||
/* determine file size */ | ||
fseek(src, 0, SEEK_END); | ||
bytes = ftell(src); | ||
fseek(src, 0, SEEK_SET); | ||
|
||
/* allocate memory */ | ||
buffer = malloc(bytes + 1); | ||
if (buffer == NULL) | ||
{ | ||
fprintf(stderr, "Out of memory allocating %d byte buffer\n", bytes); | ||
return 1; | ||
} | ||
|
||
/* read the source file */ | ||
fread(buffer, 1, bytes, src); | ||
buffer[bytes] = 0; | ||
fclose(src); | ||
|
||
/* open dest file */ | ||
dst = fopen(dstfile, "w"); | ||
if (dst == NULL) | ||
{ | ||
fprintf(stderr, "Unable to open output file '%s'\n", dstfile); | ||
return 1; | ||
} | ||
|
||
/* write the initial header */ | ||
fprintf(dst, "const %s %s[] =\n{\n\t", type, varname); | ||
|
||
/* write out the data */ | ||
for (offs = 0; offs < bytes + terminate; offs++) | ||
{ | ||
fprintf(dst, "0x%02x%s", buffer[offs], (offs != bytes + terminate - 1) ? "," : ""); | ||
if (offs % 16 == 15) | ||
fprintf(dst, "\n\t"); | ||
} | ||
fprintf(dst, "\n};\n"); | ||
|
||
/* close the files */ | ||
free(buffer); | ||
fclose(dst); | ||
return 0; | ||
} |
Oops, something went wrong.