From f50e11626ce7bf1b638da3f24370705b65510970 Mon Sep 17 00:00:00 2001 From: Rupert Wood Date: Tue, 1 Dec 2015 00:11:21 +0000 Subject: [PATCH 1/2] Don't repeat class & version mismatch warnings from the same instance of TypeTreeDatabase. Also adds a new warning here for 'no matches', also once per class per version per instance. --- .../info/ata4/unity/util/TypeTreeDatabase.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/disunity-core/src/main/java/info/ata4/unity/util/TypeTreeDatabase.java b/disunity-core/src/main/java/info/ata4/unity/util/TypeTreeDatabase.java index 0f078c4f..e7267045 100644 --- a/disunity-core/src/main/java/info/ata4/unity/util/TypeTreeDatabase.java +++ b/disunity-core/src/main/java/info/ata4/unity/util/TypeTreeDatabase.java @@ -54,6 +54,7 @@ public class TypeTreeDatabase { private final List entries = new ArrayList<>(); private final Map, TypeTreeDatabaseEntry> entryMap = new HashMap<>(); + private final Set> warnedMatches = new HashSet<>(); private Path dbFile; public TypeTreeDatabase() { @@ -233,7 +234,8 @@ public Set getNodeSet() { public TypeTreeDatabaseEntry getEntry(UnityClass unityClass, UnityVersion unityVersion, boolean exact) { // search for exact matches - TypeTreeDatabaseEntry entryA = entryMap.get(new ImmutablePair<>(unityClass, unityVersion)); + Pair classAndVersion = new ImmutablePair<>(unityClass, unityVersion); + TypeTreeDatabaseEntry entryA = entryMap.get(classAndVersion); if (entryA != null) { return entryA; } @@ -273,17 +275,27 @@ public TypeTreeDatabaseEntry getEntry(UnityClass unityClass, UnityVersion unityV // return less perfect match if (entryB != null) { - L.log(Level.WARNING, "Unprecise match for class {0} (required: {1}, available: {2})", new Object[]{unityClass, unityVersion, versionB}); + if (!warnedMatches.contains(classAndVersion)) { + L.log(Level.WARNING, "Unprecise match for class {0} (required: {1}, available: {2})", new Object[]{unityClass, unityVersion, versionB}); + warnedMatches.add(classAndVersion); + } return entryB; } // return field node from any revision as the very last resort if (entryC != null) { - L.log(Level.WARNING, "Bad match for class {0} (required: {1}, available: {2})", new Object[]{unityClass, unityVersion, versionC}); + if (!warnedMatches.contains(classAndVersion)) { + L.log(Level.WARNING, "Bad match for class {0} (required: {1}, available: {2})", new Object[]{unityClass, unityVersion, versionC}); + warnedMatches.add(classAndVersion); + } return entryC; } // no matches at all + if (!warnedMatches.contains(classAndVersion)) { + L.log(Level.WARNING, "No match for class {0} (required: {1})", new Object[]{unityClass, unityVersion}); + warnedMatches.add(classAndVersion); + } return null; } From 68c92fb1cfb728bbb8a05ea119b74e11a6e12a07 Mon Sep 17 00:00:00 2001 From: Rupert Wood Date: Tue, 1 Dec 2015 00:31:02 +0000 Subject: [PATCH 2/2] Fix bundle-extract .json with no output specified which fails by default because outDir.getParent() is null. --- .../main/java/info/ata4/unity/assetbundle/AssetBundleUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disunity-core/src/main/java/info/ata4/unity/assetbundle/AssetBundleUtils.java b/disunity-core/src/main/java/info/ata4/unity/assetbundle/AssetBundleUtils.java index eb41bb22..3b1d4c65 100644 --- a/disunity-core/src/main/java/info/ata4/unity/assetbundle/AssetBundleUtils.java +++ b/disunity-core/src/main/java/info/ata4/unity/assetbundle/AssetBundleUtils.java @@ -88,7 +88,7 @@ public static void extract(Path file, Path outDir, Progress progress) throws IOE } String bundleName = outDir.getFileName().toString(); - Path propsFile = outDir.getParent().resolve(bundleName + ".json"); + Path propsFile = outDir.resolveSibling(bundleName + ".json"); writePropertiesFile(propsFile, assetBundle); }