Triforce v0.8.3

Fixes from the 0.8 reports: a mod's code patches go in together or not at all and a mod whose code is refused is off whole; nn::crypto random bytes from the host (a crash at start); shader preparation on three quarters of the CPU threads; Evil HD ornaments and shoot leaves kept to 75 m and 70 m (flicker); the RADV lighting flicker fix; 3D BC images through block attachments on AMD RDNA 1/2 Windows (rainbow lights).
This commit is contained in:
ruckus7382sfgsgdf
2026-11-25 16:54:12 -06:00
parent 5891f8d6dc
commit ecb4d5cc99
13 changed files with 185 additions and 34 deletions

View File

@@ -410,6 +410,37 @@ class Apply(Folder):
self.apply()
self.assertEqual(self.image()[0x10:0x12], b"\xaa\xbb")
def test_a_mod_goes_in_whole_or_not_at_all(self):
# (11-25: a mod's file built in branched into the code cave its other file was refused for, and the game crashed)
before = (self.exefs / "main").read_bytes()
self.patch("cave/exefs/a.pchtxt", "@nsobid-%s\n@enabled\n00000110 AAAA\n" % MAIN_HEX)
self.patch("cave/exefs/%s.ips" % MAIN_HEX, ips([(0x100 + 0x400, b"\x1f\x20\x03\xd5")])) # (the code cave)
entries = self.apply()
self.assertEqual([e["state"] for e in entries], ["refused", "refused"])
self.assertEqual((self.exefs / "main").read_bytes(), before)
cave = "cave/exefs/%s.ips" % MAIN_HEX
refused = next(e for e in entries if e["path"] == "cave/exefs/a.pchtxt")
self.assertIn("another patch of the same mod is not applied (%s)" % cave, refused["why"])
self.assertTrue(any(line.startswith("code mods: cave/exefs/a.pchtxt is not applied: another patch") for line in self.said),
self.said)
# (another mod beside it is applied as before)
self.patch("other/exefs/b.pchtxt", "@nsobid-%s\n@enabled\n00000120 BB\n" % MAIN_HEX)
self.fresh()
entries = self.apply()
self.assertEqual({e["path"]: e["state"] for e in entries},
{"cave/exefs/a.pchtxt": "refused", cave: "refused", "other/exefs/b.pchtxt": "applied"})
self.assertNotEqual(self.image()[0x10:0x12], b"\xaa\xaa") # (the refused mod's bytes are not in)
self.assertEqual(self.image()[0x20], 0xBB)
def test_a_patch_for_another_build_holds_nothing_back(self):
# (mods carry one patch per game version: the others' refusal leaves this build's file applied)
self.patch("multi/exefs/a.pchtxt", "@nsobid-%s\n@enabled\n00000110 AAAA\n" % MAIN_HEX)
self.patch("multi/exefs/0123456789abcdef0123456789abcdef01234567.ips", ips([(0x100 + 0x10, b"\x01")]))
entries = self.apply()
self.assertEqual({e["path"].split("/")[-1]: e["state"] for e in entries},
{"a.pchtxt": "applied", "0123456789abcdef0123456789abcdef01234567.ips": "refused"})
self.assertEqual(self.image()[0x10:0x12], b"\xaa\xaa")
def test_a_patch_that_changes_nothing_leaves_the_file(self):
before = (self.exefs / "main").read_bytes()
self.patch("same/exefs/%s.ips" % MAIN_HEX, ips([(0x100 + 0x40, b"\x11\x11"), (0x100 + 0x1040, (3, 0x12))]))

View File

