flash9 tags implementation
authorkramm <kramm>
Sun, 9 Dec 2007 09:44:33 +0000 (09:44 +0000)
committerkramm <kramm>
Sun, 9 Dec 2007 09:44:33 +0000 (09:44 +0000)
lib/devices/swf.c
lib/modules/swfdump.c
lib/modules/swftools.c
lib/rfxswf.c
lib/rfxswf.h
src/swfdump.c

index d0ac1c4..872d0a9 100644 (file)
@@ -853,7 +853,7 @@ void swf_endframe(gfxdevice_t*dev)
     if(!i->pagefinished)
         endpage(dev);
 
-    if(i->config_insertstoptag) {
+    if( (i->swf->fileVersion <= 8) && (i->config_insertstoptag) ) {
        ActionTAG*atag=0;
        atag = action_Stop(atag);
        atag = action_End(atag);
@@ -1174,7 +1174,6 @@ void wipeSWF(SWF*swf)
     }
 }
 
-
 void swfoutput_finalize(gfxdevice_t*dev)
 {
     swfoutput_internal*i = (swfoutput_internal*)dev->internal;
@@ -1251,6 +1250,10 @@ void swfoutput_finalize(gfxdevice_t*dev)
        i->swf->compressed = 1;
     }
 
+    /* Initialize AVM2 if it is a Flash9 file */
+    if(i->config_flashversion>=9 && i->config_insertstoptag) {
+       AVM2_InsertStops(i->swf);
+    }
 //    if(i->config_reordertags)
 //     swf_Optimize(i->swf);
 }
index 0773f1f..b2a6698 100644 (file)
@@ -145,6 +145,8 @@ char* swf_TagGetName(TAG*tag)
             return "DEFINEEDITTEXT";
         case ST_DOACTION:
             return "DOACTION";
+        case ST_DOABC:
+            return "DOABC";
         case ST_DEFINEFONTINFO:
             return "DEFINEFONTINFO";
         case ST_DEFINESOUND:
@@ -205,6 +207,10 @@ char* swf_TagGetName(TAG*tag)
             return "EXTERNALFONT";
        case ST_EXPORTASSETS:
            return "EXPORTASSETS";
+       case ST_SYMBOLCLASS:
+           return "SYMBOLCLASS";
+       case ST_DEFINEBINARY:
+           return "DEFINEBINARY";
        case ST_IMPORTASSETS:
            return "IMPORTASSETS";
        case ST_ENABLEDEBUGGER:
index 6c37762..f763897 100644 (file)
@@ -241,6 +241,7 @@ static int swf_definingtagids[] =
  ST_DEFINEBUTTON2,
  ST_DEFINESOUND,
  ST_DEFINEVIDEOSTREAM,
+ ST_DEFINEBINARY,
  -1
 };
 
@@ -253,6 +254,7 @@ static int swf_spritetagids[] =
  ST_REMOVEOBJECT,
  ST_REMOVEOBJECT2,
  ST_DOACTION,
+ ST_DOABC,
  ST_STARTSOUND,
  ST_FRAMELABEL,
  ST_SOUNDSTREAMHEAD,
@@ -604,6 +606,7 @@ void enumerateUsedIDs(TAG * tag, int base, void (*callback)(TAG*, int, void*), v
 
        case ST_FREECHARACTER: /* unusual tags, which all start with an ID */
        case ST_NAMECHARACTER:
+       case ST_DEFINEBINARY:
        case ST_GENERATORTEXT:
            callback(tag, tag->pos + base, callback_data);
         break;
index a6071c4..adbdc5a 100644 (file)
@@ -1314,7 +1314,7 @@ int  swf_WriteSWF2(writer_t*writer, SWF * swf)     // Writes SWF to file, return
   if(swf->fileVersion >= 9) {
       if (swf->firstTag && swf->firstTag->id != ST_FILEATTRIBUTES)
       {
-         U32 flags = 0x8; // | 128 = usenetwork, | 8 = hasmetadata
+         U32 flags = 0x8; // | 128 = usenetwork, | 16 = Actionscript3 | 8 = hasmetadata
          swf_SetU32(swf_InsertTagBefore(swf, swf->firstTag,ST_FILEATTRIBUTES),flags);
       }
   }
@@ -1532,6 +1532,7 @@ void swf_FreeTags(SWF * swf)                 // Frees all malloc'ed memory for t
 #include "modules/swfcgi.c"
 #include "modules/swfbits.c"
 #include "modules/swfaction.c"
+#include "modules/swfabc.c"
 #include "modules/swfsound.c"
 #include "modules/swfdraw.c"
 #include "modules/swfrender.c"
index d33c268..67046f2 100644 (file)
@@ -326,11 +326,14 @@ SRECT swf_TurnRect(SRECT r, MATRIX* m);
 #define ST_DEFINEFONTALIGNZONES 73 /* version 8 */
 #define ST_CSMTEXTSETTINGS     74 /* version 8 */
 #define ST_DEFINEFONT3         75 /* version 8 */
+#define ST_SYMBOLCLASS         76 /* version 9 */
 #define ST_METADATA            77 /* version 8 */
 #define ST_DEFINESCALINGGRID    78 /* version 8 */
+#define ST_DOABC               82 /* version 9 */
 #define ST_DEFINESHAPE4                83 /* version 8 */
 #define ST_DEFINEMORPHSHAPE2    84 /* version 8 */
 #define ST_SCENEDESCRIPTION    86 /* version 9 */
+#define ST_DEFINEBINARY                87 /* version 9 */
 
 /* custom tags- only valid for swftools */
 #define ST_REFLEX              777 /* to identify generator software */
@@ -1062,6 +1065,8 @@ void swf_SetFilter(TAG*tag, FILTER*f);
 FILTER*swf_GetFilter(TAG*tag);
 FILTER*swf_NewFilter(U8 type);
 
+void AVM2_InsertStops(SWF*swf);
+
 #ifdef __cplusplus
 }
 #endif
index 1793ba0..35dc77e 100644 (file)
@@ -1281,7 +1281,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) {