Triforce v0.8.0

Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-25 10:21:32 -06:00
parent 861702476a
commit 4fa4f9188b
881 changed files with 179428 additions and 15581 deletions

View File

@@ -0,0 +1,78 @@
"""A large first read of a .nup extracts the game's code first and the rest beside the lift (nx2/make_game.py
overlap_package_read). Game-free.
- the gate: a package of 1 GiB or more, more than one job, no copy of the game in the folder yet, 8 GB free and no hard
drive; each of those missing (and HOOKSHOT_OVERLAP_READ=0) keeps the read whole before the lift, as before;
- main(): the code is extracted with --only exefs and checked before the lift, the romfs with --only romfs beside it; the
package is checked to be the same file after; the romfs read is waited for before the compile, its damaged files stood in
for, and only then do the prompts (which read the romfs) start. Without the overlap, the order is as before.
python -I -B tests/test_overlap_read.py
"""
import importlib.util
import os
import sys
import tempfile
import types
import unittest
from unittest import mock
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.join(ROOT, "nx2"))
spec = importlib.util.spec_from_file_location("make_game_under_test", os.path.join(ROOT, "nx2", "make_game.py"))
make_game = importlib.util.module_from_spec(spec)
spec.loader.exec_module(make_game)
GIB = 1 << 30
class Gate(unittest.TestCase):
def gate(self, jobs=8, size=20 * GIB, have=(), free=16000, spinning=False, env=None):
with tempfile.TemporaryDirectory(prefix="overlap-read-") as tmp:
out, work = os.path.join(tmp, "out"), os.path.join(tmp, "work")
kept, romfs = os.path.join(out, ".triforce_exefs"), os.path.join(out, "romfs")
for f in have:
os.makedirs(os.path.join(out, f))
build = types.ModuleType("build")
build.free_mb = lambda: free
with mock.patch.dict(sys.modules, {"build": build}), \
mock.patch.object(make_game, "spinning_disk", lambda folder: spinning), \
mock.patch.dict(os.environ, env or {}), mock.patch.object(make_game.os, "cpu_count", lambda: 16):
if env is None:
os.environ.pop("HOOKSHOT_OVERLAP_READ", None)
return make_game.overlap_package_read(jobs, types.SimpleNamespace(st_size=size), out, work, kept, romfs)
def test_gate(self):
self.assertTrue(self.gate())
self.assertTrue(self.gate(jobs=None)) # (the build's own count)
self.assertTrue(self.gate(spinning=None)) # (a drive that cannot be told: as an SSD)
for what, kw in (("one job", dict(jobs=1)), ("a small package", dict(size=GIB - 1)),
("a copy of the code", dict(have=(".triforce_exefs",))), ("a romfs", dict(have=("romfs",))),
("little memory", dict(free=8191)), ("memory not known", dict(free=None)),
("a hard drive", dict(spinning=True)), ("switched off", dict(env={"HOOKSHOT_OVERLAP_READ": "0"}))):
self.assertFalse(self.gate(**kw), what)
def test_identity(self):
st = os.stat(__file__)
self.assertEqual(make_game.package_identity(st), make_game.package_identity(os.stat(__file__)))
class Order(unittest.TestCase):
def test_main(self):
src = open(os.path.join(ROOT, "nx2", "make_game.py"), encoding="utf-8").read()
body = src[src.index("def main("):]
exefs_first = body.index('run(extract + ["--only", "exefs"])')
self.assertLess(exefs_first, body.index("remaining_assets = read_assets"))
self.assertIn('run(extract + (["--only", "romfs"] if overlap else []))', body)
self.assertIn("package_identity(os.stat(a.nup)) != package_identity(st)", body)
reader = body.index("reading = reader.submit(remaining_assets)")
joined = body.index("reading.result()", reader)
self.assertLess(body.index("\n translate()\n", reader), joined)
stand_in = body.index("stand_in_damaged_files(out, romfs, seen_holder[0])", joined)
self.assertLess(stand_in, body.index("prompts = start_prompts()", joined))
self.assertLess(joined, body.index('env["HOOKSHOT_TIMES"]')) # (before the compile)
self.assertIn("prompts = None if remaining_assets else start_prompts()", body)
if __name__ == "__main__":
unittest.main()