decoder's subdirectory. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/pwntcha/trunk@2318 92316355-f0b4-4df1-b90c-862c8a59935fmaster
| @@ -1,7 +1,6 @@ | |||||
| NULL = | |||||
| SUBDIRS = src | SUBDIRS = src | ||||
| DIST_SUBDIRS = $(SUBDIRS) extras share | |||||
| DIST_SUBDIRS = $(SUBDIRS) extras | |||||
| EXTRA_DIST = \ | EXTRA_DIST = \ | ||||
| bootstrap \ | bootstrap \ | ||||
| @@ -96,6 +96,5 @@ AC_OUTPUT([ | |||||
| src/vbulletin/Makefile | src/vbulletin/Makefile | ||||
| src/xanga/Makefile | src/xanga/Makefile | ||||
| extras/Makefile | extras/Makefile | ||||
| share/Makefile | |||||
| ]) | ]) | ||||
| @@ -1,26 +0,0 @@ | |||||
| NULL = | |||||
| EXTRA_DIST = \ | |||||
| font_authimage.png \ | |||||
| font_linuxfr.png \ | |||||
| font_phpbb.png \ | |||||
| font_slashdot.png \ | |||||
| font_vbulletin.png \ | |||||
| font_freesans_24_09AZ.bmp \ | |||||
| font_comic_24_az_messed.bmp \ | |||||
| font_comic_32_az.bmp \ | |||||
| font_freemonobold_24_az.bmp \ | |||||
| font_freemonobold_32_az.bmp \ | |||||
| font_freesans_24_09AZ.bmp \ | |||||
| font_freesansbold_32_az.bmp \ | |||||
| font_freesansbold_36_az_messed.bmp \ | |||||
| font_stencil_23_AZ.bmp \ | |||||
| font_stencil_24_AZ.bmp \ | |||||
| x_font_comic_24_az_messed.bmp \ | |||||
| x_font_comic_32_az.bmp \ | |||||
| x_font_freemonobold_24_az.bmp \ | |||||
| x_font_freemonobold_32_az.bmp \ | |||||
| x_font_freesansbold_32_az.bmp \ | |||||
| x_font_freesansbold_36_az_messed.bmp \ | |||||
| $(NULL) | |||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = authimage | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = font.png | |||||
| @@ -29,7 +29,7 @@ char *decode_authimage(struct image *img) | |||||
| if(!font) | if(!font) | ||||
| { | { | ||||
| font = font_load_fixed("font_authimage.png", | |||||
| font = font_load_fixed(DECODER, "font.png", | |||||
| "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); | "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); | ||||
| if(!font) | if(!font) | ||||
| exit(-1); | exit(-1); | ||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = clubic | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = font.png | |||||
| @@ -52,7 +52,7 @@ static void find_glyphs(struct image *img) | |||||
| if(!font) | if(!font) | ||||
| { | { | ||||
| font = font_load_variable("font_clubic.png", "0123456789"); | |||||
| font = font_load_variable(DECODER, "font.png", "0123456789"); | |||||
| if(!font) | if(!font) | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| @@ -65,9 +65,9 @@ int getpixel(struct image *img, int x, int y, int *r, int *g, int *b); | |||||
| int setpixel(struct image *img, int x, int y, int r, int g, int b); | int setpixel(struct image *img, int x, int y, int r, int g, int b); | ||||
| /* font operations */ | /* font operations */ | ||||
| struct font *font_load_fixed(char *file, char *chars); | |||||
| struct font *font_load_variable(char *file, char *chars); | |||||
| void font_free(struct font *font); | |||||
| struct font *font_load_fixed(char const *, char const *, char const *); | |||||
| struct font *font_load_variable(char const *, char const *, char const *); | |||||
| void font_free(struct font *); | |||||
| /* image filters */ | /* image filters */ | ||||
| void filter_flood_fill(struct image *img, int x, int y, int r, int g, int b); | void filter_flood_fill(struct image *img, int x, int y, int r, int g, int b); | ||||
| @@ -17,16 +17,22 @@ | |||||
| #include "config.h" | #include "config.h" | ||||
| #include "common.h" | #include "common.h" | ||||
| struct font *font_load_fixed(char *file, char *chars) | |||||
| struct font *font_load_fixed(char const *decoder, char const *file, | |||||
| char const *chars) | |||||
| { | { | ||||
| char fontname[BUFSIZ]; | char fontname[BUFSIZ]; | ||||
| struct font *font; | struct font *font; | ||||
| struct image *img; | struct image *img; | ||||
| int i; | int i; | ||||
| sprintf(fontname, "%s/%s", share, file); | |||||
| sprintf(fontname, "src/%s/%s", decoder, file); | |||||
| img = image_load(fontname); | img = image_load(fontname); | ||||
| if(!img) | if(!img) | ||||
| { | |||||
| sprintf(fontname, "%s/%s/%s", share, decoder, file); | |||||
| img = image_load(fontname); | |||||
| } | |||||
| if(!img) | |||||
| { | { | ||||
| fprintf(stderr, "%s: cannot load font %s\n", argv0, fontname); | fprintf(stderr, "%s: cannot load font %s\n", argv0, fontname); | ||||
| return NULL; | return NULL; | ||||
| @@ -50,7 +56,8 @@ struct font *font_load_fixed(char *file, char *chars) | |||||
| return font; | return font; | ||||
| } | } | ||||
| struct font *font_load_variable(char *file, char *chars) | |||||
| struct font *font_load_variable(char const *decoder, char const *file, | |||||
| char const *chars) | |||||
| { | { | ||||
| char fontname[BUFSIZ]; | char fontname[BUFSIZ]; | ||||
| struct font *font; | struct font *font; | ||||
| @@ -59,9 +66,14 @@ struct font *font_load_variable(char *file, char *chars) | |||||
| int x, y, i; | int x, y, i; | ||||
| int r, g, b; | int r, g, b; | ||||
| sprintf(fontname, "%s/%s", share, file); | |||||
| sprintf(fontname, "src/%s/%s", decoder, file); | |||||
| img = image_load(fontname); | img = image_load(fontname); | ||||
| if(!img) | if(!img) | ||||
| { | |||||
| sprintf(fontname, "%s/%s/%s", share, decoder, file); | |||||
| img = image_load(fontname); | |||||
| } | |||||
| if(!img) | |||||
| { | { | ||||
| fprintf(stderr, "%s: cannot load font %s\n", argv0, fontname); | fprintf(stderr, "%s: cannot load font %s\n", argv0, fontname); | ||||
| return NULL; | return NULL; | ||||
| @@ -1,6 +1,8 @@ | |||||
| DECODER = java | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = linuxfr | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = font.png | |||||
| @@ -29,7 +29,7 @@ char *decode_linuxfr(struct image *img) | |||||
| if(!font) | if(!font) | ||||
| { | { | ||||
| font = font_load_fixed("font_linuxfr.png", | |||||
| font = font_load_fixed(DECODER, "font.png", | |||||
| "abcdefghijklmnopqrstuvwxyz" | "abcdefghijklmnopqrstuvwxyz" | ||||
| "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||||
| "0123456789"); | "0123456789"); | ||||
| @@ -1,6 +1,8 @@ | |||||
| DECODER = livejournal | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| @@ -58,7 +58,7 @@ static void find_glyphs(struct image *img) | |||||
| if(!font) | if(!font) | ||||
| { | { | ||||
| font = font_load_variable("x_font_freesansbold_32_09az.bmp", | |||||
| font = font_load_variable(DECODER, "x_freesansbold_32_09az.bmp", | |||||
| "0123456789abcdefghijklmnopqrstuvwxyz"); | "0123456789abcdefghijklmnopqrstuvwxyz"); | ||||
| if(!font) | if(!font) | ||||
| exit(1); | exit(1); | ||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = lmt | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = freesans_24_09AZ.bmp | |||||
| @@ -55,7 +55,7 @@ static void find_glyphs(struct image *img) | |||||
| if(!font) | if(!font) | ||||
| { | { | ||||
| font = font_load_variable("font_freesans_24_09AZ.bmp", | |||||
| font = font_load_variable(DECODER, "freesans_24_09AZ.bmp", | |||||
| "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); | "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); | ||||
| filter_smooth(font->img); | filter_smooth(font->img); | ||||
| if(!font) | if(!font) | ||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = paypal | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = stencil_23_AZ.bmp stencil_24_AZ.bmp | |||||
| @@ -47,8 +47,8 @@ static void find_glyphs(struct image *img) | |||||
| static struct font *fonts[FONTS]; | static struct font *fonts[FONTS]; | ||||
| static char *files[] = | static char *files[] = | ||||
| { | { | ||||
| "font_stencil_23_AZ.bmp", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", | |||||
| "font_stencil_24_AZ.bmp", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", | |||||
| "stencil_23_AZ.bmp", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", | |||||
| "stencil_24_AZ.bmp", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", | |||||
| }; | }; | ||||
| int x, y, i = 0, f; | int x, y, i = 0, f; | ||||
| int r, g, b; | int r, g, b; | ||||
| @@ -59,7 +59,8 @@ static void find_glyphs(struct image *img) | |||||
| { | { | ||||
| if(!fonts[f]) | if(!fonts[f]) | ||||
| { | { | ||||
| fonts[f] = font_load_variable(files[f * 2], files[f * 2 + 1]); | |||||
| fonts[f] = font_load_variable(DECODER, | |||||
| files[f * 2], files[f * 2 + 1]); | |||||
| if(!fonts[f]) | if(!fonts[f]) | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = phpbb | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = font.png | |||||
| @@ -31,7 +31,7 @@ char *decode_phpbb(struct image *img) | |||||
| if(!font) | if(!font) | ||||
| { | { | ||||
| font = font_load_fixed("font_phpbb.png", | |||||
| font = font_load_fixed(DECODER, "font.png", | |||||
| "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); | "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); | ||||
| if(!font) | if(!font) | ||||
| exit(-1); | exit(-1); | ||||
| @@ -1,6 +1,8 @@ | |||||
| DECODER = scode | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = slashdot | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = font.png | |||||
| @@ -190,7 +190,8 @@ static void find_glyphs(struct image *img) | |||||
| if(!font) | if(!font) | ||||
| { | { | ||||
| font = font_load_variable("font_slashdot.png", "abcdefgijkmnpqrstvwxyz"); | |||||
| font = font_load_variable(DECODER, "font.png", | |||||
| "abcdefgijkmnpqrstvwxyz"); | |||||
| if(!font) | if(!font) | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| @@ -1,6 +1,8 @@ | |||||
| DECODER = ticketmaster | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = tickets | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = font1.png font2.png font3.png font4.png font5.png font6.png font7.png font8.png | |||||
| @@ -34,8 +34,8 @@ char *decode_tickets(struct image *img) | |||||
| if(!fonts[i]) | if(!fonts[i]) | ||||
| { | { | ||||
| char buf[BUFSIZ]; | char buf[BUFSIZ]; | ||||
| sprintf(buf, "font_tickets%i.png", i + 1); | |||||
| fonts[i] = font_load_variable(buf, "0123456789"); | |||||
| sprintf(buf, "font%i.png", i + 1); | |||||
| fonts[i] = font_load_variable(DECODER, buf, "0123456789"); | |||||
| if(!fonts[i]) | if(!fonts[i]) | ||||
| exit(-1); | exit(-1); | ||||
| } | } | ||||
| @@ -1,6 +1,10 @@ | |||||
| DECODER = vbulletin | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = font.png | |||||
| @@ -29,7 +29,7 @@ char *decode_vbulletin(struct image *img) | |||||
| if(!font) | if(!font) | ||||
| { | { | ||||
| font = font_load_fixed("font_vbulletin.png", | |||||
| font = font_load_fixed(DECODER, "font.png", | |||||
| "2346789ABCDEFGHJKLMNPRTWXYZ"); | "2346789ABCDEFGHJKLMNPRTWXYZ"); | ||||
| if(!font) | if(!font) | ||||
| exit(-1); | exit(-1); | ||||
| @@ -1,6 +1,22 @@ | |||||
| DECODER = xanga | |||||
| noinst_LIBRARIES = libdecoder.a | noinst_LIBRARIES = libdecoder.a | ||||
| libdecoder_a_SOURCES = decoder.c | libdecoder_a_SOURCES = decoder.c | ||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. | |||||
| libdecoder_a_CPPFLAGS = -I$(srcdir)/.. -DDECODER=\"$(DECODER)\" | |||||
| EXTRA_DIST = \ | |||||
| comic_24_az_messed.bmp \ | |||||
| comic_32_az.bmp \ | |||||
| freemonobold_24_az.bmp \ | |||||
| freemonobold_32_az.bmp \ | |||||
| freesansbold_32_az.bmp \ | |||||
| freesansbold_36_az_messed.bmp \ | |||||
| x_comic_24_az_messed.bmp \ | |||||
| x_comic_32_az.bmp \ | |||||
| x_freemonobold_24_az.bmp \ | |||||
| x_freemonobold_32_az.bmp \ | |||||
| x_freesansbold_32_az.bmp \ | |||||
| x_freesansbold_36_az_messed.bmp | |||||
| @@ -120,13 +120,13 @@ static void find_glyphs(struct image *img) | |||||
| static struct font *fonts[FONTS]; | static struct font *fonts[FONTS]; | ||||
| static char *files[] = | static char *files[] = | ||||
| { | { | ||||
| "x_font_freemonobold_32_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_font_freemonobold_24_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_font_freesansbold_32_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| //"x_font_freeserifbold_32_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_font_comic_32_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_font_comic_24_az_messed.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_font_freesansbold_36_az_messed.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_freemonobold_32_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_freemonobold_24_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_freesansbold_32_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| //"x_freeserifbold_32_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_comic_32_az.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_comic_24_az_messed.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| "x_freesansbold_36_az_messed.bmp", "abcdefghijklmnopqrstuvwxyz", | |||||
| }; | }; | ||||
| struct image *tmp; | struct image *tmp; | ||||
| int x, y, i = 0, f; | int x, y, i = 0, f; | ||||
| @@ -138,7 +138,8 @@ static void find_glyphs(struct image *img) | |||||
| { | { | ||||
| if(!fonts[f]) | if(!fonts[f]) | ||||
| { | { | ||||
| fonts[f] = font_load_variable(files[f * 2], files[f * 2 + 1]); | |||||
| fonts[f] = font_load_variable(DECODER, | |||||
| files[f * 2], files[f * 2 + 1]); | |||||
| if(!fonts[f]) | if(!fonts[f]) | ||||
| exit(1); | exit(1); | ||||
| //filter_smooth(fonts[f]->img); | //filter_smooth(fonts[f]->img); | ||||