upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/bink_play.cpp
diff options
context:
space:
mode:
authorRafael <rafaelalvesp2005@gmail.com>2026-11-23 15:36:26 -0300
committerRafael <rafaelalvesp2005@gmail.com>2026-11-23 15:36:26 -0300
commit63f0e0dea3a9d44201db408c4e2c3f2f5b2b94d6 (patch)
tree86f0dcad8070e2a3a693ef4897aa83950cfeb224 /runtime/test/bink_play.cpp
parentf78f7d6a2a9364cb128c03ac539fe540d5c70df1 (diff)
parent6dda0630bd6fc0514baadb94fb98e36bd7d64c0b (diff)
Merge main into fix/walk-bink_names
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/bink_play.cpp')
-rw-r--r--runtime/test/bink_play.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/test/bink_play.cpp b/runtime/test/bink_play.cpp
index da9360e2a..1682efe6a 100644
--- a/runtime/test/bink_play.cpp
+++ b/runtime/test/bink_play.cpp
@@ -16,7 +16,8 @@
16// 16//
17// --game-dir defaults to LEONIDA_GAME_DIR, the movie to LEONIDA_MOVIE. Without a package or a movie it prints 17// --game-dir defaults to LEONIDA_GAME_DIR, the movie to LEONIDA_MOVIE. Without a package or a movie it prints
18// "SKIP (no package/movie)" and exits 77 (CTest skip). --headless decodes without a window (as fast as it can) and 18// "SKIP (no package/movie)" and exits 77 (CTest skip). --headless decodes without a window (as fast as it can) and
19// prints the decode rate, so CTest can run it; --frames stops after N frames. 19// prints the decode rate, so CTest can run it; --frames stops after N frames. Each headless decode starts from a
20// frame filled with 0xA5 and fails if it leaves the frame untouched, so a pass means every frame wrote the buffer.
20// 21//
21// Keys: Space pause/resume, Left/Right one second back/forward, Home restart, L loop on/off, Esc or closing the 22// Keys: Space pause/resume, Left/Right one second back/forward, Home restart, L loop on/off, Esc or closing the
22// window quits. The frame is scaled to the window, keeping its aspect ratio. 23// window quits. The frame is scaled to the window, keeping its aspect ratio.
@@ -118,8 +119,14 @@ struct Player {
118 uint32_t seek_to = 0; 119 uint32_t seek_to = 0;
119 120
120 void decode() { 121 void decode() {
122 // Headless, the frame is filled with a sentinel first, and a decode that leaves every byte of it fails: a
123 // pass then means each decoded frame wrote the buffer (not that its pixels are right).
124 constexpr uint8_t kSentinel = 0xa5;
125 if (!g_windowed) std::fill(frame.begin(), frame.end(), kSentinel);
121 api.do_frame(bink); 126 api.do_frame(bink);
122 api.copy(bink, frame.data(), header.width * 4, header.height, 0, 0, kCopyBgra32); 127 api.copy(bink, frame.data(), header.width * 4, header.height, 0, 0, kCopyBgra32);
128 if (!g_windowed && std::all_of(frame.begin(), frame.end(), [](uint8_t v) { return v == kSentinel; }))
129 fatal("headless decode left the BGRA buffer untouched");
123 } 130 }
124 // Bink frame numbers in BinkGoto are 1-based. 131 // Bink frame numbers in BinkGoto are 1-based.
125 void go_to(uint32_t target) { 132 void go_to(uint32_t target) {