char* extractfontids = 0;
char* extractpngids = 0;
char* extractsoundids = 0;
+char* extractbinaryids = 0;
char extractmp3 = 0;
char* extractname = 0;
{"f","frame"},
{"F","font"},
{"V","version"},
+ {"b","binary"},
{0,0}
};
extractsoundids = val;
return 1;
}
+ else if(!strcmp(name, "b")) {
+ if(extractbinaryids) {
+ fprintf(stderr, "Only one --binary argument is allowed. (Try to use a range, e.g. -s 1,2,3)\n");
+ exit(1);
+ }
+ numextracts++;
+ extractbinaryids = val;
+ return 1;
+ }
#ifdef _ZLIB_INCLUDED_
else if(!strcmp(name, "p")) {
if(extractpngids) {
if(t == 5 && (tag->id == ST_DEFINEFONT || tag->id == ST_DEFINEFONT2 || tag->id == ST_DEFINEFONT3)) {
show = 1;
}
+ if (t== 6 && (tag->id == ST_DEFINEBINARY)) {
+ show = 1;
+ }
return show;
}
char first;
int t;
int frame = 0;
- char*names[] = {"Shape", "MovieClip", "JPEG", "PNG", "Sound", "Font"};
- char*options[] = {"-i", "-i", "-j", "-p", "-s", "-F"};
+ char*names[] = {"Shape", "MovieClip", "JPEG", "PNG", "Sound", "Font", "Binary"};
+ char*options[] = {"-i", "-i", "-j", "-p", "-s", "-F","-b"};
int mp3=0;
printf("Objects in file %s:\n",filename);
swf_FoldAll(swf);
fclose(fi);
}
+void handlebinary(TAG*tag) {
+ FILE *fout = NULL;
+ char buf[100];
+ char *filename = buf;
+ int len = tag->memsize;
+ int dx = 6; // offset to binary data
+ if (tag->id!=ST_DEFINEBINARY) {
+ fprintf(stderr, "Object %d is not a binary entity!\n",
+ GET16(tag->data));
+ return;
+ }
+ sprintf(buf, "binary%d.bin", GET16(tag->data));
+ if(numextracts==1) {
+ filename = destfilename;
+ if(!strcmp(filename,"output.swf")) {
+ sprintf(buf, "output.bin");
+ filename = buf;
+ }
+ }
+ fout = fopen(filename, "wb");
+ fwrite(tag->data+dx,len-dx,1,fout);
+ fclose(fout);
+}
+
int main (int argc,char ** argv)
{
TAG*tag;
processargs(argc, argv);
if(!extractframes && !extractids && ! extractname && !extractjpegids && !extractpngids
- && !extractmp3 && !extractsoundids && !extractfontids)
+ && !extractmp3 && !extractsoundids && !extractfontids && !extractbinaryids)
listavailable = 1;
if(!originalplaceobjects && movetozero) {
if(extractsoundids && is_in_range(id, extractsoundids)) {
handledefinesound(tag);
}
+ if(extractbinaryids && is_in_range(id, extractbinaryids)) {
+ handlebinary(tag);
+ }
#ifdef _ZLIB_INCLUDED_
if(extractpngids && is_in_range(id, extractpngids)) {
handlelossless(tag);