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:
@@ -87,7 +87,8 @@ public sealed class GameBanana
|
||||
{
|
||||
using var r = await http.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token).ConfigureAwait(false);
|
||||
if (!r.IsSuccessStatusCode) throw new HttpRequestException("GameBanana answered " + (int)r.StatusCode, null, r.StatusCode);
|
||||
return await r.Content.ReadAsStringAsync(token).ConfigureAwait(false);
|
||||
// ((Triforce, 11-26) at most 8 MB unpacked: the answers come compressed, and one of a few KB could unpack to gigabytes)
|
||||
return await Downloader.TextAsync(r.Content, 8 << 20, token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
async Task<string> GetWithRetriesAsync(string url, bool retry, CancellationToken token)
|
||||
|
||||
@@ -127,7 +127,8 @@ public sealed class GameBananaInstaller
|
||||
{
|
||||
var name = Path.GetFileName(d);
|
||||
if (name.StartsWith('.')) continue;
|
||||
if (ModManager.ReadInfo(d) is not { } info || info.GameBananaId != m.Id) continue;
|
||||
// ((Triforce, 11-26) the same id and the same kind: GameBanana's mods and works in progress are numbered apart)
|
||||
if (ModManager.ReadInfo(d) is not { } info || info.GameBananaId != m.Id || info.Wip != m.Wip) continue;
|
||||
if (old.Count == 0)
|
||||
{
|
||||
var (off, num, _) = Mods.Parse(name);
|
||||
@@ -137,10 +138,20 @@ public sealed class GameBananaInstaller
|
||||
old.Add(d);
|
||||
}
|
||||
var aside = new List<(string Was, string Gone)>();
|
||||
for (var k = 0; k < old.Count; k++) // (out of the way first: removed once the new one is in, put back if it fails)
|
||||
// ((Triforce, 11-26) out of the way first, into mods\.removed as the Mods page's Remove does: kept there once the new one
|
||||
// is in (a copy the player made and edited is never lost), put back if it fails)
|
||||
var bin = Path.Combine(root, Mods.Removed);
|
||||
for (var k = 0; k < old.Count; k++)
|
||||
{
|
||||
var gone = Path.Combine(stage, "old-" + k);
|
||||
try { Directory.Move(old[k], gone); aside.Add((old[k], gone)); } catch (Exception e) { ctx.Log.Write("mods: the old " + old[k] + " could not be moved aside: " + e.Message); }
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(bin);
|
||||
var gone = ModManager.Free(bin, Path.GetFileName(old[k]).TrimStart('-', '_') is { Length: > 0 } n ? n : "mod");
|
||||
ctx.Require(gone);
|
||||
Directory.Move(old[k], gone);
|
||||
aside.Add((old[k], gone));
|
||||
}
|
||||
catch (Exception e) { ctx.Log.Write("mods: the old " + old[k] + " could not be moved aside: " + e.Message); }
|
||||
}
|
||||
var label0 = SafeName(m.Name);
|
||||
if (number == 0) number = NextNumber(root);
|
||||
@@ -168,6 +179,10 @@ public sealed class GameBananaInstaller
|
||||
ctx.Log.Write("mods: installed " + m.Name + " (" + m.Id + ") into " + placed.Count + " folder(s), the first " + placed[0]);
|
||||
var msg = "Installed into mods" + Path.DirectorySeparatorChar + Path.GetFileName(placed[0]) + ".";
|
||||
if (placed.Count > 1) msg += " It came with " + placed.Count + " options: the first is on, the others are off. Choose on the Mods page.";
|
||||
if (aside.Count > 0) msg += " The version before is kept in mods" + Path.DirectorySeparatorChar + Mods.Removed + ".";
|
||||
// (code patches are built into the game: said, so a player knows what this one changes and when)
|
||||
if (placed.Any(p => Directory.Exists(Path.Combine(p, "exefs")) && Directory.EnumerateFileSystemEntries(Path.Combine(p, "exefs")).Any()))
|
||||
msg += " It changes the game's code (exefs): build the game again to apply it.";
|
||||
return msg;
|
||||
}
|
||||
finally { Partial.Remove(stage); }
|
||||
@@ -184,8 +199,10 @@ public sealed class GameBananaInstaller
|
||||
ctx.Log.Write("mods: installing " + m.Name + " (" + m.Id + "), file " + f.Name + " (" + f.Bytes + " bytes) from " + f.Url);
|
||||
try
|
||||
{
|
||||
// (the size the server names: GameBanana's listed size is not trusted to the byte)
|
||||
await new Downloader(ctx).ToFileAsync(http, f.Url, archive, 0, progress, token).ConfigureAwait(false);
|
||||
// (the size the server names: GameBanana's listed size is not trusted to the byte, but a server that offers or sends far
|
||||
// more than it lists is refused, before the disk fills)
|
||||
var most = f.Bytes > 0 ? f.Bytes * 2 + (256L << 20) : 16L << 30;
|
||||
await new Downloader(ctx).ToFileAsync(http, f.Url, archive, 0, progress, token, most).ConfigureAwait(false);
|
||||
var unpacked = Path.Combine(stage, "unpacked");
|
||||
await Task.Run(() => mods.Unpack(within, archive, unpacked, null), token).ConfigureAwait(false);
|
||||
return unpacked;
|
||||
|
||||
@@ -82,8 +82,10 @@ public static class Mods
|
||||
{
|
||||
var off = folder.Length > 0 && (folder[0] == '-' || folder[0] == '_');
|
||||
var rest = folder.TrimStart('-', '_');
|
||||
var m = Regex.Match(rest, @"^(\d{2,3})-(.+)$", RegexOptions.Singleline);
|
||||
return m.Success ? (off, int.Parse(m.Groups[1].Value), m.Groups[2].Value) : (off, null, rest);
|
||||
// ((Triforce, 11-26) the digits 0 to 9 only: \d takes any script's digits ("01-" in full width), which int.Parse refuses,
|
||||
// and one such folder emptied the Mods page and the seed list)
|
||||
var m = Regex.Match(rest, @"^([0-9]{2,3})-(.+)$", RegexOptions.Singleline);
|
||||
return m.Success ? (off, int.Parse(m.Groups[1].Value, System.Globalization.CultureInfo.InvariantCulture), m.Groups[2].Value) : (off, null, rest);
|
||||
}
|
||||
|
||||
/// <summary>As the game compares names (host/mods.c mod_cmp, _stricmp): byte by byte, the letters A to Z without case.</summary>
|
||||
|
||||
Reference in New Issue
Block a user