From: kramm Date: Sat, 1 Dec 2001 20:08:00 +0000 (+0000) Subject: make output shorter: X-Git-Tag: release-0-2-1~77 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=39065f2cd792d02b67e8c235c68d824b988a94e4 make output shorter: * merge multiple showframes into one * show placeobject actionscript only with -a --- diff --git a/src/swfdump.c b/src/swfdump.c index 418a19a..95c57d6 100644 --- a/src/swfdump.c +++ b/src/swfdump.c @@ -96,14 +96,14 @@ int args_callback_longoption(char*name,char*val) void args_callback_usage(char*name) { printf("Usage: %s [-at] file.swf\n", name); - printf("\t-h , --help\t\t\t Print help and exit\n"); - printf("\t-e , --html\t\t\t Create a html embedding the file (simple, but useful)\n"); - printf("\t-X , --width\t\t\t Prints out a string of the form \"-X width\"\n"); - printf("\t-Y , --height\t\t\t Prints out a string of the form \"-Y height\"\n"); - printf("\t-r , --rate\t\t\t Prints out a string of the form \"-r rate\"\n"); - printf("\t-a , --action\t\t\t Disassemble action tags\n"); - printf("\t-t , --text\t\t\t Show text data\n"); - printf("\t-V , --version\t\t\t Print program version and exit\n"); + printf("\t-h , --help\t\t Print help and exit\n"); + printf("\t-e , --html\t\t Create a html embedding the file (simple, but useful)\n"); + printf("\t-X , --width\t\t Prints out a string of the form \"-X width\"\n"); + printf("\t-Y , --height\t\t Prints out a string of the form \"-Y height\"\n"); + printf("\t-r , --rate\t\t Prints out a string of the form \"-r rate\"\n"); + printf("\t-a , --action\t\t Disassemble action tags\n"); + printf("\t-t , --text\t\t Show text data\n"); + printf("\t-V , --version\t\t Print program version and exit\n"); } int args_callback_command(char*name,char*val) { @@ -308,30 +308,38 @@ void handlePlaceObject2(TAG*tag, char*prefix) } if(flags&64) swf_GetU16(tag); //clip if(flags&128) { - U8 handlerflags; - swf_GetU16(tag); - handlerflags = swf_GetU16(tag); - printf("%s global flags:%04x ",prefix, handlerflags); - printhandlerflags(handlerflags); + if (action) { + U16 globalflags; printf("\n"); - while(1) { + swf_GetU16(tag); + globalflags = swf_GetU16(tag); +// printf("%s global flags:%04x ",prefix, handlerflags); +// printhandlerflags(globalflags); +// printf("\n"); + while(1) { int length; int t; + U16 handlerflags; ActionTAG*a; handlerflags = swf_GetU16(tag); if(!handlerflags) break; - printf("%s flags:%04x ",prefix, handlerflags); + globalflags &= ~handlerflags; + printf("%s flags %04x ",prefix, handlerflags); printhandlerflags(handlerflags); - printf("\n"); length = swf_GetU32(tag); - printf("%s %d bytes actioncode\n",prefix); + printf(", %d bytes actioncode\n",length); a = swf_ActionGet(tag); swf_DumpActions(a,prefix); swf_ActionFree(a); } + if(globalflags) // should go to sterr. + printf("%s ERROR: unsatisfied handlerflags: %02x", globalflags); + } else { + printf(" has action code\n"); } + } else printf("\n"); } void fontcallback1(U16 id,U8 * name) @@ -494,7 +502,20 @@ int main (int argc,char ** argv) } else if(tag->id == ST_SHOWFRAME) { char*label = issprite?spriteframelabel:framelabel; - printf(" %d", issprite?spriteframe:mainframe); + int frame = issprite?spriteframe:mainframe; + int nframe = frame; + if(!label) { + while(tag->next && tag->next->id == ST_SHOWFRAME && tag->next->len == 0) { + tag = tag->next; + if(issprite) spriteframe++; + else mainframe++; + nframe++; + } + } + if(nframe == frame) + printf(" %d", frame); + else + printf(" %d-%d", frame, nframe); if(label) printf(" (label \"%s\")", label); if(issprite) {spriteframe++; spriteframelabel = 0;} @@ -511,6 +532,8 @@ int main (int argc,char ** argv) else printf("\n"); } + else if(tag->id == ST_PLACEOBJECT2) { + } else { printf("\n"); } @@ -544,8 +567,10 @@ int main (int argc,char ** argv) dumpButton2Actions(tag, myprefix); } else if(tag->id == ST_PLACEOBJECT2) { - if((*(U8*)tag->data)&0x80) - handlePlaceObject2(tag, myprefix); + if((*(U8*)tag->data)&0x80) + handlePlaceObject2(tag, myprefix); + else + printf("\n"); } tag = tag->next; }