Fix some deob/asm bugs
Check if last char is ; as well, so (e.g.) Login doesn't end up as ogi Check if name is the same as exported already for renamer
This commit is contained in:
@@ -110,7 +110,7 @@ public class Type
|
||||
{
|
||||
s = s.substring(1);
|
||||
}
|
||||
if (s.startsWith("L"))
|
||||
if (s.startsWith("L") && s.endsWith(";"))
|
||||
{
|
||||
return s.substring(1, s.length() - 1);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.runelite.asm.Field;
|
||||
import net.runelite.asm.Method;
|
||||
import net.runelite.asm.signature.util.VirtualMethods;
|
||||
import net.runelite.deob.Deob;
|
||||
import net.runelite.deob.DeobAnnotations;
|
||||
import net.runelite.deob.Deobfuscator;
|
||||
import net.runelite.deob.util.NameMappings;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class RenameUnique implements Deobfuscator
|
||||
for (ClassFile cf : group.getClasses())
|
||||
for (Field field : cf.getFields())
|
||||
{
|
||||
if (field.getName().length() > Deob.OBFUSCATED_NAME_MAX_LEN)
|
||||
if (field.getName().length() > Deob.OBFUSCATED_NAME_MAX_LEN && !field.getName().startsWith("__") || field.getName().equals(DeobAnnotations.getExportedName(field.getAnnotations())))
|
||||
continue;
|
||||
|
||||
map.map(field.getPoolField(), "field" + i++);
|
||||
@@ -74,7 +75,7 @@ public class RenameUnique implements Deobfuscator
|
||||
for (ClassFile cf : group.getClasses())
|
||||
for (Method method : cf.getMethods())
|
||||
{
|
||||
if (method.getName().length() > Deob.OBFUSCATED_NAME_MAX_LEN)
|
||||
if (method.getName().length() > Deob.OBFUSCATED_NAME_MAX_LEN && !method.getName().startsWith("__") || method.getName().equals(DeobAnnotations.getExportedName(method.getAnnotations())))
|
||||
continue;
|
||||
|
||||
List<Method> virtualMethods = VirtualMethods.getVirtualMethods(method);
|
||||
|
||||
@@ -216,6 +216,8 @@ public class Renamer implements Deobfuscator
|
||||
field.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_NAME, "value", field.getName());
|
||||
}
|
||||
|
||||
assert DeobAnnotations.getExportedName(field.getAnnotations()) == null || DeobAnnotations.getExportedName(field.getAnnotations()).equals(newName) : "Tried changing field name to something other than the exported name!";
|
||||
|
||||
field.setName(newName);
|
||||
++fields;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user