mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-21 00:59:59 -04:00
Triforce v0.6.0 "Sage Of Power"
Faster frames (the replay's memory work, held submits, helper threads, collection and capture cuts), the game letting old areas go (QueryMemoryInfo), the 0.5.2 stutter fixed, AMD RX 5000/6000 and integrated-GPU fixes, the GPU device chosen by name, the in-game menus and launcher reworked, controller, Linux and benchmark fixes.
This commit is contained in:
@@ -135,7 +135,7 @@ public sealed partial class Backend
|
||||
Send(new JsonObject
|
||||
{
|
||||
["t"] = "bench", ["phase"] = "done", ["places"] = places, ["recs"] = recs,
|
||||
["verdict"] = Benchmark.Summary(r1.Scenes, r2?.Scenes, r2 != null ? benchSecond?.name : null),
|
||||
["verdict"] = Benchmark.Summary(r1.Scenes, r2?.Scenes, r2 != null ? benchSecond?.name : null) + Benchmark.SkippedNote(r1.Skipped),
|
||||
["eb"] = "Benchmark finished · " + BuildClock.Span(r1.Took + (r2?.Took ?? TimeSpan.Zero)) + (gpu != null ? " · " + gpu : ""),
|
||||
["compare"] = r2 == null && benchSecond != null ? "Compare with " + benchSecond.Value.name : null,
|
||||
["second"] = r2 != null ? benchSecond?.name : null,
|
||||
|
||||
@@ -27,11 +27,18 @@ public sealed partial class Backend
|
||||
readonly StringBuilder logOut = new();
|
||||
Timer? logTimer;
|
||||
BuildResult? lastResult;
|
||||
// ((Triforce) 11-19, ticket "this is what i get on the new launcher": a failure before the build itself (the tools'
|
||||
// download, the check) left no BuildResult, and Copy report said "stopped at its start after 0 s: no reason given"; the
|
||||
// reason was in launcher.log only. Now the report says it, and setup.log has it too)
|
||||
string? lastFailure;
|
||||
|
||||
// the game
|
||||
Process? gameProc;
|
||||
Timer? runningTimer;
|
||||
|
||||
LauncherColorChoice colorChoice = null!; // (the page's Color scheme: what state.color sends; RegisterCore)
|
||||
int colorRefused; // (1 once a 'color' that was not a #rrggbb is logged)
|
||||
|
||||
partial void AddSettingsState(JsonObject state);
|
||||
|
||||
void RegisterCore()
|
||||
@@ -73,13 +80,16 @@ public sealed partial class Backend
|
||||
On("dlssanswer", m => { if ((string?)m["id"] == "yes") new Dlss(ctx).Accept(); SendReveal(); });
|
||||
On("screen", _ => { });
|
||||
On("open", m => OpenThing((string?)m["arg"] ?? ""));
|
||||
On("report", _ => Copy(Report.ForBuild(ctx, lastResult, runner?.Details ?? "", new Tools(ctx).InstalledVersion)));
|
||||
On("report", _ => Copy(Report.ForBuild(ctx, lastResult, runner?.Details ?? "", new Tools(ctx).InstalledVersion, lastFailure)));
|
||||
On("sound", m =>
|
||||
{
|
||||
ctx.Settings.MusicVolume = (int)Math.Round(((double?)m["music"] ?? .4) * 100);
|
||||
ctx.Settings.SoundVolume = (int)Math.Round(((double?)m["sfx"] ?? .7) * 100);
|
||||
ctx.Settings.Muted = (bool?)m["muted"] ?? false;
|
||||
});
|
||||
// (the page's Color scheme row: ColorArrived takes the color as the message arrives; this keeps the newest one)
|
||||
colorChoice = new LauncherColorChoice(ctx.Settings);
|
||||
On("color", _ => colorChoice.Keep());
|
||||
On("closeanswer", m => { if ((string?)m["id"] == "yes") { StopEverything(); host.Close(); } });
|
||||
On("uninstallanswer", m =>
|
||||
{
|
||||
@@ -90,12 +100,22 @@ public sealed partial class Backend
|
||||
ctx.Platform.NotificationRequested += (_, n) => { Log.Write("notice: " + n.Title + " · " + n.Text); host.Attention(n.Title, n.Text); };
|
||||
}
|
||||
|
||||
/// <summary>The page's 'color', called by OnMessage as it arrives, before its handler goes to a worker: only a "#rrggbb" is
|
||||
/// taken (the color state.color sends from then on, also when nothing is written); anything else is left out, with one log
|
||||
/// line a run.</summary>
|
||||
void ColorArrived(JsonNode m)
|
||||
{
|
||||
if (colorChoice.Take(m) != null || Interlocked.Exchange(ref colorRefused, 1) != 0) return;
|
||||
var what = m["hex"]?.ToJsonString() ?? "(none)";
|
||||
Log.Write("color: not a #rrggbb, left out: " + (what.Length > 40 ? what.Substring(0, 40) + "..." : what));
|
||||
}
|
||||
|
||||
// ---------------- start ----------------
|
||||
void OnReady()
|
||||
{
|
||||
Send(new JsonObject { ["t"] = "hello", ["chrome"] = host.CustomChrome, ["os"] = OperatingSystem.IsWindows() ? "windows" : "linux" });
|
||||
var s = ctx.Settings;
|
||||
var state = new JsonObject { ["sound"] = new JsonObject { ["music"] = s.MusicVolume / 100.0, ["sfx"] = s.SoundVolume / 100.0, ["muted"] = s.Muted } };
|
||||
var state = new JsonObject { ["sound"] = new JsonObject { ["music"] = s.MusicVolume / 100.0, ["sfx"] = s.SoundVolume / 100.0, ["muted"] = s.Muted }, ["color"] = colorChoice.Current };
|
||||
AddSettingsState(state);
|
||||
SendState(state);
|
||||
if (start.SignalUpWhenShown) Startup.SignalUp(ctx);
|
||||
@@ -323,6 +343,7 @@ public sealed partial class Backend
|
||||
Push(true);
|
||||
Go("work");
|
||||
using var reg = token.Register(() => r.Stop());
|
||||
lastFailure = null;
|
||||
var res = lastResult = await r.RunAsync(req, token);
|
||||
Push(true);
|
||||
FlushLog();
|
||||
@@ -407,6 +428,9 @@ public sealed partial class Backend
|
||||
void WorkFailed(string title, string text, Exception? e)
|
||||
{
|
||||
if (e != null) Log.Write("work failed: " + e);
|
||||
lastFailure = title + ": " + text + (e != null ? " (" + e.GetType().Name + ": " + e.Message + ")" : "");
|
||||
lastResult = null;
|
||||
try { ctx.Log.Write("work failed: " + lastFailure); } catch (Exception) { }
|
||||
FlushLog();
|
||||
Send(new JsonObject
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ public sealed partial class Backend
|
||||
{
|
||||
var g = GameDir;
|
||||
if (g == null) return null;
|
||||
if (!gpusHooked) { GameOptionsSchema.UseSystemGpus(); gpusHooked = true; }
|
||||
if (!gpusHooked) { GameOptionsSchema.UseGameGpus(() => GameDir); gpusHooked = true; } // ((Triforce) 11-19: the game's own order)
|
||||
GameOptionsFile f;
|
||||
try { f = GameOptionsFile.Load(g, MainScreen()); }
|
||||
catch (Exception e) { Log.Write("game options: " + e.Message); return null; }
|
||||
|
||||
@@ -6,14 +6,16 @@ namespace Triforce.Launcher;
|
||||
|
||||
/// <summary>The Settings page (DESIGN 6 Settings): a plain list in groups, Launcher, Game, Shortcuts, Help, Remove. The page
|
||||
/// draws the list the launcher sends (state "settings"); pressing a row sends cmd 'setting' {id}. The two volume sliders are the
|
||||
/// page's and the core's ('sound'); they are only listed here. The benchmark (Backend.Bench.cs) is offered once a game is built.</summary>
|
||||
/// page's and the core's ('sound'); they are only listed here. The Color scheme row under them is the page's own (ui/app.js adds
|
||||
/// it): its 'color' {hex} is kept by the core (LauncherColorChoice, Settings.Color) and comes back as state.color at start and
|
||||
/// with the list. The benchmark (Backend.Bench.cs) is offered once a game is built.</summary>
|
||||
public sealed partial class Backend
|
||||
{
|
||||
const string DiscordUrl = "https://discord.gg/triforce";
|
||||
|
||||
partial void RegisterSettings()
|
||||
{
|
||||
On("settings.list", _ => SendSettings());
|
||||
On("settings.list", _ => SendSettings(color: true));
|
||||
On("setting", m => SettingPressed((string?)m["id"] ?? (string?)m["arg"]));
|
||||
On("settings.lang", m => LanguageChosen((string?)m["id"]));
|
||||
On("settings.dlss", m =>
|
||||
@@ -40,10 +42,13 @@ public sealed partial class Backend
|
||||
state["gameopts"] = GameOptsState();
|
||||
}
|
||||
|
||||
void SendSettings()
|
||||
/// <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
|
||||
/// the Settings page opens; not after a row's change, so a color still being chosen there is not set back).</summary>
|
||||
void SendSettings(bool color = false)
|
||||
{
|
||||
var o = new JsonObject();
|
||||
AddSettingsState(o);
|
||||
if (color) o["color"] = colorChoice.Current;
|
||||
SendState(o);
|
||||
}
|
||||
|
||||
@@ -92,7 +97,11 @@ public sealed partial class Backend
|
||||
rows.Add(SteamRow(game));
|
||||
|
||||
rows.Add(Head("Help"));
|
||||
rows.Add(Row("log", "Log folder", ctx.Platform.LogFolder(ctx.Home), "Open"));
|
||||
// ((Triforce) 11-20, ticket "The log button brings me to the wrong folder": the game writes triforce_log.txt (and .1 to .4)
|
||||
// beside its program in the game folder, which is what a bug report asks for; the launcher's own log is elsewhere)
|
||||
var gameLogs = GameLogFolder(game);
|
||||
rows.Add(Row("gamelog", "Game logs", gameLogs ?? "Build the game first", "Open", off: gameLogs == null));
|
||||
rows.Add(Row("log", "Launcher log", ctx.Platform.LogFolder(ctx.Home), "Open"));
|
||||
rows.Add(Row("report", "Report", "What to paste when you ask for help", "Copy"));
|
||||
rows.Add(Row("discord", "Discord", "discord.gg/triforce", "Open"));
|
||||
rows.Add(Row("versions", "Versions", VersionsLine(game), "Copy"));
|
||||
@@ -104,6 +113,11 @@ public sealed partial class Backend
|
||||
|
||||
static string Capital(string s) => s.Length > 0 ? char.ToUpperInvariant(s[0]) + s.Substring(1) : s;
|
||||
|
||||
/// <summary>((Triforce) 11-20) The folder the game writes triforce_log.txt in: its program's (Game.FindExe: the game folder on
|
||||
/// Windows, bin/ under it on Linux with the launcher script). Null without a built game.</summary>
|
||||
string? GameLogFolder(string? game) =>
|
||||
game != null && new Game(ctx).FindExe(game) is { } exe ? Path.GetDirectoryName(exe) : null;
|
||||
|
||||
string VersionsLine(string? game) =>
|
||||
"launcher " + BuildInfo.Version + " · tools " + (new Tools(ctx).InstalledVersion ?? "none") + " · game " + (game != null ? Game.BuiltVersion(game) ?? "unknown" : "not built");
|
||||
|
||||
@@ -174,6 +188,9 @@ public sealed partial class Backend
|
||||
case "log":
|
||||
OpenPlace(ctx.Platform.LogFolder(ctx.Home));
|
||||
break;
|
||||
case "gamelog":
|
||||
if (GameLogFolder(game) is { } logs) OpenPlace(logs);
|
||||
break;
|
||||
case "report":
|
||||
Copy(SettingsReport(game));
|
||||
break;
|
||||
|
||||
@@ -71,6 +71,8 @@ public sealed partial class Backend
|
||||
case "drop": if (files.Length > 0) _ = Intake(files[0]); break;
|
||||
case "cmd":
|
||||
var c = (string?)m["c"] ?? "";
|
||||
// (a color is taken here, in the order the page sent it, so a 'settings.list' after it sends it back)
|
||||
if (c == "color") ColorArrived(m);
|
||||
if (cmds.TryGetValue(c, out var h))
|
||||
Task.Run(() => { try { h(m, files); } catch (Exception e) { Log.Write("cmd " + c + ": " + e); Toast("Something went wrong: " + H(e.Message), "error"); } });
|
||||
else Log.Write("unhandled cmd " + c);
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
//
|
||||
// Layout: "BWAV", a byte order mark, a version, a CRC32, a prefetch flag (u16) and the channel count (u16 at 0x0E), then
|
||||
// 0x4C bytes per channel: codec (u16: 0 PCM16, 1 DSP-ADPCM), pan (u16: 0 left, 1 right, 2 middle), sample rate (u32),
|
||||
// sample count (u32), the count again, 16 DSP coefficients (s16), the place of the samples in the file (u32 at 0x30), ...
|
||||
// sample count (u32), the count again, 16 DSP coefficients (s16), the place of the samples in the file (u32 at 0x30) and
|
||||
// again (0x34), a u32 that is 1 in every file, looped or not (0x38), the loop's end (u32 at 0x3C: the sample after its
|
||||
// last one, 0xFFFFFFFF for a sound that does not loop) and its start (u32 at 0x40), then the ADPCM state at the loop.
|
||||
// The music loops that way: Saria's Song, the Fairy Fountain and the Temple of Time play an intro once and then loop to
|
||||
// their end from a sample after it; the item fanfare and the interface sounds have no loop.
|
||||
// DSP-ADPCM is frames of 8 bytes: a header (the coefficient pair's index, the scale's exponent) and 14 samples of four bits.
|
||||
// All numbers little-endian. Other codecs (the title music's codec 2) are not decoded.
|
||||
namespace Triforce.Core.GameFiles;
|
||||
@@ -17,6 +21,10 @@ public sealed class Pcm
|
||||
public int Frames => Samples.Length / 2;
|
||||
public double Seconds => Rate > 0 ? (double)Frames / Rate : 0;
|
||||
|
||||
/// <summary>The game's loop, in frames: from Start to just before End, which is at most Frames. Null for a sound that
|
||||
/// plays once (or a WAV file without a loop).</summary>
|
||||
public (int Start, int End)? Loop { get; init; }
|
||||
|
||||
/// <summary>The loudest sample's size (0 for silence).</summary>
|
||||
public int Peak
|
||||
{
|
||||
@@ -76,7 +84,21 @@ public static class Bwav
|
||||
samples[2 * i] = (short)Math.Clamp((int)l, -32768, 32767);
|
||||
samples[2 * i + 1] = (short)Math.Clamp((int)r, -32768, 32767);
|
||||
}
|
||||
return new Pcm { Rate = (int)rate, Samples = samples };
|
||||
return new Pcm { Rate = (int)rate, Samples = samples, Loop = LoopOf(b, 0x10, frames) };
|
||||
}
|
||||
|
||||
/// <summary>The loop a channel's header gives (its end at 0x3C, its start at 0x40), cut to the sound's length; null for
|
||||
/// a sound that does not loop (end 0xFFFFFFFF) or a loop that is none (its start not before its end). The first
|
||||
/// channel's: the game's files give every channel the same.</summary>
|
||||
static (int Start, int End)? LoopOf(byte[] b, long info, long frames)
|
||||
{
|
||||
long end = U32(b, info + 0x3C), start = U32(b, info + 0x40);
|
||||
if (end == 0xFFFFFFFF)
|
||||
return null;
|
||||
end = Math.Min(end, frames);
|
||||
if (start >= end)
|
||||
return null;
|
||||
return ((int)start, (int)end);
|
||||
}
|
||||
|
||||
/// <summary>Is the channel one of the two codecs, with all of its samples (as many as the sound has, at most) inside the
|
||||
@@ -131,7 +153,8 @@ public static class Bwav
|
||||
/// <summary>
|
||||
/// Tracks of the same rate summed sample by sample (a shorter one is silence after its end), then scaled so the loudest
|
||||
/// sample is at `peak` of full scale, each sample cut toward zero: mixwav.py. One track in gives that track normalized.
|
||||
/// Saria's Song is the eight BGM_LostWood_0 .. _7 layers mixed this way.
|
||||
/// Saria's Song is the eight BGM_LostWood_0 .. _7 layers mixed this way. The mix keeps the tracks' loop when they all
|
||||
/// have the same one (the eight layers do), else it has none.
|
||||
/// </summary>
|
||||
public static Pcm Mix(double peak, params Pcm[] tracks)
|
||||
{
|
||||
@@ -155,7 +178,10 @@ public static class Bwav
|
||||
var output = new short[length];
|
||||
for (var i = 0; i < length; i++)
|
||||
output[i] = (short)Math.Clamp((int)(sum[i] * gain), -32768, 32767);
|
||||
return new Pcm { Rate = rate, Samples = output };
|
||||
var loop = tracks[0].Loop;
|
||||
if (tracks.Any(t => t.Loop != loop))
|
||||
loop = null;
|
||||
return new Pcm { Rate = rate, Samples = output, Loop = loop };
|
||||
}
|
||||
|
||||
/// <summary>Mix at the default peak (70 % of full scale).</summary>
|
||||
@@ -171,51 +197,87 @@ public static class Bwav
|
||||
var output = new short[s.Length];
|
||||
for (var i = 0; i < s.Length; i++)
|
||||
output[i] = (short)Math.Clamp((int)(s[i] * gain), -32768, 32767);
|
||||
return new Pcm { Rate = track.Rate, Samples = output };
|
||||
return new Pcm { Rate = track.Rate, Samples = output, Loop = track.Loop };
|
||||
}
|
||||
|
||||
/// <summary>The sound as a WAV file's bytes: 16-bit stereo PCM with the usual 44-byte header.</summary>
|
||||
/// <summary>The size of the smpl chunk ToWav writes for a loop: its 8-byte head, 36 bytes and one loop of 24.</summary>
|
||||
public const int SmplChunkSize = 8 + 36 + 24;
|
||||
|
||||
/// <summary>
|
||||
/// The sound as a WAV file's bytes: 16-bit stereo PCM with the usual 44-byte header. A sound with a loop gets a smpl
|
||||
/// chunk after its data (the samples stay at byte 44, as in a file without one): one forward loop that plays for ever,
|
||||
/// from the loop's start to its last sample (smpl counts the end in), which is what the launcher's page loops between.
|
||||
/// </summary>
|
||||
public static byte[] ToWav(Pcm pcm)
|
||||
{
|
||||
var data = pcm.Samples.Length * 2;
|
||||
var wav = new byte[44 + data];
|
||||
var smpl = pcm.Loop.HasValue ? SmplChunkSize : 0;
|
||||
var wav = new byte[44 + data + smpl];
|
||||
void Tag(int at, string tag) { for (var i = 0; i < 4; i++) wav[at + i] = (byte)tag[i]; }
|
||||
void Put(int at, int value, int bytes) { for (var i = 0; i < bytes; i++) wav[at + i] = (byte)(value >> 8 * i); }
|
||||
Tag(0, "RIFF"); Put(4, 36 + data, 4); Tag(8, "WAVE");
|
||||
Tag(0, "RIFF"); Put(4, 36 + data + smpl, 4); Tag(8, "WAVE");
|
||||
Tag(12, "fmt "); Put(16, 16, 4); Put(20, 1, 2); Put(22, 2, 2); Put(24, pcm.Rate, 4); Put(28, pcm.Rate * 4, 4); Put(32, 4, 2); Put(34, 16, 2);
|
||||
Tag(36, "data"); Put(40, data, 4);
|
||||
System.Runtime.InteropServices.MemoryMarshal.AsBytes(pcm.Samples.AsSpan()).CopyTo(wav.AsSpan(44));
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
for (var i = 44; i + 1 < wav.Length; i += 2)
|
||||
for (var i = 44; i + 1 < 44 + data; i += 2)
|
||||
(wav[i], wav[i + 1]) = (wav[i + 1], wav[i]);
|
||||
if (pcm.Loop is { } loop)
|
||||
{
|
||||
// (manufacturer, product, the sample period in ns, MIDI note 60, no pitch fraction, no SMPTE, one loop, no
|
||||
// sampler data; then the loop: cue 0, type 0 = forward, start, last sample, no fraction, play count 0 = for ever)
|
||||
var at = 44 + data;
|
||||
Tag(at, "smpl"); Put(at + 4, 36 + 24, 4);
|
||||
Put(at + 16, pcm.Rate > 0 ? 1_000_000_000 / pcm.Rate : 0, 4); Put(at + 20, 60, 4); Put(at + 36, 1, 4);
|
||||
Put(at + 52, loop.Start, 4); Put(at + 56, loop.End - 1, 4);
|
||||
}
|
||||
return wav;
|
||||
}
|
||||
|
||||
/// <summary>A 16-bit stereo WAV file read back (for comparing with references; the data chunk is found by its tag).</summary>
|
||||
/// <summary>The first loop of a WAV file's smpl chunk (its body at `at`, `n` bytes), with its end made the sample after
|
||||
/// the last (null without a loop, or with a loop that ends before it starts).</summary>
|
||||
static (int Start, int End)? SmplLoop(byte[] wav, int at, int n)
|
||||
{
|
||||
if (n < 36 + 24 || at + 36 + 24 > wav.Length || U32(wav, at + 28) == 0)
|
||||
return null;
|
||||
long start = U32(wav, at + 36 + 8), last = U32(wav, at + 36 + 12);
|
||||
if (start > last || last >= int.MaxValue)
|
||||
return null;
|
||||
return ((int)start, (int)last + 1);
|
||||
}
|
||||
|
||||
/// <summary>A 16-bit stereo WAV file read back (for comparing with references; the chunks are found by their tags), with
|
||||
/// the loop of its smpl chunk when it has one inside the sound.</summary>
|
||||
public static Pcm FromWav(byte[] wav)
|
||||
{
|
||||
if (wav.Length < 12 || wav[0] != 'R' || wav[8] != 'W')
|
||||
throw new InvalidDataException("not a WAV file");
|
||||
int rate = 0, at = 12;
|
||||
short[]? samples = null;
|
||||
(int Start, int End)? loop = null;
|
||||
while (at + 8 <= wav.Length)
|
||||
{
|
||||
var tag = System.Text.Encoding.ASCII.GetString(wav, at, 4);
|
||||
var n = (int)U32(wav, at + 4);
|
||||
var n = (int)Math.Min(U32(wav, at + 4), wav.Length - at - 8);
|
||||
if (tag == "fmt ")
|
||||
{
|
||||
if (U16(wav, at + 8 + 2) != 2 || U16(wav, at + 8 + 14) != 16)
|
||||
throw new NotSupportedException("only 16-bit stereo WAV files are read");
|
||||
rate = (int)U32(wav, at + 8 + 4);
|
||||
}
|
||||
else if (tag == "data")
|
||||
else if (tag == "data" && samples == null)
|
||||
{
|
||||
n = Math.Min(n, wav.Length - at - 8);
|
||||
var samples = new short[n / 2];
|
||||
samples = new short[n / 2];
|
||||
System.Runtime.InteropServices.MemoryMarshal.Cast<byte, short>(wav.AsSpan(at + 8, n / 2 * 2)).CopyTo(samples);
|
||||
return new Pcm { Rate = rate, Samples = samples };
|
||||
}
|
||||
else if (tag == "smpl")
|
||||
loop = SmplLoop(wav, at + 8, n);
|
||||
at += 8 + n + (n & 1);
|
||||
}
|
||||
throw new InvalidDataException("WAV without data");
|
||||
if (samples == null)
|
||||
throw new InvalidDataException("WAV without data");
|
||||
if (loop is { } l && l.End > samples.Length / 2)
|
||||
loop = null;
|
||||
return new Pcm { Rate = rate, Samples = samples, Loop = loop };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ public sealed class GameMedia
|
||||
/// <summary>Changes whenever a decoder's output would change, so older cache files are not used.</summary>
|
||||
const string CacheVersion = "gamemedia-1";
|
||||
|
||||
/// <summary>The same for the sounds alone (the art's files keep their names): "loop-1" since the WAV files carry the
|
||||
/// game's loop in a smpl chunk, so a cache made before is decoded again once, its old files removed.</summary>
|
||||
const string SoundVersion = CacheVersion + "+loop-1";
|
||||
|
||||
/// <summary>The title screen's texture archive.</summary>
|
||||
public const string TitleArchive = "UI/Layout2Archive/Title.Product.100.Nin_Ounce_NVN2.bntx.zs";
|
||||
|
||||
@@ -97,7 +101,7 @@ public sealed class GameMedia
|
||||
var tracks = new Pcm[paths.Length];
|
||||
Parallel.For(0, paths.Length, i => tracks[i] = Bwav.Decode(source.Read(paths[i])));
|
||||
return Bwav.ToWav(Bwav.Mix(tracks));
|
||||
});
|
||||
}, SoundVersion);
|
||||
}
|
||||
|
||||
/// <summary>The names of the textures in an archive (to check a name, or to pick another piece of art).</summary>
|
||||
@@ -114,9 +118,9 @@ public sealed class GameMedia
|
||||
/// source files' stamps. Made by `make` when it is not there (written beside and then moved into place, so a reader
|
||||
/// never sees half a file); other versions of the same item are removed then.
|
||||
/// </summary>
|
||||
string Cached(string fileName, string[] inputs, Func<byte[]> make)
|
||||
string Cached(string fileName, string[] inputs, Func<byte[]> make, string version = CacheVersion)
|
||||
{
|
||||
var identity = new StringBuilder(CacheVersion).Append('|').Append(fileName);
|
||||
var identity = new StringBuilder(version).Append('|').Append(fileName);
|
||||
foreach (var input in inputs)
|
||||
identity.Append('|').Append(input).Append('=').Append(source.Stamp(input)
|
||||
?? throw new FileNotFoundException("The game has no " + input + " (" + source.Describe + ")", input));
|
||||
|
||||
@@ -33,7 +33,11 @@ public sealed record PlaceResult(string Place, double AverageFps, double OnePerc
|
||||
}
|
||||
|
||||
/// <summary>One benchmark run as the game wrote it.</summary>
|
||||
public sealed record BenchRun(IReadOnlyList<PlaceResult> Scenes, string? Gpu, bool Stopped, string? Error, TimeSpan Took);
|
||||
public sealed record BenchRun(IReadOnlyList<PlaceResult> Scenes, string? Gpu, bool Stopped, string? Error, TimeSpan Took)
|
||||
{
|
||||
/// <summary>((Triforce, 11-19) the places the game would not take Link to, left out (host/hos_bench.c skip_scene)</summary>
|
||||
public IReadOnlyList<string> Skipped { get; init; } = Array.Empty<string>();
|
||||
}
|
||||
|
||||
/// <summary>A setting the benchmark would change: its triforce_options.ini key, the menu's row name, the value now and the
|
||||
/// recommended one (the App shows them with the menu's own labels).</summary>
|
||||
@@ -72,6 +76,7 @@ public sealed class Benchmark : IBenchmarkRunner
|
||||
// 3 FSR 3.1, 4 FSR 4. resolution: 3 = 67 % (Quality), 5 = 58 % (Balanced), 4 = 50 % (Performance). quality_preset 0 Custom.
|
||||
static readonly (int value, int fps)[] Caps = { (0, 60), (2, 120), (3, 144), (5, 240) };
|
||||
public const int UpGame = 0, UpDlss = 1, UpFsr3 = 3, ResQuality = 3, ResBalanced = 5, CapUncapped = 5;
|
||||
public const int SteadyRefreshSteps = 2; // (fps_cap.h: 0 Off, 1 Any rate, 2 Refresh steps)
|
||||
|
||||
public string WorkFolder => Path.Combine(ctx.WorkFolder, "benchmark");
|
||||
string Marker => Path.Combine(WorkFolder, "restore.txt");
|
||||
@@ -156,7 +161,7 @@ public sealed class Benchmark : IBenchmarkRunner
|
||||
RestoreIfLeft();
|
||||
var userCopy = Path.Combine(WorkFolder, "user");
|
||||
if (Directory.Exists(userCopy)) Directory.Delete(userCopy, true);
|
||||
CopyUser(Path.Combine(game, "user"), userCopy);
|
||||
CopyUser(ctx.Platform.UserFolder(game), userCopy); // ((Triforce) 11-19: on Linux it is outside the game folder)
|
||||
var backup = Path.Combine(WorkFolder, "options.backup.ini");
|
||||
var hadOptions = File.Exists(ini);
|
||||
if (hadOptions) File.Copy(ini, backup, true);
|
||||
@@ -238,9 +243,12 @@ public sealed class Benchmark : IBenchmarkRunner
|
||||
if (s.TryGetProperty("frametimes_ms", out var f)) foreach (var x in f.EnumerateArray()) if (x.TryGetDouble(out var d)) ft.Add(d);
|
||||
scenes.Add(new PlaceResult(s.TryGetProperty("name", out var n) ? n.GetString() ?? "" : "", D("avg"), D("low1"), false) { Low01 = D("low01"), FrameTimes = ft });
|
||||
}
|
||||
var skipped = new List<string>();
|
||||
if (r.TryGetProperty("skipped", out var sk) && sk.ValueKind == System.Text.Json.JsonValueKind.Array)
|
||||
foreach (var x in sk.EnumerateArray()) if (x.GetString() is { Length: > 0 } name) skipped.Add(name);
|
||||
return new BenchRun(scenes, r.TryGetProperty("gpu", out var gpu) ? gpu.GetString() : null,
|
||||
r.TryGetProperty("stopped", out var st) && st.ValueKind == System.Text.Json.JsonValueKind.True,
|
||||
r.TryGetProperty("error", out var er) ? er.GetString() : null, took);
|
||||
r.TryGetProperty("error", out var er) ? er.GetString() : null, took) { Skipped = skipped };
|
||||
}
|
||||
|
||||
/// <summary>The old interface: one run, then the rules (the App runs the upscaler pass on its own, when asked).</summary>
|
||||
@@ -249,7 +257,7 @@ public sealed class Benchmark : IBenchmarkRunner
|
||||
var now = BenchIni.Read(OptionsOf(request.GameFolder));
|
||||
var run = await RunOnceAsync(request.GameFolder, null, progress, token);
|
||||
var recs = Recommend(now, run.Scenes, null, null, DisplayHz());
|
||||
return new BenchmarkResult(run.Scenes, null, null, recs, Summary(run.Scenes, null, null), run.Took);
|
||||
return new BenchmarkResult(run.Scenes, null, null, recs, Summary(run.Scenes, null, null) + SkippedNote(run.Skipped), run.Took);
|
||||
}
|
||||
|
||||
static void CopyUser(string from, string to)
|
||||
@@ -282,9 +290,11 @@ public sealed class Benchmark : IBenchmarkRunner
|
||||
foreach (var (value, fps) in Caps)
|
||||
if (worstLow >= fps && (displayHz <= 0 || fps <= displayHz + 1)) cap = value;
|
||||
recs.Add(new SettingChange(KCap, "Game frame rate cap", Now(KCap, 0), cap));
|
||||
// steady frame rate: on where the lows fall under 80 % of the average anywhere
|
||||
// steady frame rate: on where the lows fall under 80 % of the average anywhere. ((Triforce) 11-19, ticket "screen tearing":
|
||||
// "Any rate" (1) held 36 fps on an RTX 2060 Max-Q's 60 Hz screen, frames shown for one refresh, then two: uneven, seen as
|
||||
// tearing. "Refresh steps" (2) holds rates that divide the refresh (60, 30), even on a screen without G-Sync/FreeSync)
|
||||
var uneven = chosen.Any(r => r.OnePercentLow < r.AverageFps * 0.8);
|
||||
recs.Add(new SettingChange(KSteady, "Steady frame rate", Now(KSteady, 0), uneven ? 1 : Now(KSteady, 0)));
|
||||
recs.Add(new SettingChange(KSteady, "Steady frame rate", Now(KSteady, 0), uneven ? SteadyRefreshSteps : Now(KSteady, 0)));
|
||||
// frame generation: never turned on by this (DESIGN 12: only below 60 with DLSS-G / FSR 4 FG, not measured yet)
|
||||
recs.Add(new SettingChange(KFrameGen, "Frame generation", Now(KFrameGen, 0), Now(KFrameGen, 0)));
|
||||
if (recs.Any(r => r.Changes && (r.Key == KUpscaler || r.Key == KResolution)))
|
||||
@@ -292,6 +302,10 @@ public sealed class Benchmark : IBenchmarkRunner
|
||||
return recs;
|
||||
}
|
||||
|
||||
/// <summary>((Triforce, 11-19) the verdict's note for places left out ("" when none)</summary>
|
||||
public static string SkippedNote(IReadOnlyList<string> skipped) => skipped.Count == 0 ? ""
|
||||
: " " + string.Join(" and ", skipped) + (skipped.Count == 1 ? " was" : " were") + " left out: the game would not take Link there from your save.";
|
||||
|
||||
public static string Summary(IReadOnlyList<PlaceResult> p1, IReadOnlyList<PlaceResult>? p2, string? second)
|
||||
{
|
||||
var w1 = p1.Min(r => r.OnePercentLow);
|
||||
|
||||
@@ -267,6 +267,10 @@ public sealed class GameOptionsFile : IGameOptionValues
|
||||
write[GameOptionsSchema.ResolutionKey] = (Atoi(dyn) != 0 ? 0 : 1).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
foreach (var (k, v) in set) write[k] = v.ToString(CultureInfo.InvariantCulture);
|
||||
// ((Triforce) 11-20) the GPU device row's card by its name too: the game finds it by the name first, so the number
|
||||
// counted in Windows' order (no triforce_gpus.txt before the game's first run) no longer picks another card. Auto: empty
|
||||
if (set.TryGetValue(GameOptionsSchema.GpuKey, out var gpu))
|
||||
write[GameOptionsSchema.GpuNameKey] = (GameOptionsSchema.GpuNameOf(gpu) ?? "").Replace('\r', ' ').Replace('\n', ' ');
|
||||
var bump = !exists || !hasVersion || Atoi(vs!) < GameOptionsSchema.CurrentVersion;
|
||||
if (bump) write[GameOptionsSchema.VersionKey] = GameOptionsSchema.CurrentVersion.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
|
||||
@@ -36,6 +36,31 @@ public static class GameOptionsSchema
|
||||
/// <summary>GpuNames from Gpus.List() (this PC's display adapters).</summary>
|
||||
public static void UseSystemGpus() => GpuNames = () => Gpus.List().Select(g => g.Name).ToList();
|
||||
|
||||
/// <summary>((Triforce) 11-19, ticket "GPU read issue") GpuNames as the game counts them: the game folder's
|
||||
/// triforce_gpus.txt ("<value>\t<name>" lines, gpu/vk/vk_main.cpp pick_device), which the game writes at every
|
||||
/// start. Windows' order of the display adapters (Gpus.List()) is not Vulkan's on every PC: on a laptop with an Intel UHD
|
||||
/// 770 and an RTX 3050 the launcher's "1: NVIDIA" saved the value the game reads as the Intel. Without the file (a game
|
||||
/// that has not started since v0.5.3): Windows' order, as before.</summary>
|
||||
public static void UseGameGpus(Func<string?> gameFolder) => GpuNames = () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (gameFolder() is { } g && File.Exists(Path.Combine(g, GpuListFile)))
|
||||
{
|
||||
var names = new List<string>();
|
||||
foreach (var line in File.ReadAllLines(Path.Combine(g, GpuListFile)))
|
||||
{
|
||||
var tab = line.IndexOf('\t');
|
||||
if (tab > 0 && int.TryParse(line.AsSpan(0, tab), out var v) && v == names.Count + 1) names.Add(line[(tab + 1)..].Trim());
|
||||
}
|
||||
if (names.Count > 0) return names;
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
return Gpus.List().Select(x => x.Name).ToList();
|
||||
};
|
||||
public const string GpuListFile = "triforce_gpus.txt";
|
||||
|
||||
// ---- the keys ----
|
||||
|
||||
/// <summary>vk_menu.cpp ini_key: a few rows keep the keys they were first saved with; every other row's key is its
|
||||
@@ -134,6 +159,16 @@ public static class GameOptionsSchema
|
||||
{
|
||||
try { return GpuNames?.Invoke() ?? Array.Empty<string>(); } catch (Exception) { return Array.Empty<string>(); }
|
||||
}
|
||||
/// <summary>((Triforce) 11-20) The GPU device row's card for a value, by the name the row shows for it (GpuNames): what
|
||||
/// GameOptionsFile.Save writes as gpu_device_name beside the number, so that the game finds the card the player clicked
|
||||
/// whatever order the list was in (gpu/vk/gpu_choice.h pick). Null for Auto or a value with no name.</summary>
|
||||
public static string? GpuNameOf(int v)
|
||||
{
|
||||
if (v <= 0) return null;
|
||||
var names = GpuNamesNow();
|
||||
return v - 1 < names.Count && names[v - 1].Trim() is { Length: > 0 } n ? n : null;
|
||||
}
|
||||
public const string GpuNameKey = "gpu_device_name";
|
||||
/// <summary>tx_mic without the game's device list: Off, Default, and a device by the name the file keeps
|
||||
/// (microphone_device), "Microphone" without one.</summary>
|
||||
static string TxMic(int v, IGameOptionValues? o)
|
||||
@@ -280,7 +315,7 @@ public static class GameOptionsSchema
|
||||
Row(GameOptionTab.Display, "High dynamic range", "HDR peak brightness", 400, 10000, 100, 1000, GameOptionKind.Slider, TxNits, false, true,
|
||||
"The brightest highlights with HDR on: set it to your display's peak brightness."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX HDR", 0, 1, 1, 0, GameOptionKind.Choice, TxOnoff, true, true,
|
||||
"With HDR set to Native: RenoDX's tone mapping, eye adaptation and colour grading in place of the game's own, and its rows below. Off: the game's own HDR. Applies after a restart. RenoDX is by Carlos Lopez (clshortfuse), under the MIT license."),
|
||||
"With HDR set to Native: RenoDX's tone mapping, eye adaptation and color grading in place of the game's own, and its rows below. Off: the game's own HDR. Applies after a restart. RenoDX is by Carlos Lopez (clshortfuse), under the MIT license."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX tonemapper", 0, 2, 1, 1, GameOptionKind.Choice, TxRdxTonemap, false, true,
|
||||
"With HDR Native: how the scene's light is brought to the display. Vanilla: the game's own curve. PsychoV35: RenoDX's, which keeps hue and saturation into the highlights, up to the peak brightness. RenoDRT: RenoDX's, which carries the game's SDR look up to the peak by brightness. RenoDX is by Carlos Lopez (clshortfuse), under the MIT license."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX gamma correction", 0, 2, 1, 0, GameOptionKind.Choice, TxRdxGamma, false, true,
|
||||
@@ -292,31 +327,31 @@ public static class GameOptionsSchema
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX tone slope", 0, 100, 1, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"With PsychoV35: the steepness of the tone curve through middle grey. 50 leaves it unchanged."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX hue clip", 0, 100, 5, 50, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"With PsychoV35: how much bright colours turn as they do where the game's SDR picture clips: fire towards yellow and white. 0% keeps their hue."),
|
||||
"With PsychoV35: how much bright colors turn as they do where the game's SDR picture clips: fire towards yellow and white. 0% keeps their hue."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX UI brightness", 80, 400, 10, 200, GameOptionKind.Slider, TxNits, false, true,
|
||||
"How bright the menus' and the HUD's white is with RenoDX's tonemapper. The scene's follows HDR paper white."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX color space", 0, 2, 1, 1, GameOptionKind.Choice, TxRdxSpace, false, true,
|
||||
"The colours the picture is taken to be in before HDR10's. Vanilla: the game's own matrix. BT.709: as the SDR picture. DCI-P3: more saturated."),
|
||||
"The colors the picture is taken to be in before HDR10's. Vanilla: the game's own matrix. BT.709: as the SDR picture. DCI-P3: more saturated."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX exposure", 0, 200, 5, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"The scene's brightness before RenoDX's tone mapping. 100% is the game's."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX highlights", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"RenoDX's colour grading: the bright parts of the scene. 50 is neutral."),
|
||||
"RenoDX's color grading: the bright parts of the scene. 50 is neutral."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX shadows", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"RenoDX's colour grading: the dark parts of the scene. 50 is neutral."),
|
||||
"RenoDX's color grading: the dark parts of the scene. 50 is neutral."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX contrast", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"RenoDX's colour grading: the scene's contrast. 50 is neutral."),
|
||||
"RenoDX's color grading: the scene's contrast. 50 is neutral."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX saturation", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"RenoDX's colour grading: the scene's saturation. 50 is neutral."),
|
||||
"RenoDX's color grading: the scene's saturation. 50 is neutral."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX highlight saturation", 0, 100, 1, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"With RenoDRT: the strength of the colours of the brightest parts. 50 leaves it unchanged."),
|
||||
"With RenoDRT: the strength of the colors of the brightest parts. 50 leaves it unchanged."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX blowout", 0, 100, 1, 0, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"With RenoDRT: turns the brightest parts towards white. 0 keeps their colour."),
|
||||
"With RenoDRT: turns the brightest parts towards white. 0 keeps their color."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX flare", 0, 100, 1, 0, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"With RenoDRT: lifts the darkest parts as a little stray light would. 0 keeps black black."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX hue correction", 0, 100, 5, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"With RenoDRT: how much bright colours keep the hue they have before the tonemapper. 0% lets them shift as the curve takes them."),
|
||||
"With RenoDRT: how much bright colors keep the hue they have before the tonemapper. 0% lets them shift as the curve takes them."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX color grading", 0, 100, 5, 100, GameOptionKind.Slider, TxPercent, false, true,
|
||||
"With RenoDRT: how much of the game's own colour grading the HDR picture keeps. 0% is the scene without it."),
|
||||
"With RenoDRT: how much of the game's own color grading the HDR picture keeps. 0% is the scene without it."),
|
||||
Row(GameOptionTab.Display, "RenoDX", "RenoDX bloom", 0, 100, 5, 50, GameOptionKind.Slider, TxRdxGrade, false, true,
|
||||
"How strong the glow around bright things is. 50 is the game's."),
|
||||
Row(GameOptionTab.Graphics, "Quality", "Quality preset", 0, 5, 1, 0, GameOptionKind.Choice, TxPreset, false, false,
|
||||
@@ -443,6 +478,7 @@ public static class GameOptionsSchema
|
||||
{
|
||||
[VersionKey] = "the file's format: the rules the game reads an older file by (GameOptionsFile.Save writes 7 when it brings an older file up to date)",
|
||||
[MicDeviceKey] = "the Microphone row's device, by its name: the game's to choose from the devices it lists",
|
||||
[GpuNameKey] = "the GPU device row's card by its name (11-20): Save writes it with the row; the game finds the card by it first",
|
||||
["layout_preset"] = "the Controls page's Layout preset: choosing one in the game rebinds the pad_ lines, which a changed value alone would not do",
|
||||
["debug_tools"] = "the Debug tab (not ported)",
|
||||
["descriptor_reuse"] = "the Debug tab's Developer rows (not ported)",
|
||||
|
||||
@@ -45,14 +45,16 @@ public static class Report
|
||||
|
||||
/// <summary>The report for a build that stopped (old Shell.cs CopyTheReport): the launcher's and tools' versions, the OS, the
|
||||
/// step it stopped at, why, the command, the game folder and the install with their free space, then the logs.</summary>
|
||||
public static string ForBuild(TriforceContext ctx, BuildResult? result, string buildLines, string? toolsVersion)
|
||||
public static string ForBuild(TriforceContext ctx, BuildResult? result, string buildLines, string? toolsVersion, string? failure = null)
|
||||
{
|
||||
string Room(string folder) => ctx.FreeBytes(folder) is { } free ? " (" + ctx.Platform.Disk(folder) + " has " + (free >> 30) + " GB free)" : "";
|
||||
var step = result?.StoppedAt is { } s && BuildStages.Find(s) is { } st ? "\"" + st.Text + "\"" : "its start";
|
||||
var known = new[]
|
||||
{
|
||||
"Triforce " + BuildInfo.Version + ", tools " + (toolsVersion ?? "none") + ", " + Environment.OSVersion.VersionString,
|
||||
"The build stopped at " + step + " after " + BuildClock.Span(result?.Elapsed ?? TimeSpan.Zero) + ": " + (result?.Failure ?? "no reason given"),
|
||||
result == null && failure != null
|
||||
? "It stopped before the build itself: " + failure
|
||||
: "The build stopped at " + step + " after " + BuildClock.Span(result?.Elapsed ?? TimeSpan.Zero) + ": " + (result?.Failure ?? failure ?? "no reason given"),
|
||||
result?.CommandLine ?? "",
|
||||
"Game folder: " + (result?.OutFolder ?? "") + (result?.OutFolder is { } o ? Room(o) : ""),
|
||||
"Launcher: " + ctx.Home + Room(ctx.Home),
|
||||
|
||||
61
launcher/Logic/LauncherColor.cs
Normal file
61
launcher/Logic/LauncherColor.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
// The launcher page's color scheme (Settings > Launcher > Color scheme): one color in place of Triforce gold. The page draws
|
||||
// it (ui/app.js, "settings: Color scheme") and sends {t:'cmd', c:'color', hex:'#rrggbb'}; the launcher keeps it with its
|
||||
// other settings (Settings.Color) and sends it back as state.color at start and when the Settings page asks for its list.
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Triforce.Logic;
|
||||
|
||||
public static class LauncherColor
|
||||
{
|
||||
/// <summary>Triforce gold, the look as it was: the page's GOLD, and what Reset to gold sends.</summary>
|
||||
public const string Default = "#e0b23e";
|
||||
|
||||
/// <summary>"#rrggbb" (six hex digits, either case) as "#rrggbb" in lower case; null for anything else (no "#", three
|
||||
/// digits, a name, spaces around it, an alpha).</summary>
|
||||
public static string? Parse(string? s)
|
||||
{
|
||||
if (s is not { Length: 7 } || s[0] != '#') return null;
|
||||
for (var i = 1; i < 7; i++)
|
||||
if (!char.IsAsciiHexDigit(s[i])) return null;
|
||||
return s.ToLowerInvariant();
|
||||
}
|
||||
|
||||
/// <summary>The page's 'color' command: its "hex" when that is a JSON string Parse takes, else null (no object, no hex,
|
||||
/// a number, an array, an object, a bad string).</summary>
|
||||
public static string? FromCommand(JsonNode? message) =>
|
||||
message is JsonObject o && o["hex"] is JsonValue v && v.GetValueKind() == JsonValueKind.String ? Parse(v.GetValue<string>()) : null;
|
||||
}
|
||||
|
||||
/// <summary>The launcher's color while it runs: the last one the page sent, else the kept one (Settings.Color). It is held here
|
||||
/// and not only in the settings because a run that writes nothing (NoWrites, --snapshot) must still send back the color the
|
||||
/// player chose, not the old kept one, and because the page's commands run on worker threads in any order: Take is called as
|
||||
/// each 'color' arrives, in the order the page sent it, so a 'settings.list' handled after it sends the new color, and Keep
|
||||
/// writes the newest choice whichever of its workers runs last.</summary>
|
||||
public sealed class LauncherColorChoice
|
||||
{
|
||||
readonly Settings settings;
|
||||
readonly object keeping = new();
|
||||
volatile string? chosen;
|
||||
|
||||
public LauncherColorChoice(Settings settings) => this.settings = settings;
|
||||
|
||||
/// <summary>What state.color says: the page's last color, or the kept one before the page has sent any.</summary>
|
||||
public string Current => chosen ?? settings.Color;
|
||||
|
||||
/// <summary>The page's 'color' command, as it arrives: its color (LauncherColor.FromCommand) becomes Current; null when it
|
||||
/// is not a #rrggbb, and Current stays.</summary>
|
||||
public string? Take(JsonNode? message)
|
||||
{
|
||||
var hex = LauncherColor.FromCommand(message);
|
||||
if (hex != null) chosen = hex;
|
||||
return hex;
|
||||
}
|
||||
|
||||
/// <summary>Writes Current as Settings.Color when the page has sent one and it differs (dropped under NoWrites).</summary>
|
||||
public void Keep()
|
||||
{
|
||||
lock (keeping)
|
||||
if (chosen is { } hex && hex != settings.Color) settings.Color = hex;
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,11 @@ public interface IPlatform
|
||||
string LogFolder(string home);
|
||||
/// <summary>Where NVIDIA's DLSS SDK is fetched to: beside the tools, never inside them (an update replaces those whole).</summary>
|
||||
string NgxSdkFolder(string home);
|
||||
/// <summary>The save folder of a game folder: Windows <game>\user\save\<uid>; Linux ${XDG_DATA_HOME}/hookshot/save/<uid>.</summary>
|
||||
/// <summary>The save folder of a game folder: Windows <game>\user\save\<uid>; Linux <UserFolder>/save/<uid>.</summary>
|
||||
string SaveFolder(string game, string uid);
|
||||
/// <summary>The game's user folder (its saves, their commits, its options): what --user names. Windows <game>\user;
|
||||
/// Linux ${XDG_DATA_HOME}/triforce/user, or the folder an older build used while the game has not moved it yet.</summary>
|
||||
string UserFolder(string game);
|
||||
/// <summary>The folders emulators keep their data in: (Roaming, Local) on Windows; (data, config) on Linux.</summary>
|
||||
(string Roaming, string Local) EmulatorDataRoots { get; }
|
||||
/// <summary>Steam folders to look in, in order (test run: <root>\Steam only).</summary>
|
||||
|
||||
@@ -41,8 +41,18 @@ public sealed class LinuxPlatform : PlatformBase
|
||||
public override string LogFolder(string home) => Path.Combine(StateHome, "triforce");
|
||||
// (hookshot_builder.py ngx_sdk_dir: beside the builder's versions, kept across updates)
|
||||
public override string NgxSdkFolder(string home) => Path.Combine(DefaultInstallDir, "ngx-sdk");
|
||||
// (host/hos_main.c saves_dir: $XDG_DATA_HOME/hookshot, outside the game folder so a rebuild keeps them)
|
||||
public override string SaveFolder(string game, string uid) => Path.Combine(DataHome, "hookshot", "save", uid);
|
||||
// (host/hos_main.c saves_dir: $XDG_DATA_HOME/triforce/user, outside the game folder so a rebuild keeps them)
|
||||
public override string SaveFolder(string game, string uid) => Path.Combine(UserFolder(game), "save", uid);
|
||||
/// <summary>((Triforce) 11-19) $XDG_DATA_HOME/triforce/user. Until the game has started once on v0.5.3 or later, the saves are
|
||||
/// still where an older build kept them: $XDG_DATA_HOME/hookshot (the game renames that to triforce/user at its next
|
||||
/// start), or the game folder's user/ when the game could not move them out of it. The first of these with a save folder.</summary>
|
||||
public override string UserFolder(string game)
|
||||
{
|
||||
var now = Path.Combine(DataHome, "triforce", "user");
|
||||
foreach (var d in new[] { now, Path.Combine(DataHome, "hookshot"), Path.Combine(game, "user") })
|
||||
if (Directory.Exists(Path.Combine(d, "save"))) return d;
|
||||
return now;
|
||||
}
|
||||
public override (string Roaming, string Local) EmulatorDataRoots => (DataHome, ConfigHome);
|
||||
|
||||
public override IReadOnlyList<string> SteamRoots()
|
||||
|
||||
@@ -27,6 +27,7 @@ public abstract class PlatformBase : IPlatform
|
||||
public abstract string LogFolder(string home);
|
||||
public abstract string NgxSdkFolder(string home);
|
||||
public abstract string SaveFolder(string game, string uid);
|
||||
public abstract string UserFolder(string game);
|
||||
public abstract (string Roaming, string Local) EmulatorDataRoots { get; }
|
||||
public abstract IReadOnlyList<string> SteamRoots();
|
||||
public abstract string ShortcutPath(ShortcutPlace place);
|
||||
|
||||
@@ -17,6 +17,8 @@ public static class SettingNames
|
||||
SetupSkip = "SetupSkip", Sounds = "Sounds", ModsBuilt = "ModsBuilt";
|
||||
// (DESIGN 10: kept per user)
|
||||
public const string MusicVolume = "MusicVolume", SoundVolume = "SoundVolume", Muted = "Muted";
|
||||
// (the page's Color scheme, "#rrggbb": LauncherColor)
|
||||
public const string Color = "Color";
|
||||
}
|
||||
|
||||
/// <summary>Where the settings are kept. Get/Set work on the settings; the Uninstall* calls on the Apps-list entry (Windows,
|
||||
@@ -221,6 +223,13 @@ public sealed class Settings
|
||||
/// <summary>DESIGN 10: 0..100, default 70.</summary>
|
||||
public int SoundVolume { get => Percent(SettingNames.SoundVolume, 70); set => Set(SettingNames.SoundVolume, Math.Clamp(value, 0, 100).ToString()); }
|
||||
public bool Muted { get => Get(SettingNames.Muted) == "1"; set => Set(SettingNames.Muted, value ? "1" : "0"); }
|
||||
/// <summary>The page's color scheme, "#rrggbb" in lower case: Triforce gold (LauncherColor.Default) when never chosen, as in
|
||||
/// every settings file from before it, or when what is kept does not read as one. Only a color LauncherColor.Parse takes is kept.</summary>
|
||||
public string Color
|
||||
{
|
||||
get => LauncherColor.Parse(Get(SettingNames.Color)) ?? LauncherColor.Default;
|
||||
set => Set(SettingNames.Color, LauncherColor.Parse(value) ?? throw new ArgumentException("Not a #rrggbb color: " + value));
|
||||
}
|
||||
|
||||
int Percent(string name, int fallback) => int.TryParse(Get(name), out var v) && v >= 0 && v <= 100 ? v : fallback;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ public sealed class WindowsPlatform : PlatformBase
|
||||
public override string DefaultGameFolder => Path.Combine(TestRoot ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Games", "Triforce");
|
||||
public override string LogFolder(string home) => home;
|
||||
public override string NgxSdkFolder(string home) => Path.Combine(home, "ngx-sdk");
|
||||
public override string SaveFolder(string game, string uid) => Path.Combine(game, "user", "save", uid);
|
||||
public override string SaveFolder(string game, string uid) => Path.Combine(UserFolder(game), "save", uid);
|
||||
public override string UserFolder(string game) => Path.Combine(game, "user");
|
||||
public override (string Roaming, string Local) EmulatorDataRoots => TestRoot != null
|
||||
? (Path.Combine(TestRoot, "Roaming"), Path.Combine(TestRoot, "Local"))
|
||||
: (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Saves of this game (Ocarina of Time, 0400486024DEC000), wherever they are (old setup/Saves.cs, Shell.Saves.cs): Triforce keeps
|
||||
// them in <game>\user\save\<uid> (Linux: ~/.local/share/hookshot/save/<uid>, host/hos_main.c saves_dir), emulators in their NAND
|
||||
// them in <game>\user\save\<uid> (Linux: ~/.local/share/triforce/user/save/<uid>, host/hos_main.c saves_dir; older builds ~/.local/share/hookshot), emulators in their NAND
|
||||
// (Eden, yuzu, suyu, sudachi, citron, torzu, EvilOOT: nand\user\save\0000000000000000\<user>\0400486024DEC000) or Ryujinx's
|
||||
// bis\user\save\<index>\0, NX2navi in its game folder's profile (NaviSave). The files are the same everywhere (account.sav,
|
||||
// option.sav, slot_00..05\caption.sav + progress.sav), so bringing saves in or out is a copy, with what gets replaced backed up first.
|
||||
|
||||
@@ -11,6 +11,12 @@ static partial class Tests
|
||||
(string, Func<Task>) Sync(string n, Action a) => (n, () => { a(); return Task.CompletedTask; });
|
||||
yield return Sync("settings: registry.txt round trip", SettingsTestRoot);
|
||||
yield return Sync("settings: builder.ini round trip (Linux store)", SettingsIni);
|
||||
yield return Sync("linux: the user folder follows the saves (triforce/user, then hookshot, then the game's)", LinuxUserFolder);
|
||||
yield return Sync("benchmark: an uneven run gets Steady frame rate Refresh steps, an even one keeps the player's", BenchSteady);
|
||||
yield return Sync("benchmark: a place left out is read and said", BenchSkipped);
|
||||
yield return Sync("settings: color scheme, the page's 'color' read", ColorParse);
|
||||
yield return Sync("settings: color scheme kept and read back (registry.txt, builder.ini, old files)", ColorKept);
|
||||
yield return Sync("settings: color scheme, the launcher's color (--snapshot, commands out of order)", ColorChoice);
|
||||
yield return Sync("startup: argument parsing", StartArgsParsing);
|
||||
yield return Sync("startup: lock name algorithm", LockName);
|
||||
yield return Sync("startup: installed run, old exe removed, second start defers", StartupInstalled);
|
||||
@@ -43,6 +49,8 @@ static partial class Tests
|
||||
yield return Sync("steam: add, set, remove in a fake Steam folder", SteamShortcut);
|
||||
yield return Sync("report: names out", ReportNames);
|
||||
yield return Sync("languages", LanguagesTest);
|
||||
yield return Sync("media: the game's music loop through decode, mix and WAV (smpl)", MusicLoop);
|
||||
yield return Sync("media: the WAV cache made again with the loop, an older file replaced", MusicCache);
|
||||
}
|
||||
|
||||
// ---- settings ----
|
||||
@@ -77,6 +85,48 @@ static partial class Tests
|
||||
Equal(null, Ctx(root).Settings.Language, "NoWrites writes nothing");
|
||||
}
|
||||
|
||||
static void BenchSkipped()
|
||||
{
|
||||
var root = NewRoot("benchskip");
|
||||
var f = Path.Combine(root, "results.json");
|
||||
File.WriteAllText(f, "{\"version\":1,\"stopped\":false,\"scenes\":[{\"name\":\"Hyrule Field\",\"avg\":60,\"low1\":50,\"frametimes_ms\":[16.6]}],\"skipped\":[\"Lake Hylia\"],\"settings\":{}}");
|
||||
var run = Benchmark.ReadResults(f, TimeSpan.FromSeconds(1));
|
||||
Equal(1, run.Scenes.Count, "the measured place");
|
||||
Equal("Lake Hylia", run.Skipped.Single(), "the place left out");
|
||||
Check(Benchmark.SkippedNote(run.Skipped).Contains("Lake Hylia was left out"), "the verdict's note");
|
||||
Equal("", Benchmark.SkippedNote(Array.Empty<string>()), "no note without one");
|
||||
File.WriteAllText(f, "{\"version\":1,\"stopped\":false,\"scenes\":[]}");
|
||||
Equal(0, Benchmark.ReadResults(f, TimeSpan.Zero).Skipped.Count, "an older game's results: none");
|
||||
}
|
||||
|
||||
static void BenchSteady()
|
||||
{
|
||||
var now = new Dictionary<string, int> { [Benchmark.KSteady] = 0 };
|
||||
var uneven = new[] { new PlaceResult("Hyrule Field", 45, 28), new PlaceResult("Kokiri Forest", 58, 55) };
|
||||
var r = Benchmark.Recommend(now, uneven, null, null, 60).Single(c => c.Key == Benchmark.KSteady);
|
||||
Equal(Benchmark.SteadyRefreshSteps, r.To, "lows under 80 % of the average: Refresh steps (36 fps on 60 Hz was uneven)");
|
||||
var even = new[] { new PlaceResult("Hyrule Field", 60, 58) };
|
||||
Equal(0, Benchmark.Recommend(now, even, null, null, 60).Single(c => c.Key == Benchmark.KSteady).To, "even: the player's own");
|
||||
}
|
||||
|
||||
static void LinuxUserFolder()
|
||||
{
|
||||
var root = NewRoot("linuxuser");
|
||||
var p = new LinuxPlatform(new Dictionary<string, string?> { ["TRIFORCE_TEST_ROOT"] = root });
|
||||
var game = Path.Combine(root, "game");
|
||||
var now = Path.Combine(p.DataHome, "triforce", "user");
|
||||
var old = Path.Combine(p.DataHome, "hookshot");
|
||||
Equal(now, p.UserFolder(game), "no saves anywhere: the new folder");
|
||||
Directory.CreateDirectory(Path.Combine(game, "user", "save", "1"));
|
||||
Equal(Path.Combine(game, "user"), p.UserFolder(game), "saves the game could not move out of its folder: there");
|
||||
Directory.CreateDirectory(Path.Combine(old, "save", "1"));
|
||||
Equal(old, p.UserFolder(game), "an older build's ~/.local/share/hookshot, not renamed yet: there");
|
||||
Equal(Path.Combine(old, "save", "abc"), p.SaveFolder(game, "abc"), "SaveFolder under it");
|
||||
Directory.CreateDirectory(Path.Combine(now, "save", "1"));
|
||||
Equal(now, p.UserFolder(game), "triforce/user once it has saves: first");
|
||||
Equal(Path.Combine(now, "save", "abc"), p.SaveFolder(game, "abc"), "SaveFolder under the new one");
|
||||
}
|
||||
|
||||
static void SettingsIni()
|
||||
{
|
||||
var root = NewRoot("ini");
|
||||
@@ -95,6 +145,119 @@ static partial class Tests
|
||||
Throws<ArgumentException>(() => s.Set("x", "a\nb"), "a line break is refused");
|
||||
}
|
||||
|
||||
static void ColorParse()
|
||||
{
|
||||
Equal("#e0b23e", LauncherColor.Default, "the default is Triforce gold, the page's GOLD");
|
||||
Equal("#5e9cf0", LauncherColor.Parse("#5E9CF0"), "upper case kept as lower case");
|
||||
Equal("#0a0908", LauncherColor.Parse("#0a0908"), "lower case as it is");
|
||||
foreach (var bad in new[] { null, "", "#", "#fff", "e0b23e", "#e0b23", "#e0b23e0", "#e0b23eff", "#gggggg", " #e0b23e", "#e0b23e ",
|
||||
"#e0b23e\n", "##e0b23", "rgb(224,178,62)", "gold", "#e0 23e", "#" + (char)0xFF45 + "0b23e" })
|
||||
Equal(null, LauncherColor.Parse(bad), "not a #rrggbb: [" + bad + "]");
|
||||
|
||||
string? Cmd(string json) => LauncherColor.FromCommand(System.Text.Json.Nodes.JsonNode.Parse(json));
|
||||
Equal("#5e9cf0", Cmd("""{"t":"cmd","c":"color","hex":"#5E9CF0"}"""), "the page's message");
|
||||
Equal("#e0b23e", Cmd("""{"t":"cmd","c":"color","hex":"#e0b23e"}"""), "Reset to gold");
|
||||
Equal(null, Cmd("""{"t":"cmd","c":"color"}"""), "no hex");
|
||||
Equal(null, Cmd("""{"t":"cmd","c":"color","hex":null}"""), "hex null");
|
||||
Equal(null, Cmd("""{"t":"cmd","c":"color","hex":14725694}"""), "hex a number");
|
||||
Equal(null, Cmd("""{"t":"cmd","c":"color","hex":true}"""), "hex a bool");
|
||||
Equal(null, Cmd("""{"t":"cmd","c":"color","hex":["#e0b23e"]}"""), "hex an array");
|
||||
Equal(null, Cmd("""{"t":"cmd","c":"color","hex":{"v":"#e0b23e"}}"""), "hex an object");
|
||||
Equal(null, Cmd("""{"t":"cmd","c":"color","hex":"#e0b23e; background:url(x)"}"""), "hex with more after it");
|
||||
Equal(null, Cmd("""{"t":"cmd","c":"color","hex":"blue"}"""), "a name");
|
||||
Equal(null, Cmd("""["#e0b23e"]"""), "a message that is not an object");
|
||||
Equal(null, LauncherColor.FromCommand(null), "no message");
|
||||
}
|
||||
|
||||
static void ColorKept()
|
||||
{
|
||||
// registry.txt (Windows' values in a test run): a file from before the color has no Color line and reads as gold
|
||||
var root = NewRoot("color");
|
||||
File.WriteAllLines(Path.Combine(root, "registry.txt"), new[] { @"Software\Triforce\Language=de", @"Software\Triforce\MusicVolume=55", @"Software\Triforce\Muted=1" });
|
||||
var old = Ctx(root);
|
||||
Equal(LauncherColor.Default, old.Settings.Color, "an old settings file: the default");
|
||||
Equal("de", old.Settings.Language, "and its other values as before");
|
||||
Equal(55, old.Settings.MusicVolume, "music volume as before");
|
||||
Check(old.Settings.Muted, "muted as before");
|
||||
Check(!File.ReadAllText(Path.Combine(root, "registry.txt")).Contains("Color"), "reading writes nothing");
|
||||
|
||||
old.Settings.Color = "#5E9CF0";
|
||||
Equal("#5e9cf0", Ctx(root).Settings.Color, "kept, lower case, read back by a new start");
|
||||
var lines = File.ReadAllLines(Path.Combine(root, "registry.txt"));
|
||||
Check(lines.Contains(@"Software\Triforce\Color=#5e9cf0"), "one line beside the others: " + string.Join(" / ", lines));
|
||||
Check(lines.Contains(@"Software\Triforce\Language=de") && lines.Contains(@"Software\Triforce\MusicVolume=55"), "the other values kept");
|
||||
|
||||
Throws<ArgumentException>(() => old.Settings.Color = "blue", "a bad color is refused");
|
||||
Throws<ArgumentException>(() => old.Settings.Color = "#fff", "three digits are refused");
|
||||
Equal("#5e9cf0", Ctx(root).Settings.Color, "and the kept one stays");
|
||||
|
||||
Ctx(root).Settings.Color = LauncherColor.Default;
|
||||
Equal(LauncherColor.Default, Ctx(root).Settings.Color, "Reset to gold kept");
|
||||
Equal(1, File.ReadAllLines(Path.Combine(root, "registry.txt")).Count(l => l.StartsWith(@"Software\Triforce\Color=")), "one line per name after a write");
|
||||
|
||||
// a kept value that does not read (changed by hand) is the default, not an error
|
||||
Ctx(root).Settings.Set(SettingNames.Color, "#12345");
|
||||
Equal(LauncherColor.Default, Ctx(root).Settings.Color, "an unreadable kept value: the default");
|
||||
Ctx(root).Settings.Set(SettingNames.Color, "#ABCDEF");
|
||||
Equal("#abcdef", Ctx(root).Settings.Color, "a kept upper-case value reads as lower case");
|
||||
|
||||
var snap = Ctx(root);
|
||||
snap.NoWrites = true;
|
||||
snap.Settings.Color = "#4fc3b4";
|
||||
Equal("#abcdef", Ctx(root).Settings.Color, "NoWrites writes no color");
|
||||
|
||||
Ctx(root).Platform.Settings.RemoveAll();
|
||||
Equal(LauncherColor.Default, Ctx(root).Settings.Color, "settings removed (uninstall): the default");
|
||||
|
||||
// builder.ini (Linux): its own key, the Tk builder's keys kept
|
||||
var iroot = NewRoot("color-ini");
|
||||
var file = Path.Combine(iroot, "triforce", "builder.ini");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(file)!);
|
||||
File.WriteAllText(file, "kind=nup\nout=/home/a/Games/Triforce\nlanguage=en-US\nMusicVolume=30\n");
|
||||
var ini = new Settings(new IniSettingsStore(file), () => false);
|
||||
Equal(LauncherColor.Default, ini.Color, "an old builder.ini: the default");
|
||||
Equal(30, ini.MusicVolume, "and its volume as before");
|
||||
ini.Color = "#C77DDA";
|
||||
Equal("#c77dda", new Settings(new IniSettingsStore(file), () => false).Color, "kept in builder.ini");
|
||||
var text = File.ReadAllText(file);
|
||||
Check(text.Contains("Color=#c77dda\n") && text.Contains("kind=nup\n") && text.Contains("out=/home/a/Games/Triforce\n") && text.Contains("MusicVolume=30\n"),
|
||||
"Color= beside the Tk builder's keys: " + text);
|
||||
}
|
||||
|
||||
static void ColorChoice()
|
||||
{
|
||||
static System.Text.Json.Nodes.JsonNode Msg(string hex) => System.Text.Json.Nodes.JsonNode.Parse("{\"t\":\"cmd\",\"c\":\"color\",\"hex\":\"" + hex + "\"}")!;
|
||||
var root = NewRoot("color-choice");
|
||||
Ctx(root).Settings.Color = "#5e9cf0";
|
||||
|
||||
// --snapshot (NoWrites): the choice is not kept, but state.color (Current) is the player's, not the kept one
|
||||
var snap = Ctx(root);
|
||||
snap.NoWrites = true;
|
||||
var c = new LauncherColorChoice(snap.Settings);
|
||||
Equal("#5e9cf0", c.Current, "before the page sends one: the kept color");
|
||||
Equal("#c77dda", c.Take(Msg("#C77DDA")), "the page's color taken, lower case");
|
||||
c.Keep();
|
||||
Equal("#c77dda", c.Current, "NoWrites: the chosen color, so the Settings list does not set the page back");
|
||||
Equal("#5e9cf0", Ctx(root).Settings.Color, "and nothing written");
|
||||
Equal(null, c.Take(Msg("blue")), "a bad color is not taken");
|
||||
Equal("#c77dda", c.Current, "and the choice stays");
|
||||
|
||||
// a 'settings.list' handled before the 'color' just ahead of it has been kept: Current is already the new color
|
||||
var ctx = Ctx(root);
|
||||
c = new LauncherColorChoice(ctx.Settings);
|
||||
c.Take(Msg("#4fc3b4"));
|
||||
Equal("#4fc3b4", c.Current, "taken as it arrives, before its worker runs");
|
||||
Equal("#5e9cf0", ctx.Settings.Color, "not kept yet");
|
||||
// two colors whose workers run the wrong way round: the newest is kept
|
||||
c.Take(Msg("#e05a5a"));
|
||||
c.Keep(); c.Keep();
|
||||
Equal("#e05a5a", Ctx(root).Settings.Color, "the newest kept");
|
||||
Equal("#e05a5a", c.Current, "and sent");
|
||||
c.Take(Msg(LauncherColor.Default));
|
||||
c.Keep();
|
||||
Equal(LauncherColor.Default, Ctx(root).Settings.Color, "Reset to gold kept");
|
||||
}
|
||||
|
||||
// ---- startup ----
|
||||
|
||||
static void StartArgsParsing()
|
||||
|
||||
@@ -232,6 +232,33 @@ static partial class Tests
|
||||
Equal("0: NVIDIA GeForce RTX 4070", L("gpu_device", 1), "gpu 1");
|
||||
GameOptionsSchema.UseSystemGpus(); // (not asked here: the tests do not read this PC's registry)
|
||||
Check(GameOptionsSchema.GpuNames != null, "the hook is set");
|
||||
// ((Triforce) 11-19) the game's own order, from its triforce_gpus.txt: Windows lists the Intel first on that laptop,
|
||||
// Vulkan the NVIDIA, and the row's values are Vulkan's
|
||||
var g = NewRoot("gpulist");
|
||||
File.WriteAllText(Path.Combine(g, GameOptionsSchema.GpuListFile), "1\tNVIDIA GeForce RTX 3050 6GB Laptop GPU\n2\tIntel(R) UHD Graphics 770\n");
|
||||
GameOptionsSchema.UseGameGpus(() => g);
|
||||
Equal("0: NVIDIA GeForce RTX 3050 6GB Laptop GPU", L("gpu_device", 1), "the game's first card is the row's 1");
|
||||
Equal("1: Intel(R) UHD Graphics 770", L("gpu_device", 2), "and its second the row's 2");
|
||||
File.WriteAllText(Path.Combine(g, GameOptionsSchema.GpuListFile), "garbage\n3\tout of order\n");
|
||||
GameOptionsSchema.UseGameGpus(() => g);
|
||||
Check(GameOptionsSchema.GpuNames!() != null, "a file with nothing usable: Windows' list (no throw)");
|
||||
// ((Triforce) 11-20) Save writes the card's name with its number (gpu_device_name: the game finds it by the name
|
||||
// first), and an empty one for Auto
|
||||
GameOptionsSchema.GpuNames = () => new[] { "AMD Radeon(TM) 860M Graphics", "NVIDIA GeForce RTX 5060 Laptop GPU" };
|
||||
Equal("NVIDIA GeForce RTX 5060 Laptop GPU", GameOptionsSchema.GpuNameOf(2), "the name of the row's 2");
|
||||
Equal(null, GameOptionsSchema.GpuNameOf(0), "Auto has no name");
|
||||
var nf = NewRoot("gpuname");
|
||||
var opt = GameOptionsFile.Load(nf);
|
||||
opt.Set(GameOptionsSchema.GpuKey, 2);
|
||||
opt.Save();
|
||||
var text = File.ReadAllText(Path.Combine(nf, GameOptionsSchema.FileName));
|
||||
Check(text.Contains("gpu_device=2") && text.Contains("gpu_device_name=NVIDIA GeForce RTX 5060 Laptop GPU"),
|
||||
"the number and the name saved: " + text.Replace("\n", " | "));
|
||||
opt.Set(GameOptionsSchema.GpuKey, 0);
|
||||
opt.Save();
|
||||
text = File.ReadAllText(Path.Combine(nf, GameOptionsSchema.FileName));
|
||||
Check(text.Contains("gpu_device=0") && text.Contains("gpu_device_name=\r\n") || text.Contains("gpu_device_name=\n"),
|
||||
"Auto: the name emptied: " + text.Replace("\n", " | "));
|
||||
}
|
||||
finally { GameOptionsSchema.GpuNames = before; }
|
||||
|
||||
|
||||
122
launcher/LogicTests/Tests.Media.cs
Normal file
122
launcher/LogicTests/Tests.Media.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using System.Text;
|
||||
using Triforce.Core.GameFiles;
|
||||
using static Triforce.LogicTests.T;
|
||||
|
||||
namespace Triforce.LogicTests;
|
||||
|
||||
static partial class Tests
|
||||
{
|
||||
// ---- the launcher's music: the game's loop from the BWAV through the mix into the WAV the page plays ----
|
||||
// (every sound here is made by the test: no game file is read)
|
||||
|
||||
/// <summary>A BWAV file laid out as the game's are, with PCM16 channels (one in the middle, or two: left and right) and
|
||||
/// a loop from loopStart to just before loopEnd (0xFFFFFFFF: none, as the item fanfare and the interface sounds).</summary>
|
||||
static byte[] TestBwav(short[][] channels, uint loopStart, uint loopEnd, int rate = 48000)
|
||||
{
|
||||
var frames = channels[0].Length;
|
||||
var at = (0x10 + channels.Length * 0x4C + 0x3F) & ~0x3F; // (the samples start at 0xC0 in the game's two-channel files)
|
||||
var b = new byte[at + channels.Length * frames * 2];
|
||||
void Put(int o, long v, int n) { for (var i = 0; i < n; i++) b[o + i] = (byte)(v >> 8 * i); }
|
||||
Encoding.ASCII.GetBytes("BWAV").CopyTo(b, 0);
|
||||
Put(4, 0xFEFF, 2); Put(6, 1, 2); Put(0x0E, channels.Length, 2);
|
||||
for (var c = 0; c < channels.Length; c++)
|
||||
{
|
||||
int info = 0x10 + c * 0x4C, data = at + c * frames * 2;
|
||||
Put(info, 0, 2); Put(info + 2, channels.Length == 1 ? 2 : c, 2); Put(info + 4, rate, 4); Put(info + 8, frames, 4); Put(info + 0xC, frames, 4);
|
||||
Put(info + 0x30, data, 4); Put(info + 0x34, data, 4); Put(info + 0x38, 1, 4); Put(info + 0x3C, loopEnd, 4); Put(info + 0x40, loopStart, 4);
|
||||
for (var i = 0; i < frames; i++)
|
||||
Put(data + 2 * i, channels[c][i], 2);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
static short[] TestTone(int frames, int step) => Enumerable.Range(0, frames).Select(i => (short)(i * step % 2000 - 1000)).ToArray();
|
||||
|
||||
static void MusicLoop()
|
||||
{
|
||||
// (1000 frames: an intro of 300, then the loop to the end, as the game's songs are laid out)
|
||||
short[] left = TestTone(1000, 7), right = TestTone(1000, 11);
|
||||
(int Start, int End)? want = (300, 1000);
|
||||
var pcm = Bwav.Decode(TestBwav(new[] { left, right }, 300, 1000));
|
||||
Equal(1000, pcm.Frames, "frames");
|
||||
Equal(want, pcm.Loop, "the header's loop: its start, and its end the sample after its last");
|
||||
Check(Bwav.Decode(TestBwav(new[] { left, right }, 0, 0xFFFFFFFF)).Loop == null, "end 0xFFFFFFFF: no loop");
|
||||
Check(Bwav.Decode(TestBwav(new[] { left, right }, 1000, 1000)).Loop == null, "a loop that starts at its end is none");
|
||||
Equal(want, Bwav.Decode(TestBwav(new[] { left, right }, 300, 5000)).Loop, "an end past the sound is cut to it");
|
||||
Equal(want, Bwav.Decode(TestBwav(new[] { left }, 300, 1000)).Loop, "one channel");
|
||||
|
||||
// the mix (the eight layers of Saria's Song share one loop) keeps it; layers with other loops have none
|
||||
var layer = Bwav.Decode(TestBwav(new[] { right, left }, 300, 1000));
|
||||
var mixed = Bwav.Mix(pcm, layer);
|
||||
Equal(want, mixed.Loop, "a mix of layers with the same loop");
|
||||
Check(Bwav.Mix(pcm, Bwav.Decode(TestBwav(new[] { right, left }, 200, 1000))).Loop == null, "a mix of layers with other loops: none");
|
||||
Check(Bwav.Mix(pcm, Bwav.Decode(TestBwav(new[] { right, left }, 0, 0xFFFFFFFF))).Loop == null, "a mix with a layer that does not loop: none");
|
||||
Equal(want, Bwav.Normalize(pcm).Loop, "normalized");
|
||||
Equal(want, Bwav.Gain(pcm, .5).Loop, "made quieter");
|
||||
|
||||
// the WAV: the 44-byte header and the samples at 44 as before, then a smpl chunk with the loop, its last sample in
|
||||
var wav = Bwav.ToWav(mixed);
|
||||
var data = mixed.Samples.Length * 2;
|
||||
Equal(44 + data + Bwav.SmplChunkSize, wav.Length, "length with the smpl chunk");
|
||||
Equal("RIFF", Encoding.ASCII.GetString(wav, 0, 4), "RIFF");
|
||||
Equal(wav.Length - 8, BitConverter.ToInt32(wav, 4), "the RIFF size takes the smpl chunk in");
|
||||
Equal("data", Encoding.ASCII.GetString(wav, 36, 4), "the data chunk where it was");
|
||||
Equal(data, BitConverter.ToInt32(wav, 40), "data size");
|
||||
Check(Bwav.FromWav(wav).Samples.SequenceEqual(mixed.Samples), "the samples read back");
|
||||
var smpl = 44 + data;
|
||||
Equal("smpl", Encoding.ASCII.GetString(wav, smpl, 4), "smpl after the data");
|
||||
Equal(60, BitConverter.ToInt32(wav, smpl + 4), "smpl size: 36 and one loop");
|
||||
Equal(1_000_000_000 / 48000, BitConverter.ToInt32(wav, smpl + 8 + 8), "the sample period in ns");
|
||||
Equal(60, BitConverter.ToInt32(wav, smpl + 8 + 12), "MIDI unity note");
|
||||
Equal(1, BitConverter.ToInt32(wav, smpl + 8 + 28), "one loop");
|
||||
Equal(0, BitConverter.ToInt32(wav, smpl + 8 + 40), "forward");
|
||||
Equal(300, BitConverter.ToInt32(wav, smpl + 8 + 44), "loop start");
|
||||
Equal(999, BitConverter.ToInt32(wav, smpl + 8 + 48), "the loop's last sample");
|
||||
Equal(0, BitConverter.ToInt32(wav, smpl + 8 + 56), "play count 0: for ever");
|
||||
Equal(want, Bwav.FromWav(wav).Loop, "the loop read back");
|
||||
|
||||
// a sound that plays once: the WAV as before (44 bytes and the samples), no smpl
|
||||
var once = Bwav.Decode(TestBwav(new[] { left, right }, 0, 0xFFFFFFFF));
|
||||
var plain = Bwav.ToWav(once);
|
||||
Equal(44 + once.Samples.Length * 2, plain.Length, "no loop, no smpl chunk");
|
||||
Equal(36 + once.Samples.Length * 2, BitConverter.ToInt32(plain, 4), "its RIFF size as before");
|
||||
Check(Bwav.FromWav(plain).Loop == null, "read back without a loop");
|
||||
|
||||
// a smpl loop that is not inside the sound, or a smpl without loops, reads as no loop
|
||||
var past = (byte[])wav.Clone();
|
||||
BitConverter.TryWriteBytes(past.AsSpan(smpl + 8 + 48), 1000);
|
||||
Check(Bwav.FromWav(past).Loop == null, "a loop whose last sample is past the sound");
|
||||
var backwards = (byte[])wav.Clone();
|
||||
BitConverter.TryWriteBytes(backwards.AsSpan(smpl + 8 + 44), 1000);
|
||||
Check(Bwav.FromWav(backwards).Loop == null, "a loop that ends before it starts");
|
||||
var none = (byte[])wav.Clone();
|
||||
BitConverter.TryWriteBytes(none.AsSpan(smpl + 8 + 28), 0);
|
||||
Check(Bwav.FromWav(none).Loop == null, "a smpl chunk with no loop");
|
||||
Check(Bwav.FromWav(wav.AsSpan(0, smpl + 8 + 40).ToArray()).Loop == null, "a smpl chunk cut off");
|
||||
}
|
||||
|
||||
static void MusicCache()
|
||||
{
|
||||
var root = NewRoot("media-loop");
|
||||
var stream = Path.Combine(root, "romfs", "Sound", "Resource", "Stream");
|
||||
Directory.CreateDirectory(stream);
|
||||
short[] tone = TestTone(1000, 7);
|
||||
File.WriteAllBytes(Path.Combine(stream, "BGM_GreatFairyFountain.bwav"), TestBwav(new[] { tone, tone }, 300, 1000));
|
||||
File.WriteAllBytes(Path.Combine(stream, "BGM_ItemGet_Large.bwav"), TestBwav(new[] { tone, tone }, 0, 0xFFFFFFFF));
|
||||
var cache = Path.Combine(root, "media");
|
||||
Directory.CreateDirectory(cache);
|
||||
// (what an older launcher left: the same name with another key, and no loop in it)
|
||||
var old = Path.Combine(cache, "fairy-0123456789abcdef.wav");
|
||||
File.WriteAllBytes(old, Bwav.ToWav(new Pcm { Rate = 48000, Samples = new short[20] }));
|
||||
|
||||
using var source = new FolderSource(root);
|
||||
var media = new GameMedia(source, cache);
|
||||
var file = media.WavFile("fairy");
|
||||
Check(!File.Exists(old), "the older launcher's WAV is replaced");
|
||||
Check(Path.GetFileName(file).StartsWith("fairy-", StringComparison.Ordinal) && Path.GetFileName(file).Length == Path.GetFileName(old).Length, "named as before: " + file);
|
||||
(int Start, int End)? want = (300, 1000);
|
||||
Equal(want, Bwav.FromWav(File.ReadAllBytes(file)).Loop, "the cached WAV has the game's loop");
|
||||
Equal(file, new GameMedia(source, cache).WavFile("fairy"), "read back from the cache the next time");
|
||||
Check(Bwav.FromWav(media.Wav("itemget")).Loop == null, "the fanfare plays once");
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Logic\Triforce.Logic.csproj" />
|
||||
<!-- (the game's media decoders, for the music loop's tests: on sounds the tests make, never a game's) -->
|
||||
<ProjectReference Include="..\Core\Triforce.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#s-work.failed .center h1 { color: #ffd6d9; }
|
||||
#s-work.failed .nowmusic, #s-work.failed .workfoot { display: none; }
|
||||
.drawer { position: absolute; left: 0; right: 0; bottom: 0; height: 0; overflow: hidden; z-index: 12; background: rgba(8, 7, 6, .97);
|
||||
border-top: 1px solid rgba(224, 178, 62, .4); transition: height .25s ease; }
|
||||
border-top: 1px solid rgba(var(--gold-rgb), .4); transition: height .25s ease; }
|
||||
.drawer.open { height: 330px; }
|
||||
.drawer .dhead { display: flex; gap: 22px; align-items: baseline; padding: 14px 64px 8px; font-size: 14px; }
|
||||
.drawer .dhead b { flex: 1; font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 19px; color: var(--gold-hi); }
|
||||
@@ -51,9 +51,9 @@
|
||||
.search input { width: 100%; height: 100%; padding: 0 14px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14.5px; }
|
||||
.search input::placeholder { color: var(--text3); }
|
||||
.mods { top: 222px !important; max-height: 500px; overflow-y: auto; align-content: start; }
|
||||
.mods::-webkit-scrollbar { width: 6px; } .mods::-webkit-scrollbar-thumb { background: rgba(224, 178, 62, .35); }
|
||||
.mods::-webkit-scrollbar { width: 6px; } .mods::-webkit-scrollbar-thumb { background: rgba(var(--gold-rgb), .35); }
|
||||
.mod { grid-template-columns: 64px 1fr auto !important; gap: 14px; }
|
||||
.mod .mi { width: 64px; height: 40px; background-size: cover; background-position: center; outline: 1px solid rgba(224, 178, 62, .3); }
|
||||
.mod .mi { width: 64px; height: 40px; background-size: cover; background-position: center; outline: 1px solid rgba(var(--gold-rgb), .3); }
|
||||
.mod .mi.none { background: rgba(255, 255, 255, .04); }
|
||||
.mod em.offm { color: var(--text3); }
|
||||
.mod.more b { color: var(--gold); }
|
||||
@@ -85,12 +85,12 @@
|
||||
.opts.many .opt { padding: 12px 14px; }
|
||||
.opt > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
/* a long text in a sheet scrolls with the launcher's own thin bar, not the system's */
|
||||
.asktext::-webkit-scrollbar { width: 6px; } .asktext::-webkit-scrollbar-thumb { background: rgba(224, 178, 62, .35); }
|
||||
.asktext::-webkit-scrollbar { width: 6px; } .asktext::-webkit-scrollbar-thumb { background: rgba(var(--gold-rgb), .35); }
|
||||
.asktext::-webkit-scrollbar-button { display: none; } .asktext { padding-right: 10px; }
|
||||
/* settings: the list scrolls inside the page (it is longer than the window) */
|
||||
.set { max-height: 572px; overflow-y: auto; padding-right: 14px; }
|
||||
.set::-webkit-scrollbar { width: 6px; } .set::-webkit-scrollbar-thumb { background: rgba(224, 178, 62, .35); }
|
||||
.opts.grid::-webkit-scrollbar { width: 6px; } .opts.grid::-webkit-scrollbar-thumb { background: rgba(224, 178, 62, .35); }
|
||||
.set::-webkit-scrollbar { width: 6px; } .set::-webkit-scrollbar-thumb { background: rgba(var(--gold-rgb), .35); }
|
||||
.opts.grid::-webkit-scrollbar { width: 6px; } .opts.grid::-webkit-scrollbar-thumb { background: rgba(var(--gold-rgb), .35); }
|
||||
/* (Cormorant's old-style figures read "1" as "ı": lining figures everywhere) */
|
||||
body { font-variant-numeric: lining-nums; }
|
||||
/* Mods: the tabs under the title, not over it */
|
||||
@@ -127,3 +127,52 @@ body { font-variant-numeric: lining-nums; }
|
||||
.place.two .pg { height: 40px; }
|
||||
.recs .compare { margin-top: 14px; width: 100%; }
|
||||
.recs .act .qlink { white-space: nowrap; }
|
||||
|
||||
/* Color scheme (Settings > Launcher): any colour in place of the gold. theme.css holds the shades, app.js moves them. */
|
||||
/* the crest's metal turned to the colour; img/crest-gold.png is its mask, so the three stones and the dark stone stay */
|
||||
.tint .mark::after, .tint .seal::after, .tint.noart .mini::after { content: ''; position: absolute; inset: 0; pointer-events: none;
|
||||
background: url(img/crest.png) center / contain no-repeat; -webkit-mask: url(img/crest-gold.png) center / contain no-repeat; mask: url(img/crest-gold.png) center / contain no-repeat;
|
||||
filter: hue-rotate(var(--tint-h)) saturate(var(--tint-s)) brightness(var(--tint-b)); }
|
||||
.tint.noart .mini::after { background-size: 92px; -webkit-mask-size: 92px; mask-size: 92px; }
|
||||
/* the game's ornament and the logo's aura: the same sepia gold as drawn, turned by as much */
|
||||
.tint .orn { filter: sepia(1) saturate(calc(3.2 * var(--tint-s))) hue-rotate(calc(-10deg + var(--tint-h))) brightness(calc(1.05 * var(--tint-b))); }
|
||||
.tint .rule i, .tint .frame .top i { filter: sepia(1) saturate(calc(3.2 * var(--tint-s))) hue-rotate(calc(-10deg + var(--tint-h))) brightness(var(--tint-b)); }
|
||||
.tint .logo .aura, .tint .mini .aura { filter: sepia(1) saturate(calc(2.2 * var(--tint-s))) hue-rotate(calc(-6deg + var(--tint-h))) brightness(var(--tint-b)); }
|
||||
.tint .rlogo .aura { filter: sepia(1) saturate(calc(2.4 * var(--tint-s))) hue-rotate(calc(-8deg + var(--tint-h))) brightness(var(--tint-b)) blur(6px); }
|
||||
|
||||
/* the row: its value is the colour (a diamond, as the sliders' knob) and its hex; selecting it drops the picker under it */
|
||||
.row-set .sw { display: inline-block; width: 11px; height: 11px; margin: 0 12px 0 3px; transform: rotate(45deg); vertical-align: 0; background: var(--gold);
|
||||
box-shadow: 0 0 0 1px rgba(var(--gold-hi-rgb), .55), 0 0 0 3px rgba(10, 9, 8, .9); }
|
||||
.cpick { height: 0; overflow: hidden; visibility: hidden; border-bottom: 1px solid var(--line-soft); margin-bottom: -1px;
|
||||
transition: height .25s ease, visibility 0s linear .25s; }
|
||||
.cpick.open { height: 222px; visibility: visible; margin-bottom: 0; transition: height .25s ease; }
|
||||
/* (16px on the left: the focus ring, the frame and the diamond at the left end stay inside the list, which clips there) */
|
||||
.cp { display: grid; grid-template-columns: 250px 1fr; gap: 38px; padding: 20px 4px 22px 16px; }
|
||||
/* the square: saturation across, brightness up; the hue under it as one of the launcher's sliders */
|
||||
.cp-sv { position: relative; height: 140px; cursor: crosshair; outline: 1px solid rgba(var(--gold-rgb), .42); outline-offset: 4px;
|
||||
background: linear-gradient(0deg, #000, rgba(0, 0, 0, 0)), linear-gradient(90deg, #fff, hsl(var(--cp-h, 43), 100%, 50%)); }
|
||||
.cp-sv u, .cp-hue u { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; transform: rotate(45deg); pointer-events: none;
|
||||
background: var(--cp-c, var(--gold)); box-shadow: 0 0 0 2px var(--text), 0 0 0 4px rgba(10, 9, 8, .9); }
|
||||
.cp-sv.held { outline: 2px solid var(--gold-hi); }
|
||||
/* held (Enter / A: the arrows set it): a double ring over the focus ring, and the bigger diamond */
|
||||
body.kb .cp-sv.held.kf { outline: 4px double var(--gold-hi) !important; box-shadow: 0 0 0 9px rgba(var(--gold-hi-rgb), .3); }
|
||||
.cp-sv.held u { transform: rotate(45deg) scale(1.3); }
|
||||
.cp-hue { margin-top: 26px; background: linear-gradient(90deg, #f00, #ff0 16.667%, #0f0 33.333%, #0ff 50%, #00f 66.667%, #f0f 83.333%, #f00); }
|
||||
.cp-hue::before { content: ''; position: absolute; left: 0; right: 0; top: -10px; bottom: -10px; }
|
||||
.cp-hue u { top: 50%; box-shadow: 0 0 0 3px rgba(10, 9, 8, .9); }
|
||||
/* hex and r, g, b: the launcher's field (the mods search), checked as typed */
|
||||
.cp-f { display: flex; gap: 14px; }
|
||||
.cp-f label { display: block; font-size: 13px; font-weight: 600; color: var(--text3); }
|
||||
.cp-f input { display: block; width: 62px; height: 38px; margin-top: 5px; padding: 0 12px; font: inherit; font-size: 14.5px; font-variant-numeric: tabular-nums; color: var(--text);
|
||||
background: rgba(10, 9, 8, .6); border: 1px solid rgba(var(--gold-rgb), .35); outline: 0; border-radius: 0; }
|
||||
.cp-f input#cpHex { width: 112px; letter-spacing: .03em; text-transform: uppercase; }
|
||||
.cp-f input:focus { border-color: var(--gold-hi); }
|
||||
.cp-f input.bad { border-color: #ff8a92; color: #ffd6d9; }
|
||||
.cp-msg { height: 18px; margin-top: 6px; font-size: 12.5px; color: var(--text3); } .cp-msg.bad { color: #ff8a92; }
|
||||
/* the ready colours (Triforce gold first) and the way back to it */
|
||||
.cp-pre { display: flex; gap: 17px; margin: 6px 0 0 4px; }
|
||||
.cp-pre span { width: 18px; height: 18px; transform: rotate(45deg); background: var(--c); box-shadow: 0 0 0 1px rgba(243, 234, 213, .25), 0 0 0 3px rgba(10, 9, 8, .9); cursor: pointer; }
|
||||
.cp-pre span.on { box-shadow: 0 0 0 2px var(--text), 0 0 0 4px rgba(10, 9, 8, .9); }
|
||||
.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; }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
page -> launcher {t:'ready'} {t:'win', a:'min'|'max'|'close'} {t:'pick', kind:'file'|'folder'} {t:'drop', files:[file:// on Linux]}
|
||||
{t:'cmd', c:<name>, ...args} (build, stop, retry, play, update, playold, showgame, open, lang, folder, setting,
|
||||
saves.import, saves.export, saves.open, mods.*, bench, benchstop, benchapply,
|
||||
report, sound, workback, ...)
|
||||
report, sound, color, workback, ...)
|
||||
launcher -> page {t:'hello', chrome, os} {t:'state', ...parts} {t:'go', s} {t:'check', st, name, msg}
|
||||
{t:'work', ...} {t:'log', lines} {t:'toast', html} {t:'sfx', id} {t:'bench', ...} {t:'max', on}
|
||||
|
||||
@@ -40,32 +40,119 @@ const S = { media: { art: false, music: false, sfx: false }, sound: { music: .4,
|
||||
|
||||
/* ---------------- sound: the game's own music and menu sounds (only once a game is known) ---------------- */
|
||||
const TRACKS = { saria: "Saria's Song", fairy: 'Fairy Fountain', temple: 'Temple of Time', itemget: 'Item get' };
|
||||
const live = []; // music being played: { el, k, target, rate, name }
|
||||
let curTrack = null, unlocked = !!HOST;
|
||||
addEventListener('pointerdown', () => unlocked = true, true); addEventListener('keydown', () => unlocked = true, true);
|
||||
/* Music plays through Web Audio: a track is read and decoded once into an AudioBuffer and played by a buffer source that
|
||||
loops between the game's own loop points, sample for sample, so an intro plays once and the loop joins with no gap and
|
||||
no jump back to the start (the launcher writes the loop into the WAV as a smpl chunk: launcher/Core/GameFiles/Bwav.cs
|
||||
ToWav). An <audio> element's loop starts the whole file again, intro and all, after a pause: it is only the fallback,
|
||||
for a page without Web Audio or a file it cannot read or decode. A file without a loop (made by an older launcher)
|
||||
loops whole, still without a gap. */
|
||||
const live = []; // music being played: { k, target, rate, name, loop, and src + g (Web Audio) or el (<audio>) once started }
|
||||
let curTrack = null, unlocked = !!HOST, actx = null, actxTried = false, lastResume = 0;
|
||||
const decoded = new Map(); // track -> Promise of { buf, start, end } (the loop, in seconds), for media version decodedFor
|
||||
let decodedFor;
|
||||
function audioCtx() {
|
||||
if (actxTried) return actx;
|
||||
actxTried = true;
|
||||
const AC = window.AudioContext || window.webkitAudioContext;
|
||||
// (at the game's rate, so the buffers are not resampled and the loop points stay whole samples)
|
||||
if (AC) try { actx = new AC({ sampleRate: 48000 }); } catch { try { actx = new AC(); } catch { actx = null; } }
|
||||
return actx;
|
||||
}
|
||||
function unlock() { unlocked = true; if (actx && actx.state === 'suspended') actx.resume().catch(() => {}); }
|
||||
addEventListener('pointerdown', unlock, true); addEventListener('keydown', unlock, true);
|
||||
/* The loop a WAV file carries, in samples: a smpl chunk's first loop (smpl counts its last sample in; end here is the
|
||||
sample after it), else the whole file. { rate, frames, start, end }, or null for what is not a PCM WAV file. */
|
||||
function wavLoop(ab) {
|
||||
const d = new DataView(ab), len = d.byteLength;
|
||||
const tag = at => String.fromCharCode(d.getUint8(at), d.getUint8(at + 1), d.getUint8(at + 2), d.getUint8(at + 3));
|
||||
if (len < 12 || tag(0) !== 'RIFF' || tag(8) !== 'WAVE') return null;
|
||||
let rate = 0, align = 0, frames = 0, loop = null;
|
||||
for (let at = 12; at + 8 <= len;) {
|
||||
const id = tag(at), n = Math.min(d.getUint32(at + 4, true), len - at - 8), body = at + 8;
|
||||
if (id === 'fmt ' && n >= 16) { rate = d.getUint32(body + 4, true); align = d.getUint16(body + 12, true); }
|
||||
else if (id === 'data' && !frames && align) frames = Math.floor(n / align);
|
||||
else if (id === 'smpl' && n >= 60 && d.getUint32(body + 28, true) > 0) loop = { start: d.getUint32(body + 44, true), end: d.getUint32(body + 48, true) + 1 };
|
||||
at = body + n + (n & 1);
|
||||
}
|
||||
if (!rate || !frames) return null;
|
||||
const ok = loop && loop.start < loop.end && loop.end <= frames;
|
||||
return { rate, frames, start: ok ? loop.start : 0, end: ok ? loop.end : frames };
|
||||
}
|
||||
function track(name) {
|
||||
if (decodedFor !== S.media.v) { decoded.clear(); decodedFor = S.media.v; }
|
||||
let p = decoded.get(name);
|
||||
if (!p) {
|
||||
p = fetch('audio/' + name + '.wav').then(r => { if (!r.ok) throw new Error(name + ': ' + r.status); return r.arrayBuffer(); }).then(ab => {
|
||||
const lp = wavLoop(ab);
|
||||
// (the callback form too: an older WebKit's decodeAudioData returns nothing)
|
||||
return new Promise((ok, no) => { const q = actx.decodeAudioData(ab, ok, no); if (q && q.then) q.then(ok, no); })
|
||||
.then(buf => ({ buf, start: lp ? lp.start / lp.rate : 0, end: lp ? Math.min(lp.end / lp.rate, buf.duration) : buf.duration }));
|
||||
});
|
||||
p.catch(() => { if (decoded.get(name) === p) decoded.delete(name); });
|
||||
decoded.set(name, p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
function startBuffer(m, t) {
|
||||
const src = actx.createBufferSource(), g = actx.createGain();
|
||||
src.buffer = t.buf;
|
||||
if (m.loop) { src.loop = true; src.loopStart = t.start; src.loopEnd = t.end; }
|
||||
// (at the level it has now, from the first sample: 0 for a looping track, which fades in; the full level for the
|
||||
// fanfare, which would otherwise wait for the next frame and a ramp, or play silent while frames are held back)
|
||||
const v = level(m);
|
||||
g.gain.value = v;
|
||||
src.connect(g); g.connect(actx.destination);
|
||||
if (!m.loop) src.onended = () => { m.ended = true; if (!m.stopped) oneShotEnded(m); };
|
||||
src.start();
|
||||
m.src = src; m.g = g; m.v = v; m.loading = false;
|
||||
}
|
||||
function startElement(m) {
|
||||
const el = new Audio('audio/' + m.name + '.wav'); el.loop = m.loop; el.volume = level(m);
|
||||
m.el = el; m.loading = false;
|
||||
el.play().catch(() => { m.blocked = true; });
|
||||
if (!m.loop) el.onended = () => oneShotEnded(m);
|
||||
}
|
||||
function level(m) { return Math.max(0, Math.min(1, m.k * m.k * (S.sound.muted ? 0 : S.sound.music))); }
|
||||
function oneShotEnded(m) { m.target = 0; m.k = 0; if (curTrack === m.name) { curTrack = null; afterOneShot(m.name); } nowPlaying(); }
|
||||
function stopVoice(m) {
|
||||
m.dead = true;
|
||||
if (m.el) { m.el.pause(); m.el.removeAttribute('src'); }
|
||||
// (a source that has played to its end fires no second ended: its gain is let go at once)
|
||||
else if (m.src) {
|
||||
m.stopped = true;
|
||||
if (m.ended) m.g.disconnect();
|
||||
else { m.src.onended = () => m.g.disconnect(); try { m.src.stop(actx.currentTime + .05); } catch { m.g.disconnect(); } }
|
||||
}
|
||||
// (a track no longer playing lets go of its decoded samples, up to 30 MB for a long one: read again when wanted)
|
||||
if (m.name !== curTrack && !live.some(o => o !== m && !o.dead && o.name === m.name)) decoded.delete(m.name);
|
||||
}
|
||||
function music(name, loop = true, fade = 1.4) {
|
||||
if (name && !S.media.music) name = null;
|
||||
if (curTrack === name) return;
|
||||
curTrack = name;
|
||||
for (const m of live) { m.target = 0; m.rate = 1 / fade; }
|
||||
if (name) {
|
||||
const el = new Audio('audio/' + name + '.wav'); el.loop = loop; el.volume = 0;
|
||||
const m = { el, k: 0, target: 1, rate: 1 / fade, name };
|
||||
el.play().catch(() => { m.blocked = true; });
|
||||
if (!loop) el.onended = () => { m.target = 0; m.k = 0; if (curTrack === name) { curTrack = null; afterOneShot(name); } };
|
||||
// (a one-shot, the item fanfare, starts at its full level: fading it in would swallow its first notes)
|
||||
const m = { k: loop ? 0 : 1, target: 1, rate: 1 / fade, name, loop, loading: true };
|
||||
live.push(m);
|
||||
if (audioCtx()) track(name).then(t => { if (!m.dead) startBuffer(m, t); }, () => { if (!m.dead) startElement(m); });
|
||||
else startElement(m);
|
||||
}
|
||||
nowPlaying();
|
||||
}
|
||||
let lastT = performance.now();
|
||||
function audioTick(t) {
|
||||
const dt = Math.min(.1, (t - lastT) / 1000); lastT = t;
|
||||
const mv = S.sound.muted ? 0 : S.sound.music;
|
||||
if (actx && unlocked && actx.state === 'suspended' && t - lastResume > 1000) { lastResume = t; actx.resume().catch(() => {}); }
|
||||
for (let i = live.length - 1; i >= 0; i--) {
|
||||
const m = live[i];
|
||||
// (a track still being read waits at its first level, so its fade-in is heard whole; one faded out before it starts is dropped)
|
||||
if (m.loading) { if (m.target === 0) { stopVoice(m); live.splice(i, 1); } continue; }
|
||||
m.k += Math.sign(m.target - m.k) * Math.min(Math.abs(m.target - m.k), m.rate * dt);
|
||||
m.el.volume = Math.max(0, Math.min(1, m.k * m.k * mv));
|
||||
if (m.k <= 0 && m.target === 0) { m.el.pause(); m.el.removeAttribute('src'); live.splice(i, 1); }
|
||||
const v = level(m);
|
||||
if (m.el) m.el.volume = v;
|
||||
else if (Math.abs(v - m.v) > 1e-4) { m.v = v; m.g.gain.setTargetAtTime(v, actx.currentTime, .015); }
|
||||
if (m.k <= 0 && m.target === 0) { stopVoice(m); live.splice(i, 1); }
|
||||
else if (m.blocked && unlocked) { m.blocked = false; m.el.play().catch(() => { m.blocked = true; }); }
|
||||
}
|
||||
}
|
||||
@@ -113,7 +200,7 @@ const MUSIC = { welcome: null, reveal: 'saria', work: 'temple', done: 'itemget',
|
||||
let screen = null;
|
||||
function go(name) {
|
||||
if (name === screen || !$('#s-' + name)) return;
|
||||
closeSheet(true); closeVol(true);
|
||||
closeSheet(true); closeVol(true); closeColor();
|
||||
screen = name;
|
||||
$$('.screen').forEach(s => s.classList.toggle('on', s.id === 's-' + name));
|
||||
const busy = FIRST_RUN.includes(name) || name === 'work' || name === 'brun' || name === 'playing';
|
||||
@@ -137,14 +224,20 @@ function visible(el) { return !!(el.offsetParent || el.getClientRects().length)
|
||||
function focusables() {
|
||||
if ($('#sheetBg').classList.contains('open')) return $$('[data-f]', $('#sheet')).filter(visible);
|
||||
if ($('#vol').classList.contains('open')) return $$('[data-f]', $('#vol')).concat($('#spk'));
|
||||
const out = $$('[data-f]', $('#s-' + screen)).filter(visible);
|
||||
// ((Triforce, 11-19) before the first screen is shown screen is null and there is no #s-null: a controller's press or a drifting
|
||||
// stick then threw here, in the frame loop)
|
||||
const page = screen && $('#s-' + screen);
|
||||
const out = page ? $$('[data-f]', page).filter(el => visible(el) && !el.closest('.cpick:not(.open)')) : [];
|
||||
if (!$('#bar').classList.contains('bare')) out.push(...$$('[data-f]', $('#bar')).filter(visible));
|
||||
return out;
|
||||
}
|
||||
function setFocus(el, sound) {
|
||||
if (!el || el === focused) return;
|
||||
if (focused) focused.classList.remove('kf');
|
||||
const letGo = focused && focused.id === 'cpSv' && focused.classList.contains('held'); // (the colour square lets go when focus leaves it)
|
||||
if (letGo) focused.classList.remove('held');
|
||||
focused = el; el.classList.add('kf');
|
||||
if (letGo || el.id === 'cpSv') colorMsg();
|
||||
if (el.tagName === 'INPUT') el.focus(); else if (document.activeElement && document.activeElement.tagName === 'INPUT') document.activeElement.blur();
|
||||
if (document.body.classList.contains('kb')) el.scrollIntoView({ block: 'nearest' });
|
||||
if (sound) sfx('cursor');
|
||||
@@ -165,13 +258,20 @@ function move(dx, dy) {
|
||||
}
|
||||
if (best) setFocus(best, true);
|
||||
}
|
||||
document.addEventListener('mouseover', e => { const el = e.target.closest('[data-f]'); if (el && focusables().includes(el)) setFocus(el, true); });
|
||||
document.addEventListener('mouseover', e => {
|
||||
const el = e.target.closest('[data-f]'); if (!el || !focusables().includes(el)) return;
|
||||
const a = document.activeElement; // (while a colour field is typed in, the pointer passing over the others does not take it away; a click does)
|
||||
if (a && a.tagName === 'INPUT' && a !== el && a.closest('#cpick')) return;
|
||||
setFocus(el, true);
|
||||
});
|
||||
document.addEventListener('focusin', e => { if (e.target.tagName === 'INPUT' && e.target.closest('#cpick') && e.target !== focused) setFocus(e.target); });
|
||||
document.addEventListener('mousemove', () => document.body.classList.remove('kb'));
|
||||
|
||||
/* ---------------- actions ---------------- */
|
||||
function activate(el) {
|
||||
if (!el) return;
|
||||
if (el.tagName === 'INPUT') { el.focus(); return; }
|
||||
if (el.id === 'cpSv') return holdSv();
|
||||
if (el.dataset.go) { if (el.dataset.go !== screen) { sfx('decide'); go(el.dataset.go); } return; }
|
||||
const act = el.dataset.act; if (!act) return;
|
||||
const i = act.indexOf(':'), verb = i < 0 ? act : act.slice(0, i), arg = i < 0 ? '' : act.slice(i + 1);
|
||||
@@ -192,6 +292,8 @@ function back() {
|
||||
if ($('#drawer').classList.contains('open')) return ACTIONS.details();
|
||||
if ($('#sheetBg').classList.contains('open')) return closeSheet();
|
||||
if ($('#vol').classList.contains('open')) return closeVol();
|
||||
if (focused && focused.id === 'cpSv' && focused.classList.contains('held')) return holdSv();
|
||||
if (CS.open && screen === 'settings') return closeColor('close');
|
||||
const b = $('#s-' + screen).dataset.back; if (!b) return;
|
||||
sfx('cancel');
|
||||
if (ACTIONS[b]) return ACTIONS[b]();
|
||||
@@ -401,7 +503,7 @@ $('#modQ').addEventListener('keydown', e => { if (e.key === 'Enter' || e.key ===
|
||||
/* ---------------- settings: a list the launcher sends, and the game's own Options menu in tabs ---------------- */
|
||||
S.settab = 'launcher';
|
||||
function launcherRows() {
|
||||
return (S.settings || []).map(r => r.h ? `<h4>${esc(r.h)}</h4>` : r.kind === 'slider' ?
|
||||
return withColorRow(S.settings || []).map(r => r.h ? `<h4>${esc(r.h)}</h4>` : r.kind === 'color' ? colorRow(r) : r.kind === 'slider' ?
|
||||
`<div class="row-set" style="cursor:default"><b>${esc(r.label)}</b><div class="rng"><div class="slider" data-f data-vol="${esc(r.id)}" id="row-${esc(r.id)}"><i></i><u></u></div><span data-volv="${esc(r.id)}"></span></div><em></em></div>` :
|
||||
`<div class="row-set${r.danger ? ' danger' : ''}${r.off ? ' off' : ''}" data-f data-act="row:${esc(r.id)}" id="row-${esc(r.id)}"><b>${esc(r.label)}</b><span>${esc(r.value || '')}</span><em>${esc(r.actLabel || 'Change')}</em></div>`).join('');
|
||||
}
|
||||
@@ -418,7 +520,9 @@ function drawSettings() {
|
||||
if (!tabs.some(t => t.id === S.settab)) S.settab = 'launcher';
|
||||
const keep = focused && focused.id;
|
||||
$('#setTabs').innerHTML = tabs.map(t => `<span data-f data-act="settab:${t.id}" id="st-${t.id}" class="${t.id === S.settab ? 'on' : ''}">${esc(t.name)}</span>`).join('');
|
||||
const cp = $('#cpick'); // (the open picker is kept as it is, with what is being typed in it, through a redraw)
|
||||
$('#set').innerHTML = S.settab === 'launcher' ? launcherRows() : gameRows(S.settab);
|
||||
if (cp && $('#cpick')) { cp.classList.toggle('open', CS.open); $$('.kf', cp).forEach(e => e.classList.remove('kf')); $('#cpick').replaceWith(cp); }
|
||||
$('#s-settings').dataset.first = 'st-' + S.settab;
|
||||
setVol('music', S.sound.music, true); setVol('sfx', S.sound.sfx, true);
|
||||
$('#benchCard').style.display = S.bench && S.bench.available && (S.settab === 'launcher' || S.settab === 'graphics') ? '' : 'none';
|
||||
@@ -426,7 +530,7 @@ function drawSettings() {
|
||||
$('#benchLast').textContent = S.bench && S.bench.last || '';
|
||||
if (keep && $('#' + keep) && screen === 'settings') { focused = null; setFocus($('#' + keep)); }
|
||||
}
|
||||
ACTIONS.settab = (t) => { S.settab = t; drawSettings(); $('#set').scrollTop = 0; setFocus($('#st-' + t)); };
|
||||
ACTIONS.settab = (t) => { CS.open = false; S.settab = t; drawSettings(); $('#set').scrollTop = 0; setFocus($('#st-' + t)); };
|
||||
ACTIONS.gopt = (key) => cmd('gopt.choose', { key });
|
||||
/* the game's sliders: drag, or left / right while focused; the value goes to the launcher when let go */
|
||||
function gStep(el, v) {
|
||||
@@ -452,6 +556,185 @@ function settingRow(id) { cmd('setting', { id }); }
|
||||
// (the list is asked for each time the page opens, so it shows what is true now: Steam, shortcuts, the game folder)
|
||||
new MutationObserver(() => { if ($('#s-settings').classList.contains('on')) cmd('settings.list'); }).observe($('#s-settings'), { attributes: true, attributeFilter: ['class'] });
|
||||
|
||||
/* ---------------- settings: Color scheme (any colour in place of the gold) ---------------- */
|
||||
/* One colour stands in for Triforce gold. Every gold the look is made of (theme.css, --gold-*-rgb) sits from it as it sits
|
||||
from gold today: its hue turned by as much, its saturation scaled by as much, its lightness kept in proportion on the way
|
||||
to white or to black. So Triforce gold gives back today's values, and is drawn with theme.css's own (nothing set here).
|
||||
Text on gold takes dark ink or light, whichever reads better on the colour. The row is the page's own, under Sounds; the
|
||||
choice is kept in this window's storage and sent to the launcher ({t:'cmd', c:'color', hex}); a launcher that keeps it
|
||||
sends it back as state.color, and that wins. */
|
||||
const GOLD = '#e0b23e';
|
||||
const GOLD_SHADES = { 'gold': [224, 178, 62], 'gold-hi': [247, 220, 140], 'gold-lit': [255, 244, 204], 'gold-low': [168, 118, 28], 'gold-deep': [154, 106, 24],
|
||||
'gold-edge': [61, 42, 8], 'gold-glow': [247, 200, 110], 'gold-warm': [255, 196, 92],
|
||||
'gold-w1': [255, 241, 184], 'gold-w2': [232, 184, 64], 'gold-w3': [181, 126, 28], 'gold-w4': [243, 207, 106] };
|
||||
const GOLD_INK = { dark: { ink: [61, 42, 8], ink2: [36, 23, 0], emboss: [255, 244, 204] }, light: { ink: [255, 244, 204], ink2: [255, 244, 204], emboss: [36, 23, 0] } };
|
||||
const PRESETS = [[GOLD, 'Triforce gold'], ['#c9ccd4', 'Silver'], ['#d98c5f', 'Copper'], ['#e2687a', 'Goron ruby'], ['#c77dda', 'Fairy violet'],
|
||||
['#5e9cf0', 'Zora sapphire'], ['#4fc3b4', 'Lake Hylia'], ['#79c463', 'Kokiri emerald']];
|
||||
const CS = { hex: GOLD, h: 0, s: 0, v: 0, open: false };
|
||||
const clamp01 = x => Math.max(0, Math.min(1, x));
|
||||
const hexRgb = h => [1, 3, 5].map(i => parseInt(h.slice(i, i + 2), 16));
|
||||
const rgbHex = c => '#' + c.map(x => Math.round(x).toString(16).padStart(2, '0')).join('');
|
||||
function rgbHsl([r, g, b]) {
|
||||
r /= 255; g /= 255; b /= 255;
|
||||
const mx = Math.max(r, g, b), mn = Math.min(r, g, b), d = mx - mn, l = (mx + mn) / 2;
|
||||
if (!d) return [0, 0, l];
|
||||
const h = mx === r ? ((g - b) / d + 6) % 6 : mx === g ? (b - r) / d + 2 : (r - g) / d + 4;
|
||||
return [h * 60, d / (1 - Math.abs(2 * l - 1)), l];
|
||||
}
|
||||
function hslRgb([h, s, l]) {
|
||||
const k = n => (n + h / 30) % 12, a = s * Math.min(l, 1 - l);
|
||||
return [0, 8, 4].map(n => Math.round(255 * (l - a * Math.max(-1, Math.min(k(n) - 3, 9 - k(n), 1)))));
|
||||
}
|
||||
function hsvRgb(h, s, v) { const f = n => { const k = (n + h / 60) % 6; return Math.round(255 * (v - v * s * Math.max(0, Math.min(k, 4 - k, 1)))); }; return [f(5), f(3), f(1)]; }
|
||||
function rgbHsv([r, g, b]) { const mx = Math.max(r, g, b), d = mx - Math.min(r, g, b); return [d ? rgbHsl([r, g, b])[0] : CS.h, mx ? d / mx : 0, mx / 255]; }
|
||||
const GOLD_HSL = rgbHsl(GOLD_SHADES.gold);
|
||||
[CS.h, CS.s, CS.v] = rgbHsv(GOLD_SHADES.gold);
|
||||
/* a shade of today's gold, moved to the chosen colour (as h, s, l) */
|
||||
function moveShade(c, [th, ts, tl]) {
|
||||
const [h, s, l] = rgbHsl(c), [gh, gs, gl] = GOLD_HSL;
|
||||
return hslRgb([(h - gh + th + 360) % 360, Math.min(1, s * ts / gs), l >= gl ? tl + (1 - tl) * (l - gl) / (1 - gl) : tl * l / gl]);
|
||||
}
|
||||
function lum(c) { const [r, g, b] = c.map(x => { x /= 255; return x <= .04045 ? x / 12.92 : ((x + .055) / 1.055) ** 2.4; }); return .2126 * r + .7152 * g + .0722 * b; }
|
||||
function contrast(a, b) { const x = lum(a), y = lum(b); return (Math.max(x, y) + .05) / (Math.min(x, y) + .05); }
|
||||
/* Two sets are made from the colour. The polished bars (Play, "Find my best settings", Apply...: --gold-bar-*) take it as
|
||||
it is, but no lighter than BAR_TOP, so their highlight, sheen and foot keep gold's steps on a near-white colour. Text,
|
||||
links, lines, rings and diamonds on the dark ground (--gold-*) take it as it is, but no darker than reads on that ground
|
||||
(TEXT_MIN to 1 on --ink), so a near-black colour cannot hide them, nor the way back to gold. Gold is far from both. */
|
||||
const BAR_SHADES = ['gold', 'gold-hi', 'gold-lit', 'gold-low', 'gold-deep', 'gold-edge'], BAR_TOP = .78, INK_BG = [10, 9, 8], TEXT_MIN = 4.5;
|
||||
function textSafe([h, s, l]) {
|
||||
while (l < 1 && contrast(moveShade(GOLD_SHADES.gold, [h, s, l]), INK_BG) < TEXT_MIN) l = Math.min(1, l + .005);
|
||||
return [h, s, l];
|
||||
}
|
||||
function paintColor(hex) {
|
||||
const root = document.documentElement, st = root.style;
|
||||
const vars = Object.keys(GOLD_SHADES).concat('gold-ink', 'gold-ink2', 'gold-emboss', BAR_SHADES.map(n => n.replace('gold', 'gold-bar')));
|
||||
root.classList.toggle('tint', hex !== GOLD);
|
||||
if (hex === GOLD) { vars.forEach(n => st.removeProperty(`--${n}-rgb`)); ['h', 's', 'b'].forEach(n => st.removeProperty('--tint-' + n)); return; }
|
||||
const c = hexRgb(hex), to = rgbHsl(c), tt = textSafe(to), tb = [to[0], to[1], Math.min(to[2], BAR_TOP)];
|
||||
for (const n in GOLD_SHADES) st.setProperty(`--${n}-rgb`, moveShade(GOLD_SHADES[n], tt).join(', '));
|
||||
for (const n of BAR_SHADES) st.setProperty(`--${n.replace('gold', 'gold-bar')}-rgb`, moveShade(GOLD_SHADES[n], tb).join(', '));
|
||||
const bar = moveShade(GOLD_SHADES.gold, tb), dark = moveShade(GOLD_INK.dark.ink, tb), light = moveShade(GOLD_INK.light.ink, tb);
|
||||
const ink = GOLD_INK[contrast(dark, bar) >= contrast(light, bar) ? 'dark' : 'light'];
|
||||
for (const n in ink) st.setProperty(`--gold-${n}-rgb`, moveShade(ink[n], tb).join(', '));
|
||||
st.setProperty('--tint-h', Math.round(((to[0] - GOLD_HSL[0]) % 360 + 540) % 360 - 180) + 'deg');
|
||||
st.setProperty('--tint-s', (to[1] / GOLD_HSL[1]).toFixed(3));
|
||||
st.setProperty('--tint-b', Math.max(.35, Math.min(1.6, to[2] / GOLD_HSL[2])).toFixed(3));
|
||||
}
|
||||
/* from: where the colour came from (load, host, sv, hue, hex, rgb, preset, reset); the field being typed in is left alone */
|
||||
let colorSave = 0;
|
||||
function setColor(hex, from) {
|
||||
hex = hex.toLowerCase(); if (hex[0] !== '#') hex = '#' + hex;
|
||||
if (!/^#[0-9a-f]{6}$/.test(hex)) return;
|
||||
// (a choice not sent yet wins over the launcher's kept one, which is older)
|
||||
if (from === 'host' && colorSave) return;
|
||||
if (from !== 'sv' && from !== 'hue') [CS.h, CS.s, CS.v] = rgbHsv(hexRgb(hex));
|
||||
const was = CS.hex; CS.hex = hex;
|
||||
if (hex !== was || from === 'load') paintColor(hex);
|
||||
drawColor(from);
|
||||
if (from === 'host') { try { localStorage.setItem('triforce.color', hex); } catch { } }
|
||||
else if (from !== 'load' && hex !== was) { clearTimeout(colorSave); colorSave = setTimeout(() => { colorSave = 0; try { localStorage.setItem('triforce.color', CS.hex); } catch { } cmd('color', { hex: CS.hex }); }, 400); }
|
||||
}
|
||||
function fromHsv(from) { setColor(rgbHex(hsvRgb(CS.h, CS.s, CS.v)), from); }
|
||||
/* the row goes under Sounds (or last in the Launcher group), unless the launcher sends one with id 'color' itself */
|
||||
function withColorRow(list) {
|
||||
if (!list.length || list.some(r => r.id === 'color')) return list.map(r => r.id === 'color' ? Object.assign({}, r, { kind: 'color' }) : r);
|
||||
let at = list.findIndex(r => r.id === 'sfx');
|
||||
if (at < 0) { at = list.findIndex(r => r.h === 'Launcher'); while (at >= 0 && list[at + 1] && !list[at + 1].h) at++; }
|
||||
return at < 0 ? list : list.slice(0, at + 1).concat({ id: 'color', label: 'Color scheme', kind: 'color' }, list.slice(at + 1));
|
||||
}
|
||||
function colorValue() { return `<i class="sw" style="background:${CS.hex}"></i>${CS.hex.toUpperCase()}`; }
|
||||
function colorRow(r) {
|
||||
const o = CS.open ? ' open' : '', [cr, cg, cb] = hexRgb(CS.hex), field = (id, l, v, n) => `<label>${l}<input data-f id="${id}" value="${v}" maxlength="${n}" spellcheck="false" autocomplete="off"></label>`;
|
||||
return `<div class="row-set cs${o}" data-f data-act="color" id="row-color"><b>${esc(r.label || 'Color scheme')}</b><span>${colorValue()}</span><em>${CS.open ? 'Done' : 'Change'}</em></div>` +
|
||||
`<div class="cpick${o}" id="cpick"><div class="cp"><div><div class="cp-sv" data-f id="cpSv"><u></u></div><div class="slider cp-hue" data-f id="cpHue"><u></u></div></div>` +
|
||||
`<div><div class="cp-f">${field('cpHex', 'Hex', CS.hex.toUpperCase(), 7)}${field('cpR', 'R', cr, 3)}${field('cpG', 'G', cg, 3)}${field('cpB', 'B', cb, 3)}</div><p class="cp-msg" id="cpMsg"></p>` +
|
||||
`<div class="cp-pre">${PRESETS.map(([c, n], i) => `<span data-f data-act="cpre:${c}" id="cpp${i}" title="${n}" style="--c:${c}"></span>`).join('')}</div>` +
|
||||
`<div class="cp-foot"><em id="cpName"></em><span class="lnk" data-f data-act="creset" id="cpReset">Reset to gold</span></div></div></div></div>`;
|
||||
}
|
||||
function drawColor(from) {
|
||||
const row = $('#row-color'); if (!row) return;
|
||||
row.querySelector('span').innerHTML = colorValue();
|
||||
const sv = $('#cpSv'), hu = $('#cpHue'), [r, g, b] = hexRgb(CS.hex);
|
||||
sv.style.setProperty('--cp-h', CS.h); sv.style.setProperty('--cp-c', CS.hex);
|
||||
sv.querySelector('u').style.left = CS.s * 100 + '%'; sv.querySelector('u').style.top = (1 - CS.v) * 100 + '%';
|
||||
hu.style.setProperty('--cp-c', `hsl(${CS.h}, 100%, 50%)`); hu.querySelector('u').style.left = CS.h / 360 * 100 + '%';
|
||||
if (from !== 'hex') { $('#cpHex').value = CS.hex.toUpperCase(); $('#cpHex').classList.remove('bad'); }
|
||||
if (from !== 'rgb') [['#cpR', r], ['#cpG', g], ['#cpB', b]].forEach(([s, v]) => { $(s).value = v; $(s).classList.remove('bad'); });
|
||||
const p = PRESETS.find(x => x[0] === CS.hex);
|
||||
$$('.cp-pre span').forEach(s => s.classList.toggle('on', s.dataset.act === 'cpre:' + CS.hex));
|
||||
$('#cpName').textContent = p ? p[1] : '';
|
||||
colorMsg();
|
||||
}
|
||||
function colorMsg() {
|
||||
if (!$('#cpMsg')) return;
|
||||
const hexBad = $('#cpHex').classList.contains('bad'), rgbBad = $$('#cpR, #cpG, #cpB').some(i => i.classList.contains('bad'));
|
||||
const sv = $('#cpSv'), on = focused === sv, held = sv.classList.contains('held');
|
||||
$('#cpMsg').textContent = hexBad ? 'Hex: six digits, 0-9 and A-F, as E0B23E' : rgbBad ? 'R, G and B: whole numbers from 0 to 255'
|
||||
: held ? 'Left / Right: saturation · Up / Down: brightness · A or Enter to let go'
|
||||
: on ? 'Drag in the square, or A / Enter to set it with the arrows' : 'Pick in the square, or type the color';
|
||||
$('#cpMsg').classList.toggle('bad', hexBad || rgbBad);
|
||||
}
|
||||
function openColor() {
|
||||
CS.open = true; $('#row-color').classList.add('open'); $('#cpick').classList.add('open'); $('#row-color em').textContent = 'Done'; drawColor();
|
||||
setTimeout(() => { const s = $('#set'), p = $('#cpick'); if (!p || !CS.open) return; const over = p.offsetTop + p.offsetHeight - s.scrollTop - s.clientHeight; if (over > 0) s.scrollTop += over; }, 260);
|
||||
}
|
||||
function closeColor(sound) {
|
||||
if (!CS.open) return;
|
||||
CS.open = false;
|
||||
const row = $('#row-color'), p = $('#cpick'); if (!row || !p) return;
|
||||
const inside = focused && p.contains(focused);
|
||||
row.classList.remove('open'); p.classList.remove('open'); $('#cpSv').classList.remove('held'); row.querySelector('em').textContent = 'Change';
|
||||
drawColor(); // (a half-typed field goes back to the colour)
|
||||
if (sound) sfx(sound);
|
||||
if (inside && screen === 'settings') { focused = null; setFocus(row); }
|
||||
}
|
||||
function holdSv() { const h = $('#cpSv').classList.toggle('held'); sfx(h ? 'decide' : 'cancel'); colorMsg(); }
|
||||
/* arrows on the square (while it is held with Enter / A: left / right saturation, up / down brightness; not held, they move
|
||||
on, as anywhere) and on the hue (left / right, as a slider); down from the open row goes into the picker and up from its
|
||||
top line back to the row (the nearest-by-distance move would skip past it) */
|
||||
function colorNudge(dx, dy) {
|
||||
if (!focused) return false;
|
||||
if (focused.id === 'cpHue' && dx) { CS.h = Math.max(0, Math.min(359, CS.h + dx * 5)); fromHsv('hue'); }
|
||||
else if (focused.id === 'cpSv' && focused.classList.contains('held')) { CS.s = clamp01(CS.s + dx * .04); CS.v = clamp01(CS.v + dy * .04); fromHsv('sv'); }
|
||||
else if (CS.open && dy < 0 && focused.id === 'row-color') { setFocus($('#cpSv'), true); return true; }
|
||||
else if (dy > 0 && /^cp(Sv|Hex|[RGB])$/.test(focused.id)) { setFocus($('#row-color'), true); return true; }
|
||||
else return false;
|
||||
sfx('cursor'); return true;
|
||||
}
|
||||
ACTIONS.color = () => CS.open ? closeColor() : openColor();
|
||||
ACTIONS.cpre = (hex) => setColor(hex, 'preset');
|
||||
ACTIONS.creset = () => setColor(GOLD, 'reset');
|
||||
document.addEventListener('pointerdown', e => {
|
||||
const el = e.target.closest('#cpSv, #cpHue'); if (!el) return;
|
||||
e.preventDefault(); setFocus(el, true);
|
||||
const id = el.id;
|
||||
const mv = ev => {
|
||||
const b = $('#' + id).getBoundingClientRect(), x = clamp01((ev.clientX - b.left) / b.width), y = clamp01((ev.clientY - b.top) / b.height);
|
||||
if (id === 'cpHue') CS.h = Math.round(x * 359); else { CS.s = x; CS.v = 1 - y; }
|
||||
fromHsv(id === 'cpHue' ? 'hue' : 'sv');
|
||||
};
|
||||
mv(e);
|
||||
const up = () => { removeEventListener('pointermove', mv); removeEventListener('pointerup', up); sfx('cursor'); };
|
||||
addEventListener('pointermove', mv); addEventListener('pointerup', up);
|
||||
});
|
||||
/* typed: a whole valid value is used at once; a wrong one is marked, and put back when the field is left */
|
||||
document.addEventListener('input', e => {
|
||||
const t = e.target;
|
||||
if (t.id === 'cpHex') {
|
||||
const v = t.value.trim().replace(/^#/, '');
|
||||
t.classList.toggle('bad', /[^0-9a-f]/i.test(v) || v.length > 6);
|
||||
if (/^[0-9a-f]{6}$/i.test(v)) setColor('#' + v, 'hex');
|
||||
colorMsg();
|
||||
} else if (/^cp[RGB]$/.test(t.id)) {
|
||||
const f = $$('#cpR, #cpG, #cpB'), ok = i => /^\d{1,3}$/.test(i.value.trim()) && +i.value <= 255;
|
||||
t.classList.toggle('bad', t.value.trim() !== '' && !ok(t));
|
||||
if (f.every(ok)) setColor(rgbHex(f.map(i => +i.value)), 'rgb');
|
||||
colorMsg();
|
||||
}
|
||||
});
|
||||
document.addEventListener('focusout', e => { if (/^cp(Hex|[RGB])$/.test(e.target.id)) drawColor(); });
|
||||
try { const c = localStorage.getItem('triforce.color'); if (c && /^#[0-9a-f]{6}$/.test(c)) setColor(c, 'load'); } catch { }
|
||||
|
||||
/* ---------------- benchmark ---------------- */
|
||||
/* a scene's frame times (ms) as a small line: higher = slower, the 16.7 ms line (60 fps) dashed */
|
||||
function sparkline(pts, cls) {
|
||||
@@ -491,6 +774,7 @@ onHost(m => {
|
||||
const had = { music: S.media.music, sfx: S.media.sfx };
|
||||
for (const k in m) if (k !== 't') S[k] = m[k];
|
||||
if (m.sound) { setVol('music', S.sound.music, true); setVol('sfx', S.sound.sfx, true); }
|
||||
if (typeof m.color === 'string') setColor(m.color, 'host');
|
||||
if (m.media) {
|
||||
document.documentElement.classList.toggle('noart', !S.media.art);
|
||||
if (S.media.art) $$('.gamelogo').forEach(i => { if (!i.complete || !i.naturalWidth) i.src = 'img/game/Logo_USEU_00.png?' + (S.media.v || ''); });
|
||||
@@ -519,7 +803,9 @@ document.addEventListener('keydown', e => {
|
||||
if (e.key === 'F2' && !HOST) { e.preventDefault(); return toggleJump(); }
|
||||
if (document.activeElement && document.activeElement.tagName === 'INPUT' && !['Escape', 'Enter', 'ArrowDown', 'ArrowUp', 'Tab'].includes(e.key)) return;
|
||||
const k = e.key; let used = true;
|
||||
if (focused && focused.dataset.vol && (k === 'ArrowLeft' || k === 'ArrowRight')) { setVol(focused.dataset.vol, S.sound[focused.dataset.vol] + (k === 'ArrowLeft' ? -.05 : .05)); sfx('cursor'); }
|
||||
const ca = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] }[k];
|
||||
if (ca && colorNudge(ca[0], ca[1])) { } // (the colour picker's square and hue take the arrows first)
|
||||
else if (focused && focused.dataset.vol && (k === 'ArrowLeft' || k === 'ArrowRight')) { setVol(focused.dataset.vol, S.sound[focused.dataset.vol] + (k === 'ArrowLeft' ? -.05 : .05)); sfx('cursor'); }
|
||||
else if (focused && focused.dataset.gkey && (k === 'ArrowLeft' || k === 'ArrowRight')) gNudge(k === 'ArrowLeft' ? -1 : 1);
|
||||
else if (k === 'ArrowLeft') move(-1, 0); else if (k === 'ArrowRight') move(1, 0);
|
||||
else if (k === 'ArrowUp') move(0, -1); else if (k === 'ArrowDown') move(0, 1);
|
||||
@@ -539,18 +825,21 @@ function pad(t) {
|
||||
const gp = [...(navigator.getGamepads ? navigator.getGamepads() : [])].find(g => g && g.connected); if (!gp) return;
|
||||
const B = i => gp.buttons[i] && gp.buttons[i].pressed;
|
||||
const edge = (i, fn) => { const p = B(i); if (p && !held[i]) { document.body.classList.add('kb'); unlocked = true; fn(); } held[i] = p; };
|
||||
const slide = d => { if (focused && focused.dataset.vol) { setVol(focused.dataset.vol, S.sound[focused.dataset.vol] + d * .05); sfx('cursor'); return true; } return gNudge(d); };
|
||||
const slide = d => { if (colorNudge(d, 0)) return true; if (focused && focused.dataset.vol) { setVol(focused.dataset.vol, S.sound[focused.dataset.vol] + d * .05); sfx('cursor'); return true; } return gNudge(d); };
|
||||
edge(0, () => activate(focused)); edge(1, back); edge(4, () => tab(-1)); edge(5, () => tab(1));
|
||||
edge(3, toggleMute); edge(9, () => { if (MAIN.includes(screen)) go('settings'); });
|
||||
edge(12, () => move(0, -1)); edge(13, () => move(0, 1)); edge(14, () => slide(-1) || move(-1, 0)); edge(15, () => slide(1) || move(1, 0));
|
||||
edge(12, () => colorNudge(0, 1) || move(0, -1)); edge(13, () => colorNudge(0, -1) || move(0, 1)); edge(14, () => slide(-1) || move(-1, 0)); edge(15, () => slide(1) || move(1, 0));
|
||||
const x = gp.axes[0] || 0, y = gp.axes[1] || 0, dir = Math.abs(x) > .55 ? (x > 0 ? 'r' : 'l') : Math.abs(y) > .55 ? (y > 0 ? 'd' : 'u') : '';
|
||||
if (dir && (dir !== stickDir || t - stickAt > 220)) {
|
||||
document.body.classList.add('kb'); stickAt = t + (dir !== stickDir ? 160 : 0);
|
||||
({ l: () => slide(-1) || move(-1, 0), r: () => slide(1) || move(1, 0), u: () => move(0, -1), d: () => move(0, 1) })[dir]();
|
||||
({ l: () => slide(-1) || move(-1, 0), r: () => slide(1) || move(1, 0), u: () => colorNudge(0, 1) || move(0, -1), d: () => colorNudge(0, -1) || move(0, 1) })[dir]();
|
||||
}
|
||||
stickDir = dir;
|
||||
}
|
||||
function frame(t) { audioTick(t); pad(t); requestAnimationFrame(frame); }
|
||||
// ((Triforce, 11-19) #bug-tracker "launcher has no music" (menu sounds fine, an Xbox controller): the next frame is asked for
|
||||
// first, so an error in one frame's work no longer ends the loop. It did: pad threw once at the start (focusables, above), the
|
||||
// loop stopped, and audioTick, which fades the music in from 0, never ran again)
|
||||
function frame(t) { requestAnimationFrame(frame); audioTick(t); pad(t); }
|
||||
requestAnimationFrame(frame);
|
||||
|
||||
/* ---------------- preview only: jump to a screen (the stand-in plays along) ---------------- */
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
{ id: 'c', name: 'Sample: Brighter nights', sub: 'Lighting · sample data', state: 'get' }, { id: 'd', name: 'Sample: Faster text', sub: 'Gameplay · sample data', state: 'get' },
|
||||
{ id: 'e', name: 'Sample: Ocarina notes on screen', sub: 'Interface · sample data', state: 'get' },
|
||||
];
|
||||
const MINE = [{ id: 'm1', name: 'Sample: Quieter Navi', sub: 'In your mods folder', state: 'on', removable: true }, { id: 'm2', name: 'Sample: Tunic recolour', sub: 'In your mods folder', state: 'off', removable: true }];
|
||||
const MINE = [{ id: 'm1', name: 'Sample: Quieter Navi', sub: 'In your mods folder', state: 'on', removable: true }, { id: 'm2', name: 'Sample: Tunic recolor', sub: 'In your mods folder', state: 'off', removable: true }];
|
||||
function mods(tab, q) {
|
||||
const items = (tab === 'mine' ? MINE : MODS).filter(m => !q || m.name.toLowerCase().includes(q.toLowerCase()));
|
||||
emit({ t: 'state', mods: { tab, items, loaded: true, note: tab === 'mine' ? 'Changes take effect after the game is built again: <b>about 6 minutes</b>.' : '' } });
|
||||
|
||||
BIN
launcher/ui/img/crest-gold.png
Normal file
BIN
launcher/ui/img/crest-gold.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -10,14 +10,14 @@ html, body { width: 100%; height: 100%; overflow: hidden; background: #000; marg
|
||||
.play { transition: filter .15s ease, transform .15s ease; }
|
||||
.play:hover { filter: brightness(1.08) saturate(1.05); }
|
||||
.play:active { transform: translateY(1px); filter: brightness(.95); }
|
||||
.qbtn { transition: background .15s, border-color .15s; } .qbtn:hover { background: rgba(243, 234, 213, .12); border-color: rgba(224, 178, 62, .65); }
|
||||
.qbtn { transition: background .15s, border-color .15s; } .qbtn:hover { background: rgba(243, 234, 213, .12); border-color: rgba(var(--gold-rgb), .65); }
|
||||
.ch:hover, .qlink:hover, .links b:hover, .lnk:hover { color: var(--gold-hi); }
|
||||
.nav a:hover { color: var(--text); }
|
||||
.f { transition: transform .15s, outline-color .15s; } .f:hover { outline-color: var(--gold); }
|
||||
.sc .p { transition: filter .15s; } .sc:hover .p { filter: brightness(1.08); }
|
||||
.wc span:hover { color: var(--text); } .wc span:last-child:hover { background: #a3272f; color: #fff; }
|
||||
/* the pad / keyboard focus: a gold ring, only when the last input was not the mouse */
|
||||
body.kb .kf { outline: 2px solid var(--gold-hi) !important; outline-offset: 5px; box-shadow: 0 0 0 7px rgba(247, 220, 140, .14); }
|
||||
body.kb .kf { outline: 2px solid var(--gold-hi) !important; outline-offset: 5px; box-shadow: 0 0 0 7px rgba(var(--gold-hi-rgb), .14); }
|
||||
body.kb .play.kf { outline-offset: 6px; }
|
||||
|
||||
/* the logo rise of the reveal */
|
||||
@@ -31,7 +31,7 @@ body.kb .play.kf { outline-offset: 6px; }
|
||||
|
||||
/* drop area while a file is over it, and while it is checked */
|
||||
.portal::before, .portal::after, .portal .c { pointer-events: none; } .portal > div { position: relative; z-index: 1; }
|
||||
.portal.hot::before { border-color: var(--gold-hi); box-shadow: 0 0 40px rgba(247, 220, 140, .25) inset; }
|
||||
.portal.hot::before { border-color: var(--gold-hi); box-shadow: 0 0 40px rgba(var(--gold-hi-rgb), .25) inset; }
|
||||
.portal.checking h2::after { content: '…'; }
|
||||
.portal.bad::before { border-color: #ff6b76; } .portal.bad p { color: #ff6b76; }
|
||||
|
||||
@@ -50,7 +50,7 @@ body.kb .play.kf { outline-offset: 6px; }
|
||||
|
||||
/* toasts and sheets */
|
||||
.toast { position: absolute; left: 50%; top: 70px; z-index: 40; transform: translateX(-50%); padding: 13px 22px; font-size: 14.5px; color: var(--text);
|
||||
background: rgba(16, 14, 10, .96); border: 1px solid rgba(224, 178, 62, .5); box-shadow: 0 20px 50px rgba(0, 0, 0, .6); animation: fadeup .2s ease both; }
|
||||
background: rgba(16, 14, 10, .96); border: 1px solid rgba(var(--gold-rgb), .5); box-shadow: 0 20px 50px rgba(0, 0, 0, .6); animation: fadeup .2s ease both; }
|
||||
.toast b { color: var(--emerald); }
|
||||
.sheet-bg { position: absolute; inset: 0; z-index: 30; background: rgba(5, 4, 3, .66); display: none; }
|
||||
.sheet-bg.open { display: block; animation: glowin .2s ease both; }
|
||||
@@ -59,7 +59,7 @@ body.kb .play.kf { outline-offset: 6px; }
|
||||
.sheet p { margin-top: 8px; font-size: 14.5px; color: var(--text2); }
|
||||
.opt { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; padding: 14px 16px; border: 1px solid var(--line); cursor: pointer; }
|
||||
.opt:first-of-type { margin-top: 18px; } .opt b { font-weight: 600; } .opt span { font-size: 13px; color: var(--text3); }
|
||||
.opt.sel { border-color: var(--gold-hi); background: rgba(224, 178, 62, .08); }
|
||||
.opt.sel { border-color: var(--gold-hi); background: rgba(var(--gold-rgb), .08); }
|
||||
.sheet .acts { margin-top: 22px; display: flex; justify-content: flex-end; align-items: center; gap: 22px; }
|
||||
|
||||
/* settings */
|
||||
@@ -81,7 +81,7 @@ body.kb .play.kf { outline-offset: 6px; }
|
||||
.brun .hud h1 { font-size: 58px; } .brun .fps { font-size: 64px; font-weight: 750; font-variant-numeric: tabular-nums; }
|
||||
.brun .fps small { font-size: 20px; color: var(--text2); font-weight: 600; margin-left: 8px; }
|
||||
.brun .prog { position: absolute; left: 64px; right: 64px; bottom: 34px; height: 4px; background: rgba(255,255,255,.12); }
|
||||
.brun .prog i { display: block; height: 100%; background: linear-gradient(90deg, #9a6a18, #e0b23e); width: 0; transition: width .2s linear; }
|
||||
.brun .prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); width: 0; transition: width .2s linear; }
|
||||
.brun .stop { position: absolute; right: 64px; top: 84px; font-size: 14px; color: var(--text2); }
|
||||
|
||||
/* mods */
|
||||
@@ -90,7 +90,7 @@ body.kb .play.kf { outline-offset: 6px; }
|
||||
.mod b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 21px; font-weight: 700; } .mod span { display: block; font-size: 13px; color: var(--text3); margin-top: 2px; }
|
||||
.mod em { font-style: normal; font-size: 14px; font-weight: 600; color: var(--gold); } .mod em.inst { color: var(--emerald); }
|
||||
.search { position: absolute; left: 64px; top: 150px; width: 420px; height: 38px; display: flex; align-items: center; padding: 0 14px; font-size: 14px; color: var(--text3);
|
||||
border: 1px solid rgba(224, 178, 62, .35); background: rgba(10, 9, 8, .6); }
|
||||
border: 1px solid rgba(var(--gold-rgb), .35); background: rgba(10, 9, 8, .6); }
|
||||
.cats { position: absolute; left: 510px; top: 158px; display: flex; gap: 22px; font-size: 14px; color: var(--text3); }
|
||||
.cats span.on { color: var(--gold-hi); font-weight: 600; box-shadow: inset 0 -2px 0 var(--gold); padding-bottom: 4px; }
|
||||
|
||||
|
||||
@@ -2,11 +2,29 @@
|
||||
the mark, serif titles, the three stones for state (style_tokens.md v3 values). Kept out: the halo, motes, letter-spaced
|
||||
capitals and the painted crest as decoration. */
|
||||
:root {
|
||||
--ink: #0a0908; --panel: rgba(18, 16, 12, .8); --line: rgba(224, 178, 62, .2); --line-soft: #2c2518;
|
||||
--ink: #0a0908; --panel: rgba(18, 16, 12, .8); --line: rgba(var(--gold-rgb), .2); --line-soft: #2c2518;
|
||||
--text: #f3ead5; --text2: #cdc2a8; --text3: #948a70;
|
||||
--gold: #e0b23e; --gold-hi: #f7dc8c; --gold-ink: #3d2a08;
|
||||
--gold: rgb(var(--gold-rgb)); --gold-hi: rgb(var(--gold-hi-rgb)); --gold-ink: rgb(var(--gold-ink-rgb));
|
||||
--emerald: #6be07f; --emerald-ink: #0a5a14; --sapphire: #8fc0ff; --ruby: #ff6b76; --amber: #f7dc8c;
|
||||
}
|
||||
/* the gold, as r, g, b: Settings > Launcher > Color scheme moves every one of them from the one chosen colour (app.js, gold
|
||||
shades), and these are what Triforce gold gives back, so the default is the look as it was. lit / low / deep: the polished
|
||||
bar's top, foot and the bars' dark end; edge: the hairlines cut into it; ink, ink2 and emboss: the text on gold and the light
|
||||
under it (dark or light by the colour's luminance); glow and warm: the light under Play and over the title scene; w1-w4: the
|
||||
wordmark. tint-*: how far the crest and the game's ornaments are turned to match (0deg, 1, 1 = as drawn). */
|
||||
:root {
|
||||
--gold-rgb: 224, 178, 62; --gold-hi-rgb: 247, 220, 140; --gold-lit-rgb: 255, 244, 204; --gold-low-rgb: 168, 118, 28; --gold-deep-rgb: 154, 106, 24;
|
||||
--gold-edge-rgb: 61, 42, 8; --gold-ink-rgb: 61, 42, 8; --gold-ink2-rgb: 36, 23, 0; --gold-emboss-rgb: 255, 244, 204;
|
||||
--gold-glow-rgb: 247, 200, 110; --gold-warm-rgb: 255, 196, 92;
|
||||
--gold-w1-rgb: 255, 241, 184; --gold-w2-rgb: 232, 184, 64; --gold-w3-rgb: 181, 126, 28; --gold-w4-rgb: 243, 207, 106;
|
||||
--gold-lit: rgb(var(--gold-lit-rgb)); --gold-low: rgb(var(--gold-low-rgb)); --gold-deep: rgb(var(--gold-deep-rgb)); --gold-ink2: rgb(var(--gold-ink2-rgb));
|
||||
--tint-h: 0deg; --tint-s: 1; --tint-b: 1;
|
||||
}
|
||||
/* the polished bars' own shades: the gold's, until a colour is chosen (app.js keeps them from going too light to shine) */
|
||||
:root {
|
||||
--gold-bar-rgb: var(--gold-rgb); --gold-bar-hi-rgb: var(--gold-hi-rgb); --gold-bar-lit-rgb: var(--gold-lit-rgb); --gold-bar-low-rgb: var(--gold-low-rgb);
|
||||
--gold-bar-deep-rgb: var(--gold-deep-rgb); --gold-bar-edge-rgb: var(--gold-edge-rgb);
|
||||
}
|
||||
.flair, h1, h2, .side h3, .slot p b, .found b { font-family: 'Cormorant Garamond', 'Palatino Linotype', Georgia, serif; font-variation-settings: normal; }
|
||||
h1 { font-weight: 700; font-size: 70px; letter-spacing: -.01em; line-height: .98; }
|
||||
h2 { font-weight: 700; font-size: 46px; letter-spacing: -.005em; }
|
||||
@@ -21,28 +39,28 @@ h2 { font-weight: 700; font-size: 46px; letter-spacing: -.005em; }
|
||||
|
||||
/* the mark: the crest itself, and the wordmark in engraved gold */
|
||||
.brand { gap: 12px; font-family: 'Cormorant Garamond', 'Palatino Linotype', Georgia, serif; font-size: 25px; font-weight: 700; letter-spacing: .01em; }
|
||||
.brand span { background: linear-gradient(180deg, #fff1b8 0%, #e8b840 42%, #b57e1c 56%, #f3cf6a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
||||
.brand span { background: linear-gradient(180deg, rgb(var(--gold-w1-rgb)) 0%, rgb(var(--gold-w2-rgb)) 42%, rgb(var(--gold-w3-rgb)) 56%, rgb(var(--gold-w4-rgb)) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
||||
.mark { width: 30px; height: 28px; background: url(img/crest.png) center / contain no-repeat; }
|
||||
.mark i { display: none; }
|
||||
.nav a { border-radius: 0; padding: 9px 4px; margin: 0 12px; color: var(--text3); }
|
||||
.nav a.on { background: none; color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }
|
||||
.state { background: rgba(10, 9, 8, .6); border-color: var(--line); color: var(--text2); }
|
||||
.dot { background: var(--emerald); } .dot.amber { background: var(--gold-hi); } .dot.blue { background: var(--sapphire); }
|
||||
.dot { background: var(--emerald); } .dot.amber { background: var(--amber); } .dot.blue { background: var(--sapphire); }
|
||||
|
||||
/* the eyebrow: gold, in sentence case, after a gold hairline */
|
||||
.over { color: var(--gold); font-weight: 600; } .over b { background: var(--gold); opacity: .8; height: 1px; width: 28px; }
|
||||
|
||||
/* the one gold action, as the polished bar of the old Setup; everything else is quiet */
|
||||
.btn { background: rgba(243, 234, 213, .07); border-color: var(--line); color: var(--text); }
|
||||
.btn.go { color: var(--gold-ink); background: linear-gradient(180deg, #fff4cc 0%, #f7dc8c 12%, #e0b23e 48%, #9a6a18 100%);
|
||||
box-shadow: 0 12px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(61, 42, 8, .35);
|
||||
text-shadow: 0 1px 0 rgba(255, 244, 204, .45); }
|
||||
.btn.go { color: var(--gold-ink); background: linear-gradient(180deg, rgb(var(--gold-bar-lit-rgb)) 0%, rgb(var(--gold-bar-hi-rgb)) 12%, rgb(var(--gold-bar-rgb)) 48%, rgb(var(--gold-bar-deep-rgb)) 100%);
|
||||
box-shadow: 0 12px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(var(--gold-bar-edge-rgb), .35);
|
||||
text-shadow: 0 1px 0 rgba(var(--gold-emboss-rgb), .45); }
|
||||
.btn.quiet { background: transparent; border-color: transparent; color: var(--text2); }
|
||||
.focus { outline-color: var(--gold-hi); }
|
||||
|
||||
/* pictures framed with a gold hairline */
|
||||
.card::after, .slot { border-color: rgba(224, 178, 62, .32); }
|
||||
.card::after { border: 1px solid rgba(224, 178, 62, .38); }
|
||||
.card::after, .slot { border-color: rgba(var(--gold-rgb), .32); }
|
||||
.card::after { border: 1px solid rgba(var(--gold-rgb), .38); }
|
||||
.thumbs div.on { outline-color: var(--gold); }
|
||||
.tag { background: rgba(10, 9, 8, .78); color: var(--text); }
|
||||
|
||||
@@ -53,9 +71,9 @@ h2 { font-weight: 700; font-size: 46px; letter-spacing: -.005em; }
|
||||
.steps .done i { background: var(--emerald-ink); border-color: var(--emerald); color: var(--emerald); }
|
||||
.steps .now { color: var(--text); } .steps .now i { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
|
||||
.box, .slot { background: var(--panel); border-color: var(--line); }
|
||||
.file { background: rgba(224, 178, 62, .08); border-color: var(--line); color: var(--gold); }
|
||||
.file { background: rgba(var(--gold-rgb), .08); border-color: var(--line); color: var(--gold); }
|
||||
.field + .field { border-top-color: var(--line-soft); }
|
||||
.track { background: #262017; height: 6px; } .track i { background: linear-gradient(90deg, #9a6a18, #e0b23e 70%, #fff4cc); }
|
||||
.track { background: #262017; height: 6px; } .track i { background: linear-gradient(90deg, var(--gold-deep), var(--gold) 70%, var(--gold-lit)); }
|
||||
.list div + div { border-top-color: var(--line-soft); }
|
||||
.d .bul { background: var(--emerald-ink); border-color: var(--emerald); } .d .bul::after { border-color: var(--emerald); }
|
||||
.n .bul { border-color: var(--gold); } .n .bul::after { background: var(--gold); } .list .n span { color: var(--gold); }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
radial-gradient(120% 90% at 72% 40%, rgba(10, 9, 8, 0) 30%, rgba(10, 9, 8, .55) 100%),
|
||||
linear-gradient(90deg, rgba(10, 9, 8, .86) 0%, rgba(10, 9, 8, .55) 30%, rgba(10, 9, 8, .05) 60%),
|
||||
linear-gradient(180deg, rgba(10, 9, 8, .55) 0%, rgba(10, 9, 8, 0) 18%, rgba(10, 9, 8, 0) 52%, rgba(10, 9, 8, .82) 74%, #0a0908 100%),
|
||||
linear-gradient(180deg, rgba(255, 196, 92, .07), rgba(255, 196, 92, 0) 50%); }
|
||||
linear-gradient(180deg, rgba(var(--gold-warm-rgb), .07), rgba(var(--gold-warm-rgb), 0) 50%); }
|
||||
|
||||
/* the game's own logo with its own aura behind it */
|
||||
.logo { position: absolute; left: 38px; top: 58px; width: 470px; height: 362px; }
|
||||
@@ -33,30 +33,30 @@
|
||||
.orn.r { transform: scaleX(-1); }
|
||||
.play { position: relative; width: 300px; height: 66px; margin: 0 -6px; display: grid; place-items: center;
|
||||
clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);
|
||||
background: linear-gradient(180deg, #fff4cc 0%, #f7dc8c 14%, #e0b23e 50%, #a8761c 100%);
|
||||
font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 700; font-size: 32px; letter-spacing: .01em; color: #241700; z-index: 1;
|
||||
text-shadow: 0 1px 0 rgba(255, 244, 204, .5); }
|
||||
background: linear-gradient(180deg, rgb(var(--gold-bar-lit-rgb)) 0%, rgb(var(--gold-bar-hi-rgb)) 14%, rgb(var(--gold-bar-rgb)) 50%, rgb(var(--gold-bar-low-rgb)) 100%);
|
||||
font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 700; font-size: 32px; letter-spacing: .01em; color: var(--gold-ink2); z-index: 1;
|
||||
text-shadow: 0 1px 0 rgba(var(--gold-emboss-rgb), .5); }
|
||||
.play::before { content: ''; position: absolute; inset: 4px; clip-path: inherit;
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, .0), rgba(255, 255, 255, 0)); box-shadow: inset 0 0 0 1px rgba(61, 42, 8, .45); }
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, .0), rgba(255, 255, 255, 0)); box-shadow: inset 0 0 0 1px rgba(var(--gold-bar-edge-rgb), .45); }
|
||||
.play::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(255, 255, 255, 0) 8%, rgba(255, 255, 255, .22) 16%, rgba(255, 255, 255, 0) 26%); }
|
||||
.glow { position: absolute; left: 120px; top: 548px; width: 260px; height: 60px; border-radius: 50%; background: rgba(247, 200, 110, .22); filter: blur(30px); }
|
||||
.glow { position: absolute; left: 120px; top: 548px; width: 260px; height: 60px; border-radius: 50%; background: rgba(var(--gold-glow-rgb), .22); filter: blur(30px); }
|
||||
.links { position: absolute; left: 112px; top: 612px; display: flex; gap: 26px; font-size: 14px; color: var(--text2); }
|
||||
.links span b { color: var(--gold); font-weight: 600; }
|
||||
|
||||
/* the dock: a gold hairline with the ornament at its centre, the files, and what's new */
|
||||
.dock { position: absolute; left: 0; right: 0; bottom: 0; height: 156px; }
|
||||
.rule { position: absolute; left: 64px; right: 64px; top: 0; height: 1px;
|
||||
background: linear-gradient(90deg, rgba(224, 178, 62, 0), rgba(224, 178, 62, .55) 18%, rgba(224, 178, 62, .55) 82%, rgba(224, 178, 62, 0)); }
|
||||
background: linear-gradient(90deg, rgba(var(--gold-rgb), 0), rgba(var(--gold-rgb), .55) 18%, rgba(var(--gold-rgb), .55) 82%, rgba(var(--gold-rgb), 0)); }
|
||||
.rule i { position: absolute; top: -14px; width: 28px; height: 28px; background: url(img/game/TitleBtnDeco_00.png) center / contain no-repeat;
|
||||
mix-blend-mode: screen; filter: sepia(1) saturate(3.2) hue-rotate(-10deg); }
|
||||
.rule i.a { left: calc(50% - 30px); } .rule i.b { left: calc(50% + 2px); transform: scaleX(-1); }
|
||||
.files { position: absolute; left: 64px; top: 30px; }
|
||||
.files h4, .whatsnew h4 { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 600; font-size: 18px; color: var(--gold-hi); }
|
||||
.strip { display: flex; gap: 12px; margin-top: 10px; }
|
||||
.f { position: relative; width: 118px; height: 66px; border-radius: 4px; overflow: hidden; outline: 1px solid rgba(224, 178, 62, .35); outline-offset: 0; }
|
||||
.f { position: relative; width: 118px; height: 66px; border-radius: 4px; overflow: hidden; outline: 1px solid rgba(var(--gold-rgb), .35); outline-offset: 0; }
|
||||
.f img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.85) brightness(.82); }
|
||||
.f small { position: absolute; left: 7px; bottom: 5px; font-size: 11px; font-weight: 700; text-shadow: 0 1px 3px #000; }
|
||||
.f.on { outline: 2px solid var(--gold-hi); box-shadow: 0 0 22px rgba(247, 220, 140, .35); transform: translateY(-3px); }
|
||||
.f.on { outline: 2px solid var(--gold-hi); box-shadow: 0 0 22px rgba(var(--gold-hi-rgb), .35); transform: translateY(-3px); }
|
||||
.f.on img { filter: none; }
|
||||
.whatsnew { position: absolute; left: 862px; right: 64px; top: 30px; }
|
||||
.whatsnew p { margin-top: 8px; font-size: 13.5px; color: var(--text2); line-height: 1.35; }
|
||||
@@ -68,8 +68,8 @@
|
||||
.frame { position: absolute; left: 672px; top: 118px; width: 544px; height: 306px; }
|
||||
.frame .pic { position: absolute; inset: 0; background: url(img/save3.jpg) center / cover; box-shadow: 0 40px 90px rgba(0, 0, 0, .7); }
|
||||
.frame .pic::after { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 120% at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(10, 9, 8, .45) 100%); }
|
||||
.frame .edge { position: absolute; inset: -9px; border: 1px solid rgba(224, 178, 62, .55); }
|
||||
.frame .edge::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(224, 178, 62, .22); }
|
||||
.frame .edge { position: absolute; inset: -9px; border: 1px solid rgba(var(--gold-rgb), .55); }
|
||||
.frame .edge::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(var(--gold-rgb), .22); }
|
||||
.frame .top { position: absolute; left: calc(50% - 46px); top: -32px; width: 92px; height: 46px; display: flex; }
|
||||
.frame .top i { flex: 1; background: url(img/game/TitleBtnDeco_00.png) center / 46px no-repeat; mix-blend-mode: screen; filter: sepia(1) saturate(3.2) hue-rotate(-10deg); }
|
||||
.frame .top i + i { transform: scaleX(-1); }
|
||||
@@ -78,17 +78,17 @@
|
||||
/* sound: the speaker in the bar, and its panel (Music, Sounds, what is playing) */
|
||||
.spk { width: 40px; height: 34px; display: grid; place-items: center; margin-left: 10px; border-radius: 17px; border: 1px solid var(--line); background: rgba(10, 9, 8, .6); color: var(--text); }
|
||||
.spk svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
|
||||
.spk.on { border-color: var(--gold); color: var(--gold-hi); box-shadow: 0 0 0 3px rgba(224, 178, 62, .14); }
|
||||
.spk.on { border-color: var(--gold); color: var(--gold-hi); box-shadow: 0 0 0 3px rgba(var(--gold-rgb), .14); }
|
||||
.vol { position: absolute; right: 150px; top: 60px; width: 318px; padding: 18px 20px 16px; z-index: 5; background: rgba(16, 14, 10, .96);
|
||||
border: 1px solid rgba(224, 178, 62, .45); box-shadow: 0 24px 60px rgba(0, 0, 0, .65); }
|
||||
border: 1px solid rgba(var(--gold-rgb), .45); box-shadow: 0 24px 60px rgba(0, 0, 0, .65); }
|
||||
.vol::before { content: ''; position: absolute; right: 22px; top: -7px; width: 12px; height: 12px; background: rgba(16, 14, 10, .96);
|
||||
border-left: 1px solid rgba(224, 178, 62, .45); border-top: 1px solid rgba(224, 178, 62, .45); transform: rotate(45deg); }
|
||||
border-left: 1px solid rgba(var(--gold-rgb), .45); border-top: 1px solid rgba(var(--gold-rgb), .45); transform: rotate(45deg); }
|
||||
.vol h5 { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 600; font-size: 18px; color: var(--gold-hi); }
|
||||
.vrow { display: grid; grid-template-columns: 62px 1fr 36px; align-items: center; gap: 12px; margin-top: 14px; font-size: 14px; color: var(--text2); }
|
||||
.vrow b { font-weight: 600; color: var(--text); } .vrow span { text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.slider { position: relative; height: 4px; background: #262017; }
|
||||
.slider i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #9a6a18, #e0b23e); }
|
||||
.slider u { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; background: #f7dc8c; transform: rotate(45deg); box-shadow: 0 0 0 3px rgba(10, 9, 8, .9); }
|
||||
.slider i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
|
||||
.slider u { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; background: var(--gold-hi); transform: rotate(45deg); box-shadow: 0 0 0 3px rgba(10, 9, 8, .9); }
|
||||
.nowp { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text3); }
|
||||
.nowp em { font-style: italic; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 16px; color: var(--text2); }
|
||||
.eq { display: flex; gap: 2px; align-items: flex-end; height: 14px; } .eq i { width: 3px; background: var(--gold); }
|
||||
@@ -111,10 +111,10 @@
|
||||
/* steps of the first run: gold diamonds on a hairline */
|
||||
.path { position: absolute; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 0; font-size: 14px; color: var(--text3); }
|
||||
.path span { display: flex; align-items: center; gap: 10px; }
|
||||
.path span + span::before { content: ''; width: 64px; height: 1px; margin: 0 16px; background: linear-gradient(90deg, rgba(224,178,62,.15), rgba(224,178,62,.5), rgba(224,178,62,.15)); }
|
||||
.path span + span::before { content: ''; width: 64px; height: 1px; margin: 0 16px; background: linear-gradient(90deg, rgba(var(--gold-rgb), .15), rgba(var(--gold-rgb), .5), rgba(var(--gold-rgb), .15)); }
|
||||
.path i { width: 11px; height: 11px; transform: rotate(45deg); border: 1px solid var(--text3); }
|
||||
.path .done { color: var(--text2); } .path .done i { background: var(--gold); border-color: var(--gold); }
|
||||
.path .now { color: var(--gold-hi); font-weight: 600; } .path .now i { border-color: var(--gold-hi); box-shadow: 0 0 0 3px rgba(247,220,140,.18); background: rgba(247,220,140,.25); }
|
||||
.path .now { color: var(--gold-hi); font-weight: 600; } .path .now i { border-color: var(--gold-hi); box-shadow: 0 0 0 3px rgba(var(--gold-hi-rgb), .18); background: rgba(var(--gold-hi-rgb), .25); }
|
||||
|
||||
.center { position: absolute; left: 230px; width: 820px; text-align: center; }
|
||||
.center .eb { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 600; font-size: 21px; color: var(--gold-hi); }
|
||||
@@ -122,8 +122,8 @@
|
||||
.center .lead { margin-top: 10px; font-size: 16.5px; color: var(--text2); }
|
||||
|
||||
/* a framed box: two gold hairlines, as the picture frame */
|
||||
.fbox { position: relative; background: rgba(18, 16, 12, .82); border: 1px solid rgba(224, 178, 62, .42); text-align: left; }
|
||||
.fbox::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(224, 178, 62, .14); pointer-events: none; }
|
||||
.fbox { position: relative; background: rgba(18, 16, 12, .82); border: 1px solid rgba(var(--gold-rgb), .42); text-align: left; }
|
||||
.fbox::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(var(--gold-rgb), .14); pointer-events: none; }
|
||||
.fbox .row2 { display: grid; grid-template-columns: 200px 1fr auto; align-items: center; gap: 18px; padding: 17px 26px; }
|
||||
.fbox .row2 + .row2 { border-top: 1px solid var(--line-soft); }
|
||||
.fbox label { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 600; font-size: 18px; color: var(--gold-hi); }
|
||||
@@ -131,22 +131,22 @@
|
||||
.fbox .ch { font-size: 14px; font-weight: 600; color: var(--gold); }
|
||||
.gamefile { display: flex; align-items: center; gap: 20px; padding: 20px 26px; }
|
||||
.gamefile .nup { width: 50px; height: 62px; display: grid; place-items: end center; padding-bottom: 8px; font-size: 11px; font-weight: 800; color: var(--gold);
|
||||
background: linear-gradient(180deg, rgba(224,178,62,.16), rgba(224,178,62,.04)); border: 1px solid rgba(224,178,62,.45); }
|
||||
background: linear-gradient(180deg, rgba(var(--gold-rgb), .16), rgba(var(--gold-rgb), .04)); border: 1px solid rgba(var(--gold-rgb), .45); }
|
||||
.gamefile b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 23px; font-weight: 700; }
|
||||
.gamefile .ok { font-size: 14px; }
|
||||
|
||||
/* the chamfered gold bar at another size, and the quiet button with a gold hairline */
|
||||
.play.sm { width: 240px; height: 56px; font-size: 26px; }
|
||||
.qbtn { height: 48px; padding: 0 24px; display: inline-grid; place-items: center; font-size: 15px; font-weight: 600; color: var(--text);
|
||||
background: rgba(243, 234, 213, .06); border: 1px solid rgba(224, 178, 62, .35); }
|
||||
background: rgba(243, 234, 213, .06); border: 1px solid rgba(var(--gold-rgb), .35); }
|
||||
.qlink { font-size: 15px; font-weight: 600; color: var(--text2); }
|
||||
.act { position: absolute; display: flex; align-items: center; gap: 22px; }
|
||||
|
||||
/* the build: the time left, a gold line with a spark at its head, the steps with their times */
|
||||
.gline { position: relative; height: 6px; margin: 30px auto 0; width: 820px; background: #262017; }
|
||||
.gline i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #9a6a18, #e0b23e 75%, #fff4cc); }
|
||||
.gline u { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; transform: rotate(45deg); background: #fff4cc;
|
||||
box-shadow: 0 0 14px 4px rgba(247, 220, 140, .55); }
|
||||
.gline i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold) 75%, var(--gold-lit)); }
|
||||
.gline u { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; transform: rotate(45deg); background: var(--gold-lit);
|
||||
box-shadow: 0 0 14px 4px rgba(var(--gold-hi-rgb), .55); }
|
||||
.gline::before, .gline::after { content: ''; position: absolute; top: -4px; width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid var(--gold); background: #0a0908; }
|
||||
.gline::before { left: -16px; } .gline::after { right: -16px; }
|
||||
.stepl { width: 820px; margin: 26px auto 0; text-align: left; }
|
||||
@@ -154,7 +154,7 @@
|
||||
.stepl div:first-child { border-top: 0; }
|
||||
.stepl em { width: 11px; height: 11px; transform: rotate(45deg); border: 1px solid var(--text3); margin-left: 4px; }
|
||||
.stepl .d { color: var(--text2); } .stepl .d em { background: var(--emerald); border-color: var(--emerald); }
|
||||
.stepl .n { color: var(--text); } .stepl .n em { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px rgba(247, 220, 140, .6); }
|
||||
.stepl .n { color: var(--text); } .stepl .n em { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px rgba(var(--gold-hi-rgb), .6); }
|
||||
.stepl b { font-weight: 600; } .stepl span { font-size: 14px; } .stepl .n span { color: var(--gold-hi); font-weight: 600; }
|
||||
.nowmusic { position: absolute; right: 64px; bottom: 26px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text3); }
|
||||
.nowmusic em { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 16px; color: var(--text2); }
|
||||
@@ -163,8 +163,8 @@
|
||||
.sgrid { position: absolute; left: 64px; top: 196px; display: grid; grid-template-columns: repeat(3, 258px); gap: 34px 26px; }
|
||||
.sc { position: relative; }
|
||||
.sc .p { position: relative; width: 258px; height: 145px; background-size: cover; background-position: center; }
|
||||
.sc .p::after { content: ''; position: absolute; inset: -6px; border: 1px solid rgba(224, 178, 62, .45); }
|
||||
.sc.on .p::after { border-color: var(--gold-hi); box-shadow: 0 0 24px rgba(247, 220, 140, .3); }
|
||||
.sc .p::after { content: ''; position: absolute; inset: -6px; border: 1px solid rgba(var(--gold-rgb), .45); }
|
||||
.sc.on .p::after { border-color: var(--gold-hi); box-shadow: 0 0 24px rgba(var(--gold-hi-rgb), .3); }
|
||||
.sc .t { margin-top: 12px; display: flex; justify-content: space-between; align-items: baseline; }
|
||||
.sc .t b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 20px; font-weight: 700; }
|
||||
.sc .t span { font-size: 12.5px; color: var(--text3); }
|
||||
@@ -181,7 +181,7 @@
|
||||
.places { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
|
||||
.place { position: relative; height: 112px; background-size: cover; background-position: center; }
|
||||
.place::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,9,8,.1), rgba(10,9,8,.86)); }
|
||||
.place::before { content: ''; position: absolute; inset: -5px; border: 1px solid rgba(224,178,62,.38); z-index: 1; }
|
||||
.place::before { content: ''; position: absolute; inset: -5px; border: 1px solid rgba(var(--gold-rgb), .38); z-index: 1; }
|
||||
.place div { position: absolute; left: 14px; right: 14px; bottom: 10px; z-index: 1; display: flex; justify-content: space-between; align-items: baseline; }
|
||||
.place b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 19px; font-weight: 700; }
|
||||
.place span { font-size: 13px; color: var(--text2); } .place span strong { font-size: 22px; color: var(--text); font-weight: 700; }
|
||||
@@ -200,7 +200,7 @@
|
||||
/* ---- v4 first run (11-19, "the setup still looks like the old launcher"): a stage, a drop, a reveal ---- */
|
||||
.stage { position: absolute; inset: 0; background: #070605; }
|
||||
.stage::before { content: ''; position: absolute; left: 50%; top: 52%; width: 1100px; height: 640px; transform: translate(-50%, -50%);
|
||||
background: radial-gradient(closest-side, rgba(224, 178, 62, .13), rgba(224, 178, 62, .04) 55%, rgba(0, 0, 0, 0)); }
|
||||
background: radial-gradient(closest-side, rgba(var(--gold-rgb), .13), rgba(var(--gold-rgb), .04) 55%, rgba(0, 0, 0, 0)); }
|
||||
.welcome { position: absolute; left: 96px; top: 120px; width: 520px; }
|
||||
.welcome .k { font-size: 14px; font-weight: 600; color: var(--gold); }
|
||||
.welcome h1 { font-size: 64px; margin-top: 10px; line-height: 1; }
|
||||
@@ -208,12 +208,12 @@
|
||||
.welcome p + p { margin-top: 10px; font-size: 14px; color: var(--text3); }
|
||||
.portal { position: absolute; left: 660px; top: 120px; width: 524px; height: 520px; display: grid; place-items: center; text-align: center;
|
||||
background: linear-gradient(180deg, rgba(24, 20, 13, .9), rgba(12, 10, 7, .9)); }
|
||||
.portal::before { content: ''; position: absolute; inset: 0; border: 1px solid rgba(224, 178, 62, .55); }
|
||||
.portal::after { content: ''; position: absolute; inset: 10px; border: 1px dashed rgba(224, 178, 62, .32); }
|
||||
.portal::before { content: ''; position: absolute; inset: 0; border: 1px solid rgba(var(--gold-rgb), .55); }
|
||||
.portal::after { content: ''; position: absolute; inset: 10px; border: 1px dashed rgba(var(--gold-rgb), .32); }
|
||||
.portal .c { position: absolute; width: 22px; height: 22px; border-color: var(--gold-hi); border-style: solid; border-width: 0; }
|
||||
.portal .c1 { left: -1px; top: -1px; border-left-width: 2px; border-top-width: 2px; } .portal .c2 { right: -1px; top: -1px; border-right-width: 2px; border-top-width: 2px; }
|
||||
.portal .c3 { left: -1px; bottom: -1px; border-left-width: 2px; border-bottom-width: 2px; } .portal .c4 { right: -1px; bottom: -1px; border-right-width: 2px; border-bottom-width: 2px; }
|
||||
.portal .ic { width: 66px; height: 82px; margin: 0 auto; position: relative; border: 1.5px solid var(--gold); background: rgba(224, 178, 62, .06); }
|
||||
.portal .ic { width: 66px; height: 82px; margin: 0 auto; position: relative; border: 1.5px solid var(--gold); background: rgba(var(--gold-rgb), .06); }
|
||||
.portal .ic::before { content: ''; position: absolute; right: -1.5px; top: -1.5px; width: 20px; height: 20px; background: #070605; border-left: 1.5px solid var(--gold); border-bottom: 1.5px solid var(--gold); }
|
||||
.portal .ic::after { content: '.nup'; position: absolute; left: 0; right: 0; bottom: 10px; font-size: 12px; font-weight: 800; color: var(--gold); }
|
||||
.portal h2 { font-size: 34px; margin-top: 26px; } .portal p { margin-top: 8px; font-size: 14.5px; color: var(--text2); }
|
||||
@@ -231,7 +231,7 @@
|
||||
.rlogo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 34px rgba(0, 0, 0, .8)); }
|
||||
.found4 { position: absolute; left: 0; right: 0; top: 500px; text-align: center; font-size: 15px; color: var(--text2); }
|
||||
.found4 b { color: var(--emerald); font-weight: 650; } .found4 em { font-style: normal; color: var(--text3); }
|
||||
.choices { position: absolute; left: 150px; right: 150px; top: 556px; display: grid; grid-template-columns: 1fr 1.6fr; border-top: 1px solid rgba(224,178,62,.35); border-bottom: 1px solid rgba(224,178,62,.35); }
|
||||
.choices { position: absolute; left: 150px; right: 150px; top: 556px; display: grid; grid-template-columns: 1fr 1.6fr; border-top: 1px solid rgba(var(--gold-rgb), .35); border-bottom: 1px solid rgba(var(--gold-rgb), .35); }
|
||||
.choices > div { padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; }
|
||||
.choices > div + div { border-left: 1px solid var(--line-soft); }
|
||||
.choices label { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 600; font-size: 17px; color: var(--gold-hi); display: block; }
|
||||
|
||||
Reference in New Issue
Block a user