mirror of
https://git.triforceproject.com/triforce/source
synced 2026-12-01 05:18:50 -04:00
Triforce v0.9.0
Character tab, faster renderer defaults, HD rumble shipped, and the 11-30 bug pass: ending softlock below 60 fps, adult first-night lock, Intel Arc robust buffers, adult map, randomizer load order.
This commit is contained in:
@@ -195,10 +195,10 @@ static partial class Tests
|
||||
|
||||
static void RandoNames()
|
||||
{
|
||||
Equal("Randomizer K7QW2MPA", Randomizer.FolderName("K7QW2MPA"), "a plain seed");
|
||||
Equal("Randomizer my seed for Saturday", Randomizer.FolderName(" my_seed.for Saturday "), "space, _ and . become spaces");
|
||||
Equal("Randomizer a-b-c", Randomizer.FolderName("a/b\\c"), "path characters cannot leave the folder");
|
||||
Equal("Randomizer seed", Randomizer.FolderName("::"), "nothing left: seed");
|
||||
Equal("~Randomizer K7QW2MPA", Randomizer.FolderName("K7QW2MPA"), "a plain seed");
|
||||
Equal("~Randomizer my seed for Saturday", Randomizer.FolderName(" my_seed.for Saturday "), "space, _ and . become spaces");
|
||||
Equal("~Randomizer a-b-c", Randomizer.FolderName("a/b\\c"), "path characters cannot leave the folder");
|
||||
Equal("~Randomizer seed", Randomizer.FolderName("::"), "nothing left: seed");
|
||||
Check(Randomizer.FolderName(new string('x', 300)).Length <= 60, "a long seed is cut");
|
||||
Check(Randomizer.FolderName("../../x").IndexOf("..", StringComparison.Ordinal) < 0, "no .. in a name");
|
||||
var root = NewRoot("rando-names");
|
||||
@@ -310,7 +310,7 @@ static partial class Tests
|
||||
var made = await r.MakeAsync(game, s, values, "Saturday race!", new RandoCosmetics("grouped", "off", "random", false), lines.Add, CancellationToken.None, "Easy");
|
||||
Check(!Directory.EnumerateDirectories(Path.Combine(game, "mods"), Randomizer.Making + "*").Any(), "no build folder left, the old one taken away");
|
||||
Equal("Easy", made.Seed.Preset, "the preset it went by, kept");
|
||||
var folder = Path.Combine(game, "mods", "Randomizer Saturday race!");
|
||||
var folder = Path.Combine(game, "mods", "~Randomizer Saturday race!");
|
||||
Equal(folder, made.Seed.Mod.Path, "the seed's folder");
|
||||
Check(made.Seed.Mod.On, "on");
|
||||
Equal("flow of Saturday race!", File.ReadAllText(Path.Combine(folder, "romfs", "Event", "EventFlow", "Dm_Kokiri_0000.bfevfl.zs")), "the seed's game files");
|
||||
@@ -333,27 +333,56 @@ static partial class Tests
|
||||
|
||||
// (a second seed: on, the first off; the same seed again gets a folder of its own)
|
||||
var second = await r.MakeAsync(game, s, s.Defaults(), "Saturday race!", new RandoCosmetics(), null, CancellationToken.None);
|
||||
Equal("Randomizer Saturday race! 2", second.Seed.Mod.Name, "the same seed's second folder");
|
||||
Equal("~Randomizer Saturday race! 2", second.Seed.Mod.Name, "the same seed's second folder");
|
||||
var seeds = r.Seeds(game);
|
||||
Equal(2, seeds.Count, "two seeds");
|
||||
Equal(1, seeds.Count(x => x.Mod.On), "one on");
|
||||
Check(seeds.Single(x => x.Mod.On).Mod.Name == "Randomizer Saturday race! 2", "the new one");
|
||||
Check(Directory.Exists(Path.Combine(game, "mods", "-Randomizer Saturday race!")), "the first switched off by its folder's name");
|
||||
Check(seeds.Single(x => x.Mod.On).Mod.Name == "~Randomizer Saturday race! 2", "the new one");
|
||||
Check(Directory.Exists(Path.Combine(game, "mods", "-~Randomizer Saturday race!")), "the first switched off by its folder's name");
|
||||
r.Use(game, seeds.Single(x => !x.Mod.On));
|
||||
Equal("Randomizer Saturday race!", r.Seeds(game).Single(x => x.Mod.On).Mod.Name, "Use: that one on, the other off");
|
||||
Equal("~Randomizer Saturday race!", r.Seeds(game).Single(x => x.Mod.On).Mod.Name, "Use: that one on, the other off");
|
||||
r.Off(game);
|
||||
Check(r.Seeds(game).All(x => !x.Mod.On), "Off: every seed off");
|
||||
r.Remove(game, r.Seeds(game).First(x => x.Mod.Name == "Randomizer Saturday race! 2"));
|
||||
r.Remove(game, r.Seeds(game).First(x => x.Mod.Name == "~Randomizer Saturday race! 2"));
|
||||
Equal(1, r.Seeds(game).Count, "removed");
|
||||
Check(Directory.EnumerateDirectories(Path.Combine(game, "mods", Mods.Removed)).Any(), "into mods\\.removed");
|
||||
|
||||
// (another mod that is on and carries one of the seed's files, sorting after it, wins it: said)
|
||||
// (another mod that is on and carries one of the seed's files: the seed sorts after it and wins, unnumbered names after
|
||||
// "Randomizer" included (11-30, ticket 1576351134820470917: "Song of Time Age Swap" took the seed's event tables, its
|
||||
// chests stayed shut)
|
||||
r.Use(game, r.Seeds(game).Single());
|
||||
var other = Path.Combine(game, "mods", "Tall grass", "romfs", "Event", "EventFlow");
|
||||
var other = Path.Combine(game, "mods", "Song of Time Age Swap", "romfs", "RSDB");
|
||||
Directory.CreateDirectory(other);
|
||||
File.WriteAllText(Path.Combine(other, "Dm_Kokiri_0000.bfevfl.zs"), "other");
|
||||
File.WriteAllText(Path.Combine(other, "EventSetting.Product.111.rstbl.byml.zs"), "other");
|
||||
var seedRsdb = Path.Combine(r.Seeds(game).Single().Mod.Path, "romfs", "RSDB");
|
||||
Directory.CreateDirectory(seedRsdb);
|
||||
File.WriteAllText(Path.Combine(seedRsdb, "EventSetting.Product.111.rstbl.byml.zs"), "seed's");
|
||||
var shared = r.Shared(game, r.Seeds(game).Single().Mod.Rel);
|
||||
Check(shared.Count == 1 && shared[0].Name == "Tall grass" && shared[0].Wins, "the other mod that wins a file");
|
||||
Check(shared.Count == 1 && shared[0].Name == "Song of Time Age Swap" && !shared[0].Wins, "the seed wins its event table: " + string.Join(";", shared));
|
||||
Equal("seed's", File.ReadAllText(r.Manager.RomfsFile(game, "RSDB/EventSetting.Product.111.rstbl.byml.zs")!), "the file the game takes is the seed's");
|
||||
// (a mod whose name sorts after ~ still can: that is said)
|
||||
var after = Path.Combine(game, "mods", "Über grass", "romfs", "Event", "EventFlow");
|
||||
Directory.CreateDirectory(after);
|
||||
File.WriteAllText(Path.Combine(after, "Dm_Kokiri_0000.bfevfl.zs"), "other");
|
||||
shared = r.Shared(game, r.Seeds(game).Single().Mod.Rel);
|
||||
Check(shared.Any(x => x.Name == "Über grass" && x.Wins), "the other mod that wins a file");
|
||||
Directory.Delete(Path.Combine(game, "mods", "Über grass"), true);
|
||||
Directory.Delete(Path.Combine(game, "mods", "Song of Time Age Swap"), true);
|
||||
|
||||
// (a seed made before 11-30, "Randomizer <seed>": switched on, it gets the ~; one numbered on the Mods page keeps its place)
|
||||
Equal("~Randomizer Old", Randomizer.OnName("-Randomizer Old"), "an old seed's folder");
|
||||
Equal(null, Randomizer.OnName("-~Randomizer New"), "a new one keeps its name");
|
||||
Equal(null, Randomizer.OnName("-04-Randomizer Ordered"), "a numbered one keeps its name");
|
||||
Equal(null, Randomizer.OnName("-Tall grass"), "not a seed's name");
|
||||
var oldSeed = Path.Combine(game, "mods", "-Randomizer Old");
|
||||
Directory.CreateDirectory(Path.Combine(oldSeed, "romfs", "Event"));
|
||||
File.WriteAllText(Path.Combine(oldSeed, "romfs", "Event", "x.zs"), "old");
|
||||
File.WriteAllText(Path.Combine(oldSeed, Randomizer.Marker), "{\"seed\":\"Old\"}");
|
||||
var onOld = r.Use(game, r.Seeds(game).Single(x => x.Seed == "Old"));
|
||||
Equal(Path.Combine(game, "mods", "~Randomizer Old"), onOld, "the old seed switched on under the ~ name");
|
||||
Check(r.Seeds(game).Single(x => x.Mod.On).Seed == "Old", "and it is the one on");
|
||||
r.Use(game, r.Seeds(game).Single(x => x.Seed != "Old"));
|
||||
r.Remove(game, r.Seeds(game).Single(x => x.Seed == "Old"));
|
||||
|
||||
// (a seed whose other seed cannot be switched off: it is made, and stays off; never two seeds on)
|
||||
var onNow = r.Seeds(game).Single(x => x.Mod.On);
|
||||
@@ -361,7 +390,7 @@ static partial class Tests
|
||||
var stuck = await ThrowsAsync<OotrrException>(() => r.MakeAsync(game, s, s.Defaults(), "Sunday", new RandoCosmetics(), null, CancellationToken.None), "the other seed cannot be switched off");
|
||||
Check(stuck.Message.StartsWith("Seed Sunday is made, but it stays off: ", StringComparison.Ordinal), "said: " + stuck.Message);
|
||||
Equal(1, r.Seeds(game).Count(x => x.Mod.On), "still one seed on");
|
||||
Check(r.Seeds(game).Single(x => x.Seed == "Sunday") is { Mod.On: false } sunday && sunday.Mod.Folder == "-Randomizer Sunday", "the new one is there, off");
|
||||
Check(r.Seeds(game).Single(x => x.Seed == "Sunday") is { Mod.On: false } sunday && sunday.Mod.Folder == "-~Randomizer Sunday", "the new one is there, off");
|
||||
Directory.Delete(Path.Combine(game, "mods", "-" + onNow.Mod.Folder));
|
||||
r.Use(game, r.Seeds(game).Single(x => x.Seed == "Sunday"));
|
||||
Check(r.Seeds(game).Single(x => x.Mod.On).Seed == "Sunday", "and can be switched on once that is fixed");
|
||||
@@ -399,12 +428,12 @@ static partial class Tests
|
||||
var s = await r.SchemaAsync(CancellationToken.None);
|
||||
var e = await ThrowsAsync<OotrrException>(() => r.MakeAsync(game, s, s.Defaults(), "fail", new RandoCosmetics(), null, CancellationToken.None), "generate fails");
|
||||
Equal("The randomizer stopped: no placement could be found", e.Message, "OOTRR's own error");
|
||||
Check(!Directory.Exists(Path.Combine(game, "mods", "Randomizer fail")), "no folder left");
|
||||
Check(!Directory.Exists(Path.Combine(game, "mods", Randomizer.FolderName("fail"))), "no folder left");
|
||||
|
||||
// (stopped while the build writes, a file of its own held open: the program is gone before its folder is taken away)
|
||||
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60)))
|
||||
await ThrowsAsync<OperationCanceledException>(() => r.MakeAsync(game, s, s.Defaults(), "slow", new RandoCosmetics(), l => { if (l == "Writing flows") cts.Cancel(); }, cts.Token), "stopped part way");
|
||||
Check(!Directory.Exists(Path.Combine(game, "mods", "Randomizer slow")) && !Directory.Exists(Path.Combine(game, "mods", "-Randomizer slow")), "a stopped build leaves no half-made seed");
|
||||
Check(!Directory.Exists(Path.Combine(game, "mods", Randomizer.FolderName("slow"))) && !Directory.Exists(Path.Combine(game, "mods", "-" + Randomizer.FolderName("slow"))), "a stopped build leaves no half-made seed");
|
||||
Check(!Directory.EnumerateDirectories(Path.Combine(game, "mods"), Randomizer.Making + "*").Any(), "nor its build folder (the file it held let go)");
|
||||
await ThrowsAsync<OotrrException>(() => r.MakeAsync(game, s, s.Defaults(), "two\nlines", new RandoCosmetics(), null, CancellationToken.None), "a line break in a seed");
|
||||
await ThrowsAsync<OotrrException>(() => r.MakeAsync(game, s, s.Defaults(), new string('x', Randomizer.MaxSeed + 1), new RandoCosmetics(), null, CancellationToken.None), "a seed too long");
|
||||
@@ -412,7 +441,7 @@ static partial class Tests
|
||||
full.FreeBytes = _ => 10L << 20;
|
||||
var cramped = new Randomizer(full, null, new ModManager(full) { GameRuns = _ => false });
|
||||
var room = await ThrowsAsync<OotrrException>(() => cramped.MakeAsync(game, s, s.Defaults(), "room", new RandoCosmetics(), null, CancellationToken.None), "a disk without room");
|
||||
Check(room.Message.Length > 0 && !Directory.Exists(Path.Combine(game, "mods", "Randomizer room")), "refused before anything is written: " + room.Message);
|
||||
Check(room.Message.Length > 0 && !Directory.Exists(Path.Combine(game, "mods", Randomizer.FolderName("room"))), "refused before anything is written: " + room.Message);
|
||||
|
||||
// (the check before a seed: what OOTRR refuses, in the settings' words; nothing written in the mods folder)
|
||||
var refused = s.Defaults();
|
||||
|
||||
Reference in New Issue
Block a user