diff options
| author | 2014-09-24 01:00:54 -0400 | |
|---|---|---|
| committer | 2014-09-24 01:00:54 -0400 | |
| commit | 8776a8ba38123c822530e5f659c626c8db616217 (patch) | |
| tree | 8138a4e4447552e598bb99cfd8fb23a5f27f840b /src/cuchaz/enigma/mapping/MappingsRenamer.java | |
| parent | trying to figure out why some mappings to correspond to anything in the jar f... (diff) | |
| download | enigma-fork-8776a8ba38123c822530e5f659c626c8db616217.tar.gz enigma-fork-8776a8ba38123c822530e5f659c626c8db616217.tar.xz enigma-fork-8776a8ba38123c822530e5f659c626c8db616217.zip | |
HOW DO I WRITE SO MANY BUGS?!?
Diffstat (limited to 'src/cuchaz/enigma/mapping/MappingsRenamer.java')
| -rw-r--r-- | src/cuchaz/enigma/mapping/MappingsRenamer.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/cuchaz/enigma/mapping/MappingsRenamer.java b/src/cuchaz/enigma/mapping/MappingsRenamer.java index 49e7b5f..dcceefb 100644 --- a/src/cuchaz/enigma/mapping/MappingsRenamer.java +++ b/src/cuchaz/enigma/mapping/MappingsRenamer.java | |||
| @@ -79,7 +79,7 @@ public class MappingsRenamer | |||
| 79 | { | 79 | { |
| 80 | String deobfSignature = getTranslator( TranslationDirection.Deobfuscating ).translateSignature( obf.getSignature() ); | 80 | String deobfSignature = getTranslator( TranslationDirection.Deobfuscating ).translateSignature( obf.getSignature() ); |
| 81 | MethodEntry targetEntry = new MethodEntry( entry.getClassEntry(), deobfName, deobfSignature ); | 81 | MethodEntry targetEntry = new MethodEntry( entry.getClassEntry(), deobfName, deobfSignature ); |
| 82 | if( m_mappings.containsDeobfMethod( entry.getClassEntry(), deobfName, entry.getSignature() ) || m_index.containsObfMethod( targetEntry ) ) | 82 | if( m_mappings.containsDeobfMethod( entry.getClassEntry(), deobfName, entry.getSignature() ) || m_index.containsObfBehavior( targetEntry ) ) |
| 83 | { | 83 | { |
| 84 | String deobfClassName = getTranslator( TranslationDirection.Deobfuscating ).translateClass( entry.getClassName() ); | 84 | String deobfClassName = getTranslator( TranslationDirection.Deobfuscating ).translateClass( entry.getClassName() ); |
| 85 | throw new IllegalNameException( deobfName, "There is already a method with that name and signature in class " + deobfClassName ); | 85 | throw new IllegalNameException( deobfName, "There is already a method with that name and signature in class " + deobfClassName ); |
| @@ -96,7 +96,7 @@ public class MappingsRenamer | |||
| 96 | { | 96 | { |
| 97 | deobfName = NameValidator.validateMethodName( deobfName ); | 97 | deobfName = NameValidator.validateMethodName( deobfName ); |
| 98 | MethodEntry targetEntry = new MethodEntry( obf.getClassEntry(), deobfName, obf.getSignature() ); | 98 | MethodEntry targetEntry = new MethodEntry( obf.getClassEntry(), deobfName, obf.getSignature() ); |
| 99 | if( m_mappings.containsDeobfMethod( obf.getClassEntry(), deobfName, obf.getSignature() ) || m_index.containsObfMethod( targetEntry ) ) | 99 | if( m_mappings.containsDeobfMethod( obf.getClassEntry(), deobfName, obf.getSignature() ) || m_index.containsObfBehavior( targetEntry ) ) |
| 100 | { | 100 | { |
| 101 | String deobfClassName = getTranslator( TranslationDirection.Deobfuscating ).translateClass( obf.getClassName() ); | 101 | String deobfClassName = getTranslator( TranslationDirection.Deobfuscating ).translateClass( obf.getClassName() ); |
| 102 | throw new IllegalNameException( deobfName, "There is already a method with that name and signature in class " + deobfClassName ); | 102 | throw new IllegalNameException( deobfName, "There is already a method with that name and signature in class " + deobfClassName ); |
| @@ -110,7 +110,7 @@ public class MappingsRenamer | |||
| 110 | { | 110 | { |
| 111 | deobfName = NameValidator.validateArgumentName( deobfName ); | 111 | deobfName = NameValidator.validateArgumentName( deobfName ); |
| 112 | // NOTE: don't need to check arguments for name collisions with names determined by Procyon | 112 | // NOTE: don't need to check arguments for name collisions with names determined by Procyon |
| 113 | if( m_mappings.containsArgument( obf.getMethodEntry(), deobfName ) ) | 113 | if( m_mappings.containsArgument( obf.getBehaviorEntry(), deobfName ) ) |
| 114 | { | 114 | { |
| 115 | throw new IllegalNameException( deobfName, "There is already an argument with that name" ); | 115 | throw new IllegalNameException( deobfName, "There is already an argument with that name" ); |
| 116 | } | 116 | } |
| @@ -119,6 +119,32 @@ public class MappingsRenamer | |||
| 119 | classMapping.setArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), deobfName ); | 119 | classMapping.setArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), deobfName ); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | public boolean moveFieldToObfClass( ClassMapping classMapping, FieldMapping fieldMapping, ClassEntry obfClass ) | ||
| 123 | { | ||
| 124 | classMapping.removeFieldMapping( fieldMapping ); | ||
| 125 | ClassMapping targetClassMapping = getOrCreateClassMapping( obfClass ); | ||
| 126 | if( !targetClassMapping.containsObfField( fieldMapping.getObfName() ) | ||
| 127 | && !targetClassMapping.containsDeobfField( fieldMapping.getDeobfName() ) ) | ||
| 128 | { | ||
| 129 | targetClassMapping.addFieldMapping( fieldMapping ); | ||
| 130 | return true; | ||
| 131 | } | ||
| 132 | return false; | ||
| 133 | } | ||
| 134 | |||
| 135 | public boolean moveMethodToObfClass( ClassMapping classMapping, MethodMapping methodMapping, ClassEntry obfClass ) | ||
| 136 | { | ||
| 137 | classMapping.removeMethodMapping( methodMapping ); | ||
| 138 | ClassMapping targetClassMapping = getOrCreateClassMapping( obfClass ); | ||
| 139 | if( !targetClassMapping.containsObfMethod( methodMapping.getObfName(), methodMapping.getObfSignature() ) | ||
| 140 | && !targetClassMapping.containsDeobfMethod( methodMapping.getDeobfName(), methodMapping.getObfSignature() ) ) | ||
| 141 | { | ||
| 142 | targetClassMapping.addMethodMapping( methodMapping ); | ||
| 143 | return true; | ||
| 144 | } | ||
| 145 | return false; | ||
| 146 | } | ||
| 147 | |||
| 122 | public void write( OutputStream out ) | 148 | public void write( OutputStream out ) |
| 123 | throws IOException | 149 | throws IOException |
| 124 | { | 150 | { |