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:
@@ -73,6 +73,18 @@ static class Storage
|
||||
return running.StartsWith(Path.GetFullPath(versionDir).TrimEnd('\\') + "\\", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// (Triforce) make_game.py keep_translation left the lift's small files in sa (its .lift_key marked "kept"): the next update with the
|
||||
/// same tools skips the lift with them. Not let go after a build (Free up space still lets them go)
|
||||
static bool KeptTranslation(string sa)
|
||||
{
|
||||
try
|
||||
{
|
||||
var words = File.ReadAllText(Path.Combine(sa, "gen", ".lift_key")).Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries);
|
||||
return words.Length >= 3 && words[2] == "kept";
|
||||
}
|
||||
catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return false; }
|
||||
}
|
||||
|
||||
/// What Free lets go. afterBuild: what goes once the game is ready, the compiled objects of the build (objcache, which make_game.py
|
||||
/// prunes to them) and their system headers' stamp kept, so that the next update compiles only what changed (issue 1287: every
|
||||
/// update compiled all ~600 files again, an hour and more). The Free up space button lets those go too. (Triforce) Never an
|
||||
@@ -82,7 +94,8 @@ static class Storage
|
||||
static IEnumerable<string> Freeable(bool afterBuild = false, bool installing = false)
|
||||
{
|
||||
foreach (var d in afterBuild ? new[] { "sa", "exefs", "probe" } : new[] { "objcache", "sa", "exefs", "probe" })
|
||||
yield return Path.Combine(Work, d);
|
||||
if (!(afterBuild && d == "sa" && KeptTranslation(Path.Combine(Work, d))))
|
||||
yield return Path.Combine(Work, d);
|
||||
foreach (var d in installing ? new[] { "update" } : new[] { "downloads", "update" })
|
||||
yield return Path.Combine(Base, d);
|
||||
var versions = Path.Combine(Base, "versions");
|
||||
|
||||
@@ -42,6 +42,22 @@ DLSS_LICENSE = (
|
||||
)
|
||||
|
||||
|
||||
def read_only(text):
|
||||
"""((Triforce, 11-24, after Source A's) text, a tk.Text, read-only as Windows' IsReadOnly box: it selects and copies
|
||||
(Ctrl+A, Ctrl+C) but typing, paste, cut and delete leave it as it is. Returns the function that adds to its end. Its insert
|
||||
and delete are refused in Tcl, so Tk's own bindings stay. (Not -state disabled: Tk 8.5 and early 8.6 give a disabled Text
|
||||
no focus from a click off Windows, so Ctrl+C would not reach it.)"""
|
||||
w = str(text)
|
||||
text.tk.call("rename", w, w + "_rw")
|
||||
text.tk.call("proc", w, "op args", "if {$op in {insert delete replace}} return\n"
|
||||
"uplevel 1 [list {%s_rw} $op {*}$args]" % w)
|
||||
# (Tk deletes the widget's own command when the window goes: the proc goes with it)
|
||||
text.tk.call("trace", "add", "command", w + "_rw", "delete", "apply {{w args} {rename $w {}}} {%s}" % w)
|
||||
# (Ctrl+A is line start in Tk's X11 bindings: here it selects all, as in the Windows box)
|
||||
text.bind("<Control-a>", lambda e: (text.tag_add("sel", "1.0", "end"), "break")[1])
|
||||
return lambda s: text.tk.call(w + "_rw", "insert", "end", s)
|
||||
|
||||
|
||||
def ngx_sdk_dir():
|
||||
"""Where NVIDIA's DLSS SDK goes when the player ticks NVIDIA DLSS: beside the builder's versions, kept across updates."""
|
||||
return os.path.join(linux_update.data_root(), "ngx-sdk")
|
||||
@@ -985,6 +1001,7 @@ class Builder(tk.Tk):
|
||||
self.proc = subprocess.Popen(cmd, cwd=ROOT, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
text=True, bufsize=1, encoding="utf-8", errors="replace", start_new_session=True, **env_kw)
|
||||
threading.Thread(target=self.read, args=(self.proc,), daemon=True).start()
|
||||
self.tick() # ((Triforce, 11-24) the clock once the build runs: asked before it, it stopped at once
|
||||
|
||||
def read(self, proc):
|
||||
for line in proc.stdout:
|
||||
@@ -999,6 +1016,7 @@ class Builder(tk.Tk):
|
||||
self.compile_started = None
|
||||
self.times = None
|
||||
self.shaders_later = False
|
||||
self.built = self.error = None # ((Triforce, 11-24) this run's own: what make_game.py says, or Cancel)
|
||||
px = self.px
|
||||
page = self.page = ttk.Frame(self)
|
||||
page.pack(fill="both", expand=True)
|
||||
@@ -1029,6 +1047,7 @@ class Builder(tk.Tk):
|
||||
borderwidth=0, highlightthickness=0, padx=px(10), pady=px(8), insertbackground=INK,
|
||||
selectbackground=BRAND, selectforeground=WHITE)
|
||||
self.log.grid(row=0, column=0, sticky="nsew")
|
||||
self.add_log = read_only(self.log) # ((Triforce, 11-24) selects and copies, takes no typing
|
||||
scroll = ttk.Scrollbar(lines, orient="vertical", command=self.log.yview, style="Log.Vertical.TScrollbar")
|
||||
scroll.grid(row=0, column=1, sticky="ns")
|
||||
self.log.configure(yscrollcommand=scroll.set)
|
||||
@@ -1134,11 +1153,12 @@ class Builder(tk.Tk):
|
||||
elif line.startswith(make_game.NOT_PREPARED):
|
||||
self.shaders_later = True
|
||||
if hasattr(self, "log"):
|
||||
self.log.insert("end", line + "\n")
|
||||
self.add_log(line + "\n")
|
||||
self.log.see("end")
|
||||
|
||||
def on_exit(self, code):
|
||||
self.proc = None
|
||||
self.time_text.set("") # ((Triforce, 11-24) the clock and its countdown are a running build's; the line above says how it ended)
|
||||
for w in self.buttons.winfo_children():
|
||||
w.destroy()
|
||||
folder = getattr(self, "built", None)
|
||||
@@ -1166,7 +1186,7 @@ class Builder(tk.Tk):
|
||||
self.stage_label.configure(style="Go.Stage.TLabel")
|
||||
self.set_step(2)
|
||||
else:
|
||||
self.stage_text.set("The build stopped: %s" % getattr(self, "error", "see the lines above"))
|
||||
self.stage_text.set("The build stopped: %s" % (getattr(self, "error", None) or "see the lines above"))
|
||||
ttk.Button(self.buttons, text="Back", command=self.show_form, cursor="hand2").pack(side="right", padx=self.px(4))
|
||||
self.heading.configure(text="The build stopped")
|
||||
self.stage_label.configure(style="Bad.Stage.TLabel")
|
||||
|
||||
@@ -231,10 +231,25 @@ def _https(url):
|
||||
return url
|
||||
|
||||
|
||||
class _HttpsRedirects(urllib.request.HTTPRedirectHandler):
|
||||
"""((Triforce, 11-24, after Source A's) A redirect is followed only to another https link. urllib's own follows one to http:
|
||||
and ftp: too, so _https saw the first link and not where the download came from"""
|
||||
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
return super().redirect_request(req, fp, code, msg, headers, _https(newurl))
|
||||
|
||||
|
||||
_OPENER = urllib.request.build_opener(_HttpsRedirects)
|
||||
|
||||
|
||||
def _open(req, timeout):
|
||||
return _OPENER.open(req, timeout=timeout)
|
||||
|
||||
|
||||
def _request(url, timeout, limit=MAX_DOWNLOAD):
|
||||
# (no second argument: Request's second is the POST body, and a str body failed every download before connecting)
|
||||
req = urllib.request.Request(_https(url), headers={"User-Agent": "Triforce", "Accept": "application/vnd.github+json"})
|
||||
with urllib.request.urlopen(req, timeout=timeout) as response:
|
||||
with _open(req, timeout) as response:
|
||||
return _read_at_most(response, limit)
|
||||
|
||||
|
||||
@@ -254,7 +269,7 @@ def _api_download(url):
|
||||
if asset.get("name") == name:
|
||||
req = urllib.request.Request(_https(asset.get("url")), headers={
|
||||
"User-Agent": "Triforce", "Accept": "application/octet-stream"})
|
||||
with urllib.request.urlopen(req, timeout=120) as response:
|
||||
with _open(req, 120) as response:
|
||||
return _read_at_most(response, MAX_DOWNLOAD)
|
||||
return None
|
||||
|
||||
|
||||
@@ -241,6 +241,16 @@ def _kept_version(d):
|
||||
return bool(cur) and _same(cur, d)
|
||||
|
||||
|
||||
def kept_translation(sa):
|
||||
"""(Triforce) make_game.py keep_translation left the lift's small files in sa (its .lift_key marked "kept"): the next update with
|
||||
the same tools skips the lift with them. Not let go after a build (Free up space still lets them go)"""
|
||||
try:
|
||||
with open(os.path.join(sa, "gen", ".lift_key"), encoding="utf-8") as f:
|
||||
return f.read().split()[2:3] == ["kept"]
|
||||
except (OSError, UnicodeDecodeError):
|
||||
return False
|
||||
|
||||
|
||||
def freeable(after_build=False, installing=False):
|
||||
"""What free lets go (measure counts it; nothing is changed here). (Triforce) Never an unfinished version that still holds
|
||||
folders of the installed one (setup_parts.lent: its reused.txt): deleted, the installed version lost its Python or its
|
||||
@@ -248,7 +258,8 @@ def freeable(after_build=False, installing=False):
|
||||
(downloads\\, versions\\) stays"""
|
||||
from . import setup_parts
|
||||
for d in (("sa", "exefs", "probe") if after_build else ("objcache", "sa", "exefs", "probe")):
|
||||
yield os.path.join(work(), d)
|
||||
if not (after_build and d == "sa" and kept_translation(os.path.join(work(), d))):
|
||||
yield os.path.join(work(), d)
|
||||
for d in ("update",) if installing else ("downloads", "update"):
|
||||
yield os.path.join(paths.base(), d)
|
||||
v = paths.versions()
|
||||
|
||||
Reference in New Issue
Block a user