1 /****************************************************************************
2 *
3 * Copyright (C) 2005-2006 "Stuart R. Anderson" <anderson@netsweng.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 ****************************************************************************/
20
21 #include "blocks/blocktypes.h"
22 #include "action.h"
23 #include "parser.h"
24 #include "read.h"
25 #include "decompile.h"
26 #include "swfoutput.h"
27 #include "abctypes.h"
28
29 #include <stdio.h>
30 #include <stdarg.h>
31 #include <string.h>
32
33 extern const char *blockName (SWFBlocktype header);
34
35 extern int verbose;
36
37 extern struct Movie m;
38 /*
39 * This file contains output functions that can display the different SWF block
40 * types in a human readable format.
41 */
42
43 #define OUT_BEGIN(block) \
44 struct block *sblock = (struct block *)pblock;
45
46 static struct SWFBlockOutput outputs[] = {
47 {SWF_CHARACTERSET, outputSWF_CHARACTERSET},
48 {SWF_DEFINEBITS, outputSWF_DEFINEBITS},
49 {SWF_DEFINEBITSJPEG2, outputSWF_DEFINEBITSJPEG2},
50 {SWF_DEFINEBITSJPEG3, outputSWF_DEFINEBITSJPEG3},
51 {SWF_DEFINEBITSPTR, outputSWF_DEFINEBITSPTR},
52 {SWF_DEFINEBUTTON, outputSWF_DEFINEBUTTON},
53 {SWF_DEFINEBUTTON2, outputSWF_DEFINEBUTTON2},
54 {SWF_DEFINEBUTTONCXFORM, outputSWF_DEFINEBUTTONCXFORM},
55 {SWF_DEFINEBUTTONSOUND, outputSWF_DEFINEBUTTONSOUND},
56 {SWF_DEFINECOMMANDOBJ, outputSWF_DEFINECOMMANDOBJ},
57 {SWF_DEFINEEDITTEXT, outputSWF_DEFINEEDITTEXT},
58 {SWF_DEFINEFONT, outputSWF_DEFINEFONT},
59 {SWF_DEFINEFONT2, outputSWF_DEFINEFONT2},
60 {SWF_DEFINEFONT3, outputSWF_DEFINEFONT3},
61 {SWF_DEFINEFONTINFO, outputSWF_DEFINEFONTINFO},
62 {SWF_DEFINEFONTINFO2, outputSWF_DEFINEFONTINFO2},
63 {SWF_CSMTEXTSETTINGS, outputSWF_CSMTEXTSETTINGS},
64 {SWF_DEFINEFONTNAME, outputSWF_DEFINEFONTNAME},
65 {SWF_DEFINEFONTALIGNZONES, outputSWF_DEFINEFONTALIGNZONES},
66 {SWF_DEFINELOSSLESS, outputSWF_DEFINELOSSLESS},
67 {SWF_DEFINELOSSLESS2, outputSWF_DEFINELOSSLESS2},
68 {SWF_DEFINEMORPHSHAPE, outputSWF_DEFINEMORPHSHAPE},
69 {SWF_DEFINEMORPHSHAPE2, outputSWF_DEFINEMORPHSHAPE2},
70 {SWF_DEFINESHAPE, outputSWF_DEFINESHAPE},
71 {SWF_DEFINESHAPE2, outputSWF_DEFINESHAPE2},
72 {SWF_DEFINESHAPE3, outputSWF_DEFINESHAPE3},
73 {SWF_DEFINESHAPE4, outputSWF_DEFINESHAPE4},
74 {SWF_DEFINESOUND, outputSWF_DEFINESOUND},
75 {SWF_DEFINESPRITE, outputSWF_DEFINESPRITE},
76 {SWF_DEFINETEXT, outputSWF_DEFINETEXT},
77 {SWF_DEFINETEXT2, outputSWF_DEFINETEXT2},
78 {SWF_DEFINETEXTFORMAT, outputSWF_DEFINETEXTFORMAT},
79 {SWF_DEFINEVIDEO, outputSWF_DEFINEVIDEO},
80 {SWF_DEFINEVIDEOSTREAM, outputSWF_DEFINEVIDEOSTREAM},
81 {SWF_DOACTION, outputSWF_DOACTION},
82 {SWF_ENABLEDEBUGGER, outputSWF_ENABLEDEBUGGER},
83 {SWF_ENABLEDEBUGGER2, outputSWF_ENABLEDEBUGGER2},
84 {SWF_END, outputSWF_END},
85 {SWF_EXPORTASSETS, outputSWF_EXPORTASSETS},
86 {SWF_FONTREF, outputSWF_FONTREF},
87 {SWF_FRAMELABEL, outputSWF_FRAMELABEL},
88 {SWF_FRAMETAG, outputSWF_FRAMETAG},
89 {SWF_FREEALL, outputSWF_FREEALL},
90 {SWF_FREECHARACTER, outputSWF_FREECHARACTER},
91 {SWF_GENCOMMAND, outputSWF_GENCOMMAND},
92 {SWF_IMPORTASSETS, outputSWF_IMPORTASSETS},
93 {SWF_IMPORTASSETS2, outputSWF_IMPORTASSETS2},
94 {SWF_JPEGTABLES, outputSWF_JPEGTABLES},
95 {SWF_NAMECHARACTER, outputSWF_NAMECHARACTER},
96 {SWF_PATHSAREPOSTSCRIPT, outputSWF_PATHSAREPOSTSCRIPT},
97 {SWF_PLACEOBJECT, outputSWF_PLACEOBJECT},
98 {SWF_PLACEOBJECT2, outputSWF_PLACEOBJECT2},
99 {SWF_PLACEOBJECT3, outputSWF_PLACEOBJECT3},
100 {SWF_PREBUILT, outputSWF_PREBUILT},
101 {SWF_PREBUILTCLIP, outputSWF_PREBUILTCLIP},
102 {SWF_PROTECT, outputSWF_PROTECT},
103 {SWF_REMOVEOBJECT, outputSWF_REMOVEOBJECT},
104 {SWF_REMOVEOBJECT2, outputSWF_REMOVEOBJECT2},
105 {SWF_SERIALNUMBER, outputSWF_SERIALNUMBER},
106 {SWF_SETBACKGROUNDCOLOR, outputSWF_SETBACKGROUNDCOLOR},
107 {SWF_SHOWFRAME, outputSWF_SHOWFRAME},
108 {SWF_SOUNDSTREAMBLOCK, outputSWF_SOUNDSTREAMBLOCK},
109 {SWF_SOUNDSTREAMHEAD, outputSWF_SOUNDSTREAMHEAD},
110 {SWF_SOUNDSTREAMHEAD2, outputSWF_SOUNDSTREAMHEAD2},
111 {SWF_STARTSOUND, outputSWF_STARTSOUND},
112 {SWF_STARTSOUND2, outputSWF_STARTSOUND2},
113 {SWF_SYNCFRAME, outputSWF_SYNCFRAME},
114 {SWF_INITACTION, outputSWF_INITACTION},
115 {SWF_VIDEOFRAME, outputSWF_VIDEOFRAME},
116 {SWF_REFLEX, outputSWF_REFLEX},
117 {SWF_FILEATTRIBUTES, outputSWF_FILEATTRIBUTES},
118 {SWF_METADATA, outputSWF_METADATA},
119 {SWF_SCRIPTLIMITS, outputSWF_SCRIPTLIMITS},
120 {SWF_DEFINESCALINGGRID, outputSWF_DEFINESCALINGGRID},
121 {SWF_SETTABINDEX, outputSWF_SETTABINDEX},
122 {SWF_DOABC, outputSWF_DOABC},
123 {SWF_SYMBOLCLASS, outputSWF_SYMBOLCLASS},
124 {SWF_DEFINESCENEANDFRAMEDATA, outputSWF_DEFINESCENEANDFRAMEDATA},
125 {SWF_DEBUGID, outputSWF_DEBUGID},
126 };
127
128 static int numOutputs = sizeof (outputs) / sizeof (struct SWFBlockOutput);
129
130 /* Indented output function */
131
132 static unsigned INDENT=0;
133
134 static void
_iprintf(const char * fmt,...)135 _iprintf(const char* fmt, ...)
136 {
137 va_list ap;
138 unsigned ii=INDENT;
139
140 /* do intenting */
141 while(ii--) printf(" ");
142
143 va_start (ap, fmt);
144 vprintf(fmt, ap);
145 return;
146 }
147
148 /* Output basic Flash Types */
149
150 void
outputSWF_RGBA(SWF_RGBA * rgb,char * pname)151 outputSWF_RGBA (SWF_RGBA * rgb, char *pname)
152 {
153 _iprintf (" RGBA: (");
154 _iprintf ("%2x,", rgb->red);
155 _iprintf ("%2x,", rgb->green);
156 _iprintf ("%2x,", rgb->blue);
157 _iprintf ("%2x)\n", rgb->alpha);
158 }
159
160 void
outputSWF_RECT(SWF_RECT * rect)161 outputSWF_RECT (SWF_RECT * rect)
162 {
163 _iprintf (" RECT: ");
164 _iprintf (" (%ld,", rect->Xmin);
165 _iprintf ("%ld)x", rect->Ymin);
166 _iprintf ("(%ld,", rect->Xmax);
167 _iprintf ("%ld)", rect->Ymax);
168 _iprintf (":%d\n", rect->Nbits);
169 }
170
171 void
outputSWF_MATRIX(SWF_MATRIX * matrix,char * name)172 outputSWF_MATRIX (SWF_MATRIX * matrix, char *name)
173 {
174 _iprintf (" Matrix:\n");
175 if (matrix->HasScale)
176 {
177 _iprintf (" ScaleX %f ", matrix->ScaleX);
178 _iprintf ("ScaleY %f\n", matrix->ScaleY);
179 }
180 if (matrix->HasRotate)
181 {
182 _iprintf (" RotateSkew0 %f ", matrix->RotateSkew0);
183 _iprintf ("RotateSkew1 %f\n", matrix->RotateSkew1);
184 }
185 _iprintf (" TranslateX %6ld ", matrix->TranslateX);
186 _iprintf ("TranslateY %6ld\n", matrix->TranslateY);
187 }
188
189 void
outputSWF_CXFORM(SWF_CXFORM * cxform)190 outputSWF_CXFORM(SWF_CXFORM * cxform){
191 _iprintf(" ColorTransform:\n");
192 if (cxform->HasMultTerms){
193 _iprintf(" Mult:");
194 _iprintf("%ld,", cxform->RedMultTerm);
195 _iprintf("%ld,", cxform->GreenMultTerm);
196 _iprintf("%ld,", cxform->BlueMultTerm);
197 /*
198 if (cxform->hasAlpha){
199 _iprintf("%ld", cxform->AlphaMultTerm);
200 }
201 */
202 _iprintf("\n");
203 }
204
205 if (cxform->HasAddTerms){
206 _iprintf(" Add:");
207 _iprintf("%ld,", cxform->RedAddTerm);
208 _iprintf("%ld,", cxform->GreenAddTerm);
209 _iprintf("%ld,", cxform->BlueAddTerm);
210 /*
211 if (cxform->hasAlpha){
212 _iprintf("%ld", cxform->AlphaAddTerm);
213 }
214 */
215 _iprintf("\n");
216 }
217 }
218
219 /* alpha could be handled in SWF_CXFORM / outputSWF_CXFORM too
220 * or is there a reason to make
221 * 2 parsefunctions /
222 * 2 cxform structures
223 * 2 outputfunctions
224 * for that?
225 */
226 void
outputSWF_CXFORMWITHALPHA(SWF_CXFORMWITHALPHA * cxform,char * name)227 outputSWF_CXFORMWITHALPHA(SWF_CXFORMWITHALPHA * cxform, char *name){
228 _iprintf(" ColorTransform:\n");
229 if (cxform->HasMultTerms){
230 _iprintf(" Mult:");
231 _iprintf("%ld,", cxform->RedMultTerm);
232 _iprintf("%ld,", cxform->GreenMultTerm);
233 _iprintf("%ld,", cxform->BlueMultTerm);
234 _iprintf("%ld", cxform->AlphaMultTerm);
235 _iprintf("\n");
236 }
237 if (cxform->HasAddTerms){
238 _iprintf(" Add:");
239 _iprintf("%ld,", cxform->RedAddTerm);
240 _iprintf("%ld,", cxform->GreenAddTerm);
241 _iprintf("%ld,", cxform->BlueAddTerm);
242 _iprintf("%ld", cxform->AlphaAddTerm);
243 _iprintf("\n");
244 }
245 }
246
247 void
248 outputSWF_FILTER(SWF_FILTER *filter);
249
250 void
outputSWF_BUTTONRECORD(SWF_BUTTONRECORD * brec)251 outputSWF_BUTTONRECORD (SWF_BUTTONRECORD *brec)
252 {
253 _iprintf (" BUTTONRECORD: ");
254 _iprintf (" ButtonHasBlendMode %d ", brec->ButtonHasBlendMode);
255 _iprintf (" ButtonHasFilterList %d ", brec->ButtonHasFilterList);
256 _iprintf (" ButtonStateHitTest: %d ", brec->ButtonStateHitTest);
257 _iprintf (" ButtonStateDown: %d ", brec->ButtonStateDown);
258 _iprintf (" ButtonStateOver: %d ", brec->ButtonStateOver);
259 _iprintf (" ButtonStateUp: %d\n", brec->ButtonStateUp);
260 _iprintf (" CharacterID: %d\n", brec->CharacterId);
261 _iprintf (" PlaceDepth: %d\n", brec->PlaceDepth);
262
263 outputSWF_MATRIX(&brec->PlaceMatrix,"");
264 outputSWF_CXFORMWITHALPHA(&brec->ColorTransform,"");
265 if( brec->ButtonHasBlendMode )
266 _iprintf(" BlendMode %d\n", brec->BlendMode );
267 if( brec->ButtonHasFilterList )
268 {
269 int i;
270 SWF_FILTERLIST *filterList = &brec->FilterList;
271
272 _iprintf(" NumberOfFilters %d\n", filterList->NumberOfFilters);
273
274 for(i = 0; i < filterList->NumberOfFilters; i++)
275 outputSWF_FILTER(filterList->Filter + i);
276 }
277 }
278
279 void
outputSWF_BUTTONCONDACTION(SWF_BUTTONCONDACTION * bcarec)280 outputSWF_BUTTONCONDACTION (SWF_BUTTONCONDACTION *bcarec)
281 {
282 #ifdef NODECOMPILE
283 int i;
284 #endif
285 #if !defined(ACTIONONLY)
286 _iprintf (" BUTTONCONDACTION: ");
287 _iprintf (" CondActionSize: %d\n", bcarec->CondActionSize);
288 _iprintf (" CondIdleToOverDown: %d ", bcarec->CondIdleToOverDown);
289 _iprintf (" CondOutDownToIdle: %d ", bcarec->CondOutDownToIdle);
290 _iprintf (" CondOutDownToOverDown: %d ", bcarec->CondOutDownToOverDown);
291 _iprintf (" CondOverDownToOutDown: %d ", bcarec->CondOverDownToOutDown);
292 _iprintf (" CondOverDownToOverUp: %d ", bcarec->CondOverDownToOverUp);
293 _iprintf (" CondOverUpToOverDown: %d ", bcarec->CondOverUpToOverDown);
294 _iprintf (" CondOverUpToIdle: %d ", bcarec->CondOverUpToIdle);
295 _iprintf (" CondIdleToOverUp: %d ", bcarec->CondIdleToOverUp);
296 _iprintf (" CondKeyPress: %d ", bcarec->CondKeyPress);
297 _iprintf (" CondOverDownToIdle: %d ", bcarec->CondOverDownToIdle);
298 _iprintf ("\n");
299 #endif
300 #ifdef NODECOMPILE
301 _iprintf(" %d Actions\n", bcarec->numActions);
302 for(i=0;i<bcarec->numActions;i++)
303 outputSWF_ACTION(i,&(bcarec->Actions[i]));
304 #else
305 _iprintf (" %s\n", decompile5Action(bcarec->numActions,bcarec->Actions,0));
306 #endif
307 }
308
309 void
outputSWF_CLIPEVENTFLAGS(SWF_CLIPEVENTFLAGS * clipevflags)310 outputSWF_CLIPEVENTFLAGS (SWF_CLIPEVENTFLAGS * clipevflags )
311 {
312 if ( clipevflags->ClipEventKeyUp ) printf (" ClipEventKeyUp");
313 if ( clipevflags->ClipEventKeyDown ) printf (" ClipEventKeyDown");
314 if ( clipevflags->ClipEventMouseUp ) printf (" ClipEventMouseUp");
315 if ( clipevflags->ClipEventMouseDown ) printf (" ClipEventMouseDown");
316 if ( clipevflags->ClipEventMouseMove ) printf (" ClipEventMouseMove");
317 if ( clipevflags->ClipEventUnload ) printf (" ClipEventUnload");
318 if ( clipevflags->ClipEventEnterFrame ) printf (" ClipEventEnterFrame");
319 if ( clipevflags->ClipEventLoad ) printf (" ClipEventLoad");
320 if ( clipevflags->ClipEventDragOver ) printf (" ClipEventDragOver");
321 if ( clipevflags->ClipEventRollOut ) printf (" ClipEventRollOut");
322 if ( clipevflags->ClipEventRollOver ) printf (" ClipEventRollOver");
323 if ( clipevflags->ClipEventReleaseOutside ) printf (" ClipEventReleaseOutside");
324 if ( clipevflags->ClipEventRelease ) _iprintf (" ClipEventRelease");
325 if ( clipevflags->ClipEventPress ) _iprintf (" ClipEventPress");
326 if ( clipevflags->ClipEventInitialize ) _iprintf (" ClipEventInitialize");
327 if ( clipevflags->ClipEventData ) _iprintf (" ClipEventData");
328 if ( clipevflags->ClipEventConstruct ) _iprintf (" ClipEventConstruct");
329 if ( clipevflags->ClipEventKeyPress ) _iprintf (" ClipEventKeyPress");
330 if ( clipevflags->ClipEventDragOut ) _iprintf (" ClipEventDragOut");
331 }
332
333 void
outputSWF_CLIPACTIONRECORD(SWF_CLIPACTIONRECORD * carec)334 outputSWF_CLIPACTIONRECORD (SWF_CLIPACTIONRECORD * carec )
335 {
336 #ifdef NODECOMPILE
337 int i;
338 #endif
339 #if !defined(ACTIONONLY)
340 _iprintf(" onClipEvents("); outputSWF_CLIPEVENTFLAGS (&carec->EventFlag); printf(" ):\n");
341 /*_iprintf(" ActionRecordSize %ld\n", carec->ActionRecordSize);*/
342 if ( carec->KeyCode) _iprintf(" EventKeyCode %d\n", carec->KeyCode);
343 #endif
344 #ifdef NODECOMPILE
345 ++INDENT;
346 /*_iprintf(" %d Actions\n", carec->numActions);*/
347 for(i=0;i<carec->numActions;i++)
348 outputSWF_ACTION(i,&(carec->Actions[i]));
349 --INDENT;
350 #else
351 ++INDENT;
352 _iprintf (" %s\n", decompile5Action(carec->numActions,carec->Actions,0));
353 --INDENT;
354 #endif
355 }
356
357 void
outputSWF_CLIPACTIONS(SWF_CLIPACTIONS * clipactions)358 outputSWF_CLIPACTIONS (SWF_CLIPACTIONS * clipactions )
359 {
360 int i;
361 for(i=0;i<clipactions->NumClipRecords-1;i++)
362 outputSWF_CLIPACTIONRECORD(&(clipactions->ClipActionRecords[i]));
363 }
364
365 void
outputSWF_GRADIENTRECORD(SWF_GRADIENTRECORD * gradientrec,char * gname)366 outputSWF_GRADIENTRECORD (SWF_GRADIENTRECORD * gradientrec, char *gname)
367 {
368 _iprintf (" Ratio: %d\n", gradientrec->Ratio);
369 outputSWF_RGBA (&gradientrec->Color, "");
370 }
371
372 void
outputSWF_MORPHGRADIENTRECORD(SWF_MORPHGRADIENTRECORD * gradientrec,char * gname)373 outputSWF_MORPHGRADIENTRECORD (SWF_MORPHGRADIENTRECORD * gradientrec,
374 char *gname)
375 {
376 _iprintf (" StartRatio: %d\n", gradientrec->StartRatio);
377 outputSWF_RGBA (&gradientrec->StartColor, "");
378 _iprintf (" EndRatio: %d\n", gradientrec->EndRatio);
379 outputSWF_RGBA (&gradientrec->EndColor, "");
380 }
381
382 void
outputFIXED(FIXED fixed,const char * prefix)383 outputFIXED(FIXED fixed, const char *prefix)
384 {
385 float f;
386
387 f = fixed * 1.0 / (1<<16);
388 _iprintf("%s%f\n", prefix, f);
389 }
390
391 void
outputFIXED8(FIXED fixed,const char * prefix)392 outputFIXED8(FIXED fixed, const char *prefix)
393 {
394 float f;
395
396 f = fixed * 1.0 / (1<<8);
397 _iprintf("%s%f\n", prefix, f);
398 }
399
400 void
outputSWF_FOCALGRADIENT(SWF_FOCALGRADIENT * gradient,char * name)401 outputSWF_FOCALGRADIENT (SWF_FOCALGRADIENT * gradient, char *name)
402 {
403 int i;
404 _iprintf (" Gradient: ");
405 _iprintf (" SpreadMode: %d\n", gradient->SpreadMode);
406 _iprintf (" InterpolationMode: %d\n", gradient->InterpolationMode);
407 _iprintf (" NumGradients: %d\n", gradient->NumGradients);
408 for (i = 0; i < gradient->NumGradients; i++)
409 outputSWF_GRADIENTRECORD (&(gradient->GradientRecords[i]),"");
410 outputFIXED8(gradient->FocalPoint, " FocalPoint: ");
411 }
412
413 void
outputSWF_GRADIENT(SWF_GRADIENT * gradient,char * name)414 outputSWF_GRADIENT (SWF_GRADIENT * gradient, char *name)
415 {
416 int i;
417 _iprintf (" Gradient: ");
418 _iprintf (" SpreadMode: %d\n", gradient->SpreadMode);
419 _iprintf (" InterpolationMode: %d\n", gradient->InterpolationMode);
420 _iprintf (" NumGradients: %d\n", gradient->NumGradients);
421 for (i = 0; i < gradient->NumGradients; i++)
422 outputSWF_GRADIENTRECORD (&(gradient->GradientRecords[i]),"");
423 }
424
425 void
outputSWF_MORPHGRADIENT(SWF_MORPHGRADIENT * gradient,char * name)426 outputSWF_MORPHGRADIENT (SWF_MORPHGRADIENT * gradient, char *name)
427 {
428 int i;
429 _iprintf (" MorphGradient: ");
430 _iprintf (" NumGradients: %d\n", gradient->NumGradients);
431 for (i = 0; i < gradient->NumGradients; i++)
432 outputSWF_MORPHGRADIENTRECORD (&(gradient->GradientRecords[i]),"");
433 }
434
435
436 void
outputSWF_FILLSTYLE(SWF_FILLSTYLE * fillstyle,char * name,int i)437 outputSWF_FILLSTYLE (SWF_FILLSTYLE * fillstyle, char *name, int i)
438 {
439 _iprintf (" FillStyle: ");
440 _iprintf (" FillStyleType: %x\n", fillstyle->FillStyleType);
441 switch (fillstyle->FillStyleType)
442 {
443 case 0x00: /* Solid Fill */
444 outputSWF_RGBA (&fillstyle->Color, "");
445 break;
446 case 0x10: /* Linear Gradient Fill */
447 case 0x12: /* Radial Gradient Fill */
448 outputSWF_MATRIX (&fillstyle->GradientMatrix,"");
449 outputSWF_GRADIENT (&fillstyle->Gradient,"");
450 break;
451 case 0x13:
452 outputSWF_MATRIX (&fillstyle->GradientMatrix,"");
453 outputSWF_FOCALGRADIENT(&fillstyle->FocalGradient, "");
454 case 0x40: /* Repeating Bitmap Fill */
455 case 0x41: /* Clipped Bitmap Fill */
456 case 0x42: /* Non-smoothed Repeating Bitmap Fill */
457 case 0x43: /* Non-smoothed Clipped Bitmap Fill */
458 _iprintf (" BitmapID: %d\n", fillstyle->BitmapId);
459 outputSWF_MATRIX (&fillstyle->BitmapMatrix,"");
460 break;
461 }
462 }
463
464 void
outputSWF_FILLSTYLEARRAY(SWF_FILLSTYLEARRAY * fillstylearray,char * name)465 outputSWF_FILLSTYLEARRAY (SWF_FILLSTYLEARRAY * fillstylearray, char *name)
466 {
467 int count, i;
468
469 _iprintf (" FillStyleArray: ");
470 _iprintf (" FillStyleCount: %6d ", fillstylearray->FillStyleCount);
471 _iprintf (" FillStyleCountExtended: %6d\n",
472 fillstylearray->FillStyleCountExtended);
473 count =
474 (fillstylearray->FillStyleCount !=
475 0xff) ? fillstylearray->FillStyleCount : fillstylearray->
476 FillStyleCountExtended;
477 for (i = 0; i < count; i++)
478 {
479 outputSWF_FILLSTYLE (&(fillstylearray->FillStyles[i]),"",0);
480 }
481 }
482
483 void
outputSWF_MORPHFILLSTYLE(SWF_MORPHFILLSTYLE * fillstyle,char * name,int i)484 outputSWF_MORPHFILLSTYLE (SWF_MORPHFILLSTYLE * fillstyle, char *name,
485 int i)
486 {
487 _iprintf (" MorphFillStyle: ");
488 _iprintf (" FillStyleType: %x\n", fillstyle->FillStyleType);
489 switch (fillstyle->FillStyleType)
490 {
491 case 0x00: /* Solid Fill */
492 outputSWF_RGBA (&fillstyle->StartColor, "");
493 outputSWF_RGBA (&fillstyle->EndColor, "");
494 break;
495 case 0x10: /* Linear Gradient Fill */
496 case 0x12: /* Radial Gradient Fill */
497 outputSWF_MATRIX (&fillstyle->StartGradientMatrix,"");
498 outputSWF_MATRIX (&fillstyle->EndGradientMatrix,"");
499 outputSWF_MORPHGRADIENT (&fillstyle->Gradient,"");
500 break;
501 case 0x40: /* Repeating Bitmap Fill */
502 case 0x41: /* Clipped Bitmap Fill */
503 case 0x42: /* Non-smoothed Repeating Bitmap Fill */
504 case 0x43: /* Non-smoothed Clipped Bitmap Fill */
505 _iprintf (" BitmapID: %d\n", fillstyle->BitmapId);
506 outputSWF_MATRIX (&fillstyle->StartBitmapMatrix,"");
507 outputSWF_MATRIX (&fillstyle->EndBitmapMatrix,"");
508 break;
509 }
510 }
511
512 void
outputSWF_MORPHFILLSTYLES(SWF_MORPHFILLSTYLES * fillstylearray)513 outputSWF_MORPHFILLSTYLES( SWF_MORPHFILLSTYLES *fillstylearray)
514 {
515 int count, i;
516
517 if( !verbose )
518 return;
519 _iprintf (" MorphFillStyleArray: ");
520 _iprintf (" FillStyleCount: %6d ", fillstylearray->FillStyleCount);
521 _iprintf (" FillStyleCountExtended: %6d\n",
522 fillstylearray->FillStyleCountExtended);
523 count =
524 (fillstylearray->FillStyleCount !=
525 0xff) ? fillstylearray->FillStyleCount : fillstylearray->
526 FillStyleCountExtended;
527 for (i = 0; i < count; i++)
528 {
529 outputSWF_MORPHFILLSTYLE (&(fillstylearray->FillStyles[i]),"",0);
530 }
531 }
532
533
534 void
outputSWF_LINESTYLE(SWF_LINESTYLE * fillstyle,char * name,int i)535 outputSWF_LINESTYLE (SWF_LINESTYLE * fillstyle, char *name, int i)
536 {
537 _iprintf (" LineStyle: ");
538 _iprintf (" Width: %d\n", fillstyle->Width);
539 outputSWF_RGBA (&fillstyle->Color, "");
540 }
541
542 void
outputSWF_LINESTYLE2(SWF_LINESTYLE2 * fillstyle,char * name,int i)543 outputSWF_LINESTYLE2 (SWF_LINESTYLE2 * fillstyle, char *name, int i)
544 {
545 _iprintf (" LineStyle2: ");
546 _iprintf (" Width: %d\n", fillstyle->Width);
547 _iprintf (" StartCapStyle: %d\n", fillstyle->StartCapStyle);
548 _iprintf (" JoinStyle: %d\n", fillstyle->JoinStyle);
549 _iprintf (" HasFillFlag: %d\n", fillstyle->HasFillFlag);
550 _iprintf (" NoHScaleFlag: %d\n", fillstyle->NoHScaleFlag);
551 _iprintf (" NoVScaleFlag: %d\n", fillstyle->NoVScaleFlag);
552 _iprintf (" PixelHintingFlag %d\n", fillstyle->PixelHintingFlag);
553 _iprintf (" NoClose %d\n", fillstyle->NoClose);
554 _iprintf (" EndCapStyle %d\n", fillstyle->EndCapStyle);
555 if(fillstyle->JoinStyle == 2)
556 _iprintf (" MiterLimitFactor %d\n", fillstyle->MiterLimitFactor);
557 if(fillstyle->HasFillFlag == 0)
558 outputSWF_RGBA (&fillstyle->Color, "");
559 else
560 outputSWF_FILLSTYLE (&fillstyle->FillType, "", 0);
561 }
562
563 void
outputSWF_LINESTYLEARRAY(SWF_LINESTYLEARRAY * linestylearray,char * name)564 outputSWF_LINESTYLEARRAY (SWF_LINESTYLEARRAY * linestylearray, char *name)
565 {
566
567 int count, i;
568
569 count = linestylearray->LineStyleCount;
570
571 _iprintf (" LineStyleArray: ");
572 _iprintf (" LineStyleCount: %d\n", count);
573
574 for (i = 0; i < count; i++)
575 {
576 if(linestylearray->LineStyles != NULL)
577 outputSWF_LINESTYLE (&(linestylearray->LineStyles[i]),"",0);
578 else if(linestylearray->LineStyles2 != NULL)
579 outputSWF_LINESTYLE2 (&(linestylearray->LineStyles2[i]),"",0);
580 else
581 _iprintf("LineStyleArray: parser error\n");
582 }
583 }
584
585 void
outputSWF_MORPHLINESTYLE(SWF_MORPHLINESTYLE * linestyle,char * name)586 outputSWF_MORPHLINESTYLE (SWF_MORPHLINESTYLE * linestyle, char *name)
587 {
588 _iprintf (" MorphLineStyle: ");
589 _iprintf (" StartWidth: %d\n", linestyle->StartWidth);
590 _iprintf (" EndWidth: %d\n", linestyle->EndWidth);
591 outputSWF_RGBA (&linestyle->StartColor, "");
592 outputSWF_RGBA (&linestyle->EndColor, "");
593 }
594
595 void
outputSWF_MORPHLINESTYLE2(SWF_MORPHLINESTYLE2 * linestyle,char * name)596 outputSWF_MORPHLINESTYLE2 (SWF_MORPHLINESTYLE2 * linestyle, char *name)
597 {
598 _iprintf (" MorphLineStyle2: ");
599 _iprintf (" StartWidth: %d\n", linestyle->StartWidth);
600 _iprintf (" EndWidth: %d\n", linestyle->EndWidth);
601 _iprintf (" StartCapStyle: %d\n", linestyle->StartCapStyle);
602 _iprintf (" JoinStyle: %d\n", linestyle->JoinStyle);
603 _iprintf (" HasFillFlag: %d\n", linestyle->HasFillFlag);
604 _iprintf (" NoHScaleFlag: %d\n", linestyle->NoHScaleFlag);
605 _iprintf (" NoVScaleFlag: %d\n", linestyle->NoVScaleFlag);
606 _iprintf (" PixelHintingFlag %d\n", linestyle->PixelHintingFlag);
607 _iprintf (" NoClose %d\n", linestyle->NoClose);
608 _iprintf (" EndCapStyle %d\n", linestyle->EndCapStyle);
609 if(linestyle->JoinStyle == 2)
610 _iprintf (" MiterLimitFactor %d\n", linestyle->MiterLimitFactor);
611 if(linestyle->HasFillFlag == 0) {
612 outputSWF_RGBA (&linestyle->StartColor, "");
613 outputSWF_RGBA (&linestyle->EndColor, "");
614 }
615 else
616 outputSWF_MORPHFILLSTYLE (&linestyle->FillType, "", 0);
617 }
618
619 void
outputSWF_MORPHLINESTYLES(SWF_MORPHLINESTYLES * linestylearray)620 outputSWF_MORPHLINESTYLES (SWF_MORPHLINESTYLES * linestylearray)
621 {
622
623 int count, i;
624
625 if( !verbose ) return;
626 _iprintf (" MorphLineStyleArray: ");
627 _iprintf (" LineStyleCount: %6d ", linestylearray->LineStyleCount);
628 _iprintf (" LineStyleCountExtended: %6d\n",
629 linestylearray->LineStyleCountExtended);
630 count =
631 (linestylearray->LineStyleCount !=
632 0xff) ? linestylearray->LineStyleCount : linestylearray->
633 LineStyleCountExtended;
634 for (i = 0; i < count; i++)
635 {
636 if(linestylearray->LineStyles != NULL)
637 outputSWF_MORPHLINESTYLE (&(linestylearray->LineStyles[i]),"");
638 else if(linestylearray->LineStyles2 != NULL)
639 outputSWF_MORPHLINESTYLE2 (&(linestylearray->LineStyles2[i]),"");
640 else
641 _iprintf("LineStyleArray: parser error\n");
642 }
643 }
644
645 void
outputSWF_SHAPERECORD(SWF_SHAPERECORD * shaperec,char * parentname)646 outputSWF_SHAPERECORD (SWF_SHAPERECORD * shaperec, char *parentname)
647 {
648 if (shaperec->EndShape.TypeFlag)
649 {
650 /* An Edge Record */
651 if (shaperec->StraightEdge.StraightEdge == 1)
652 {
653 /* A Straight Edge Record */
654 _iprintf (" Straight EdgeRecord: (%d)",
655 shaperec->StraightEdge.NumBits);
656 if( shaperec->StraightEdge.GeneralLineFlag ) {
657 _iprintf(" - (%ld, %ld)\n",shaperec->StraightEdge.DeltaX,shaperec->StraightEdge.DeltaY);
658 } else {
659 if( shaperec->StraightEdge.VertLineFlag )
660 _iprintf(" - (0, %ld)\n",shaperec->StraightEdge.VLDeltaY);
661 else
662 _iprintf(" - (%ld, 0)\n",shaperec->StraightEdge.VLDeltaX);
663 }
664 }
665 else
666 {
667 /* A Curved Edge Record */
668 _iprintf (" Curved EdgeRecord: %d", shaperec->CurvedEdge.NumBits);
669 _iprintf (" Control(%ld,%ld)", shaperec->CurvedEdge.ControlDeltaX,
670 shaperec->CurvedEdge.ControlDeltaY);
671 _iprintf (" Anchor(%ld,%ld)\n", shaperec->CurvedEdge.AnchorDeltaX,
672 shaperec->CurvedEdge.AnchorDeltaY);
673 }
674 }
675 else
676 {
677 /* A Non-Edge Record */
678 if (shaperec->EndShape.EndOfShape == 0)
679 {
680 _iprintf (" ENDSHAPE\n");
681 return;
682 }
683 _iprintf (" StyleChangeRecord:\n");
684 _iprintf (" StateNewStyles: %d", shaperec->StyleChange.StateNewStyles);
685 _iprintf (" StateLineStyle: %d ", shaperec->StyleChange.StateLineStyle);
686 _iprintf (" StateFillStyle1: %d\n",
687 shaperec->StyleChange.StateFillStyle1);
688 _iprintf (" StateFillStyle0: %d",
689 shaperec->StyleChange.StateFillStyle0);
690 _iprintf (" StateMoveTo: %d\n", shaperec->StyleChange.StateMoveTo);
691
692 if (shaperec->StyleChange.StateLineStyle) {
693 _iprintf (" LineStyle: %ld\n", shaperec->StyleChange.LineStyle);
694 }
695 if (shaperec->StyleChange.StateFillStyle1) {
696 _iprintf (" FillStyle1: %ld\n", shaperec->StyleChange.FillStyle1);
697 }
698 if (shaperec->StyleChange.StateFillStyle0) {
699 _iprintf (" FillStyle0: %ld\n", shaperec->StyleChange.FillStyle0);
700 }
701 if (shaperec->StyleChange.StateMoveTo)
702 {
703 _iprintf (" MoveBits: %d ", shaperec->StyleChange.MoveBits);
704 _iprintf (" MoveDeltaX: %ld ", shaperec->StyleChange.MoveDeltaX);
705 _iprintf (" MoveDeltaY: %ld\n", shaperec->StyleChange.MoveDeltaY);
706 }
707 }
708 }
709
710 void
outputSWF_SHAPE(SWF_SHAPE * shape,char * name)711 outputSWF_SHAPE (SWF_SHAPE * shape, char *name)
712 {
713 int i;
714 _iprintf (" %s\n", name );
715 _iprintf (" NumFillBits: %d\n", shape->NumFillBits);
716 _iprintf (" NumLineBits: %d\n", shape->NumLineBits);
717 for (i = 0; i < shape->NumShapeRecords; i++)
718 {
719 outputSWF_SHAPERECORD (&(shape->ShapeRecords[i]), name);
720 }
721 }
722
723 void
outputSWF_SHAPEWITHSTYLE(SWF_SHAPEWITHSTYLE * shape,int level,char * name)724 outputSWF_SHAPEWITHSTYLE (SWF_SHAPEWITHSTYLE * shape, int level, char *name)
725 {
726 int i;
727
728 outputSWF_FILLSTYLEARRAY (&(shape->FillStyles),"");
729 outputSWF_LINESTYLEARRAY (&(shape->LineStyles),"");
730 _iprintf (" NumFillBits: %d\n", shape->NumFillBits);
731 _iprintf (" NumLineBits: %d\n", shape->NumLineBits);
732 for (i = 0; i < shape->NumShapeRecords; i++)
733 {
734 outputSWF_SHAPERECORD (&(shape->ShapeRecords[i]),name);
735 }
736 }
737
738 void
outputSWF_GLYPHENTRY(SWF_GLYPHENTRY * gerec)739 outputSWF_GLYPHENTRY (SWF_GLYPHENTRY *gerec)
740 {
741 _iprintf(" GlyphIndex[0] = %4.4lx ", gerec->GlyphIndex[0] );
742 _iprintf(" GlyphAdvance[0] = %4.4lx\n", gerec->GlyphAdvance[0] );
743 }
744
745 void
outputSWF_TEXTRECORD(SWF_TEXTRECORD * trec,int level)746 outputSWF_TEXTRECORD (SWF_TEXTRECORD *trec, int level)
747 {
748 int i;
749 _iprintf (" TEXTRECORD: ");
750 _iprintf (" TextRecordType: %d ", trec->TextRecordType);
751 _iprintf (" StyleFlagsReserved: %d ", trec->StyleFlagsReserved);
752 _iprintf (" StyleFlagHasFont: %d ", trec->StyleFlagHasFont);
753 _iprintf (" StyleFlagHasColor: %d ", trec->StyleFlagHasColor);
754 _iprintf (" StyleFlagHasYOffset: %d ", trec->StyleFlagHasYOffset);
755 _iprintf (" StyleFlagHasXOffset: %d\n", trec->StyleFlagHasXOffset);
756
757 if ( trec->TextRecordType == 0 )
758 {
759 /*
760 * parser doesn't initialize any other
761 * member when TextRecordType == 0,
762 * see parseSWF_TEXTRECORD in parser.c
763 */
764 return;
765 }
766
767 if( trec->StyleFlagHasFont )
768 _iprintf (" FontID: %d\n", trec->FontID);
769 if( trec->StyleFlagHasColor ) {
770 outputSWF_RGBA(&trec->TextColor, "" );
771 }
772 if( trec->StyleFlagHasYOffset || trec->StyleFlagHasXOffset ) {
773 _iprintf (" XOffset: %d ", trec->XOffset);
774 _iprintf (" YOffset: %d\n", trec->YOffset);
775 }
776 if( trec->StyleFlagHasFont )
777 _iprintf (" TextHeight: %d\n", trec->TextHeight);
778 _iprintf (" GlyphCount: %d\n", trec->GlyphCount);
779 for(i=0;i<trec->GlyphCount;i++)
780 outputSWF_GLYPHENTRY( &(trec->GlyphEntries[i]) );
781 }
782
783 void
outputSWF_BLURFILTER(SWF_BLURFILTER * filter)784 outputSWF_BLURFILTER(SWF_BLURFILTER *filter)
785 {
786 outputFIXED(filter->BlurX, " BlurX: ");
787 outputFIXED(filter->BlurY, " BlurY: ");
788 _iprintf(" Passes %d\n", filter->Passes);
789 }
790
791 void
outputSWF_BEVELFILTER(SWF_BEVELFILTER * filter)792 outputSWF_BEVELFILTER(SWF_BEVELFILTER *filter)
793 {
794 outputSWF_RGBA (&filter->ShadowColor, " ShadowColor:");
795 outputSWF_RGBA (&filter->HighlightColor, " HighLightColor:");
796 outputFIXED(filter->BlurX, " BlurX: ");
797 outputFIXED(filter->BlurY, " BlurY: ");
798 outputFIXED(filter->Angle, " Angle: ");
799 outputFIXED(filter->Distance, " Distance: ");
800 outputFIXED8(filter->Strength, " Strength: ");
801 _iprintf(" InnerShadow: %d\n", filter->InnerShadow);
802 _iprintf(" Kockout %d\n", filter->Kockout);
803 _iprintf(" CompositeSource %d\n", filter->CompositeSource);
804 _iprintf(" OnTop: %d\n", filter->OnTop);
805 _iprintf(" Passes %d\n", filter->Passes);
806 }
807
808 void
outputSWF_GRADIENTFILTER(SWF_GRADIENTFILTER * filter)809 outputSWF_GRADIENTFILTER(SWF_GRADIENTFILTER *filter)
810 {
811 int i;
812 _iprintf(" NumColor %d\n", filter->NumColors);
813 for(i = 0; i < filter->NumColors; i++)
814 {
815 outputSWF_RGBA (filter->GradientColors + i, " ");
816 _iprintf(" Ratio: %d\n", filter->GradientRatio[i]);
817 }
818 outputFIXED(filter->BlurX, " BlurX: ");
819 outputFIXED(filter->BlurY, " BlurY: ");
820 outputFIXED(filter->Angle, " Angle: ");
821 outputFIXED(filter->Distance, " Distance: ");
822 outputFIXED8(filter->Strength, " Strength: ");
823 _iprintf(" InnerShadow: %d\n", filter->InnerShadow);
824 _iprintf(" Kockout %d\n", filter->Kockout);
825 _iprintf(" CompositeSource %d\n", filter->CompositeSource);
826 _iprintf(" OnTop: %d\n", filter->OnTop);
827 _iprintf(" Passes %d\n", filter->Passes);
828 }
829
830 void
outputSWF_DROPSHADOWFILTER(SWF_DROPSHADOWFILTER * filter)831 outputSWF_DROPSHADOWFILTER(SWF_DROPSHADOWFILTER *filter)
832 {
833 outputSWF_RGBA (&filter->DropShadowColor, " DropShadowColor:");
834 outputFIXED(filter->BlurX, " BlurX: ");
835 outputFIXED(filter->BlurY, " BlurY: ");
836 outputFIXED(filter->Angle, " Angle: ");
837 outputFIXED(filter->Distance, " Distance: ");
838 outputFIXED8(filter->Strength, " Strength: ");
839 _iprintf(" InnerShadow: %d\n", filter->InnerShadow);
840 _iprintf(" Kockout %d\n", filter->Kockout);
841 _iprintf(" CompositeSource %d\n", filter->CompositeSource);
842 _iprintf(" Passes %d\n", filter->Passes);
843 }
844
845 void
outputSWF_GLOWFILTER(SWF_GLOWFILTER * filter)846 outputSWF_GLOWFILTER(SWF_GLOWFILTER *filter)
847 {
848 outputSWF_RGBA (&filter->GlowColor, "");
849 outputFIXED(filter->BlurX, " BlurX: ");
850 outputFIXED(filter->BlurY, " BlurY: ");
851 outputFIXED8(filter->Strength, " Strength: ");
852 _iprintf(" InnerGlow: %d\n", filter->InnerGlow);
853 _iprintf(" Kockout %d\n", filter->Kockout);
854 _iprintf(" CompositeSource %d\n", filter->CompositeSource);
855 _iprintf(" Passes %d\n", filter->Passes);
856 }
857
858 void
outputSWF_CONVOLUTIONFILTER(SWF_CONVOLUTIONFILTER * filter)859 outputSWF_CONVOLUTIONFILTER(SWF_CONVOLUTIONFILTER *filter)
860 {
861 int y, x;
862
863 _iprintf(" Matrix %dx%d\n", filter->MatrixX, filter->MatrixY);
864 _iprintf(" Bias %f, Divisor %f\n", filter->Bias, filter->Divisor);
865 for(y = 0; y < filter->MatrixY; y++)
866 {
867 _iprintf(" ");
868 for(x = 0; x < filter->MatrixX; x++)
869 {
870 FLOAT val = filter->Matrix[y * filter->MatrixX + x];
871 _iprintf("%f ", val);
872 }
873 _iprintf("\n");
874 }
875 outputSWF_RGBA (&filter->DefaultColor, " efault Color: ");
876 _iprintf(" Clamp: %d\n", filter->Clamp);
877 _iprintf(" PreserveAlpha: %d\n", filter->PreserveAlpha);
878 }
879
880 void
outputSWF_COLORMATRIXFILTER(SWF_COLORMATRIXFILTER * filter)881 outputSWF_COLORMATRIXFILTER(SWF_COLORMATRIXFILTER *filter)
882 {
883 int y, x;
884
885 for(y = 0; y < 4; y++)
886 {
887 _iprintf(" ");
888 for(x = 0; x < 5; x++)
889 {
890 FLOAT val = filter->Matrix[y * 5 + x];
891 _iprintf("%f ", val);
892 }
893 _iprintf("\n");
894 }
895 }
896
897 void
outputSWF_FILTER(SWF_FILTER * filter)898 outputSWF_FILTER(SWF_FILTER *filter)
899 {
900 switch(filter->FilterId)
901 {
902 case FILTER_DROPSHADOW:
903 _iprintf(" Filter: DropShadow\n");
904 outputSWF_DROPSHADOWFILTER(&filter->filter.dropShadow);
905 break;
906 case FILTER_BLUR:
907 _iprintf(" Filter: Blur\n");
908 outputSWF_BLURFILTER(&filter->filter.blur);
909 break;
910 case FILTER_GLOW:
911 _iprintf(" Filter: Glow\n");
912 outputSWF_GLOWFILTER(&filter->filter.glow);
913 break;
914 case FILTER_BEVEL:
915 _iprintf(" Filter: Bevel\n");
916 outputSWF_BEVELFILTER(&filter->filter.bevel);
917 break;
918 case FILTER_GRADIENTGLOW:
919 _iprintf(" Filter: GradientGlow\n");
920 outputSWF_GRADIENTFILTER(&filter->filter.gradientGlow);
921 break;
922 case FILTER_CONVOLUTION:
923 _iprintf(" Filter: Convolution\n");
924 outputSWF_CONVOLUTIONFILTER(&filter->filter.convolution);
925 break;
926 case FILTER_COLORMATRIX:
927 _iprintf(" Filter: ColorMatrix\n");
928 outputSWF_COLORMATRIXFILTER(&filter->filter.colorMatrix);
929 break;
930 case FILTER_GRADIENTBEVEL:
931 _iprintf(" Filter: GradientBevel\n");
932 outputSWF_GRADIENTFILTER(&filter->filter.gradientBevel);
933 break;
934 default:
935 _iprintf(" Filter: Unknown %d\n", filter->FilterId);
936 }
937 }
938
939 /* Output Flash Blocks */
940
941 void
outputSWF_CHARACTERSET(SWF_Parserstruct * pblock)942 outputSWF_CHARACTERSET (SWF_Parserstruct * pblock)
943 {
944 //OUT_BEGIN (SWF_CHARACTERSET);
945
946 }
947
948 void
outputSWF_DEFINEBITS(SWF_Parserstruct * pblock)949 outputSWF_DEFINEBITS (SWF_Parserstruct * pblock)
950 {
951 OUT_BEGIN (SWF_DEFINEBITS);
952 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
953 }
954
955 void
outputSWF_DEFINEBITSJPEG2(SWF_Parserstruct * pblock)956 outputSWF_DEFINEBITSJPEG2 (SWF_Parserstruct * pblock)
957 {
958 OUT_BEGIN (SWF_DEFINEBITSJPEG2);
959 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
960 }
961
962 void
outputSWF_DEFINEBITSJPEG3(SWF_Parserstruct * pblock)963 outputSWF_DEFINEBITSJPEG3 (SWF_Parserstruct * pblock)
964 {
965 OUT_BEGIN (SWF_DEFINEBITSJPEG3);
966 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
967 _iprintf(" AlphaDataOffset %d\n", sblock->AlphaDataOffset);
968 }
969
970 void
outputSWF_DEFINEBITSPTR(SWF_Parserstruct * pblock)971 outputSWF_DEFINEBITSPTR (SWF_Parserstruct * pblock)
972 {
973 //OUT_BEGIN (SWF_DEFINEBITSPTR);
974
975 }
976
977 void
outputSWF_DEFINEBUTTON(SWF_Parserstruct * pblock)978 outputSWF_DEFINEBUTTON (SWF_Parserstruct * pblock)
979 {
980 //OUT_BEGIN (SWF_DEFINEBUTTON);
981
982 }
983
984 void
outputSWF_DEFINEBUTTON2(SWF_Parserstruct * pblock)985 outputSWF_DEFINEBUTTON2 (SWF_Parserstruct * pblock)
986 {
987 int i;
988 OUT_BEGIN (SWF_DEFINEBUTTON2);
989
990 #if !defined(ACTIONONLY)
991 _iprintf (" CharacterID: %d\n", sblock->Buttonid);
992 _iprintf (" TrackAsMenu: %d\n", sblock->TrackAsMenu);
993 _iprintf (" ActionOffset: %d\n", sblock->ActionOffset);
994 for(i=0;i<sblock->numCharacters;i++) {
995 outputSWF_BUTTONRECORD( &(sblock->Characters[i]) );
996 }
997 #endif
998 for(i=0;i<sblock->numActions;i++) {
999 outputSWF_BUTTONCONDACTION( &(sblock->Actions[i]) );
1000 }
1001
1002 }
1003
1004 void
outputSWF_DEFINEBUTTONCXFORM(SWF_Parserstruct * pblock)1005 outputSWF_DEFINEBUTTONCXFORM (SWF_Parserstruct * pblock)
1006 {
1007 OUT_BEGIN (SWF_DEFINEBUTTONCXFORM);
1008 _iprintf(" ButtonId %d\n", sblock->ButtonId);
1009 outputSWF_CXFORM(&sblock->ButtonColorTransform);
1010 }
1011
1012 void
1013 outputSWF_SOUNDINFO (SWF_SOUNDINFO *info);
1014
1015 void
outputSWF_DEFINEBUTTONSOUND(SWF_Parserstruct * pblock)1016 outputSWF_DEFINEBUTTONSOUND (SWF_Parserstruct * pblock)
1017 {
1018 OUT_BEGIN (SWF_DEFINEBUTTONSOUND);
1019 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
1020 _iprintf(" ButtonSoundChar0 %d\n", sblock->ButtonSoundChar0);
1021 if(sblock->ButtonSoundChar0)
1022 outputSWF_SOUNDINFO (&sblock->ButtonSoundInfo0);
1023
1024 _iprintf(" ButtonSoundChar1 %d\n", sblock->ButtonSoundChar1);
1025 if(sblock->ButtonSoundChar1)
1026 outputSWF_SOUNDINFO (&sblock->ButtonSoundInfo1);
1027
1028 _iprintf(" ButtonSoundChar2 %d\n", sblock->ButtonSoundChar2);
1029 if(sblock->ButtonSoundChar2)
1030 outputSWF_SOUNDINFO (&sblock->ButtonSoundInfo2);
1031
1032 _iprintf(" ButtonSoundChar3 %d\n", sblock->ButtonSoundChar3);
1033 if(sblock->ButtonSoundChar3)
1034 outputSWF_SOUNDINFO (&sblock->ButtonSoundInfo3);
1035 }
1036
1037 void
outputSWF_DEFINECOMMANDOBJ(SWF_Parserstruct * pblock)1038 outputSWF_DEFINECOMMANDOBJ (SWF_Parserstruct * pblock)
1039 {
1040 //OUT_BEGIN (SWF_DEFINECOMMANDOBJ);
1041
1042 }
1043
1044 void
outputSWF_DEFINEEDITTEXT(SWF_Parserstruct * pblock)1045 outputSWF_DEFINEEDITTEXT (SWF_Parserstruct * pblock)
1046 {
1047 OUT_BEGIN (SWF_DEFINEEDITTEXT);
1048
1049 _iprintf (" CharacterID: %d\n", sblock->CharacterID);
1050 outputSWF_RECT (&(sblock->Bounds));
1051 _iprintf (" Flags: ");
1052 _iprintf (" HasText: %d ", sblock->HasText);
1053 _iprintf (" WordWrap: %d ", sblock->WordWrap);
1054 _iprintf (" Multiline: %d ", sblock->Multiline);
1055 _iprintf (" Password: %d ", sblock->Password);
1056 _iprintf (" ReadOnly: %d\n", sblock->ReadOnly);
1057 _iprintf (" ");
1058 _iprintf (" HasTextColor: %d ", sblock->HasTextColor);
1059 _iprintf (" HasMaxLength: %d ", sblock->HasMaxLength);
1060 _iprintf (" HasFont: %d ", sblock->HasFont);
1061 _iprintf (" HasFontClass: %d ", sblock->HasFontClass);
1062 _iprintf (" AutoSize: %d ", sblock->AutoSize);
1063 _iprintf (" HasLayout: %d\n", sblock->HasLayout);
1064 _iprintf (" ");
1065 _iprintf (" NoSelect: %d ", sblock->NoSelect);
1066 _iprintf (" Border: %d ", sblock->Border);
1067 _iprintf (" WasStatic: %d ", sblock->WasStatic);
1068 _iprintf (" HTML: %d ", sblock->HTML);
1069 _iprintf (" UseOutlines: %d\n", sblock->UseOutlines);
1070 if (sblock->HasFont)
1071 {
1072 _iprintf (" Font: ");
1073 _iprintf (" FontID: %d ", sblock->FontID);
1074 _iprintf (" FontHeight: %d\n", sblock->FontHeight);
1075 }
1076
1077 if (sblock->HasFontClass)
1078 _iprintf(" FontClass: %s\n", sblock->FontClass);
1079
1080 if (sblock->HasTextColor)
1081 {
1082 outputSWF_RGBA (&sblock->TextColor,"");
1083 }
1084 if (sblock->HasLayout)
1085 {
1086 _iprintf (" Layout:: ");
1087 _iprintf (" Align: %d ", sblock->Align);
1088 _iprintf (" LeftMargin: %d ", sblock->LeftMargin);
1089 _iprintf (" RightMargin: %d ", sblock->RightMargin);
1090 _iprintf (" Indent: %d ", sblock->Indent);
1091 _iprintf (" Leading: %d\n", sblock->Leading);
1092 }
1093 _iprintf (" VariableName: %s\n", sblock->VariableName);
1094 if (sblock->HasText)
1095 {
1096 _iprintf (" InitialText: %s\n", sblock->InitialText);
1097 }
1098 }
1099
1100 void
outputSWF_DEFINEFONT(SWF_Parserstruct * pblock)1101 outputSWF_DEFINEFONT (SWF_Parserstruct * pblock)
1102 {
1103 int i;
1104 OUT_BEGIN (SWF_DEFINEFONT);
1105 _iprintf (" FontID: %d\n", sblock->FontID);
1106 for (i = 0; i < sblock->NumGlyphs; i++)
1107 _iprintf (" OffsetTable[%3.3d]: %x\n", i, sblock->OffsetTable[i]);
1108
1109 for (i = 0; i < sblock->NumGlyphs; i++)
1110 {
1111 char shapename[32];
1112 sprintf(shapename,"Shape[%3.3d]",i);
1113 outputSWF_SHAPE (&(sblock->GlyphShapeTable[i]), shapename);
1114 }
1115 }
1116
1117 void
outputSWF_DEFINEFONT2(SWF_Parserstruct * pblock)1118 outputSWF_DEFINEFONT2 (SWF_Parserstruct * pblock)
1119 {
1120 int i;
1121 OUT_BEGIN (SWF_DEFINEFONT2);
1122
1123 _iprintf (" FontID: %d\n", sblock->FontID);
1124 _iprintf (" FontFlagsHasLayout: %d\n", sblock->FontFlagsHasLayout);
1125 _iprintf (" FontFlagsShiftJis: %d\n", sblock->FontFlagsShiftJis);
1126 _iprintf (" FontFlagsSmallText: %d\n", sblock->FontFlagsSmallText);
1127 _iprintf (" FontFlagsFlagANSI: %d\n", sblock->FontFlagsFlagANSI);
1128 _iprintf (" FontFlagsWideOffsets: %d\n", sblock->FontFlagsWideOffsets);
1129 _iprintf (" FontFlagsWideCodes: %d\n", sblock->FontFlagsWideCodes);
1130 _iprintf (" FontFlagsFlagsItalics: %d\n", sblock->FontFlagsFlagsItalics);
1131 _iprintf (" FontFlagsFlagsBold: %d\n", sblock->FontFlagsFlagsBold);
1132 _iprintf (" LanguageCode: %d\n", sblock->LanguageCode);
1133 _iprintf (" FontNameLen: %d\n", sblock->FontNameLen);
1134 _iprintf (" FontName: %s\n", sblock->FontName);
1135 _iprintf (" NumGlyphs: %d\n", sblock->NumGlyphs);
1136 for (i = 0; i < sblock->NumGlyphs; i++)
1137 {
1138 if (sblock->FontFlagsWideOffsets)
1139 {
1140 _iprintf (" OffsetTable[%3.3d]: %lx\n", i,
1141 sblock->OffsetTable.UI32[i]);
1142 }
1143 else
1144 {
1145 _iprintf (" OffsetTable[%3.3d]: %x\n", i,
1146 sblock->OffsetTable.UI16[i]);
1147 }
1148 }
1149 if (sblock->FontFlagsWideOffsets)
1150 {
1151 _iprintf (" CodeTableOffset: %lx\n", sblock->CodeTableOffset.UI32);
1152 }
1153 else
1154 {
1155 _iprintf (" CodeTableOffset: %x\n", sblock->CodeTableOffset.UI16);
1156 }
1157
1158 for (i = 0; i < sblock->NumGlyphs; i++)
1159 {
1160 char shapename[32];
1161 sprintf(shapename,"Shape[%3.3d]",i);
1162 outputSWF_SHAPE (&(sblock->GlyphShapeTable[i]), shapename);
1163 }
1164
1165 for (i = 0; i < sblock->NumGlyphs; i++)
1166 {
1167 if( sblock->FontFlagsWideCodes )
1168 {
1169 _iprintf (" CodeTable[%3.3d]: %4.4x\n", i,
1170 sblock->CodeTable[i]);
1171 }
1172 else
1173 {
1174 _iprintf (" CodeTable[%3.3d]: %2.2x\n", i,
1175 sblock->CodeTable[i]);
1176 }
1177 }
1178
1179 if( sblock->FontFlagsHasLayout ) {
1180 _iprintf (" FontAscent: %d\n", sblock->FontAscent);
1181 _iprintf (" FontDecent: %d\n", sblock->FontDecent);
1182 _iprintf (" FontLeading: %d\n", sblock->FontLeading);
1183 for (i = 0; i < sblock->NumGlyphs; i++)
1184 {
1185 _iprintf (" FontAdvanceTable[%3.3d]: %x\n", i,
1186 sblock->FontAdvanceTable[i]);
1187 }
1188 _iprintf (" FontBoundsTable: (not used)\n");
1189 for (i = 0; i < sblock->NumGlyphs; i++)
1190 {
1191 outputSWF_RECT (&(sblock->FontBoundsTable[i]));
1192 }
1193 _iprintf (" KerningCount: %d\n", sblock->KerningCount);
1194 for (i = 0; i < sblock->KerningCount; i++)
1195 {
1196 _iprintf (" FontKerningTable[%3.3d]: %d,%d %d\n", i,
1197 sblock->FontKerningTable[i].FontKerningCode1,
1198 sblock->FontKerningTable[i].FontKerningCode2,
1199 sblock->FontKerningTable[i].FontKerningAdjustment);
1200 }
1201 }
1202
1203 }
1204
1205 void
outputSWF_DEFINEFONT3(SWF_Parserstruct * pblock)1206 outputSWF_DEFINEFONT3 (SWF_Parserstruct * pblock)
1207 {
1208 int i;
1209 OUT_BEGIN (SWF_DEFINEFONT3);
1210
1211 _iprintf (" FontID: %d\n", sblock->FontID);
1212 _iprintf (" FontFlagsHasLayout: %d\n", sblock->FontFlagsHasLayout);
1213 _iprintf (" FontFlagsShiftJis: %d\n", sblock->FontFlagsShiftJis);
1214 _iprintf (" FontFlagsSmallText: %d\n", sblock->FontFlagsSmallText);
1215 _iprintf (" FontFlagsFlagANSI: %d\n", sblock->FontFlagsFlagANSI);
1216 _iprintf (" FontFlagsWideOffsets: %d\n", sblock->FontFlagsWideOffsets);
1217 _iprintf (" FontFlagsWideCodes: %d\n", sblock->FontFlagsWideCodes);
1218 _iprintf (" FontFlagsFlagsItalics: %d\n", sblock->FontFlagsFlagsItalics);
1219 _iprintf (" FontFlagsFlagsBold: %d\n", sblock->FontFlagsFlagsBold);
1220 _iprintf (" LanguageCode: %d\n", sblock->LanguageCode);
1221 _iprintf (" FontNameLen: %d\n", sblock->FontNameLen);
1222 _iprintf (" FontName: %s\n", sblock->FontName);
1223 _iprintf (" NumGlyphs: %d\n", sblock->NumGlyphs);
1224 for (i = 0; i < sblock->NumGlyphs; i++)
1225 {
1226 if (sblock->FontFlagsWideOffsets)
1227 {
1228 _iprintf (" OffsetTable[%3.3d]: %lx\n", i,
1229 sblock->OffsetTable.UI32[i]);
1230 }
1231 else
1232 {
1233 _iprintf (" OffsetTable[%3.3d]: %x\n", i,
1234 sblock->OffsetTable.UI16[i]);
1235 }
1236 }
1237 if (sblock->FontFlagsWideOffsets)
1238 {
1239 _iprintf (" CodeTableOffset: %lx\n", sblock->CodeTableOffset.UI32);
1240 }
1241 else
1242 {
1243 _iprintf (" CodeTableOffset: %x\n", sblock->CodeTableOffset.UI16);
1244 }
1245
1246 for (i = 0; i < sblock->NumGlyphs; i++)
1247 {
1248 char shapename[32];
1249 sprintf(shapename,"Shape[%3.3d]",i);
1250 outputSWF_SHAPE (&(sblock->GlyphShapeTable[i]), shapename);
1251 }
1252
1253 for (i = 0; i < sblock->NumGlyphs; i++)
1254 {
1255 if( sblock->FontFlagsWideCodes )
1256 {
1257 _iprintf (" CodeTable[%3.3d]: %4.4x\n", i,
1258 sblock->CodeTable[i]);
1259 }
1260 else
1261 {
1262 _iprintf (" CodeTable[%3.3d]: %2.2x\n", i,
1263 sblock->CodeTable[i]);
1264 }
1265 }
1266
1267 if( sblock->FontFlagsHasLayout ) {
1268 _iprintf (" FontAscent: %d\n", sblock->FontAscent);
1269 _iprintf (" FontDecent: %d\n", sblock->FontDecent);
1270 _iprintf (" FontLeading: %d\n", sblock->FontLeading);
1271 for (i = 0; i < sblock->NumGlyphs; i++)
1272 {
1273 _iprintf (" FontAdvanceTable[%3.3d]: %x\n", i,
1274 sblock->FontAdvanceTable[i]);
1275 }
1276 _iprintf (" FontBoundsTable: (not used)\n");
1277 for (i = 0; i < sblock->NumGlyphs; i++)
1278 {
1279 outputSWF_RECT (&(sblock->FontBoundsTable[i]));
1280 }
1281 _iprintf (" KerningCount: %d\n", sblock->KerningCount);
1282 for (i = 0; i < sblock->KerningCount; i++)
1283 {
1284 _iprintf (" FontKerningTable[%3.3d]: %d,%d %d\n", i,
1285 sblock->FontKerningTable[i].FontKerningCode1,
1286 sblock->FontKerningTable[i].FontKerningCode2,
1287 sblock->FontKerningTable[i].FontKerningAdjustment);
1288 }
1289 }
1290
1291 }
1292
1293 void
outputSWF_DEFINEFONTINFO(SWF_Parserstruct * pblock)1294 outputSWF_DEFINEFONTINFO (SWF_Parserstruct * pblock)
1295 {
1296 int i;
1297 OUT_BEGIN (SWF_DEFINEFONTINFO);
1298 _iprintf("FontID: %d\n", sblock->FontID);
1299 _iprintf("FontNameLen %d\n", sblock->FontNameLen);
1300 _iprintf("FontName %s\n", sblock->FontName);
1301 _iprintf("FontFlagsSmallText %d\n", sblock->FontFlagsSmallText);
1302 _iprintf("FontFlagsShiftJIS %d\n", sblock->FontFlagsShiftJIS);
1303 _iprintf("FontFlagsANSI %d\n", sblock->FontFlagsANSI);
1304 _iprintf("FontFlagsItalic %d\n", sblock->FontFlagsItalic);
1305 _iprintf("FontFlagsBold %d\n", sblock->FontFlagsBold);
1306 _iprintf("FontFlagsWideCodes %d\n", sblock->FontFlagsWideCodes);
1307
1308 if(!verbose)
1309 return;
1310
1311 for (i = 0; i < sblock->nGlyph; i++)
1312 _iprintf("code table mapping: %i -> %i\n", i, sblock->CodeTable[i]);
1313 }
1314
1315 void
outputSWF_DEFINEFONTINFO2(SWF_Parserstruct * pblock)1316 outputSWF_DEFINEFONTINFO2 (SWF_Parserstruct * pblock)
1317 {
1318 int i;
1319 OUT_BEGIN (SWF_DEFINEFONTINFO2);
1320 _iprintf("FontID: %d\n", sblock->FontID);
1321 _iprintf("FontNameLen %d\n", sblock->FontNameLen);
1322 _iprintf("FontName %s\n", sblock->FontName);
1323 _iprintf("FontFlagsSmallText %d\n", sblock->FontFlagsSmallText);
1324 _iprintf("FontFlagsShiftJIS %d\n", sblock->FontFlagsShiftJIS);
1325 _iprintf("FontFlagsANSI %d\n", sblock->FontFlagsANSI);
1326 _iprintf("FontFlagsItalic %d\n", sblock->FontFlagsItalic);
1327 _iprintf("FontFlagsBold %d\n", sblock->FontFlagsBold);
1328 _iprintf("FontFlagsWideCodes %d\n", sblock->FontFlagsWideCodes);
1329 _iprintf("LanguageCode %d\n", sblock->LanguageCode);
1330
1331 if(!verbose)
1332 return;
1333
1334 for (i = 0; i < sblock->nGlyph; i++)
1335 _iprintf("code table mapping: %i -> %i\n", i, sblock->CodeTable[i]);
1336 }
1337
1338 void
outputSWF_CSMTEXTSETTINGS(SWF_Parserstruct * pblock)1339 outputSWF_CSMTEXTSETTINGS (SWF_Parserstruct * pblock)
1340 {
1341 OUT_BEGIN (SWF_CSMTEXTSETTINGS);
1342 _iprintf("TextID: %d\n", sblock->TextID);
1343 _iprintf("UseFlashType %d\n", sblock->UseFlashType);
1344 _iprintf("GridFit %d\n", sblock->GridFit);
1345 _iprintf("Thickness %d\n", sblock->Thickness);
1346 _iprintf("Sharpness %d\n", sblock->Sharpness);
1347 }
1348
1349 void
outputSWF_ZONEDATA(int j,struct SWF_ZONEDATA * data)1350 outputSWF_ZONEDATA(int j, struct SWF_ZONEDATA *data)
1351 {
1352 _iprintf(" ZoneData: %i\n", j);
1353 _iprintf(" AlignmentCoordinate %d\n", data->AlignmentCoordinate);
1354 _iprintf(" Range %d\n", data->Range);
1355 }
1356
1357 void
outputSWF_ZONERECORD(int i,struct SWF_ZONERECORD * zone)1358 outputSWF_ZONERECORD(int i, struct SWF_ZONERECORD *zone)
1359 {
1360 int j;
1361 _iprintf("ZoneRecord %d\n", i);
1362 _iprintf(" NumZoneData %d\n", zone->NumZoneData);
1363 for(j = 0; j < zone->NumZoneData; j++)
1364 outputSWF_ZONEDATA(j, zone->ZoneData + j);
1365
1366 _iprintf(" ZoneMask X %d, Y %d\n", zone->ZoneMaskX, zone->ZoneMaskY);
1367 }
1368
1369 void
outputSWF_DEFINEFONTALIGNZONES(SWF_Parserstruct * pblock)1370 outputSWF_DEFINEFONTALIGNZONES (SWF_Parserstruct * pblock)
1371 {
1372 int i;
1373 OUT_BEGIN (SWF_DEFINEFONTALIGNZONES);
1374
1375 _iprintf(" FontID: %d\n", sblock->FontID);
1376 _iprintf(" CSMTableHint %d\n", sblock->CSMTableHint);
1377 _iprintf(" GlyphCount %d\n", sblock->GlyphCount);
1378 for(i = 0; i < sblock->GlyphCount; i++)
1379 outputSWF_ZONERECORD(i, sblock->ZoneTable + i);
1380 }
1381
1382 void
outputSWF_DEFINEFONTNAME(SWF_Parserstruct * pblock)1383 outputSWF_DEFINEFONTNAME (SWF_Parserstruct *pblock)
1384 {
1385 OUT_BEGIN(SWF_DEFINEFONTNAME);
1386 _iprintf(" FontId: %d\n", sblock->FontId);
1387 _iprintf(" FontName: %s\n", sblock->FontName);
1388 _iprintf(" FontCopyright %s\n", sblock->FontCopyright);
1389 }
1390
1391 void
outputSWF_DEFINELOSSLESS(SWF_Parserstruct * pblock)1392 outputSWF_DEFINELOSSLESS (SWF_Parserstruct * pblock)
1393 {
1394 OUT_BEGIN (SWF_DEFINELOSSLESS);
1395 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
1396 _iprintf(" Bitmap format %d\n", sblock->BitmapFormat);
1397 _iprintf(" Bitmap width %d x height %d\n", sblock->BitmapWidth, sblock->BitmapHeight);
1398
1399 if(sblock->BitmapFormat == 3)
1400 _iprintf(" BitmapColorTableSize %d\n", sblock->BitmapColorTableSize);
1401 }
1402
1403 void
outputSWF_DEFINELOSSLESS2(SWF_Parserstruct * pblock)1404 outputSWF_DEFINELOSSLESS2 (SWF_Parserstruct * pblock)
1405 {
1406 OUT_BEGIN (SWF_DEFINELOSSLESS2);
1407 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
1408 _iprintf(" Bitmap format %d\n", sblock->BitmapFormat);
1409 _iprintf(" Bitmap width %d x height %d\n", sblock->BitmapWidth, sblock->BitmapHeight);
1410 if(sblock->BitmapFormat == 3)
1411 _iprintf(" BitmapColorTableSize %d\n", sblock->BitmapColorTableSize);
1412 }
1413
1414 void
outputSWF_DEFINEMORPHSHAPE(SWF_Parserstruct * pblock)1415 outputSWF_DEFINEMORPHSHAPE (SWF_Parserstruct * pblock)
1416 {
1417 OUT_BEGIN (SWF_DEFINEMORPHSHAPE);
1418 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
1419 outputSWF_RECT(&(sblock->StartBounds));
1420 outputSWF_RECT(&(sblock->EndBounds));
1421 _iprintf(" Offset %d\n", sblock->Offset);
1422 outputSWF_MORPHFILLSTYLES(&(sblock->MorphFillStyles));
1423 outputSWF_MORPHLINESTYLES(&(sblock->MorphLineStyles));
1424 outputSWF_SHAPE(&(sblock->StartEdges), "");
1425 outputSWF_SHAPE(&(sblock->EndEdges), "");
1426 }
1427
1428 void
outputSWF_DEFINEMORPHSHAPE2(SWF_Parserstruct * pblock)1429 outputSWF_DEFINEMORPHSHAPE2 (SWF_Parserstruct * pblock)
1430 {
1431 OUT_BEGIN (SWF_DEFINEMORPHSHAPE2);
1432 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
1433 outputSWF_RECT(&(sblock->StartBounds));
1434 outputSWF_RECT(&(sblock->EndBounds));
1435 outputSWF_RECT(&(sblock->StartEdgeBounds));
1436 outputSWF_RECT(&(sblock->EndEdgeBounds));
1437 _iprintf(" UsesNonScalingStrokes %d\n",
1438 sblock->UsesNonScalingStrokes);
1439 _iprintf(" UsesScalinStrokes %d\n",
1440 sblock->UsesScalingStrokes);
1441 _iprintf(" Offset %d\n", sblock->Offset);
1442 outputSWF_MORPHFILLSTYLES(&(sblock->MorphFillStyles));
1443 outputSWF_MORPHLINESTYLES(&(sblock->MorphLineStyles));
1444 outputSWF_SHAPE(&(sblock->StartEdges), "");
1445 outputSWF_SHAPE(&(sblock->EndEdges), "");
1446 }
1447
1448 void
outputSWF_DEFINESHAPE(SWF_Parserstruct * pblock)1449 outputSWF_DEFINESHAPE (SWF_Parserstruct * pblock)
1450 {
1451 OUT_BEGIN (SWF_DEFINESHAPE);
1452
1453 _iprintf (" CharacterID: %d\n", sblock->ShapeID);
1454 outputSWF_RECT (&(sblock->ShapeBounds));
1455 outputSWF_SHAPEWITHSTYLE (&(sblock->Shapes),1,"");
1456 }
1457
1458 void
outputSWF_DEFINESHAPE2(SWF_Parserstruct * pblock)1459 outputSWF_DEFINESHAPE2 (SWF_Parserstruct * pblock)
1460 {
1461 OUT_BEGIN (SWF_DEFINESHAPE2);
1462
1463 _iprintf (" CharacterID: %d\n", sblock->ShapeID);
1464 outputSWF_RECT (&(sblock->ShapeBounds));
1465 outputSWF_SHAPEWITHSTYLE (&(sblock->Shapes),2,"");
1466
1467 }
1468
1469 void
outputSWF_DEFINESHAPE3(SWF_Parserstruct * pblock)1470 outputSWF_DEFINESHAPE3 (SWF_Parserstruct * pblock)
1471 {
1472 OUT_BEGIN (SWF_DEFINESHAPE3);
1473
1474 _iprintf (" CharacterID: %d\n", sblock->ShapeID);
1475 outputSWF_RECT (&(sblock->ShapeBounds));
1476 outputSWF_SHAPEWITHSTYLE (&(sblock->Shapes),2,"");
1477
1478 }
1479
1480 void
outputSWF_DEFINESHAPE4(SWF_Parserstruct * pblock)1481 outputSWF_DEFINESHAPE4 (SWF_Parserstruct * pblock)
1482 {
1483 OUT_BEGIN (SWF_DEFINESHAPE4);
1484
1485 _iprintf (" CharacterID: %d\n", sblock->ShapeID);
1486 outputSWF_RECT (&(sblock->ShapeBounds));
1487 outputSWF_RECT (&(sblock->EdgeBounds));
1488 _iprintf(" UsesNonScalingStrokes: %d\n", sblock->UsesNonScalingStrokes);
1489 _iprintf(" UsesScalingStrokes: %d\n", sblock->UsesScalingStrokes);
1490 outputSWF_SHAPEWITHSTYLE (&(sblock->Shapes),2,"");
1491 }
1492
1493 void
outputSWF_DEFINESOUND(SWF_Parserstruct * pblock)1494 outputSWF_DEFINESOUND (SWF_Parserstruct * pblock)
1495 {
1496 OUT_BEGIN (SWF_DEFINESOUND);
1497 _iprintf(" CharacterID: %d\n", sblock->SoundId);
1498
1499 _iprintf(" SoundFormat: ");
1500 switch(sblock->SoundFormat)
1501 {
1502 case 0: _iprintf("uncompressed\n"); break;
1503 case 1: _iprintf("ADPCM\n"); break;
1504 case 2: _iprintf("MP3\n"); break;
1505 case 3: _iprintf("uncompressed (LE)\n"); break;
1506 case 6: _iprintf("Nellymoser\n"); break;
1507 default: _iprintf("unknow ID %d\n", sblock->SoundFormat);
1508 }
1509
1510 _iprintf(" SoundRate: ");
1511 switch(sblock->SoundRate)
1512 {
1513 case 0: _iprintf("5.5 KHz\n"); break;
1514 case 1: _iprintf("11 KHz\n"); break;
1515 case 2: _iprintf("22 KHz\n"); break;
1516 case 3: _iprintf("44 KHz\n"); break;
1517 }
1518 _iprintf(" SoundSize: %s\n", sblock->SoundSize?"16-bit":"8-bit");
1519 _iprintf(" SoundType: %s\n", sblock->SoundType?"Stereo":"Mono");
1520 _iprintf(" SoundSampleCount: %d\n", sblock->SoundSampleCount);
1521
1522 if(sblock->SoundFormat == 2)
1523 {
1524 _iprintf(" Mp3: SeekSamples %i\n",
1525 sblock->SoundData.mp3.SeekSamples);
1526 }
1527 }
1528
1529 void
outputSWF_DEFINESPRITE(SWF_Parserstruct * pblock)1530 outputSWF_DEFINESPRITE (SWF_Parserstruct * pblock)
1531 {
1532 int i;
1533 OUT_BEGIN (SWF_DEFINESPRITE);
1534
1535 _iprintf(" CharacterID: %d\n", sblock->SpriteId );
1536 _iprintf(" FrameCount: %d\n", sblock->FrameCount );
1537 _iprintf(" BlockCount: %d\n", sblock->BlockCount );
1538 ++INDENT;
1539 for(i=0;i<sblock->BlockCount;i++) {
1540 outputBlock(sblock->tagTypes[i], sblock->Tags[i], NULL);
1541 }
1542 --INDENT;
1543
1544 }
1545
1546 void
outputSWF_DEFINETEXT(SWF_Parserstruct * pblock)1547 outputSWF_DEFINETEXT (SWF_Parserstruct * pblock)
1548 {
1549 int i;
1550 OUT_BEGIN (SWF_DEFINETEXT);
1551
1552 _iprintf(" CharacterID: %d\n", sblock->CharacterID );
1553 outputSWF_RECT( &sblock->TextBounds );
1554 outputSWF_MATRIX( &sblock->TextMatrix, "" );
1555 _iprintf(" GlyphBits: %d\n", sblock->GlyphBits );
1556 _iprintf(" AdvanceBits: %d\n", sblock->AdvanceBits );
1557 _iprintf(" TextRecords: %d\n", sblock->numTextRecords );
1558 for(i=0;i<sblock->numTextRecords;i++) {
1559 outputSWF_TEXTRECORD(&(sblock->TextRecords[i]), 1 );
1560 }
1561
1562 }
1563
1564 void
outputSWF_DEFINETEXT2(SWF_Parserstruct * pblock)1565 outputSWF_DEFINETEXT2 (SWF_Parserstruct * pblock)
1566 {
1567 int i;
1568 OUT_BEGIN (SWF_DEFINETEXT2);
1569
1570 _iprintf(" CharacterID: %d\n", sblock->CharacterID );
1571 outputSWF_RECT( &sblock->TextBounds );
1572 outputSWF_MATRIX( &sblock->TextMatrix, "" );
1573 _iprintf(" GlyphBits: %d\n", sblock->GlyphBits );
1574 _iprintf(" AdvanceBits: %d\n", sblock->AdvanceBits );
1575 _iprintf(" TextRecords: %d\n", sblock->numTextRecords );
1576 for(i=0;i<sblock->numTextRecords;i++) {
1577 outputSWF_TEXTRECORD(&(sblock->TextRecords[i]), 2 );
1578 }
1579 }
1580
1581 void
outputSWF_DEFINETEXTFORMAT(SWF_Parserstruct * pblock)1582 outputSWF_DEFINETEXTFORMAT (SWF_Parserstruct * pblock)
1583 {
1584 //OUT_BEGIN (SWF_DEFINETEXTFORMAT);
1585
1586 }
1587
1588 void
outputSWF_DEFINEVIDEO(SWF_Parserstruct * pblock)1589 outputSWF_DEFINEVIDEO (SWF_Parserstruct * pblock)
1590 {
1591 //OUT_BEGIN (SWF_DEFINEVIDEO);
1592
1593 }
1594
1595 void
outputSWF_DEFINEVIDEOSTREAM(SWF_Parserstruct * pblock)1596 outputSWF_DEFINEVIDEOSTREAM (SWF_Parserstruct * pblock)
1597 {
1598 OUT_BEGIN (SWF_DEFINEVIDEOSTREAM);
1599 _iprintf(" CharacterID: %d\n", sblock->CharacterID);
1600 _iprintf(" NumFrames: %d\n", sblock->NumFrames);
1601 _iprintf(" Width: %d; Height %d\n", sblock->Width, sblock->Height);
1602 _iprintf(" Flag deblocking: %x\n", sblock->VideoFlagsDeblocking);
1603 _iprintf(" Flag smoothing: %x\n", sblock->VideoFlagsSmoothing);
1604 _iprintf(" Codec ID: %d\n", sblock->CodecID);
1605 }
1606
1607 void
outputSWF_DOACTION(SWF_Parserstruct * pblock)1608 outputSWF_DOACTION (SWF_Parserstruct * pblock)
1609 {
1610 #ifdef NODECOMPILE
1611 int i;
1612 #endif
1613 OUT_BEGIN (SWF_DOACTION);
1614
1615 #ifdef NODECOMPILE
1616 _iprintf(" %d Actions\n", sblock->numActions);
1617 for(i=0;i<sblock->numActions;i++)
1618 outputSWF_ACTION(i,&(sblock->Actions[i]));
1619 #else
1620 _iprintf ("%s\n", decompile5Action(sblock->numActions, sblock->Actions, 0));
1621 #endif
1622
1623 }
1624
1625 void
outputSWF_ENABLEDEBUGGER(SWF_Parserstruct * pblock)1626 outputSWF_ENABLEDEBUGGER (SWF_Parserstruct * pblock)
1627 {
1628 OUT_BEGIN (SWF_ENABLEDEBUGGER);
1629 _iprintf(" Password: %s\n", sblock->Password);
1630 }
1631
1632 void
outputSWF_ENABLEDEBUGGER2(SWF_Parserstruct * pblock)1633 outputSWF_ENABLEDEBUGGER2 (SWF_Parserstruct * pblock)
1634 {
1635 OUT_BEGIN (SWF_ENABLEDEBUGGER2);
1636 _iprintf(" Password: %s\n", sblock->Password);
1637 }
1638
1639
1640 void
outputSWF_END(SWF_Parserstruct * pblock)1641 outputSWF_END (SWF_Parserstruct * pblock)
1642 {
1643 //OUT_BEGIN (SWF_END);
1644
1645 }
1646
1647 void
outputSWF_EXPORTASSETS(SWF_Parserstruct * pblock)1648 outputSWF_EXPORTASSETS (SWF_Parserstruct * pblock)
1649 {
1650 int i;
1651 OUT_BEGIN (SWF_EXPORTASSETS);
1652
1653 _iprintf (" num assets: %d\n", sblock->Count );
1654 for (i = 0; i < sblock->Count; i++)
1655 {
1656 _iprintf (" Asset[%3.3d]: %s\n", sblock->Tags[i],
1657 sblock->Names[i]);
1658 }
1659
1660 }
1661
1662 void
outputSWF_FONTREF(SWF_Parserstruct * pblock)1663 outputSWF_FONTREF (SWF_Parserstruct * pblock)
1664 {
1665 //OUT_BEGIN (SWF_FONTREF);
1666
1667 }
1668
1669 void
outputSWF_FRAMELABEL(SWF_Parserstruct * pblock)1670 outputSWF_FRAMELABEL (SWF_Parserstruct * pblock)
1671 {
1672 OUT_BEGIN (SWF_FRAMELABEL);
1673
1674 _iprintf (" Name: %s\n", sblock->Name );
1675 _iprintf (" IsAnchor: %d\n", sblock->IsAnchor );
1676 }
1677
1678 void
outputSWF_FRAMETAG(SWF_Parserstruct * pblock)1679 outputSWF_FRAMETAG (SWF_Parserstruct * pblock)
1680 {
1681 //OUT_BEGIN (SWF_FRAMETAG);
1682
1683 }
1684
1685 void
outputSWF_FREEALL(SWF_Parserstruct * pblock)1686 outputSWF_FREEALL (SWF_Parserstruct * pblock)
1687 {
1688 //OUT_BEGIN (SWF_FREEALL);
1689
1690 }
1691
1692 void
outputSWF_FREECHARACTER(SWF_Parserstruct * pblock)1693 outputSWF_FREECHARACTER (SWF_Parserstruct * pblock)
1694 {
1695 //OUT_BEGIN (SWF_FREECHARACTER);
1696
1697 }
1698
1699 void
outputSWF_GENCOMMAND(SWF_Parserstruct * pblock)1700 outputSWF_GENCOMMAND (SWF_Parserstruct * pblock)
1701 {
1702 //OUT_BEGIN (SWF_GENCOMMAND);
1703
1704 }
1705
1706 void
outputSWF_IMPORTASSETS(SWF_Parserstruct * pblock)1707 outputSWF_IMPORTASSETS (SWF_Parserstruct * pblock)
1708 {
1709 int i;
1710 OUT_BEGIN (SWF_IMPORTASSETS);
1711
1712 _iprintf (" URL: %s\n", sblock->URL );
1713 _iprintf (" num assets: %d\n", sblock->Count );
1714 for (i = 0; i < sblock->Count; i++)
1715 {
1716 _iprintf (" Asset[%3.3d]: %s\n", sblock->Tags[i],
1717 sblock->Names[i]);
1718 }
1719
1720 }
1721
1722 void
outputSWF_IMPORTASSETS2(SWF_Parserstruct * pblock)1723 outputSWF_IMPORTASSETS2 (SWF_Parserstruct * pblock)
1724 {
1725 int i;
1726 OUT_BEGIN (SWF_IMPORTASSETS2);
1727
1728 _iprintf (" URL: %s\n", sblock->URL );
1729 _iprintf (" num assets: %d\n", sblock->Count );
1730 for (i = 0; i < sblock->Count; i++)
1731 {
1732 _iprintf (" Asset[%3.3d]: %s\n", sblock->Tags[i],
1733 sblock->Names[i]);
1734 }
1735
1736 }
1737
1738 void
outputSWF_JPEGTABLES(SWF_Parserstruct * pblock)1739 outputSWF_JPEGTABLES (SWF_Parserstruct * pblock)
1740 {
1741 //OUT_BEGIN (SWF_JPEGTABLES);
1742
1743 }
1744
1745 void
outputSWF_NAMECHARACTER(SWF_Parserstruct * pblock)1746 outputSWF_NAMECHARACTER (SWF_Parserstruct * pblock)
1747 {
1748 OUT_BEGIN (SWF_NAMECHARACTER);
1749 _iprintf(" Id: %d\n", sblock->Id);
1750 _iprintf(" Name: %s\n", sblock->Name);
1751 }
1752
1753 void
outputSWF_PATHSAREPOSTSCRIPT(SWF_Parserstruct * pblock)1754 outputSWF_PATHSAREPOSTSCRIPT (SWF_Parserstruct * pblock)
1755 {
1756 //OUT_BEGIN (SWF_PATHSAREPOSTSCRIPT);
1757
1758 }
1759
1760 void
outputSWF_PLACEOBJECT(SWF_Parserstruct * pblock)1761 outputSWF_PLACEOBJECT (SWF_Parserstruct * pblock)
1762 {
1763 //OUT_BEGIN (SWF_PLACEOBJECT);
1764
1765 }
1766
1767 void
outputSWF_PLACEOBJECT2(SWF_Parserstruct * pblock)1768 outputSWF_PLACEOBJECT2 (SWF_Parserstruct * pblock)
1769 {
1770 OUT_BEGIN (SWF_PLACEOBJECT2);
1771
1772 #if !defined(ACTIONONLY)
1773 _iprintf(" PlaceFlagHasClipActions %d\n", sblock->PlaceFlagHasClipActions);
1774 _iprintf(" PlaceFlagHasClipDepth %d\n", sblock->PlaceFlagHasClipDepth);
1775 _iprintf(" PlaceFlagHasName %d\n", sblock->PlaceFlagHasName);
1776 _iprintf(" PlaceFlagHasRatio %d\n", sblock->PlaceFlagHasRatio);
1777 _iprintf(" PlaceFlagHasColorTransform %d\n", sblock->PlaceFlagHasColorTransform);
1778 _iprintf(" PlaceFlagHasMatrix %d\n", sblock->PlaceFlagHasMatrix);
1779 _iprintf(" PlaceFlagHasCharacter %d\n", sblock->PlaceFlagHasCharacter);
1780 _iprintf(" PlaceFlagMove %d\n", sblock->PlaceFlagMove);
1781 _iprintf(" Depth %d\n", sblock->Depth);
1782 if( sblock->PlaceFlagHasCharacter )
1783 _iprintf( " CharacterID: %d\n", sblock->CharacterId );
1784 if( sblock->PlaceFlagHasMatrix )
1785 outputSWF_MATRIX (&(sblock->Matrix), "");
1786 if( sblock->PlaceFlagHasColorTransform )
1787 outputSWF_CXFORMWITHALPHA (&(sblock->ColorTransform), "");
1788 if( sblock->PlaceFlagHasRatio )
1789 _iprintf( " Ratio: %d\n", sblock->Ratio );
1790 if( sblock->PlaceFlagHasName )
1791 _iprintf( " Name: %s\n", sblock->Name );
1792 if( sblock->PlaceFlagHasClipDepth )
1793 _iprintf( " ClipDepth: %d\n", sblock->ClipDepth );
1794 #endif
1795 if( sblock->PlaceFlagHasClipActions )
1796 outputSWF_CLIPACTIONS (&(sblock->ClipActions));
1797 }
1798
1799 void
outputSWF_PLACEOBJECT3(SWF_Parserstruct * pblock)1800 outputSWF_PLACEOBJECT3 (SWF_Parserstruct * pblock)
1801 {
1802 OUT_BEGIN (SWF_PLACEOBJECT3);
1803 #if !defined(ACTIONONLY)
1804 _iprintf(" PlaceFlagHasClipActions %d\n", sblock->PlaceFlagHasClipActions);
1805 _iprintf(" PlaceFlagHasClipDepth %d\n", sblock->PlaceFlagHasClipDepth);
1806 _iprintf(" PlaceFlagHasName %d\n", sblock->PlaceFlagHasName);
1807 _iprintf(" PlaceFlagHasRatio %d\n", sblock->PlaceFlagHasRatio);
1808 _iprintf(" PlaceFlagHasColorTransform %d\n", sblock->PlaceFlagHasColorTransform);
1809 _iprintf(" PlaceFlagHasMatrix %d\n", sblock->PlaceFlagHasMatrix);
1810 _iprintf(" PlaceFlagHasCharacter %d\n", sblock->PlaceFlagHasCharacter);
1811 _iprintf(" PlaceFlagMove %d\n", sblock->PlaceFlagMove);
1812 _iprintf(" PlaceFlagHasImage %d\n", sblock->PlaceFlagHasImage);
1813 _iprintf(" PlaceFlagHasClassName %d\n", sblock->PlaceFlagHasClassName);
1814 _iprintf(" PlaceFlagHasCacheAsbitmap %d\n", sblock->PlaceFlagHasCacheAsBitmap);
1815 _iprintf(" PlaceFlagHasBlendMode %d\n", sblock->PlaceFlagHasBlendMode);
1816 _iprintf(" PlaceFlagHasFilterList %d\n", sblock->PlaceFlagHasFilterList);
1817 _iprintf(" Depth %d\n", sblock->Depth);
1818
1819 if( sblock->PlaceFlagHasClassName ||
1820 (sblock->PlaceFlagHasImage && sblock->PlaceFlagHasCharacter))
1821 _iprintf(" ClassName %s\n", sblock->ClassName);
1822
1823 if( sblock->PlaceFlagHasCharacter )
1824 _iprintf( " CharacterID: %d\n", sblock->CharacterId );
1825 if( sblock->PlaceFlagHasMatrix )
1826 outputSWF_MATRIX (&(sblock->Matrix), "");
1827 if( sblock->PlaceFlagHasColorTransform )
1828 outputSWF_CXFORMWITHALPHA (&(sblock->ColorTransform), "");
1829 if( sblock->PlaceFlagHasRatio )
1830 _iprintf( " Ratio: %d\n", sblock->Ratio );
1831 if( sblock->PlaceFlagHasName )
1832 _iprintf( " Name: %s\n", sblock->Name );
1833 if( sblock->PlaceFlagHasClipDepth )
1834 _iprintf( " ClipDepth: %d\n", sblock->ClipDepth );
1835 if( sblock->PlaceFlagHasBlendMode )
1836 _iprintf(" BlendMode %d\n", sblock->BlendMode );
1837 if( sblock->PlaceFlagHasFilterList )
1838 {
1839 int i;
1840 SWF_FILTERLIST *filterList = &sblock->SurfaceFilterList;
1841
1842 _iprintf(" NumberOfFilters %d\n", filterList->NumberOfFilters);
1843
1844 for(i = 0; i < filterList->NumberOfFilters; i++)
1845 outputSWF_FILTER(filterList->Filter + i);
1846 }
1847 #endif
1848 if( sblock->PlaceFlagHasClipActions )
1849 outputSWF_CLIPACTIONS (&(sblock->ClipActions));
1850
1851 }
1852
1853 void
outputSWF_PREBUILT(SWF_Parserstruct * pblock)1854 outputSWF_PREBUILT (SWF_Parserstruct * pblock)
1855 {
1856 //OUT_BEGIN (SWF_PREBUILT);
1857
1858 }
1859
1860 void
outputSWF_PREBUILTCLIP(SWF_Parserstruct * pblock)1861 outputSWF_PREBUILTCLIP (SWF_Parserstruct * pblock)
1862 {
1863 //OUT_BEGIN (SWF_PREBUILTCLIP);
1864
1865 }
1866
1867 void
outputSWF_PROTECT(SWF_Parserstruct * pblock)1868 outputSWF_PROTECT (SWF_Parserstruct * pblock)
1869 {
1870 OUT_BEGIN (SWF_PROTECT);
1871
1872 if( sblock->Password )
1873 _iprintf(" Password: %s\n", sblock->Password);
1874
1875 }
1876
1877 void
outputSWF_REMOVEOBJECT(SWF_Parserstruct * pblock)1878 outputSWF_REMOVEOBJECT (SWF_Parserstruct * pblock)
1879 {
1880 OUT_BEGIN (SWF_REMOVEOBJECT);
1881
1882 _iprintf(" CharacterID: %d\n", sblock->CharacterId);
1883 _iprintf(" Depth: %d\n", sblock->Depth);
1884
1885 }
1886
1887 void
outputSWF_REMOVEOBJECT2(SWF_Parserstruct * pblock)1888 outputSWF_REMOVEOBJECT2 (SWF_Parserstruct * pblock)
1889 {
1890 OUT_BEGIN (SWF_REMOVEOBJECT2);
1891 _iprintf(" Depth: %d\n", sblock->Depth);
1892
1893 }
1894
1895 void
outputSWF_SERIALNUMBER(SWF_Parserstruct * pblock)1896 outputSWF_SERIALNUMBER (SWF_Parserstruct * pblock)
1897 {
1898 OUT_BEGIN (SWF_SERIALNUMBER);
1899 _iprintf("Version %d.%d.%d.%d\n", sblock->Id, sblock->Edition,
1900 sblock->Major, sblock->Minor);
1901 _iprintf("Build: %lu\n", (((long long)sblock->BuildH) << 32) + sblock->BuildL);
1902 _iprintf("Timestamp: %lu\n",
1903 (((long long)sblock->TimestampH) << 32) + sblock->TimestampL);
1904 }
1905
1906 void
outputSWF_SETBACKGROUNDCOLOR(SWF_Parserstruct * pblock)1907 outputSWF_SETBACKGROUNDCOLOR (SWF_Parserstruct * pblock)
1908 {
1909 OUT_BEGIN (SWF_SETBACKGROUNDCOLOR);
1910
1911 outputSWF_RGBA (&sblock->rgb, "");
1912
1913 }
1914
1915 void
outputSWF_SHOWFRAME(SWF_Parserstruct * pblock)1916 outputSWF_SHOWFRAME (SWF_Parserstruct * pblock)
1917 {
1918 //OUT_BEGIN (SWF_SHOWFRAME);
1919
1920 }
1921
1922
1923 void
outputSWF_SOUNDSTREAMBLOCK(SWF_Parserstruct * pblock)1924 outputSWF_SOUNDSTREAMBLOCK (SWF_Parserstruct * pblock)
1925 {
1926 OUT_BEGIN (SWF_SOUNDSTREAMBLOCK);
1927 if(m.soundStreamFmt == 2)
1928 {
1929 _iprintf(" SampleCount %u\n", sblock->StreamData.mp3.SampleCount);
1930 _iprintf(" Mp3: SeekSamples %i\n",
1931 sblock->StreamData.mp3.SeekSamples);
1932 }
1933 }
1934
1935 void
outputSWF_SOUNDSTREAMHEAD(SWF_Parserstruct * pblock)1936 outputSWF_SOUNDSTREAMHEAD (SWF_Parserstruct * pblock)
1937 {
1938 char *tmp;
1939
1940 OUT_BEGIN (SWF_SOUNDSTREAMHEAD);
1941 switch(sblock->PlaybackSoundRate)
1942 {
1943 case 0: tmp = "5.5 kHz"; break;
1944 case 1: tmp = "11 kHz"; break;
1945 case 2: tmp = "22 kHz"; break;
1946 case 3: tmp = "44 kHz"; break;
1947 default: tmp = "error";
1948 }
1949 _iprintf(" PlaybackSoundRate %s\n", tmp);
1950
1951 switch(sblock->PlaybackSoundSize)
1952 {
1953 case 1: tmp = "16 bit"; break;
1954 default: tmp = "error";
1955 }
1956 _iprintf(" PlaybackSoundSize %s\n", tmp);
1957
1958 switch(sblock->PlaybackSoundType)
1959 {
1960 case 0: tmp = "mono"; break;
1961 case 1: tmp = "stereo"; break;
1962 default: tmp = "error";
1963 }
1964 _iprintf(" PlaybackSoundType %s\n", tmp);
1965
1966 switch(sblock->StreamSoundCompression)
1967 {
1968 case 1: tmp = "ADPCM"; break;
1969 case 2: tmp = "MP3"; break;
1970 default: tmp ="error";
1971 }
1972 _iprintf(" StreamSoundCompression %s\n", tmp);
1973
1974 switch(sblock->StreamSoundRate)
1975 {
1976 case 0: tmp = "5.5 kHz"; break;
1977 case 1: tmp = "11 kHz"; break;
1978 case 2: tmp = "22 kHz"; break;
1979 case 3: tmp = "44 kHz"; break;
1980 default: tmp = "error";
1981 }
1982 _iprintf(" StreamSoundRate %s\n", tmp);
1983
1984 switch(sblock->StreamSoundSize)
1985 {
1986 case 1: tmp = "16 bit"; break;
1987 default: tmp = "error";
1988 }
1989 _iprintf(" StreamSoundSize %s\n", tmp);
1990
1991 switch(sblock->StreamSoundType)
1992 {
1993 case 0: tmp = "mono"; break;
1994 case 1: tmp = "stereo"; break;
1995 default: tmp = "error";
1996 }
1997 _iprintf(" StreamSoundType %s\n", tmp);
1998 _iprintf(" StreamSoundSampleCount %u\n", sblock->StreamSoundSampleCount);
1999 if(sblock->StreamSoundCompression == 2)
2000 _iprintf(" LatencySeek %i\n", sblock->LatencySeek);
2001 }
2002
2003 void
outputSWF_SOUNDSTREAMHEAD2(SWF_Parserstruct * pblock)2004 outputSWF_SOUNDSTREAMHEAD2 (SWF_Parserstruct * pblock)
2005 {
2006 char *tmp;
2007 OUT_BEGIN (SWF_SOUNDSTREAMHEAD2);
2008 switch(sblock->PlaybackSoundRate)
2009 {
2010 case 0: tmp = "5.5 kHz"; break;
2011 case 1: tmp = "11 kHz"; break;
2012 case 2: tmp = "22 kHz"; break;
2013 case 3: tmp = "44 kHz"; break;
2014 default: tmp = "error";
2015 }
2016 _iprintf(" PlaybackSoundRate %s\n", tmp);
2017
2018 switch(sblock->PlaybackSoundSize)
2019 {
2020 case 0: tmp = "8 bit"; break;
2021 case 1: tmp = "16 bit"; break;
2022 default: tmp = "error";
2023 }
2024 _iprintf(" PlaybackSoundSize %s\n", tmp);
2025
2026 switch(sblock->PlaybackSoundType)
2027 {
2028 case 0: tmp = "mono"; break;
2029 case 1: tmp = "stereo"; break;
2030 default: tmp = "error";
2031 }
2032 _iprintf(" PlaybackSoundType %s\n", tmp);
2033
2034 switch(sblock->StreamSoundCompression)
2035 {
2036 case 0: tmp = "uncompressed"; break;
2037 case 1: tmp = "ADPCM"; break;
2038 case 2: tmp = "MP3"; break;
2039 case 3: tmp = "uncompressed"; break;
2040 case 6: tmp = "Nellymoser"; break;
2041 default: tmp ="error";
2042 }
2043 _iprintf(" StreamSoundCompression %s\n", tmp);
2044
2045 switch(sblock->StreamSoundRate)
2046 {
2047 case 0: tmp = "5.5 kHz"; break;
2048 case 1: tmp = "11 kHz"; break;
2049 case 2: tmp = "22 kHz"; break;
2050 case 3: tmp = "44 kHz"; break;
2051 default: tmp = "error";
2052 }
2053 _iprintf(" StreamSoundRate %s\n", tmp);
2054
2055 switch(sblock->StreamSoundSize)
2056 {
2057 case 0: tmp = "8 bit"; break;
2058 case 1: tmp = "16 bit"; break;
2059 default: tmp = "error";
2060 }
2061 _iprintf(" StreamSoundSize %s\n", tmp);
2062
2063 switch(sblock->StreamSoundType)
2064 {
2065 case 0: tmp = "mono"; break;
2066 case 1: tmp = "stereo"; break;
2067 default: tmp = "error";
2068 }
2069 _iprintf(" StreamSoundType %s\n", tmp);
2070 _iprintf(" StreamSoundSampleCount %u\n", sblock->StreamSoundSampleCount);
2071 if(sblock->StreamSoundCompression == 2)
2072 _iprintf(" LatencySeek %i\n", sblock->LatencySeek);
2073 }
2074
2075 void
outputSWF_SOUNDENVELOPE(SWF_SOUNDENVELOPE * env)2076 outputSWF_SOUNDENVELOPE (SWF_SOUNDENVELOPE *env)
2077 {
2078 _iprintf(" SoundEnvelope:");
2079 _iprintf(" Pos44 %d, LeftLevel %d, RightLevel %d\n",
2080 env->Pos44, env->LeftLevel, env->RightLevel);
2081 }
2082
2083 void
outputSWF_SOUNDINFO(SWF_SOUNDINFO * info)2084 outputSWF_SOUNDINFO (SWF_SOUNDINFO *info)
2085 {
2086 _iprintf(" SoundInfo:\n");
2087 _iprintf(" SyncStop: %s\n", info->SyncStop?"Yes":"No");
2088 _iprintf(" SyncNoMultiple: %s\n", info->SyncNoMultiple?"Yes":"No");
2089 _iprintf(" HasEnvelope: %s\n", info->HasEnvelope?"Yes":"No");
2090 _iprintf(" Loops: %d\n", info->HasLoops?info->LoopCount:0);
2091
2092 if(info->HasOutPoint)
2093 _iprintf(" HasOutPoint: %d", info->OutPoint);
2094
2095 if(info->HasInPoint)
2096 _iprintf(" HasInPoint: %d", info->InPoint);
2097
2098 _iprintf("\n");
2099
2100 if(info->HasEnvelope)
2101 {
2102 int i;
2103 _iprintf(" EnvPoints %d\n", info->EnvPoints);
2104 for(i = 0; i < info->EnvPoints; i++)
2105 outputSWF_SOUNDENVELOPE(info->EnvelopeRecords + i);
2106 }
2107 }
2108
2109 void
outputSWF_STARTSOUND(SWF_Parserstruct * pblock)2110 outputSWF_STARTSOUND (SWF_Parserstruct * pblock)
2111 {
2112 OUT_BEGIN (SWF_STARTSOUND);
2113 _iprintf(" SoundId %d\n", sblock->SoundId);
2114 outputSWF_SOUNDINFO(&sblock->SoundInfo);
2115 }
2116
2117 void
outputSWF_STARTSOUND2(SWF_Parserstruct * pblock)2118 outputSWF_STARTSOUND2 (SWF_Parserstruct * pblock)
2119 {
2120 OUT_BEGIN (SWF_STARTSOUND2);
2121 _iprintf(" SoundClassName %s\n", sblock->SoundClassName);
2122 outputSWF_SOUNDINFO(&sblock->SoundInfo);
2123 }
2124
2125 void
outputSWF_SYNCFRAME(SWF_Parserstruct * pblock)2126 outputSWF_SYNCFRAME (SWF_Parserstruct * pblock)
2127 {
2128 //OUT_BEGIN (SWF_SYNCFRAME);
2129
2130 }
2131
2132 void
outputSWF_INITACTION(SWF_Parserstruct * pblock)2133 outputSWF_INITACTION (SWF_Parserstruct * pblock)
2134 {
2135 #ifdef NODECOMPILE
2136 int i;
2137 #endif
2138 OUT_BEGIN (SWF_INITACTION);
2139
2140 _iprintf(" %d Init actions for character %u\n", sblock->numActions, sblock->SpriteId);
2141 #ifdef NODECOMPILE
2142 for(i=0;i<sblock->numActions;i++)
2143 outputSWF_ACTION(i,&(sblock->Actions[i]));
2144 #else
2145 _iprintf ("%s\n", decompile5Action(sblock->numActions,sblock->Actions,0));
2146 #endif
2147
2148 }
2149 void
outputSWF_VIDEOFRAME(SWF_Parserstruct * pblock)2150 outputSWF_VIDEOFRAME (SWF_Parserstruct * pblock)
2151 {
2152 OUT_BEGIN (SWF_VIDEOFRAME);
2153 _iprintf(" StreamID %i\n", sblock->StreamID);
2154 _iprintf(" FrameNum %i\n", sblock->FrameNum);
2155 }
2156
2157 void
outputSWF_REFLEX(SWF_Parserstruct * pblock)2158 outputSWF_REFLEX (SWF_Parserstruct * pblock)
2159 {
2160 OUT_BEGIN (SWF_REFLEX);
2161
2162 _iprintf(" Reflex: \"%c%c%c\"\n", sblock->rfx[0], sblock->rfx[1], sblock->rfx[2]);
2163 }
2164
2165 void
outputSWF_FILEATTRIBUTES(SWF_Parserstruct * pblock)2166 outputSWF_FILEATTRIBUTES(SWF_Parserstruct * pblock)
2167 {
2168 OUT_BEGIN (SWF_FILEATTRIBUTES);
2169
2170 _iprintf(" FileAttributes: HasMetaData %d, UseNetwork %d, HasAS3 %d\n",
2171 sblock->HasMetadata, sblock->UseNetwork, sblock->ActionScript3);
2172 }
2173
2174 void
outputSWF_METADATA(SWF_Parserstruct * pblock)2175 outputSWF_METADATA(SWF_Parserstruct * pblock)
2176 {
2177 OUT_BEGIN (SWF_METADATA);
2178
2179 _iprintf(" Metadata: \n%s\n\n",
2180 sblock->Metadata);
2181 }
2182
2183 void
outputSWF_SCRIPTLIMITS(SWF_Parserstruct * pblock)2184 outputSWF_SCRIPTLIMITS(SWF_Parserstruct * pblock)
2185 {
2186 OUT_BEGIN (SWF_SCRIPTLIMITS);
2187 _iprintf(" MaxRecursionDepth %d\n", sblock->MaxRecursionDepth);
2188 _iprintf(" ScriptTimeoutSeconds %d\n", sblock->ScriptTimeoutSeconds);
2189 }
2190
2191 void
outputSWF_DEFINESCALINGGRID(SWF_Parserstruct * pblock)2192 outputSWF_DEFINESCALINGGRID(SWF_Parserstruct * pblock)
2193 {
2194 OUT_BEGIN (SWF_DEFINESCALINGGRID);
2195 _iprintf(" CharacterId %d\n", sblock->CharacterId);
2196 outputSWF_RECT(&sblock->Splitter);
2197 }
2198
2199 void
outputSWF_SETTABINDEX(SWF_Parserstruct * pblock)2200 outputSWF_SETTABINDEX(SWF_Parserstruct *pblock)
2201 {
2202 OUT_BEGIN (SWF_SETTABINDEX);
2203 _iprintf(" Depth: %d\n", sblock->Depth);
2204 _iprintf(" TabIndex: %d\n", sblock->TabIndex);
2205 }
2206
2207 static void
2208 outputNSSetConstant(struct ABC_FILE *abc, unsigned int index);
2209 static void
2210 outputNamespaceConstant(struct ABC_FILE *abc, unsigned int index);
2211 static void
2212 outputMultinameConstant(struct ABC_FILE *abc, unsigned int index);
2213 static void
2214 outputStringConstant(struct ABC_FILE *abc, unsigned int strIndex);
2215
2216 static void
outputABC_STRING_INFO(struct ABC_STRING_INFO * si)2217 outputABC_STRING_INFO(struct ABC_STRING_INFO *si)
2218 {
2219 char *buffer, *bufp;
2220 int i;
2221 if(si->Size == 0)
2222 {
2223 _iprintf(" ** empty ** (0)\n");
2224 return;
2225 }
2226
2227 // we don't deal with utf8 yet
2228 buffer = malloc(si->Size+1);
2229 memset(buffer, 0, si->Size+1);
2230 bufp = buffer;
2231 for(i = 0; i < si->Size; i++)
2232 {
2233 if(si->UTF8String[i] < 128)
2234 *bufp++ = si->UTF8String[i];
2235 }
2236 _iprintf(" '%s' (%i)\n", buffer, si->Size);
2237 free(buffer);
2238
2239 }
2240
2241 static void
outputABC_QNAME(struct ABC_FILE * abc,struct ABC_QNAME * qn)2242 outputABC_QNAME(struct ABC_FILE *abc, struct ABC_QNAME *qn)
2243 {
2244 outputNamespaceConstant(abc, qn->NS);
2245 outputStringConstant(abc, qn->Name);
2246 }
2247
2248 static void
outputABC_RTQNAME(struct ABC_FILE * abc,struct ABC_RTQNAME * rtq)2249 outputABC_RTQNAME(struct ABC_FILE *abc, struct ABC_RTQNAME *rtq)
2250 {
2251 outputStringConstant(abc, rtq->Name);
2252 }
2253
2254 static void
outputABC_MULTINAME(struct ABC_FILE * abc,struct ABC_MULTINAME * mn)2255 outputABC_MULTINAME(struct ABC_FILE *abc, struct ABC_MULTINAME *mn)
2256 {
2257 outputStringConstant(abc, mn->Name);
2258 outputNSSetConstant(abc, mn->NSSet);
2259 }
2260
2261 static void
outputABC_MULTINAME_L(struct ABC_FILE * abc,struct ABC_MULTINAME_L * ml)2262 outputABC_MULTINAME_L(struct ABC_FILE *abc, struct ABC_MULTINAME_L *ml)
2263 {
2264 outputNSSetConstant(abc, ml->NSSet);
2265 }
2266
outputABC_MULTINAME_INFO(struct ABC_FILE * abc,struct ABC_MULTINAME_INFO * mi)2267 static void outputABC_MULTINAME_INFO(struct ABC_FILE *abc,
2268 struct ABC_MULTINAME_INFO *mi)
2269 {
2270 switch(mi->Kind)
2271 {
2272 case ABC_CONST_QNAME:
2273 case ABC_CONST_QNAME_A:
2274 _iprintf(" Multiname ABC_CONST_QNAME(A)");
2275 outputABC_QNAME(abc, &mi->Data.QName);
2276 break;
2277 case ABC_CONST_RTQNAME:
2278 case ABC_CONST_RTQNAME_A:
2279 _iprintf(" Multiname ABC_CONST_RTQNAME(A)");
2280 outputABC_RTQNAME(abc, &mi->Data.RTQName);
2281 break;
2282 case ABC_CONST_RTQNAME_L:
2283 case ABC_CONST_RTQNAME_LA:
2284 _iprintf(" Multiname ABC_CONST_MULTINAME(A)");
2285 break;
2286 case ABC_CONST_MULTINAME:
2287 case ABC_CONST_MULTINAME_A:
2288 _iprintf(" Multiname ABC_CONST_MULTINAME(A)");
2289 outputABC_MULTINAME(abc, &mi->Data.Multiname);
2290 break;
2291 case ABC_CONST_MULTINAME_L:
2292 case ABC_CONST_MULTINAME_LA:
2293 _iprintf(" Multiname ABC_CONST_MULTINAME(A)");
2294 outputABC_MULTINAME_L(abc, &mi->Data.MultinameL);
2295 break;
2296 }
2297 }
2298
2299 static void
outputABC_NS_INFO(struct ABC_FILE * abc,struct ABC_NS_INFO * ns)2300 outputABC_NS_INFO(struct ABC_FILE *abc, struct ABC_NS_INFO *ns)
2301 {
2302 _iprintf(" Namespace Kind %x\n", ns->Kind);
2303 outputStringConstant(abc, ns->Name);
2304 }
2305
2306 static void
outputABC_NS_SET_INFO(struct ABC_FILE * abc,struct ABC_NS_SET_INFO * set)2307 outputABC_NS_SET_INFO(struct ABC_FILE *abc, struct ABC_NS_SET_INFO *set)
2308 {
2309 int i;
2310 for(i = 0; i < set->Count; i++)
2311 {
2312 unsigned int index = set->NS[i];
2313 outputNamespaceConstant(abc, index);
2314 }
2315 }
2316
2317 static void
outputNSSetConstant(struct ABC_FILE * abc,unsigned int index)2318 outputNSSetConstant(struct ABC_FILE *abc, unsigned int index)
2319 {
2320 struct ABC_CONSTANT_POOL *cp = &abc->ConstantPool;
2321 if(index >= cp->NamespaceSetCount)
2322 {
2323 _iprintf("ConstantPool NamespaceSetCount %u <= index %u\n",
2324 cp->NamespaceSetCount, index);
2325 return;
2326 }
2327
2328 if(index == 0)
2329 {
2330 _iprintf("*\n");
2331 return;
2332 }
2333 outputABC_NS_SET_INFO(abc, cp->NsSets + index);
2334 }
2335
2336
2337 static void
outputNamespaceConstant(struct ABC_FILE * abc,unsigned int index)2338 outputNamespaceConstant(struct ABC_FILE *abc, unsigned int index)
2339 {
2340 struct ABC_CONSTANT_POOL *cp = &abc->ConstantPool;
2341 if(index >= cp->NamespaceCount)
2342 {
2343 _iprintf("ConstantPool NamespaceCount %u <= index %u\n",
2344 cp->NamespaceCount, index);
2345 return;
2346 }
2347
2348 if(index == 0)
2349 {
2350 _iprintf("*\n");
2351 return;
2352 }
2353 outputABC_NS_INFO(abc, cp->Namespaces + index);
2354 }
2355
2356 static void
outputMultinameConstant(struct ABC_FILE * abc,unsigned int index)2357 outputMultinameConstant(struct ABC_FILE *abc, unsigned int index)
2358 {
2359 struct ABC_CONSTANT_POOL *cp = &abc->ConstantPool;
2360 if(index >= cp->MultinameCount)
2361 {
2362 _iprintf("ConstantPool MultinameCount %u <= index %u\n",
2363 cp->MultinameCount, index);
2364 return;
2365 }
2366
2367 if(index == 0)
2368 {
2369 _iprintf("Multiname index 0 is not allowed\n");
2370 return;
2371 }
2372 outputABC_MULTINAME_INFO(abc, cp->Multinames + index);
2373 }
2374
2375 static void
outputIntConstant(struct ABC_FILE * abc,unsigned int index)2376 outputIntConstant(struct ABC_FILE *abc, unsigned int index)
2377 {
2378 struct ABC_CONSTANT_POOL *cp = &abc->ConstantPool;
2379 if(index >= cp->IntCount)
2380 {
2381 _iprintf("ConstantPool IntCount %u <= index %u\n",
2382 cp->IntCount, index);
2383 return;
2384 }
2385
2386 if(index == 0)
2387 {
2388 _iprintf("Integer index 0 is not allowed\n");
2389 return;
2390 }
2391 _iprintf("Int %i\n", cp->Integers[index]);
2392 }
2393
2394 static void
outputUIntConstant(struct ABC_FILE * abc,unsigned int index)2395 outputUIntConstant(struct ABC_FILE *abc, unsigned int index)
2396 {
2397 struct ABC_CONSTANT_POOL *cp = &abc->ConstantPool;
2398 if(index >= cp->UIntCount)
2399 {
2400 _iprintf("ConstantPool UIntCount %u <= index %u\n",
2401 cp->UIntCount, index);
2402 return;
2403 }
2404
2405 if(index == 0)
2406 {
2407 _iprintf("UInteger index 0 is not allowed\n");
2408 return;
2409 }
2410 _iprintf(" UInt %u\n", cp->UIntegers[index]);
2411 }
2412
2413 static void
outputDoubleConstant(struct ABC_FILE * abc,unsigned int index)2414 outputDoubleConstant(struct ABC_FILE *abc, unsigned int index)
2415 {
2416 struct ABC_CONSTANT_POOL *cp = &abc->ConstantPool;
2417 if(index >= cp->DoubleCount)
2418 {
2419 _iprintf("ConstantPool DoubleCount %u <= index %u\n",
2420 cp->DoubleCount, index);
2421 return;
2422 }
2423
2424 if(index == 0)
2425 {
2426 _iprintf(" NaN\n");
2427 return;
2428 }
2429 _iprintf(" Double %f\n", cp->Doubles[index]);
2430 }
2431
2432
2433 static void
outputStringConstant(struct ABC_FILE * abc,unsigned int strIndex)2434 outputStringConstant(struct ABC_FILE *abc, unsigned int strIndex)
2435 {
2436 struct ABC_CONSTANT_POOL *cp = &abc->ConstantPool;
2437 if(strIndex >= cp->StringCount)
2438 {
2439 _iprintf("ConstantPool StringCount %u <= strIndex %u\n",
2440 cp->StringCount, strIndex);
2441 return;
2442 }
2443
2444 if(strIndex == 0)
2445 {
2446 _iprintf(" *\n");
2447 return;
2448 }
2449 outputABC_STRING_INFO(cp->Strings + strIndex);
2450 }
2451
outputABC_OPTION_INFO(struct ABC_FILE * abc,struct ABC_OPTION_INFO * o)2452 void outputABC_OPTION_INFO(struct ABC_FILE *abc, struct ABC_OPTION_INFO *o)
2453 {
2454 int i;
2455 for (i = 0; i < o->OptionCount; i++)
2456 {
2457 unsigned int index = o->Option[i].Val;
2458 _iprintf(" Option: ");
2459 switch(o->Option[i].Kind)
2460 {
2461 case ABC_INT:
2462 outputIntConstant(abc, index);
2463 break;
2464 case ABC_UINT:
2465 outputUIntConstant(abc, index);
2466 break;
2467 case ABC_DOUBLE:
2468 outputDoubleConstant(abc, index);
2469 break;
2470 case ABC_UTF8:
2471 outputStringConstant(abc, index);
2472 break;
2473 case ABC_TRUE:
2474 _iprintf(" TRUE\n");
2475 break;
2476 case ABC_FALSE:
2477 _iprintf(" FALSE\n");
2478 break;
2479 case ABC_NULL:
2480 _iprintf(" NULL\n");
2481 break;
2482 case ABC_UNDEF:
2483 _iprintf(" UNDEF\n");
2484 break;
2485 case ABC_NAMESPACE:
2486 case ABC_PACKAGE_NS:
2487 case ABC_PACKAGE_INTERNAL_NS:
2488 case ABC_PROTECTED_NS:
2489 case ABC_EXPLICIT_NS:
2490 case ABC_STATIC_PROTECTED_NS:
2491 case ABC_PRIVATE_NS:
2492 outputNamespaceConstant(abc, index);
2493 break;
2494 default:
2495 _iprintf("Option type %x unknown\n", o->Option[i].Kind);
2496 }
2497 }
2498 }
2499
outputABC_METHOD_INFO(struct ABC_FILE * abc,struct ABC_METHOD_INFO * minfo)2500 void outputABC_METHOD_INFO(struct ABC_FILE *abc, struct ABC_METHOD_INFO *minfo)
2501 {
2502 int i;
2503 _iprintf(" ParamCount %u\n", minfo->ParamCount);
2504 _iprintf(" ReturnType \n {\n");
2505 if(minfo->ReturnType)
2506 outputMultinameConstant(abc, minfo->ReturnType);
2507 else
2508 _iprintf(" void\n");
2509 _iprintf(" }\n\n");
2510 for(i = 0; i < minfo->ParamCount; i++)
2511 {
2512 unsigned int index = minfo->ParamType[i];
2513 _iprintf(" Parameter %i\n {\n", i);
2514 outputMultinameConstant(abc, index);
2515 _iprintf(" }\n");
2516 }
2517
2518 _iprintf(" Name (%u) ", minfo->Name);
2519 if(minfo->Name)
2520 outputStringConstant(abc, minfo->Name);
2521 else
2522 _iprintf("**no name**\n");
2523
2524 _iprintf(" Flags %x\n", minfo->Flags);
2525 if(minfo->Flags & ABC_METHOD_HAS_OPTIONAL)
2526 outputABC_OPTION_INFO(abc, &minfo->Options);
2527 if(minfo->Flags & ABC_METHOD_HAS_PARAM_NAMES)
2528 {
2529 int i;
2530 _iprintf(" Parameter Names:\n");
2531 for(i = 0; i < minfo->ParamCount; i++)
2532 {
2533 int strIndex = minfo->ParamType[i];
2534 outputStringConstant(abc, strIndex);
2535 }
2536 }
2537 }
2538
2539
outputABC_CONSTANT_POOL(struct ABC_CONSTANT_POOL * cpool)2540 void outputABC_CONSTANT_POOL(struct ABC_CONSTANT_POOL *cpool)
2541 {
2542 _iprintf(" ConstantPool: \n");
2543 _iprintf(" Integers: %u, Unsigend %u Doubles %u\n",
2544 cpool->IntCount, cpool->UIntCount, cpool->DoubleCount);
2545 _iprintf(" Strings %u, Namespaces %u, NS-Sets %u, Multinames %u\n\n",
2546 cpool->StringCount, cpool->NamespaceCount, cpool->NamespaceSetCount,
2547 cpool->MultinameCount);
2548 }
2549
2550 void
outputABC_METADATA_INFO(struct ABC_FILE * abc,struct ABC_METADATA_INFO * mi)2551 outputABC_METADATA_INFO(struct ABC_FILE *abc, struct ABC_METADATA_INFO *mi)
2552 {
2553 unsigned int i;
2554
2555 _iprintf(" Name: ");
2556 outputStringConstant(abc, mi->Name);
2557
2558 for(i = 0; i < mi->ItemCount; i++)
2559 {
2560 _iprintf(" Key (%u) ", mi->Items[i].Key);
2561 outputStringConstant(abc, mi->Items[i].Key);
2562 _iprintf(" Value (%u) ", mi->Items[i].Value);
2563 outputStringConstant(abc, mi->Items[i].Value);
2564 _iprintf("\n");
2565 }
2566 }
2567
2568 void
outputABC_TRAIT_SLOT(struct ABC_FILE * abc,struct ABC_TRAIT_SLOT * ts)2569 outputABC_TRAIT_SLOT(struct ABC_FILE *abc, struct ABC_TRAIT_SLOT *ts)
2570 {
2571 _iprintf(" Trait Slot\n");
2572 _iprintf(" SlotId %u\n", ts->SlotId);
2573 _iprintf(" Type Name ");
2574 if(ts->TypeName)
2575 outputMultinameConstant(abc, ts->TypeName);
2576 else
2577 _iprintf(" * ");
2578 _iprintf("\n");
2579
2580 _iprintf(" VIndex %u\n", ts->VIndex);
2581 if(ts->VIndex)
2582 _iprintf(" VKind %u\n", ts->VKind);
2583 }
2584
2585 void
outputABC_TRAIT_CLASS(struct ABC_FILE * abc,struct ABC_TRAIT_CLASS * tc)2586 outputABC_TRAIT_CLASS(struct ABC_FILE *abc, struct ABC_TRAIT_CLASS *tc)
2587 {
2588 _iprintf(" Trait Class\n");
2589 _iprintf(" SlotId %u\n", tc->SlotId);
2590 _iprintf(" Class Index %u\n", tc->ClassIndex);
2591 }
2592
2593 void
outputABC_TRAIT_FUNCTION(struct ABC_FILE * abc,struct ABC_TRAIT_FUNCTION * tf)2594 outputABC_TRAIT_FUNCTION(struct ABC_FILE *abc, struct ABC_TRAIT_FUNCTION *tf)
2595 {
2596 _iprintf(" Trait Function\n");
2597 _iprintf(" SlotId %u\n", tf->SlotId);
2598 _iprintf(" Method Index %u\n", tf->Function);
2599 }
2600
2601 void
outputABC_TRAIT_METHOD(struct ABC_FILE * abc,struct ABC_TRAIT_METHOD * tm)2602 outputABC_TRAIT_METHOD(struct ABC_FILE *abc, struct ABC_TRAIT_METHOD *tm)
2603 {
2604 _iprintf(" Trait Method\n");
2605 _iprintf(" DispId %u\n", tm->DispId);
2606 _iprintf(" Method Index %u\n", tm->Method);
2607 }
2608
2609
2610 void
outputABC_TRAITS_INFO(struct ABC_FILE * abc,struct ABC_TRAITS_INFO * ti)2611 outputABC_TRAITS_INFO(struct ABC_FILE *abc, struct ABC_TRAITS_INFO *ti)
2612 {
2613 _iprintf(" Name: ");
2614 outputMultinameConstant(abc, ti->Name);
2615 _iprintf("\n");
2616
2617 switch(ti->Kind & 0xf)
2618 {
2619 case ABC_CONST_TRAIT_SLOT:
2620 case ABC_CONST_TRAIT_CONST:
2621 outputABC_TRAIT_SLOT(abc, &ti->Data.Slot);
2622 break;
2623 case ABC_CONST_TRAIT_CLASS:
2624 outputABC_TRAIT_CLASS(abc, &ti->Data.Class);
2625 break;
2626 case ABC_CONST_TRAIT_FUNCTION:
2627 outputABC_TRAIT_FUNCTION(abc, &ti->Data.Function);
2628 break;
2629 case ABC_CONST_TRAIT_METHOD:
2630 case ABC_CONST_TRAIT_GETTER:
2631 case ABC_CONST_TRAIT_SETTER:
2632 outputABC_TRAIT_METHOD(abc, &ti->Data.Method);
2633 break;
2634 default:
2635 _iprintf("unknown trait %x\n", ti->Kind);
2636 }
2637
2638 _iprintf(" Trait Attr %x\n", ti->Attr);
2639 if(ti->Attr & ABC_TRAIT_ATTR_METADATA)
2640 {
2641 unsigned int i;
2642 _iprintf(" Trait Metadata Num %u\n", ti->MetadataCount);
2643 for(i = 0; i < ti->MetadataCount; i++)
2644 {
2645 _iprintf(" Metadata[%u] -> %u\n", i, ti->Metadata[i]);
2646 }
2647 }
2648 }
2649
2650 void
outputABC_INSTANCE_INFO(struct ABC_FILE * abc,struct ABC_INSTANCE_INFO * ii)2651 outputABC_INSTANCE_INFO(struct ABC_FILE *abc, struct ABC_INSTANCE_INFO *ii)
2652 {
2653 unsigned int i;
2654
2655 _iprintf(" Name: ");
2656 outputStringConstant(abc, ii->Name);
2657 _iprintf(" SuperName: ");
2658 outputStringConstant(abc, ii->SuperName);
2659 _iprintf(" Flags %x\n", ii->Flags);
2660
2661 if(ii->Flags & ABC_CLASS_PROTECTED_NS)
2662 {
2663 _iprintf(" Protected NS ");
2664 outputNamespaceConstant(abc, ii->ProtectedNs);
2665 }
2666
2667 _iprintf(" Interfaces: (%u)\n", ii->InterfaceCount);
2668 for(i = 0; i < ii->InterfaceCount; i++)
2669 {
2670 _iprintf(" Interface (%u)", i);
2671 outputMultinameConstant(abc, ii->Interfaces[i]);
2672 }
2673 _iprintf(" Init Method #%u\n", ii->IInit);
2674
2675 _iprintf(" Traits (%u):\n", ii->TraitCount);
2676 for(i = 0; i < ii->TraitCount; i++)
2677 {
2678 _iprintf(" Trait %u:\n", i);
2679 outputABC_TRAITS_INFO(abc, ii->Traits + i);
2680 }
2681 }
2682
2683 void
outputABC_CLASS_INFO(struct ABC_FILE * abc,struct ABC_CLASS_INFO * ci)2684 outputABC_CLASS_INFO(struct ABC_FILE *abc, struct ABC_CLASS_INFO *ci)
2685 {
2686 unsigned int i;
2687
2688 _iprintf(" Init Method #%u\n", ci->CInit);
2689
2690 _iprintf(" Traits (%u):\n", ci->TraitCount);
2691 for(i = 0; i < ci->TraitCount; i++)
2692 {
2693 _iprintf(" Trait %u:\n", i);
2694 outputABC_TRAITS_INFO(abc, ci->Traits + i);
2695 }
2696 }
2697
2698 void
outputABC_SCRIPT_INFO(struct ABC_FILE * abc,struct ABC_SCRIPT_INFO * si)2699 outputABC_SCRIPT_INFO(struct ABC_FILE *abc, struct ABC_SCRIPT_INFO *si)
2700 {
2701 unsigned int i;
2702
2703 _iprintf(" Init Method #%u\n", si->Init);
2704
2705 _iprintf(" Traits (%u):\n", si->TraitCount);
2706 for(i = 0; i < si->TraitCount; i++)
2707 {
2708 _iprintf(" Trait %u:\n", i);
2709 outputABC_TRAITS_INFO(abc, si->Traits + i);
2710 }
2711 }
2712
2713 void
outputABC_EXCEPTION_INFO(struct ABC_FILE * abc,struct ABC_EXCEPTION_INFO * ei)2714 outputABC_EXCEPTION_INFO(struct ABC_FILE *abc, struct ABC_EXCEPTION_INFO *ei)
2715 {
2716 _iprintf(" From: %u\n", ei->From);
2717 _iprintf(" To: %u\n", ei->To);
2718 _iprintf(" Target: %u\n", ei->Target);
2719 _iprintf(" ExcType: ");
2720 outputStringConstant(abc, ei->ExcType);
2721 _iprintf(" VarName: ");
2722 outputStringConstant(abc, ei->VarName);
2723 }
2724
2725 void
outputABC_METHOD_BODY_INFO(struct ABC_FILE * abc,struct ABC_METHOD_BODY_INFO * mb)2726 outputABC_METHOD_BODY_INFO(struct ABC_FILE *abc, struct ABC_METHOD_BODY_INFO *mb)
2727 {
2728 unsigned int i;
2729
2730 _iprintf(" Method Index -> %u\n", mb->Method);
2731 _iprintf(" Max Stack %u\n", mb->MaxStack);
2732 _iprintf(" LocalCount %u\n", mb->LocalCount);
2733 _iprintf(" InitScopeDepth %u\n", mb->InitScopeDepth);
2734 _iprintf(" MaxScopeDepth %u\n", mb->CodeLength);
2735 _iprintf(" CodeLength %u\n", mb->CodeLength);
2736
2737 _iprintf(" ExceptionCount %u\n", mb->ExceptionCount);
2738 for(i = 0; i < mb->ExceptionCount; i++)
2739 {
2740 _iprintf(" Exception [%u]: \n", i);
2741 outputABC_EXCEPTION_INFO(abc, mb->Exceptions + i);
2742 }
2743
2744 _iprintf(" Traits (%u):\n", mb->TraitCount);
2745 for(i = 0; i < mb->TraitCount; i++)
2746 {
2747 _iprintf(" Trait [%u]:\n", i);
2748 outputABC_TRAITS_INFO(abc, mb->Traits + i);
2749 }
2750 }
2751
outputABC_FILE(struct ABC_FILE * abc)2752 void outputABC_FILE(struct ABC_FILE *abc)
2753 {
2754 unsigned int i;
2755
2756 _iprintf(" Version %i.%i\n", abc->Major, abc->Minor);
2757 outputABC_CONSTANT_POOL(&abc->ConstantPool);
2758
2759 _iprintf(" MethodCount %u\n", abc->MethodCount);
2760 for(i = 0; i < abc->MethodCount; i++)
2761 {
2762 _iprintf(" Method Info[%u]:\n", i);
2763 outputABC_METHOD_INFO(abc, abc->Methods + i);
2764 _iprintf(" ### Method done ###\n\n");
2765 }
2766 _iprintf(" ### Method Info done ###\n\n");
2767
2768 _iprintf(" MetadataCount %u\n", abc->MetadataCount);
2769 for(i = 0; i < abc->MetadataCount; i++)
2770 {
2771 _iprintf(" Metadata [%u]:\n", i);
2772 outputABC_METADATA_INFO(abc, abc->Metadata + i);
2773 _iprintf(" ### Metadata done ###\n\n");
2774 }
2775 _iprintf(" ### Metadata Info done ###\n\n");
2776
2777 _iprintf(" InstanceCount %u\n", abc->ClassCount);
2778 for(i = 0; i < abc->ClassCount; i++)
2779 {
2780 _iprintf(" Instance [%u]:\n", i);
2781 outputABC_INSTANCE_INFO(abc, abc->Instances + i);
2782 _iprintf(" ### Instance done ###\n\n");
2783 }
2784 _iprintf(" ### Instances Info done ###\n\n");
2785
2786 _iprintf(" ClassCount %u\n", abc->ClassCount);
2787 for(i = 0; i < abc->ClassCount; i++)
2788 {
2789 _iprintf(" Class [%u]:\n", i);
2790 outputABC_CLASS_INFO(abc, abc->Classes + i);
2791 _iprintf(" ### Class done ###\n\n");
2792 }
2793 _iprintf(" ### Class Info done ###\n\n");
2794
2795 _iprintf(" ScriptCount %u\n", abc->ScriptCount);
2796 for(i = 0; i < abc->ScriptCount; i++)
2797 {
2798 _iprintf(" Script [%u]:\n", i);
2799 outputABC_SCRIPT_INFO(abc, abc->Scripts + i);
2800 _iprintf(" ### Script done ###\n\n");
2801 }
2802 _iprintf(" ### Script Info done ###\n\n");
2803
2804 _iprintf(" MethodBodyCount %u\n", abc->MethodBodyCount);
2805 for(i = 0; i < abc->MethodBodyCount; i++)
2806 {
2807 _iprintf(" Method Body [%u]:\n", i);
2808 outputABC_METHOD_BODY_INFO(abc, abc->MethodBodies + i);
2809 _iprintf(" ### Method Body done ###\n\n");
2810 }
2811 _iprintf(" ### Method Body Info done ###\n\n");
2812 }
2813
2814 void
outputSWF_DOABC(SWF_Parserstruct * pblock)2815 outputSWF_DOABC(SWF_Parserstruct *pblock)
2816 {
2817 OUT_BEGIN (SWF_DOABC);
2818 _iprintf(" ActionFlags: %x\n", sblock->Flags);
2819 _iprintf(" Name %s\n", sblock->Name);
2820 outputABC_FILE(&sblock->AbcFile);
2821 }
2822
2823 void
outputSWF_SYMBOLCLASS(SWF_Parserstruct * pblock)2824 outputSWF_SYMBOLCLASS(SWF_Parserstruct *pblock)
2825 {
2826 int count, i;
2827 OUT_BEGIN(SWF_SYMBOLCLASS);
2828 count = sblock->SymbolCount;
2829 _iprintf("SymbolCount %i\n", count);
2830 for(i = 0; i < count; i++)
2831 {
2832 _iprintf(" Id: %i, Name: %s\n",
2833 sblock->SymbolList[i].SymbolId, sblock->SymbolList[i].SymbolName);
2834 }
2835 }
2836
2837 void
outputSWF_DEFINESCENEANDFRAMEDATA(SWF_Parserstruct * pblock)2838 outputSWF_DEFINESCENEANDFRAMEDATA(SWF_Parserstruct *pblock)
2839 {
2840 int i;
2841 OUT_BEGIN(SWF_DEFINESCENEANDFRAMEDATA);
2842 _iprintf(" SceneCount: %d\n", sblock->SceneCount);
2843 for(i = 0; i < sblock->SceneCount; i++)
2844 _iprintf(" Scene #%d: Offset: %d, Name: %s\n",
2845 i, sblock->Scenes[i].Offset, sblock->Scenes[i].Name);
2846
2847 _iprintf(" FrameLabelCount: %d\n", sblock->FrameLabelCount);
2848 for(i = 0; i < sblock->FrameLabelCount; i++)
2849 _iprintf(" FrameLabel #%d: Frame: %d, Name: %s\n",
2850 i, sblock->Frames[i].FrameNum, sblock->Frames[i].FrameLabel);
2851 }
2852
2853 void
outputSWF_DEBUGID(SWF_Parserstruct * pblock)2854 outputSWF_DEBUGID(SWF_Parserstruct *pblock)
2855 {
2856 int i;
2857 OUT_BEGIN(SWF_DEBUGID);
2858 _iprintf(" UUID: ");
2859 for(i = 0; i < pblock->length; i++)
2860 _iprintf("%x ", sblock->UUID[i]);
2861 _iprintf("\n");
2862 }
2863
2864 void
outputSWF_UNKNOWNBLOCK(SWF_Parserstruct * pblock)2865 outputSWF_UNKNOWNBLOCK(SWF_Parserstruct *pblock)
2866 {
2867 OUT_BEGIN(SWF_UNKNOWNBLOCK);
2868 if(sblock->Data == NULL)
2869 return;
2870 dumpBuffer(sblock->Data, pblock->length);
2871 }
2872
2873
2874 void
printRect(struct Rect * r)2875 printRect(struct Rect *r)
2876 {
2877 _iprintf("(%i,%i)x(%i,%i)", r->xMin, r->xMax, r->yMin, r->yMax);
2878 }
2879
2880 void
outputHeader(struct Movie * m)2881 outputHeader (struct Movie *m)
2882 {
2883
2884 setNewLineString("\n");
2885
2886 _iprintf("File version: %i\n", m->version);
2887 _iprintf("File size: %i\n", m->size);
2888
2889 _iprintf("Frame size: ");
2890 printRect(&(m->frame));
2891 putchar('\n');
2892
2893 _iprintf("Frame rate: %f / sec.\n", m->rate);
2894 _iprintf("Total frames: %i\n", m->nFrames);
2895 }
2896
2897 void
outputTrailer(struct Movie * m)2898 outputTrailer (struct Movie *m)
2899 {
2900 }
2901
2902 void
outputBlock(int type,SWF_Parserstruct * blockp,FILE * stream)2903 outputBlock (int type, SWF_Parserstruct * blockp, FILE* stream)
2904 {
2905 int i;
2906
2907 if(blockp == NULL)
2908 return;
2909
2910 int offset = blockp->offset;
2911 int length = blockp->length;
2912
2913 if (type < 0)
2914 return;
2915
2916 #if defined(ACTIONONLY)
2917 if( type != SWF_DOACTION &&
2918 type != SWF_INITACTION &&
2919 type != SWF_DEFINEBUTTON2 &&
2920 type != SWF_PLACEOBJECT2 ) return;
2921 #endif
2922
2923 putchar('\n');
2924 _iprintf( "Offset: %d (0x%4.4x)\n", offset, offset );
2925 _iprintf( "Block type: %d (%s)\n", type, blockName(type) );
2926 _iprintf( "Block length: %d\n", length );
2927 putchar('\n');
2928
2929 for (i = 0; i < numOutputs; i++)
2930 {
2931 if (outputs[i].type == type)
2932 {
2933 outputs[i].output (blockp);
2934 return;
2935 }
2936 }
2937 SWF_error("printing type: %d (%s) is not implemented", type, blockName(type));
2938 return;
2939 }
2940