aboutsummaryrefslogtreecommitdiff
path: root/examples
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
parent09f321e37fc187affa664d32e36e32c0533a7e8e (diff)
downloadpsn00bsdk-8e3a757d4d7d5dfc62f69ce4ede08f1cf79e3461.tar.gz
Add IsIdleGPU(), tweak psxgpu.h, fix mdec/strvideo
Diffstat (limited to 'examples')
-rw-r--r--examples/demos/n00bdemo/main.c29
-rw-r--r--examples/mdec/strvideo/main.c19
2 files changed, 26 insertions, 22 deletions
diff --git a/examples/demos/n00bdemo/main.c b/examples/demos/n00bdemo/main.c
index c9ca3ce..55dbbc4 100644
--- a/examples/demos/n00bdemo/main.c
+++ b/examples/demos/n00bdemo/main.c
@@ -358,10 +358,9 @@ void stencilstuff() {
/*
The stencil demo is achieved by utilizing the mask bit setting
primitive GP0(E6h). The structure of this primitive is defined as
- DR_MASK initialized and set by setDrawMask(). These are not available
- in Sony's SDK by default.
+ DR_STP initialized and set by setDrawStp().
- The DR_MASK primitive controls mask bit operations for drawing
+ The DR_STP primitive controls mask bit operations for drawing
primitives such as setting mask bits on every pixel drawn or mask
bit test where pixels won't be drawn on pixels with the mask bit set.
It applies to most graphics drawing primitives except VRAM fill.
@@ -373,10 +372,10 @@ void stencilstuff() {
bit operation disabled.
The stencil effect featured in this demo is achieved by enabling set
- mask bit with DR_MASK, drawing semi-transparent primitives using
+ mask bit with DR_STP, drawing semi-transparent primitives using
additive blending but color is all zero to make it completely invisible
but is enough to update the mask bits, disable mask set bit but enable
- mask test with DR_MASK and then drawing a rectangle that fills the
+ mask test with DR_STP and then drawing a rectangle that fills the
entire screen. Semi-transparency mask in textures must not be used when
drawing the scene that will be 'below' the mask layer.
*/
@@ -384,7 +383,7 @@ void stencilstuff() {
int spin=0;
- DR_MASK *mask;
+ DR_STP *mask;
TILE *rect;
SC_OT s_ot;
@@ -430,10 +429,10 @@ void stencilstuff() {
// Sort mask primitive that enables setting mask bits
- mask = (DR_MASK*)nextpri;
- setDrawMask( mask, 1, 0 );
+ mask = (DR_STP*)nextpri;
+ setDrawStp( mask, 1, 0 );
addPrim( ot[db]+20, mask );
- nextpri += sizeof(DR_MASK);
+ nextpri += sizeof(DR_STP);
// Sort the stars
@@ -465,10 +464,10 @@ void stencilstuff() {
// Sort mask primitive that enables mask bit test
- mask = (DR_MASK*)nextpri;
- setDrawMask( mask, 0, 1 );
+ mask = (DR_STP*)nextpri;
+ setDrawStp( mask, 0, 1 );
addPrim( ot[db]+18, mask );
- nextpri += sizeof(DR_MASK);
+ nextpri += sizeof(DR_STP);
// Sort rectangle that fills the screen
@@ -482,10 +481,10 @@ void stencilstuff() {
// Clear all mask settings
- mask = (DR_MASK*)nextpri;
- setDrawMask( mask, 0, 0 );
+ mask = (DR_STP*)nextpri;
+ setDrawStp( mask, 0, 0 );
addPrim( ot[db]+15, mask );
- nextpri += sizeof(DR_MASK);
+ nextpri += sizeof(DR_STP);
// Sort overlay then display
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;