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);
|
s = s.substring(1);
|
||||||
}
|
}
|
||||||
if (s.startsWith("L"))
|
if (s.startsWith("L") && s.endsWith(";"))
|
||||||
{
|
{
|
||||||
return s.substring(1, s.length() - 1);
|
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.Method;
|
||||||
import net.runelite.asm.signature.util.VirtualMethods;
|
import net.runelite.asm.signature.util.VirtualMethods;
|
||||||
import net.runelite.deob.Deob;
|
import net.runelite.deob.Deob;
|
||||||
|
import net.runelite.deob.DeobAnnotations;
|
||||||
import net.runelite.deob.Deobfuscator;
|
import net.runelite.deob.Deobfuscator;
|
||||||
import net.runelite.deob.util.NameMappings;
|
import net.runelite.deob.util.NameMappings;
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ public class RenameUnique implements Deobfuscator
|
|||||||
for (ClassFile cf : group.getClasses())
|
for (ClassFile cf : group.getClasses())
|
||||||
for (Field field : cf.getFields())
|
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;
|
continue;
|
||||||
|
|
||||||
map.map(field.getPoolField(), "field" + i++);
|
map.map(field.getPoolField(), "field" + i++);
|
||||||
@@ -74,7 +75,7 @@ public class RenameUnique implements Deobfuscator
|
|||||||
for (ClassFile cf : group.getClasses())
|
for (ClassFile cf : group.getClasses())
|
||||||
for (Method method : cf.getMethods())
|
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;
|
continue;
|
||||||
|
|
||||||
List<Method> virtualMethods = VirtualMethods.getVirtualMethods(method);
|
List<Method> virtualMethods = VirtualMethods.getVirtualMethods(method);
|
||||||
|
|||||||
@@ -216,6 +216,8 @@ public class Renamer implements Deobfuscator
|
|||||||
field.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_NAME, "value", field.getName());
|
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);
|
field.setName(newName);
|
||||||
++fields;
|
++fields;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user