diff --git a/src/dumper/dumper.cs b/src/dumper/dumper.cs index 6adc179..4eefae6 100644 --- a/src/dumper/dumper.cs +++ b/src/dumper/dumper.cs @@ -268,15 +268,32 @@ class Dumper string relativeOutPath = outPath.TrimStart('/', '\\'); string fullPath = Path.Combine(_outDir, relativeOutPath, fileName); - // consider umg path for icons (should i also do this with perks and offerings n stuff?) if (cleanPath.StartsWith("UI/Icons/")) cleanPath = "/Game/UI/UMGAssets/" + cleanPath["UI/".Length..]; if (File.Exists(fullPath)) return; if (_provider == null) return; + // special thanks to whichever dev kept fucking up the casing + if (!_provider.TryLoadPackage(cleanPath, out IPackage? package)) + { + _log.Verbose("Failed exact path match for {0}. Attempting case-insensitive search", cleanPath); - if (_provider.TryLoadPackage(cleanPath, out IPackage? package)) + string searchSuffix = cleanPath; + + if (searchSuffix.StartsWith("/Game/")) + searchSuffix = searchSuffix["/Game/".Length..]; + + if (!searchSuffix.EndsWith(".uasset")) + searchSuffix += ".uasset"; + + var actualFile = _provider.Files.FirstOrDefault(kvp => kvp.Key.EndsWith(searchSuffix, StringComparison.OrdinalIgnoreCase)); + if (actualFile.Value != null) + _provider.TryLoadPackage(actualFile.Value, out package); + } + + + if (package != null) { UTexture2D? texture = package.GetExports().OfType().FirstOrDefault(); @@ -295,9 +312,13 @@ class Dumper File.WriteAllBytes(fullPath, bytes); _log.Verbose("Exported icon: {0}", fileName); } + else + throw new InvalidDataException("Bitmap was invalid"); } else throw new FileNotFoundException("Failed to find texture"); } + else + throw new FileNotFoundException("Failed to find texture package"); } }