Merged The Two ASMifier Disassemblers

This commit is contained in:
Konloch 2024-10-02 17:42:38 -06:00
parent 995c0ffede
commit aff69c295e

AI 샘플 코드 생성 중입니다

Loading...
2 changed files with 18 additions and 16 deletions

View File

@ -57,13 +57,16 @@ public class DecompilerViewComponent
private void createMenu() private void createMenu()
{ {
if (type == JAVA || type == JAVA_NON_EDITABLE || type == JAVA_AND_BYTECODE) if (type == JAVA || type == JAVA_NON_EDITABLE
|| type == JAVA_AND_BYTECODE || type == JAVA_AND_BYTECODE_NON_EDITABLE)
menu.add(java); menu.add(java);
if (type == BYTECODE || type == JAVA_AND_BYTECODE || type == BYTECODE_NON_EDITABLE) if (type == BYTECODE || type == BYTECODE_NON_EDITABLE
|| type == JAVA_AND_BYTECODE || type == JAVA_AND_BYTECODE_NON_EDITABLE)
menu.add(bytecode); menu.add(bytecode);
if (type != JAVA_NON_EDITABLE && type != BYTECODE_NON_EDITABLE) if (type != JAVA_NON_EDITABLE && type != BYTECODE_NON_EDITABLE
&& type != JAVA_AND_BYTECODE_NON_EDITABLE)
{ {
menu.add(new JSeparator()); menu.add(new JSeparator());
menu.add(editable); menu.add(editable);
@ -74,11 +77,8 @@ public class DecompilerViewComponent
public void addToGroup(ButtonGroup group) public void addToGroup(ButtonGroup group)
{ {
if (type == JAVA || type == JAVA_NON_EDITABLE || type == JAVA_AND_BYTECODE) group.add(java);
group.add(java); group.add(bytecode);
if (type == BYTECODE || type == JAVA_AND_BYTECODE || type == BYTECODE_NON_EDITABLE)
group.add(bytecode);
} }
public JMenu getMenu() public JMenu getMenu()
@ -117,6 +117,7 @@ public class DecompilerViewComponent
JAVA_NON_EDITABLE, JAVA_NON_EDITABLE,
BYTECODE, BYTECODE,
BYTECODE_NON_EDITABLE, BYTECODE_NON_EDITABLE,
JAVA_AND_BYTECODE; JAVA_AND_BYTECODE,
JAVA_AND_BYTECODE_NON_EDITABLE;
} }
} }

View File