@@ -78,9 +78,12 @@ int main(void) {
evil_hd_foliage(1.0f, out);
CHECK(same(out, game, 1.0f));
evil_hd_foliage(2.5f, out);
CHECK(same(out, game, 2.5f) && out[0] == 100.0f && out[1] == 150.0f && out[5] == 337.5f);
CHECK(out[0] == 100.0f && out[1] == 150.0f && out[5] == 337.5f && out[4] == 100.0f && out[7] == 112.5f);
CHECK(out[2] == 75.0f && out[3] == 70.0f); /* (the ornaments and shoot leaves kept to 75 and 70 m: 11-25 flicker) */
evil_hd_foliage(4.0f, out);
CHECK(same(out, game, 4.0f));
CHECK(out[0] == 160.0f && out[1] == 240.0f && out[5] == 540.0f && out[2] == 75.0f && out[3] == 70.0f);
evil_hd_foliage(2.0f, out);
CHECK(out[2] == 70.0f && out[3] == 60.0f); /* (under their most: the factor's own) */
/* which bytes are known: the game's, or what a write of this left (a factor from 1 to 4) */
CHECK(evil_hd_foliage_known(game));
for (float f = 1.0f; f <= 4.0f; f += 0.25f) {

View File

@@ -21,10 +21,11 @@ int main() {
// (what it was: half the processors, 1 to 32)
expect(half(1) == 1 && half(2) == 1 && half(12) == 6 && half(24) == 12 && half(64) == 32 && half(128) == 32, "half, as before");
// (a player's PC: normal priority, RAM free at the start)
expect(count(12, 24 * GB, false, 0) == 12, "12 processors, 24 GB free: all 12");
expect(count(24, 26 * GB, false, 0) == 24, "24 processors, 26 GB free: all 24");
expect(count(12, 24 * GB, false, 0) == 9, "12 processors, 24 GB free: three quarters, 9");
expect(count(24, 26 * GB, false, 0) == 18, "24 processors, 26 GB free: three quarters, 18");
expect(count(8, 16 * GB, false, 0) == 6 && count(4, 16 * GB, false, 0) == 3, "8 and 4 processors: 6 and 3");
expect(count(1, 8 * GB, false, 0) == 1 && count(2, 8 * GB, false, 0) == 2, "one and two processors");
expect(count(128, 256 * GB, false, 0) == 64, "64 at most");
expect(count(128, 256 * GB, false, 0) == 64 && count(64, 256 * GB, false, 0) == 48, "64 at most; 64 processors: 48");
// (1 GB free a worker past half)
expect(count(24, 16 * GB, false, 0) == 16, "24 processors, 16 GB free: 16");
expect(count(32, 11 * GB, false, 0) == 16, "32 processors, 11 GB free: half, 16, not fewer");
@@ -46,16 +47,16 @@ int main() {
expect(count(24, 2 * GB, true, 20) == 20, "the switch decides, whatever the RAM and the priority");
expect(count(4, 64 * GB, false, 1) == 1, "the switch: one");
expect(count(8, 64 * GB, false, 1000) == 64, "the switch: 64 at most");
expect(count(24, 26 * GB, false, -3) == 24 && count(24, 26 * GB, false, 0) == 24, "the switch not set, or not a count: the rule");
expect(count(24, 26 * GB, false, -3) == 18 && count(24, 26 * GB, false, 0) == 18, "the switch not set, or not a count: the rule");
// (the translation pass on AMD's Windows driver for RDNA 1 and 2: kAmdOlderMost at most, fewer where count gives fewer;
// other drivers and the switch: count's number)
using prepare_threads::translate;
const unsigned most = prepare_threads::kAmdOlderMost;
expect(translate(count(24, 26 * GB, false, 0), true, false) == most, "AMD's older driver, 24 processors: the cap");
expect(translate(count(24, 64 * GB, true, 0), true, false) == most, "AMD's older driver, above normal: the cap over half");
expect(translate(count(4, 64 * GB, false, 0), true, false) == 4 && translate(2, true, false) == 2, "AMD's older driver, few processors: count's");
expect(translate(count(4, 64 * GB, false, 0), true, false) == count(4, 64 * GB, false, 0) && translate(2, true, false) == 2, "AMD's older driver, few processors: count's");
expect(translate(count(24, 26 * GB, false, 20), true, true) == 20, "AMD's older driver: the switch still decides");
expect(translate(count(24, 26 * GB, false, 0), false, false) == 24, "other drivers: count's");
expect(translate(count(24, 26 * GB, false, 0), false, false) == 18, "other drivers: count's");
// ((Triforce) the process heap's signature: the segment heap's, the NT heap's, anything else not known)
expect(prepare_threads::segment_heap(0xDDEEDDEEu) && !prepare_threads::segment_heap(0xFFEEFFEEu) && !prepare_threads::segment_heap(0),
"segment_heap: the segment heap's signature only");