diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 21df89e4a..7c28f17ca 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -334,6 +334,7 @@ public final class MethodBody implements Cloneable { } else { logger.log(Level.SEVERE, "Decompilation error in: " + path, ex); } + convertException = ex; Throwable cause = ex.getCause(); if (ex instanceof ExecutionException && cause instanceof Exception) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java index ca67b478c..58e21b37d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java @@ -863,6 +863,7 @@ public abstract class Action implements GraphSourceItem { } else { logger.log(Level.SEVERE, "Decompilation error in: " + path, ex); } + convertException = ex; Throwable cause = ex.getCause(); if (ex instanceof ExecutionException && cause instanceof Exception) { @@ -1023,11 +1024,12 @@ public abstract class Action implements GraphSourceItem { } } out = ActionGraph.translateViaGraph(regNames, variables2, functions, actions.subList(adr2ip(actions, endAddr), adr2ip(actions, endAddr + size)), version, staticOperation, path + (cntName == null ? "" : "/" + cntName)); - } catch (OutOfMemoryError | TranslateException | StackOverflowError ex2) { - logger.log(Level.SEVERE, "Decompilation error in: " + path, ex2); - if (ex2 instanceof OutOfMemoryError) { + } catch (OutOfMemoryError | TranslateException | StackOverflowError ex) { + logger.log(Level.SEVERE, "Decompilation error in: " + path, ex); + if (ex instanceof OutOfMemoryError) { Helper.freeMem(); } + out = new ArrayList<>(); out.add(new CommentItem(new String[]{ "", @@ -1035,7 +1037,7 @@ public abstract class Action implements GraphSourceItem { " * " + AppResources.translate("decompilationError.obfuscated"), Helper.decompilationErrorAdd == null ? null : " * " + Helper.decompilationErrorAdd, " * " + AppResources.translate("decompilationError.errorType") + ": " - + ex2.getClass().getSimpleName(), + + ex.getClass().getSimpleName(), ""})); } outs.add(out); @@ -1065,7 +1067,7 @@ public abstract class Action implements GraphSourceItem { } /*ActionJump && ActionIf removed*/ - /*if ((action instanceof ActionEnumerate2) || (action instanceof ActionEnumerate)) { + /*if ((action instanceof ActionEnumerate2) || (action instanceof ActionEnumerate)) { loopStart = ip + 1; isForIn = true; ip += 4; diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java index 9264dec10..30de0fc0d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java @@ -1406,4 +1406,26 @@ public class Helper { lastIds.put(str, a); return str + "_" + a; } + + public static boolean is64BitJre() { + String prop = System.getProperty("sun.arch.data.model"); + return prop != null && prop.contains("64"); + + } + + public static boolean is64BitOs() { + String arch = System.getenv("PROCESSOR_ARCHITECTURE"); + String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432"); + + if (arch == null) { + return false; + } + + return arch.endsWith("64") + || wow64Arch != null && wow64Arch.endsWith("64"); + } + + public static void showOutOfMemoryWarning() { + + } } diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 7d4ca0dfa..053dd27cf 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -1006,6 +1006,8 @@ public class Main { } else { throw new IOException("Output is empty"); } + } else { + throw new IOException("Output not found"); } } @@ -2250,6 +2252,9 @@ public class Main { @Override public void uncaughtException(Thread t, Throwable e) { logger.log(Level.SEVERE, "Uncaught exception in thread: " + t.getName(), e); + if (e instanceof OutOfMemoryError || !Helper.is64BitJre() && Helper.is64BitOs()) { + View.showMessageDialog(null, AppStrings.translate("message.warning.outOfMemeory32BitJre"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE); + } } }); diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 84cf7206f..11291e169 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -28,7 +28,6 @@ import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools; import com.jpexs.decompiler.flash.gui.helpers.CheckResources; import com.jpexs.decompiler.flash.tags.ABCContainerTag; import com.jpexs.helpers.ByteArrayRange; -import com.jpexs.helpers.Cache; import com.jpexs.helpers.Helper; import com.jpexs.helpers.utf8.Utf8Helper; import com.sun.jna.Platform; @@ -559,16 +558,16 @@ public abstract class MainFrameMenu implements MenuBuilder { } /*protected void cacheOnDiskActionPerformed(ActionEvent evt) { - AbstractButton button = (AbstractButton) evt.getSource(); - boolean selected = button.isSelected(); + AbstractButton button = (AbstractButton) evt.getSource(); + boolean selected = button.isSelected(); - Configuration.cacheOnDisk.set(selected); - if (selected) { - Cache.setStorageType(Cache.STORAGE_FILES); - } else { - Cache.setStorageType(Cache.STORAGE_MEMORY); - } - }*/ + Configuration.cacheOnDisk.set(selected); + if (selected) { + Cache.setStorageType(Cache.STORAGE_FILES); + } else { + Cache.setStorageType(Cache.STORAGE_MEMORY); + } + }*/ protected void setLanguageActionPerformed(ActionEvent evt) { new SelectLanguageDialog().display(); } @@ -949,9 +948,9 @@ public abstract class MainFrameMenu implements MenuBuilder { }); /*setMenuChecked("/settings/cacheOnDisk", Configuration.cacheOnDisk.get()); - Configuration.cacheOnDisk.addListener(configListenerCacheOnDisk = (Boolean newValue) -> { - setMenuChecked("/settings/cacheOnDisk", newValue); - });*/ + Configuration.cacheOnDisk.addListener(configListenerCacheOnDisk = (Boolean newValue) -> { + setMenuChecked("/settings/cacheOnDisk", newValue); + });*/ setMenuChecked("/settings/gotoMainClassOnStartup", Configuration.gotoMainClassOnStartup.get()); Configuration.gotoMainClassOnStartup.addListener(configListenerGotoMainClassOnStartup = (Boolean newValue) -> { setMenuChecked("/settings/gotoMainClassOnStartup", newValue); @@ -1012,6 +1011,8 @@ public abstract class MainFrameMenu implements MenuBuilder { String architecture = System.getProperty("sun.arch.data.model"); Runtime runtime = Runtime.getRuntime(); String info = "Architecture: " + architecture + Helper.newLine + + "Jre 64bit: " + Helper.is64BitJre() + Helper.newLine + + "Os 64bit: " + Helper.is64BitOs() + Helper.newLine + "Max: " + (runtime.maxMemory() / 1024 / 1024) + "MB" + Helper.newLine + "Used: " + (runtime.totalMemory() / 1024 / 1024) + "MB" + Helper.newLine + "Free: " + (runtime.freeMemory() / 1024 / 1024) + "MB"; diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 1e407b88d..ffd9c5797 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -712,3 +712,4 @@ menu.settings.simplifyExpressions = Simplify expressions #after 8.0.1 menu.recentFiles.empty = Recent file list is empty +message.warning.outOfMemeory32BitJre = OutOfMemory error occured. You are running 32bit Java on 64bit system. Please use 64bit Java.