Triforce v0.8.5

A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-28 10:54:41 -06:00
parent 2df08c751e
commit b527e29adb
203 changed files with 18821 additions and 2051 deletions

View File

@@ -52,7 +52,26 @@ constexpr Palette kGamePalette = {
rgba(124, 93, 49, 255), rgba(84, 64, 38), rgba(44, 36, 26, 244), rgba(150, 122, 78, 255), rgba(118, 94, 58, 255),
rgba(255, 251, 238), rgba(40, 28, 14), rgba(60, 42, 22, 235), rgba(52, 38, 22, 250), rgba(122, 98, 64, 220),
rgba(10, 8, 5, 200), rgba(150, 120, 40), rgba(24, 21, 14, 255), rgba(211, 144, 37, 255), rgba(255, 254, 228),
rgba(255, 255, 255), rgba(150, 185, 255), rgba(75, 57, 34), rgba(28, 13, 13), 0};
rgba(255, 255, 255), rgba(163, 184, 255), rgba(75, 57, 34), rgba(28, 13, 13), 0};
// ((Triforce, 11-26) the cursors' glows as the game's (the lab's SDR shots, fitted: ui083_cursor_fit): the Options rows'
// 163,184,255 at 0.80 (it was 150,185,255 at 0.5 to 0.85, breathing over 2 s), the System list's buttons' bluer, at 0.72.
// The game's breathes little, over its CursorLoop's 40 frames (vk_menu.cpp ui_ctx's pulse): 0.76 to 0.84, 0.68 to 0.76
constexpr ImU32 kCmnCursorGlow = rgba(125, 161, 255);
constexpr float kCursorGlowBase = 0.76f, kCmnCursorGlowBase = 0.68f, kCursorGlowBreath = 0.08f;
// ((Triforce, 11-26) The glows with HDR on (glow_layers). The game blends its cursor's glow into its picture as sRGB codes
// and RenoDX then codes the picture for HDR10: the lab's HDR shot of the game's System list is its SDR shot coded so, pixel
// for pixel. Our overlay blends on HDR10's PQ codes (vk_imgui.cpp hdr10), where the same glow came out narrow and grey: the
// owner's "whiter compared to the vanilla's bluer white outline" (at 5 pixels out the game's 25,54,133 over its background,
// ours 43,61,90). A faint glow moves a PQ code about a third as far as it moves an sRGB code, and no one strength makes up
// for that both near the line and far out. So with HDR on each glow is drawn twice, each layer its own colour and strength,
// fitted to the game's glow as RenoDX codes it over the menus' browns (labbuild ui083_hdr_glow_layers.py): within 5 of 1023
// codes of it at 200 nits in Display P3, 5 to 7 at 100 to 400 nits and in BT.709; drawn once as in SDR, 22 to 34 off
struct GlowLayer {
ImU32 col;
float a; // (its strength at the breath's middle)
};
constexpr GlowLayer kCursorGlowHdr[2] = {{rgba(144, 174, 255), 0.698f}, {rgba(143, 159, 255), 0.690f}};
constexpr GlowLayer kCmnCursorGlowHdr[2] = {{rgba(85, 116, 255), 0.627f}, {rgba(110, 159, 254), 0.622f}};
inline ImU32 kInk = kGamePalette.ink, kInkBright = kGamePalette.ink_bright, kSoft = kGamePalette.soft, kDim = kGamePalette.dim,
kGold = kGamePalette.gold, kGoldHi = kGamePalette.gold_hi, kGoldInk = kGamePalette.gold_ink, kAccent = kGamePalette.accent,
kEdge = kGamePalette.edge, kCellDark = kGamePalette.cell_dark, kCellName = kGamePalette.cell_name,
@@ -90,6 +109,7 @@ struct Ctx {
const char* clear_icon = nullptr;
const char* clear_name = "X";
float pulse = 1; // (the cursor's glow now, 0 to 1: the game's breathes)
bool hdr10 = false; // ((Triforce, 11-26) the overlay is blended on HDR10's PQ codes (vk_imgui.cpp hdr10): glow_layers' look
bool over_game = false; // (Triforce: drawn over the game's own Options screen: the guides' band hides the game's guides)
// ((Triforce, 11-20) over_game: where the game's guides band ends at the right, in these pixels (game_grid.h
// guide_band_x1): past w on a picture wider than the grid; w or less, the plate ends at w as before)
@@ -99,6 +119,11 @@ struct Ctx {
const char* key_tab_l = "Q";
const char* key_tab_r = "E";
const char* key_back = "Esc";
// ((Triforce, 11-26) the options' Apply, kApply: the key bound to the Switch's X (Space unless rebound), and on a
// controller the icon of the Switch button bound to its face button, or its name without one, as Clear's
const char* key_apply = "Space";
const char* apply_icon = nullptr;
const char* apply_name = "Y";
};
/// A place of the game's layout (units from the screen's centre, y up) in pixels
@@ -289,6 +314,18 @@ inline void value_plate(Ctx& c, ImVec2 a, ImVec2 b, bool on = false, float k = 1
else if (const Art* g = skin("OptionBtnThinElement_00")) nine(c, g, a - m, b + m, 200, 28, alpha(on ? kValueOn : kValue, k));
else c.d->AddRectFilled(a, b, alpha(on ? kValueOn : kValue, k), lu(c, 4));
}
/// ((Triforce, 11-26) A cursor's glow texture t over a..b (nine's): once, col at base and breathing, with SDR; its two layers
/// hdr with HDR on (c.hdr10: kCursorGlowHdr's note), breathing as much. k: how much of the cursor shows
inline void glow_layers(Ctx& c, const Art* t, ImVec2 a, ImVec2 b, float bx, float by, ImU32 col, float base,
const GlowLayer (&hdr)[2], float k) {
const float s = base + kCursorGlowBreath * c.pulse;
if (!c.hdr10) {
nine(c, t, a, b, bx, by, alpha(col, s * k));
return;
}
const float r = s / (base + kCursorGlowBreath * 0.5f) * k;
for (const GlowLayer& l : hdr) nine(c, t, a, b, bx, by, alpha(l.col, l.a * r));
}
/// The cursor: the game's white hand-drawn frame, its inner edge on a..b, and its blue-white glow outside, which breathes
/// (vk_game_tex.h make_cursor, from OptionBtnThinCursorLine and OptionBtnThinCursorGlow: the layout draws the 640 x 173
/// texture 960 x 260 units, the line's inner edge then a box of 809 x 114). (Triforce) k: how much of it shows, as the
@@ -298,7 +335,7 @@ inline void cursor(Ctx& c, ImVec2 a, ImVec2 b, float k = 1) {
const Art *line = skin("cursor_line"), *glow = skin("cursor_glow");
const ImVec2 m(lu(c, 75.5f), lu(c, 73));
if (line && glow) {
nine(c, glow, a - m, b + m, 150, 80, alpha(kCursorGlow, (0.50f + 0.35f * c.pulse) * k));
glow_layers(c, glow, a - m, b + m, 150, 80, kCursorGlow, kCursorGlowBase, kCursorGlowHdr, k);
nine(c, line, a - m, b + m, 150, 80, alpha(kCursor, k));
return;
}
@@ -310,6 +347,21 @@ inline void cursor(Ctx& c, ImVec2 a, ImVec2 b, float k = 1) {
}
/// (the old name: the selection's outline)
inline void glow(Ctx& c, ImVec2 a0, ImVec2 b0) { cursor(c, a0, b0); }
/// ((Triforce, 11-26) A button's cursor as the game's System list draws its own (PaCommonBtnThin_00: CmnBtnCursorLine_00 and
/// _Glow_00, vk_game_tex.h cmn_cursor_*): its line's inner edge on the plate's edge a..b, the line outside it (the lab's SDR
/// shots: the game's 7 pixels at 1440 lines from the plate's edge outwards; ours sat 4 pixels further in, over the plate's
/// rim), its glow the bluer one. Without those textures the Options rows' cursor, where it was
inline void cmn_cursor(Ctx& c, ImVec2 a, ImVec2 b, float k = 1) {
if (k <= 0) return;
const Art *line = skin("cmn_cursor_line"), *glow = skin("cmn_cursor_glow");
if (!line || !glow) {
cursor(c, a + ImVec2(lu(c, 8), lu(c, 8)), b - ImVec2(lu(c, 8), lu(c, 8)), k);
return;
}
const ImVec2 m(lu(c, 68.25f), lu(c, 72)); // (the line's inner edge 45.5 and 48 texels in from the texture's edges)
glow_layers(c, glow, a - m, b + m, 140, 90, kCmnCursorGlow, kCmnCursorGlowBase, kCmnCursorGlowHdr, k);
nine(c, line, a - m, b + m, 140, 90, alpha(kCursor, k));
}
/// The game's arrow at m, pointing left or right: on its Options screen a plain white triangle, 18 x 22 units
inline void arrow(Ctx& c, ImVec2 m, bool right, ImU32 col = kInk) { triangle(c, m, lu(c, 28), right ? 1 : 0, col); } // (28: its anti-aliased rim counted)
/// The game's separator across x0..x1 at y: its mark in the middle, a fine line to either side (PaSlideListSeparator: P_DecoMark_00,
@@ -355,7 +407,8 @@ inline void heading(Ctx& c, ImVec2 a, ImVec2 b, float name_x, const char* title)
}
// ---- the button prompts: the game's own icons (its External font), or the keys' caps ----
enum Glyph { kUpDown, kLeftRight, kTabs, kConfirm, kBack, kKey, kClear }; // ((Triforce) kClear: Del, or Ctx's clear_* on a pad)
// ((Triforce) kClear: Del, or Ctx's clear_* on a pad; (11-26) kApply: the options' Apply, Ctx's key_apply and apply_*)
enum Glyph { kUpDown, kLeftRight, kTabs, kConfirm, kBack, kKey, kClear, kApply };
struct Prompt {
Glyph g;
const char* what;
@@ -379,6 +432,8 @@ inline float glyph(Ctx& c, float my, float x, const Prompt& pr, bool draw) {
if (pr.g == kKey) return key(x, pr.key);
if (pr.g == kClear && !c.pad) return key(x, "Del");
if (pr.g == kClear && (!c.f.glyph || !c.clear_icon)) return key(x, c.clear_name);
if (pr.g == kApply && !c.pad) return key(x, c.key_apply); // ((Triforce, 11-26))
if (pr.g == kApply && (!c.f.glyph || !c.apply_icon)) return key(x, c.apply_name);
if (!c.pad || !c.f.glyph) {
if (c.pad) { // (a controller, and no icon font: the buttons by name)
switch (pr.g) {
@@ -434,17 +489,21 @@ inline float glyph(Ctx& c, float my, float x, const Prompt& pr, bool draw) {
}
case kConfirm: return icon(x, kIconA);
case kClear: return icon(x, c.clear_icon);
case kApply: return icon(x, c.apply_icon);
default: return icon(x, kIconB);
}
}
/// The prompts from x on, the label before its icon as the game's own (PaGuideKey: the label 48 units): their width (draw
/// false: measured only)
inline float prompts(Ctx& c, float x, float my, const Prompt* list, int n, bool draw) {
inline float prompts(Ctx& c, float x, float my, const Prompt* list, int n, bool draw, float* spans = nullptr) {
const float px = lu(c, 48 * kType), x0 = x, gap = lu(c, 20), between = lu(c, 76);
for (int i = 0; i < n; i++) {
if (spans) spans[2 * i] = x; // ((Triforce, 11-26) where each prompt is, its label to its icon: for the mouse)
if (draw) text_mid(c, c.f.body, px, x, my, kInk, list[i].what);
x += size_of(c.f.body, px, list[i].what).x + gap;
x += glyph(c, my, x, list[i], draw) + between;
x += glyph(c, my, x, list[i], draw);
if (spans) spans[2 * i + 1] = x;
x += between;
}
return n ? x - x0 - between : 0;
}
@@ -452,9 +511,11 @@ inline float prompts(Ctx& c, float x, float my, const Prompt* list, int n, bool
inline float prompt_bar_top(const Ctx& c) { return at(c, 0, -1080 + 160).y; }
/// The prompts at the bottom right, as the System screens' guides: the dark band fading to the left (SystemGuideBase), the
/// labels and icons ending 80 units from the right edge, their middle 62 units up; its top (prompt_bar_top). Prompts wider
/// than the window take smaller ones
inline float prompt_bar(Ctx& c, const Prompt* list, int n) {
const float my = at(c, 0, -1018).y, right = at(c, 1840, 0).x;
/// than the window take smaller ones. ((Triforce, 11-26) spans: each prompt's left and right, 2 n of them, for the mouse)
inline float prompt_bar(Ctx& c, const Prompt* list, int n, float* spans = nullptr) {
// ((Triforce, 11-25) a window narrower than 16:9 is the whole column, and the grid's right edge is past it: the prompts
// end 80 units inside the window then, as on 16:9 (at 5:4 the last ones were off the screen))
const float my = at(c, 0, -1018).y, right = std::min(at(c, 1840, 0).x, c.w - lu(c, 80));
Ctx k = c;
const float room = c.w - lu(c, 160), full = prompts(c, 0, my, list, n, false);
if (full > room) k.s = c.s * room / full;
@@ -475,7 +536,7 @@ inline float prompt_bar(Ctx& c, const Prompt* list, int n) {
c.d->AddRectFilledMultiColor(ImVec2(band0, top), ImVec2(c.w, c.h), alpha(kBar, 0), kBar, kBar, alpha(kBar, 0));
if (x1 > c.w) c.d->AddRectFilled(ImVec2(c.w, top), ImVec2(x1, c.h), kBar);
}
prompts(k, right - pw, my, list, n, true);
prompts(k, right - pw, my, list, n, true, spans);
return top;
}
/// The System screens' header across the top (SystemHeader_00: 200 units high, the picture's ragged lower edge and the
@@ -554,7 +615,7 @@ inline void box(Ctx& c, ImVec2 a, ImVec2 b, float opacity = 1) {
inline void button(Ctx& c, ImVec2 a0, ImVec2 b0, const char* label, float focus) {
plate(c, a0, b0, false, true);
text_mid_centre(c, c.f.body, lu(c, 54 * kType), (a0.x + b0.x) * 0.5f, (a0.y + b0.y) * 0.5f - lu(c, 2), kInk, label);
if (focus > 0) cursor(c, a0 + ImVec2(lu(c, 8), lu(c, 8)), b0 - ImVec2(lu(c, 8), lu(c, 8)), focus); // (the line on the plate's edge, as the game's)
if (focus > 0) cmn_cursor(c, a0, b0, focus); // ((Triforce, 11-26) the game's System list's own cursor, outside the plate's edge)
}
inline void button(Ctx& c, ImVec2 a0, ImVec2 b0, const char* label, bool sel) { button(c, a0, b0, label, sel ? 1.0f : 0.0f); }