aboutsummaryrefslogtreecommitdiff
path: root/examples/mdec
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2023-04-04 00:46:20 +0200
committerspicyjpeg <thatspicyjpeg@gmail.com>2023-04-04 00:46:20 +0200
commit8e3a757d4d7d5dfc62f69ce4ede08f1cf79e3461 (patch)
tree2cbbfe5b2a1f2ba53a4d070ed142f8fbc9ba49b2 /examples/mdec
parent09f321e37fc187affa664d32e36e32c0533a7e8e (diff)
downloadpsn00bsdk-8e3a757d4d7d5dfc62f69ce4ede08f1cf79e3461.tar.gz
Add IsIdleGPU(), tweak psxgpu.h, fix mdec/strvideo
Diffstat (limited to 'examples/mdec')
-rw-r--r--examples/mdec/strvideo/main.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/examples/mdec/strvideo/main.c b/examples/mdec/strvideo/main.c
index 57cb6ef..853e0c2 100644
--- a/examples/mdec/strvideo/main.c
+++ b/examples/mdec/strvideo/main.c
@@ -189,8 +189,15 @@ void cd_sector_handler(void) {
return;
// If this sector is actually part of a new frame, validate the sectors
- // that have been read so far and flip the bitstream data buffers.
- if (sector_header.frame_id != str_ctx.frame_id) {
+ // that have been read so far and flip the bitstream data buffers. If the
+ // frame number is actually lower than the current one, assume the drive
+ // has started reading another .STR file and stop playback.
+ if ((int) sector_header.frame_id < str_ctx.frame_id) {
+ str_ctx.frame_ready = -1;
+ return;
+ }
+
+ if ((int) sector_header.frame_id > str_ctx.frame_id) {
// Do not set the ready flag if any sector has been missed.
if (str_ctx.sector_count)
str_ctx.dropped_frames++;
@@ -263,11 +270,9 @@ void init_stream(void) {
CdReadyCallback(&cd_event_handler);
ExitCriticalSection();
- // Set the maximum amount of data DecDCTvlc() can output and copy the
- // lookup table used for decompression to the scratchpad area. This is
- // optional but makes the decompressor slightly faster. See the libpsxpress
- // documentation for more details.
- DecDCTvlcSize(0x8000);
+ // Copy the lookup table used for frame decompression to the scratchpad
+ // area. This is optional but makes the decompressor slightly faster. See
+ // the libpsxpress documentation for more details.
DecDCTvlcCopyTableV3((VLC_TableV3 *) 0x1f800000);
str_ctx.cur_frame = 0;