mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Added better frame support
This commit is contained in:
1 parent
6e1a0a26b3
commit
0cb4461cc2
3 files changed
+74
-6
No files matched your search
@@ -581,7 +581,14 @@ public class Assembler {
|
||||
} else {
|
||||
for (String asd : l.split(", ")) {
|
||||
if (!asd.startsWith("(")) {
|
||||
arr.add(UnicodeUtils.unescape(asd));
|
||||
int frameType = ClassUtil.getFrameTypeByName(asd);
|
||||
if (frameType != -1)
|
||||
arr.add(new Integer(frameType));
|
||||
else {
|
||||
String frame = UnicodeUtils.unescape(asd);
|
||||
frame = frame.substring(1, frame.length() - 1);
|
||||
arr.add(frame);
|
||||
}
|
||||
} else {
|
||||
if (asd.startsWith("(label) ")) {
|
||||
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
||||
@@ -620,7 +627,14 @@ public class Assembler {
|
||||
} else {
|
||||
for (String asd : st.split(", ")) {
|
||||
if (!asd.startsWith("(")) {
|
||||
arr.add(UnicodeUtils.unescape(asd));
|
||||
int frameType = ClassUtil.getFrameTypeByName(asd);
|
||||
if (frameType != -1)
|
||||
arr.add(new Integer(frameType));
|
||||
else {
|
||||
String frame = UnicodeUtils.unescape(asd);
|
||||
frame = frame.substring(1, frame.length() - 1);
|
||||
arr.add(frame);
|
||||
}
|
||||
} else {
|
||||
if (asd.startsWith("(label) ")) {
|
||||
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
||||
|
||||
@@ -421,9 +421,15 @@ public class Disassembler {
|
||||
arr.add(null);
|
||||
} else {
|
||||
if (o instanceof String) {
|
||||
arr.add(UnicodeUtils.escapeWithSpaces((String) o));
|
||||
arr.add("L" + UnicodeUtils.escapeWithSpaces((String) o) + ";");
|
||||
} else if (o instanceof LabelNode) {
|
||||
arr.add("(label) " + labels.get(((LabelNode) o).getLabel()));
|
||||
} else if (o instanceof Integer) {
|
||||
String frameType = ClassUtil.getFrameTypeByID(((Integer) o).intValue());
|
||||
if (frameType != null)
|
||||
arr.add(frameType);
|
||||
else
|
||||
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
||||
} else {
|
||||
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
||||
}
|
||||
@@ -441,9 +447,15 @@ public class Disassembler {
|
||||
arr.add(null);
|
||||
} else {
|
||||
if (o instanceof String) {
|
||||
arr.add(UnicodeUtils.escapeWithSpaces((String) o));
|
||||
arr.add("L" + UnicodeUtils.escapeWithSpaces((String) o) + ";");
|
||||
} else if (o instanceof LabelNode) {
|
||||
arr.add("(label) " + labels.get(((LabelNode) o).getLabel()));
|
||||
} else if (o instanceof Integer) {
|
||||
String frameType = ClassUtil.getFrameTypeByID(((Integer) o).intValue());
|
||||
if (frameType != null)
|
||||
arr.add(frameType);
|
||||
else
|
||||
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
||||
} else {
|
||||
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
||||
}
|
||||
|
||||
@@ -184,6 +184,46 @@ public class ClassUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFrameTypeByID(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
return "top";
|
||||
case 1:
|
||||
return "int";
|
||||
case 2:
|
||||
return "float";
|
||||
case 3:
|
||||
return "double";
|
||||
case 4:
|
||||
return "long";
|
||||
case 5:
|
||||
return "null";
|
||||
case 6:
|
||||
return "uninitializedThis";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getFrameTypeByName(String type) {
|
||||
switch (type) {
|
||||
case "top":
|
||||
return 0;
|
||||
case "int":
|
||||
return 1;
|
||||
case "float":
|
||||
return 2;
|
||||
case "double":
|
||||
return 3;
|
||||
case "long":
|
||||
return 4;
|
||||
case "null":
|
||||
return 5;
|
||||
case "uninitializedThis":
|
||||
return 6;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static String getAccessFlagsClass(int access) {
|
||||
String s = "";
|
||||
if ((ACC_PUBLIC & access) != 0) {
|
||||
@@ -192,7 +232,8 @@ public class ClassUtil {
|
||||
if ((ACC_FINAL & access) != 0) {
|
||||
s += "final ";
|
||||
}
|
||||
if ((ACC_ABSTRACT & access) != 0 && (ACC_ANNOTATION & access) == 0 && (ACC_ENUM & access) == 0 && (ACC_INTERFACE & access) == 0) {
|
||||
if ((ACC_ABSTRACT & access) != 0 && (ACC_ANNOTATION & access) == 0 && (ACC_ENUM & access) == 0
|
||||
&& (ACC_INTERFACE & access) == 0) {
|
||||
s += "abstract ";
|
||||
}
|
||||
if ((ACC_SYNTHETIC & access) != 0) {
|
||||
@@ -484,7 +525,8 @@ public class ClassUtil {
|
||||
public static String getDecompiledValue(Object o, String desc, boolean escapeSpaces) {
|
||||
switch (o.getClass().getName()) {
|
||||
case "java.lang.String": {
|
||||
return "\"" + (escapeSpaces ? UnicodeUtils.escapeWithSpaces((String) o) : UnicodeUtils.escape((String) o)) + "\"";
|
||||
return "\"" + (escapeSpaces ? UnicodeUtils.escapeWithSpaces((String) o) : UnicodeUtils.escape((String) o))
|
||||
+ "\"";
|
||||
}
|
||||
case "java.lang.Integer": {
|
||||
if (desc.equals("Z")) {
|
||||
|
||||
Reference in new issue
Block a user