diff --git a/src/com/jpexs/decompiler/flash/SWFInputStream.java b/src/com/jpexs/decompiler/flash/SWFInputStream.java
index 2441d76ea..6e2d173cc 100644
--- a/src/com/jpexs/decompiler/flash/SWFInputStream.java
+++ b/src/com/jpexs/decompiler/flash/SWFInputStream.java
@@ -383,7 +383,7 @@ public class SWFInputStream implements AutoCloseable {
}
DumpInfo di = new DumpInfo(name, type, null, startByte, bitPos, 0, 0);
di.parent = dumpInfo;
- dumpInfo.childInfos.add(di);
+ dumpInfo.getChildInfos().add(di);
dumpInfo = di;
}
}
diff --git a/src/com/jpexs/decompiler/flash/SWFSearch.java b/src/com/jpexs/decompiler/flash/SWFSearch.java
index 9d3c32fa0..37db1180b 100644
--- a/src/com/jpexs/decompiler/flash/SWFSearch.java
+++ b/src/com/jpexs/decompiler/flash/SWFSearch.java
@@ -1,151 +1,152 @@
-/*
- * Copyright (C) 2014 JPEXS
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.jpexs.decompiler.flash;
-
-import com.jpexs.helpers.MemoryInputStream;
-import com.jpexs.helpers.PosMarkedInputStream;
-import com.jpexs.helpers.ProgressListener;
-import com.jpexs.helpers.Searchable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- *
- * @author JPEXS
- */
-public class SWFSearch {
-
- protected Searchable s;
- private final boolean noCheck;
- private final SearchMode searchMode;
- private boolean processed = false;
- private final Set listeners = new HashSet<>();
- private final Map swfStreams = new HashMap<>();
-
- public SWFSearch(Searchable s, boolean noCheck, SearchMode searchMode) {
- this.s = s;
- this.noCheck = noCheck;
- this.searchMode = searchMode;
- }
-
- public void addProgressListener(ProgressListener l) {
- listeners.add(l);
- }
-
- public void removeProgressListener(ProgressListener l) {
- listeners.remove(l);
- }
-
- private void setProgress(int p) {
- for (ProgressListener l : listeners) {
- l.progress(p);
- }
- }
-
- public void process() {
- Map ret = new HashMap<>();
- ret = s.search(new ProgressListener() {
- @Override
- public void progress(int p) {
- setProgress(p);
- }
- },
- "FWS".getBytes(), //Uncompressed Flash
- "CWS".getBytes(), //ZLib compressed Flash
- "ZWS".getBytes(), //LZMA compressed Flash
- "GFX".getBytes(), //Uncompressed ScaleForm GFx
- "CFX".getBytes()); //Compressed ScaleForm GFx
- int pos = 0;
- long biggestSize = 0;
- long smallestSize = Long.MAX_VALUE;
- addressLoop:
- for (Long addr : ret.keySet()) {
- setProgress(pos * 100 / ret.size());
- pos++;
- try {
- MemoryInputStream mis = (MemoryInputStream) ret.get(addr);
- mis.reset();
- PosMarkedInputStream pmi = new PosMarkedInputStream(mis);
- SWF swf = noCheck ? new SWF(pmi) : new SWF(pmi, null, false, true);
- boolean valid = swf.fileSize > 0
- && swf.version > 0
- && (!swf.tags.isEmpty() || noCheck)
- && swf.version < 25; // Needs to be fixed when SWF versions reaches this value
- if (valid) {
- long limit = pmi.getPos();
- MemoryInputStream is = new MemoryInputStream(mis.getAllRead(), (int) (long) addr, (int) limit);
- switch (searchMode) {
- case ALL:
- swfStreams.put(addr, is);
- break;
- case BIGGEST:
- if (limit > biggestSize) {
- biggestSize = limit;
- swfStreams.clear();
- swfStreams.put(addr, is);
- }
- break;
- case SMALLEST:
- if (limit < smallestSize) {
- smallestSize = limit;
- swfStreams.clear();
- swfStreams.put(addr, is);
- }
- break;
- case FIRST:
- swfStreams.put(addr, is);
- break addressLoop;
- case LAST:
- swfStreams.clear();
- swfStreams.put(addr, is);
- break;
- }
- }
- } catch (OutOfMemoryError ome) {
- System.gc();
- } catch (Exception | Error ex) {
- }
- }
- setProgress(100);
- processed = true;
- }
-
- public MemoryInputStream get(ProgressListener listener, long address) throws IOException {
- if (!processed) {
- return null;
- }
- if (!swfStreams.containsKey(address)) {
- return null;
- }
- return swfStreams.get(address);
- }
-
- public Set getAddresses() {
- return swfStreams.keySet();
- }
-
- public int length() {
- if (!processed) {
- return 0;
- }
- return swfStreams.size();
- }
-}
+/*
+ * Copyright (C) 2014 JPEXS
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.jpexs.decompiler.flash;
+
+import com.jpexs.helpers.Helper;
+import com.jpexs.helpers.MemoryInputStream;
+import com.jpexs.helpers.PosMarkedInputStream;
+import com.jpexs.helpers.ProgressListener;
+import com.jpexs.helpers.Searchable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class SWFSearch {
+
+ protected Searchable s;
+ private final boolean noCheck;
+ private final SearchMode searchMode;
+ private boolean processed = false;
+ private final Set listeners = new HashSet<>();
+ private final Map swfStreams = new HashMap<>();
+
+ public SWFSearch(Searchable s, boolean noCheck, SearchMode searchMode) {
+ this.s = s;
+ this.noCheck = noCheck;
+ this.searchMode = searchMode;
+ }
+
+ public void addProgressListener(ProgressListener l) {
+ listeners.add(l);
+ }
+
+ public void removeProgressListener(ProgressListener l) {
+ listeners.remove(l);
+ }
+
+ private void setProgress(int p) {
+ for (ProgressListener l : listeners) {
+ l.progress(p);
+ }
+ }
+
+ public void process() {
+ Map ret = new HashMap<>();
+ ret = s.search(new ProgressListener() {
+ @Override
+ public void progress(int p) {
+ setProgress(p);
+ }
+ },
+ "FWS".getBytes(), //Uncompressed Flash
+ "CWS".getBytes(), //ZLib compressed Flash
+ "ZWS".getBytes(), //LZMA compressed Flash
+ "GFX".getBytes(), //Uncompressed ScaleForm GFx
+ "CFX".getBytes()); //Compressed ScaleForm GFx
+ int pos = 0;
+ long biggestSize = 0;
+ long smallestSize = Long.MAX_VALUE;
+ addressLoop:
+ for (Long addr : ret.keySet()) {
+ setProgress(pos * 100 / ret.size());
+ pos++;
+ try {
+ MemoryInputStream mis = (MemoryInputStream) ret.get(addr);
+ mis.reset();
+ PosMarkedInputStream pmi = new PosMarkedInputStream(mis);
+ SWF swf = noCheck ? new SWF(pmi) : new SWF(pmi, null, false, true);
+ boolean valid = swf.fileSize > 0
+ && swf.version > 0
+ && (!swf.tags.isEmpty() || noCheck)
+ && swf.version < 25; // Needs to be fixed when SWF versions reaches this value
+ if (valid) {
+ long limit = pmi.getPos();
+ MemoryInputStream is = new MemoryInputStream(mis.getAllRead(), (int) (long) addr, (int) limit);
+ switch (searchMode) {
+ case ALL:
+ swfStreams.put(addr, is);
+ break;
+ case BIGGEST:
+ if (limit > biggestSize) {
+ biggestSize = limit;
+ swfStreams.clear();
+ swfStreams.put(addr, is);
+ }
+ break;
+ case SMALLEST:
+ if (limit < smallestSize) {
+ smallestSize = limit;
+ swfStreams.clear();
+ swfStreams.put(addr, is);
+ }
+ break;
+ case FIRST:
+ swfStreams.put(addr, is);
+ break addressLoop;
+ case LAST:
+ swfStreams.clear();
+ swfStreams.put(addr, is);
+ break;
+ }
+ }
+ } catch (OutOfMemoryError ome) {
+ Helper.freeMem();
+ } catch (Exception | Error ex) {
+ }
+ }
+ setProgress(100);
+ processed = true;
+ }
+
+ public MemoryInputStream get(ProgressListener listener, long address) throws IOException {
+ if (!processed) {
+ return null;
+ }
+ if (!swfStreams.containsKey(address)) {
+ return null;
+ }
+ return swfStreams.get(address);
+ }
+
+ public Set getAddresses() {
+ return swfStreams.keySet();
+ }
+
+ public int length() {
+ if (!processed) {
+ return 0;
+ }
+ return swfStreams.size();
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/action/Action.java b/src/com/jpexs/decompiler/flash/action/Action.java
index 2b733dafe..de1305fba 100644
--- a/src/com/jpexs/decompiler/flash/action/Action.java
+++ b/src/com/jpexs/decompiler/flash/action/Action.java
@@ -900,7 +900,7 @@ public class Action implements GraphSourceItem {
} catch (OutOfMemoryError | TranslateException | StackOverflowError ex2) {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error in: " + path, ex2);
if (ex2 instanceof OutOfMemoryError) {
- System.gc();
+ Helper.freeMem();
}
out = new ArrayList<>();
out.add(new CommentItem(new String[]{
diff --git a/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java b/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java
index 3313db2d2..a339fceb1 100644
--- a/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java
+++ b/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java
@@ -40,7 +40,7 @@ public class DumpInfo {
public DumpInfo parent;
- public List childInfos = new ArrayList<>();
+ private List childInfos;
public DumpInfo(String name, String type, Object value, long startByte, long lengthBytes) {
@@ -62,6 +62,13 @@ public class DumpInfo {
this.lengthBits = lengthBits;
}
+ public List getChildInfos() {
+ if (childInfos == null) {
+ childInfos = new ArrayList<>();
+ }
+ return childInfos;
+ }
+
@Override
public String toString() {
String value = previewValue == null ? "" : previewValue.toString();
diff --git a/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java b/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java
index 1db9cc0b5..bac8c0ba8 100644
--- a/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java
+++ b/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java
@@ -1,463 +1,463 @@
-/*
- * Copyright (C) 2010-2014 JPEXS
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.jpexs.decompiler.flash.gui;
-
-import com.jpexs.decompiler.flash.AppStrings;
-import com.jpexs.decompiler.flash.SWF;
-import com.jpexs.decompiler.flash.SWFSourceInfo;
-import com.jpexs.decompiler.flash.configuration.Configuration;
-import com.jpexs.helpers.Helper;
-import com.jpexs.helpers.LimitedInputStream;
-import com.jpexs.helpers.PosMarkedInputStream;
-import com.jpexs.helpers.ProgressListener;
-import com.jpexs.helpers.ReReadableInputStream;
-import com.jpexs.process.ProcessTools;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.FlowLayout;
-import java.awt.Image;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.swing.BoxLayout;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.DefaultListModel;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JProgressBar;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.JTable;
-import javax.swing.SwingWorker;
-import javax.swing.SwingWorker.StateValue;
-import javax.swing.filechooser.FileFilter;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableRowSorter;
-
-/**
- *
- * @author petrik
- */
-public class LoadFromMemoryFrame extends AppFrame implements ActionListener {
-
- static final String ACTION_SELECT_PROCESS = "SELECTPROCESS";
- static final String ACTION_REFRESH_PROCESS_LIST = "REFRESHPROCESSLIST";
- static final String ACTION_OPEN_SWF = "OPENSWF";
- static final String ACTION_SAVE = "SAVE";
-
- private MainFrame mainFrame;
- private List processlist;
- private List foundIs;
- private List selProcesses;
- private JList list;
- private DefaultListModel model;
- private DefaultTableModel resTableModel;
- private final JTable tableRes;
- private final JLabel stateLabel;
- private boolean processing = false;
- private final JProgressBar progress;
-
- private class SelectProcessWorker extends SwingWorker, Object> {
-
- private final List procs;
-
- public SelectProcessWorker(List procs) {
- this.procs = procs;
- }
-
- @Override
- protected void process(List