Fix str offset + spu init

This commit is contained in:
ABelliqueux 2021-11-12 16:54:24 +01:00
parent 3f627778d3
commit 6e168368f6

View File

@ -8,13 +8,14 @@
#include <libgte.h> #include <libgte.h>
#include <libetc.h> #include <libetc.h>
#include <libgpu.h> #include <libgpu.h>
#include <libspu.h>
// CD library // CD library
#include <libcd.h> #include <libcd.h>
// CODEC library // CODEC library
#include <libpress.h> #include <libpress.h>
#define VMODE 0 // Video Mode : 0 : NTSC, 1: PAL #define VMODE 0 // Video Mode : 0 : NTSC, 1: PAL
#define TRUECOL 1 // 0 : 16bpp, 1: 24bpp #define TRUECOL 0 // 0 : 16bpp, 1: 24bpp
#define SCREENXRES 320 // Screen width #define SCREENXRES 320 // Screen width
#define SCREENYRES 240 + (VMODE << 4) // Screen height : If VMODE is 0 = 240, if VMODE is 1 = 256 #define SCREENYRES 240 + (VMODE << 4) // Screen height : If VMODE is 0 = 240, if VMODE is 1 = 256
#define CENTERX SCREENXRES/2 // Center of screen on x #define CENTERX SCREENXRES/2 // Center of screen on x
@ -112,6 +113,7 @@ int main() {
u_long * curVLCptr = VlcBuff[db]; u_long * curVLCptr = VlcBuff[db];
// Init Disp/Draw env, Font, etc. // Init Disp/Draw env, Font, etc.
init(); init();
SpuInit();
// Init CDrom system // Init CDrom system
CdInit(); CdInit();
// Reset the MDEC // Reset the MDEC
@ -150,7 +152,7 @@ int main() {
// 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
RECT curSlice = { 0, RECT curSlice = { STR_POS_X,
(db * StrFileY) + STR_POS_Y, (db * StrFileY) + STR_POS_Y,
// In 24bpp, use 24 pixels wide slices // In 24bpp, use 24 pixels wide slices
16 * PPW , 16 * PPW ,
@ -163,11 +165,11 @@ int main() {
// Begin decoding RLE-encoded MDEC image data // Begin decoding RLE-encoded MDEC image data
DecDCTin( curVLCptr , 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 + StrFileX * PPW) {
// Receive decoded data : a 16*ppw*240 px slice // Receive decoded data : a 16*ppw*240 px slice in long word (4B), so / 2
DecDCTout( (u_long *) curIMGptr, 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(0);
// Transfer data from main memory to VRAM // Transfer data from main memory to VRAM
LoadImage(&curSlice, (u_long *) curIMGptr ); 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)