diff options
Diffstat (limited to 'src/cuchaz/enigma/Deobfuscator.java')
| -rw-r--r-- | src/cuchaz/enigma/Deobfuscator.java | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/src/cuchaz/enigma/Deobfuscator.java b/src/cuchaz/enigma/Deobfuscator.java index f7f7448..9a33917 100644 --- a/src/cuchaz/enigma/Deobfuscator.java +++ b/src/cuchaz/enigma/Deobfuscator.java | |||
| @@ -41,6 +41,8 @@ import cuchaz.enigma.analysis.SourceIndex; | |||
| 41 | import cuchaz.enigma.analysis.SourceIndexVisitor; | 41 | import cuchaz.enigma.analysis.SourceIndexVisitor; |
| 42 | import cuchaz.enigma.analysis.Token; | 42 | import cuchaz.enigma.analysis.Token; |
| 43 | import cuchaz.enigma.mapping.ArgumentEntry; | 43 | import cuchaz.enigma.mapping.ArgumentEntry; |
| 44 | import cuchaz.enigma.mapping.BehaviorEntry; | ||
| 45 | import cuchaz.enigma.mapping.BehaviorEntryFactory; | ||
| 44 | import cuchaz.enigma.mapping.ClassEntry; | 46 | import cuchaz.enigma.mapping.ClassEntry; |
| 45 | import cuchaz.enigma.mapping.ClassMapping; | 47 | import cuchaz.enigma.mapping.ClassMapping; |
| 46 | import cuchaz.enigma.mapping.ConstructorEntry; | 48 | import cuchaz.enigma.mapping.ConstructorEntry; |
| @@ -165,6 +167,12 @@ public class Deobfuscator | |||
| 165 | // methods | 167 | // methods |
| 166 | for( MethodMapping methodMapping : Lists.newArrayList( classMapping.methods() ) ) | 168 | for( MethodMapping methodMapping : Lists.newArrayList( classMapping.methods() ) ) |
| 167 | { | 169 | { |
| 170 | // skip constructors | ||
| 171 | if( methodMapping.isConstructor() ) | ||
| 172 | { | ||
| 173 | continue; | ||
| 174 | } | ||
| 175 | |||
| 168 | MethodEntry methodEntry = new MethodEntry( obfClassEntry, methodMapping.getObfName(), methodMapping.getObfSignature() ); | 176 | MethodEntry methodEntry = new MethodEntry( obfClassEntry, methodMapping.getObfName(), methodMapping.getObfSignature() ); |
| 169 | ClassEntry resolvedObfClassEntry = m_jarIndex.resolveEntryClass( methodEntry ); | 177 | ClassEntry resolvedObfClassEntry = m_jarIndex.resolveEntryClass( methodEntry ); |
| 170 | if( resolvedObfClassEntry != null && !resolvedObfClassEntry.equals( methodEntry.getClassEntry() ) ) | 178 | if( resolvedObfClassEntry != null && !resolvedObfClassEntry.equals( methodEntry.getClassEntry() ) ) |
| @@ -228,33 +236,12 @@ public class Deobfuscator | |||
| 228 | // check methods | 236 | // check methods |
| 229 | for( MethodMapping methodMapping : Lists.newArrayList( classMapping.methods() ) ) | 237 | for( MethodMapping methodMapping : Lists.newArrayList( classMapping.methods() ) ) |
| 230 | { | 238 | { |
| 231 | if( methodMapping.getObfName().equals( "<clinit>" ) ) | 239 | BehaviorEntry obfBehaviorEntry = BehaviorEntryFactory.createObf( classEntry, methodMapping ); |
| 232 | { | 240 | if( !m_jarIndex.containsObfBehavior( obfBehaviorEntry ) ) |
| 233 | // skip static initializers | ||
| 234 | continue; | ||
| 235 | } | ||
| 236 | else if( methodMapping.getObfName().equals( "<init>" ) ) | ||
| 237 | { | ||
| 238 | ConstructorEntry constructorEntry = new ConstructorEntry( classEntry, methodMapping.getObfSignature() ); | ||
| 239 | if( !m_jarIndex.containsObfBehavior( constructorEntry ) ) | ||
| 240 | { | ||
| 241 | System.err.println( "WARNING: unable to find constructor " + constructorEntry + ". dropping mapping." ); | ||
| 242 | classMapping.removeMethodMapping( methodMapping ); | ||
| 243 | } | ||
| 244 | } | ||
| 245 | else | ||
| 246 | { | 241 | { |
| 247 | MethodEntry methodEntry = new MethodEntry( | 242 | System.err.println( "WARNING: unable to find behavior " + obfBehaviorEntry + ". dropping mapping." ); |
| 248 | classEntry, | 243 | classMapping.removeMethodMapping( methodMapping ); |
| 249 | methodMapping.getObfName(), | 244 | } |
| 250 | methodMapping.getObfSignature() | ||
| 251 | ); | ||
| 252 | if( !m_jarIndex.containsObfBehavior( methodEntry ) ) | ||
| 253 | { | ||
| 254 | System.err.println( "WARNING: unable to find method " + methodEntry + ". dropping mapping." ); | ||
| 255 | classMapping.removeMethodMapping( methodMapping ); | ||
| 256 | } | ||
| 257 | } | ||
| 258 | } | 245 | } |
| 259 | 246 | ||
| 260 | // check inner classes | 247 | // check inner classes |