mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 08:00:25 +02:00
Quest: address flavor safety review
This commit is contained in:
1 parent
6e6406c200
commit
02dd9bf8cc
15 files changed
+162
-67
No files matched your search
@@ -74,7 +74,7 @@ internal sealed class QuestBuildService
|
||||
var kitDirectory = Path.Combine(questRoot, "kit");
|
||||
_reporter.Progress(InstallStages.QuestKit, "Reading the game kit from the Quest app...", 2);
|
||||
var kit = ExtractKit(apkPath, kitDirectory, cancellationToken);
|
||||
_reporter.Diagnostic($"Quest game kit {kit.Fingerprint} [{string.Join(", ", kit.Products)}]");
|
||||
_reporter.Diagnostic($"Quest game kit {kit.Fingerprint} [{string.Join(", ", kit.Products)}, CPU {kit.AndroidCpu}]");
|
||||
if (!kit.Products.Contains(product))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
@@ -185,7 +185,7 @@ internal sealed class QuestBuildService
|
||||
File.Exists(Path.Combine(directory, "sys", "main.dol"));
|
||||
|
||||
/// <summary>What the extracted kit says it builds: its fingerprint and the products it carries.</summary>
|
||||
internal sealed record Kit(string Fingerprint, IReadOnlyCollection<string> Products);
|
||||
internal sealed record Kit(string Fingerprint, string AndroidCpu, IReadOnlyCollection<string> Products);
|
||||
|
||||
/// <summary>Extracts <c>assets/game_kit</c> from the Quest app's APK and reads what it is for.</summary>
|
||||
internal static Kit ExtractKit(string apkPath, string destination, CancellationToken cancellationToken)
|
||||
@@ -219,11 +219,16 @@ internal sealed class QuestBuildService
|
||||
{
|
||||
throw new InvalidDataException("The Quest app's game kit has no fingerprint.");
|
||||
}
|
||||
if (!document.RootElement.TryGetProperty("androidCpu", out var androidCpu) ||
|
||||
androidCpu.ValueKind != JsonValueKind.String || string.IsNullOrWhiteSpace(androidCpu.GetString()))
|
||||
{
|
||||
throw new InvalidDataException("The Quest app's game kit has no Android CPU target.");
|
||||
}
|
||||
var products = document.RootElement.TryGetProperty("products", out var value) &&
|
||||
value.ValueKind == JsonValueKind.Object
|
||||
? value.EnumerateObject().Select(property => property.Name).ToArray()
|
||||
: throw new InvalidDataException("The Quest app's game kit lists no games it can build.");
|
||||
return new Kit(fingerprint.GetString()!, products);
|
||||
return new Kit(fingerprint.GetString()!, androidCpu.GetString()!, products);
|
||||
}
|
||||
|
||||
private async Task<Toolchain> EnsureToolchainAsync(string questRoot, CancellationToken cancellationToken)
|
||||
|
||||
@@ -384,14 +384,14 @@ internal static class SelfTests
|
||||
using var writer = new StreamWriter(zip.CreateEntry(name).Open());
|
||||
writer.Write(text);
|
||||
}
|
||||
Add("assets/game_kit/kit.json", "{\"schema\":3,\"fingerprint\":\"abc123\",\"products\":{\"base\":{},\"retro_rewind\":{}}}");
|
||||
Add("assets/game_kit/kit.json", "{\"schema\":3,\"fingerprint\":\"abc123\",\"androidCpu\":\"kryo\",\"products\":{\"base\":{},\"retro_rewind\":{}}}");
|
||||
Add("assets/game_kit/include/memory.h", "#pragma once");
|
||||
Add("assets/runtime_resources/dsp_coef.bin", "not the kit");
|
||||
Add("lib/arm64-v8a/libSDL3.so", "not the kit");
|
||||
}
|
||||
var kit = Path.Combine(temp, "kit");
|
||||
var extracted = QuestBuildService.ExtractKit(apk, kit, CancellationToken.None);
|
||||
if (extracted.Fingerprint != "abc123" || !extracted.Products.Contains("base") ||
|
||||
if (extracted.Fingerprint != "abc123" || extracted.AndroidCpu != "kryo" || !extracted.Products.Contains("base") ||
|
||||
!extracted.Products.Contains("retro_rewind"))
|
||||
throw new Exception("The kit fingerprint or its games were not read.");
|
||||
if (!File.Exists(Path.Combine(kit, "include", "memory.h")) ||
|
||||
|
||||
Reference in new issue
Block a user