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

@@ -118,7 +118,7 @@ public sealed class Benchmark : IBenchmarkRunner
if (target != null && ctx.AllowedForGame(target))
{
if (backup == "none") File.Delete(target);
else if (backup != null && File.Exists(backup)) File.Copy(backup, target, true);
else if (backup != null && File.Exists(backup)) BenchIni.Restore(backup, target);
ctx.Log.Write("benchmark: the options file put back after a cut-off run: " + target);
}
File.Delete(Marker);
@@ -251,7 +251,7 @@ public sealed class Benchmark : IBenchmarkRunner
{
try
{
if (hadOptions) File.Copy(backup, ini, true); else if (File.Exists(ini)) File.Delete(ini);
if (hadOptions) BenchIni.Restore(backup, ini); else if (File.Exists(ini)) File.Delete(ini);
File.Delete(Marker);
}
catch (Exception e) { ctx.Log.Write("benchmark: putting the options back: " + e.Message); }
@@ -374,8 +374,9 @@ public sealed class Benchmark : IBenchmarkRunner
var tested = run.Scenes.Where(p => p.Helpers != null).ToList();
if (tested.Count == 0) return "";
static string Pct(HelperHalves h) => (h.OnFps / h.OffFps - 1).ToString("+0%;-0%;0%", CultureInfo.InvariantCulture);
var faster = tested.Where(p => p.Helpers!.Verdict == 1).Select(p => p.Place + " " + Pct(p.Helpers!)).ToList();
var slower = tested.Where(p => p.Helpers!.Verdict == -1).Select(p => p.Place + " " + Pct(p.Helpers!)).ToList();
// ((Triforce, 11-26) the verdict is HTML on the page: the places' names, read from the game's results file, encoded)
var faster = tested.Where(p => p.Helpers!.Verdict == 1).Select(p => Html(p.Place) + " " + Pct(p.Helpers!)).ToList();
var slower = tested.Where(p => p.Helpers!.Verdict == -1).Select(p => Html(p.Place) + " " + Pct(p.Helpers!)).ToList();
var s = $" With the {threads} replay helper threads on: ";
if (faster.Count == tested.Count) return s + $"faster everywhere ({string.Join(", ", faster)}).";
if (faster.Count == 0)
@@ -386,7 +387,9 @@ public sealed class Benchmark : IBenchmarkRunner
/// <summary>((Triforce, 11-19) the verdict's note for places left out ("" when none)</summary>
public static string SkippedNote(IReadOnlyList<string> skipped) => skipped.Count == 0 ? ""
: " " + string.Join(" and ", skipped) + (skipped.Count == 1 ? " was" : " were") + " left out: the game would not take Link there from your save.";
: " " + string.Join(" and ", skipped.Select(Html)) + (skipped.Count == 1 ? " was" : " were") + " left out: the game would not take Link there from your save.";
static string Html(string? s) => System.Net.WebUtility.HtmlEncode(s ?? "");
public static string Summary(IReadOnlyList<PlaceResult> p1, IReadOnlyList<PlaceResult>? p2, string? second)
{
@@ -396,8 +399,8 @@ public sealed class Benchmark : IBenchmarkRunner
if (p2 != null && second != null)
{
var w2 = p2.Min(r => r.OnePercentLow);
s += w2 >= w1 * 1.15 ? $" With {second} the slowest place holds {w2:0}, so it is worth turning on."
: $" {second} changed little here ({w2:0}), so it stays as it is.";
s += w2 >= w1 * 1.15 ? $" With {Html(second)} the slowest place holds {w2:0}, so it is worth turning on."
: $" {Html(second)} changed little here ({w2:0}), so it stays as it is.";
}
return s;
}
@@ -453,15 +456,34 @@ public static class BenchIni
return d;
}
/// <summary>((Triforce, 11-26) Every line of a key set, not only the first: the game reads the last one, so with a key twice the
/// value set was not the one used. The file's bytes kept as they are (Latin-1 round-trips every byte, as GameOptionsFile reads
/// it) and its line ends too.</summary>
public static void Set(string path, IReadOnlyDictionary<string, int> keys)
{
var lines = File.Exists(path) ? File.ReadAllLines(path).ToList() : new List<string>();
var left = new Dictionary<string, int>(keys);
var text = File.Exists(path) ? File.ReadAllText(path, Encoding.Latin1) : "";
var nl = text.Contains("\r\n", StringComparison.Ordinal) ? "\r\n" : "\n";
var lines = text.Length == 0 ? new List<string>() : text.Replace("\r\n", "\n", StringComparison.Ordinal).Split('\n').ToList();
if (lines.Count > 0 && lines[^1].Length == 0) lines.RemoveAt(lines.Count - 1);
var done = new HashSet<string>(StringComparer.Ordinal);
for (var n = 0; n < lines.Count; n++)
if (lines[n].IndexOf('=') is var i and > 0 && left.Remove(lines[n][..i].Trim(), out var v)) lines[n] = lines[n][..i].Trim() + "=" + v.ToString(CultureInfo.InvariantCulture);
foreach (var (k, v) in left) lines.Add(k + "=" + v.ToString(CultureInfo.InvariantCulture));
if (lines[n].IndexOf('=') is var i and > 0 && lines[n][..i].Trim() is var k && keys.TryGetValue(k, out var v))
{
lines[n] = k + "=" + v.ToString(CultureInfo.InvariantCulture);
done.Add(k);
}
foreach (var (k, v) in keys) if (!done.Contains(k)) lines.Add(k + "=" + v.ToString(CultureInfo.InvariantCulture));
var fresh = path + ".new";
File.WriteAllText(fresh, string.Join("\n", lines) + "\n");
File.WriteAllText(fresh, string.Join(nl, lines) + nl, Encoding.Latin1);
File.Move(fresh, path, true);
}
/// <summary>((Triforce, 11-26) A backup put back in one step (through .new, then a move): a copy cut off half way left the
/// options file half written.</summary>
public static void Restore(string backup, string path)
{
var fresh = path + ".new";
File.Copy(backup, fresh, true);
File.Move(fresh, path, true);
}
}