mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-25 18:48:51 -04:00
Triforce v0.8.0
Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
This commit is contained in:
@@ -40,6 +40,7 @@ public sealed partial class Backend
|
||||
state["settings"] = SettingsRows();
|
||||
state["bench"] = BenchState();
|
||||
state["gameopts"] = GameOptsState();
|
||||
state["texpack"] = PackState(); // ((Triforce, 11-25) the Play screen's Remastered textures row)
|
||||
}
|
||||
|
||||
/// <summary>The list again. color: the kept color too, as at start (only when the page asks for the list, which it does each time
|
||||
|
||||
120
launcher/App/Backend.TexturePack.cs
Normal file
120
launcher/App/Backend.TexturePack.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System.Text.Json.Nodes;
|
||||
using Triforce.Logic;
|
||||
|
||||
namespace Triforce.Launcher;
|
||||
|
||||
/// <summary>((Triforce, 11-25) The Play screen's Remastered textures row, under the Evil HD switch: Evil HD's texture pack
|
||||
/// downloaded into the game folder (Triforce.Logic.TexturePack), stopped and gone on with, or removed. The pack is hosted apart
|
||||
/// from the release; the game shows it while Evil HD is on, from its next start.</summary>
|
||||
public sealed partial class Backend
|
||||
{
|
||||
CancellationTokenSource? packCts;
|
||||
TexturePackManifest? packManifest;
|
||||
string packLine = "";
|
||||
double packFrac;
|
||||
|
||||
void RegisterTexturePack()
|
||||
{
|
||||
OnAsync("texpack", _ => PackAsk());
|
||||
OnAsync("texpack.go", m => (string?)m["id"] switch
|
||||
{
|
||||
"go" => RunPack(),
|
||||
"rm" => RemovePack(),
|
||||
_ => Task.CompletedTask,
|
||||
});
|
||||
On("texpackstop", _ => { try { packCts?.Cancel(); } catch { } });
|
||||
}
|
||||
|
||||
static string PackGb(long bytes) => (bytes / (double)(1L << 30)).ToString("0.0") + " GB";
|
||||
|
||||
/// <summary>The row's state for the Play screen.</summary>
|
||||
JsonObject PackState()
|
||||
{
|
||||
var g = GameDir;
|
||||
if (g == null) return new JsonObject { ["have"] = "nogame" };
|
||||
var have = new TexturePack(ctx).Have(g, packManifest);
|
||||
return new JsonObject
|
||||
{
|
||||
["have"] = have switch { TexturePackHave.Installed => "installed", TexturePackHave.Partial => "partial", _ => "none" },
|
||||
["busy"] = packCts != null, ["frac"] = packFrac, ["line"] = packLine,
|
||||
["size"] = packManifest != null ? PackGb(packManifest.Download) : "18 GB",
|
||||
};
|
||||
}
|
||||
|
||||
void SendPack() => SendState(new JsonObject { ["texpack"] = PackState() });
|
||||
|
||||
async Task PackAsk()
|
||||
{
|
||||
var g = GameDir;
|
||||
if (g == null) { Toast("Build the game first.", "error"); return; }
|
||||
if (packCts != null) return;
|
||||
var tp = new TexturePack(ctx);
|
||||
try { packManifest = await tp.ManifestAsync(http, CancellationToken.None); }
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Write("texture pack: no manifest from " + TexturePack.BaseUrl + ": " + e.Message);
|
||||
Toast(tp.Have(g) == TexturePackHave.Installed ? "The remastered textures are installed. (The download page could not be reached to check for a newer pack.)"
|
||||
: "The remastered textures could not be reached. Check your internet connection and try again.", "error");
|
||||
return;
|
||||
}
|
||||
var m = packManifest;
|
||||
var have = tp.Have(g, m);
|
||||
SendPack();
|
||||
if (have == TexturePackHave.Installed)
|
||||
{
|
||||
Ask("Remastered textures",
|
||||
"<p>Evil HD's remastered textures are installed in your game folder. The game shows them while <b>Evil HD</b> is on.</p>" +
|
||||
"<p>Remove them to free " + PackGb(m.Unpacked) + ". You can download them again any time.</p>",
|
||||
"texpack.go", new[] { ("no", "Keep them", true), ("rm", "Remove", false) });
|
||||
return;
|
||||
}
|
||||
var left = tp.Remaining(g, m);
|
||||
var mins = (int)Math.Ceiling(left / (100e6 / 8) / 60); // (at 100 Mbit/s)
|
||||
Ask("Remastered textures",
|
||||
"<p>" + m.Textures.ToString("N0") + " of the game's textures, remastered at twice the detail with their own grain kept. " +
|
||||
"The game shows them while <b>Evil HD</b> is on, from its next start.</p>" +
|
||||
"<p><b>" + PackGb(left) + " to download</b>" + (have == TexturePackHave.Partial ? " to finish" : "") +
|
||||
" (about " + mins + " minutes at 100 Mbit/s), unpacked into your game folder as it comes. " +
|
||||
"You can stop any time: it goes on where it stopped.</p>" +
|
||||
"<p>They take more video memory: best with a graphics card of 10 GB or more.</p>",
|
||||
"texpack.go", new[] { ("no", "Not now", false), ("go", have == TexturePackHave.Partial ? "Continue" : "Download", true) });
|
||||
}
|
||||
|
||||
async Task RunPack()
|
||||
{
|
||||
var g = GameDir;
|
||||
if (g == null || packCts != null || packManifest == null) return;
|
||||
if (new Game(ctx).IsRunning(g)) { Toast("Close the game first: it reads the textures when it starts.", "error"); return; }
|
||||
using var cts = packCts = new CancellationTokenSource();
|
||||
packFrac = 0; packLine = "Starting the download";
|
||||
SendPack();
|
||||
var last = DateTime.MinValue;
|
||||
try
|
||||
{
|
||||
await new TexturePack(ctx).InstallAsync(http, g, packManifest, p =>
|
||||
{
|
||||
packFrac = p.Fraction; packLine = p.Text;
|
||||
if ((DateTime.UtcNow - last).TotalMilliseconds < 500) return;
|
||||
last = DateTime.UtcNow;
|
||||
SendPack();
|
||||
}, cts.Token);
|
||||
Toast("<b>◆</b> Remastered textures installed · turn on <b>Evil HD</b> to see them", "success");
|
||||
Sfx("success");
|
||||
}
|
||||
catch (OperationCanceledException) { Toast("Download stopped · it goes on where it stopped next time"); }
|
||||
catch (NoRoomException e) { Toast(H(e.Message), "error"); }
|
||||
catch (Exception e) { Log.Write("texture pack: " + e); Toast("The textures' download stopped: " + H(e.Message), "error"); }
|
||||
finally { packCts = null; packLine = ""; SendPack(); }
|
||||
}
|
||||
|
||||
Task RemovePack()
|
||||
{
|
||||
var g = GameDir;
|
||||
if (g == null || packCts != null) return Task.CompletedTask;
|
||||
if (new Game(ctx).IsRunning(g)) { Toast("Close the game first.", "error"); return Task.CompletedTask; }
|
||||
try { new TexturePack(ctx).Remove(g); Toast("Remastered textures removed"); }
|
||||
catch (Exception e) { Log.Write("texture pack: remove: " + e); Toast("Could not remove them: " + H(e.Message), "error"); }
|
||||
SendPack();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public sealed partial class Backend
|
||||
this.host = host; this.content = content; this.ctx = ctx; this.start = start; this.dataDir = dataDir;
|
||||
content.Media = MediaFor;
|
||||
content.SavePicture = SavePicture;
|
||||
RegisterCore(); RegisterSaves(); RegisterMods(); RegisterSettings(); RegisterBench(); RegisterGameOpts();
|
||||
RegisterCore(); RegisterSaves(); RegisterMods(); RegisterSettings(); RegisterBench(); RegisterGameOpts(); RegisterTexturePack();
|
||||
}
|
||||
|
||||
partial void RegisterSaves();
|
||||
|
||||
@@ -87,7 +87,7 @@ public sealed class Benchmark : IBenchmarkRunner
|
||||
// the options file's keys (gpu/vk/vk_menu.cpp ini_key; values gpu/vk/vk_menu.h, upscaler_rows.h, fps_cap.h)
|
||||
public const string KCap = "frame_rate_cap", KVsync = "vsync", KSteady = "steady_frame_rate", KUpscaler = "dlss",
|
||||
KResolution = "resolution", KFrameGen = "frame_generation";
|
||||
// frame_rate_cap: 0 60, 1 90, 2 120, 3 144, 4 165, 5 240, 6 the monitor's. dlss (the Upscaler row): 0 the game's, 1 DLSS,
|
||||
// frame_rate_cap: 0 60, 1 90, 2 120, 3 144, 4 165, 5 240, 6 the monitor's, 7 uncapped. dlss (the Upscaler row): 0 the game's, 1 DLSS,
|
||||
// 3 FSR 3.1, 4 FSR 4. resolution: 3 = 67 % (Quality), 5 = 58 % (Balanced), 4 = 50 % (Performance). ((Triforce, options_version 8)
|
||||
// steady_frame_rate and frame_generation are the saved values of the merged Frame pacing and Frame generation rows; the
|
||||
// Quality preset is gone: the game drops its line)
|
||||
|
||||
@@ -28,6 +28,9 @@ public static partial class BuildInfo
|
||||
/// <summary>The Linux parts list (builder/linux/linux_update.py LIST_NAME).</summary>
|
||||
public const string LinuxListAsset = "triforce-linux.txt";
|
||||
public const string AppName = "Triforce";
|
||||
/// <summary>((Triforce, 11-25) Evil HD's texture pack: its manifest.json and parts, in an R2 bucket of their own, apart from the
|
||||
/// release's files (TexturePack; TRIFORCE_TEXPACK_URL goes over it for a test).</summary>
|
||||
public const string TexturePackBase = "https://hd.triforceproject.com";
|
||||
|
||||
/// <summary>The User-Agent every request to the release server carries (old Shell.cs Http).</summary>
|
||||
public static string UserAgent => "TriforceSetup/" + Version;
|
||||
|
||||
@@ -17,7 +17,11 @@ public static class GameOptionsSchema
|
||||
{
|
||||
/// <summary>The file the game reads at its start and writes at every change in its menu, in the game folder.</summary>
|
||||
public const string FileName = "triforce_options.ini";
|
||||
/// <summary>The options_version the game writes (vk_menu.cpp save): the file's format, which menu_init's rules read.</summary>
|
||||
/// <summary>The options_version the launcher brings a file up to: the format menu_init's rules read, and
|
||||
/// output_sizes.h's OUTPUT_OPTIONS_VERSION. The game itself writes 10 since 11-24 (vk_menu.cpp save): 10 changed the
|
||||
/// keys alone (Plus is Tab, no longer Enter too: host/nn_hid.c binds_load moves a file's old default pair, and only
|
||||
/// while the file's version is below 10). The launcher has no key rows and no rule for 10, so it stops at 9: a file it
|
||||
/// brings up to date still has the game's own key migration ahead of it, and a 10 is left as it is.</summary>
|
||||
public const int CurrentVersion = 9;
|
||||
|
||||
public const string OutputResKey = "output_res";
|
||||
@@ -108,6 +112,18 @@ public static class GameOptionsSchema
|
||||
"Blowout" => "renodx_blowout", "Flare" => "renodx_flare", "Hue correction" => "renodx_hue_correction",
|
||||
"Color grading" => "renodx_color_grading", "Highlights" => "renodx_highlights", "Shadows" => "renodx_shadows",
|
||||
"Contrast" => "renodx_contrast", "Saturation" => "renodx_saturation", "Bloom" => "renodx_bloom",
|
||||
// ((Triforce) 11-24/25: HUD placement's Custom rows, Auto (this PC), the Controller speaker rows: ini_key's table)
|
||||
"Hearts and magic across" => "hud_health_x", "Hearts and magic up" => "hud_health_y", "Hearts and magic size" => "hud_health_scale",
|
||||
"Buttons across" => "hud_buttons_x", "Buttons up" => "hud_buttons_y", "Buttons size" => "hud_buttons_scale",
|
||||
"Minimap across" => "hud_minimap_x", "Minimap up" => "hud_minimap_y", "Minimap size" => "hud_minimap_scale",
|
||||
"Auto (this PC)" => "auto_pc",
|
||||
"Speaker volume" => "pad_speaker_volume", "Controller sync" => "pad_speaker_sync",
|
||||
"Headphones on the controller" => "pad_speaker_headphones", "Headphone volume" => "pad_speaker_headphone_volume",
|
||||
"Navi's voice" => "pad_speaker_navi_voice", "Navi's flight sounds" => "pad_speaker_navi_sound",
|
||||
"Z-targeting" => "pad_speaker_target", "Ocarina" => "pad_speaker_ocarina", "Pick-ups" => "pad_speaker_pickup",
|
||||
"Items" => "pad_speaker_item", "Fairies" => "pad_speaker_fairy", "Interface sounds" => "pad_speaker_ui",
|
||||
"Stone of Agony" => "pad_speaker_agony", "Low health alarm" => "pad_speaker_low_health",
|
||||
"Fishing" => "pad_speaker_fishing", "Bottles" => "pad_speaker_bottle",
|
||||
_ => Cut(new string(name.Select(c => c == ' ' ? '_' : c is >= 'A' and <= 'Z' ? (char)(c + 32) : c).ToArray()), 31),
|
||||
};
|
||||
static string Cut(string s, int n) => s.Length > n ? s[..n] : s;
|
||||
@@ -120,7 +136,8 @@ public static class GameOptionsSchema
|
||||
static string Pct(int v) => v.ToString(CultureInfo.InvariantCulture) + "%";
|
||||
|
||||
static string TxOnoff(int v, IGameOptionValues? o) => v != 0 ? "On" : "Off";
|
||||
static string TxMenuShortcut(int v, IGameOptionValues? o) => v != 0 ? "F1 only" : "Insert or F1";
|
||||
static string TxVibration(int v, IGameOptionValues? o) => v == 2 ? "Off" : v == 1 ? "Basic" : "Auto"; // ((Triforce) 11-24)
|
||||
static string TxMenuShortcut(int v, IGameOptionValues? o) => v == 4 ? "Insert, F1, Esc or touchpad" : v == 3 ? "Insert, F1 or touchpad" : v == 2 ? "Insert, F1 or Esc" : v != 0 ? "F1 only" : "Insert or F1";
|
||||
static string TxHdr(int v) => v == 1 ? "Expanded" : v == 2 ? "Native" : "Off";
|
||||
/// <summary>tx_hdr_mode: the HDR row, opts.hdr with RenoDX HDR as its fourth value.</summary>
|
||||
static string TxHdrMode(int v, IGameOptionValues? o) => v == HdrRenodx ? "Native + RenoDX" : TxHdr(Math.Clamp(v, 0, 2));
|
||||
@@ -129,6 +146,7 @@ public static class GameOptionsSchema
|
||||
static string TxFpsCap(int v, IGameOptionValues? o)
|
||||
{
|
||||
if (v < 0) return v == -1 ? "45" : v == -2 ? "40" : "30";
|
||||
if (v >= 7) return "Uncapped";
|
||||
if (v >= 6) return "Monitor's rate";
|
||||
return new[] { "60 (the console's)", "90", "120", "144", "165", "240" }[v];
|
||||
}
|
||||
@@ -137,20 +155,28 @@ public static class GameOptionsSchema
|
||||
static string TxPacing(int v, IGameOptionValues? o) => Pick(new[] { "Off", "Even", "Steady, any rate", "Steady, refresh steps" }, v);
|
||||
/// <summary>tx_gyro without a controller's answer (the game adds "(gyro found)" and the like).</summary>
|
||||
static string TxGyro(int v, IGameOptionValues? o) => v != 0 ? "On" : "Off";
|
||||
static string TxMousecam(int v, IGameOptionValues? o) => v != 0 ? "Native" : "As the stick";
|
||||
static string TxMousecam(int v, IGameOptionValues? o) => v == 2 ? "Off" : v != 0 ? "Native" : "As the stick";
|
||||
static string TxSens(int v, IGameOptionValues? o) =>
|
||||
(v < 0 ? "-" : "") + (Math.Abs(v) / 100).ToString(CultureInfo.InvariantCulture) + "." + (Math.Abs(v) % 100).ToString("00", CultureInfo.InvariantCulture);
|
||||
static readonly string[] LatencyNames = { "Off", "On", "On + Boost" };
|
||||
/// <summary>tx_latency: the Low latency row by the card's maker (with DLSS frame generation the game shows Reflex's Off as
|
||||
/// On: Streamline's Reflex is always on).</summary>
|
||||
static string TxLatency(int v, IGameOptionValues? o) => LatencyNames[Math.Clamp(v, 0, LatencyHi(LatencyNow()))];
|
||||
static readonly string[] Engines = { "Game", "NVIDIA DLSS", "NVIDIA DLSS", "AMD FSR 3.1", "AMD FSR 4", "AMD FSR 4", "AMD FSR 3.1" };
|
||||
static readonly string[] Engines = { "Game", "NVIDIA DLSS", "NVIDIA DLSS", "AMD FSR 3.1", "AMD FSR 4", "AMD FSR 4", "AMD FSR 3.1", "Off", "Intel XeSS", "Intel XeSS" };
|
||||
/// <summary>tx_upscaler: the engine alone (options_version 8: DLAA and the native AAs are the Render resolution's Native
|
||||
/// (100%)); the game names FSR 4 by the version AMD's library runs once it has asked ("AMD FSR 4.1").</summary>
|
||||
static string TxUpscaler(int v, IGameOptionValues? o) => Engines[Engine(v)];
|
||||
/// <summary>tx_dlss_model without RX_VK_DLSS_PRESET.</summary>
|
||||
static string TxDlssModel(int v, IGameOptionValues? o) => Pick(new[] { "Transformer (K)", "Transformer 2 (M)", "Transformer 2 (L)", "NVIDIA default" }, v);
|
||||
static string TxAniso(int v, IGameOptionValues? o) => OrFirst(new[] { "Game", "2x", "4x", "8x", "16x" }, v);
|
||||
/// <summary>((Triforce) 11-24) the Fullscreen screen row: the game names each screen by the monitor's name and size, which
|
||||
/// the launcher does not know; here they are counted in the game's order (the game also keeps fullscreen_screen_name).</summary>
|
||||
static string TxFsScreen(int v, IGameOptionValues? o) => v <= 0 ? "Automatic" : "Screen " + v.ToString(CultureInfo.InvariantCulture);
|
||||
static string TxVsync(int v, IGameOptionValues? o) => v == 2 ? "Every refresh" : v != 0 ? "On" : "Off";
|
||||
static string TxFgBy(int v, IGameOptionValues? o) => OrFirst(new[] { "Triforce", "AMD FSR 3.1" }, v);
|
||||
static string TxColourVision(int v, IGameOptionValues? o) => OrFirst(new[] { "Off", "Protan (red-green)", "Deutan (red-green)", "Tritan (blue-yellow)" }, v);
|
||||
static string TxGrassDistance(int v, IGameOptionValues? o) => OrFirst(new[] { "Game's", "2x", "3x", "4x" }, v);
|
||||
static string TxShadowRes(int v, IGameOptionValues? o) => OrFirst(new[] { "Game's", "High", "Highest" }, v);
|
||||
/// <summary>tx_tex_detail: the game adds the level Automatic gives ("Automatic (Full)") once its first texture is made.</summary>
|
||||
static string TxTexDetail(int v, IGameOptionValues? o) => OrFirst(new[] { "Automatic", "Full", "Reduced", "Low" }, v);
|
||||
static string TxPercent(int v, IGameOptionValues? o) => Pct(v);
|
||||
@@ -161,7 +187,11 @@ public static class GameOptionsSchema
|
||||
static string TxRdxGrade(int v, IGameOptionValues? o) => v.ToString(CultureInfo.InvariantCulture);
|
||||
static string TxSpeed(int v, IGameOptionValues? o) => v != 0 ? "Real time" : "Per frame";
|
||||
static string TxTextSpeed(int v, IGameOptionValues? o) => OrFirst(new[] { "Normal", "2x", "4x", "Instant" }, v);
|
||||
static readonly string[] Shapes = { "16:9", "16:10", "21:9", "32:9" };
|
||||
static string TxTextSize(int v, IGameOptionValues? o) => OrFirst(new[] { "Normal", "110%", "125%", "150%", "175%" }, v);
|
||||
static string TxDamageTaken(int v, IGameOptionValues? o) => new[] { "Half", "Normal", "Double", "Quadruple" }[v is >= 0 and < 4 ? v : 1];
|
||||
/// <summary>tx_fov: percent of the game's own angle.</summary>
|
||||
static string TxFov(int v, IGameOptionValues? o) => v == 100 ? "100% (the game's)" : Pct(v);
|
||||
static readonly string[] Shapes = { "16:9", "16:10", "21:9", "32:9", "4:3" }; // ((Triforce, N64 Classic) 4:3, the row's last)
|
||||
/// <summary>tx_shape: the row's choice, or the shape of an Output resolution that has its own (the row then has nothing
|
||||
/// to choose) with its size. (The game shows HOS_ASPECT's there while it is set.)</summary>
|
||||
static string TxUltrawide(int v, IGameOptionValues? o)
|
||||
@@ -179,7 +209,7 @@ public static class GameOptionsSchema
|
||||
}
|
||||
static string TxPixels(int v, IGameOptionValues? o) => v.ToString(CultureInfo.InvariantCulture);
|
||||
static string TxWideHud(int v, IGameOptionValues? o) => v != 0 ? "Screen edges" : "Middle";
|
||||
static string TxWideMenus(int v, IGameOptionValues? o) => Pick(new[] { "Full width", "Centred, blurred sides", "Centred, black bars" }, v);
|
||||
static string TxWideMenus(int v, IGameOptionValues? o) => Pick(new[] { "Full width", "Centred, blurred sides", "Centred, black bars", "Extended" }, v);
|
||||
static string TxPrompts(int v, IGameOptionValues? o) =>
|
||||
Pick(new[] { "Auto", "Switch", "Xbox", "PlayStation 4", "PlayStation 5", "Steam Deck", "Keyboard & mouse" }, v);
|
||||
static string TxRumble(int v, IGameOptionValues? o) => v != 0 ? Pct(v) : "Off";
|
||||
@@ -190,10 +220,37 @@ public static class GameOptionsSchema
|
||||
/// <summary>tx_own_dead_zone: -1 is XInput's own (~24%), the Default (options_version 8: the shared Stick dead zone is gone).</summary>
|
||||
static string TxOwnDeadZone(int v, IGameOptionValues? o) => v < 0 ? "Default (24%)" : Pct(v);
|
||||
static string TxWalkKey(int v, IGameOptionValues? o) => OrFirst(new[] { "Off", "Caps Lock", "Shift", "Ctrl", "Tab" }, v);
|
||||
static string TxAudioOutput(int v, IGameOptionValues? o) => OrFirst(new[] { "Auto", "Stereo", "5.1" }, v);
|
||||
static string TxAudioOutput(int v, IGameOptionValues? o) => OrFirst(new[] { "Auto", "Stereo", "5.1", "Mono" }, v);
|
||||
static string TxDeadzone(int v, IGameOptionValues? o) => Pick(new[] { "Low", "Standard", "High" }, v);
|
||||
static string TxMesh(int v, IGameOptionValues? o) => v == 1 ? "Compute fallback" : "Auto";
|
||||
static string TxPerf(int v, IGameOptionValues? o) => v == 1 ? "On" : v >= 2 ? "Full" : "Off";
|
||||
// ((Triforce) 11-24/25: the rows the game added since: tx_hud_placement, tx_fsr4_model, n64_rules.h name,
|
||||
// reshade_menu.h preset_choices (reshade/fx_builtin.h's numbers, the Clarity looks last), tx_menu_lang (menu_i18n.h kLangs),
|
||||
// and the Controller speaker's tx_pad_*)
|
||||
static string TxHudPlacement(int v, IGameOptionValues? o) => v != 0 ? "Custom" : "Game's";
|
||||
static string TxFsr4Model(int v, IGameOptionValues? o) => v != 0 ? "Lite (INT8)" : "Auto (AMD's)";
|
||||
static string TxN64(int v, IGameOptionValues? o) => v == 1 ? "Faithful" : v == 2 ? "Remembered" : "Off";
|
||||
static readonly string[] ReshadePresets =
|
||||
{
|
||||
"Off", "Warm", "Cool", "User", "HDR Vibrance", "Depth View", "Depth Haze",
|
||||
"Serfrost (Recommended)", "Serfrost (Dim Display)", "Serfrost (Bright Display)", "Bruz", "t3nka Neutral+", "Jamie",
|
||||
"Contrasty", "The Complaining Gamer", "Filmic", "CellHunter", "ViskClarity", "Survival of the Wild (Warmer)",
|
||||
"Survival of the Wild (Colder)", "Godot's Mexican", "Hexaae's Clear", "MaranBr (Little More Intense)",
|
||||
"YeMaoWuXin (Bright Colors)", "YeMaoWuXin (Vivid and Clear)", "Cobalt (Saturated & Bright)", "Clarity Base",
|
||||
};
|
||||
static string TxReshade(int v, IGameOptionValues? o) => Pick(ReshadePresets, v);
|
||||
static readonly string[] MenuLanguages =
|
||||
{
|
||||
"English", "Português (Brasil)", "Español (Latinoamérica)", "Español (España)", "Français", "Deutsch", "Italiano",
|
||||
"Nederlands", "Polski", "Русский", "日本語", "한국어", "简体中文", "繁體中文",
|
||||
};
|
||||
static string TxMenuLang(int v, IGameOptionValues? o) => v <= 0 ? "Auto (game's language)" : Pick(MenuLanguages, v - 1);
|
||||
static string TxPadSpeaker(int v, IGameOptionValues? o) => v == 1 ? "Controller only" : v == 2 ? "Controller + TV" : "Off";
|
||||
static string TxPadHeadphones(int v, IGameOptionValues? o) => v == 1 ? "Controller sounds" : v == 2 ? "All sound" : "Off";
|
||||
static string TxPadSync(int v, IGameOptionValues? o) =>
|
||||
v < 0 ? "TV waits " + (-v).ToString(CultureInfo.InvariantCulture) + " ms"
|
||||
: v > 0 ? "Controller waits " + v.ToString(CultureInfo.InvariantCulture) + " ms" : "0 ms";
|
||||
// ((Triforce) and the levels between On and Full, saved after Full's 2: gpu/vk/fps_levels.h)
|
||||
static string TxPerf(int v, IGameOptionValues? o) => v switch { 1 => "On", 2 => "Full", 3 => "Frame time", 4 => "Graph", 5 => "Breakdown", 6 => "Dev", _ => "Off" };
|
||||
static string TxDlssg(int v) => v == 1 ? "2x" : v == 2 ? "3x" : v == 3 ? "4x" : "Off";
|
||||
/// <summary>tx_framegen where AMD's library can make the frames, before it has said its version (the game then shows
|
||||
/// "AMD FSR (4.0.2)" and the like; elsewhere a saved 9 as 2x).</summary>
|
||||
@@ -253,14 +310,14 @@ public static class GameOptionsSchema
|
||||
|
||||
// (gpu/vk/output_sizes.h, as plain code)
|
||||
const int OutputMinW = 640, OutputMinH = 360, OutputMaxW = 7680, OutputMaxH = 2880;
|
||||
const double OutputMaxPixels = 5120.0 * 2880.0, OutputRowPixels = 3840.0 * 2160.0, ShapeMin = 5.0 / 4.0, ShapeMax = 32.0 / 9.0;
|
||||
const double OutputMaxPixels = 5120.0 * 2880.0, OutputRowPixels = 3840.0 * 2160.0, ShapeMin = 5.0 / 4.0, ShapeMax = 48.0 / 9.0;
|
||||
static int OutputFrameWidth(int height) => (height * 16 + 36) / 72 * 8;
|
||||
static bool ShapeIsGame(double shape) => !(shape > 16.0 / 9.0 * 1.01 || shape < 16.0 / 9.0 * 0.99);
|
||||
static bool SizeShaped((int W, int H) s) => s.W > 0 && s.H > 0 && !ShapeIsGame((double)s.W / s.H);
|
||||
/// <summary>ultrawide_row_ratio: the Ultrawide row's shape, 0 for the game's own 16:9.</summary>
|
||||
static double UltrawideRatio(int row) => row <= 0 ? 0 : row == 1 ? 1.6f : row == 2 ? (float)(64.0 / 27.0) : (float)(32.0 / 9.0);
|
||||
static double UltrawideRatio(int row) => row <= 0 ? 0 : row == 1 ? 1.6f : row >= 4 ? (float)(4.0 / 3.0) : row == 2 ? (float)(64.0 / 27.0) : (float)(32.0 / 9.0);
|
||||
/// <summary>output_width_range: the widths, whole multiples of 8, a picture of height h can have on one side of 16:9:
|
||||
/// within 5:4 to 32:9 and outside the 1% beside 16:9, within the width's ends and the pixels. Lo above Hi: none.</summary>
|
||||
/// within 5:4 to 48:9 and outside the 1% beside 16:9, within the width's ends and the pixels. Lo above Hi: none.</summary>
|
||||
static (int Lo, int Hi) OutputWidthRange(int h, bool wide)
|
||||
{
|
||||
const double game = 16.0 / 9.0;
|
||||
@@ -273,7 +330,7 @@ public static class GameOptionsSchema
|
||||
return ((int)least, most < 0 ? 0 : (int)most);
|
||||
}
|
||||
/// <summary>output_size_used: a size from outside (the screen's, Custom's) as the game takes it, null for none. Its
|
||||
/// shape first (5:4 to 32:9), then into the limits in that shape: 7680x4320 is 5120x2880. The width is the multiple of
|
||||
/// shape first (5:4 to 48:9), then into the limits in that shape: 7680x4320 is 5120x2880. The width is the multiple of
|
||||
/// 8 nearest the shape's among those OutputWidthRange allows, so what comes out is taken as itself when given again.</summary>
|
||||
internal static (int W, int H)? OutputSizeUsed(long w, long h)
|
||||
{
|
||||
@@ -362,7 +419,7 @@ public static class GameOptionsSchema
|
||||
var size = OutputSizeOf(v, o);
|
||||
var frameH = v == 0 ? Outputs[1].H : size.H;
|
||||
var sized = SizeShaped(size);
|
||||
var want = sized ? (double)size.W / size.H : UltrawideRatio(Math.Clamp(V(o, UltrawideKey, 0), 0, 3));
|
||||
var want = sized ? (double)size.W / size.H : UltrawideRatio(Math.Clamp(V(o, UltrawideKey, 0), 0, 4));
|
||||
if (OutputPicture(frameH, want, sized) is not { } p) return v == 0 ? Outputs[0] : size;
|
||||
return v == 0 ? (p.W * 4 / 5, p.H * 4 / 5) : p;
|
||||
}
|
||||
@@ -380,22 +437,25 @@ public static class GameOptionsSchema
|
||||
}
|
||||
|
||||
// (upscaler_rows.h)
|
||||
const int Game = 0, Dlss = 1, Dlaa = 2, Fsr3 = 3, Fsr4 = 4, Fsr4Aa = 5, Fsr3Aa = 6;
|
||||
const int Game = 0, Dlss = 1, Dlaa = 2, Fsr3 = 3, Fsr4 = 4, Fsr4Aa = 5, Fsr3Aa = 6, UpscalerOff = 7; // ((Triforce) 11-24: Off, no upscaler)
|
||||
// ((Triforce) Intel XeSS and its Native AA, after Off: the game offers them with Intel's libxess.dll beside it. Not in
|
||||
// UpscalerOrder, as Off is not: a saved one keeps its value and its name here)
|
||||
const int Xess = 8, XessAa = 9;
|
||||
/// <summary>The engines in the order the Upscaler row shows them (kEngines): an engine's native anti-aliasing (DLAA, FSR's
|
||||
/// Native AA) is the Render resolution's Native (100%) from options_version 8, its saved value as before.</summary>
|
||||
public static readonly IReadOnlyList<int> UpscalerOrder = new[] { Game, Dlss, Fsr3, Fsr4 };
|
||||
/// <summary>upscaler_rows.h engine: DLAA is DLSS's, FSR 4's and FSR 3.1's native AA their own.</summary>
|
||||
public static int Engine(int up) => up == Dlaa ? Dlss : up == Fsr4Aa ? Fsr4 : up == Fsr3Aa ? Fsr3 : up is >= Game and <= Fsr3Aa ? up : Game;
|
||||
public static int Engine(int up) => up == Dlaa ? Dlss : up == Fsr4Aa ? Fsr4 : up == Fsr3Aa ? Fsr3 : up == XessAa ? Xess : up is >= Game and <= Xess ? up : Game;
|
||||
/// <summary>upscaler_rows.h native_of: an engine's native anti-aliasing (the game's own has none: itself).</summary>
|
||||
public static int NativeOf(int engine) => engine == Dlss ? Dlaa : engine == Fsr4 ? Fsr4Aa : engine == Fsr3 ? Fsr3Aa : engine;
|
||||
public static int NativeOf(int engine) => engine == Dlss ? Dlaa : engine == Fsr4 ? Fsr4Aa : engine == Fsr3 ? Fsr3Aa : engine == Xess ? XessAa : engine;
|
||||
/// <summary>The Render resolution row's Native (100%) with DLSS or FSR (upscaler_rows.h kNativeStep): its value here while
|
||||
/// the Upscaler is an engine's native AA (GameOptionsFile.Get). Chosen, the Upscaler becomes that native AA and the
|
||||
/// saved resolution stays as it is.</summary>
|
||||
public const int NativeStep = -1;
|
||||
static readonly int[] Percents = { 0, 100, 75, 67, 50, 58, 33 };
|
||||
static int Percent(int v) => v > 0 && v < Percents.Length ? Percents[v] : 0;
|
||||
public static bool FullScale(int up) => up == Dlaa || up == Fsr4Aa || up == Fsr3Aa;
|
||||
static bool ScalesByMode(int up) => up == Dlss || up == Fsr3 || up == Fsr4;
|
||||
public static bool FullScale(int up) => up == Dlaa || up == Fsr4Aa || up == Fsr3Aa || up == XessAa;
|
||||
static bool ScalesByMode(int up) => up == Dlss || up == Fsr3 || up == Fsr4 || up == Xess;
|
||||
/// <summary>upscaler_rows.h native_size: the 3D at the output's full size (an engine's native AA, or the game's own at 100%).</summary>
|
||||
public static bool NativeSize(int up, int resolution) => FullScale(up) || (up == Game && Percent(resolution) == 100);
|
||||
static readonly int[] GameSteps = { 0, 1, 2, 3, 4 }, DlssSteps = { 0, 3, 5, 4, 6 }, TemporalSteps = { 0, NativeStep, 3, 5, 4, 6 };
|
||||
@@ -508,6 +568,11 @@ public static class GameOptionsSchema
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>((Triforce) 11-24) A Controller speaker row for one kind of sound: where it plays (tx_pad_speaker).</summary>
|
||||
static GameOptionRow PadSound(string name) => Row(GameOptionTab.Audio, "Controller speaker", name, 0, 2, 1, 0, GameOptionKind.Choice,
|
||||
TxPadSpeaker, false, true,
|
||||
"Where this kind of sound plays with a DualSense on a USB cable. Off: with the rest of the game's sound. Controller only: on the controller's speaker, and no longer on the TV. Controller + TV: on both.");
|
||||
|
||||
/// <summary>A merged row (merged_rows.h): a Choice row with no line of its own, a view of its parts. Low latency's choices
|
||||
/// follow the card's maker (LatencyVendorOf).</summary>
|
||||
static GameOptionRow Merged(GameOptionTab tab, string section, string name, int lo, int hi, int step,
|
||||
@@ -531,20 +596,43 @@ public static class GameOptionsSchema
|
||||
{
|
||||
Row(GameOptionTab.Display, "Screen", "Fullscreen", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"The game fills the whole screen, without the window's border. F10 and Alt+Enter do the same."),
|
||||
Row(GameOptionTab.Display, "Screen", "Fullscreen screen", 0, 15, 1, 0, GameOptionKind.Choice, TxFsScreen, false, true,
|
||||
"Which screen Fullscreen fills: Automatic, the one the window is on, or one of the connected screens. Changes at once."),
|
||||
Row(GameOptionTab.Display, "Screen", "Output resolution", 0, 9, 1, 0, GameOptionKind.Choice, TxOutputRes, true, false,
|
||||
"The picture's size, before it is scaled to the window: the fixed sizes, and the size of each connected screen by its name. A size that is not 16:9 is a wider or narrower picture: the HUD, menus and story movies keep their 16:9 shape at its height. Docked only. Applies after a restart."),
|
||||
Row(GameOptionTab.Display, "Screen", "Output width", 640, 7680, 8, 2560, GameOptionKind.Slider, TxPixels, true, false,
|
||||
"The output resolution's width in pixels, where it is a screen's size or Custom; hold Left or Right to move faster. Output resolution shows the size the game takes: 5:4 to 32:9 in shape, at most the pixels of 5120x2880. Applies after a restart."),
|
||||
"The output resolution's width in pixels, where it is a screen's size or Custom; hold Left or Right to move faster, or type a number and press Enter. Output resolution shows the size the game takes: 5:4 to 48:9 in shape, at most the pixels of 5120x2880. Applies after a restart."),
|
||||
Row(GameOptionTab.Display, "Screen", "Output height", 360, 2880, 8, 1440, GameOptionKind.Slider, TxPixels, true, false,
|
||||
"The output resolution's height in pixels, where it is a screen's size or Custom; hold Left or Right to move faster. Output resolution shows the size the game takes: 5:4 to 32:9 in shape, at most the pixels of 5120x2880. Applies after a restart."),
|
||||
"The output resolution's height in pixels, where it is a screen's size or Custom; hold Left or Right to move faster, or type a number and press Enter. Output resolution shows the size the game takes: 5:4 to 48:9 in shape, at most the pixels of 5120x2880. Applies after a restart."),
|
||||
Row(GameOptionTab.Display, "Screen", "GPU device", 0, 8, 1, 0, GameOptionKind.Choice, TxGpu, true, true,
|
||||
"Which graphics card the game runs on. Applies after a restart."),
|
||||
Row(GameOptionTab.Display, "Ultrawide", "Aspect ratio", 0, 3, 1, 0, GameOptionKind.Choice, TxUltrawide, true, false,
|
||||
"The picture's shape for a 16:9 Output resolution: the game's own 16:9, or a fixed 16:10, 21:9 or 32:9 at the same height, for a screen or a window of that shape. A screen of another shape shows the picture between black bars. An Output resolution that is not 16:9 has its own shape, shown here. Applies after a restart."),
|
||||
Row(GameOptionTab.Display, "Ultrawide", "HUD position", 0, 1, 1, 0, GameOptionKind.Choice, TxWideHud, true, true,
|
||||
"With a picture wider than 16:9: where corner HUD elements, tips and notices sit. Middle: in the middle 16:9, as on a normal screen. Screen edges: out in the screen's corners. Applies after a restart."),
|
||||
Row(GameOptionTab.Display, "Ultrawide", "Menu sides", 0, 2, 1, 1, GameOptionKind.Choice, TxWideMenus, false, false,
|
||||
Row(GameOptionTab.Display, "Ultrawide", "Aspect ratio", 0, 4, 1, 0, GameOptionKind.Choice, TxUltrawide, true, false,
|
||||
"The picture's shape for a 16:9 Output resolution: the game's own 16:9, or a fixed 16:10, 21:9 or 32:9 at the same height, for a screen or a window of that shape, or 4:3, a TV's of 1998. A screen of another shape shows the picture between black bars. An Output resolution that is not 16:9 has its own shape, shown here. Applies after a restart."),
|
||||
Row(GameOptionTab.Display, "Ultrawide", "HUD position", 0, 1, 1, 0, GameOptionKind.Choice, TxWideHud, false, true,
|
||||
"With a picture wider than 16:9: where corner HUD elements, tips and notices sit. Middle: in the middle 16:9, as on a normal screen. Screen edges: out in the screen's corners. Changes at once."),
|
||||
Row(GameOptionTab.Display, "Ultrawide", "Menu sides", 0, 3, 1, 1, GameOptionKind.Choice, TxWideMenus, false, false,
|
||||
"With a picture wider than 16:9: the pause, item and map menus, and what shows beside them. Loading screens and story movies, which draw no world either, get the same sides (the title's movie fills the picture up to 12:5); a fade always covers the whole screen. Changes at once."),
|
||||
// ((Triforce) 11-24/25) the HUD's three groups moved and sized (host/hos_wide_ui.c): Custom's rows by their own keys
|
||||
Row(GameOptionTab.Display, "HUD", "HUD placement", 0, 1, 1, 0, GameOptionKind.Choice, TxHudPlacement, false, true,
|
||||
"Where the hearts, the buttons and the minimap sit in play. Custom moves and resizes each group. Changes at once."),
|
||||
Row(GameOptionTab.Display, "HUD", "Hearts and magic across", -15, 15, 1, 0, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Moves the hearts and magic left or right, as a share of the picture's width."),
|
||||
Row(GameOptionTab.Display, "HUD", "Hearts and magic up", -15, 15, 1, 0, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Moves the hearts and magic down or up, as a share of the picture's height."),
|
||||
Row(GameOptionTab.Display, "HUD", "Hearts and magic size", 75, 125, 1, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Resizes the hearts and magic together."),
|
||||
Row(GameOptionTab.Display, "HUD", "Buttons across", -15, 15, 1, 0, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Moves the action prompts and the item buttons left or right, as a share of the picture's width."),
|
||||
Row(GameOptionTab.Display, "HUD", "Buttons up", -15, 15, 1, 0, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Moves the action prompts and the item buttons down or up, as a share of the picture's height."),
|
||||
Row(GameOptionTab.Display, "HUD", "Buttons size", 75, 125, 1, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Resizes the action prompts and the item buttons together."),
|
||||
Row(GameOptionTab.Display, "HUD", "Minimap across", -15, 15, 1, 0, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Moves the minimap left or right, as a share of the picture's width."),
|
||||
Row(GameOptionTab.Display, "HUD", "Minimap up", -15, 15, 1, 0, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Moves the minimap down or up, as a share of the picture's height."),
|
||||
Row(GameOptionTab.Display, "HUD", "Minimap size", 75, 125, 1, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"Resizes the minimap."),
|
||||
Merged(GameOptionTab.Display, "HDR", "HDR", 0, 3, 1, MergeHdr, TxHdrMode, true, true,
|
||||
"HDR10 on an HDR display (Windows: Use HDR on in the display settings). Native + RenoDX applies after a restart."),
|
||||
Row(GameOptionTab.Display, "HDR", "Paper white", 80, 400, 10, 200, GameOptionKind.Slider, TxNits, false, true,
|
||||
@@ -589,12 +677,22 @@ public static class GameOptionsSchema
|
||||
"The scene's color. 50 is neutral."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "Bloom", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"The glow around bright things. 50 is the game's. RenoDX is by Carlos Lopez (clshortfuse), under the MIT license."),
|
||||
Row(GameOptionTab.Display, "Overlay", "FPS counter", 0, 2, 1, 0, GameOptionKind.Choice, TxPerf, false, true,
|
||||
Row(GameOptionTab.Display, "Accessibility", "Color vision correction", 0, 3, 1, 0, GameOptionKind.Choice, TxColourVision, false, true,
|
||||
"Recolors the finished picture for red-green or blue-yellow color vision deficiency, keeping its brightness. Not with HDR Native. Changes at once."),
|
||||
Row(GameOptionTab.Display, "Overlay", "FPS counter", 0, 6, 1, 0, GameOptionKind.Choice, TxPerf, false, true,
|
||||
"Frames per second in the top right corner. Full: a performance panel in its place: the GPU's and the CPU's load, temperatures and memory, the frame rate and its lows, the frame times and their graph, the waits per frame and the picture's settings."),
|
||||
Row(GameOptionTab.Graphics, "Upscaling", "Upscaler", 0, 6, 1, 0, GameOptionKind.Choice, TxUpscaler, false, false,
|
||||
// ((Triforce, 11-23) Evil HD, the game's first Graphics row: gpu/vk/evil_hd.h, saved as evil_hd)
|
||||
Row(GameOptionTab.Graphics, "Evil HD", "Evil HD", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"The fullest picture the game can give, for a powerful PC: SMAA Ultra edges, 16x texture filtering, every texture whole, the shadows of distant grass and leaves as the game draws them, and soft shadows in corners and creases (ambient occlusion), and the grass, plants, flowers and stones drawn 4 times as far (in the areas you enter after it is turned on). Your own choices in those rows come back when it is off. F2 turns it on and off."),
|
||||
// ((Triforce) Auto (this PC): auto_settings.h; its state is auto_tune and auto_for, kept keys)
|
||||
Row(GameOptionTab.Graphics, "This PC", "Auto (this PC)", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"On: the Upscaler, Render resolution, Texture detail, Shadow resolution and Grass distance are set for this PC's graphics card, memory and processor, and adjusted in the first minutes of play to hold the Frame rate cap. Changing one of those rows yourself turns it Off. The Render resolution and Upscaler apply after a restart."),
|
||||
Row(GameOptionTab.Graphics, "Upscaling", "Upscaler", 0, 9, 1, 0, GameOptionKind.Choice, TxUpscaler, false, false,
|
||||
"What draws the 3D up to the Output resolution."),
|
||||
Row(GameOptionTab.Graphics, "Upscaling", "DLSS model", 0, 3, 1, 0, GameOptionKind.Choice, TxDlssModel, false, true,
|
||||
"Which of NVIDIA's DLSS networks draws the picture."),
|
||||
Row(GameOptionTab.Graphics, "Upscaling", "FSR 4 model", 0, 1, 1, 0, GameOptionKind.Choice, TxFsr4Model, false, true,
|
||||
"The FSR 4 network: Auto lets AMD pick for this GPU, Lite is the faster INT8 network."),
|
||||
Row(GameOptionTab.Graphics, "Upscaling", "Render resolution", 0, 6, 1, 0, GameOptionKind.Choice, TxResolution, true, false,
|
||||
"The size the 3D is drawn at; the upscaler fills in the rest. Applies after a restart."),
|
||||
Row(GameOptionTab.Graphics, "Upscaling", "Upscale before bloom", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, true, true,
|
||||
@@ -603,12 +701,17 @@ public static class GameOptionsSchema
|
||||
"With DLSS, DLAA or AMD FSR as the Upscaler, the 3D before the HUD (FSR's own sharpening; AMD's RCAS for DLSS); with the game's own upscaler, the picture at the window. 0 is off. Too much shows halos around edges."),
|
||||
Row(GameOptionTab.Graphics, "Anti-aliasing", "Anti-aliasing", 0, 3, 1, 0, GameOptionKind.Choice, TxAa, false, true,
|
||||
"How the 3D's edges are smoothed: the game's own SMAA, none, FXAA, or SMAA at its Ultra preset. Changes at once."),
|
||||
// ((Triforce, N64 Classic) the row; its Remembered page's rows (n64_rem_*) are kept keys, set in the game)
|
||||
Row(GameOptionTab.Graphics, "N64 Classic", "N64 Classic", 0, 2, 1, 0, GameOptionKind.Choice, TxN64, false, true,
|
||||
"The game as the 1998 cartridge on a TV of then. F7 turns it on and off. Changes at once."),
|
||||
Merged(GameOptionTab.Graphics, "Frame generation", "Frame generation", 0, 12, 1, MergeFramegen, TxFramegenRow, true, true,
|
||||
"Makes frames between the game's own, for smoother motion, at a little input delay. Fast motion and camera cuts can show artifacts. NVIDIA DLSS applies after a restart."),
|
||||
Row(GameOptionTab.Graphics, "Frame rate & latency", "Frame rate cap", -3, 6, 1, 0, GameOptionKind.Choice, TxFpsCap, true, true,
|
||||
"The most frames the game renders a second; made frames come on top. 60 is the safe choice: past it some cutscenes and bosses can misbehave. 30, 40 and 45 are for a PC that holds one of them where 60 swings. Monitor's rate: the refresh rate of the screen the game starts on. Applies after a restart."),
|
||||
Row(GameOptionTab.Graphics, "Frame rate & latency", "VSync", 0, 1, 1, 1, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Whether a finished frame waits for the screen's next refresh. Off: a little less delay, and the picture can tear. Changes at once."),
|
||||
Row(GameOptionTab.Graphics, "Frame generation", "Frame generation by", 0, 1, 1, 0, GameOptionKind.Choice, TxFgBy, false, true,
|
||||
"Who makes the frames at Auto and 2x to 8x."),
|
||||
Row(GameOptionTab.Graphics, "Frame rate & latency", "Frame rate cap", -3, 7, 1, 0, GameOptionKind.Choice, TxFpsCap, false, true,
|
||||
"The most frames the game renders a second; made frames come on top. 60 is the safe choice: past it some cutscenes and bosses can misbehave. 30, 40 and 45 are for a PC that holds one of them where 60 swings. Monitor's rate: the refresh rate of the screen the game starts on. Uncapped: as fast as the PC can, still at real time; with VSync on, the screen's refresh rate is the limit. Changes at once."),
|
||||
Row(GameOptionTab.Graphics, "Frame rate & latency", "VSync", 0, 2, 1, 1, GameOptionKind.Choice, TxVsync, false, true,
|
||||
"Whether a finished frame waits for the screen's next refresh. Off: a little less delay, and the picture can tear. Every refresh: always the screen's own pacing (FIFO), for a display that tears or stutters otherwise. Changes at once."),
|
||||
Merged(GameOptionTab.Graphics, "Frame rate & latency", "Frame pacing", 0, 3, 1, MergePacing, TxPacing, true, false,
|
||||
"When each frame is shown. Steady paces the game to a rate this PC holds where you are: steadier, at some frame rate."),
|
||||
Merged(GameOptionTab.Graphics, "Frame rate & latency", "Low latency", 0, 2, 1, MergeLatency, TxLatency, false, false,
|
||||
@@ -617,56 +720,107 @@ public static class GameOptionsSchema
|
||||
"Keeps ground, paths and walls sharp where they slope away from the camera. Game: what the game asks for; 16x is the sharpest, at a small cost."),
|
||||
Row(GameOptionTab.Graphics, "Textures", "Texture detail", 0, 3, 1, 0, GameOptionKind.Choice, TxTexDetail, true, false,
|
||||
"How large the game's textures are kept in video memory. Automatic suits the graphics card. Applies after a restart."),
|
||||
// ((Triforce) 11-24) the ReShade presets (reshade/fx_builtin.h); the User preset file is the game's to list
|
||||
Row(GameOptionTab.Graphics, "Post-processing", "ReShade preset", 0, 26, 1, 0, GameOptionKind.Choice, TxReshade, false, true,
|
||||
"Native HDR supports built-in and LinearHDR presets. Use Expanded HDR for imported SDR presets."),
|
||||
Row(GameOptionTab.Graphics, "Detail", "Grass distance", 0, 3, 1, 0, GameOptionKind.Choice, TxGrassDistance, false, false,
|
||||
"How far away short grass blades reach, such as Kokiri Forest's tufts and the moss on its stones. The game stops them at about 20 m. Higher extends their reach for some GPU time. Changes at once."),
|
||||
Row(GameOptionTab.Graphics, "Detail", "Shadow resolution", 0, 2, 1, 0, GameOptionKind.Choice, TxShadowRes, false, false,
|
||||
"The size of the sun's shadow maps: higher keeps the shadows of thin things near you, such as chains, fences and leaves, smooth instead of stair-stepped, for more video memory and a little GPU time. Highest also makes them shimmer less while the camera moves. Changes at once."),
|
||||
Row(GameOptionTab.Graphics, "Advanced", "Mesh shaders", 0, 1, 1, 0, GameOptionKind.Choice, TxMesh, true, false,
|
||||
"How the game's mesh-shader draws run. Try Compute fallback on an AMD card that shows glowing walls or loses the GPU. Applies after a restart."),
|
||||
// ((Triforce) 11-23) the System tab's Achievements group (host/achievements.c)
|
||||
Row(GameOptionTab.System, "Achievements", "Achievements", 0, 1, 1, 1, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Whether things you do in the game are marked as earned. Off: nothing is checked or earned, and what you have earned is kept."),
|
||||
Row(GameOptionTab.System, "Achievements", "Achievement notices", 0, 1, 1, 1, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Whether a notice and a sound tell you when you earn one. Off: they are still earned, and listed under View achievements."),
|
||||
Row(GameOptionTab.System, "Game", "Menu language", 0, 14, 1, 1, GameOptionKind.Choice, TxMenuLang, false, true,
|
||||
"The language of this menu."),
|
||||
Row(GameOptionTab.System, "Game", "Text speed", 0, 3, 1, 0, GameOptionKind.Choice, TxTextSpeed, false, false,
|
||||
"How fast the letters of dialogue and other messages appear."),
|
||||
Row(GameOptionTab.System, "Game", "Text size", 0, 4, 1, 0, GameOptionKind.Choice, TxTextSize, false, true,
|
||||
"How large the text of dialogue, Navi and signs is drawn."),
|
||||
Row(GameOptionTab.System, "Game", "Game speed", 0, 1, 1, 1, GameOptionKind.Choice, TxSpeed, false, false,
|
||||
"How the game keeps time when it runs below 60 fps."),
|
||||
Row(GameOptionTab.System, "Game", "Field of view", 50, 150, 5, 100, GameOptionKind.Slider, TxFov, false, true,
|
||||
"How much of the world the camera shows while you play: higher is wider. Cutscenes keep their own view."),
|
||||
Row(GameOptionTab.System, "Game", "Damage taken", 0, 3, 1, 1, GameOptionKind.Choice, TxDamageTaken, false, true,
|
||||
"How much of his hearts Link loses from a hit. Half rounds up to the next quarter heart. Healing stays as it is."),
|
||||
Row(GameOptionTab.System, "Game", "Skip title screen", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Starts the game straight on your newest save: Continue and Load are pressed for you, unless you press something first. From the game's next start."),
|
||||
Row(GameOptionTab.System, "Game", "Skip opening", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"A new game starts without its opening, the story movie and Navi waking Link. Every later cutscene plays as it does."),
|
||||
Row(GameOptionTab.Audio, "Sound", "Master volume", 0, 100, 5, 100, GameOptionKind.Slider, TxVolume, false, true,
|
||||
"How loud the game is, in percent of its own volume."),
|
||||
Row(GameOptionTab.Audio, "Sound", "Menu sounds", 0, 100, 5, 80, GameOptionKind.Slider, TxMenuSounds, false, true,
|
||||
"How loud these options' own sounds are, the game's interface sounds from your game files."),
|
||||
Row(GameOptionTab.Audio, "Sound", "Audio output", 0, 2, 1, 0, GameOptionKind.Choice, TxAudioOutput, true, true,
|
||||
"The speakers the game mixes its sound for. Applies after a restart."),
|
||||
Row(GameOptionTab.Audio, "Sound", "Mute in background", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"No sound while another window has the focus."),
|
||||
Row(GameOptionTab.Audio, "Sound", "Audio output", 0, 3, 1, 0, GameOptionKind.Choice, TxAudioOutput, true, true,
|
||||
"The speakers the game mixes its sound for. Applies after a restart; Stereo and Mono change at once."),
|
||||
Row(GameOptionTab.Audio, "Microphone", "Microphone", 0, 18, 1, 1, GameOptionKind.Choice, TxMic, false, true,
|
||||
"What the ocarina hears when the game's microphone option is on (playing an instrument, or humming)."),
|
||||
Row(GameOptionTab.Audio, "Microphone", "Microphone gain", 25, 400, 25, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"How loud the microphone is for the ocarina, in percent of what it gives. Raise it if your notes are not heard."),
|
||||
// ((Triforce) 11-24) a DualSense's own speaker and headphones (host/pad_speaker.c)
|
||||
Row(GameOptionTab.Audio, "Controller speaker", "Speaker volume", 0, 200, 10, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"How loud a DualSense's own speaker plays the sounds sent to it below (the controller on a USB cable). A short tone plays on it when you change this."),
|
||||
Row(GameOptionTab.Audio, "Controller speaker", "Controller sync", -100, 150, 10, 0, GameOptionKind.Slider, TxPadSync, false, true,
|
||||
"Lines up the sounds set to Controller + TV. If the controller plays later than the TV, go below 0: the TV waits. If the TV plays later, go above 0: the controller waits."),
|
||||
Row(GameOptionTab.Audio, "Controller speaker", "Headphones on the controller", 0, 2, 1, 0, GameOptionKind.Choice, TxPadHeadphones, false, true,
|
||||
"With headphones in a DualSense's jack (on a USB cable). All sound: the whole game plays on them and the TV is silent, as on the console. Controller sounds: only the sounds set to play on the controller go to them. Off: they are left out."),
|
||||
Row(GameOptionTab.Audio, "Controller speaker", "Headphone volume", 0, 100, 10, 80, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"How loud the headphones in the controller's jack play."),
|
||||
PadSound("Navi's voice"), PadSound("Navi's flight sounds"), PadSound("Z-targeting"), PadSound("Ocarina"), PadSound("Pick-ups"),
|
||||
PadSound("Items"), PadSound("Fairies"), PadSound("Interface sounds"), PadSound("Stone of Agony"), PadSound("Low health alarm"),
|
||||
PadSound("Fishing"), PadSound("Bottles"),
|
||||
Row(GameOptionTab.System, "Saves & reports", "Autosave", 0, 1, 1, 1, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Whether the game saves by itself as you go from one area to another. Off skips those saves; saving from the pause menu still works."),
|
||||
Row(GameOptionTab.System, "Online", "Discord status", 0, 1, 1, 1, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Shows \"Playing Triforce\" and the time played in your Discord status, while Discord runs on this PC."),
|
||||
Row(GameOptionTab.Controls, "Controller", "Controller in background", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, false,
|
||||
"Whether the controller plays the game while another window has the focus."),
|
||||
Row(GameOptionTab.Controls, "Controller", "Left stick dead zone", -1, 50, 1, -1, GameOptionKind.Slider, TxOwnDeadZone, false, true,
|
||||
"How far the left stick moves before the game sees it, in percent of its travel on each axis: lower for a precise stick, higher for one that drifts. The game's own dead zone still follows."),
|
||||
"How far the left stick moves from its centre before the game sees it, in percent of its travel: lower for a precise stick, higher for one that drifts. The game's own dead zone still follows."),
|
||||
Row(GameOptionTab.Controls, "Controller", "Right stick dead zone", -1, 50, 1, -1, GameOptionKind.Slider, TxOwnDeadZone, false, true,
|
||||
"How far the right stick moves before the game sees it, in percent of its travel on each axis: lower for a precise stick, higher for one that drifts. The game's own dead zone still follows."),
|
||||
"How far the right stick moves from its centre before the game sees it, in percent of its travel: lower for a precise stick, higher for one that drifts. The game's own dead zone still follows."),
|
||||
Row(GameOptionTab.Controls, "Controller", "Camera speed", 25, 300, 5, 100, GameOptionKind.Slider, TxSens, true, true,
|
||||
"How fast the right stick turns the camera, times the game's own speed. Applies after a restart."),
|
||||
Row(GameOptionTab.Controls, "Controller", "Invert camera X", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Swaps left and right for the right stick's camera."),
|
||||
Row(GameOptionTab.Controls, "Controller", "Invert camera Y", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Swaps up and down for the right stick's camera."),
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Mouse camera", 0, 1, 1, 0, GameOptionKind.Choice, TxMousecam, false, true,
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Mouse camera", 0, 2, 1, 0, GameOptionKind.Choice, TxMousecam, false, true,
|
||||
"How the captured mouse turns the camera."),
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Mouse sensitivity", 10, 500, 10, 100, GameOptionKind.Slider, TxSens, false, true,
|
||||
"How far the camera turns for a mouse movement. The - and = keys change it in game too."),
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Invert mouse vertical", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Swaps up and down for the mouse."),
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Invert mouse horizontal", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Swaps left and right for the mouse."),
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Walk key", 0, 4, 1, 0, GameOptionKind.Choice, TxWalkKey, false, true,
|
||||
"A key that makes Link walk: held with the movement keys, they push the stick only as far as Walk scale. While it is chosen the key presses nothing else."),
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Walk scale", 20, 90, 1, 51, GameOptionKind.Slider, TxSens, false, true,
|
||||
"How far the movement keys push the stick while the Walk key is held: 1.00 would be all the way."),
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Menu shortcut", 0, 1, 1, 0, GameOptionKind.Choice, TxMenuShortcut, false, true,
|
||||
"Which keys open and close these options from anywhere. F1 always does; F1 only leaves Insert free for an overlay."),
|
||||
Row(GameOptionTab.Controls, "Mouse & keyboard", "Menu shortcut", 0, 4, 1, 0, GameOptionKind.Choice, TxMenuShortcut, false, true,
|
||||
"Which keys open and close these options from anywhere. F1 always does; F1 only leaves Insert free for an overlay. With Esc, Esc opens them too, as a PC game's pause menu (open, Esc still goes back a page or closes them). With touchpad, a DualShock 4's or DualSense's touchpad click opens and closes them as F1 does."),
|
||||
Row(GameOptionTab.Controls, "Rumble", "Rumble strength", 0, 300, 25, 100, GameOptionKind.Slider, TxRumble, false, true,
|
||||
"How strongly the controller rumbles, in percent of the game's rumble. Off turns it off."),
|
||||
Row(GameOptionTab.Controls, "Rumble", "Vibration curve", 20, 150, 5, 100, GameOptionKind.Slider, TxSens, false, true,
|
||||
"Shapes the rumble: 1.00 is the game's. Lower makes the many weak rumbles easier to feel; higher quiets them. A Switch controller's HD rumble is not changed."),
|
||||
Row(GameOptionTab.Controls, "Rumble", "Trigger vibration", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Xbox One and Series controllers: the motors in the triggers rumble too."),
|
||||
// ((Triforce) 11-24) the Insert menu's Vibration and DualSense HD Haptics (host/vibration.h, host/rumble_renhdrum.c)
|
||||
Row(GameOptionTab.Controls, "Rumble", "Vibration", 0, 2, 1, 0, GameOptionKind.Choice, TxVibration, false, true,
|
||||
"How the controller vibrates. Auto plays the best it can: with RenHDrum beside the game a DualSense its voice coils, a Switch controller and an Xbox controller RenHDrum's HD rumble, a Steam Controller (2026) its grips; without it a Switch controller its own HD rumble and every other controller its motors. Basic plays the motors on every controller. Off stops it. The line below says what plays the controller used last."),
|
||||
Row(GameOptionTab.Controls, "Rumble", "DualSense HD Haptics", 0, 1, 1, 1, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"A DualSense that RenHDrum plays also taps its speaker and kicks back on L2 and R2 while you hold them, from the game's vibration, with deeper heavy hits. Off: its fine haptics alone."),
|
||||
Row(GameOptionTab.Controls, "Gameplay", "Sprint button", 0, 2, 1, 0, GameOptionKind.Choice, TxSprint, false, true,
|
||||
"Link sprints from a button press, without rolling first. Left stick click: the game has no other use for it. B: sprints while Link moves (with the game's Swap Jump Controls B is the jump: use the stick's click)."),
|
||||
Row(GameOptionTab.Controls, "Gameplay", "Sprint mode", 0, 1, 1, 0, GameOptionKind.Choice, TxSprintMode, false, true,
|
||||
"Toggle: a press starts the sprint, the next press or stopping ends it. Hold: Link sprints while the button is held."),
|
||||
Row(GameOptionTab.Controls, "Gameplay", "Camera centering", 0, 1, 1, 1, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"Whether the camera turns by itself the way Link moves. Off: it stays where you put it, which suits the mouse; the game's own recentring still works."),
|
||||
Row(GameOptionTab.Controls, "Motion", "Motion controls", 0, 1, 1, 1, GameOptionKind.Choice, TxGyro, false, true,
|
||||
"Aims and looks with the controller's gyroscope where the game uses motion, as on the Switch: Switch Pro controllers and pads in Switch mode, DualSense and DualShock 4."),
|
||||
Row(GameOptionTab.Controls, "Motion", "Motion sensitivity X", 10, 600, 10, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
@@ -679,6 +833,26 @@ public static class GameOptionsSchema
|
||||
"Swaps the motion aim's up and down."),
|
||||
Row(GameOptionTab.Controls, "Motion", "Motion deadzone", 0, 2, 1, 1, GameOptionKind.Choice, TxDeadzone, false, true,
|
||||
"How slow a turn counts as none, the console's three settings: Standard is its own. High steadies a pad that jitters; Low keeps the smallest movements."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle ZL", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of ZL holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle ZR", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of ZR holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle L", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of L holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle R", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of R holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle A", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of A holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle B", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of B holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle X", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of X holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle Y", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of Y holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle LS", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of the left stick's click holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Hold to toggle", "Toggle RS", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, false, true,
|
||||
"One press of the right stick's click holds it, the next lets it go, with whatever is bound to it. Opening a menu or pressing Plus or Minus lets it go too."),
|
||||
Row(GameOptionTab.Controls, "Controls", "Button prompts", 0, 6, 1, 0, GameOptionKind.Choice, TxPrompts, true, true,
|
||||
"The button icons the game shows in its texts and menus: those of this controller, or the keyboard's and the mouse's."),
|
||||
};
|
||||
@@ -714,7 +888,8 @@ public static class GameOptionsSchema
|
||||
[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",
|
||||
[CustomSizeKey] = "the Custom size entered before a screen's size was chosen in the game's Output resolution row: the game's to keep; GameOptionsFile empties it when it writes another Custom size, and takes it back into the rows when the Output resolution is changed",
|
||||
["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",
|
||||
["fullscreen_screen_name"] = "the Fullscreen screen row's screen by its name and size (11-24): the game finds the screen by it first, so a choice of the row here holds where the file has no such line",
|
||||
["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)",
|
||||
["fast_pipeline_link"] = "the Debug tab's Developer rows (not ported)",
|
||||
@@ -734,6 +909,38 @@ public static class GameOptionsSchema
|
||||
["debug_tab"] = "an old line (Alt+G's Debug tab): the game drops it at its next save",
|
||||
["rivatuner_limit"] = "an old test builds' line: the game drops it at its next save",
|
||||
["discord_app_id"] = "the Discord status's application, for a test application (host/discord_rpc.c): no row",
|
||||
["discord_text"] = "the Discord status's text, the player's template (host/discord_activity.c): no row",
|
||||
["discord_image"] = "the Discord status's picture, an art asset's key or an https:// link (host/discord_activity.c): no row",
|
||||
["discord_image_text"] = "the Discord status's picture's hover text, a template (host/discord_activity.c): no row",
|
||||
// ((Triforce) 11-24/25: the game's own state and its pages' rows, set in the game)
|
||||
["auto_tune"] = "Auto (this PC)'s tuning state (auto_settings.h): the game's own",
|
||||
["auto_for"] = "the hardware Auto (this PC) chose for (auto_settings.h): the game's own",
|
||||
["n64_classic_last"] = "the preset F7 turns N64 Classic on to (n64_rules.h Toggle): the game's own",
|
||||
["n64_rem_fps"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_lines"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_colour"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_dither"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_blur"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_tv"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_scanlines"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_mask"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_mask_strength"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_bleed"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_glow"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_curvature"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["n64_rem_saturation"] = "N64 Classic's Remembered page (n64_rules.h kSpec): set in the game",
|
||||
["use_global_multipliers"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["fade_start_multiplier"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["turf_density_multiplier"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["minimum_blades_multiplier"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["far_power_multiplier"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["fade_start"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["turf_density"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["minimum_blades"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["far_power"] = "the Simulated turf page's (sim_turf_settings.h; its own file now): an older build's line",
|
||||
["user_preset_file"] = "the ReShade User preset file row: the game's list of the files in its reshade folder (reshade/selected.txt)",
|
||||
["compile_shaders"] = "the Debug tab's Developer rows (not ported)",
|
||||
["threaded_rendering"] = "the Debug tab's Developer rows (not ported)",
|
||||
};
|
||||
/// <summary>The binding lines of the Controls page's grid: pad_<button>=<input> and key_<button>=<key>,<key>.</summary>
|
||||
public static readonly IReadOnlyList<string> KeptPrefixes = new[] { "pad_", "key_" };
|
||||
|
||||
@@ -43,8 +43,26 @@ public static class Report
|
||||
return NoName(s.ToString(), folders);
|
||||
}
|
||||
|
||||
/// <summary>((Triforce) 11-24) The PC as a problem report asks for it, beside the OS: the CPU's threads and the RAM, what a
|
||||
/// build's compile needs most of.</summary>
|
||||
public static string Pc()
|
||||
{
|
||||
var ram = GC.GetGCMemoryInfo().TotalAvailableMemoryBytes;
|
||||
return "PC: " + Environment.ProcessorCount + " threads" + (ram > 0 ? ", " + ((ram + (1L << 29)) >> 30) + " GB of RAM" : "");
|
||||
}
|
||||
|
||||
/// <summary>((Triforce) 11-24) The switches set in the launcher's environment that the build and the game read (RX_, HOS_,
|
||||
/// HOOKSHOT_, TRIFORCE_), by their names alone: a value can be a path or something private, and is never in a report.</summary>
|
||||
public static string Switches(IEnumerable<string> names)
|
||||
{
|
||||
var set = names.Where(n => new[] { "RX_", "HOS_", "HOOKSHOT_", "TRIFORCE_" }.Any(p => n.Length > p.Length && n.StartsWith(p, StringComparison.Ordinal)))
|
||||
.Distinct().OrderBy(n => n, StringComparer.Ordinal).ToList();
|
||||
return "Switches set: " + (set.Count == 0 ? "none" : string.Join(", ", set) + " (their values are left out)");
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// step it stopped at, why, the command, the game folder and the install with their free space, the PC and the switches
|
||||
/// set, then the logs.</summary>
|
||||
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)" : "";
|
||||
@@ -58,6 +76,8 @@ public static class Report
|
||||
result?.CommandLine ?? "",
|
||||
"Game folder: " + (result?.OutFolder ?? "") + (result?.OutFolder is { } o ? Room(o) : ""),
|
||||
"Launcher: " + ctx.Home + Room(ctx.Home),
|
||||
Pc(),
|
||||
Switches(Environment.GetEnvironmentVariables().Keys.Cast<object>().Select(k => k.ToString() ?? "")),
|
||||
};
|
||||
var profile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
string? shortName = null;
|
||||
|
||||
202
launcher/Logic/TexturePack.cs
Normal file
202
launcher/Logic/TexturePack.cs
Normal file
@@ -0,0 +1,202 @@
|
||||
using System.IO.Compression;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Triforce.Logic;
|
||||
|
||||
/// <summary>((Triforce, 11-25) Evil HD's texture pack: one part of the download (an uncompressed zip of whole textures).</summary>
|
||||
public sealed record TexturePackPart(string Name, long Size, string Sha256, int Files, long Unpacked);
|
||||
|
||||
/// <summary>The pack's manifest (manifest.json beside its parts, made by the release's pack_textures.ps1).</summary>
|
||||
public sealed record TexturePackManifest(string Id, int Textures, int Files, long Unpacked, long Download, IReadOnlyList<TexturePackPart> Parts);
|
||||
|
||||
/// <summary>How far an install is: the part (1-based) of how many, that part's download 0..1, the whole install 0..1, words.</summary>
|
||||
public readonly record struct TexturePackProgress(int Part, int Parts, double PartFraction, double Fraction, string Text);
|
||||
|
||||
/// <summary>What the game folder has of the pack: none, some parts of one (an install stopped part way), or one whole.</summary>
|
||||
public enum TexturePackHave { None, Partial, Installed }
|
||||
|
||||
/// <summary>((Triforce, 11-25) Evil HD's remastered textures, downloaded into the game folder's triforce_texpack, where the game's
|
||||
/// renderer finds them (gpu/vk/vk_texture.cpp texpack: <key>.png and its <key>_mN.png levels). The pack is made from the game's
|
||||
/// own textures, so it is hosted apart from the release (BuildInfo.TexturePackBase) and never ships with Triforce.
|
||||
///
|
||||
/// One part at a time: downloaded into the launcher's downloads folder (Downloader: a stopped download goes on from its .part),
|
||||
/// its SHA-256 checked against the manifest, unpacked into the folder, then deleted. The folder's .pack.json names the pack and
|
||||
/// the parts in it, so a stopped install goes on at the next part, and needs about one part of room beyond the pack. A part
|
||||
/// whose hash is wrong is deleted and fetched anew at the next try. Only names a pack file has (16 hex digits, an optional _mN,
|
||||
/// .png) are written, flat in the folder: nothing in a zip can reach outside it.</summary>
|
||||
public sealed class TexturePack
|
||||
{
|
||||
public const string FolderName = "triforce_texpack";
|
||||
public const string StateName = ".pack.json";
|
||||
static readonly Regex FileName = new(@"^[0-9a-f]{16}(_m\d{1,2})?\.png$", RegexOptions.CultureInvariant);
|
||||
static readonly Regex PartName = new(@"^[A-Za-z0-9._-]{1,80}\.zip$", RegexOptions.CultureInvariant);
|
||||
|
||||
readonly TriforceContext ctx;
|
||||
readonly Downloader downloader;
|
||||
public TexturePack(TriforceContext ctx, Downloader? downloader = null)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
this.downloader = downloader ?? new Downloader(ctx);
|
||||
}
|
||||
|
||||
/// <summary>Where the pack's manifest and parts are: TRIFORCE_TEXPACK_URL over BuildInfo's (a test's own server).</summary>
|
||||
public static string BaseUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
var e = Environment.GetEnvironmentVariable("TRIFORCE_TEXPACK_URL");
|
||||
return (string.IsNullOrWhiteSpace(e) ? BuildInfo.TexturePackBase : e.Trim()).TrimEnd('/');
|
||||
}
|
||||
}
|
||||
|
||||
public static string Folder(string game) => Path.Combine(game, FolderName);
|
||||
|
||||
/// <summary>The manifest's JSON as a manifest; FormatException for one that is not whole (no parts, a part without a size,
|
||||
/// a hash or a plain name).</summary>
|
||||
public static TexturePackManifest Parse(string json)
|
||||
{
|
||||
var o = JsonNode.Parse(json) as JsonObject ?? throw new FormatException("the pack's manifest is not an object");
|
||||
var parts = new List<TexturePackPart>();
|
||||
foreach (var p in o["parts"] as JsonArray ?? new JsonArray())
|
||||
{
|
||||
var name = (string?)p?["name"] ?? "";
|
||||
var sha = ((string?)p?["sha256"] ?? "").ToLowerInvariant();
|
||||
var size = (long?)p?["size"] ?? 0;
|
||||
if (!PartName.IsMatch(name) || sha.Length != 64 || size <= 0) throw new FormatException("the pack's manifest has a part it cannot use: " + name);
|
||||
parts.Add(new TexturePackPart(name, size, sha, (int?)p?["files"] ?? 0, (long?)p?["unpacked"] ?? 0));
|
||||
}
|
||||
var id = (string?)o["id"] ?? "";
|
||||
if (parts.Count == 0 || !Regex.IsMatch(id, @"^[A-Za-z0-9._-]{1,60}$")) throw new FormatException("the pack's manifest names no pack or no parts");
|
||||
return new TexturePackManifest(id, (int?)o["textures"] ?? 0, (int?)o["files"] ?? 0, (long?)o["unpacked"] ?? parts.Sum(x => x.Unpacked),
|
||||
(long?)o["download"] ?? parts.Sum(x => x.Size), parts);
|
||||
}
|
||||
|
||||
public async Task<TexturePackManifest> ManifestAsync(HttpClient http, CancellationToken token)
|
||||
{
|
||||
using var r = await http.GetAsync(BaseUrl + "/manifest.json", token).ConfigureAwait(false);
|
||||
r.EnsureSuccessStatusCode();
|
||||
return Parse(await r.Content.ReadAsStringAsync(token).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
sealed record State(string Id, List<string> Done, bool Whole);
|
||||
|
||||
static State? ReadState(string game)
|
||||
{
|
||||
try
|
||||
{
|
||||
var o = JsonNode.Parse(File.ReadAllText(Path.Combine(Folder(game), StateName))) as JsonObject;
|
||||
if (o == null) return null;
|
||||
var done = (o["done"] as JsonArray ?? new JsonArray()).Select(x => (string?)x ?? "").Where(x => x.Length > 0).ToList();
|
||||
return new State((string?)o["id"] ?? "", done, (bool?)o["whole"] ?? false);
|
||||
}
|
||||
catch (Exception) { return null; }
|
||||
}
|
||||
|
||||
static void WriteState(string game, State s)
|
||||
{
|
||||
var o = new JsonObject { ["id"] = s.Id, ["whole"] = s.Whole, ["done"] = new JsonArray(s.Done.Select(x => (JsonNode)JsonValue.Create(x)!).ToArray()) };
|
||||
var path = Path.Combine(Folder(game), StateName);
|
||||
File.WriteAllText(path + ".new", o.ToJsonString(new JsonSerializerOptions { WriteIndented = true }));
|
||||
File.Move(path + ".new", path, true);
|
||||
}
|
||||
|
||||
/// <summary>What the folder has: Installed only with every part of a pack in it (by its own list; a manifest, when given,
|
||||
/// must be the same pack). A folder of pictures with no list (the pack moved in by hand) counts as Installed too.</summary>
|
||||
public TexturePackHave Have(string game, TexturePackManifest? m = null)
|
||||
{
|
||||
var s = ReadState(game);
|
||||
if (s == null)
|
||||
{
|
||||
try { return Directory.Exists(Folder(game)) && Directory.EnumerateFiles(Folder(game), "*.png").Any() ? TexturePackHave.Installed : TexturePackHave.None; }
|
||||
catch (Exception) { return TexturePackHave.None; }
|
||||
}
|
||||
if (m != null && s.Id != m.Id) return s.Done.Count > 0 ? TexturePackHave.Partial : TexturePackHave.None;
|
||||
return s.Whole ? TexturePackHave.Installed : s.Done.Count > 0 ? TexturePackHave.Partial : TexturePackHave.None;
|
||||
}
|
||||
|
||||
/// <summary>The bytes the install still downloads, for a manifest (the parts not in the folder yet).</summary>
|
||||
public long Remaining(string game, TexturePackManifest m)
|
||||
{
|
||||
var s = ReadState(game);
|
||||
var done = s != null && s.Id == m.Id ? s.Done : new List<string>();
|
||||
return m.Parts.Where(p => !done.Contains(p.Name)).Sum(p => p.Size);
|
||||
}
|
||||
|
||||
/// <summary>Downloads and unpacks the parts the folder does not have yet. Another pack in the folder (an older one) is
|
||||
/// removed first. The game must not be running (its renderer lists the folder at its start).</summary>
|
||||
public async Task InstallAsync(HttpClient http, string game, TexturePackManifest m, Action<TexturePackProgress>? progress, CancellationToken token)
|
||||
{
|
||||
var folder = Folder(game);
|
||||
var s = ReadState(game);
|
||||
if (s != null && s.Id != m.Id) { Remove(game); s = null; }
|
||||
else if (s == null && Directory.Exists(folder)) Remove(game); // (pictures with no list: not this pack's for sure)
|
||||
Directory.CreateDirectory(folder);
|
||||
s ??= new State(m.Id, new List<string>(), false);
|
||||
if (s.Whole && m.Parts.All(p => s.Done.Contains(p.Name))) return;
|
||||
s = s with { Whole = false };
|
||||
WriteState(game, s);
|
||||
var cache = Path.Combine(ctx.DownloadsFolder, "texpack");
|
||||
Directory.CreateDirectory(cache);
|
||||
var left = m.Parts.Where(p => !s.Done.Contains(p.Name)).ToList();
|
||||
var need = left.Sum(p => p.Unpacked > 0 ? p.Unpacked : p.Size) + (left.Count > 0 ? left.Max(p => p.Size) : 0);
|
||||
if (ctx.SpaceProblem("Evil HD's textures (" + (m.Download >> 30) + " GB)", need, folder) is { } none) throw new NoRoomException(none);
|
||||
long before = m.Parts.Where(p => s.Done.Contains(p.Name)).Sum(p => p.Size), total = Math.Max(1, m.Parts.Sum(p => p.Size));
|
||||
for (var i = 0; i < m.Parts.Count; i++)
|
||||
{
|
||||
var p = m.Parts[i];
|
||||
if (s.Done.Contains(p.Name)) continue;
|
||||
token.ThrowIfCancellationRequested();
|
||||
var n = i + 1;
|
||||
var zip = Path.Combine(cache, p.Name);
|
||||
var start = before;
|
||||
void Say(double f, string text) => progress?.Invoke(new TexturePackProgress(n, m.Parts.Count, f, Math.Min(1, (start + f * p.Size) / total), text));
|
||||
if (!(File.Exists(zip) && new FileInfo(zip).Length == p.Size))
|
||||
await downloader.ToFileAsync(http, BaseUrl + "/" + p.Name, zip, p.Size,
|
||||
d => Say(d.Fraction * 0.9, "Downloading part " + n + " of " + m.Parts.Count), token).ConfigureAwait(false);
|
||||
Say(0.9, "Checking part " + n + " of " + m.Parts.Count);
|
||||
var sha = await Task.Run(() => { using var f = File.OpenRead(zip); return Convert.ToHexStringLower(SHA256.HashData(f)); }, token).ConfigureAwait(false);
|
||||
if (sha != p.Sha256)
|
||||
{
|
||||
try { File.Delete(zip); } catch (Exception) { }
|
||||
throw new InvalidDataException("Part " + n + " of Evil HD's textures did not download whole. Try again: it is fetched anew.");
|
||||
}
|
||||
Say(0.95, "Unpacking part " + n + " of " + m.Parts.Count);
|
||||
await Task.Run(() => Unpack(zip, folder), CancellationToken.None).ConfigureAwait(false);
|
||||
s.Done.Add(p.Name);
|
||||
WriteState(game, s);
|
||||
try { File.Delete(zip); } catch (Exception) { }
|
||||
before += p.Size;
|
||||
ctx.Log.Write("texture pack " + m.Id + ": part " + n + " of " + m.Parts.Count + " in (" + p.Name + ")");
|
||||
}
|
||||
WriteState(game, s with { Whole = true });
|
||||
progress?.Invoke(new TexturePackProgress(m.Parts.Count, m.Parts.Count, 1, 1, "Evil HD's textures are in"));
|
||||
ctx.Log.Write("texture pack " + m.Id + ": installed in " + folder);
|
||||
}
|
||||
|
||||
/// <summary>A part's pictures into the folder, each through name.new then into place (a stop leaves no half picture).</summary>
|
||||
static void Unpack(string zip, string folder)
|
||||
{
|
||||
using var z = ZipFile.OpenRead(zip);
|
||||
foreach (var e in z.Entries)
|
||||
{
|
||||
if (e.FullName.EndsWith('/')) continue;
|
||||
if (!FileName.IsMatch(e.FullName)) throw new InvalidDataException("a file Evil HD's textures do not have: " + e.FullName);
|
||||
var dst = Path.Combine(folder, e.FullName);
|
||||
e.ExtractToFile(dst + ".new", true);
|
||||
File.Move(dst + ".new", dst, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The folder gone (the pack's pictures and its list); the game then draws its own textures.</summary>
|
||||
public void Remove(string game)
|
||||
{
|
||||
var f = Folder(game);
|
||||
if (!Directory.Exists(f)) return;
|
||||
// (a link to a folder elsewhere, the lab's: only the link goes)
|
||||
if (new DirectoryInfo(f).LinkTarget != null) { Directory.Delete(f); return; }
|
||||
Directory.Delete(f, true);
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,8 @@ static partial class Tests
|
||||
yield return Sync("tools: unpack the whole zip, refuse unsafe names", ToolsUnpack);
|
||||
yield return Sync("tools: base list and parts", ToolsParts);
|
||||
yield return ("tools: update from the fake server with progress", ToolsUpdate);
|
||||
yield return ("texture pack: download, stop and go on, hashes, names, replace, remove", TexturePackInstall);
|
||||
yield return ("texture pack: the real pack end to end (TEXPACK_E2E)", TexturePackRealPack);
|
||||
yield return Sync("build: @@ protocol from a recorded transcript", Protocol);
|
||||
yield return Sync("build: estimates from history and without", Estimates);
|
||||
yield return Sync("build: time left, slow first part of the shaders then fast", EtaSlowStart);
|
||||
@@ -491,6 +493,11 @@ static partial class Tests
|
||||
var o = Report.NoName(text, @"C:\Users\Ann", @"C:\Users\ANN~1");
|
||||
Equal(@"%USERPROFILE%\AppData\x and %USERPROFILE%//Games and C:\Users\Anna\y and %USERPROFILE%\Temp", o, "the account's folder read as %USERPROFILE%");
|
||||
Equal("b\nc", Report.Tail("a\nb\nc\n\n", 2).Replace("\r", ""), "tail");
|
||||
// ((Triforce) 11-24) the switches set, by their names alone, in order; the PC's threads and RAM
|
||||
Equal("Switches set: HOOKSHOT_JOBS, HOS_LOG_FILE, RX_VK_AA (their values are left out)",
|
||||
Report.Switches(new[] { "PATH", "RX_VK_AA", "HOS_LOG_FILE", "HOOKSHOT_JOBS", "RX_", "USERNAME", "RX_VK_AA" }), "the switches set");
|
||||
Equal("Switches set: none", Report.Switches(new[] { "PATH", "TEMP" }), "no switch set");
|
||||
Check(Report.Pc().StartsWith("PC: " + Environment.ProcessorCount + " threads"), "the PC's threads");
|
||||
}
|
||||
|
||||
static void LanguagesTest()
|
||||
|
||||
@@ -102,6 +102,16 @@ static partial class Tests
|
||||
foreach (var line in s.Split('\n'))
|
||||
{
|
||||
var code = line.Split("//")[0];
|
||||
// ((Triforce) 11-24) arrays, pad_speaker[12] = {0, ...}: each element by its index, and the name alone where every
|
||||
// element is the same (toggle[HOS_SW_ZL]: a symbol for an index)
|
||||
var arr = Regex.Match(code, @"^\s*int\s+(\w+)\[\d+\]\s*=\s*\{([^}]*)\}\s*;");
|
||||
if (arr.Success)
|
||||
{
|
||||
var vals = arr.Groups[2].Value.Split(',').Select(x => int.Parse(x.Trim())).ToList();
|
||||
for (var i = 0; i < vals.Count; i++) d[arr.Groups[1].Value + "[" + i + "]"] = vals[i];
|
||||
if (vals.Distinct().Count() == 1) d[arr.Groups[1].Value + "[]"] = vals[0];
|
||||
continue;
|
||||
}
|
||||
var m = Regex.Match(code, @"^\s*int\s+(.*);");
|
||||
if (!m.Success) continue;
|
||||
foreach (var part in m.Groups[1].Value.Split(','))
|
||||
@@ -122,9 +132,14 @@ static partial class Tests
|
||||
Check(table.Count > 100, "the table read: " + table.Count + " entries");
|
||||
var symbols = new Dictionary<string, int>
|
||||
{
|
||||
["kLastOutput"] = 9, ["OUTPUT_MIN_W"] = 640, ["OUTPUT_MAX_W"] = 7680, ["OUTPUT_MIN_H"] = 360, ["OUTPUT_MAX_H"] = 2880, ["ur::kValues - 1"] = 6, ["ur::kUpscalers - 1"] = 6, ["ur::kModels - 1"] = 3, ["aa_rows::kValues - 1"] = 3,
|
||||
["kLastOutput"] = 9, ["OUTPUT_MIN_W"] = 640, ["OUTPUT_MAX_W"] = 7680, ["OUTPUT_MIN_H"] = 360, ["OUTPUT_MAX_H"] = 2880, ["ur::kValues - 1"] = 6, ["ur::kUpscalers - 1"] = 9, ["ur::kModels - 1"] = 3, ["aa_rows::kValues - 1"] = 3,
|
||||
["2 + kMaxMics"] = 18, ["HOS_PROMPT_N"] = 6, ["mr7::FG_DLSS_LAST"] = 12, ["framegen_rows::kRowMax"] = 9,
|
||||
// ((Triforce) 11-22..25: N64 Classic, the FPS counter's levels, Frame generation by, FSR 4 model, ReShade, Menu language)
|
||||
["n64_rules::FAITHFUL"] = 1, ["n64_rules::REMEMBERED"] = 2, ["n64_rules::kPresets - 1"] = 2, ["fps_levels::kMax"] = 6,
|
||||
["framegen_rows::kByMax"] = 1, ["ur::kFsr4Models - 1"] = 1, ["reshade::last_builtin_preset"] = 26, ["i18n::lang_count()"] = 14,
|
||||
};
|
||||
// (an array element by a symbol's index, toggle[HOS_SW_ZL]: the array's one value)
|
||||
int Dflt(string field) => defaults.TryGetValue(field, out var v) ? v : defaults[Regex.Replace(field, @"\[.*\]$", "[]")];
|
||||
int Num(string s, string what) => int.TryParse(s, out var v) ? v : symbols.TryGetValue(s, out v) ? v : throw new TestFailed(what + ": a symbol the test does not know, " + s);
|
||||
var tabs = new Dictionary<string, GameOptionTab>
|
||||
{
|
||||
@@ -137,6 +152,8 @@ static partial class Tests
|
||||
// parts' defaults, by the schema's own rules)
|
||||
var hidden = table.Where(r => r.Tab == "TAB_HIDDEN" && r.Value != "nullptr").ToList();
|
||||
var partDefaults = new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
// ((Triforce) 11-24/25) the game's own state among them (auto_tune, auto_for, n64_classic_last): kept keys, no part
|
||||
hidden = hidden.Where(r => !GameOptionsSchema.KeptKeys.ContainsKey(GameOptionsSchema.IniKey(r.Name))).ToList();
|
||||
foreach (var r in hidden)
|
||||
{
|
||||
var key = GameOptionsSchema.IniKey(r.Name);
|
||||
@@ -150,7 +167,7 @@ static partial class Tests
|
||||
}
|
||||
Equal(string.Join(",", hidden.Select(r => GameOptionsSchema.IniKey(r.Name)).OrderBy(k => k, StringComparer.Ordinal)),
|
||||
string.Join(",", GameOptionsSchema.Parts.Keys.OrderBy(k => k, StringComparer.Ordinal)), "the parts are the hidden rows");
|
||||
var left = new[] { "&opts.language", "&opts.pad_layout" }; // (Game language: language.txt's; Layout preset: KeptKeys)
|
||||
var left = new[] { "&opts.language", "&opts.pad_layout", "&output_pick", "&reshade_menu::user_pick" }; // (+ 11-24: the Output device and the User preset file, the game's own lists of this PC's devices and files) // (Game language: language.txt's; Layout preset: KeptKeys)
|
||||
var sections = new Dictionary<string, string>();
|
||||
var names = new List<string>();
|
||||
foreach (var r in table)
|
||||
@@ -177,7 +194,7 @@ static partial class Tests
|
||||
else
|
||||
{
|
||||
Check(!row.IsMerged && GameOptionsSchema.IniKey(r.Name) == row.Key, r.Name + ": its own line, key " + row.Key);
|
||||
Equal(defaults[r.Value["&opts.".Length..]], row.Default, r.Name + ": default");
|
||||
Equal(Dflt(r.Value["&opts.".Length..]), row.Default, r.Name + ": default");
|
||||
}
|
||||
}
|
||||
Equal(string.Join("|", names), string.Join("|", GameOptionsSchema.All.Select(r => r.Name)), "the rows, in the menu's order");
|
||||
@@ -235,15 +252,15 @@ static partial class Tests
|
||||
}
|
||||
else Equal(0, r.Choices.Count, r.Name + ": a slider has no choice list");
|
||||
}
|
||||
Equal("Screen,Ultrawide,HDR,RenoDX,Overlay", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.Display)), "Display's sections");
|
||||
Equal("Upscaling,Anti-aliasing,Frame generation,Frame rate & latency,Textures,Advanced", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.Graphics)), "Graphics' sections");
|
||||
Equal("Controller,Mouse & keyboard,Rumble,Gameplay,Motion,Controls", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.Controls)), "Controls' sections");
|
||||
Equal("Sound,Microphone", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.Audio)), "Audio's sections");
|
||||
Equal("Game,Online", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.System)), "System's sections (with rows)");
|
||||
Equal("Screen,Ultrawide,HUD,HDR,RenoDX,Accessibility,Overlay", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.Display)), "Display's sections");
|
||||
Equal("Evil HD,This PC,Upscaling,Anti-aliasing,N64 Classic,Frame generation,Frame rate & latency,Textures,Post-processing,Detail,Advanced", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.Graphics)), "Graphics' sections");
|
||||
Equal("Controller,Mouse & keyboard,Rumble,Gameplay,Motion,Hold to toggle,Controls", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.Controls)), "Controls' sections");
|
||||
Equal("Sound,Microphone,Controller speaker", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.Audio)), "Audio's sections");
|
||||
Equal("Achievements,Game,Saves & reports,Online", string.Join(",", GameOptionsSchema.Sections(GameOptionTab.System)), "System's sections (with rows)");
|
||||
|
||||
string L(string key, int v) => GameOptionsSchema.Get(key).Label(v);
|
||||
string Cs(string key) => string.Join("|", GameOptionsSchema.Get(key).Choices.Select(c => c.Value + "=" + c.Label));
|
||||
Equal("-3=30|-2=40|-1=45|0=60 (the console's)|1=90|2=120|3=144|4=165|5=240|6=Monitor's rate", Cs("frame_rate_cap"), "fps cap");
|
||||
Equal("-3=30|-2=40|-1=45|0=60 (the console's)|1=90|2=120|3=144|4=165|5=240|6=Monitor's rate|7=Uncapped", Cs("frame_rate_cap"), "fps cap");
|
||||
Equal("7=1536x864 (handheld)|3=1920x1080|0=2048x1152|1=2560x1440|2=3840x2160|4=5120x1440|6=5120x2160|5=5120x2880|8=Screen|9=Custom (2560x1440)", Cs("output_res"),
|
||||
"output sizes, smallest first, then Screen and Custom");
|
||||
Equal("0=Game|1=NVIDIA DLSS|3=AMD FSR 3.1|4=AMD FSR 4", Cs("dlss"), "upscalers: the engines, in the menu's order");
|
||||
@@ -254,7 +271,7 @@ static partial class Tests
|
||||
Equal("0=Off|1=Expanded|2=Native|3=Native + RenoDX", Cs(GameOptionsSchema.HdrKey), "HDR, RenoDX merged in");
|
||||
Equal("0=Off|1=Even|2=Steady, any rate|3=Steady, refresh steps", Cs(GameOptionsSchema.PacingKey), "frame pacing, steady merged in");
|
||||
Equal("0=Auto|1=Switch|2=Xbox|3=PlayStation 4|4=PlayStation 5|5=Steam Deck|6=Keyboard & mouse", Cs("button_prompts"), "prompts");
|
||||
Equal("0=Insert or F1|1=F1 only", Cs("menu_shortcut"), "menu shortcut");
|
||||
Equal("0=Insert or F1|1=F1 only|2=Insert, F1 or Esc|3=Insert, F1 or touchpad|4=Insert, F1, Esc or touchpad", Cs("menu_shortcut"), "menu shortcut");
|
||||
// (Low latency by the card's maker: NVIDIA's Reflex where it is not known)
|
||||
var vendorBefore = GameOptionsSchema.LatencyVendorOf;
|
||||
try
|
||||
@@ -312,7 +329,7 @@ static partial class Tests
|
||||
Equal("75% (3840x1620)", wide.Label("resolution"), "of the whole 5120x2160");
|
||||
wide.Set("output_res", 2);
|
||||
Equal("21:9", wide.Label("ultrawide"), "a 16:9 size: the row's shape");
|
||||
Equal(4, wide.ChoicesOf("ultrawide").Count, "and its four choices");
|
||||
Equal(5, wide.ChoicesOf("ultrawide").Count, "and its five choices (4:3 since N64 Classic)");
|
||||
Equal("75% (3312x1398)", wide.Label("resolution"), "the row's 21:9 at the 4K output: kept to 3840x2160's pixels");
|
||||
wide.Set("ultrawide", 0);
|
||||
Equal("75% (2880x1620)", wide.Label("resolution"), "the game's own picture");
|
||||
@@ -482,7 +499,8 @@ static partial class Tests
|
||||
var info = new FileInfo(path);
|
||||
var (len, time) = (info.Length, info.LastWriteTimeUtc);
|
||||
var f = GameOptionsFile.Load(RealGame);
|
||||
Check(f.Exists && f.Version == GameOptionsSchema.CurrentVersion, "read, version " + f.Version);
|
||||
// (the game writes 10 since 11-24, a version the launcher leaves as it is: CurrentVersion)
|
||||
Check(f.Exists && f.Version >= GameOptionsSchema.CurrentVersion, "read, version " + f.Version);
|
||||
// (every key is a row or a kept one: these, knowingly. options_version: the format; menu_size: the old Menu size row;
|
||||
// layout_preset: rebinds the pad_ lines in the game; the Debug tab's; pad_* and key_*: the Controls page's bindings)
|
||||
Equal("", string.Join(",", f.UnknownKeys), "no key nobody knows");
|
||||
@@ -497,7 +515,7 @@ static partial class Tests
|
||||
if (r.Kind == GameOptionKind.Choice)
|
||||
Check(f.ChoicesOf(r.Key).Any(c => c.Value == v && c.Label == label), r.Name + ": " + v + " = \"" + label + "\" is one of its choices");
|
||||
else
|
||||
Check(Regex.IsMatch(label, @"^(-?\d+( nits|%)?|\d\.\d\d|Off|Muted|Default \(24%\))$"), r.Name + ": a slider's label \"" + label + "\"");
|
||||
Check(Regex.IsMatch(label, @"^(-?\d+( nits|%| ms)?|\d\.\d\d|Off|Muted|Default \(24%\)|(TV|Controller) waits \d+ ms|100% \(the game's\))$"), r.Name + ": a slider's label \"" + label + "\"");
|
||||
Check(r.IsMerged || v == GameOptionsSchema.NativeStep || f.Raw(r.Key) == null || v == r.AsRead(GameOptionsFile.Atoi(f.Raw(r.Key)!)),
|
||||
r.Name + ": the file's value as the game reads it");
|
||||
}
|
||||
|
||||
128
launcher/LogicTests/Tests.TexturePack.cs
Normal file
128
launcher/LogicTests/Tests.TexturePack.cs
Normal file
@@ -0,0 +1,128 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Triforce.Logic;
|
||||
using static Triforce.LogicTests.T;
|
||||
|
||||
namespace Triforce.LogicTests;
|
||||
|
||||
static partial class Tests
|
||||
{
|
||||
// ((Triforce, 11-25) Evil HD's texture pack: the launcher's download into the game folder (Logic/TexturePack.cs))
|
||||
static string PackManifest(string id, params (string Name, byte[] Zip, int Files)[] parts)
|
||||
{
|
||||
var ps = string.Join(",", parts.Select(p => "{\"name\":\"" + p.Name + "\",\"size\":" + p.Zip.Length + ",\"sha256\":\"" +
|
||||
Convert.ToHexStringLower(SHA256.HashData(p.Zip)) + "\",\"files\":" + p.Files + ",\"unpacked\":" + p.Zip.Length + "}"));
|
||||
return "{\"id\":\"" + id + "\",\"textures\":3,\"files\":4,\"unpacked\":100,\"download\":" + parts.Sum(p => p.Zip.Length) + ",\"parts\":[" + ps + "]}";
|
||||
}
|
||||
|
||||
static async Task TexturePackInstall()
|
||||
{
|
||||
using var s = new FakeServer();
|
||||
var root = NewRoot("texpack");
|
||||
var ctx = Ctx(root);
|
||||
var game = Path.Combine(root, "game");
|
||||
Directory.CreateDirectory(game);
|
||||
var p1 = Zip(("00000000000000a1.png", "one"), ("00000000000000a1_m1.png", "one-1"));
|
||||
var p2 = Zip(("00000000000000b2.png", "two"));
|
||||
var p3 = Zip(("00000000000000c3.png", "three"));
|
||||
var json = PackManifest("pack-1", ("pack-1-01.zip", p1, 2), ("pack-1-02.zip", p2, 1), ("pack-1-03.zip", p3, 1));
|
||||
s.Add("/manifest.json", json);
|
||||
s.Add("/pack-1-01.zip", p1);
|
||||
s.Add("/pack-1-03.zip", p3); // (part 2 not there yet: the install stops at it)
|
||||
var before = Environment.GetEnvironmentVariable("TRIFORCE_TEXPACK_URL");
|
||||
Environment.SetEnvironmentVariable("TRIFORCE_TEXPACK_URL", s.Url);
|
||||
try
|
||||
{
|
||||
using var http = Downloader.CreateHttp();
|
||||
var tp = new TexturePack(ctx);
|
||||
Equal(TexturePackHave.None, tp.Have(game), "nothing yet");
|
||||
var m = await tp.ManifestAsync(http, CancellationToken.None);
|
||||
Equal(3, m.Parts.Count, "the manifest's parts");
|
||||
Equal(p1.Length + p2.Length + p3.Length, (int)tp.Remaining(game, m), "all of it to download");
|
||||
var failed = false;
|
||||
try { await tp.InstallAsync(http, game, m, null, CancellationToken.None); } catch (HttpRequestException) { failed = true; }
|
||||
Check(failed, "a missing part stops the install");
|
||||
Equal(TexturePackHave.Partial, tp.Have(game, m), "part 1 in: partial");
|
||||
Equal("one", File.ReadAllText(Path.Combine(TexturePack.Folder(game), "00000000000000a1.png")), "part 1's pictures unpacked");
|
||||
Check(!File.Exists(Path.Combine(ctx.DownloadsFolder, "texpack", "pack-1-01.zip")), "a part's zip goes once it is unpacked");
|
||||
// (the part comes: the install goes on from it, part 1 not fetched again)
|
||||
s.Add("/pack-1-02.zip", p2);
|
||||
var asked = s.Seen.Count(x => x.Contains("pack-1-01.zip"));
|
||||
var seen = new List<TexturePackProgress>();
|
||||
await tp.InstallAsync(http, game, m, seen.Add, CancellationToken.None);
|
||||
Equal(asked, s.Seen.Count(x => x.Contains("pack-1-01.zip")), "part 1 not downloaded again");
|
||||
Equal(TexturePackHave.Installed, tp.Have(game, m), "every part in: installed");
|
||||
Equal("three", File.ReadAllText(Path.Combine(TexturePack.Folder(game), "00000000000000c3.png")), "the last part's pictures");
|
||||
Check(seen.Count > 0 && seen[^1].Fraction == 1, "progress ends at 1");
|
||||
Check(!Directory.EnumerateFiles(TexturePack.Folder(game), "*.new").Any(), "no half-written picture left");
|
||||
|
||||
// (a part whose bytes are not the manifest's: refused, its zip deleted, the folder left as it was)
|
||||
var game2 = Path.Combine(root, "game2");
|
||||
Directory.CreateDirectory(game2);
|
||||
var good = Zip(("00000000000000d4.png", "four"));
|
||||
var bad = PackManifest("pack-2", ("pack-2-01.zip", good, 1));
|
||||
var hurt = (byte[])good.Clone();
|
||||
hurt[hurt.Length / 2] ^= 0x5a; // (the same size, one byte changed: only the hash tells)
|
||||
s.Add("/pack-2-01.zip", hurt);
|
||||
var m2 = TexturePack.Parse(bad);
|
||||
Throws<InvalidDataException>(() => tp.InstallAsync(http, game2, m2, null, CancellationToken.None).GetAwaiter().GetResult(), "a wrong hash");
|
||||
Check(!File.Exists(Path.Combine(ctx.DownloadsFolder, "texpack", "pack-2-01.zip")), "the bad part is deleted, to be fetched anew");
|
||||
Check(!File.Exists(Path.Combine(TexturePack.Folder(game2), "00000000000000d4.png")), "nothing unpacked from it");
|
||||
|
||||
// (a zip with a name a pack has not: nothing is written outside the folder)
|
||||
var game3 = Path.Combine(root, "game3");
|
||||
Directory.CreateDirectory(game3);
|
||||
var evil = Zip(("../escape.png", "x"));
|
||||
s.Add("/pack-3-01.zip", evil);
|
||||
var m3 = TexturePack.Parse(PackManifest("pack-3", ("pack-3-01.zip", evil, 1)));
|
||||
Throws<InvalidDataException>(() => tp.InstallAsync(http, game3, m3, null, CancellationToken.None).GetAwaiter().GetResult(), "a file a pack does not have");
|
||||
Check(!File.Exists(Path.Combine(game3, "escape.png")), "nothing escapes the folder");
|
||||
|
||||
// (another pack in the folder is replaced; Remove takes the folder away)
|
||||
await tp.InstallAsync(http, game, TexturePack.Parse(PackManifest("pack-4", ("pack-1-03.zip", p3, 1))), null, CancellationToken.None);
|
||||
Check(!File.Exists(Path.Combine(TexturePack.Folder(game), "00000000000000a1.png")), "the older pack's pictures go");
|
||||
Equal(TexturePackHave.Installed, tp.Have(game), "the new pack installed");
|
||||
tp.Remove(game);
|
||||
Equal(TexturePackHave.None, tp.Have(game), "removed");
|
||||
Throws<FormatException>(() => TexturePack.Parse("{\"id\":\"x\",\"parts\":[]}"), "a manifest with no parts");
|
||||
Throws<FormatException>(() => TexturePack.Parse("{\"id\":\"x\",\"parts\":[{\"name\":\"../a.zip\",\"size\":1,\"sha256\":\"" + new string('0', 64) + "\"}]}"), "a part named outside");
|
||||
}
|
||||
finally { Environment.SetEnvironmentVariable("TRIFORCE_TEXPACK_URL", before); }
|
||||
}
|
||||
|
||||
/// <summary>The real pack end to end, only with TEXPACK_E2E=<its address> (and TEXPACK_E2E_REF=<a pack folder> to compare a
|
||||
/// sample with): installed into a test game folder, every file there, the sample's bytes the same. Skipped otherwise.</summary>
|
||||
static async Task TexturePackRealPack()
|
||||
{
|
||||
var url = Environment.GetEnvironmentVariable("TEXPACK_E2E");
|
||||
if (string.IsNullOrEmpty(url)) { Console.WriteLine(" (skipped: TEXPACK_E2E not set)"); return; }
|
||||
var root = NewRoot("texpack-e2e");
|
||||
var ctx = Ctx(root);
|
||||
var game = Path.Combine(root, "game");
|
||||
Directory.CreateDirectory(game);
|
||||
var before = Environment.GetEnvironmentVariable("TRIFORCE_TEXPACK_URL");
|
||||
Environment.SetEnvironmentVariable("TRIFORCE_TEXPACK_URL", url);
|
||||
try
|
||||
{
|
||||
using var http = Downloader.CreateHttp();
|
||||
var tp = new TexturePack(ctx);
|
||||
var m = await tp.ManifestAsync(http, CancellationToken.None);
|
||||
var t0 = DateTime.UtcNow;
|
||||
var lastPart = 0;
|
||||
await tp.InstallAsync(http, game, m, p => { if (p.Part != lastPart) { lastPart = p.Part; Console.WriteLine(" " + p.Text + " (" + (int)(p.Fraction * 100) + "%)"); } }, CancellationToken.None);
|
||||
Console.WriteLine(" installed in " + (int)(DateTime.UtcNow - t0).TotalSeconds + " s");
|
||||
var files = Directory.GetFiles(TexturePack.Folder(game), "*.png");
|
||||
Equal(m.Files, files.Length, "every picture of the pack");
|
||||
Equal(TexturePackHave.Installed, tp.Have(game, m), "installed");
|
||||
var reference = Environment.GetEnvironmentVariable("TEXPACK_E2E_REF");
|
||||
if (!string.IsNullOrEmpty(reference))
|
||||
foreach (var f in files.Where((_, i) => i % 997 == 0))
|
||||
Check(File.ReadAllBytes(f).AsSpan().SequenceEqual(File.ReadAllBytes(Path.Combine(reference, Path.GetFileName(f)))), Path.GetFileName(f) + ": the same bytes");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Environment.SetEnvironmentVariable("TRIFORCE_TEXPACK_URL", before);
|
||||
try { Directory.Delete(root, true); } catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,3 +176,35 @@ body.kb .cp-sv.held.kf { outline: 4px double var(--gold-hi) !important; box-shad
|
||||
.cp-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 20px; font-size: 14px; }
|
||||
.cp-foot em { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 600; font-size: 17px; color: var(--gold-hi); }
|
||||
.cp-foot .lnk { font-weight: 600; color: var(--gold); cursor: pointer; }
|
||||
|
||||
/* ((Triforce, 11-25) Evil HD on the home screen: under the save's picture, in its frame's lines; the switch lit in the theme's
|
||||
own colour when on (the gold variables follow the colour chosen in Settings) */
|
||||
.evilhd { position: absolute; left: 672px; top: 470px; width: 544px; height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 22px 0 24px; box-sizing: border-box; cursor: pointer;
|
||||
background: linear-gradient(90deg, rgba(10, 9, 8, .78), rgba(10, 9, 8, .52)); border: 1px solid rgba(var(--gold-rgb), .38); transition: border-color .2s, box-shadow .2s; }
|
||||
.evilhd::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(var(--gold-rgb), .14); pointer-events: none; }
|
||||
.evilhd:hover, .evilhd.kf { border-color: rgba(var(--gold-rgb), .7); }
|
||||
.evilhd .eh-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
||||
.evilhd .eh-txt b { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 700; font-size: 25px; line-height: 1; color: var(--text); letter-spacing: .01em; transition: color .2s, text-shadow .2s; }
|
||||
.evilhd .eh-txt span { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.evilhd .eh-sw { position: relative; flex: none; width: 64px; height: 30px; border-radius: 15px; background: rgba(10, 9, 8, .85); border: 1px solid rgba(var(--gold-rgb), .5); transition: background .2s, box-shadow .2s; }
|
||||
.evilhd .eh-sw i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text3); transition: left .2s, background .2s; }
|
||||
.evilhd.on { border-color: rgba(var(--gold-rgb), .7); box-shadow: 0 0 28px rgba(var(--gold-glow-rgb), .18); }
|
||||
.evilhd.on .eh-txt b { color: var(--gold-hi); text-shadow: 0 0 18px rgba(var(--gold-glow-rgb), .55); }
|
||||
.evilhd.on .eh-sw { background: linear-gradient(180deg, rgb(var(--gold-hi-rgb)), rgb(var(--gold-low-rgb))); box-shadow: 0 0 16px rgba(var(--gold-glow-rgb), .5); border-color: rgba(var(--gold-hi-rgb), .9); }
|
||||
.evilhd.on .eh-sw i { left: 37px; background: var(--ink); }
|
||||
.evilhd.off { cursor: default; opacity: .6; }
|
||||
#s-home.nopic .evilhd { top: 118px; }
|
||||
/* ((Triforce, 11-25) the Remastered textures row under the switch: Evil HD's texture pack, its download and progress) */
|
||||
.ehpack { position: absolute; left: 672px; top: 544px; width: 544px; height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 12px 0 24px; box-sizing: border-box;
|
||||
background: rgba(10, 9, 8, .55); border: 1px solid rgba(var(--gold-rgb), .22); }
|
||||
.ehpack .ehp-txt { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
|
||||
.ehpack .ehp-txt b { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 700; font-size: 18px; color: var(--text); white-space: nowrap; }
|
||||
.ehpack .ehp-txt span { font-size: 12.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.ehpack .ehp-btn { flex: none; height: 28px; padding: 0 16px; font: 600 13px Commissioner, sans-serif; letter-spacing: .04em; color: var(--gold-hi); background: transparent;
|
||||
border: 1px solid rgba(var(--gold-rgb), .55); cursor: pointer; transition: background .2s, color .2s; }
|
||||
.ehpack .ehp-btn:hover, .ehpack .ehp-btn.kf { background: rgba(var(--gold-rgb), .16); }
|
||||
.ehpack.have .ehp-txt b { color: var(--gold-hi); }
|
||||
.ehpack .ehp-bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
|
||||
.ehpack .ehp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, rgb(var(--gold-low-rgb)), rgb(var(--gold-hi-rgb))); box-shadow: 0 0 10px rgba(var(--gold-glow-rgb), .6); transition: width .4s; }
|
||||
#s-home.nopic .ehpack { top: 192px; }
|
||||
@media (prefers-reduced-motion: reduce) { .evilhd, .evilhd * { transition: none !important; } }
|
||||
|
||||
@@ -327,6 +327,8 @@ const ACTIONS = {
|
||||
mod: (id) => openModSheet(id),
|
||||
sc: (i) => openSaveSheet(+i),
|
||||
file: (i) => { S.cur = +i; drawHome(); },
|
||||
texpack: () => cmd(S.texpack && S.texpack.busy ? 'texpackstop' : 'texpack'),
|
||||
evilhd: () => { const r = evilRow(); if (!r) return; r.v = +r.v === 1 ? 0 : 1; drawEvilHd(); cmd('gopt.value', { key: 'evil_hd', value: r.v }); },
|
||||
bringin: () => openSaveFlow('import'),
|
||||
copyout: () => openSaveFlow('export'),
|
||||
opt: (a, el) => { $$('.opt', el.parentElement).forEach(o => o.classList.toggle('sel', o === el)); },
|
||||
@@ -426,6 +428,36 @@ function addLog(lines) {
|
||||
}
|
||||
|
||||
/* ---------------- home ---------------- */
|
||||
/// ((Triforce, 11-25) Evil HD on the home screen, the owner's ask: the game's own row (evil_hd, the Graphics tab), on or off
|
||||
/// with one click; the same setting as the game's menu and F2. Hidden where the game's settings are not known (no game yet))
|
||||
function evilRow() {
|
||||
const g = S.gameopts; if (!g || !g.data) return null;
|
||||
for (const t in g.data) for (const s of g.data[t]) for (const r of s.rows) if (r.key === 'evil_hd') return r;
|
||||
return null;
|
||||
}
|
||||
function drawEvilHd() {
|
||||
const r = evilRow(), box = $('#evilHd'); if (!box) return;
|
||||
box.style.display = r ? '' : 'none'; if (!r) return;
|
||||
const on = +r.v === 1, locked = !!(S.gameopts && S.gameopts.locked);
|
||||
box.classList.toggle('on', on); box.classList.toggle('off', locked);
|
||||
box.title = r.help || '';
|
||||
$('#evilHdSub').textContent = locked ? 'Close the game to change it · F2 works while you play'
|
||||
: 'Remastered textures, edges and shadows · F2 in game';
|
||||
drawTexPack();
|
||||
}
|
||||
// ((Triforce, 11-25) the Remastered textures row under the switch: Evil HD's texture pack, downloaded into the game folder
|
||||
function drawTexPack() {
|
||||
const p = S.texpack, box = $('#ehPack'), r = evilRow(); if (!box) return;
|
||||
const show = !!(p && r && p.have !== 'nogame'); box.style.display = show ? '' : 'none'; if (!show) return;
|
||||
box.classList.toggle('busy', !!p.busy); box.classList.toggle('have', p.have === 'installed');
|
||||
const pct = Math.round((p.frac || 0) * 100);
|
||||
$('#ehPackSub').textContent = p.busy ? (p.line || 'Downloading') + ' · ' + pct + '%'
|
||||
: p.have === 'installed' ? 'Installed · shown while Evil HD is on'
|
||||
: p.have === 'partial' ? 'Stopped part way · goes on where it stopped'
|
||||
: '4,505 textures at twice the detail · ' + (p.size || '18 GB');
|
||||
$('#ehPackBtn').textContent = p.busy ? 'Stop' : p.have === 'installed' ? 'Manage' : p.have === 'partial' ? 'Continue' : 'Download';
|
||||
$('#ehPackBar').style.width = (p.busy ? pct : 0) + '%';
|
||||
}
|
||||
function picUrl(f) { return f && f.pic ? `url("${f.pic}")` : 'none'; }
|
||||
function drawHome() {
|
||||
const h = S.home; if (!h) return;
|
||||
@@ -446,6 +478,7 @@ function drawHome() {
|
||||
$('#hCap').textContent = f ? `${f.label} · ${f.last ? 'your last save · ' : ''}picture from the game` : '';
|
||||
$('#strip').innerHTML = files.map((x, i) => `<div class="f${i === S.cur ? ' on' : ''}" data-f data-act="file:${i}" id="f${i}"><img src="${esc(x.pic)}" alt=""><small>${esc(x.label)}</small></div>`).join('');
|
||||
$('.files').style.display = files.length ? '' : 'none';
|
||||
drawEvilHd();
|
||||
const n = h.news;
|
||||
$('#whatsnew').innerHTML = n ? `<h4>${esc(n.title)}${n.more && h.mode !== 'update' ? ' · <span class="lnk" data-f data-act="open:changes">All changes</span>' : ''}</h4>` + n.items.map(i => `<p><b>${esc(i.b)}</b> ${esc(i.p)}</p>`).join('') : '';
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{ slot: 6, label: 'File 6', place: 'Hyrule Castle', when: '9 Nov', meta: '5 h 50 min played · Saved 9 Nov', time: '5 h 50 min played', pic: 'img/save5.jpg' },
|
||||
];
|
||||
const NEWS = { title: 'New in 0.5.2', items: [{ b: 'Battle music', p: 'ends again after the last enemy.' }, { b: 'Menu text', p: 'always shows on every screen.' }, { b: 'Updates', p: 'download 12 MB and keep your shaders.' }], more: true };
|
||||
const st = { lang: 'English (US)', folder: 'D:\\Games\\Triforce', ver: '0.5.2', update: false, timer: 0, kind: '', sound: { music: .4, sfx: .7, muted: false } };
|
||||
const st = { lang: 'English (US)', folder: 'D:\\Games\\Triforce', ver: '0.5.2', update: false, timer: 0, kind: '', evil: 0, pack: { have: 'none', busy: false, frac: 0, line: '', size: '18.4 GB' }, packTimer: 0, sound: { music: .4, sfx: .7, muted: false } };
|
||||
const SET = () => [
|
||||
{ h: 'Launcher' }, { id: 'music', label: 'Music', kind: 'slider' }, { id: 'sfx', label: 'Sounds', kind: 'slider' },
|
||||
{ id: 'autostart', label: 'Start with Windows', value: 'No', actLabel: 'Change' },
|
||||
@@ -27,6 +27,10 @@
|
||||
];
|
||||
function home() {
|
||||
const s = { t: 'state', files: FILES, settings: SET(), bench: { available: true, last: 'Not run yet on this PC' }, sound: st.sound };
|
||||
// ((Triforce, 11-25) the game's own settings, Evil HD's row alone: the home screen's switch shows it)
|
||||
s.gameopts = { tabs: [{ id: 'graphics', name: 'Graphics' }], locked: false, note: '', data: { graphics: [{ h: 'Evil HD', rows: [
|
||||
{ key: 'evil_hd', label: 'Evil HD', value: st.evil ? 'On' : 'Off', v: st.evil, kind: 'choice', lo: 0, hi: 1, step: 1, restart: false, help: 'The fullest picture the game can give, for a powerful PC.' }] }] } };
|
||||
s.texpack = Object.assign({}, st.pack); // ((Triforce, 11-25) the Remastered textures row
|
||||
if (st.update) {
|
||||
s.home = { mode: 'update', eb: 'An update is ready', title: 'Version 0.5.3', meta: '12 MB download · About 4 minutes · your saves and mods stay', button: 'Update', act: 'update',
|
||||
links: [{ html: '<b>Play 0.5.2 first</b>', act: 'playold' }, { html: 'See all changes', act: 'open:changes' }], news: { title: 'New in 0.5.3', items: [{ b: 'RX 580', p: 'no more white speckles on grass and Link.' }, { b: 'Controller', p: 'LB and RB reach every menu tab.' }, { b: 'Mods', p: 'the whole list, and online co-op.' }] } };
|
||||
@@ -119,6 +123,7 @@
|
||||
receive(m, fn) {
|
||||
out = fn;
|
||||
if (m.t === 'ready') { emit({ t: 'hello', chrome: true, os: 'windows' }); emit({ t: 'state', sound: st.sound, media: { art: false, music: false, sfx: true } }); const j = location.hash.slice(1); if (j) window.DEMO.jump(j, fn); else emit({ t: 'go', s: 'welcome' }); return; }
|
||||
if (m.t === 'gopt.value' && m.key === 'evil_hd') { st.evil = +m.value ? 1 : 0; return emit(home()); }
|
||||
if (m.t === 'pick') return check(m.kind === 'folder' ? 'OcarinaOfTime (folder)' : 'OcarinaOfTime.nup');
|
||||
if (m.t === 'drop') return check(m.names[0] || 'file');
|
||||
if (m.t === 'win') return emit({ t: 'toast', html: 'Window button: ' + m.a + ' <span style="color:var(--text3)">· in the launcher only</span>' });
|
||||
@@ -139,6 +144,21 @@
|
||||
else if (c === 'saves.importfrom') emit({ t: 'toast', html: '<b>◆</b> 6 files brought in from Eden · the old ones are in backups', sfx: 'success' });
|
||||
else if (c === 'saves.export') emit({ t: 'choice', title: 'Copy saves out', text: 'Your files, copied. Nothing here changes.', ok: 'Copy them out', reply: 'saves.exportto', options: [{ id: 'eden', name: 'To Eden', sub: 'its files are backed up first', sel: true }, { id: 'dir', name: 'To a folder…' }] });
|
||||
else if (c === 'saves.exportto') emit({ t: 'toast', html: '<b>◆</b> 6 files copied out', sfx: 'success' });
|
||||
else if (c === 'texpack') { // ((Triforce, 11-25) the Remastered textures row: a pretend download, 19 parts
|
||||
if (st.pack.have === 'installed') emit({ t: 'ask', title: 'Remastered textures', html: '<p>Evil HD\'s remastered textures are installed in your game folder. The game shows them while <b>Evil HD</b> is on.</p><p>Remove them to free 18.4 GB. You can download them again any time.</p>', reply: 'texpack.go', buttons: [{ id: 'no', label: 'Keep them', main: true }, { id: 'rm', label: 'Remove' }] });
|
||||
else emit({ t: 'ask', title: 'Remastered textures', html: '<p>4,505 of the game\'s textures, remastered at twice the detail with their own grain kept. The game shows them while <b>Evil HD</b> is on, from its next start.</p><p><b>18.4 GB to download</b> (about 26 minutes at 100 Mbit/s), unpacked into your game folder as it comes. You can stop any time: it goes on where it stopped.</p><p>They take more video memory: best with a graphics card of 10 GB or more.</p>', reply: 'texpack.go', buttons: [{ id: 'no', label: 'Not now' }, { id: 'go', label: st.pack.have === 'partial' ? 'Continue' : 'Download', main: true }] });
|
||||
}
|
||||
else if (c === 'texpack.go' && m.id === 'go') {
|
||||
st.pack.busy = true; emit(home()); clearInterval(st.packTimer);
|
||||
st.packTimer = setInterval(() => {
|
||||
st.pack.frac = Math.min(1, st.pack.frac + 0.02); const n = Math.min(19, 1 + Math.floor(st.pack.frac * 19));
|
||||
st.pack.line = (st.pack.frac * 19 % 1 > 0.9 ? 'Unpacking part ' : 'Downloading part ') + n + ' of 19';
|
||||
if (st.pack.frac >= 1) { clearInterval(st.packTimer); st.pack = { have: 'installed', busy: false, frac: 1, line: '', size: '18.4 GB' }; emit({ t: 'toast', html: '<b>◆</b> Remastered textures installed · turn on <b>Evil HD</b> to see them' }); }
|
||||
emit(home());
|
||||
}, 300);
|
||||
}
|
||||
else if (c === 'texpack.go' && m.id === 'rm') { st.pack = { have: 'none', busy: false, frac: 0, line: '', size: '18.4 GB' }; emit({ t: 'toast', html: 'Remastered textures removed' }); emit(home()); }
|
||||
else if (c === 'texpackstop') { clearInterval(st.packTimer); st.pack.busy = false; st.pack.have = 'partial'; emit({ t: 'toast', html: 'Download stopped · it goes on where it stopped next time' }); emit(home()); }
|
||||
else if (c === 'setting' && m.id === 'uninstall') emit({ t: 'ask', title: 'Uninstall Triforce?', html: '<p>Removes the launcher, its tools and the built game.</p><p>Your saves and mods stay in a backup folder.</p>', reply: 'uninstall', buttons: [{ id: 'no', label: 'Keep it' }, { id: 'yes', label: 'Uninstall', main: true }] });
|
||||
else if (c === 'setting') emit({ t: 'toast', html: m.id + ' <span style="color:var(--text3)">· the launcher does this</span>' });
|
||||
else if (c === 'bench') bench();
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
<div class="logo"><div class="aura"></div><img class="gamelogo" src="img/game/Logo_USEU_00.png" alt=""></div>
|
||||
<div class="cont"><div class="eb" id="hEb"></div><h1 id="hH1"></h1><div class="meta" id="hMeta"></div></div>
|
||||
<div class="frame" id="hFrame"><div class="pic" id="homePic"></div><div class="edge"></div><div class="top"><i></i><i></i></div><div class="cap"><span></span><span id="hCap"></span></div></div>
|
||||
<div class="evilhd" id="evilHd" data-f data-act="evilhd"><div class="eh-txt"><b>Evil HD</b><span id="evilHdSub"></span></div><div class="eh-sw"><i></i></div></div>
|
||||
<div class="ehpack" id="ehPack"><div class="ehp-txt"><b>Remastered textures</b><span id="ehPackSub"></span></div><button class="ehp-btn" id="ehPackBtn" data-f data-act="texpack"></button><div class="ehp-bar"><i id="ehPackBar"></i></div></div>
|
||||
<div class="glow"></div>
|
||||
<div class="playrow"><div class="orn"></div><div class="play" data-f id="playBtn" data-act="play" data-big>Play</div><div class="orn r"></div></div>
|
||||
<div class="links" id="hLinks"></div>
|
||||
|
||||
Reference in New Issue
Block a user