Triforce v0.6.0 "Sage Of Power"

Faster frames (the replay's memory work, held submits, helper threads, collection and capture cuts), the game letting old areas go (QueryMemoryInfo), the 0.5.2 stutter fixed, AMD RX 5000/6000 and integrated-GPU fixes, the GPU device chosen by name, the in-game menus and launcher reworked, controller, Linux and benchmark fixes.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-20 17:06:21 -06:00
parent b0e46adb48
commit 6c7117635c
265 changed files with 26893 additions and 2549 deletions

View File

@@ -33,7 +33,11 @@ public sealed record PlaceResult(string Place, double AverageFps, double OnePerc
}
/// <summary>One benchmark run as the game wrote it.</summary>
public sealed record BenchRun(IReadOnlyList<PlaceResult> Scenes, string? Gpu, bool Stopped, string? Error, TimeSpan Took);
public sealed record BenchRun(IReadOnlyList<PlaceResult> Scenes, string? Gpu, bool Stopped, string? Error, TimeSpan Took)
{
/// <summary>((Triforce, 11-19) the places the game would not take Link to, left out (host/hos_bench.c skip_scene)</summary>
public IReadOnlyList<string> Skipped { get; init; } = Array.Empty<string>();
}
/// <summary>A setting the benchmark would change: its triforce_options.ini key, the menu's row name, the value now and the
/// recommended one (the App shows them with the menu's own labels).</summary>
@@ -72,6 +76,7 @@ public sealed class Benchmark : IBenchmarkRunner
// 3 FSR 3.1, 4 FSR 4. resolution: 3 = 67 % (Quality), 5 = 58 % (Balanced), 4 = 50 % (Performance). quality_preset 0 Custom.
static readonly (int value, int fps)[] Caps = { (0, 60), (2, 120), (3, 144), (5, 240) };
public const int UpGame = 0, UpDlss = 1, UpFsr3 = 3, ResQuality = 3, ResBalanced = 5, CapUncapped = 5;
public const int SteadyRefreshSteps = 2; // (fps_cap.h: 0 Off, 1 Any rate, 2 Refresh steps)
public string WorkFolder => Path.Combine(ctx.WorkFolder, "benchmark");
string Marker => Path.Combine(WorkFolder, "restore.txt");
@@ -156,7 +161,7 @@ public sealed class Benchmark : IBenchmarkRunner
RestoreIfLeft();
var userCopy = Path.Combine(WorkFolder, "user");
if (Directory.Exists(userCopy)) Directory.Delete(userCopy, true);
CopyUser(Path.Combine(game, "user"), userCopy);
CopyUser(ctx.Platform.UserFolder(game), userCopy); // ((Triforce) 11-19: on Linux it is outside the game folder)
var backup = Path.Combine(WorkFolder, "options.backup.ini");
var hadOptions = File.Exists(ini);
if (hadOptions) File.Copy(ini, backup, true);
@@ -238,9 +243,12 @@ public sealed class Benchmark : IBenchmarkRunner
if (s.TryGetProperty("frametimes_ms", out var f)) foreach (var x in f.EnumerateArray()) if (x.TryGetDouble(out var d)) ft.Add(d);
scenes.Add(new PlaceResult(s.TryGetProperty("name", out var n) ? n.GetString() ?? "" : "", D("avg"), D("low1"), false) { Low01 = D("low01"), FrameTimes = ft });
}
var skipped = new List<string>();
if (r.TryGetProperty("skipped", out var sk) && sk.ValueKind == System.Text.Json.JsonValueKind.Array)
foreach (var x in sk.EnumerateArray()) if (x.GetString() is { Length: > 0 } name) skipped.Add(name);
return new BenchRun(scenes, r.TryGetProperty("gpu", out var gpu) ? gpu.GetString() : null,
r.TryGetProperty("stopped", out var st) && st.ValueKind == System.Text.Json.JsonValueKind.True,
r.TryGetProperty("error", out var er) ? er.GetString() : null, took);
r.TryGetProperty("error", out var er) ? er.GetString() : null, took) { Skipped = skipped };
}
/// <summary>The old interface: one run, then the rules (the App runs the upscaler pass on its own, when asked).</summary>
@@ -249,7 +257,7 @@ public sealed class Benchmark : IBenchmarkRunner
var now = BenchIni.Read(OptionsOf(request.GameFolder));
var run = await RunOnceAsync(request.GameFolder, null, progress, token);
var recs = Recommend(now, run.Scenes, null, null, DisplayHz());
return new BenchmarkResult(run.Scenes, null, null, recs, Summary(run.Scenes, null, null), run.Took);
return new BenchmarkResult(run.Scenes, null, null, recs, Summary(run.Scenes, null, null) + SkippedNote(run.Skipped), run.Took);
}
static void CopyUser(string from, string to)
@@ -282,9 +290,11 @@ public sealed class Benchmark : IBenchmarkRunner
foreach (var (value, fps) in Caps)
if (worstLow >= fps && (displayHz <= 0 || fps <= displayHz + 1)) cap = value;
recs.Add(new SettingChange(KCap, "Game frame rate cap", Now(KCap, 0), cap));
// steady frame rate: on where the lows fall under 80 % of the average anywhere
// steady frame rate: on where the lows fall under 80 % of the average anywhere. ((Triforce) 11-19, ticket "screen tearing":
// "Any rate" (1) held 36 fps on an RTX 2060 Max-Q's 60 Hz screen, frames shown for one refresh, then two: uneven, seen as
// tearing. "Refresh steps" (2) holds rates that divide the refresh (60, 30), even on a screen without G-Sync/FreeSync)
var uneven = chosen.Any(r => r.OnePercentLow < r.AverageFps * 0.8);
recs.Add(new SettingChange(KSteady, "Steady frame rate", Now(KSteady, 0), uneven ? 1 : Now(KSteady, 0)));
recs.Add(new SettingChange(KSteady, "Steady frame rate", Now(KSteady, 0), uneven ? SteadyRefreshSteps : Now(KSteady, 0)));
// frame generation: never turned on by this (DESIGN 12: only below 60 with DLSS-G / FSR 4 FG, not measured yet)
recs.Add(new SettingChange(KFrameGen, "Frame generation", Now(KFrameGen, 0), Now(KFrameGen, 0)));
if (recs.Any(r => r.Changes && (r.Key == KUpscaler || r.Key == KResolution)))
@@ -292,6 +302,10 @@ public sealed class Benchmark : IBenchmarkRunner
return recs;
}
/// <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.";
public static string Summary(IReadOnlyList<PlaceResult> p1, IReadOnlyList<PlaceResult>? p2, string? second)
{
var w1 = p1.Min(r => r.OnePercentLow);

View File

@@ -267,6 +267,10 @@ public sealed class GameOptionsFile : IGameOptionValues
write[GameOptionsSchema.ResolutionKey] = (Atoi(dyn) != 0 ? 0 : 1).ToString(CultureInfo.InvariantCulture);
}
foreach (var (k, v) in set) write[k] = v.ToString(CultureInfo.InvariantCulture);
// ((Triforce) 11-20) the GPU device row's card by its name too: the game finds it by the name first, so the number
// counted in Windows' order (no triforce_gpus.txt before the game's first run) no longer picks another card. Auto: empty
if (set.TryGetValue(GameOptionsSchema.GpuKey, out var gpu))
write[GameOptionsSchema.GpuNameKey] = (GameOptionsSchema.GpuNameOf(gpu) ?? "").Replace('\r', ' ').Replace('\n', ' ');
var bump = !exists || !hasVersion || Atoi(vs!) < GameOptionsSchema.CurrentVersion;
if (bump) write[GameOptionsSchema.VersionKey] = GameOptionsSchema.CurrentVersion.ToString(CultureInfo.InvariantCulture);

