diff --git a/trunk/src/com/jpexs/decompiler/flash/BinarySWFBundle.java b/trunk/src/com/jpexs/decompiler/flash/BinarySWFBundle.java index 2ea2d85d3..87d5693d6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/BinarySWFBundle.java +++ b/trunk/src/com/jpexs/decompiler/flash/BinarySWFBundle.java @@ -33,8 +33,8 @@ public class BinarySWFBundle implements SWFBundle { private final SWFSearch search; - public BinarySWFBundle(InputStream is) { - search = new SWFSearch(new StreamSearch(is)); + public BinarySWFBundle(InputStream is, boolean noCheck) { + search = new SWFSearch(new StreamSearch(is), noCheck); search.process(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 4db780229..96da9fe18 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -335,7 +335,7 @@ public final class SWF implements TreeItem { * @throws java.lang.InterruptedException */ public SWF(InputStream is, ProgressListener listener, boolean parallelRead) throws IOException, InterruptedException { - this(is, listener, parallelRead, false); + this(is, listener, parallelRead, false, false); } /** @@ -348,7 +348,7 @@ public final class SWF implements TreeItem { * @throws IOException * @throws java.lang.InterruptedException */ - public SWF(InputStream is, ProgressListener listener, boolean parallelRead, boolean checkOnly) throws IOException, InterruptedException { + public SWF(InputStream is, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean skipTagReading) throws IOException, InterruptedException { byte[] hdr = new byte[3]; is.read(hdr); String shdr = new String(hdr, Utf8Helper.charset); @@ -411,8 +411,8 @@ public final class SWF implements TreeItem { sis.readUI8(); //tmpFirstByetOfFrameRate frameRate = sis.readUI8(); frameCount = sis.readUI16(); - if (checkOnly) { - //return; + if (skipTagReading) { + return; } tags = sis.readTagList(this, 0, parallelRead, true, !checkOnly, gfx); if (!checkOnly) { diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java b/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java index 6f36cbccf..e4c0e671f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java @@ -34,12 +34,14 @@ import java.util.Set; public class SWFSearch { protected Searchable s; + private boolean noCheck; private boolean processed = false; private final Set listeners = new HashSet<>(); private final Map swfStreams = new HashMap<>(); - public SWFSearch(Searchable s) { + public SWFSearch(Searchable s, boolean noCheck) { this.s = s; + this.noCheck = noCheck; } public void addProgressListener(ProgressListener l) { @@ -77,7 +79,7 @@ public class SWFSearch { MemoryInputStream mis = (MemoryInputStream) ret.get(addr); mis.reset(); PosMarkedInputStream pmi = new PosMarkedInputStream(mis); - SWF swf = new SWF(pmi, null, false, true); + SWF swf = new SWF(pmi, null, false, true, noCheck); long limit = pmi.getPos(); MemoryInputStream is = new MemoryInputStream(mis.getAllRead(), (int) (long) addr, (int) limit); if (swf.fileSize > 0 && swf.version > 0 && !swf.tags.isEmpty() && swf.version < 25/*Needs to be fixed when SWF versions reaches this value*/) { diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFSourceInfo.java b/trunk/src/com/jpexs/decompiler/flash/SWFSourceInfo.java index 85739c0de..3c03a0dca 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFSourceInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFSourceInfo.java @@ -76,7 +76,7 @@ public class SWFSourceInfo { return false; } - public SWFBundle getBundle() throws IOException { + public SWFBundle getBundle(boolean noCheck) throws IOException { if (!isBundle()) { return null; } @@ -89,7 +89,7 @@ public class SWFSourceInfo { case ".zip": return new ZippedSWFBundle(is); default: - return new BinarySWFBundle(is); + return new BinarySWFBundle(is, noCheck); } } } diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 345240f89..5aaf1c78e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -122,7 +122,7 @@ public class CommandLineArgumentParser { System.out.println(" ...Compress SWF and save it to "); System.out.println(" 8) -decompress "); System.out.println(" ...Decompress and save it to "); - System.out.println(" 9) -extract [(all|biggest)]"); + System.out.println(" 9) -extract [nocheck] [(all|biggest)]"); System.out.println(" ...Extracts SWF files from ZIP or other binary files"); System.out.println(" 10) -renameInvalidIdentifiers (typeNumber|randomWord) e"); System.out.println(" ...Renames the invalid identifiers in and save it to "); @@ -755,6 +755,15 @@ public class CommandLineArgumentParser { String fileName = args.remove(); ExtractMode mode = ExtractMode.ALL; + + boolean noCheck = false; + if (args.size() > 0) { + if (args.peek().toLowerCase().equals("nocheck")) { + noCheck = true; + args.remove(); + } + } + if (args.size() > 0) { String modeStr = args.remove().toLowerCase(); switch (modeStr) { @@ -770,7 +779,7 @@ public class CommandLineArgumentParser { System.err.println("Error: should be a bundle. (ZIP or non SWF binary file)"); System.exit(1); } - SWFBundle bundle = sourceInfo.getBundle(); + SWFBundle bundle = sourceInfo.getBundle(noCheck); List> streamsToExtract = new ArrayList<>(); Map.Entry biggest = null; int biggestSize = 0; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java index 1db9cc0b5..14bc73dbf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java @@ -136,7 +136,7 @@ public class LoadFromMemoryFrame extends AppFrame implements ActionListener { try { PosMarkedInputStream pmi = new PosMarkedInputStream(ret.get(addr)); ReReadableInputStream is = new ReReadableInputStream(pmi); - SWF swf = new SWF(is, null, false, true); + SWF swf = new SWF(is, null, false, true, false); long limit = pmi.getPos(); is.seek(0); is = new ReReadableInputStream(new LimitedInputStream(is, limit)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 3e42a9c23..4aeb2706c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -230,7 +230,7 @@ public class Main { SWFBundle bundle = null; if (inputStream == null) { inputStream = new BufferedInputStream(new FileInputStream(sourceInfo.getFile())); - bundle = sourceInfo.getBundle(); + bundle = sourceInfo.getBundle(false); logger.log(Level.INFO, "Load file: {0}", sourceInfo.getFile()); } else if (inputStream instanceof SeekableInputStream || inputStream instanceof BufferedInputStream) {