OrnitheMC / enigma

A deobfuscation/remapping tool for Java bytecode, fork of cuchaz's Enigma.
GNU Lesser General Public License v3.0
9 stars 2 forks source link

add support for locals mapping #19

Closed SpaceWalkerRS closed 2 years ago

SpaceWalkerRS commented 2 years ago
viktor40 commented 2 years ago

If this were to be merged, would anything break in feather or the example mod if someone maps locals? What happens if you use cfr decompiler? does it ignore the local mappings and work fine else?

If this would break anything anywhere I would like to keep this pr open as a draft until we can resolve that, so in case we need to, we can still deploy non-breaking versions of enigma.

SpaceWalkerRS commented 2 years ago

Existing Feather mappings are unaffected. If one were to start mapping locals these are added to the feather mappings. In the enigma format (the .mapping files) the locals are added below the parameters with the LOCAL keyword. This keeps the enigma format backwards compatible, since the class/field/method/parameter mappings are unchanged.

The tiny format is completely unchanged and does not add the locals mappings, which means the mod development environment is also unaffected.

If you use CFR instead of Procyon enigma will work exactly the same as before (apart from the fixed "reset to obfuscated" bug), meaning you cannot edit the locals at all. You can safely switch decompilers at any time, since the mappings are kept in memory and enigma tracks the changes you make and only stores those. If a method contains locals mappings but you used the CFR decompiler, parameter name validation will still take the existing locals mappings into account so you won't get conflicts between the parameters and locals.

SpaceWalkerRS commented 2 years ago

I'm gonna convert this PR to a draft and have another go at getting locals mapped in the dev env.