View File

@@ -36,6 +36,31 @@ public static class GameOptionsSchema
/// <summary>GpuNames from Gpus.List() (this PC's display adapters).</summary>
public static void UseSystemGpus() => GpuNames = () => Gpus.List().Select(g => g.Name).ToList();
/// <summary>((Triforce) 11-19, ticket "GPU read issue") GpuNames as the game counts them: the game folder's
/// triforce_gpus.txt ("&lt;value&gt;\t&lt;name&gt;" lines, gpu/vk/vk_main.cpp pick_device), which the game writes at every
/// start. Windows' order of the display adapters (Gpus.List()) is not Vulkan's on every PC: on a laptop with an Intel UHD
/// 770 and an RTX 3050 the launcher's "1: NVIDIA" saved the value the game reads as the Intel. Without the file (a game
/// that has not started since v0.5.3): Windows' order, as before.</summary>
public static void UseGameGpus(Func<string?> gameFolder) => GpuNames = () =>
{
try
{
if (gameFolder() is { } g && File.Exists(Path.Combine(g, GpuListFile)))
{
var names = new List<string>();
foreach (var line in File.ReadAllLines(Path.Combine(g, GpuListFile)))
{
var tab = line.IndexOf('\t');
if (tab > 0 && int.TryParse(line.AsSpan(0, tab), out var v) && v == names.Count + 1) names.Add(line[(tab + 1)..].Trim());
}
if (names.Count > 0) return names;
}
}
catch (Exception) { }
return Gpus.List().Select(x => x.Name).ToList();
};
public const string GpuListFile = "triforce_gpus.txt";
// ---- the keys ----
/// <summary>vk_menu.cpp ini_key: a few rows keep the keys they were first saved with; every other row's key is its
@@ -134,6 +159,16 @@ public static class GameOptionsSchema
{
try { return GpuNames?.Invoke() ?? Array.Empty<string>(); } catch (Exception) { return Array.Empty<string>(); }
}
/// <summary>((Triforce) 11-20) The GPU device row's card for a value, by the name the row shows for it (GpuNames): what
/// GameOptionsFile.Save writes as gpu_device_name beside the number, so that the game finds the card the player clicked
/// whatever order the list was in (gpu/vk/gpu_choice.h pick). Null for Auto or a value with no name.</summary>
public static string? GpuNameOf(int v)
{
if (v <= 0) return null;
var names = GpuNamesNow();
return v - 1 < names.Count && names[v - 1].Trim() is { Length: > 0 } n ? n : null;
}
public const string GpuNameKey = "gpu_device_name";
/// <summary>tx_mic without the game's device list: Off, Default, and a device by the name the file keeps
/// (microphone_device), "Microphone" without one.</summary>
static string TxMic(int v, IGameOptionValues? o)
@@ -280,7 +315,7 @@ public static class GameOptionsSchema
Row(GameOptionTab.Display, "High dynamic range", "HDR peak brightness", 400, 10000, 100, 1000, GameOptionKind.Slider, TxNits, false, true,
"The brightest highlights with HDR on: set it to your display's peak brightness."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX HDR", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, true, true,
"With HDR set to Native: RenoDX's tone mapping, eye adaptation and colour grading in place of the game's own, and its rows below. Off: the game's own HDR. Applies after a restart. RenoDX is by Carlos Lopez (clshortfuse), under the MIT license."),
"With HDR set to Native: RenoDX's tone mapping, eye adaptation and color grading in place of the game's own, and its rows below. Off: the game's own HDR. Applies after a restart. RenoDX is by Carlos Lopez (clshortfuse), under the MIT license."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX tonemapper", 0, 2, 1, 1, GameOptionKind.Choice, TxRdxTonemap, false, true,
"With HDR Native: how the scene's light is brought to the display. Vanilla: the game's own curve. PsychoV35: RenoDX's, which keeps hue and saturation into the highlights, up to the peak brightness. RenoDRT: RenoDX's, which carries the game's SDR look up to the peak by brightness. RenoDX is by Carlos Lopez (clshortfuse), under the MIT license."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX gamma correction", 0, 2, 1, 0, GameOptionKind.Choice, TxRdxGamma, false, true,
@@ -292,31 +327,31 @@ public static class GameOptionsSchema
Row(GameOptionTab.Display, "RenoDX", "RenoDX tone slope", 0, 100, 1, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
"With PsychoV35: the steepness of the tone curve through middle grey. 50 leaves it unchanged."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX hue clip", 0, 100, 5, 50, GameOptionKind.Slider, TxPercent, false, true,
"With PsychoV35: how much bright colours turn as they do where the game's SDR picture clips: fire towards yellow and white. 0% keeps their hue."),
"With PsychoV35: how much bright colors turn as they do where the game's SDR picture clips: fire towards yellow and white. 0% keeps their hue."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX UI brightness", 80, 400, 10, 200, GameOptionKind.Slider, TxNits, false, true,
"How bright the menus' and the HUD's white is with RenoDX's tonemapper. The scene's follows HDR paper white."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX color space", 0, 2, 1, 1, GameOptionKind.Choice, TxRdxSpace, false, true,
"The colours the picture is taken to be in before HDR10's. Vanilla: the game's own matrix. BT.709: as the SDR picture. DCI-P3: more saturated."),
"The colors the picture is taken to be in before HDR10's. Vanilla: the game's own matrix. BT.709: as the SDR picture. DCI-P3: more saturated."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX exposure", 0, 200, 5, 100, GameOptionKind.Slider, TxPercent, false, true,
"The scene's brightness before RenoDX's tone mapping. 100% is the game's."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX highlights", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
"RenoDX's colour grading: the bright parts of the scene. 50 is neutral."),
"RenoDX's color grading: the bright parts of the scene. 50 is neutral."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX shadows", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
"RenoDX's colour grading: the dark parts of the scene. 50 is neutral."),
"RenoDX's color grading: the dark parts of the scene. 50 is neutral."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX contrast", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
"RenoDX's colour grading: the scene's contrast. 50 is neutral."),
"RenoDX's color grading: the scene's contrast. 50 is neutral."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX saturation", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
"RenoDX's colour grading: the scene's saturation. 50 is neutral."),
"RenoDX's color grading: the scene's saturation. 50 is neutral."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX highlight saturation", 0, 100, 1, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
"With RenoDRT: the strength of the colours of the brightest parts. 50 leaves it unchanged."),
"With RenoDRT: the strength of the colors of the brightest parts. 50 leaves it unchanged."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX blowout", 0, 100, 1, 0, GameOptionKind.Slider, TxRdxGrade, false, true,
"With RenoDRT: turns the brightest parts towards white. 0 keeps their colour."),
"With RenoDRT: turns the brightest parts towards white. 0 keeps their color."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX flare", 0, 100, 1, 0, GameOptionKind.Slider, TxRdxGrade, false, true,
"With RenoDRT: lifts the darkest parts as a little stray light would. 0 keeps black black."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX hue correction", 0, 100, 5, 100, GameOptionKind.Slider, TxPercent, false, true,
"With RenoDRT: how much bright colours keep the hue they have before the tonemapper. 0% lets them shift as the curve takes them."),
"With RenoDRT: how much bright colors keep the hue they have before the tonemapper. 0% lets them shift as the curve takes them."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX color grading", 0, 100, 5, 100, GameOptionKind.Slider, TxPercent, false, true,
"With RenoDRT: how much of the game's own colour grading the HDR picture keeps. 0% is the scene without it."),
"With RenoDRT: how much of the game's own color grading the HDR picture keeps. 0% is the scene without it."),
Row(GameOptionTab.Display, "RenoDX", "RenoDX bloom", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
"How strong the glow around bright things is. 50 is the game's."),
Row(GameOptionTab.Graphics, "Quality", "Quality preset", 0, 5, 1, 0, GameOptionKind.Choice, TxPreset, false, false,
@@ -443,6 +478,7 @@ public static class GameOptionsSchema
{
[VersionKey] = "the file's format: the rules the game reads an older file by (GameOptionsFile.Save writes 7 when it brings an older file up to date)",
[MicDeviceKey] = "the Microphone row's device, by its name: the game's to choose from the devices it lists",
[GpuNameKey] = "the GPU device row's card by its name (11-20): Save writes it with the row; the game finds the card by it first",
["layout_preset"] = "the Controls page's Layout preset: choosing one in the game rebinds the pad_ lines, which a changed value alone would not do",
["debug_tools"] = "the Debug tab (not ported)",
["descriptor_reuse"] = "the Debug tab's Developer rows (not ported)",

View File

@@ -45,14 +45,16 @@ public static class Report
/// <summary>The report for a build that stopped (old Shell.cs CopyTheReport): the launcher's and tools' versions, the OS, the
/// step it stopped at, why, the command, the game folder and the install with their free space, then the logs.</summary>
public static string ForBuild(TriforceContext ctx, BuildResult? result, string buildLines, string? toolsVersion)
public static string ForBuild(TriforceContext ctx, BuildResult? result, string buildLines, string? toolsVersion, string? failure = null)
{
string Room(string folder) => ctx.FreeBytes(folder) is { } free ? " (" + ctx.Platform.Disk(folder) + " has " + (free >> 30) + " GB free)" : "";
var step = result?.StoppedAt is { } s && BuildStages.Find(s) is { } st ? "\"" + st.Text + "\"" : "its start";
var known = new[]
{
"Triforce " + BuildInfo.Version + ", tools " + (toolsVersion ?? "none") + ", " + Environment.OSVersion.VersionString,
"The build stopped at " + step + " after " + BuildClock.Span(result?.Elapsed ?? TimeSpan.Zero) + ": " + (result?.Failure ?? "no reason given"),
result == null && failure != null
? "It stopped before the build itself: " + failure
: "The build stopped at " + step + " after " + BuildClock.Span(result?.Elapsed ?? TimeSpan.Zero) + ": " + (result?.Failure ?? failure ?? "no reason given"),
result?.CommandLine ?? "",
"Game folder: " + (result?.OutFolder ?? "") + (result?.OutFolder is { } o ? Room(o) : ""),
"Launcher: " + ctx.Home + Room(ctx.Home),

View File

@@ -0,0 +1,61 @@
// The launcher page's color scheme (Settings > Launcher > Color scheme): one color in place of Triforce gold. The page draws
// it (ui/app.js, "settings: Color scheme") and sends {t:'cmd', c:'color', hex:'#rrggbb'}; the launcher keeps it with its
// other settings (Settings.Color) and sends it back as state.color at start and when the Settings page asks for its list.
using System.Text.Json;
using System.Text.Json.Nodes;
namespace Triforce.Logic;
public static class LauncherColor
{
/// <summary>Triforce gold, the look as it was: the page's GOLD, and what Reset to gold sends.</summary>
public const string Default = "#e0b23e";
/// <summary>"#rrggbb" (six hex digits, either case) as "#rrggbb" in lower case; null for anything else (no "#", three
/// digits, a name, spaces around it, an alpha).</summary>
public static string? Parse(string? s)
{
if (s is not { Length: 7 } || s[0] != '#') return null;
for (var i = 1; i < 7; i++)
if (!char.IsAsciiHexDigit(s[i])) return null;
return s.ToLowerInvariant();
}
/// <summary>The page's 'color' command: its "hex" when that is a JSON string Parse takes, else null (no object, no hex,
/// a number, an array, an object, a bad string).</summary>
public static string? FromCommand(JsonNode? message) =>
message is JsonObject o && o["hex"] is JsonValue v && v.GetValueKind() == JsonValueKind.String ? Parse(v.GetValue<string>()) : null;
}
/// <summary>The launcher's color while it runs: the last one the page sent, else the kept one (Settings.Color). It is held here
/// and not only in the settings because a run that writes nothing (NoWrites, --snapshot) must still send back the color the
/// player chose, not the old kept one, and because the page's commands run on worker threads in any order: Take is called as
/// each 'color' arrives, in the order the page sent it, so a 'settings.list' handled after it sends the new color, and Keep
/// writes the newest choice whichever of its workers runs last.</summary>
public sealed class LauncherColorChoice
{
readonly Settings settings;
readonly object keeping = new();
volatile string? chosen;
public LauncherColorChoice(Settings settings) => this.settings = settings;
/// <summary>What state.color says: the page's last color, or the kept one before the page has sent any.</summary>
public string Current => chosen ?? settings.Color;
/// <summary>The page's 'color' command, as it arrives: its color (LauncherColor.FromCommand) becomes Current; null when it
/// is not a #rrggbb, and Current stays.</summary>
public string? Take(JsonNode? message)
{
var hex = LauncherColor.FromCommand(message);
if (hex != null) chosen = hex;
return hex;
}
/// <summary>Writes Current as Settings.Color when the page has sent one and it differs (dropped under NoWrites).</summary>
public void Keep()
{
lock (keeping)
if (chosen is { } hex && hex != settings.Color) settings.Color = hex;
}
}

View File

@@ -48,8 +48,11 @@ public interface IPlatform
string LogFolder(string home);
/// <summary>Where NVIDIA's DLSS SDK is fetched to: beside the tools, never inside them (an update replaces those whole).</summary>
string NgxSdkFolder(string home);
/// <summary>The save folder of a game folder: Windows &lt;game&gt;\user\save\&lt;uid&gt;; Linux ${XDG_DATA_HOME}/hookshot/save/&lt;uid&gt;.</summary>
/// <summary>The save folder of a game folder: Windows &lt;game&gt;\user\save\&lt;uid&gt;; Linux &lt;UserFolder&gt;/save/&lt;uid&gt;.</summary>
string SaveFolder(string game, string uid);
/// <summary>The game's user folder (its saves, their commits, its options): what --user names. Windows &lt;game&gt;\user;
/// Linux ${XDG_DATA_HOME}/triforce/user, or the folder an older build used while the game has not moved it yet.</summary>
string UserFolder(string game);
/// <summary>The folders emulators keep their data in: (Roaming, Local) on Windows; (data, config) on Linux.</summary>
(string Roaming, string Local) EmulatorDataRoots { get; }
/// <summary>Steam folders to look in, in order (test run: &lt;root&gt;\Steam only).</summary>

View File

@@ -41,8 +41,18 @@ public sealed class LinuxPlatform : PlatformBase
public override string LogFolder(string home) => Path.Combine(StateHome, "triforce");
// (hookshot_builder.py ngx_sdk_dir: beside the builder's versions, kept across updates)
public override string NgxSdkFolder(string home) => Path.Combine(DefaultInstallDir, "ngx-sdk");
// (host/hos_main.c saves_dir: $XDG_DATA_HOME/hookshot, outside the game folder so a rebuild keeps them)
public override string SaveFolder(string game, string uid) => Path.Combine(DataHome, "hookshot", "save", uid);
// (host/hos_main.c saves_dir: $XDG_DATA_HOME/triforce/user, outside the game folder so a rebuild keeps them)
public override string SaveFolder(string game, string uid) => Path.Combine(UserFolder(game), "save", uid);
/// <summary>((Triforce) 11-19) $XDG_DATA_HOME/triforce/user. Until the game has started once on v0.5.3 or later, the saves are
/// still where an older build kept them: $XDG_DATA_HOME/hookshot (the game renames that to triforce/user at its next
/// start), or the game folder's user/ when the game could not move them out of it. The first of these with a save folder.</summary>
public override string UserFolder(string game)
{
var now = Path.Combine(DataHome, "triforce", "user");
foreach (var d in new[] { now, Path.Combine(DataHome, "hookshot"), Path.Combine(game, "user") })
if (Directory.Exists(Path.Combine(d, "save"))) return d;
return now;
}
public override (string Roaming, string Local) EmulatorDataRoots => (DataHome, ConfigHome);
public override IReadOnlyList<string> SteamRoots()

View File

@@ -27,6 +27,7 @@ public abstract class PlatformBase : IPlatform
public abstract string LogFolder(string home);
public abstract string NgxSdkFolder(string home);
public abstract string SaveFolder(string game, string uid);
public abstract string UserFolder(string game);
public abstract (string Roaming, string Local) EmulatorDataRoots { get; }
public abstract IReadOnlyList<string> SteamRoots();
public abstract string ShortcutPath(ShortcutPlace place);

View File

@@ -17,6 +17,8 @@ public static class SettingNames
SetupSkip = "SetupSkip", Sounds = "Sounds", ModsBuilt = "ModsBuilt";
// (DESIGN 10: kept per user)
public const string MusicVolume = "MusicVolume", SoundVolume = "SoundVolume", Muted = "Muted";
// (the page's Color scheme, "#rrggbb": LauncherColor)
public const string Color = "Color";
}
/// <summary>Where the settings are kept. Get/Set work on the settings; the Uninstall* calls on the Apps-list entry (Windows,
@@ -221,6 +223,13 @@ public sealed class Settings
/// <summary>DESIGN 10: 0..100, default 70.</summary>
public int SoundVolume { get => Percent(SettingNames.SoundVolume, 70); set => Set(SettingNames.SoundVolume, Math.Clamp(value, 0, 100).ToString()); }
public bool Muted { get => Get(SettingNames.Muted) == "1"; set => Set(SettingNames.Muted, value ? "1" : "0"); }
/// <summary>The page's color scheme, "#rrggbb" in lower case: Triforce gold (LauncherColor.Default) when never chosen, as in
/// every settings file from before it, or when what is kept does not read as one. Only a color LauncherColor.Parse takes is kept.</summary>
public string Color
{
get => LauncherColor.Parse(Get(SettingNames.Color)) ?? LauncherColor.Default;
set => Set(SettingNames.Color, LauncherColor.Parse(value) ?? throw new ArgumentException("Not a #rrggbb color: " + value));
}
int Percent(string name, int fallback) => int.TryParse(Get(name), out var v) && v >= 0 && v <= 100 ? v : fallback;
}

View File

@@ -26,7 +26,8 @@ public sealed class WindowsPlatform : PlatformBase
public override string DefaultGameFolder => Path.Combine(TestRoot ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Games", "Triforce");
public override string LogFolder(string home) => home;
public override string NgxSdkFolder(string home) => Path.Combine(home, "ngx-sdk");
public override string SaveFolder(string game, string uid) => Path.Combine(game, "user", "save", uid);
public override string SaveFolder(string game, string uid) => Path.Combine(UserFolder(game), "save", uid);
public override string UserFolder(string game) => Path.Combine(game, "user");
public override (string Roaming, string Local) EmulatorDataRoots => TestRoot != null
? (Path.Combine(TestRoot, "Roaming"), Path.Combine(TestRoot, "Local"))
: (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));

View File

@@ -1,5 +1,5 @@
// Saves of this game (Ocarina of Time, 0400486024DEC000), wherever they are (old setup/Saves.cs, Shell.Saves.cs): Triforce keeps
// them in <game>\user\save\<uid> (Linux: ~/.local/share/hookshot/save/<uid>, host/hos_main.c saves_dir), emulators in their NAND
// them in <game>\user\save\<uid> (Linux: ~/.local/share/triforce/user/save/<uid>, host/hos_main.c saves_dir; older builds ~/.local/share/hookshot), emulators in their NAND
// (Eden, yuzu, suyu, sudachi, citron, torzu, EvilOOT: nand\user\save\0000000000000000\<user>\0400486024DEC000) or Ryujinx's
// bis\user\save\<index>\0, NX2navi in its game folder's profile (NaviSave). The files are the same everywhere (account.sav,
// option.sav, slot_00..05\caption.sav + progress.sav), so bringing saves in or out is a copy, with what gets replaced backed up first.