-
Notifications
You must be signed in to change notification settings - Fork 734
Library
Jindra Petřík edited this page Jan 3, 2021
·
6 revisions
FFDec has two main parts
- FFDec GUI (licensed as GNU/GPLv3)
- FFDec Library (licensed as GNU/LGPLv3)
This page has some information about the library so you can properly use it in your projects.
You can find sources of ffdec_lib under libsrc/ffdec_lib/. There is also compiled JAR version of library in releases section (see Library only (Java SE) - Zipped).
package com.jpexs.decompiler.flash.test;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SwfOpenException;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
import java.io.FileInputStream;
import java.io.IOException;
public class Test {
public static void main(String[] args) {
try ( FileInputStream fis = new FileInputStream("data/as3.swf")) { //open up a file
//Pass the InputStream to SWF constructor.
//Note: There are many variants of the constructor - Do not use single parameter version - is does not process whole SWF.
SWF swf = new SWF(fis, true);
//Get some SWF parameters
System.out.println("SWF version = " + swf.version);
System.out.println("FrameCount = " + swf.frameCount);
//Process all tags
for (Tag t : swf.getTags()) {
if (t instanceof CharacterIdTag) { //Print character id with the tag if it has any
System.out.println("Tag " + t.getTagName() + " (" + ((CharacterIdTag) t).getCharacterId() + ")");
} else {
System.out.println("Tag " + t.getTagName());
}
}
System.out.println("OK");
} catch (SwfOpenException ex) {
System.out.println("ERROR: Invalid SWF file");
} catch (IOException ex) {
System.out.println("ERROR: Error during SWF opening");
} catch (InterruptedException ex) {
System.out.println("ERROR: Parsing interrupted");
}
}
}-
SWF- Basic class for SWF manipulation -
SWFInputStream- Reading of SWF data -
SWFOuputStream- Writing of SWF data
-
ABC- AS3 bytecode structure -
ABCInputStream- Reading AS3 bytecode structure -
ABCOutputStream- Writing AS3 bytecode structure -
ScriptPack- important - for purposes of easily displaying of flashCC/alchemy long scripts, ABC scripts can be splitted into so calledscript packswhich is script index and list of trait indices. FFDec always displays a scriptpack, not a whole script.
-
AVM2Code- code handling
JPEXS Free Flash Decompiler Wiki