hea3ven / mappings

A library to read/write java obfuscation mappings.
MIT License
2 stars 0 forks source link

Feeding a Mapping instance made with the srgpraser into the enigma praser to write out causes an exception. #2

Closed wgaylord closed 8 years ago

wgaylord commented 8 years ago

Trying to use a Mapping instance returned by reading a srg file with the write function for the enigma praser causes the folowing exception.

Exception in thread "main" java.lang.NullPointerException at com.hea3ven.tools.mappings.parser.enigma.EnigmaMappingsParser.descToString(EnigmaMappingsParser.java:186) at com.hea3ven.tools.mappings.parser.enigma.EnigmaMappingsParser.writeCls(EnigmaMappingsParser.java:176) at com.hea3ven.tools.mappings.parser.enigma.EnigmaMappingsParser.write(EnigmaMappingsParser.java:141) at chibill.MCP_to_Enigma.writeMappings(MCP_to_Enigma.java:28) at chibill.Main.main(Main.java:12)

My class just uses the srg praser to read in a file and then I write that mapping file right out into a enigma file.

wgaylord commented 8 years ago

`public class MCP_to_Enigma { SrgMappingsParser srg = new SrgMappingsParser(); Mapping map; EnigmaMappingsParser enigma = new EnigmaMappingsParser(); String enigmaOut;

public MCP_to_Enigma(String SrgIn,String EnigmaOut) throws FileNotFoundException, IOException{
    map = srg.add(new FileReader(SrgIn));
enigmaOut = EnigmaOut;
}

public void writeMappings() throws IOException {
    enigma.write(map, new FileWriter(enigmaOut));
}`

That is my code. My main class justs calls the init of the class then the write mappings.

hea3ven commented 8 years ago

The main issue here is that srg mappings don't specify the field type for field mappings. I can make it so that the enigma writer doesn't crash, but the enigma program says the mappings are invalid if you don't specify the field type.

wgaylord commented 8 years ago

There is code in Enigma (you need to call a different main class) that takes a jar and a mapping file and adds the types into it using the types found in the jar.

hea3ven commented 8 years ago

Version 1.1.1 with this change is up in the repo.

wgaylord commented 8 years ago

Okay