X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfdump.c;h=81dae0c301eb2964ae186a9b1fd755a4295db43a;hb=045aa1a089fc49ab5b947d48c3a0d4c8b01452bc;hp=c019f4e095f5d1ec48db6df5a1a1f1e95ce3bce0;hpb=e141334f05e61793cda73b00d4aa07a689c41513;p=swftools.git diff --git a/src/swfdump.c b/src/swfdump.c index c019f4e..81dae0c 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) { @@ -142,12 +142,15 @@ void dumpButton2Actions(TAG*tag, char*prefix) { swf_GetU16(tag); // id swf_GetU16(tag); // layer swf_GetMatrix(tag,NULL); // matrix - swf_GetCXForm(tag,NULL,1); // matrix + swf_GetCXForm(tag,NULL,1); // cxform } while(offsetpos) { U8 a; ActionTAG*actions; + + if(tag->pos >= tag->len) + break; offsetpos = swf_GetU16(tag); condition = swf_GetU16(tag); // condition @@ -280,6 +283,64 @@ void handleEditText(TAG*tag) // printf(" text \"%s\"\n", &tag->data[tag->pos]) ; } +void printhandlerflags(U16 handlerflags) +{ + if(handlerflags&1) printf("[on load]"); + if(handlerflags&2) printf("[enter frame]"); + if(handlerflags&4) printf("[unload]"); + if(handlerflags&8) printf("[mouse move]"); + if(handlerflags&16) printf("[mouse down]"); + if(handlerflags&32) printf("[mouse up]"); + if(handlerflags&64) printf("[key down]"); + if(handlerflags&128) printf("[key up]"); + if(handlerflags&256) printf("[data]"); + if(handlerflags&0xfe00) printf("[???]"); +} +void handlePlaceObject2(TAG*tag, char*prefix) +{ + U8 flags = swf_GetU8(tag); + if(flags&2) swf_GetU16(tag); //id + if(flags&4) swf_GetMatrix(tag,0); + if(flags&8) swf_GetCXForm(tag,0,0); + if(flags&16) swf_GetU16(tag); //ratio + if(flags&32) { + while(swf_GetU8(tag)); + } + if(flags&64) swf_GetU16(tag); //clip + if(flags&128) { + if (action) { + U16 globalflags; + printf("\n"); + 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; + globalflags &= ~handlerflags; + printf("%s flags %04x ",prefix, handlerflags); + printhandlerflags(handlerflags); + + length = swf_GetU32(tag); + printf(", %d bytes actioncode\n",length); + a = swf_ActionGet(tag); + swf_DumpActions(a,prefix); + swf_ActionFree(a); + } + if(globalflags) // should go to sterr. + printf("ERROR: unsatisfied handlerflags: %02x", globalflags); + } else { + printf(" has action code\n"); + } + } else printf("\n"); +} void fontcallback1(U16 id,U8 * name) { fontnum++; @@ -441,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;} @@ -458,6 +532,8 @@ int main (int argc,char ** argv) else printf("\n"); } + else if(tag->id == ST_PLACEOBJECT2) { + } else { printf("\n"); } @@ -490,6 +566,12 @@ int main (int argc,char ** argv) else if(tag->id == ST_DEFINEBUTTON2 && action) { dumpButton2Actions(tag, myprefix); } + else if(tag->id == ST_PLACEOBJECT2) { + if((*(U8*)tag->data)&0x80) + handlePlaceObject2(tag, myprefix); + else + printf("\n"); + } tag = tag->next; } @@ -497,3 +579,4 @@ int main (int argc,char ** argv) return 0; } +