From 1f0f5fc65c1ee3b1010d0a586e58ad44eb545990 Mon Sep 17 00:00:00 2001 From: Ruin0x11 Date: Fri, 17 Jul 2020 13:25:37 -0700 Subject: [PATCH] Add -ren option to Fernflower decompiler --- src/the/bytecode/club/bytecodeviewer/Settings.java | 2 ++ .../club/bytecodeviewer/decompilers/FernFlowerDecompiler.java | 3 ++- src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/the/bytecode/club/bytecodeviewer/Settings.java b/src/the/bytecode/club/bytecodeviewer/Settings.java index 305d0da9..a0c6dfc1 100644 --- a/src/the/bytecode/club/bytecodeviewer/Settings.java +++ b/src/the/bytecode/club/bytecodeviewer/Settings.java @@ -233,6 +233,7 @@ public class Settings { DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forcePureAsciiAsText.isSelected()), false); DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.synchronizedViewing.isSelected()), false); DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.showClassMethods.isSelected()), false); + DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.ren.isSelected()), false); } catch (Exception e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); } @@ -449,6 +450,7 @@ public class Settings { BytecodeViewer.viewer.forcePureAsciiAsText.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 122, false))); BytecodeViewer.viewer.synchronizedViewing.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 123, false))); BytecodeViewer.viewer.showClassMethods.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 124, false))); + BytecodeViewer.viewer.ren.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 125, false))); } catch (Exception e) { //ignore because errors are expected, first start up and outdated settings. //e.printStackTrace(); diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java index 0e3423d1..7dfac2a7 100644 --- a/src/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/FernFlowerDecompiler.java @@ -161,7 +161,8 @@ public class FernFlowerDecompiler extends Decompiler { "-udv=" + r(BytecodeViewer.viewer.udv.isSelected()), "-rer=" + r(BytecodeViewer.viewer.rer.isSelected()), "-fdi=" + r(BytecodeViewer.viewer.fdi.isSelected()), - "-asc=" + r(BytecodeViewer.viewer.asc.isSelected()), className, + "-asc=" + r(BytecodeViewer.viewer.asc.isSelected()), + "-ren=" + r(BytecodeViewer.viewer.ren.isSelected()), className, folder}; } diff --git a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index fb97cbe1..0b908f91 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -93,6 +93,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier public JCheckBoxMenuItem rer = new JCheckBoxMenuItem("Remove empty exception ranges"); public JCheckBoxMenuItem fdi = new JCheckBoxMenuItem("Deinline finally structures"); public JCheckBoxMenuItem asc = new JCheckBoxMenuItem("Allow only ASCII characters in strings"); + public JCheckBoxMenuItem ren = new JCheckBoxMenuItem("Rename ambiguous classes and class elements"); public final JMenuItem mntmNewWorkspace = new JMenuItem("New Workspace"); public JMenu mnRecentFiles = new JMenu("Recent Files"); public final JMenuItem mntmNewMenuItem = new JMenuItem("Decompile & Save All Classes.."); @@ -2250,6 +2251,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier udv.setSelected(true); fdi.setSelected(true); asc.setSelected(false); + ren.setSelected(false); JMenu mnDecompilerSettings = new JMenu("FernFlower"); mnSettings.add(mnDecompilerSettings); @@ -2279,6 +2281,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier mnDecompilerSettings.add(udv); mnDecompilerSettings.add(fdi); mnDecompilerSettings.add(asc); + mnDecompilerSettings.add(ren); debugHelpers.setSelected(true); // other chckbxmntmAppendBrackets.setSelected(true);