Triforce v0.9.0

Character tab, faster renderer defaults, HD rumble shipped, and the 11-30 bug pass: ending softlock below 60 fps, adult first-night lock, Intel Arc robust buffers, adult map, randomizer load order.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-30 20:55:14 -06:00
parent 8cb23131f9
commit 822ee913bc
86 changed files with 8128 additions and 438 deletions

View File

@@ -20,9 +20,16 @@ This compiles title_tabs.h alone (with game_grid.h) and checks where the tabs la
- the point test: each label's and each icon's middle is its tab, the gap between them and the picture's middle none; with
the save files off there is the one tab, Mods.
And the sources: the tabs are drawn with the game's own icons of what the Switch's X (Mods: the top face button, Y on an Xbox
pad, Triangle on a PlayStation one) and Y (Save Select: the left one, X and Square) are bound to; the pad's own buttons, a
click, or the host's words 6 and 7 (a test's scripted X and Y) choose them; the entry under the title's list is Quit Game.
And the sources: the tabs' prompts name the pad input the Switch's X (Mods: the top face button, Y on an Xbox pad, Triangle
on a PlayStation one) and Y (Save Select: the left one, X and Square) are bound to, as the button test reads it; the pad's
own buttons, a click, or the host's words 6 and 7 (a test's scripted X and Y) choose them; the entry under the title's list
is Quit Game.
((Triforce, 11-30) two players on an Xbox and a PlayStation controller: "The X is supposed to open up the Mod Menu but instead
it is opening up the save selection". The prompt was the Switch button's own code, right only in a font pointed at this run's
controls: in the game's own font, or on a cap without one, the Switch's letter, the other button's name on those pads. Now
the icon of the bound input itself on the face shown (title_tabs.h icon_codes, the font's codes as host/prompts.c and
nx2/prompt_assets.py number them), or that input's name: checked for every face and the layout presets.)
python -I -B tests/test_title_tabs.py [--cxx clang++]
"""
@@ -57,6 +64,7 @@ PROGRAM = r"""
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include "title_tabs.h"
using namespace mkwvk;
static int fails;
@@ -121,7 +129,42 @@ static void one(const Case& c) {
unit, m.kx, m.x(l.tab[0].x0), m.x(l.tab[0].x1), m.x(l.tab[1].x0), m.x(l.tab[1].x1), m.y(l.tab[1].y1), px0, py0);
}
// ((Triforce, 11-30) the prompts: each tab's the icon of the pad input its button is bound to, on the face shown. The faces and
// the inputs as gpu/vk/vk_api.h numbers them (HOS_PROMPT_SWITCH .. HOS_PROMPT_STEAMDECK the controllers'; HOS_PAD_SOUTH,
// EAST, WEST, NORTH first), and the layout presets as vk_menu.cpp apply_pad_layout binds the Switch's X and Y
static void prompts_check() {
const char* name = "prompts";
enum { SOUTH, EAST, WEST, NORTH, PADS = 17, FACES = 5, KEYBOARD = 5 };
struct Preset { const char* name; int x, y; } presets[] = {{"Nintendo (Def)", NORTH, WEST}, {"Xbox / PC", WEST, NORTH}, {"Swap Face", NORTH, WEST}};
for (const Preset& p : presets)
for (int face = 0; face < FACES; face++) {
unsigned mods[2], saves[2];
title_tabs::icon_codes(face, p.x, FACES, PADS, mods);
title_tabs::icon_codes(face, p.y, FACES, PADS, saves);
// (the icon is the face's own of the very input menu_tick opens the tab with, never the Switch's X or Y code)
CHECK(mods[0] == 0xF800u + 32u * (unsigned)face + (unsigned)p.x && saves[0] == 0xF800u + 32u * (unsigned)face + (unsigned)p.y);
CHECK(mods[1] == 0xF700u + (unsigned)p.x && saves[1] == 0xF700u + (unsigned)p.y);
CHECK(mods[0] != saves[0] && mods[0] != 0xE042u && saves[0] != 0xE043u);
}
// (the default controls on an Xbox pad: Mods the Y button's icon (the top one); on a PlayStation 5 one Save Select
// Square's (the left one), as the owner asked)
unsigned c[2];
title_tabs::icon_codes(1, NORTH, FACES, PADS, c);
CHECK(c[0] == 0xF800u + 32u + 3u);
title_tabs::icon_codes(3, WEST, FACES, PADS, c);
CHECK(c[0] == 0xF800u + 96u + 2u);
// (no face known, the keys' face, an unbound button, a paddle past the inputs with icons: no code, the input's name instead)
for (int face : {-1, (int)KEYBOARD, 9}) { title_tabs::icon_codes(face, NORTH, FACES, PADS, c); CHECK(c[0] == 0 && c[1] == 0); }
for (int input : {-1, (int)PADS, 21}) { title_tabs::icon_codes(1, input, FACES, PADS, c); CHECK(c[0] == 0 && c[1] == 0); }
// (UTF-8, as ImGui reads it)
char u[4];
CHECK(std::string(title_tabs::utf8(0xF823, u)) == "\xEF\xA0\xA3" && std::string(title_tabs::utf8(0xE042, u)) == "\xEE\x81\x82");
CHECK(std::string(title_tabs::utf8('X', u)) == "X" && std::string(title_tabs::utf8(0xE9, u)) == "\xC3\xA9");
CHECK(!title_tabs::utf8(0, u)[0] && !title_tabs::utf8(0x1F600, u)[0]);
}
int main() {
prompts_check();
static const Case cases[] = {
{"16:9 1920x1080", 1920, 1080, 1920, 1080, 0},
{"16:9 1280x720", 1280, 720, 1280, 720, 0},
@@ -168,11 +211,36 @@ def main():
and "const game_grid::Map m = game_grid::map_of(title_grid);" in tabs,
"the tabs are not placed from the picture's top left corner on the game's grid")
check('static const char* const labels[title_tabs::kTabs] = {"Mods", "Save Select"};' in tabs
and "static const char* const icons[title_tabs::kTabs] = {ui::kIconX, ui::kIconY};" in tabs,
and "static const int buttons[title_tabs::kTabs] = {HOS_SW_X, HOS_SW_Y};" in tabs,
"Mods is not the Switch's X (the top face button) and Save Select its Y (the left one)")
check("const bool pad = game_prompts_pad();" in tabs and "if (!pad || show <= 0) continue;" in tabs
check("const bool pad = game_prompts_pad();" in tabs and "if (!pad || !bound[i] || show <= 0) continue;" in tabs
and "c.d->AddText(c.f.glyph, ipx, at, ui::alpha(ui::kInk, show), icons[i]);" in tabs,
"the prompts under the tabs are not the game's icons, shown with a controller and fading with the list")
# ((Triforce, 11-30) the prompt is the bound input's own, as the button test reads it: its icon on the face shown, else its
# name; never the Switch button's own code (U+E042, U+E043: the Switch's letter in the game's own font) nor its letter)
check("const int input = host && host->binding ? host->binding(HOS_BIND_PAD, buttons[i], 0) : -1;" in tabs
and "bound[i] = hos_pad_bindable(input);" in tabs
and "title_tabs::icon_codes(face, input, HOS_PROMPT_KEYBOARD, HOS_PAD_N, codes);" in tabs
and "c.f.glyph->IsGlyphInFont((ImWchar)code)) title_tabs::utf8(code, icons[i]);" in tabs
and "names[i] = pad_name(input);" in tabs
and "const int face = host && host->prompt_face ? host->prompt_face() : -1;" in tabs,
"a tab's prompt is not the icon (or the name) of the pad input its button is bound to")
check("kIconX" not in tabs and "kIconY" not in tabs and '{"X", "Y"}' not in tabs,
"a tab's prompt is still the Switch button's own icon or letter: the other button's on an Xbox or PlayStation pad")
check('const ui::Prompt p{ui::kKey, "", names[i]};' in tabs and "if (icons[i][0]) {" in tabs,
"without the input's icon in the font the prompt is not its name on a key's cap")
# (the codes as the host and the font builder number them)
prompts = (ROOT / "host" / "prompts.c").read_text(encoding="utf-8")
assets = (ROOT / "nx2" / "prompt_assets.py").read_text(encoding="utf-8")
check("#define FACE_BASE 0xF800" in prompts and "#define FACE_CODES 32" in prompts and "#define PAD_BASE 0xF700" in prompts
and "#define LIVE_FACES HOS_PROMPT_KEYBOARD" in prompts
and "\nFACE_BASE = 0xF800" in assets and "\nFACE_CODES = 32" in assets and "\nPAD_BASE = 0xF700" in assets
and "constexpr unsigned kPadBase = 0xF700;" in header and "constexpr unsigned kFaceBase = 0xF800, kFaceCodes = 32;" in header,
"title_tabs.h's icon codes are not host/prompts.c's and nx2/prompt_assets.py's")
check('PADS = ["south", "east", "west", "north",' in assets, "the font's pad inputs are not in HOS_PAD_* order")
check(all(l in menu for l in ("host->bind(HOS_BIND_PAD, HOS_SW_X, 0, HOS_PAD_NORTH);", "host->bind(HOS_BIND_PAD, HOS_SW_X, 0, HOS_PAD_WEST);",
"host->bind(HOS_BIND_PAD, HOS_SW_Y, 0, HOS_PAD_WEST);", "host->bind(HOS_BIND_PAD, HOS_SW_Y, 0, HOS_PAD_NORTH);")),
"the layout presets the prompts are checked with are not apply_pad_layout's")
check("title_tab_layout = l, title_tab_map = m, title_tab_ns = prof_now();" in tabs, "where the tabs were drawn is not kept for the mouse")
# ((Triforce) the lab's first run: on the owner's 21:9 picture the corner is left of the column, and nothing was drawn)
check(tabs.index("title_tabs::picture_clip(title_grid, m,") < tabs.index("c.d->PushClipRect(ImVec2(clip[0], clip[1]), ImVec2(clip[2], clip[3]), false);")