mirror of
https://github.com/sp00nznet/xboxrecomp.git
synced 2026-12-06 02:22:30 +00:00
92aa79c624
Three things, all one thread: the loader's video paces on frames actually presented. - xbox_Nv2aFrameCounterFlip: FLIP_STALL now advances every registered swap counter, and while those arrive the 62 Hz fallback timer stands down. The timer exists for a title nothing presents for; once the executor is running flips it is the wrong clock and an actively harmful one, running virtual time far ahead of what can be drawn. - The per-pixel surface check moved to once per batch. dma_resolve walked the arena high-water mark twice per pixel and surface_hits_image walked the image range, guarding a rasterisation cheaper than the guard. Neither answer can change mid-batch: the colour offset arrives as a method. - write_if_changed in the translator. A regen rewrites all 54 chunks; an mtime bump on identical bytes costs a full /O2 rebuild of 365 MB for nothing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uoundkw2h1Z9uiD1sc2oFJ
31 lines
960 B
Python
31 lines
960 B
Python
"""write_if_changed must not touch mtime when the bytes are the same.
|
|
|
|
That is the whole point of it: a regen rewrites all 54 chunks of generated C,
|
|
and an mtime bump on an identical chunk costs a full /O2 rebuild of it.
|
|
"""
|
|
import os
|
|
import tempfile
|
|
|
|
from .translator import write_if_changed
|
|
|
|
|
|
def test_write_if_changed():
|
|
with tempfile.TemporaryDirectory() as d:
|
|
p = os.path.join(d, "chunk.c")
|
|
|
|
assert write_if_changed(p, "a") is True, "must create a missing file"
|
|
assert open(p, encoding="utf-8").read() == "a"
|
|
|
|
os.utime(p, (0, 0))
|
|
assert write_if_changed(p, "a") is False, "identical must not write"
|
|
assert os.stat(p).st_mtime == 0, "identical must not bump mtime"
|
|
|
|
assert write_if_changed(p, "b") is True, "changed must write"
|
|
assert open(p, encoding="utf-8").read() == "b"
|
|
assert os.stat(p).st_mtime != 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_write_if_changed()
|
|
print("ok")
|