diff options
| author | 2014-08-28 10:12:24 -0400 | |
|---|---|---|
| committer | 2014-08-28 10:12:24 -0400 | |
| commit | deb2775d35f5a6d2b464782242e6b30c37279124 (patch) | |
| tree | c1c5f305683d874918490191fadb934fe90a8c52 /src | |
| parent | fixed issue with method signatures in default package (diff) | |
| download | enigma-deb2775d35f5a6d2b464782242e6b30c37279124.tar.gz enigma-deb2775d35f5a6d2b464782242e6b30c37279124.tar.xz enigma-deb2775d35f5a6d2b464782242e6b30c37279124.zip | |
added checks to find buggy mappings
Diffstat (limited to 'src')
| -rw-r--r-- | src/cuchaz/enigma/Deobfuscator.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/Deobfuscator.java b/src/cuchaz/enigma/Deobfuscator.java index 8a516b18..cc1465a2 100644 --- a/src/cuchaz/enigma/Deobfuscator.java +++ b/src/cuchaz/enigma/Deobfuscator.java | |||
| @@ -41,6 +41,7 @@ import cuchaz.enigma.mapping.Entry; | |||
| 41 | import cuchaz.enigma.mapping.FieldEntry; | 41 | import cuchaz.enigma.mapping.FieldEntry; |
| 42 | import cuchaz.enigma.mapping.Mappings; | 42 | import cuchaz.enigma.mapping.Mappings; |
| 43 | import cuchaz.enigma.mapping.MethodEntry; | 43 | import cuchaz.enigma.mapping.MethodEntry; |
| 44 | import cuchaz.enigma.mapping.MethodMapping; | ||
| 44 | import cuchaz.enigma.mapping.Renamer; | 45 | import cuchaz.enigma.mapping.Renamer; |
| 45 | import cuchaz.enigma.mapping.TranslationDirection; | 46 | import cuchaz.enigma.mapping.TranslationDirection; |
| 46 | import cuchaz.enigma.mapping.Translator; | 47 | import cuchaz.enigma.mapping.Translator; |
| @@ -101,6 +102,37 @@ public class Deobfuscator | |||
| 101 | { | 102 | { |
| 102 | val = new Mappings(); | 103 | val = new Mappings(); |
| 103 | } | 104 | } |
| 105 | |||
| 106 | // make sure all the mappings match the classes in the jar | ||
| 107 | for( ClassMapping classMapping : val.classes() ) | ||
| 108 | { | ||
| 109 | ClassEntry classEntry = new ClassEntry( classMapping.getObfName() ); | ||
| 110 | if( !m_jarIndex.getObfClassEntries().contains( classEntry ) ) | ||
| 111 | { | ||
| 112 | throw new Error( "Class " + classEntry + " not found in Jar!" ); | ||
| 113 | } | ||
| 114 | |||
| 115 | // and method implementations | ||
| 116 | for( MethodMapping methodMapping : classMapping.methods() ) | ||
| 117 | { | ||
| 118 | if( methodMapping.getObfName().startsWith( "<" ) ) | ||
| 119 | { | ||
| 120 | // skip constructors and static initializers | ||
| 121 | continue; | ||
| 122 | } | ||
| 123 | |||
| 124 | MethodEntry methodEntry = new MethodEntry( | ||
| 125 | classEntry, | ||
| 126 | methodMapping.getObfName(), | ||
| 127 | methodMapping.getObfSignature() | ||
| 128 | ); | ||
| 129 | if( !m_jarIndex.isMethodImplemented( methodEntry ) ) | ||
| 130 | { | ||
| 131 | throw new Error( "Method " + methodEntry + " not found in Jar!" ); | ||
| 132 | } | ||
| 133 | } | ||
| 134 | } | ||
| 135 | |||
| 104 | m_mappings = val; | 136 | m_mappings = val; |
| 105 | m_renamer = new Renamer( m_jarIndex, m_mappings ); | 137 | m_renamer = new Renamer( m_jarIndex, m_mappings ); |
| 106 | 138 | ||