Easier Types

This commit is contained in:
SuspiciousActivity committed 2021-04-20 20:56:00 +02:00
1 parent 198c76823b
commit 74e9491fcf
2 files changed
+8 -43

No files matched your search

+5 -24
View File
@@ -771,14 +771,8 @@ public class Assembler {
String str = consolidateStrings(split, 1); String str = consolidateStrings(split, 1);
Object val; Object val;
try { try {
if (str.startsWith("Type: ")) { if (str.startsWith("Type ")) {
str = str.substring(8, str.length() - 2); val = Type.getType(UnicodeUtils.unescape(hsr, str.substring(6, str.length() - 1), true));
String[] split2 = str.split("\n\t");
String type = split2[0].substring(7);
// Reflection
val = new Type(ClassUtil.getIDFromClassNameForType(type),
UnicodeUtils.unescape(hsr, split2[3].substring(6, split2[3].length() - 1)),
Integer.parseInt(split2[1].substring(7)), Integer.parseInt(split2[2].substring(5)));
} else if (str.startsWith("\"") && str.endsWith("\"")) { } else if (str.startsWith("\"") && str.endsWith("\"")) {
val = UnicodeUtils.unescape(hsr, str.substring(1, str.length() - 1), true); val = UnicodeUtils.unescape(hsr, str.substring(1, str.length() - 1), true);
} else if (str.startsWith("#")) { } else if (str.startsWith("#")) {
@@ -1456,17 +1450,7 @@ public class Assembler {
for (int i = 10; i < sp.length - 1; i++) { for (int i = 10; i < sp.length - 1; i++) {
String st = sp[i].substring(1); String st = sp[i].substring(1);
if (st.equals("]")) { if (st.equals("]")) {
if (stage == 1) { if (stage == 2) {
try {
// Reflection
args.add(new Type(ClassUtil.getIDFromClassNameForType(vals.get(0).substring(6)),
UnicodeUtils.unescape(hsr, vals.get(3).substring(6, vals.get(3).length() - 1)),
Integer.parseInt(vals.get(1).substring(7)),
Integer.parseInt(vals.get(2).substring(5))));
} catch (Exception e) {
throw e;
}
} else if (stage == 2) {
args.add(new Handle(OpcodesReverse.getHandleOpcode(vals.get(4).substring(5)), args.add(new Handle(OpcodesReverse.getHandleOpcode(vals.get(4).substring(5)),
UnicodeUtils.unescape(hsr, vals.get(1).substring(7)), UnicodeUtils.unescape(hsr, vals.get(1).substring(7)),
UnicodeUtils.unescape(hsr, vals.get(0).substring(6)), UnicodeUtils.unescape(hsr, vals.get(0).substring(6)),
@@ -1475,11 +1459,8 @@ public class Assembler {
vals.clear(); vals.clear();
} }
stage = 0; stage = 0;
} else if (st.equals("Type: [")) { } else if (st.startsWith("Type ")) {
stage = 1; args.add(Type.getType(UnicodeUtils.unescape(hsr, st.substring(6, st.length() - 1), true)));
} else if (stage == 1) {
st = st.substring(1);
vals.add(st);
} else if (st.equals("Handle: [")) { } else if (st.equals("Handle: [")) {
vals.clear(); vals.clear();
stage = 2; stage = 2;
+3 -19
View File
@@ -409,15 +409,7 @@ public class Disassembler implements IDecompiler {
+ "\n\t\t\t]\n\t\t\targs: [\n"; + "\n\t\t\t]\n\t\t\targs: [\n";
for (Object l : node.bsmArgs) { for (Object l : node.bsmArgs) {
if (l instanceof Type) { if (l instanceof Type) {
Type type = (Type) l; s += "\t\t\t\tType " + ClassUtil.getDecompiledValue(((Type) l).getDescriptor(), "", hs) + "\n";
int valueBegin = type.valueBegin;
int valueEnd = type.valueEnd;
String buf = type.valueBuffer;
// Reflection
s += "\t\t\t\tType: [\n\t\t\t\t\ttype: " + ClassUtil.getClassNameFromType(type)
+ "\n\t\t\t\t\tstart: " + valueBegin + "\n\t\t\t\t\tend: " + valueEnd + "\n\t\t\t\t\tbuf: "
+ ClassUtil.getDecompiledValue(buf, "", hs);
s += "\n\t\t\t\t]\n";
} else if (l instanceof Handle) { } else if (l instanceof Handle) {
Handle h = (Handle) l; Handle h = (Handle) l;
s += "\t\t\t\tHandle: [\n\t\t\t\t\tname: " s += "\t\t\t\tHandle: [\n\t\t\t\t\tname: "
@@ -446,16 +438,8 @@ public class Disassembler implements IDecompiler {
case LDC_INSN: { case LDC_INSN: {
LdcInsnNode node = (LdcInsnNode) n; LdcInsnNode node = (LdcInsnNode) n;
if (node.cst instanceof Type) { if (node.cst instanceof Type) {
Type type = (Type) node.cst; return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " Type "
int valueBegin = type.valueBegin; + ClassUtil.getDecompiledValue(((Type) node.cst).getDescriptor(), "", hs) + "\n";
int valueEnd = type.valueEnd;
String buf = type.valueBuffer;
// Reflection
String s = "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " Type: [\n\t\t\ttype: "
+ ClassUtil.getClassNameFromType(type) + "\n\t\t\tstart: " + valueBegin + "\n\t\t\tend: "
+ valueEnd + "\n\t\t\tbuf: " + ClassUtil.getDecompiledValue(buf, "", hs);
s += "\n\t\t]\n";
return s;
} }
String decomp = ClassUtil.getDecompiledValue(node.cst, "", hs); String decomp = ClassUtil.getDecompiledValue(node.cst, "", hs);
if (node.cst instanceof String) { if (node.cst instanceof String) {