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);
|
||||
|
||||
Reference in New Issue
Block a user