diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..1c2c4ab5d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,22 @@ +{ + "[java]": { + "editor.suggest.showClasses": true, + "editor.suggest.showMethods": true, + "editor.suggest.showConstructors": true, + "editor.suggest.showConstants": true, + "editor.suggest.showEnumMembers": true, + "editor.suggest.showEnums": true, + "editor.suggest.showEvents": true, + "editor.suggest.showFields": true, + "editor.suggest.showInterfaces": true, + "editor.suggest.showKeywords": true, + "editor.suggest.showVariables": true, + "editor.suggest.showSnippets": true, + "editor.suggest.showWords": true, + "editor.lightbulb.enabled": true, + "editor.quickSuggestions": { + "other": "on" + } + }, + "java.inlayHints.parameterNames.exclusions": [] +} \ No newline at end of file diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java index 3df2697d1..c2733c2eb 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java @@ -156,9 +156,17 @@ public CompletableFuture openMappings(MappingFormat format, Path path) { EntryTree mappings; if (useMappingIo) { + String loadingMessage; + if (format.getMappingIoCounterpart().hasSingleFile()) { + loadingMessage = I18n.translate("progress.mappings.loading_file"); + } else { + loadingMessage = I18n.translate("progress.mappings.loading_directory"); + } + + progress.init(1, loadingMessage); MemoryMappingTree mappingTree = new MemoryMappingTree(); MappingReader.read(path, format.getMappingIoCounterpart(), mappingTree); - mappings = MappingIoConverter.fromMappingIo(mappingTree); + mappings = MappingIoConverter.fromMappingIo(mappingTree, progress); } else { mappings = format.read(path, progress, saveParameters); } @@ -218,10 +226,13 @@ public CompletableFuture saveMappings(Path path, MappingFormat format) { loadedMappingPath = path; if (useMappingIo) { - MemoryMappingTree mappingTree = MappingIoConverter.toMappingIo(mapper.getObfToDeobf()); + MemoryMappingTree mappingTree = MappingIoConverter.toMappingIo(mapper.getObfToDeobf(), progress); + + progress.init(1, I18n.translate("progress.mappings.writing")); MappingWriter writer = MappingWriter.create(path, format.getMappingIoCounterpart()); mappingTree.accept(writer); writer.close(); + progress.step(1, I18n.translate("progress.done")); } else if (saveAll) { format.write(mapper.getObfToDeobf(), path, progress, saveParameters); } else { diff --git a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingIoConverter.java b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingIoConverter.java index 54cb11ed4..9e5db1063 100644 --- a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingIoConverter.java +++ b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingIoConverter.java @@ -12,7 +12,7 @@ import net.fabricmc.mappingio.tree.MappingTree.FieldMapping; import net.fabricmc.mappingio.tree.MappingTree.MethodArgMapping; import net.fabricmc.mappingio.tree.MappingTree.MethodMapping; - +import cuchaz.enigma.ProgressListener; import cuchaz.enigma.translation.mapping.EntryMap; import cuchaz.enigma.translation.mapping.EntryMapping; import cuchaz.enigma.translation.mapping.tree.EntryTree; @@ -25,16 +25,22 @@ import cuchaz.enigma.translation.representation.entry.FieldEntry; import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; import cuchaz.enigma.translation.representation.entry.MethodEntry; +import cuchaz.enigma.utils.I18n; public class MappingIoConverter { - public static MemoryMappingTree toMappingIo(EntryTree mappings) { + public static MemoryMappingTree toMappingIo(EntryTree mappings, ProgressListener progress) { List> classes = StreamSupport.stream(mappings.spliterator(), false) .filter(node -> node.getEntry() instanceof ClassEntry) .toList(); + + progress.init(classes.size(), I18n.translate("progress.mappings.converting.to_mappingio")); + int steps = 0; + MemoryMappingTree mappingTree = new MemoryMappingTree(); mappingTree.visitNamespaces("intermediary", Arrays.asList("named")); for (EntryTreeNode classNode : classes) { + progress.step(steps++, classNode.getEntry().getFullName()); writeClass(classNode, mappings, mappingTree); } @@ -134,10 +140,13 @@ private static void writeMethodArg(EntryTreeNode methodArgNode, Me mappingTree.visitComment(MappedElementKind.METHOD_ARG, methodArgMapping.javadoc()); } - public static EntryTree fromMappingIo(MemoryMappingTree mappingTree) { + public static EntryTree fromMappingIo(MemoryMappingTree mappingTree, ProgressListener progress) { EntryTree dstMappingTree = new HashEntryTree<>(); + progress.init(mappingTree.getClasses().size(), I18n.translate("progress.mappings.converting.from_mappingio")); + int steps = 0; for (ClassMapping classMapping : mappingTree.getClasses()) { + progress.step(steps++, classMapping.getDstName(0) != null ? classMapping.getDstName(0) : classMapping.getSrcName()); readClass(classMapping, dstMappingTree); } diff --git a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/enigma/EnigmaMappingsReader.java b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/enigma/EnigmaMappingsReader.java index 1f8b75583..efa32b9fb 100644 --- a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/enigma/EnigmaMappingsReader.java +++ b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/enigma/EnigmaMappingsReader.java @@ -39,12 +39,12 @@ public enum EnigmaMappingsReader implements MappingsReader { FILE { @Override public EntryTree read(Path path, ProgressListener progress, MappingSaveParameters saveParameters) throws IOException, MappingParseException { - progress.init(1, I18n.translate("progress.mappings.enigma_file.loading")); + progress.init(1, I18n.translate("progress.mappings.loading_file")); EntryTree mappings = new HashEntryTree<>(); readFile(path, mappings); - progress.step(1, I18n.translate("progress.mappings.enigma_file.done")); + progress.step(1, I18n.translate("progress.done")); return mappings; } @@ -56,7 +56,7 @@ public EntryTree read(Path root, ProgressListener progress, Mappin List files = Files.walk(root).filter(f -> !Files.isDirectory(f)).filter(f -> f.toString().endsWith(".mapping")).toList(); - progress.init(files.size(), I18n.translate("progress.mappings.enigma_directory.loading")); + progress.init(files.size(), I18n.translate("progress.mappings.loading_directory")); int step = 0; for (Path file : files) { @@ -98,7 +98,7 @@ public static EntryTree readFiles(ProgressListener progress, Path. throw new IllegalArgumentException("No paths to read mappings from"); } - progress.init(paths.length, I18n.translate("progress.mappings.enigma_directory.loading")); + progress.init(paths.length, I18n.translate("progress.mappings.loading_directory")); int step = 0; for (Path file : paths) { diff --git a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/enigma/EnigmaMappingsWriter.java b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/enigma/EnigmaMappingsWriter.java index cd00ef772..13a6a2411 100644 --- a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/enigma/EnigmaMappingsWriter.java +++ b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/enigma/EnigmaMappingsWriter.java @@ -57,7 +57,7 @@ public enum EnigmaMappingsWriter implements MappingsWriter { public void write(EntryTree mappings, MappingDelta delta, Path path, ProgressListener progress, MappingSaveParameters saveParameters) { Collection classes = mappings.getRootNodes().filter(entry -> entry.getEntry() instanceof ClassEntry).map(entry -> (ClassEntry) entry.getEntry()).toList(); - progress.init(classes.size(), I18n.translate("progress.mappings.enigma_file.writing")); + progress.init(classes.size(), I18n.translate("progress.mappings.writing")); int steps = 0; @@ -78,7 +78,7 @@ public void write(EntryTree mappings, MappingDelta d applyDeletions(path, changedClasses, mappings, delta.getBaseMappings(), saveParameters.getFileNameFormat()); - progress.init(changedClasses.size(), I18n.translate("progress.mappings.enigma_directory.writing")); + progress.init(changedClasses.size(), I18n.translate("progress.mappings.writing")); AtomicInteger steps = new AtomicInteger(); diff --git a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/srg/SrgMappingsWriter.java b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/srg/SrgMappingsWriter.java index 4621efef9..5addcade4 100644 --- a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/srg/SrgMappingsWriter.java +++ b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/srg/SrgMappingsWriter.java @@ -45,7 +45,7 @@ public void write(EntryTree mappings, MappingDelta d List methodLines = new ArrayList<>(); List> rootEntries = Lists.newArrayList(mappings).stream().map(EntryTreeNode::getEntry).toList(); - progress.init(rootEntries.size(), I18n.translate("progress.mappings.srg_file.generating")); + progress.init(rootEntries.size(), I18n.translate("progress.mappings.converting")); int steps = 0; @@ -54,7 +54,7 @@ public void write(EntryTree mappings, MappingDelta d writeEntry(classLines, fieldLines, methodLines, mappings, entry); } - progress.init(3, I18n.translate("progress.mappings.srg_file.writing")); + progress.init(3, I18n.translate("progress.mappings.writing")); try (PrintWriter writer = new LfPrintWriter(Files.newBufferedWriter(path))) { progress.step(0, I18n.translate("type.classes")); diff --git a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/tiny/TinyMappingsReader.java b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/tiny/TinyMappingsReader.java index e08c86739..f7ff7ccd2 100644 --- a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/tiny/TinyMappingsReader.java +++ b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/tiny/TinyMappingsReader.java @@ -35,7 +35,7 @@ private EntryTree read(Path path, List lines, ProgressList EntryTree mappings = new HashEntryTree<>(); lines.remove(0); - progress.init(lines.size(), I18n.translate("progress.mappings.tiny_file.loading")); + progress.init(lines.size(), I18n.translate("progress.mappings.loading_file")); for (int lineNumber = 0; lineNumber < lines.size(); lineNumber++) { progress.step(lineNumber, ""); diff --git a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/tinyv2/TinyV2Reader.java b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/tinyv2/TinyV2Reader.java index 61bc41da7..f98526dfd 100644 --- a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/tinyv2/TinyV2Reader.java +++ b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/tinyv2/TinyV2Reader.java @@ -46,7 +46,7 @@ public EntryTree read(Path path, ProgressListener progress, Mappin private EntryTree read(Path path, List lines, ProgressListener progress) throws MappingParseException { EntryTree mappings = new HashEntryTree<>(); - progress.init(lines.size(), "progress.mappings.tiny_v2.loading"); + progress.init(lines.size(), "progress.mappings.loading_file"); BitSet state = new BitSet(STATE_SIZE); @SuppressWarnings({"unchecked", "rawtypes"}) MappingPair, RawEntryMapping>[] holds = new MappingPair[STATE_SIZE]; diff --git a/enigma/src/main/resources/lang/en_us.json b/enigma/src/main/resources/lang/en_us.json index 4ec2f087e..b0fab3a4c 100644 --- a/enigma/src/main/resources/lang/en_us.json +++ b/enigma/src/main/resources/lang/en_us.json @@ -132,6 +132,7 @@ "log_panel.messages": "Messages", "log_panel.users": "Users", + "progress.done": "Done!", "progress.operation": "%s - Operation in progress", "progress.jar.indexing": "Indexing jar", "progress.jar.indexing.entries": "Entries...", @@ -142,15 +143,12 @@ "progress.sources.writing": "Writing sources...", "progress.classes.deobfuscating": "Deobfuscating classes...", "progress.classes.decompiling": "Decompiling classes...", - "progress.mappings.enigma_file.loading": "Loading mapping file", - "progress.mappings.enigma_file.done": "Done!", - "progress.mappings.enigma_file.writing": "Writing classes", - "progress.mappings.enigma_directory.loading": "Loading mapping files", - "progress.mappings.enigma_directory.writing": "Writing classes", - "progress.mappings.tiny_file.loading": "Loading mapping file", - "progress.mappings.tiny_v2.loading": "Loading mapping file", - "progress.mappings.srg_file.generating": "Generating mappings", - "progress.mappings.srg_file.writing": "Writing mappings", + "progress.mappings.loading_file": "Loading mapping file", + "progress.mappings.loading_directory": "Loading mapping files", + "progress.mappings.writing": "Writing classes", + "progress.mappings.converting": "Converting mappings", + "progress.mappings.converting.to_mappingio": "Converting to mapping-io", + "progress.mappings.converting.from_mappingio": "Converting from mapping-io", "progress.stats": "Generating stats", "progress.stats.data": "Generating data", diff --git a/enigma/src/main/resources/lang/fr_fr.json b/enigma/src/main/resources/lang/fr_fr.json index d3d0c2976..520dd32e6 100644 --- a/enigma/src/main/resources/lang/fr_fr.json +++ b/enigma/src/main/resources/lang/fr_fr.json @@ -131,6 +131,7 @@ "log_panel.messages": "Messages", "log_panel.users": "Utilisateurs", + "progress.done": "Terminé !", "progress.operation": "%s - Opération en cours", "progress.jar.indexing": "Indexation du jar", "progress.jar.indexing.entries": "Entrées...", @@ -141,15 +142,10 @@ "progress.sources.writing": "Écriture des sources...", "progress.classes.deobfuscating": "Déobfuscation des classes...", "progress.classes.decompiling": "Décompilation des classes...", - "progress.mappings.enigma_file.loading": "Chargement du fichier de mappings", - "progress.mappings.enigma_file.done": "Terminé !", - "progress.mappings.enigma_file.writing": "Écriture des classes", - "progress.mappings.enigma_directory.loading": "Chargement des fichiers de mappings", - "progress.mappings.enigma_directory.writing": "Écriture des classes", - "progress.mappings.tiny_file.loading": "Chargement du fichier de mappings", - "progress.mappings.tiny_v2.loading": "Chargement du fichier de mappings", - "progress.mappings.srg_file.generating": "Génération des mappings", - "progress.mappings.srg_file.writing": "Écriture des mappings", + "progress.mappings.loading_file": "Chargement du fichier de mappings", + "progress.mappings.loading_directory": "Chargement des fichiers de mappings", + "progress.mappings.writing": "Écriture des mappings", + "progress.mappings.converting": "Conversion des mappings", "progress.stats": "Génération des statistiques", "progress.stats.data": "Génération des données", diff --git a/enigma/src/main/resources/lang/ja_jp.json b/enigma/src/main/resources/lang/ja_jp.json index 09e7ee08b..b4d519987 100644 --- a/enigma/src/main/resources/lang/ja_jp.json +++ b/enigma/src/main/resources/lang/ja_jp.json @@ -132,6 +132,7 @@ "log_panel.messages": "メッセージ", "log_panel.users": "ユーザー", + "progress.done": "完了しました!", "progress.operation": "%s - 処理中", "progress.jar.indexing": "jarのインデックス中", "progress.jar.indexing.entries": "エントリー...", @@ -142,15 +143,9 @@ "progress.sources.writing": "ソースコードを書き出し中...", "progress.classes.deobfuscating": "クラスを難読化解除中...", "progress.classes.decompiling": "クラスのデコンパイル中...", - "progress.mappings.enigma_file.loading": "マッピングファイルをロード", - "progress.mappings.enigma_file.done": "完了しました!", - "progress.mappings.enigma_file.writing": "クラスの書き出し中", - "progress.mappings.enigma_directory.loading": "マッピングファイルの読込中", - "progress.mappings.enigma_directory.writing": "クラスの書き出し中", - "progress.mappings.tiny_file.loading": "マッピングファイルの読込中", - "progress.mappings.tiny_v2.loading": "マッピングファイルの読込中", - "progress.mappings.srg_file.generating": "マッピングの作成中", - "progress.mappings.srg_file.writing": "マッピングの書き出し中", + "progress.mappings.loading_file": "マッピングファイルをロード", + "progress.mappings.loading_directory": "マッピングファイルの読込中", + "progress.mappings.writing": "マッピングの書き出し中", "progress.stats": "統計情報を作成中", "progress.stats.data": "データの作成中", diff --git a/enigma/src/main/resources/lang/zh_cn.json b/enigma/src/main/resources/lang/zh_cn.json index fe806fb37..dbc6dd33d 100644 --- a/enigma/src/main/resources/lang/zh_cn.json +++ b/enigma/src/main/resources/lang/zh_cn.json @@ -75,6 +75,7 @@ "info_panel.tree.implementations": "实现", "info_panel.tree.calls": "调用图", + "progress.done": "完成!", "progress.operation": "%s - 进行中", "progress.jar.indexing": "索引 Jar", "progress.jar.indexing.entries": "条目...", @@ -85,15 +86,9 @@ "progress.sources.writing": "写出源码中...", "progress.classes.deobfuscating": "反混淆类中...", "progress.classes.decompiling": "反编译类中...", - "progress.mappings.enigma_file.loading": "加载映射文件", - "progress.mappings.enigma_file.done": "完成!", - "progress.mappings.enigma_file.writing": "写入类", - "progress.mappings.enigma_directory.loading": "加载映射文件", - "progress.mappings.enigma_directory.writing": "写入类", - "progress.mappings.tiny_file.loading": "加载映射文件", - "progress.mappings.tiny_v2.loading": "加载映射文件", - "progress.mappings.srg_file.generating": "生成映射", - "progress.mappings.srg_file.writing": "写出映射", + "progress.mappings.loading_file": "加载映射文件", + "progress.mappings.loading_directory": "加载映射文件", + "progress.mappings.writing": "写出映射", "progress.stats": "生成统计范围", "progress.stats.data": "生成数据",