PlayStation glyphs: --mono, a look close to the PS5's prompts; the DualSense d-pad; no box behind a glyph

- `--mono` draws white keys and discs with black symbols, as the PS5's own button prompts look.
- In that look the d-pad is the DualSense's: four separate arrow keys pointing at the middle,
  the pressed ones white and the rest grey (all white for the plain d-pad and for all four).
- Mono sprites have no see-through bounding box behind them: when a menu highlights an option,
  the title's colour change showed that box as a black halo around the glyph.
- tests: no box behind any glyph in the mono look, the d-pad's key colours, the mono movie builds.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Yusei García
2026-11-29 18:32:16 -06:00
parent b8bd371116
commit 4ae05e76c0
3 changed files with 97 additions and 1 deletions

View File

@ -183,6 +183,10 @@ contents is not touched or needed.
kept as it is, so the title's code finds the symbols as before. The output holds those tags of the game's movie: keep it
on your PC, never commit it. `--pad-inflated 28148 --out ps_prompt_glyphs.gfx` builds the standalone movie
(with its own ActionScript block, which has never run in the title) padded to the same length.
`--mono` draws the PlayStation glyphs in a look close to the PS5's own prompts: white keys and discs with black
symbols, and the d-pad as the DualSense's four separate arrow keys pointing at the middle (the pressed ones white,
the rest grey). Its sprites have no see-through box behind them: a highlight's colour change showed that box as a
black halo.
- **Checking it.** Run with `LEONIDA_PROMPTS=playstation` (or `keyboard`) and look in the log for
`prompt glyphs: PlayStation movie loaded` (or `keyboard movie loaded`) and `prompt glyphs: the title reads its glyph
movie`, which names the family and the glyphs served. If the second line never appears, the title does not read the

View File

@ -205,5 +205,48 @@ class OverAMovie(unittest.TestCase):
self.assertEqual(sorted(g.exports_of(tags_).values()), N)
class MonoLook(unittest.TestCase):
"""--mono: the PS5-like look (white keys, black symbols, the DualSense d-pad)."""
def setUp(self):
import importlib
self.m = importlib.import_module("ps_prompt_glyphs")
self.saved = {k: getattr(self.m, k) for k in ("PANEL", "RIM", "INK", "GREY", "LIT", "BLUE", "RED", "PINK", "GREEN", "MONO")}
self.m.mono()
def tearDown(self):
for k, v in self.saved.items():
setattr(self.m, k, v)
def colours(self, n):
movie = self.m.Movie()
glyph = self.m.build_sprite(movie, n)
by_id = {sid: body for sid, body in movie.shapes.values()}
out = []
for cid, _, _ in glyph.items:
body = by_id[cid]
nb = body[2] >> 3
off = 2 + (5 + 4 * nb + 7) // 8
self.assertEqual(body[off], 1, "one fill style")
out.append(tuple(body[off + 2:off + 6]))
return out
def test_no_see_through_box_behind_a_glyph(self):
for n in N:
self.assertNotIn((0, 0, 0, 0), self.colours(n), n)
def test_the_dpad_is_four_keys_the_pressed_ones_white(self):
white, grey = (255, 255, 255, 255), self.m.DIM
self.assertEqual(self.colours(4), [white, grey, grey, grey]) # up
self.assertEqual(self.colours(7), [grey, grey, grey, white]) # right
self.assertEqual(self.colours(10), [white, white, grey, grey]) # up/down
self.assertEqual(self.colours(8), [white] * 4) # idle
self.assertEqual(self.colours(9), [white] * 4) # all
def test_the_mono_movie_builds(self):
data = self.m.build()
self.assertEqual(data[:3], b"GFX")
if __name__ == "__main__":
unittest.main()

View File

