If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
List of issues
: The issue tracker is now writable again and logged users can download files too. But note that our support is very LIMITED.
#958 Remove and Replace character tag of items from CLI
Assigned to: honfika
Would it be possible to add these GUI functions to the command line? -Remove -Replace with other character tag Cheers Laforet
Assigned: → honfika
Implemented in the latest nightly build: 27) -replaceCharacter <infile> <outfile> <characterId1> <newCharacterId1> [<characterId2> <newCharacterId2>]... ...replaces a character tag with another chatacter tag from the same SWF 28) -remove <infile> <outfile> <tagNo1> [<tagNo2>]... ...removes a tag from the SWF 29) -removeCharacter[WithDependencies] <infile> <outfile> <characterId1> [<characterId2>]... ...removes a character tag from the SWF Could you please test them (with correct and wrong parameters, too)? Thanks.
I ran these commands with a file with the following content: 00000015: FileAttributes tagId= 69 0000001b: SetBackgroundColor tagId= 9 00000020: DefineSceneAndFrameLabelData tagId= 86 00000035: DoABC2 () tagId= 82 0000023b: SymbolClass tagId= 76 0000025b: ShowFrame tagId= 1 0000025d: JPEGTables tagId= 8 00000263: DefineBits (1) tagId= 6 00000e11: DefineBitsJPEG2 (5) tagId= 21 0000cac7: PlaceObject2 (2) Depth: 1 tagId= 26 0000cacf: ShowFrame tagId= 1 0000cad1: ShowFrame tagId= 1 0000cad3: RemoveObject2 Depth: 1 tagId= 28 0000cad7: ShowFrame tagId= 1 [Omitted] 0000cae1: ShowFrame tagId= 1 0000cae3: DefineBitsJPEG3 (3) tagId= 35 0001275f: DefineBitsJPEG2 (6) tagId= 21 00077015: DefineShape (4) tagId= 2 00077048: PlaceObject2 (4) Depth: 1 tagId= 26 00077050: ShowFrame tagId= 1 00077052: ShowFrame tagId= 1 00077054: RemoveObject2 Depth: 1 tagId= 28 00077058: ShowFrame tagId= 1 [Omitted] 00077062: ShowFrame tagId= 1 00077064: End tagId= 0 --replaceCharacter seems to work fine, thank you. --removecharacter: Mostly working with some minor issues >ffdec.bat -removecharacter test.swf out.swf 99 //Remove a character that does not exist CharacterID does not exist >ffdec.bat -removecharacter test.swf out.swf 1 //Remove DefineBits (1) Exception in thread "main" java.lang.NullPointerException at com.jpexs.decompiler.flash.SWF.removeTagFromTimeline(SWF.java:2774) at com.jpexs.decompiler.flash.SWF.removeTagInternal(SWF.java:2852) at com.jpexs.decompiler.flash.SWF.removeTag(SWF.java:2822) at com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseRem oveCharacter(CommandLineArgumentParser.java:2071) at com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseArg uments(CommandLineArgumentParser.java:511) at com.jpexs.decompiler.flash.gui.Main.main(Main.java:1179) >ffdec.bat -removeCharacterWithDependencies test.swf out.swf 1 //Remove DefineBits (1) with dependencies [Works okay, character removed] So it works if I explicitly use -removeCharacterWithDependencies but not -removeCharacter. There may be some hidden dependencies and a more specific error message would have helped me to figure this out sooner. I cannot reproduce the problem in the GUI as "Remove" in the menu seems to imply "Remove with dependencies" anyway. --remove: I am confused about this. What is <tagNO> referring to? >ffdec.bat -remove test.swf out.swf 1 Tag number does not exist. Last tag number is: 32 >ffdec.bat -remove test.swf out.swf 6 Tag number does not exist. Last tag number is: 32 >ffdec.bat -remove test.swf out.swf 32 Tag number does not exist. Last tag number is: 32 I am not sure how to interpret this. Could you please clarify? Cheers Laforet
Tag number is the number of the tag:) counting from 0 to the tag count-1, so: 00000015: FileAttributes 0 0000001b: SetBackgroundColor 1 00000020: DefineSceneAndFrameLabelData 2 ... 00077062: ShowFrame 23 00077064: End 24 There was a problem with the range check, i fixed it. Remove tag should be also fixed in the next nightly build which should be released in 5 minutes. (>= 718)
Ah I see it now, thanks for the explanation. So going for my earlier example 00000015: FileAttributes 0000001b: SetBackgroundColor 00000020: DefineSceneAndFrameLabelData 00000035: DoABC2 () 00000239: SymbolClass 00000258: ShowFrame 0000025a: JPEGTables 00000260: DefineBits (1) [omitted] DefineBits (1) should have tag number 7 right? I tested with nightly726 >ffdec.bat -remove test.swf out.swf 7 [Nothing happens] It did write an output file to out.swf but it is identical to the input. >ffdec.bat -remove test.swf out.swf 99 Tag number does not exist. Tag number should be between 0 and 76 >ffdec.bat -remove test.swf out.swf 76 [Nothing happens again] Could you please check and see if it is working on your end? This is not exactly a feature I requested but there might be utility to me in future.On a side note, -dumpswf does not tell you the tag number and I had to figure it out by counting the number of tags from the top. Is it possible to add that once the -remove switch is working? I can open a new issue on it if needed. -removeCharacter seems to work without explicitly declaring [WithDependencies] now, thank you.
Fixed in the latest nightly build. Tag number added to swf dump.
Tested nightly750 again, everything is working as it should. The tag numbering in -dumpSWF is a lovely addition and I will be using it to optimise my script. Thank you very much.