diff --git a/build.gradle b/build.gradle index e3e9209..70fe9a5 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ subprojects { group = 'me.jamiemansfield' archivesBaseName = project.name.toLowerCase() - version = '0.4.3' + version = '0.4.4' repositories { mavenCentral() diff --git a/changelogs/0.4.4.md b/changelogs/0.4.4.md new file mode 100644 index 0000000..d27aba1 --- /dev/null +++ b/changelogs/0.4.4.md @@ -0,0 +1,16 @@ +Lorenz 0.4.4 +============ + +Lorenz 0.4.4 is the combination of bugs identified in the development of Lorenz 0.5.0, specifically +with regards to the mapping format implementations, in addition to a faulty mapping model method. + +## IO + +- TSRG: Don't write empty class line for parents +- TSRG: Correct a length check, preventing some **valid** mappings from being read +- Enigma: Output field types properly, using the *obfuscated* type + +## Mapping Model + +- Fix the faulty implementation of `ClassMapping::hasMappings`, specifically it did'nt consider method + argument mappings diff --git a/lorenz/src/main/java/me/jamiemansfield/lorenz/io/enigma/EnigmaWriter.java b/lorenz/src/main/java/me/jamiemansfield/lorenz/io/enigma/EnigmaWriter.java index 4d55a83..295513f 100644 --- a/lorenz/src/main/java/me/jamiemansfield/lorenz/io/enigma/EnigmaWriter.java +++ b/lorenz/src/main/java/me/jamiemansfield/lorenz/io/enigma/EnigmaWriter.java @@ -137,7 +137,7 @@ private void writeFieldMapping(final FieldMapping field, final int indent) { this.printIndentedLine(indent, String.format("FIELD %s %s %s", field.getObfuscatedName(), field.getDeobfuscatedName(), - field.getMappings().deobfuscate(type) + handleNonePrefix(type) )); }); // TODO: throw an exception if the type is unknown / WriterResult container diff --git a/lorenz/src/main/java/me/jamiemansfield/lorenz/io/srg/tsrg/TSrgReader.java b/lorenz/src/main/java/me/jamiemansfield/lorenz/io/srg/tsrg/TSrgReader.java index 6b08887..69a51c4 100644 --- a/lorenz/src/main/java/me/jamiemansfield/lorenz/io/srg/tsrg/TSrgReader.java +++ b/lorenz/src/main/java/me/jamiemansfield/lorenz/io/srg/tsrg/TSrgReader.java @@ -82,7 +82,7 @@ public void accept(final String rawLine) { final String line = SrgConstants.removeComments(rawLine); if (line.isEmpty()) return; - if (line.length() < 4) { + if (line.length() < 3) { throw new IllegalArgumentException("Faulty TSRG mapping encountered: `" + line + "`!"); } diff --git a/lorenz/src/main/java/me/jamiemansfield/lorenz/io/srg/tsrg/TSrgWriter.java b/lorenz/src/main/java/me/jamiemansfield/lorenz/io/srg/tsrg/TSrgWriter.java index 48059cc..d16e0e5 100644 --- a/lorenz/src/main/java/me/jamiemansfield/lorenz/io/srg/tsrg/TSrgWriter.java +++ b/lorenz/src/main/java/me/jamiemansfield/lorenz/io/srg/tsrg/TSrgWriter.java @@ -67,7 +67,12 @@ public void write(final MappingSet mappings) { * @param mapping The class mapping */ protected void writeClassMapping(final ClassMapping mapping) { - this.writer.println(String.format("%s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName())); + // Effectively ClassMapping#hasMappings() without the inner class check + if (mapping.hasDeobfuscatedName() || + mapping.getFieldMappings().stream().anyMatch(Mapping::hasDeobfuscatedName) || + mapping.getMethodMappings().stream().anyMatch(MethodMapping::hasMappings)) { + this.writer.println(String.format("%s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName())); + } // Write field mappings mapping.getFieldsByName().values().stream() diff --git a/lorenz/src/main/java/me/jamiemansfield/lorenz/model/ClassMapping.java b/lorenz/src/main/java/me/jamiemansfield/lorenz/model/ClassMapping.java index c827fc0..af8252a 100644 --- a/lorenz/src/main/java/me/jamiemansfield/lorenz/model/ClassMapping.java +++ b/lorenz/src/main/java/me/jamiemansfield/lorenz/model/ClassMapping.java @@ -415,7 +415,7 @@ default InnerClassMapping getOrCreateInnerClassMapping(final String obfuscatedNa default boolean hasMappings() { return this.hasDeobfuscatedName() || this.getFieldMappings().stream().anyMatch(Mapping::hasDeobfuscatedName) || - this.getMethodMappings().stream().anyMatch(Mapping::hasDeobfuscatedName) || + this.getMethodMappings().stream().anyMatch(MethodMapping::hasMappings) || this.getInnerClassMappings().stream().anyMatch(ClassMapping::hasMappings); }