summaryrefslogtreecommitdiff
path: root/src/cuchaz
diff options
context:
space:
mode:
authorGravatar jeff2014-09-26 00:33:07 -0400
committerGravatar jeff2014-09-26 00:33:07 -0400
commit575447097876b5cf3dfbae8fa1f6f749819e97b8 (patch)
tree50b544e601e295dee5a55e747db85df9d3a25577 /src/cuchaz
parentfixed invalid tokens issue (diff)
downloadenigma-575447097876b5cf3dfbae8fa1f6f749819e97b8.tar.gz
enigma-575447097876b5cf3dfbae8fa1f6f749819e97b8.tar.xz
enigma-575447097876b5cf3dfbae8fa1f6f749819e97b8.zip
implemented mark-as-deobfuscated and reset-to-obfuscated
Diffstat (limited to 'src/cuchaz')
-rw-r--r--src/cuchaz/enigma/Deobfuscator.java68
-rw-r--r--src/cuchaz/enigma/gui/Gui.java63
-rw-r--r--src/cuchaz/enigma/gui/GuiController.java18
-rw-r--r--src/cuchaz/enigma/mapping/ClassMapping.java62
-rw-r--r--src/cuchaz/enigma/mapping/Mappings.java11
-rw-r--r--src/cuchaz/enigma/mapping/MappingsRenamer.java97
-rw-r--r--src/cuchaz/enigma/mapping/MethodMapping.java6
7 files changed, 296 insertions, 29 deletions
diff --git a/src/cuchaz/enigma/Deobfuscator.java b/src/cuchaz/enigma/Deobfuscator.java
index 9a339176..44845ba2 100644
--- a/src/cuchaz/enigma/Deobfuscator.java
+++ b/src/cuchaz/enigma/Deobfuscator.java
@@ -508,23 +508,19 @@ public class Deobfuscator
508 Translator translator = getTranslator( TranslationDirection.Deobfuscating ); 508 Translator translator = getTranslator( TranslationDirection.Deobfuscating );
509 if( obfEntry instanceof ClassEntry ) 509 if( obfEntry instanceof ClassEntry )
510 { 510 {
511 String deobfName = translator.translate( (ClassEntry)obfEntry ); 511 return translator.translate( (ClassEntry)obfEntry ) != null;
512 return deobfName != null && !deobfName.equals( obfEntry.getName() );
513 } 512 }
514 else if( obfEntry instanceof FieldEntry ) 513 else if( obfEntry instanceof FieldEntry )
515 { 514 {
516 String deobfName = translator.translate( (FieldEntry)obfEntry ); 515 return translator.translate( (FieldEntry)obfEntry ) != null;
517 return deobfName != null && !deobfName.equals( obfEntry.getName() );
518 } 516 }
519 else if( obfEntry instanceof MethodEntry ) 517 else if( obfEntry instanceof MethodEntry )
520 { 518 {
521 String deobfName = translator.translate( (MethodEntry)obfEntry ); 519 return translator.translate( (MethodEntry)obfEntry ) != null;
522 return deobfName != null && !deobfName.equals( obfEntry.getName() );
523 } 520 }
524 else if( obfEntry instanceof ConstructorEntry ) 521 else if( obfEntry instanceof ConstructorEntry )
525 { 522 {
526 String deobfName = translator.translate( obfEntry.getClassEntry() ); 523 return translator.translate( obfEntry.getClassEntry() ) != null;
527 return deobfName != null && !deobfName.equals( obfEntry.getClassName() );
528 } 524 }
529 else if( obfEntry instanceof ArgumentEntry ) 525 else if( obfEntry instanceof ArgumentEntry )
530 { 526 {
@@ -540,4 +536,60 @@ public class Deobfuscator
540 { 536 {
541 return m_jarIndex.containsObfEntry( obfEntry ); 537 return m_jarIndex.containsObfEntry( obfEntry );
542 } 538 }
539
540 public void removeMapping( Entry obfEntry )
541 {
542 if( obfEntry instanceof ClassEntry )
543 {
544 m_renamer.removeClassMapping( (ClassEntry)obfEntry );
545 }
546 else if( obfEntry instanceof FieldEntry )
547 {
548 m_renamer.removeFieldMapping( (FieldEntry)obfEntry );
549 }
550 else if( obfEntry instanceof MethodEntry )
551 {
552 m_renamer.removeMethodTreeMapping( (MethodEntry)obfEntry );
553 }
554 else if( obfEntry instanceof ConstructorEntry )
555 {
556 m_renamer.removeClassMapping( obfEntry.getClassEntry() );
557 }
558 else if( obfEntry instanceof ArgumentEntry )
559 {
560 m_renamer.removeArgumentMapping( (ArgumentEntry)obfEntry );
561 }
562 else
563 {
564 throw new Error( "Unknown entry type: " + obfEntry );
565 }
566 }
567
568 public void markAsDeobfuscated( Entry obfEntry )
569 {
570 if( obfEntry instanceof ClassEntry )
571 {
572 m_renamer.markClassAsDeobfuscated( (ClassEntry)obfEntry );
573 }
574 else if( obfEntry instanceof FieldEntry )
575 {
576 m_renamer.markFieldAsDeobfuscated( (FieldEntry)obfEntry );
577 }
578 else if( obfEntry instanceof MethodEntry )
579 {
580 m_renamer.markMethodTreeAsDeobfuscated( (MethodEntry)obfEntry );
581 }
582 else if( obfEntry instanceof ConstructorEntry )
583 {
584 m_renamer.markClassAsDeobfuscated( obfEntry.getClassEntry() );
585 }
586 else if( obfEntry instanceof ArgumentEntry )
587 {
588 m_renamer.markArgumentAsDeobfuscated( (ArgumentEntry)obfEntry );
589 }
590 else
591 {
592 throw new Error( "Unknown entry type: " + obfEntry );
593 }
594 }
543} 595}
diff --git a/src/cuchaz/enigma/gui/Gui.java b/src/cuchaz/enigma/gui/Gui.java
index 1f04aa35..8bf6ce95 100644
--- a/src/cuchaz/enigma/gui/Gui.java
+++ b/src/cuchaz/enigma/gui/Gui.java
@@ -122,6 +122,7 @@ public class Gui
122 private JMenuItem m_openPreviousMenu; 122 private JMenuItem m_openPreviousMenu;
123 private JMenuItem m_showCallsMenu; 123 private JMenuItem m_showCallsMenu;
124 private JMenuItem m_showImplementationsMenu; 124 private JMenuItem m_showImplementationsMenu;
125 private JMenuItem m_toggleMappingMenu;
125 126
126 // state 127 // state
127 private EntryReference<Entry,Entry> m_reference; 128 private EntryReference<Entry,Entry> m_reference;
@@ -136,17 +137,20 @@ public class Gui
136 final Container pane = m_frame.getContentPane(); 137 final Container pane = m_frame.getContentPane();
137 pane.setLayout( new BorderLayout() ); 138 pane.setLayout( new BorderLayout() );
138 139
139 // install a global exception handler to the event thread 140 if( Boolean.parseBoolean( System.getProperty( "enigma.catchExceptions", "true" ) ) )
140 CrashDialog.init( m_frame );
141 Thread.setDefaultUncaughtExceptionHandler( new UncaughtExceptionHandler( )
142 { 141 {
143 @Override 142 // install a global exception handler to the event thread
144 public void uncaughtException( Thread thread, Throwable ex ) 143 CrashDialog.init( m_frame );
144 Thread.setDefaultUncaughtExceptionHandler( new UncaughtExceptionHandler( )
145 { 145 {
146 ex.printStackTrace( System.err ); 146 @Override
147 CrashDialog.show( ex ); 147 public void uncaughtException( Thread thread, Throwable ex )
148 } 148 {
149 } ); 149 ex.printStackTrace( System.err );
150 CrashDialog.show( ex );
151 }
152 } );
153 }
150 154
151 m_controller = new GuiController( this ); 155 m_controller = new GuiController( this );
152 156
@@ -251,6 +255,10 @@ public class Gui
251 case KeyEvent.VK_C: 255 case KeyEvent.VK_C:
252 m_showCallsMenu.doClick(); 256 m_showCallsMenu.doClick();
253 break; 257 break;
258
259 case KeyEvent.VK_T:
260 m_toggleMappingMenu.doClick();
261 break;
254 } 262 }
255 } 263 }
256 } ); 264 } );
@@ -352,6 +360,21 @@ public class Gui
352 popupMenu.add( menu ); 360 popupMenu.add( menu );
353 m_openPreviousMenu = menu; 361 m_openPreviousMenu = menu;
354 } 362 }
363 {
364 JMenuItem menu = new JMenuItem( "Mark as deobfuscated" );
365 menu.addActionListener( new ActionListener( )
366 {
367 @Override
368 public void actionPerformed( ActionEvent event )
369 {
370 toggleMapping();
371 }
372 } );
373 menu.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_T, 0 ) );
374 menu.setEnabled( false );
375 popupMenu.add( menu );
376 m_toggleMappingMenu = menu;
377 }
355 378
356 // init inheritance panel 379 // init inheritance panel
357 m_inheritanceTree = new JTree(); 380 m_inheritanceTree = new JTree();
@@ -1031,6 +1054,16 @@ public class Gui
1031 m_showCallsMenu.setEnabled( isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry ); 1054 m_showCallsMenu.setEnabled( isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry );
1032 m_openEntryMenu.setEnabled( isInJar && ( isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry ) ); 1055 m_openEntryMenu.setEnabled( isInJar && ( isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry ) );
1033 m_openPreviousMenu.setEnabled( m_controller.hasPreviousLocation() ); 1056 m_openPreviousMenu.setEnabled( m_controller.hasPreviousLocation() );
1057 m_toggleMappingMenu.setEnabled( isInJar && isToken );
1058
1059 if( isToken && m_controller.entryHasMapping( m_reference.entry ) )
1060 {
1061 m_toggleMappingMenu.setText( "Reset to obfuscated" );
1062 }
1063 else
1064 {
1065 m_toggleMappingMenu.setText( "Mark as deobfuscated" );
1066 }
1034 } 1067 }
1035 1068
1036 private void navigateTo( Entry entry ) 1069 private void navigateTo( Entry entry )
@@ -1233,6 +1266,18 @@ public class Gui
1233 redraw(); 1266 redraw();
1234 } 1267 }
1235 1268
1269 private void toggleMapping()
1270 {
1271 if( m_controller.entryHasMapping( m_reference.entry ) )
1272 {
1273 m_controller.removeMapping( m_reference );
1274 }
1275 else
1276 {
1277 m_controller.markAsDeobfuscated( m_reference );
1278 }
1279 }
1280
1236 private TreePath getPathToRoot( TreeNode node ) 1281 private TreePath getPathToRoot( TreeNode node )
1237 { 1282 {
1238 List<TreeNode> nodes = Lists.newArrayList(); 1283 List<TreeNode> nodes = Lists.newArrayList();
diff --git a/src/cuchaz/enigma/gui/GuiController.java b/src/cuchaz/enigma/gui/GuiController.java
index 098e065d..3adaf91d 100644
--- a/src/cuchaz/enigma/gui/GuiController.java
+++ b/src/cuchaz/enigma/gui/GuiController.java
@@ -249,6 +249,24 @@ public class GuiController
249 refreshCurrentClass( obfReference ); 249 refreshCurrentClass( obfReference );
250 } 250 }
251 251
252 public void removeMapping( EntryReference<Entry,Entry> deobfReference )
253 {
254 EntryReference<Entry,Entry> obfReference = m_deobfuscator.obfuscateReference( deobfReference );
255 m_deobfuscator.removeMapping( obfReference.entry );
256 m_isDirty = true;
257 refreshClasses();
258 refreshCurrentClass( obfReference );
259 }
260
261 public void markAsDeobfuscated( EntryReference<Entry,Entry> deobfReference )
262 {
263 EntryReference<Entry,Entry> obfReference = m_deobfuscator.obfuscateReference( deobfReference );
264 m_deobfuscator.markAsDeobfuscated( obfReference.entry );
265 m_isDirty = true;
266 refreshClasses();
267 refreshCurrentClass( obfReference );
268 }
269
252 public void openDeclaration( Entry deobfEntry ) 270 public void openDeclaration( Entry deobfEntry )
253 { 271 {
254 if( deobfEntry == null ) 272 if( deobfEntry == null )
diff --git a/src/cuchaz/enigma/mapping/ClassMapping.java b/src/cuchaz/enigma/mapping/ClassMapping.java
index b551d71c..88106dfa 100644
--- a/src/cuchaz/enigma/mapping/ClassMapping.java
+++ b/src/cuchaz/enigma/mapping/ClassMapping.java
@@ -79,6 +79,17 @@ public class ClassMapping implements Serializable, Comparable<ClassMapping>
79 } 79 }
80 } 80 }
81 81
82 public void removeInnerClassMapping( ClassMapping classMapping )
83 {
84 boolean obfWasRemoved = m_innerClassesByObf.remove( classMapping.getObfName() ) != null;
85 assert( obfWasRemoved );
86 if( classMapping.getDeobfName() != null )
87 {
88 boolean deobfWasRemoved = m_innerClassesByDeobf.remove( classMapping.getDeobfName() ) != null;
89 assert( deobfWasRemoved );
90 }
91 }
92
82 public ClassMapping getOrCreateInnerClass( String obfName ) 93 public ClassMapping getOrCreateInnerClass( String obfName )
83 { 94 {
84 ClassMapping classMapping = m_innerClassesByObf.get( obfName ); 95 ClassMapping classMapping = m_innerClassesByObf.get( obfName );
@@ -124,11 +135,17 @@ public class ClassMapping implements Serializable, Comparable<ClassMapping>
124 public void setInnerClassName( String obfName, String deobfName ) 135 public void setInnerClassName( String obfName, String deobfName )
125 { 136 {
126 ClassMapping classMapping = getOrCreateInnerClass( obfName ); 137 ClassMapping classMapping = getOrCreateInnerClass( obfName );
127 boolean wasRemoved = m_innerClassesByDeobf.remove( classMapping.getDeobfName() ) != null; 138 if( classMapping.getDeobfName() != null )
128 assert( wasRemoved ); 139 {
140 boolean wasRemoved = m_innerClassesByDeobf.remove( classMapping.getDeobfName() ) != null;
141 assert( wasRemoved );
142 }
129 classMapping.setDeobfName( deobfName ); 143 classMapping.setDeobfName( deobfName );
130 boolean wasAdded = m_innerClassesByDeobf.put( deobfName, classMapping ) == null; 144 if( deobfName != null )
131 assert( wasAdded ); 145 {
146 boolean wasAdded = m_innerClassesByDeobf.put( deobfName, classMapping ) == null;
147 assert( wasAdded );
148 }
132 } 149 }
133 150
134 //// FIELDS //////// 151 //// FIELDS ////////
@@ -176,6 +193,16 @@ public class ClassMapping implements Serializable, Comparable<ClassMapping>
176 assert( deobfWasRemoved ); 193 assert( deobfWasRemoved );
177 } 194 }
178 } 195 }
196
197 public FieldMapping getFieldByObf( String obfName )
198 {
199 return m_fieldsByObf.get( obfName );
200 }
201
202 public FieldMapping getFieldByDeobf( String deobfName )
203 {
204 return m_fieldsByDeobf.get( deobfName );
205 }
179 206
180 public String getObfFieldName( String deobfName ) 207 public String getObfFieldName( String deobfName )
181 { 208 {
@@ -212,8 +239,11 @@ public class ClassMapping implements Serializable, Comparable<ClassMapping>
212 assert( wasRemoved ); 239 assert( wasRemoved );
213 } 240 }
214 fieldMapping.setDeobfName( deobfName ); 241 fieldMapping.setDeobfName( deobfName );
215 boolean wasAdded = m_fieldsByDeobf.put( deobfName, fieldMapping ) == null; 242 if( deobfName != null )
216 assert( wasAdded ); 243 {
244 boolean wasAdded = m_fieldsByDeobf.put( deobfName, fieldMapping ) == null;
245 assert( wasAdded );
246 }
217 } 247 }
218 248
219 //// METHODS //////// 249 //// METHODS ////////
@@ -303,20 +333,28 @@ public class ClassMapping implements Serializable, Comparable<ClassMapping>
303 assert( wasRemoved ); 333 assert( wasRemoved );
304 } 334 }
305 methodMapping.setDeobfName( deobfName ); 335 methodMapping.setDeobfName( deobfName );
306 boolean wasAdded = m_methodsByDeobf.put( getMethodKey( deobfName, obfSignature ), methodMapping ) == null; 336 if( deobfName != null )
307 assert( wasAdded ); 337 {
338 boolean wasAdded = m_methodsByDeobf.put( getMethodKey( deobfName, obfSignature ), methodMapping ) == null;
339 assert( wasAdded );
340 }
308 } 341 }
309 342
310 //// ARGUMENTS //////// 343 //// ARGUMENTS ////////
311 344
312 public void setArgumentName( String obfMethodName, String obfMethodSignature, int argumentIndex, String argumentName ) 345 public void setArgumentName( String obfMethodName, String obfMethodSignature, int argumentIndex, String argumentName )
313 { 346 {
314 MethodMapping methodIndex = m_methodsByObf.get( getMethodKey( obfMethodName, obfMethodSignature ) ); 347 MethodMapping methodMapping = m_methodsByObf.get( getMethodKey( obfMethodName, obfMethodSignature ) );
315 if( methodIndex == null ) 348 if( methodMapping == null )
316 { 349 {
317 methodIndex = createMethodMapping( obfMethodName, obfMethodSignature ); 350 methodMapping = createMethodMapping( obfMethodName, obfMethodSignature );
318 } 351 }
319 methodIndex.setArgumentName( argumentIndex, argumentName ); 352 methodMapping.setArgumentName( argumentIndex, argumentName );
353 }
354
355 public void removeArgumentName( String obfMethodName, String obfMethodSignature, int argumentIndex )
356 {
357 m_methodsByObf.get( getMethodKey( obfMethodName, obfMethodSignature ) ).removeArgumentName( argumentIndex );
320 } 358 }
321 359
322 private MethodMapping createMethodMapping( String obfName, String obfSignature ) 360 private MethodMapping createMethodMapping( String obfName, String obfSignature )
diff --git a/src/cuchaz/enigma/mapping/Mappings.java b/src/cuchaz/enigma/mapping/Mappings.java
index 0b4e7f3c..45b41bcd 100644
--- a/src/cuchaz/enigma/mapping/Mappings.java
+++ b/src/cuchaz/enigma/mapping/Mappings.java
@@ -94,6 +94,17 @@ public class Mappings implements Serializable
94 } 94 }
95 } 95 }
96 96
97 public void removeClassMapping( ClassMapping classMapping )
98 {
99 boolean obfWasRemoved = m_classesByObf.remove( classMapping.getObfName() ) != null;
100 assert( obfWasRemoved );
101 if( classMapping.getDeobfName() != null )
102 {
103 boolean deobfWasRemoved = m_classesByDeobf.remove( classMapping.getDeobfName() ) != null;
104 assert( deobfWasRemoved );
105 }
106 }
107
97 public ClassMapping getClassByObf( ClassEntry entry ) 108 public ClassMapping getClassByObf( ClassEntry entry )
98 { 109 {
99 return getClassByObf( entry.getName() ); 110 return getClassByObf( entry.getName() );
diff --git a/src/cuchaz/enigma/mapping/MappingsRenamer.java b/src/cuchaz/enigma/mapping/MappingsRenamer.java
index 182bbd19..957b6d68 100644
--- a/src/cuchaz/enigma/mapping/MappingsRenamer.java
+++ b/src/cuchaz/enigma/mapping/MappingsRenamer.java
@@ -57,6 +57,36 @@ public class MappingsRenamer
57 } 57 }
58 } 58 }
59 59
60 public void removeClassMapping( ClassEntry obf )
61 {
62 ClassMapping classMapping = getClassMapping( obf );
63 if( obf.isInnerClass() )
64 {
65 classMapping.setInnerClassName( obf.getName(), null );
66 }
67 else
68 {
69 boolean wasRemoved = m_mappings.m_classesByDeobf.remove( classMapping.getDeobfName() ) != null;
70 assert( wasRemoved );
71 classMapping.setDeobfName( null );
72 }
73 }
74
75 public void markClassAsDeobfuscated( ClassEntry obf )
76 {
77 ClassMapping classMapping = getOrCreateClassMapping( obf );
78 if( obf.isInnerClass() )
79 {
80 classMapping.setInnerClassName( obf.getName(), obf.getName() );
81 }
82 else
83 {
84 classMapping.setDeobfName( obf.getName() );
85 boolean wasAdded = m_mappings.m_classesByDeobf.put( obf.getName(), classMapping ) == null;
86 assert( wasAdded );
87 }
88 }
89
60 public void setFieldName( FieldEntry obf, String deobfName ) 90 public void setFieldName( FieldEntry obf, String deobfName )
61 { 91 {
62 deobfName = NameValidator.validateFieldName( deobfName ); 92 deobfName = NameValidator.validateFieldName( deobfName );
@@ -70,6 +100,18 @@ public class MappingsRenamer
70 classMapping.setFieldName( obf.getName(), deobfName ); 100 classMapping.setFieldName( obf.getName(), deobfName );
71 } 101 }
72 102
103 public void removeFieldMapping( FieldEntry obf )
104 {
105 ClassMapping classMapping = getClassMappingOrInnerClassMapping( obf.getClassEntry() );
106 classMapping.setFieldName( obf.getName(), null );
107 }
108
109 public void markFieldAsDeobfuscated( FieldEntry obf )
110 {
111 ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() );
112 classMapping.setFieldName( obf.getName(), obf.getName() );
113 }
114
73 public void setMethodTreeName( MethodEntry obf, String deobfName ) 115 public void setMethodTreeName( MethodEntry obf, String deobfName )
74 { 116 {
75 Set<MethodEntry> implementations = m_index.getRelatedMethodImplementations( obf ); 117 Set<MethodEntry> implementations = m_index.getRelatedMethodImplementations( obf );
@@ -106,6 +148,34 @@ public class MappingsRenamer
106 classMapping.setMethodName( obf.getName(), obf.getSignature(), deobfName ); 148 classMapping.setMethodName( obf.getName(), obf.getSignature(), deobfName );
107 } 149 }
108 150
151 public void removeMethodTreeMapping( MethodEntry obf )
152 {
153 for( MethodEntry implementation : m_index.getRelatedMethodImplementations( obf ) )
154 {
155 removeMethodMapping( implementation );
156 }
157 }
158
159 public void removeMethodMapping( MethodEntry obf )
160 {
161 ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() );
162 classMapping.setMethodName( obf.getName(), obf.getSignature(), null );
163 }
164
165 public void markMethodTreeAsDeobfuscated( MethodEntry obf )
166 {
167 for( MethodEntry implementation : m_index.getRelatedMethodImplementations( obf ) )
168 {
169 markMethodAsDeobfuscated( implementation );
170 }
171 }
172
173 public void markMethodAsDeobfuscated( MethodEntry obf )
174 {
175 ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() );
176 classMapping.setMethodName( obf.getName(), obf.getSignature(), obf.getName() );
177 }
178
109 public void setArgumentName( ArgumentEntry obf, String deobfName ) 179 public void setArgumentName( ArgumentEntry obf, String deobfName )
110 { 180 {
111 deobfName = NameValidator.validateArgumentName( deobfName ); 181 deobfName = NameValidator.validateArgumentName( deobfName );
@@ -119,6 +189,18 @@ public class MappingsRenamer
119 classMapping.setArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), deobfName ); 189 classMapping.setArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), deobfName );
120 } 190 }
121 191
192 public void removeArgumentMapping( ArgumentEntry obf )
193 {
194 ClassMapping classMapping = getClassMappingOrInnerClassMapping( obf.getClassEntry() );
195 classMapping.removeArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex() );
196 }
197
198 public void markArgumentAsDeobfuscated( ArgumentEntry obf )
199 {
200 ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() );
201 classMapping.setArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), obf.getName() );
202 }
203
122 public boolean moveFieldToObfClass( ClassMapping classMapping, FieldMapping fieldMapping, ClassEntry obfClass ) 204 public boolean moveFieldToObfClass( ClassMapping classMapping, FieldMapping fieldMapping, ClassEntry obfClass )
123 { 205 {
124 classMapping.removeFieldMapping( fieldMapping ); 206 classMapping.removeFieldMapping( fieldMapping );
@@ -167,6 +249,11 @@ public class MappingsRenamer
167 gzipout.finish(); 249 gzipout.finish();
168 } 250 }
169 251
252 private ClassMapping getClassMapping( ClassEntry obfClassEntry )
253 {
254 return m_mappings.m_classesByObf.get( obfClassEntry.getOuterClassName() );
255 }
256
170 private ClassMapping getOrCreateClassMapping( ClassEntry obfClassEntry ) 257 private ClassMapping getOrCreateClassMapping( ClassEntry obfClassEntry )
171 { 258 {
172 String obfClassName = obfClassEntry.getOuterClassName(); 259 String obfClassName = obfClassEntry.getOuterClassName();
@@ -180,6 +267,16 @@ public class MappingsRenamer
180 return classMapping; 267 return classMapping;
181 } 268 }
182 269
270 private ClassMapping getClassMappingOrInnerClassMapping( ClassEntry obfClassEntry )
271 {
272 ClassMapping classMapping = getClassMapping( obfClassEntry );
273 if( obfClassEntry.isInDefaultPackage() )
274 {
275 classMapping = classMapping.getInnerClassByObf( obfClassEntry.getInnerClassName() );
276 }
277 return classMapping;
278 }
279
183 private ClassMapping getOrCreateClassMappingOrInnerClassMapping( ClassEntry obfClassEntry ) 280 private ClassMapping getOrCreateClassMappingOrInnerClassMapping( ClassEntry obfClassEntry )
184 { 281 {
185 ClassMapping classMapping = getOrCreateClassMapping( obfClassEntry ); 282 ClassMapping classMapping = getOrCreateClassMapping( obfClassEntry );
diff --git a/src/cuchaz/enigma/mapping/MethodMapping.java b/src/cuchaz/enigma/mapping/MethodMapping.java
index b076fa33..c51b0110 100644
--- a/src/cuchaz/enigma/mapping/MethodMapping.java
+++ b/src/cuchaz/enigma/mapping/MethodMapping.java
@@ -118,6 +118,12 @@ public class MethodMapping implements Serializable, Comparable<MethodMapping>
118 } 118 }
119 } 119 }
120 120
121 public void removeArgumentName( int index )
122 {
123 boolean wasRemoved = m_arguments.remove( index ) != null;
124 assert( wasRemoved );
125 }
126
121 @Override 127 @Override
122 public String toString( ) 128 public String toString( )
123 { 129 {