Fix buffer pointers

This commit is contained in:
ABelliqueux 2021-07-23 20:07:53 +02:00
parent 4b44c4bea9
commit d3e5674a77

View File

@ -124,8 +124,7 @@ int main() {
StSetStream(TRUECOL, 1, StrFileLength, 0, 0); StSetStream(TRUECOL, 1, StrFileLength, 0, 0);
// Get the CD location of the STR file to play // Get the CD location of the STR file to play
if ( CdSearchFile(&STRfile, StrFileName) == 0 ) { if ( CdSearchFile(&STRfile, StrFileName) == 0 ) {
printf("File not found :%s\n", StrFileName); FntPrint("File not found :%s\n", StrFileName);
//~ SetDispMask(1);
} }
// Set the seek target position // Set the seek target position
CdControl(CdlSetloc, (u_char *)&STRfile.pos, 0); CdControl(CdlSetloc, (u_char *)&STRfile.pos, 0);
@ -145,9 +144,9 @@ int main() {
// Main loop // Main loop
while (1) { while (1) {
u_long * curVLCptr = &VlcBuff[db][0]; // Set some pointers to the relevant buffer addresses
u_long * curVLCptr = &VlcBuff[!db][0];
u_short * curIMGptr = &ImgBuff[db][0]; u_short * curIMGptr = &ImgBuff[db][0];
// While end of str is not reached, play it // While end of str is not reached, play it
while (!endPlayback) { while (!endPlayback) {
// Use this area to draw the slices // Use this area to draw the slices
@ -162,15 +161,15 @@ int main() {
// Dont try decoding if not data has been loaded from ring buffer // Dont try decoding if not data has been loaded from ring buffer
if ( frameAddr ){ if ( frameAddr ){
// Begin decoding RLE-encoded MDEC image data // Begin decoding RLE-encoded MDEC image data
DecDCTin( &VlcBuff[db][0] , DCT_MODE); DecDCTin( curVLCptr , DCT_MODE);
// Prepare to receive the decoded image data from the MDEC // Prepare to receive the decoded image data from the MDEC
while (curSlice.x < STR_POS_X + SCREENXRES * PPW) { while (curSlice.x < STR_POS_X + SCREENXRES * PPW) {
// Receive decoded data : a 16*ppw*240 px slice // Receive decoded data : a 16*ppw*240 px slice
DecDCTout( (u_long *) &ImgBuff[db][0], curSlice.w * curSlice.h / 2); DecDCTout( (u_long *) curIMGptr, curSlice.w * curSlice.h / 2);
// Wait for transfer end // Wait for transfer end
DecDCToutSync(1); DecDCToutSync(1);
// Transfer data from main memory to VRAM // Transfer data from main memory to VRAM
LoadImage(&curSlice, (u_long *) &ImgBuff[db][0]); LoadImage(&curSlice, (u_long *) curIMGptr );
// Increment drawArea's X with slice width (16 or 24 pix) // Increment drawArea's X with slice width (16 or 24 pix)
curSlice.x += 16 * PPW; curSlice.x += 16 * PPW;
} }