Enigma
Enigma copied to clipboard
Support user defined "is entry obfuscated" condition
Using Enigma with StarMade. Their obfuscated classes are namespaced under obfuscated
.
Investigating how Enigma splits classes between Obfuscated Classes and De-obfuscated Classes, the Gui Controller invokes Deobfuscator.getSeperateClasses(...)
:
https://github.com/FabricMC/Enigma/blob/19a77fbb472592e116f2f6654657eeec81d40b18/src/main/java/cuchaz/enigma/Deobfuscator.java#L159-L179
Since the obfuscated entries in this case have a package name, they are marked as deobfuscated.
Would it be a good ideal to support comparing against a regular expression to force entries as obfuscated? What are some options to work around this?
Probably easiest way to work around would be to process the jar to move all the obfuscated classes out of that package, and then import that jar into Enigma.
On Enigma's side, I'm quite unsure what would be the best way to support jars like this. We could just hardcode checking for an obfuscated
package, but it's quite arbitrary.
What tool can I use to move the classes out of that package?
None that would exist already -- you'd have to make your own
On Enigma's side, I'm quite unsure what would be the best way to support jars like this. We could just hardcode checking for an obfuscated package, but it's quite arbitrary.
any more arbitrary than checking if an entry has no package, which would mean doing something like the following patch would be considered okay?
diff --git a/src/main/java/cuchaz/enigma/Deobfuscator.java b/src/main/java/cuchaz/enigma/Deobfuscator.java
index b4736d8..00f95ae 100644
--- a/src/main/java/cuchaz/enigma/Deobfuscator.java
+++ b/src/main/java/cuchaz/enigma/Deobfuscator.java
@@ -168,7 +168,7 @@ public class Deobfuscator {
if (!deobfClassEntry.equals(obfClassEntry)) {
// if the class has a mapping, clearly it's deobfuscated
deobfClasses.add(obfClassEntry);
- } else if (obfClassEntry.getPackageName() != null) {
+ } else if (obfClassEntry.getPackageName() != null && !obfClassEntry.getPackageName().equals("obfuscated")) {
// also call it deobufscated if it's not in the none package
deobfClasses.add(obfClassEntry);
} else {
Modern Enigma by default treats all classes as obfuscated, regardless of package, so this issue can be closed