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

42
nx2/dead_flags.py Normal file
View File

@@ -0,0 +1,42 @@
"""(Triforce) a64_lift.Lifter.dead_flags, answered at once for a function none of whose instructions writes a flag.
dead_flags (the kit's) works out, per function, which flags each instruction stores that nothing reads, so emit_function can
drop those stores: one pass over the function's instructions to gather what each reads and writes, then a liveness fixpoint.
Only an instruction that writes a flag (a translated op whose text stores c->n, z, c or v: flag_masks' second half) can have a
dead store (the kit keeps only those: `kills[i] and body[pc][0][0] == "op"`), so a function without one has none, and the kit's
answer is {} after all that work. It ran on every one of OoT's 294,000 functions, more than half of which write no flag; here a
function is first looked over for a flag write (flag_masks, kept by the text in the kit), and only one that has one goes through
the kit's method. The answers are the kit's (tests/test_dead_flags.py).
install() is run by nx2/lift.py at its module level, so the emit's spawned processes (nx2/emit_pool.py) have it too.
"""
import a64_lift
import a64emit
_installed = False
def writes_flags(body, texts):
"""an instruction of body is a translated op whose text stores a flag (the only kind dead_flags can find dead)"""
relative, masks = a64_lift.pc_relative, a64_lift.flag_masks
for pc, (k, w) in body.items():
if k[0] == "op":
text, fl = texts[(w, pc) if relative(w) else w]
if not fl & a64emit.UNHANDLED and masks(text)[1]:
return True
return False
def install():
global _installed
if _installed:
return
_installed = True
base = a64_lift.Lifter.dead_flags
def dead_flags(self, body, pcs, texts):
if not writes_flags(body, texts):
return {}
return base(self, body, pcs, texts)
a64_lift.Lifter.dead_flags = dead_flags