@ -55,15 +55,16 @@ public class DecompilerSelectionPane
//disassemblers //disassemblers
private final DecompilerViewComponent bytecodeViewer = new DecompilerViewComponent("Bytecode", BYTECODE_NON_EDITABLE, Decompiler.BYTECODE_DISASSEMBLER); private final DecompilerViewComponent bytecodeViewer = new DecompilerViewComponent("Bytecode", BYTECODE_NON_EDITABLE, Decompiler.BYTECODE_DISASSEMBLER);
private final DecompilerViewComponent javapDisassembler = new DecompilerViewComponent("Javap", BYTECODE_NON_EDITABLE, Decompiler.JAVAP_DISASSEMBLER); private final DecompilerViewComponent javapDisassembler = new DecompilerViewComponent("Javap", BYTECODE_NON_EDITABLE, Decompiler.JAVAP_DISASSEMBLER);
private final DecompilerViewComponent asmDisassembler = new DecompilerViewComponent("ASM Disassembler", BYTECODE_NON_EDITABLE, Decompiler.ASM_DISASSEMBLER);
private final DecompilerViewComponent krakatauDecompiler = new DecompilerViewComponent("Krakatau", JAVA_AND_BYTECODE, Decompiler.KRAKATAU_DECOMPILER, Decompiler.KRAKATAU_DISASSEMBLER); private final DecompilerViewComponent krakatauDecompiler = new DecompilerViewComponent("Krakatau", JAVA_AND_BYTECODE, Decompiler.KRAKATAU_DECOMPILER, Decompiler.KRAKATAU_DISASSEMBLER);
private final DecompilerViewComponent smaliDisassembler = new DecompilerViewComponent("Smali", BYTECODE, Decompiler.SMALI_DISASSEMBLER); private final DecompilerViewComponent smaliDisassembler = new DecompilerViewComponent("Smali", BYTECODE, Decompiler.SMALI_DISASSEMBLER);
//code-gen //code-gen / etc
private final DecompilerViewComponent asmifierCodeGen = new DecompilerViewComponent("ASMifier", JAVA_NON_EDITABLE, Decompiler.ASMIFIER_CODE_GEN); private final DecompilerViewComponent asmifierCodeGen = new DecompilerViewComponent("ASMifier", JAVA_AND_BYTECODE_NON_EDITABLE, Decompiler.ASMIFIER_CODE_GEN, Decompiler.ASM_DISASSEMBLER);
//TODO when adding new decompilers insert the DecompilerViewComponent object into here //TODO when adding new decompilers insert the DecompilerViewComponent object into here
// also in the group, then finally the build menu // also in the group, then finally the build menu
public List<DecompilerViewComponent> components = new ArrayList<>(Arrays.asList(procyonDecompiler, CFRDecompiler, JADXDecompiler, JDCoreDecompiler, fernFlowerDecompiler, krakatauDecompiler, smaliDisassembler, bytecodeViewer, asmDisassembler, asmifierCodeGen, javapDisassembler)); public List<DecompilerViewComponent> components = new ArrayList<>(Arrays.asList(
procyonDecompiler, CFRDecompiler, JADXDecompiler, JDCoreDecompiler, fernFlowerDecompiler,
krakatauDecompiler, smaliDisassembler, bytecodeViewer, asmifierCodeGen, javapDisassembler));
public DecompilerSelectionPane(int paneID) public DecompilerSelectionPane(int paneID)
{ {
@ -118,9 +119,9 @@ public class DecompilerSelectionPane
String cmd = decompiler.name(); String cmd = decompiler.name();
//TODO this is pretty janky and will break if a decompiler doesn't end with _DECOMPILER suffix //TODO this is pretty janky and will break if a decompiler doesn't end with _DECOMPILER suffix
if (cmd.endsWith("DECOMPILER")) if (cmd.endsWith("_DECOMPILER") || cmd.endsWith("_CODE_GEN"))
component.getJava().setActionCommand(cmd); component.getJava().setActionCommand(cmd);
else// if(cmd.endsWith("DISASSEMBLER")) else// if(cmd.endsWith("_DISASSEMBLER"))
component.getBytecode().setActionCommand(cmd); component.getBytecode().setActionCommand(cmd);
} }
} }
@ -161,7 +162,6 @@ public class DecompilerSelectionPane
menu.add(new JSeparator()); menu.add(new JSeparator());
menu.add(bytecodeViewer.getMenu()); menu.add(bytecodeViewer.getMenu());
menu.add(javapDisassembler.getMenu()); menu.add(javapDisassembler.getMenu());
menu.add(asmDisassembler.getMenu());
menu.add(asmifierCodeGen.getMenu()); menu.add(asmifierCodeGen.getMenu());
menu.add(new JSeparator()); menu.add(new JSeparator());
menu.add(hexcodeViewer); menu.add(hexcodeViewer);
@ -179,6 +179,7 @@ public class DecompilerSelectionPane
while (it.hasMoreElements()) while (it.hasMoreElements())
{ {
AbstractButton button = it.nextElement(); AbstractButton button = it.nextElement();
if (button.getActionCommand().equals(decompiler.name())) if (button.getActionCommand().equals(decompiler.name()))
{ {
group.setSelected(button.getModel(), true); group.setSelected(button.getModel(), true);