diff options
| author | 2017-04-05 19:56:10 +0100 | |
|---|---|---|
| committer | 2017-04-05 19:56:10 +0100 | |
| commit | e4a5891a4437ff73c461571d1454e6cbbd4facac (patch) | |
| tree | dae45ef2c31c35551a82863c4b7961eb075ee61e /src/main/java | |
| parent | Avoid crash using rebuild method names + make sure that the mapping is dirty ... (diff) | |
| download | enigma-e4a5891a4437ff73c461571d1454e6cbbd4facac.tar.gz enigma-e4a5891a4437ff73c461571d1454e6cbbd4facac.tar.xz enigma-e4a5891a4437ff73c461571d1454e6cbbd4facac.zip | |
Rebuild innerclass method names.
Diffstat (limited to '')
| -rw-r--r-- | src/main/java/cuchaz/enigma/Deobfuscator.java | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/src/main/java/cuchaz/enigma/Deobfuscator.java b/src/main/java/cuchaz/enigma/Deobfuscator.java index 4e4a54f6..1e99af2f 100644 --- a/src/main/java/cuchaz/enigma/Deobfuscator.java +++ b/src/main/java/cuchaz/enigma/Deobfuscator.java | |||
| @@ -330,30 +330,11 @@ public class Deobfuscator { | |||
| 330 | progress.init(getMappings().classes().size() * 3, "Rebuilding method names"); | 330 | progress.init(getMappings().classes().size() * 3, "Rebuilding method names"); |
| 331 | 331 | ||
| 332 | for (ClassMapping classMapping : Lists.newArrayList(getMappings().classes())) { | 332 | for (ClassMapping classMapping : Lists.newArrayList(getMappings().classes())) { |
| 333 | Map<Entry, String> renameEntries = new HashMap<>(); | ||
| 334 | |||
| 335 | progress.onProgress(i++, classMapping.getDeobfName()); | 333 | progress.onProgress(i++, classMapping.getDeobfName()); |
| 336 | 334 | rebuildMethodNames(classMapping, renameClassMap); | |
| 337 | for (MethodMapping methodMapping : Lists.newArrayList(classMapping.methods())) { | 335 | for(ClassMapping innerClass : classMapping.innerClasses()){ |
| 338 | ClassEntry classObfEntry = classMapping.getObfEntry(); | 336 | rebuildMethodNames(innerClass, renameClassMap); |
| 339 | BehaviorEntry obfEntry = methodMapping.getObfEntry(classObfEntry); | ||
| 340 | |||
| 341 | if (isBehaviorProvider(classObfEntry, obfEntry)) { | ||
| 342 | if (hasDeobfuscatedName(obfEntry) && !(obfEntry instanceof ConstructorEntry) | ||
| 343 | && !(methodMapping.getDeobfName().equals(methodMapping.getObfName()))) { | ||
| 344 | renameEntries.put(obfEntry, methodMapping.getDeobfName()); | ||
| 345 | } | ||
| 346 | |||
| 347 | for (ArgumentMapping argumentMapping : Lists.newArrayList(methodMapping.arguments())) { | ||
| 348 | Entry argObfEntry = argumentMapping.getObfEntry(obfEntry); | ||
| 349 | if (hasDeobfuscatedName(argObfEntry)) { | ||
| 350 | renameEntries.put(argObfEntry, deobfuscateEntry(argObfEntry).getName()); | ||
| 351 | } | ||
| 352 | } | ||
| 353 | } | ||
| 354 | } | 337 | } |
| 355 | |||
| 356 | renameClassMap.put(classMapping, renameEntries); | ||
| 357 | } | 338 | } |
| 358 | 339 | ||
| 359 | for (Map.Entry<ClassMapping, Map<Entry, String>> renameClassMapEntry : renameClassMap.entrySet()) { | 340 | for (Map.Entry<ClassMapping, Map<Entry, String>> renameClassMapEntry : renameClassMap.entrySet()) { |
| @@ -383,6 +364,33 @@ public class Deobfuscator { | |||
| 383 | } | 364 | } |
| 384 | } | 365 | } |
| 385 | 366 | ||
| 367 | private void rebuildMethodNames(ClassMapping classMapping, Map<ClassMapping, Map<Entry, String>> renameClassMap){ | ||
| 368 | Map<Entry, String> renameEntries = new HashMap<>(); | ||
| 369 | |||
| 370 | for (MethodMapping methodMapping : Lists.newArrayList(classMapping.methods())) { | ||
| 371 | ClassEntry classObfEntry = classMapping.getObfEntry(); | ||
| 372 | BehaviorEntry obfEntry = methodMapping.getObfEntry(classObfEntry); | ||
| 373 | |||
| 374 | if (isBehaviorProvider(classObfEntry, obfEntry)) { | ||
| 375 | if (hasDeobfuscatedName(obfEntry) && !(obfEntry instanceof ConstructorEntry) | ||
| 376 | && !(methodMapping.getDeobfName().equals(methodMapping.getObfName()))) { | ||
| 377 | renameEntries.put(obfEntry, methodMapping.getDeobfName()); | ||
| 378 | } | ||
| 379 | |||
| 380 | for (ArgumentMapping argumentMapping : Lists.newArrayList(methodMapping.arguments())) { | ||
| 381 | Entry argObfEntry = argumentMapping.getObfEntry(obfEntry); | ||
| 382 | if (hasDeobfuscatedName(argObfEntry)) { | ||
| 383 | renameEntries.put(argObfEntry, deobfuscateEntry(argObfEntry).getName()); | ||
| 384 | } | ||
| 385 | } | ||
| 386 | } | ||
| 387 | } | ||
| 388 | |||
| 389 | renameClassMap.put(classMapping, renameEntries); | ||
| 390 | } | ||
| 391 | |||
| 392 | |||
| 393 | |||
| 386 | public void writeJar(File out, ProgressListener progress) { | 394 | public void writeJar(File out, ProgressListener progress) { |
| 387 | transformJar(out, progress, createTypeLoader()::transformClass); | 395 | transformJar(out, progress, createTypeLoader()::transformClass); |
| 388 | } | 396 | } |