From b23d38e24100849e2e2ccbd894fcd3d4f6476ebc Mon Sep 17 00:00:00 2001 From: patchzyy <64382339+patchzyy@users.noreply.github.com> Date: Sun, 18 Oct 2026 18:02:44 +0200 Subject: [PATCH] fail on unusable native index without sources, create assets dir before marker delete --- Launcher/WiiCompiled.Setup.Linux/DiscTool.cs | 1 + translator/src/Translator.Core/RuntimeNativeIndex.cs | 3 +++ translator/tests/Translator.Tests/RuntimeNativeIndexTests.cs | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/Launcher/WiiCompiled.Setup.Linux/DiscTool.cs b/Launcher/WiiCompiled.Setup.Linux/DiscTool.cs index b2b1d73..4b0cab0 100644 --- a/Launcher/WiiCompiled.Setup.Linux/DiscTool.cs +++ b/Launcher/WiiCompiled.Setup.Linux/DiscTool.cs @@ -41,6 +41,7 @@ internal static class DiscTool // time, so it has to survive past this install (see Program.cs, which points dvd_root here). reporter.Progress(InstallStages.ExtractDisc, "Extracting the disc image", 4); var dataDir = Path.Combine(assetsDirectory, "DATA"); + Directory.CreateDirectory(assetsDirectory); File.Delete(Path.Combine(assetsDirectory, ExtractionMarker)); if (Directory.Exists(dataDir)) Directory.Delete(dataDir, recursive: true); await RunExtractAsync(nodTool, isoPath, dataDir, cancellationToken); diff --git a/translator/src/Translator.Core/RuntimeNativeIndex.cs b/translator/src/Translator.Core/RuntimeNativeIndex.cs index 01acd6d..2575d08 100644 --- a/translator/src/Translator.Core/RuntimeNativeIndex.cs +++ b/translator/src/Translator.Core/RuntimeNativeIndex.cs @@ -87,6 +87,9 @@ public static class RuntimeNativeIndexBuilder : null; if (RuntimeNativeIndexFile.TryLoad(indexPath, expectedDigest, out var index, out var reason)) return index; + if (expectedDigest is null) + throw new InvalidOperationException( + $"The native index {indexPath} is unusable ({reason}) and the native sources it describes are missing: {sourceRoot}"); diagnostics?.WriteLine($"[translator] ignoring native index {indexPath} ({reason}); scanning {sourceRoot}"); return Build(sourceRoot); diff --git a/translator/tests/Translator.Tests/RuntimeNativeIndexTests.cs b/translator/tests/Translator.Tests/RuntimeNativeIndexTests.cs index 595d97f..4772a34 100644 --- a/translator/tests/Translator.Tests/RuntimeNativeIndexTests.cs +++ b/translator/tests/Translator.Tests/RuntimeNativeIndexTests.cs @@ -149,6 +149,10 @@ public sealed class RuntimeNativeIndexTests AssertIndexEqual(built, RuntimeNativeIndexBuilder.Resolve(sources, indexPath, diagnostics)); Assert.Equal("", diagnostics.ToString()); Assert.Empty(RuntimeNativeIndexBuilder.Build(sources).Registrations); + + File.WriteAllText(indexPath, "{}"); + Assert.Throws( + () => RuntimeNativeIndexBuilder.Resolve(sources, indexPath, diagnostics)); } finally {