mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-25 18:48:51 -04:00
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:
44
tests/test_chunks_corrupt.py
Normal file
44
tests/test_chunks_corrupt.py
Normal file
@@ -0,0 +1,44 @@
|
||||
"""A damaged chunks.txt is ignored, and chunks.save replaces it whole (nx2/chunks.py, issue ).
|
||||
|
||||
<work>/image/chunks.txt (the lift's chunk boundaries) outlives the lift, and the launcher's completely cold build keeps image/.
|
||||
On Windows a PC that went down while the file was being written left it full of null bytes, and every later lift stopped in
|
||||
chunks.write with `ValueError: invalid literal for int() with base 16: '\\x00\\x00...'` until the player deleted the work
|
||||
folder. load() now answers no boundaries for a file it cannot read (the lift then takes them from the sizes, as without the
|
||||
file), and save() writes beside the file and moves it over, so a stopped write leaves the old file whole.
|
||||
|
||||
python -I -B tests/test_chunks_corrupt.py
|
||||
"""
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "nx2"))
|
||||
import kit # noqa: E402,F401 (a64-kit on the path)
|
||||
import chunks # noqa: E402
|
||||
|
||||
|
||||
def main():
|
||||
with tempfile.TemporaryDirectory(prefix="triforce-chunks-corrupt-") as temp:
|
||||
image = Path(temp) / "image"
|
||||
image.mkdir()
|
||||
path = image / chunks.FILE
|
||||
# (the reported file: 688 null bytes, no newline, what NTFS shows of a file whose data never reached the disk)
|
||||
path.write_bytes(b"\x00" * 688)
|
||||
got = chunks.load(str(image))
|
||||
assert got == [], "a chunks.txt of null bytes gave boundaries: %r" % got[:4]
|
||||
# (bytes that are not text at all, and a line that is not an address)
|
||||
for bad in (b"\xff\xfe\x80\x81\n", b"# first guest address\n80001000\nnot hex\n"):
|
||||
path.write_bytes(bad)
|
||||
got = chunks.load(str(image))
|
||||
assert got == [], "a damaged chunks.txt (%r) gave boundaries: %r" % (bad, got)
|
||||
# (the lift saves new boundaries over the damaged file: they are read back, and no staged file is left beside them)
|
||||
chunks.save(str(image), [0x80002000, 0x80001000])
|
||||
assert chunks.load(str(image)) == [0x80001000, 0x80002000], chunks.load(str(image))
|
||||
left = sorted(p.name for p in image.iterdir() if p.name != chunks.FILE)
|
||||
assert not left, "chunks.save left files beside chunks.txt: %s" % left
|
||||
print("a damaged chunks.txt is ignored and replaced whole: ok")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user