mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-29 04:18:49 -04:00
Triforce v0.8.5
A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
This commit is contained in:
@@ -41,6 +41,20 @@ public sealed partial class Backend
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>((Triforce, 11-26) 1 while a GameBanana file is installed: two at once shared the mods folder's download folder,
|
||||
/// and the second took away the first one's download and the version it had moved aside</summary>
|
||||
int gbInstalling;
|
||||
|
||||
/// <summary>((Triforce, 11-26) A build or an update reads the mods folder (and records which code patches it built in): no
|
||||
/// mod changes meanwhile. Says so and is true when refused.</summary>
|
||||
bool RefusedWhileBuilding()
|
||||
{
|
||||
if (Volatile.Read(ref workBusy) == 0) return false;
|
||||
Toast("Wait for the build to end: it reads the mods folder.", "error");
|
||||
SendMods();
|
||||
return true;
|
||||
}
|
||||
|
||||
static string CardKey(GbMod m) => "gb:" + (m.Wip ? "w" : "m") + ":" + m.Id;
|
||||
GbMod? CardOf(string id) { lock (modsGate) return gbCards.FirstOrDefault(c => CardKey(c) == id); }
|
||||
|
||||
@@ -283,7 +297,7 @@ public sealed partial class Backend
|
||||
{
|
||||
if (id == null) return;
|
||||
if (GameDir is not { } game) { Toast("Build the game first: mods go into its mods folder.", "error"); return; }
|
||||
if (modsBusy.ContainsKey(id)) return;
|
||||
if (modsBusy.ContainsKey(id) || RefusedWhileBuilding()) return;
|
||||
if (id.StartsWith("m:", StringComparison.Ordinal))
|
||||
{
|
||||
var mod = MineMods(game, true).FirstOrDefault(m => "m:" + m.Rel == id);
|
||||
@@ -344,7 +358,9 @@ public sealed partial class Backend
|
||||
async Task Install(string game, GbMod card, GbFile file)
|
||||
{
|
||||
var key = CardKey(card);
|
||||
if (!modsBusy.TryAdd(key, "Downloading " + Size(file.Bytes))) return;
|
||||
if (RefusedWhileBuilding()) return;
|
||||
if (Interlocked.CompareExchange(ref gbInstalling, 1, 0) != 0) { Toast("One download at a time: wait for the one on its way.", "error"); return; }
|
||||
if (!modsBusy.TryAdd(key, "Downloading " + Size(file.Bytes))) { Interlocked.Exchange(ref gbInstalling, 0); return; }
|
||||
SendMods();
|
||||
var last = DateTime.MinValue;
|
||||
void Progress(DownloadProgress p)
|
||||
@@ -367,6 +383,7 @@ public sealed partial class Backend
|
||||
finally
|
||||
{
|
||||
modsBusy.TryRemove(key, out _);
|
||||
Interlocked.Exchange(ref gbInstalling, 0);
|
||||
SendMods();
|
||||
}
|
||||
}
|
||||
@@ -390,7 +407,7 @@ public sealed partial class Backend
|
||||
|
||||
void ModsRemove(string? id)
|
||||
{
|
||||
if (id == null || GameDir is not { } game) return;
|
||||
if (id == null || GameDir is not { } game || RefusedWhileBuilding()) return;
|
||||
var all = MineMods(game, true);
|
||||
List<Mod> list;
|
||||
if (id.StartsWith("m:", StringComparison.Ordinal)) list = all.Where(m => "m:" + m.Rel == id).ToList();
|
||||
|
||||
Reference in New Issue
Block a user