mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-20 16:49:57 -04:00
Triforce v0.5.2
The new launcher (Windows and Linux: the game's own look, music and settings, saves and mods pages, smaller updates in parts), benchmark mode (Find my best settings: the game tours four places by itself and writes its results), Quit and Restart in the pause menu under Mods, Squadala! in the Mods menu, battle music above 60 fps, menu text, the controller in the menus with the game in the background, the whole GameBanana list, RX 580 and RX 5000/6000 shader fixes, the pipeline cache kept through an update, async present black flashes, and faster builds.
This commit is contained in:
@@ -431,6 +431,25 @@ RECORD_OLD = " c->x[8]=recomp_fp_to_int(c->vreg[0][0]&UINT64_C(0xffffffff),32
|
||||
RECORD_NEW = (" c->x[8]=hos_oot_record_frames((uint32_t)c->vreg[0][0]);"
|
||||
" /* (nx2/oot_patches.py: the ocarina recorder's clock above 60 fps) */\n")
|
||||
RECORD_DECL = "extern uint32_t hos_oot_record_frames(uint32_t step_bits);\n"
|
||||
# ((Triforce, 11-18) #bug-tracker "Enemy Music not clearing in dungeon": above 60 fps the battle music kept playing after the last
|
||||
# enemy was gone; at a cap of 60 it ended. Two places in Link's update f_804caa80 (x19 Link) take the time since one he keeps
|
||||
# (the float [[x19+144]] less s0) times a constant of the game's (page +2952), cut to whole frames into x8, then step a small
|
||||
# state of his by that count (against 8 and 4). Above 60 fps the time is under a frame every update, cut to 0, and the state
|
||||
# never moved on, so the music that waits on it never ended. Found in the lab (a probe over every cut in the 40 functions that
|
||||
# load the frame step: with all of them carried, then with these two alone, the music ended at 240 fps). A positive amount goes
|
||||
# through hos_frame_whole (host/frame_whole.h: its fraction carried while the frames' own time is the step, the game's cut at a
|
||||
# cap of 60), one remainder per place (the keys are ids, not fields: Link + 145 and + 147); a negative one keeps the game's cut.
|
||||
# Each place is found by its own page constant, then the constant's load and the cut (a hot lift's multiply is
|
||||
# a64_fpx_hot_*: any lines between).
|
||||
BATTLE_HEAD = "void f_804caa80(Ctx *__restrict A64_NOESC c) {\n"
|
||||
BATTLE_CUT = " c->x[8]=recomp_fp_to_int(c->vreg[0][0]&UINT64_C(0xffffffff),32,32,1,3,c->fpcr,&c->fpsr);\n"
|
||||
BATTLE_SITES = ((" c->x[8]=g_module_base + 0x804cb000ULL + (int64_t)60379136;\n", "c->x[19] + 145"),
|
||||
(" c->x[8]=g_module_base + 0x804cd000ULL + (int64_t)60370944;\n", "c->x[19] + 147"))
|
||||
BATTLE_LOAD = " { { uint64_t _v=recomp_load32(c,(c->x[8]+2952ULL)); a64_vset64(c->vreg[1],_v); } }\n"
|
||||
BATTLE_MARK = "/* (nx2/oot_patches.py: Link's state steps above 60 fps, the battle music's end) */"
|
||||
BATTLE_NEW = (" { const uint64_t _g=recomp_fp_to_int(c->vreg[0][0]&UINT64_C(0xffffffff),32,32,1,3,c->fpcr,&c->fpsr);"
|
||||
" c->x[8]=((int32_t)(uint32_t)c->vreg[0][0] > 0) ? hos_frame_whole(%s, (uint32_t)c->vreg[0][0]) : _g; } "
|
||||
+ BATTLE_MARK + "\n")
|
||||
|
||||
|
||||
def _function(s, head_text):
|
||||
@@ -540,6 +559,34 @@ def patch_record_clock(s):
|
||||
return s, done
|
||||
|
||||
|
||||
def patch_battle_steps(s):
|
||||
"""Link's two state steps of BATTLE_SITES with hos_frame_whole's whole frames: (s, how many are in s with it, made now or
|
||||
before). A place not found exactly once (another game version, or a lift with other code there) is left as it is."""
|
||||
at = _function(s, BATTLE_HEAD)
|
||||
if at is None:
|
||||
return s, 0
|
||||
head, end = at
|
||||
body = s[head:end]
|
||||
done = 0
|
||||
for anchor, key in BATTLE_SITES:
|
||||
new = BATTLE_NEW % key
|
||||
if new in body:
|
||||
done += 1
|
||||
continue
|
||||
found = [m for m in re.finditer(re.escape(anchor) + r"(?:[^\n]*\n){0,6}?" + re.escape(BATTLE_LOAD)
|
||||
+ r"(?:[^\n]*\n){0,4}?" + re.escape(BATTLE_CUT), body)]
|
||||
if len(found) != 1:
|
||||
continue
|
||||
m = found[0]
|
||||
cut_at = m.end() - len(BATTLE_CUT)
|
||||
body = body[:cut_at] + new + body[m.end():]
|
||||
done += 1
|
||||
s = s[:head] + body + s[end:]
|
||||
if done and WHOLE_DECL not in s:
|
||||
s = s.replace('#include "a64.h"\n', '#include "a64.h"\n' + WHOLE_DECL, 1)
|
||||
return s, done
|
||||
|
||||
|
||||
# The sprint button (host/oot_sprint.h has the rules, host/oot_sprint.c the game's addresses; after NX2navi's set "sprint").
|
||||
# Link sprints while his input flags hold the dash input (bit 4), which the game sets only out of a roll. Two functions load
|
||||
# those flags and test the bit: his movement update f_804caa80 (to start the sprint and to keep it), and the update of his
|
||||
@@ -752,6 +799,7 @@ def apply(gen, *, protect_hearts=False, required=False):
|
||||
whole_sites = 0 # (the counters of WHOLE_SITES with the whole frames: patch_whole_frames)
|
||||
sound_jobs = solver_sites = 0 # (patch_sound_job, patch_solver_steps: the places found with their hooks)
|
||||
floor_sites = sim_sites = record_sites = 0 # (patch_floor_carry, patch_sim_steps, patch_record_clock: the same)
|
||||
battle_sites = 0 # (patch_battle_steps: Link's two state steps)
|
||||
sprint_sites = 0 # (patch_sprint: its two calls)
|
||||
zstd_sites = 0 # (patch_host_zstd: its two calls, the supported build's alone)
|
||||
mod_size_sites = 0 # ((Triforce) patch_mod_sizes: its one call, the supported build's alone)
|
||||
@@ -862,6 +910,11 @@ def apply(gen, *, protect_hearts=False, required=False):
|
||||
if record != out:
|
||||
print("oot_patches: the ocarina recorder's clock above 60 fps in", os.path.basename(path))
|
||||
out = record
|
||||
battle, found = patch_battle_steps(out)
|
||||
battle_sites += found
|
||||
if battle != out:
|
||||
print("oot_patches: Link's state steps above 60 fps (the battle music's end) in", os.path.basename(path))
|
||||
out = battle
|
||||
sprinted, found = patch_sprint(out)
|
||||
sprint_sites += found
|
||||
if sprinted != out:
|
||||
@@ -891,6 +944,8 @@ def apply(gen, *, protect_hearts=False, required=False):
|
||||
if record_sites != sum(n for _, n in RECORD_SITES): # (without them, above 60 fps a recorded song loses its rests)
|
||||
print("oot_patches: WARNING: the ocarina recorder's clock was found at %d of %d places"
|
||||
% (record_sites, sum(n for _, n in RECORD_SITES)))
|
||||
if battle_sites != len(BATTLE_SITES): # (without them, above 60 fps the battle music keeps playing after the last enemy)
|
||||
print("oot_patches: WARNING: Link's state steps were found at %d of %d places" % (battle_sites, len(BATTLE_SITES)))
|
||||
if sprint_sites != 2: # (without them the Sprint button row does nothing)
|
||||
print("oot_patches: WARNING: the sprint button's calls were found at %d of 2 places" % sprint_sites)
|
||||
if protect_hearts and mod_size_sites != 1: # (without it a mod's bigger model can crash the game: host/mods.c)
|
||||
|
||||
Reference in New Issue
Block a user