@ -385,7 +385,42 @@ def tri(g, cx, cy, w, h, direction, color):
g.poly(pts, color)
MONO = False
def draw_dpad_mono(g, lit):
"""The mono look: a solid white cross, the pressed arms marked by black arrows pointing out."""
arm = 24.0
lo, hi = 32 - arm / 2, 32 + arm / 2
g.poly([(lo, 0), (hi, 0), (hi, lo), (64, lo), (64, hi), (hi, hi), (hi, 64), (lo, 64), (lo, hi), (0, hi),
(0, lo), (lo, lo)], RIM)
arms = {"up": ["up"], "down": ["down"], "left": ["left"], "right": ["right"], "idle": [],
"all": ["up", "down", "left", "right"], "updown": ["up", "down"], "leftright": ["left", "right"]}[lit]
at = {"up": (32, 11), "down": (32, 53), "left": (11, 32), "right": (53, 32)}
for d in arms:
tri(g, at[d][0], at[d][1], 14, 10, d, INK)
DIM = (103, 103, 103, 255) # the Xbox d-pad's unpressed grey
WHITE = (255, 255, 255, 255)
def draw_dpad_ps(g, lit):
"""The DualSense d-pad: four separate arrow keys pointing at the middle, the pressed ones white, the rest grey
(all white when none or all are meant)."""
arms = {"up": ["up"], "down": ["down"], "left": ["left"], "right": ["right"], "idle": [],
"all": ["up", "down", "left", "right"], "updown": ["up", "down"], "leftright": ["left", "right"]}[lit]
up = [(22.5, 1.5), (41.5, 1.5), (41.5, 18), (32, 26.5), (22.5, 18)]
turn = {"up": lambda x, y: (x, y), "down": lambda x, y: (64 - x, 64 - y),
"left": lambda x, y: (y, 64 - x), "right": lambda x, y: (64 - y, x)}
for d in ("up", "down", "left", "right"):
color = WHITE if (not arms or d in arms) else DIM
g.poly([turn[d](x, y) for x, y in up], color)
def draw_dpad(g, lit):
if MONO:
return draw_dpad_ps(g, lit)
arm = 24.0
lo, hi = 32 - arm / 2, 32 + arm / 2
cross = lambda inset: [
@ -510,7 +545,8 @@ def draw_touchpad(g):
def build_sprite(movie, n):
g = Glyph(movie)
x0, y0, x1, y1 = BOUNDS.get(n, (0, 0, BOX, BOX))
g.items.append(movie.shape([poly_contour(clockwise([(x0, y0), (x1, y0), (x1, y1), (x0, y1)]))], CLEAR))
if not MONO: # mono: no see-through box behind the glyph (a highlight's colour change showed it as a black halo)
g.items.append(movie.shape([poly_contour(clockwise([(x0, y0), (x1, y0), (x1, y1), (x0, y1)]))], CLEAR))
if n in DPAD:
draw_dpad(g, DPAD[n])
elif n in (12, 13, 14, 15, 17, 18, 19):
@ -769,6 +805,15 @@ def selftest():
print("ok: %d bytes, %d zlib bytes" % (len(data), len(zlib.compress(data, 9))))
def mono():
"""White fill, black ink: every symbol in one black on a plain white disc or key, as the title's Xbox glyphs."""
global PANEL, RIM, INK, GREY, LIT, BLUE, RED, PINK, GREEN, MONO
MONO = True
white, black = (255, 255, 255, 255), (0, 0, 0, 255)
PANEL = RIM = GREY = white
INK = LIT = BLUE = RED = PINK = GREEN = black
def main(argv):
ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
ap.add_argument("--out", help="write the uncompressed movie (GFX header + tags) here")
@ -778,7 +823,11 @@ def main(argv):
ap.add_argument("--from-archive", help="build over the title's own movie in this data.rpf (see above)")
ap.add_argument("--base", help="build over this inflated movie file instead of the archive")
ap.add_argument("--selftest", action="store_true")
ap.add_argument("--mono", action="store_true",
help="the Xbox glyphs' look: white discs and keys, black symbols and letters")
args = ap.parse_args(argv)
if args.mono:
mono()
if args.selftest:
selftest()
if args.from_archive or args.base: