X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fswfdump.c;h=be2a3ddf62a75f318115f7c8a71669939a65676a;hb=fb320dedbf20d805aa0595793300b863ca343c71;hp=c01a2b354de42bbe29e8a5b18aac8b5d0fe7e407;hpb=5f46881549f708a7a3dcce6c33072013f46db02d;p=swftools.git
diff --git a/src/swfdump.c b/src/swfdump.c
index c01a2b3..be2a3dd 100644
--- a/src/swfdump.c
+++ b/src/swfdump.c
@@ -51,6 +51,7 @@ static char * indent = " ";
static int placements = 0;
static int action = 0;
static int html = 0;
+static int xhtml = 0;
static int xy = 0;
static int showtext = 0;
static int showshapes = 0;
@@ -63,6 +64,7 @@ static struct options_t options[] = {
{"D", "full"},
{"V", "version"},
{"e", "html"},
+{"E", "xhtml"},
{"a", "action"},
{"t", "text"},
{"s", "shapes"},
@@ -103,6 +105,11 @@ int args_callback_option(char*name,char*val)
html = 1;
return 0;
}
+ else if(name[0]=='E') {
+ html = 1;
+ xhtml = 1;
+ return 0;
+ }
else if(name[0]=='X') {
xy |= 1;
return 0;
@@ -456,11 +463,13 @@ void handleVideoFrame(TAG*tag, char*prefix)
void handlePlaceObject2(TAG*tag, char*prefix)
{
- U8 flags = swf_GetU8(tag);
+ U8 flags;
MATRIX m;
CXFORM cx;
char pstr[3][160];
int ppos[3] = {0,0,0};
+ swf_SetTagPos(tag, 0);
+ flags = swf_GetU8(tag);
swf_GetU16(tag); //depth
//flags&1: move
@@ -551,16 +560,19 @@ void handlePlaceObject2(TAG*tag, char*prefix)
void handlePlaceObject(TAG*tag, char*prefix)
{
TAG*tag2 = swf_InsertTag(0, ST_PLACEOBJECT2);
-
- U16 id = swf_GetU16(tag);
- U16 depth = swf_GetU16(tag);
+ U16 id, depth;
MATRIX matrix;
CXFORM cxform;
+
+ swf_SetTagPos(tag, 0);
+ id = swf_GetU16(tag);
+ depth = swf_GetU16(tag);
swf_GetMatrix(tag, &matrix);
swf_GetCXForm(tag, &cxform, 0);
- swf_SetU8(tag2, 14);
+ swf_SetU8(tag2, 14 /* char, matrix, cxform */);
swf_SetU16(tag2, depth);
+ swf_SetU16(tag2, id);
swf_SetMatrix(tag2, &matrix);
swf_SetCXForm(tag2, &cxform, 1);
@@ -576,9 +588,15 @@ char* fillstyle2str(FILLSTYLE*style)
case 0x10: case 0x12:
sprintf(stylebuf, "GRADIENT (%d steps)", style->gradient.num);
break;
- case 0x40: case 0x41:
+ case 0x40:
/* TODO: display information about that bitmap */
- sprintf(stylebuf, "BITMAP %d", style->id_bitmap);
+ sprintf(stylebuf, "BITMAPt %d", style->id_bitmap);
+ /* TODO: show matrix */
+ break;
+ case 0x41:
+ /* TODO: display information about that bitmap */
+ sprintf(stylebuf, "BITMAPc %d", style->id_bitmap);
+ /* TODO: show matrix */
break;
default:
sprintf(stylebuf, "UNKNOWN[%02x]",style->type);
@@ -816,23 +834,34 @@ int main (int argc,char ** argv)
fprintf(stderr, "Fileversion>9\n");
exit(1);
}
- printf("\n", xsize, ysize, fileversions[swf.fileVersion],
- filename, filename, xsize, ysize);
+
+ if(xhtml) {
+ printf("\n\n", filename, xsize, ysize, filename);
+ } else {
+ printf("\n", xsize, ysize, fileversions[swf.fileVersion],
+ filename, filename, xsize, ysize);
+ }
return 0;
}
printf("[HEADER] File version: %d\n", swf.fileVersion);
@@ -916,8 +945,17 @@ int main (int argc,char ** argv)
printf(" object");
printf(" at depth %04d", swf_GetDepth(tag));
+
+ swf_SetTagPos(tag, 0);
+ if(tag->data[0]&64) {
+ SWFPLACEOBJECT po;
+ swf_GetPlaceObject(tag, &po);
+ printf(" (clip to %04d)", po.clipdepth);
+ swf_PlaceObjectFree(&po);
+ }
if(swf_GetName(tag))
printf(" name \"%s\"",swf_GetName(tag));
+
}
else if(tag->id == ST_REMOVEOBJECT) {
printf(" removes id %04d from depth %04d", swf_GetPlaceID(tag), swf_GetDepth(tag));
@@ -950,9 +988,9 @@ int main (int argc,char ** argv)
else if(tag->id == ST_FRAMELABEL) {
int l = strlen(tag->data);
printf(" \"%s\"", tag->data);
- if(l < tag->len-1) {
+ if((l+1) < tag->len) {
printf(" has %d extra bytes", tag->len-1-l);
- if(tag ->len-1-l == 1 && tag->data[tag->len-1] == 1)
+ if(tag ->len - (l+1) == 1 && tag->data[tag->len-1] == 1)
printf(" (ANCHOR)");
}
if((framelabel && !issprite) ||