X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfdump.c;h=3978d5c6c563ae78863c3b02c65b38891c03a7b0;hb=91d738fe108905d2103f735f564e123d78d07b29;hp=c9ca3954b9d7f11e8e5a8252303c759d6aef87e2;hpb=427ac5a71a17b9df0bd2d9893fa29fc98b8019e6;p=swftools.git diff --git a/src/swfdump.c b/src/swfdump.c index c9ca395..3978d5c 100644 --- a/src/swfdump.c +++ b/src/swfdump.c @@ -70,6 +70,7 @@ static struct options_t options[] = { {"a", "action"}, {"t", "text"}, {"s", "shapes"}, +{"F", "fonts"}, {"p", "placements"}, {"b", "bbox"}, {"X", "width"}, @@ -176,6 +177,7 @@ void args_callback_usage(char *name) printf("-a , --action Disassemble action tags\n"); printf("-t , --text Show text fields (like swfstrings).\n"); printf("-s , --shapes Show shape coordinates/styles\n"); + printf("-F , --fonts Show font information\n"); printf("-p , --placements Show placement information\n"); printf("-b , --bbox Print tag's bounding boxes\n"); printf("-X , --width Prints out a string of the form \"-X width\".\n"); @@ -286,7 +288,8 @@ void dumpFont(TAG*tag, char*prefix) printf("%slanguage: %02x\n", prefix,font->language); int t; for(t=0;tnumchars;t++) { - printf("%s== Glyph %d: advance=%d ==\n", prefix, t, font->glyph[t].advance); + int u = font->glyph2ascii?font->glyph2ascii[t]:-1; + printf("%s== Glyph %d: advance=%d encoding=%d ==\n", prefix, t, font->glyph[t].advance, u); SHAPE2* shape = swf_ShapeToShape2(font->glyph[t].shape); SHAPELINE*line = shape->lines; @@ -316,7 +319,7 @@ SWFFONT**fonts; void textcallback(void*self, int*glyphs, int*ypos, int nr, int fontid, int fontsize, int startx, int starty, RGBA*color) { int font=-1,t; - printf(" <%2d glyphs in font %2d, color #%02x%02x%02x%02x> ",nr, fontid, color->r, color->g, color->b, color->a); + printf(" <%2d glyphs in font %2d size %d, color #%02x%02x%02x%02x> ",nr, fontid, fontsize, color->r, color->g, color->b, color->a); for(t=0;tid == fontid) { @@ -535,6 +538,15 @@ void dumpFilter(FILTER*filter) FILTER_BLUR*f = (FILTER_BLUR*)filter; printf("blurx: %f blury: %f\n", f->blurx, f->blury); printf("passes: %d\n", f->passes); + } if(filter->type == FILTERTYPE_GLOW) { + FILTER_GLOW*f = (FILTER_GLOW*)filter; + printf("color %02x%02x%02x%02x\n", f->rgba.r,f->rgba.g,f->rgba.b,f->rgba.a); + printf("blurx: %f blury: %f strength: %f\n", f->blurx, f->blury, f->strength); + printf("passes: %d\n", f->passes); + printf("flags: %s%s%s\n", + f->knockout?"knockout ":"", + f->composite?"composite ":"", + f->innerglow?"innerglow":""); } if(filter->type == FILTERTYPE_DROPSHADOW) { FILTER_DROPSHADOW*f = (FILTER_DROPSHADOW*)filter; printf("blurx: %f blury: %f\n", f->blurx, f->blury); @@ -923,7 +935,6 @@ int main (int argc,char ** argv) } f = open(filename,O_RDONLY|O_BINARY); - if (f<0) { char buffer[256]; @@ -931,6 +942,12 @@ int main (int argc,char ** argv) perror(buffer); exit(1); } + char header[3]; + read(f, header, 3); + int compressed = (header[0]=='C'); + close(f); + f = open(filename,O_RDONLY|O_BINARY); + if FAILED(swf_ReadSWF(f,&swf)) { fprintf(stderr, "%s is not a valid SWF file or contains errors.\n",filename); @@ -940,7 +957,7 @@ int main (int argc,char ** argv) #ifdef HAVE_STAT fstat(f, &statbuf); - if(statbuf.st_size != swf.fileSize && !swf.compressed) + if(statbuf.st_size != swf.fileSize && !compressed) dumperror("Real Filesize (%d) doesn't match header Filesize (%d)", statbuf.st_size, swf.fileSize); filesize = statbuf.st_size; @@ -948,6 +965,11 @@ int main (int argc,char ** argv) close(f); + //if(action && swf.fileVersion>=9) { + // fprintf(stderr, "Actionscript parsing (-a) not yet supported for SWF versions>=9\n"); + // action = 0; + //} + xsize = (swf.movieSize.xmax-swf.movieSize.xmin)/20; ysize = (swf.movieSize.ymax-swf.movieSize.ymin)/20; if(xy) @@ -1015,7 +1037,7 @@ int main (int argc,char ** argv) return 0; } printf("[HEADER] File version: %d\n", swf.fileVersion); - if(swf.compressed) { + if(compressed) { printf("[HEADER] File is zlib compressed."); if(filesize && swf.fileSize) printf(" Ratio: %02d%%\n", filesize*100/(swf.fileSize)); @@ -1243,9 +1265,15 @@ int main (int argc,char ** argv) else printf("\n"); } + else if(tag->id == ST_DEFINESCALINGGRID) { + U16 id = swf_GetU16(tag); + SRECT r; + swf_GetRect(tag, &r); + printf(" (%.2f,%.2f)-(%.2f,%.2f)\n", r.xmin/20.0, r.ymin/20.0, r.xmax/20.0, r.ymax/20.0); + } else if(tag->id == ST_PLACEOBJECT2 || tag->id == ST_PLACEOBJECT3) { } - else if(tag->id == ST_NAMECHARACTER) { + else if(tag->id == ST_NAMECHARACTER || tag->id==ST_DEFINEFONTNAME) { swf_GetU16(tag); printf(" \"%s\"\n", swf_GetString(tag)); } @@ -1280,7 +1308,7 @@ int main (int argc,char ** argv) if(tag->len) dumperror("End Tag not empty"); } - else if(tag->id == ST_EXPORTASSETS) { + else if(tag->id == ST_EXPORTASSETS || tag->id == ST_SYMBOLCLASS) { handleExportAssets(tag, myprefix); } else if(tag->id == ST_DOACTION && action) { @@ -1288,6 +1316,9 @@ int main (int argc,char ** argv) actions = swf_ActionGet(tag); swf_DumpActions(actions, myprefix); } + else if(tag->id == ST_DOABC && action) { + swf_DissassembleABC(tag); + } else if(tag->id == ST_DOINITACTION && action) { ActionTAG*actions; swf_GetU16(tag); // id @@ -1309,6 +1340,13 @@ int main (int argc,char ** argv) else if(tag->id == ST_PLACEOBJECT2 || tag->id == ST_PLACEOBJECT3) { handlePlaceObject23(tag, myprefix); } + else if(tag->id == ST_DEFINEFONTNAME) { + swf_SetTagPos(tag, 0); + swf_GetU16(tag); //id + swf_GetString(tag); //name + char* copyright = swf_GetString(tag); + printf("%s%s\n", myprefix, copyright); + } else if(tag->id == ST_DEFINESHAPE || tag->id == ST_DEFINESHAPE2 || tag->id == ST_DEFINESHAPE3 ||