Triforce v0.8.5

A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-28 10:54:41 -06:00
parent 2df08c751e
commit b527e29adb
203 changed files with 18821 additions and 2051 deletions

View File

@@ -110,6 +110,8 @@ public sealed class WinHost : IHost
// Only our own page lives in this window; a link elsewhere opens in the player's browser.
if (!e.Uri.StartsWith(Origin, StringComparison.OrdinalIgnoreCase)) { e.Cancel = true; OpenUrl(e.Uri); }
};
// ((Triforce, 11-26) no frame of another site inside the page: the page has none, and one could post messages)
web.FrameNavigationStarting += (_, e) => { if (!e.Uri.StartsWith(Origin, StringComparison.OrdinalIgnoreCase)) e.Cancel = true; };
web.ProcessFailed += (_, e) => Log.Write("webview process failed: " + e.ProcessFailedKind);
web.Navigate(Origin + "ui/index.html" + Environment.GetEnvironmentVariable("TRIFORCE_START"));
ctl.MoveFocus(CoreWebView2MoveFocusReason.Programmatic);
@@ -122,17 +124,28 @@ public sealed class WinHost : IHost
}
}
/// <summary>((Triforce, 11-26) What the page may load and run: its own scripts only (no inline script, no eval), styles of its
/// own and inline ones (style attributes), pictures of its own and over https (GameBanana's), no frames, no plugins. A text
/// that got into the page unescaped then cannot run a script, nor load one.</summary>
const string Csp = "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; " +
"media-src 'self' blob: data:; font-src 'self' data:; connect-src 'self'; object-src 'none'; frame-src 'none'; " +
"base-uri 'none'; form-action 'none'";
void OnRequest(object? sender, CoreWebView2WebResourceRequestedEventArgs e)
{
var path = new Uri(e.Request.Uri).AbsolutePath;
var got = content.Get(path);
// (no Access-Control-Allow-Origin: only the page itself, on this origin, reads what is served here)
e.Response = got is { } g
? env!.CreateWebResourceResponse(new MemoryStream(g.data), 200, "OK", "Content-Type: " + g.mime + "\r\nCache-Control: no-store\r\nAccess-Control-Allow-Origin: *")
? env!.CreateWebResourceResponse(new MemoryStream(g.data), 200, "OK", "Content-Type: " + g.mime + "\r\nCache-Control: no-store" +
(g.mime.StartsWith("text/html", StringComparison.OrdinalIgnoreCase) ? "\r\nContent-Security-Policy: " + Csp : ""))
: env!.CreateWebResourceResponse(null, 404, "Not Found", "Cache-Control: no-store");
}
void OnMessage(object? sender, CoreWebView2WebMessageReceivedEventArgs e)
{
// ((Triforce, 11-26) only the launcher's own page speaks to the launcher)
if (!e.Source.StartsWith(Origin, StringComparison.OrdinalIgnoreCase)) { Log.Write("message from " + e.Source + " left out"); return; }
string json;
try { json = e.TryGetWebMessageAsString(); } catch { json = e.WebMessageAsJson; }
var files = new List<string>();