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:
authorProudnoob4 <33210516+Proudnoob4@users.noreply.github.com>2026-11-22 19:02:28 -0500
committerProudnoob4 <33210516+Proudnoob4@users.noreply.github.com>2026-11-22 19:02:28 -0500
commitdf6324ff6908242a6438fd1dc52fbe33b953514e (patch)
tree57f50b1f119ce8944f2513acd27f6faf87980fb5 /runtime/test/bink_play.cpp
parentaa2988cc555bad7ecd508b48a702adbb32fe7c95 (diff)
bink_play: a headless pass needs every decoded frame to write the buffer
--headless counted decode calls and printed RESULT PASS without looking at the frame, so a decode that wrote nothing still passed: the buffer starts zeroed and otherwise keeps the previous frame. Headless decode() now fills the frame with 0xA5 first and fails if the decode and copy leave every byte of it. Windowed playback is unchanged. Follow-up to #4049.
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) {