fix the rest of obfuscated names
All checks were successful
Publish to snapshot maven / build (push) Successful in 14s
All checks were successful
Publish to snapshot maven / build (push) Successful in 14s
This commit is contained in:
parent
c89e190c0b
commit
0c213ceff4
|
@ -1,11 +1,15 @@
|
||||||
package org.ecorous.esnesnon.nonsense_remapper.api;
|
package org.ecorous.esnesnon.nonsense_remapper.api;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.ecorous.esnesnon.nonsense_remapper.api.data.Parchment;
|
import org.ecorous.esnesnon.nonsense_remapper.api.data.Parchment;
|
||||||
import org.objectweb.asm.Label;
|
import org.objectweb.asm.Label;
|
||||||
import org.objectweb.asm.MethodVisitor;
|
import org.objectweb.asm.MethodVisitor;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.Type;
|
||||||
import org.objectweb.asm.commons.MethodRemapper;
|
import org.objectweb.asm.commons.MethodRemapper;
|
||||||
import org.objectweb.asm.commons.Remapper;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
|
|
||||||
|
@ -32,21 +36,10 @@ public class ParameterMethodRemapper extends MethodRemapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNewName(String descriptor, String signature) {
|
private String getNewName(String descriptor, String signature) {
|
||||||
String newName = switch (descriptor.charAt(0)) {
|
descriptor = remapper.mapDesc(descriptor);
|
||||||
case 'I' -> "i";
|
signature = remapper.mapSignature(signature, false);
|
||||||
case 'B' -> "b";
|
|
||||||
case 'C' -> "c";
|
String newName = convertDescriptor(descriptor);
|
||||||
case 'S' -> "s";
|
|
||||||
case 'D' -> "d";
|
|
||||||
case 'F' -> "f";
|
|
||||||
case 'J' -> "l";
|
|
||||||
case 'Z' -> "bl";
|
|
||||||
default -> {
|
|
||||||
String name = cleanType(descriptor);
|
|
||||||
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
|
|
||||||
yield name;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
String nameCopy = newName;
|
String nameCopy = newName;
|
||||||
|
@ -63,9 +56,29 @@ public class ParameterMethodRemapper extends MethodRemapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
usedLocalNames.add(newName);
|
usedLocalNames.add(newName);
|
||||||
|
System.out.println("new name for: "+descriptor+" "+signature+" "+newName);
|
||||||
return newName;
|
return newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String convertDescriptor(String descriptor){
|
||||||
|
return switch (descriptor.charAt(0)) {
|
||||||
|
case 'I' -> "i";
|
||||||
|
case 'B' -> "b";
|
||||||
|
case 'C' -> "c";
|
||||||
|
case 'S' -> "s";
|
||||||
|
case 'D' -> "d";
|
||||||
|
case 'F' -> "f";
|
||||||
|
case 'J' -> "l";
|
||||||
|
case 'Z' -> "bl";
|
||||||
|
case '[' -> Type.getType(descriptor).getElementType().getClassName() + "s";
|
||||||
|
default -> {
|
||||||
|
String name = cleanType(descriptor);
|
||||||
|
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
|
||||||
|
yield name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private String cleanType(String type) {
|
private String cleanType(String type) {
|
||||||
var cleaned = type;
|
var cleaned = type;
|
||||||
if (cleaned.indexOf('<') != -1) {
|
if (cleaned.indexOf('<') != -1) {
|
||||||
|
|
Loading…
Reference in a new issue