static int bbox = 0;
static int cumulative = 0;
static int showfonts = 0;
+static int showbuttons = 0;
static struct options_t options[] = {
{"h", "help"},
{"F", "fonts"},
{"p", "placements"},
{"b", "bbox"},
+{"B", "buttons"},
{"X", "width"},
{"Y", "height"},
{"r", "rate"},
bbox = 1;
return 0;
}
+ else if(name[0]=='B') {
+ showbuttons = 1;
+ return 0;
+ }
else if(name[0]=='D') {
- action = placements = showtext = showshapes = 1;
+ showbuttons = action = placements = showtext = showshapes = 1;
return 0;
}
else {
void dumpButtonActions(TAG*tag, char*prefix)
{
ActionTAG*actions;
+ swf_SetTagPos(tag, 0);
swf_GetU16(tag); // id
while (swf_GetU8(tag)) // state -> parse ButtonRecord
{ swf_GetU16(tag); // id
swf_DumpActions(actions, prefix);
}
+void dumpButton(TAG*tag, char*prefix)
+{
+ swf_SetTagPos(tag, 0);
+ swf_GetU16(tag); // id
+ while (1) {
+ U8 flags = swf_GetU8(tag);
+ if(!flags)
+ break;
+ U16 id = swf_GetU16(tag);
+ U16 depth = swf_GetU16(tag);
+ char event[80];
+ sprintf(event, "%s%s%s%s",
+ (flags&BS_HIT)?"[hit]":"",
+ (flags&BS_DOWN)?"[down]":"",
+ (flags&BS_OVER)?"[over]":"",
+ (flags&BS_UP)?"[up]":"");
+ if(flags&0xf0) {
+ printf("%s | Show %d at depth %d for %s flags=%02x\n", prefix, id, depth, event, flags);
+ } else {
+ printf("%s | Show %d at depth %d for %s\n", prefix, id, depth, event);
+ }
+ swf_GetMatrix(tag,NULL); // matrix
+ }
+}
+
void dumpFont(TAG*tag, char*prefix)
{
SWFFONT* font = malloc(sizeof(SWFFONT));
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;t<fontnum;t++)
{
if(fonts[t]->id == fontid) {
printf("%-2d) %s", t+1, linestyle2str(&shape.linestyles[t]));
}
printf("\n");
+ //if(shape.fillstyles[t].type&0x40) {
+ // MATRIX m = shape.fillstyles[t].m;
+ // swf_DumpMatrix(stdout, &m);
+ //}
}
printf("%s |\n", prefix);
#endif
close(f);
-
- if(action && swf.fileVersion>=9) {
- fprintf(stderr, "Actionscript parsing (-a) not yet supported for SWF versions>=9\n");
- action = 0;
- }
+
+ //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;
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 || tag->id==ST_DEFINEFONTNAME) {
actions = swf_ActionGet(tag);
swf_DumpActions(actions, myprefix);
}
+ else if(tag->id == ST_DOABC && action) {
+ swf_ReadABC(tag);
+ }
else if(tag->id == ST_DOINITACTION && action) {
ActionTAG*actions;
swf_GetU16(tag); // id
actions = swf_ActionGet(tag);
swf_DumpActions(actions, myprefix);
}
- else if(tag->id == ST_DEFINEBUTTON && action) {
- dumpButtonActions(tag, myprefix);
+ else if(tag->id == ST_DEFINEBUTTON) {
+ if(showbuttons) {
+ dumpButton(tag, myprefix);
+ }
+ if(action) {
+ dumpButtonActions(tag, myprefix);
+ }
}
else if(swf_isFontTag(tag) && showfonts) {
dumpFont(tag, myprefix);
}
- else if(tag->id == ST_DEFINEBUTTON2 && action) {
- dumpButton2Actions(tag, myprefix);
+ else if(tag->id == ST_DEFINEBUTTON2) {
+ if(action) {
+ dumpButton2Actions(tag, myprefix);
+ }
}
else if(tag->id == ST_PLACEOBJECT) {
handlePlaceObject(tag, myprefix);