Boot logo interruption?

Miscellaneous and un-categorized content regarding the PlayStation 1
Post Reply
Laban
Interested PSXDEV User
Interested PSXDEV User
Posts: 7
Joined: Mar 23, 2019

Boot logo interruption?

Post by Laban » June 17th, 2019, 9:09 pm

I'm experiencing an odd issue where the BIOS boot-up PlayStation logo gets frozen in a non-completed state on the screen for about a second (see the attached image) and then appears to get interrupted by my own program starting up (I would expect it to stick around for several seconds and fade out before that happens). At this point, if I don't call SpuInit() (using PsyQ) or otherwise do anything with the SPU, the last part of sound data put into the audio buffer by the boot animation will be stuck looping eternally in there.

Now it should be noted that this happens on emulators. Every emulator I've tried in fact, and with various BIOS images (and yes, they all display the full logo sequence when loading real game images). It may not be a thing on original hardware, unfortunately I don't have access to a CD burner to test it at this point in time.

In any case, I remember it being said that you can in fact change this logo, so I assume it can be read from the CD rather than the BIOS ROM. Does it in fact have to be, and if so, how would I go about setting that up?
Using No$psx to inspect the VRAM it appears that it does load image data for displaying the text "SONY COMPUTER ENTERTAINMENT" (which is not drawn to the screen however), but only the 'd', 'SCE' and 'TM' character sprites. There's also no draw list entries for attempting to use blank texpage areas to draw this other text, nor the polygonal PS logo itself.


Thanks in advance for any information or pointers regarding this.
You do not have the required permissions to view the files attached to this post.

Laban
Interested PSXDEV User
Interested PSXDEV User
Posts: 7
Joined: Mar 23, 2019

Post by Laban » June 17th, 2019, 9:20 pm

OK, Rubber ducking saves the day again, at least partially :lol:
Licensing the ISO for a region makes it display fully (makes sense as it does display the licensed region after all).

It still does cut off after about a second however (so there's no fade out or enough time for the audio to finish playing), is there anything that can be done about that?

User avatar
Shadow
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2670
Joined: Dec 31, 2012
PlayStation Model: H2000/5502
Discord: Shadow^PSXDEV

Post by Shadow » June 18th, 2019, 12:48 am

Your disc image was missing the license information in the first 12 sectors (which also contains that PlayStation TMD logo).

Yes, you can add this:

Code: Select all

VSync(170); // wait (lets the user hear the BIOS chime trail a little before stopping it)
SsInit(); // initialise the sound system (SpuInit() is called internally within SSInit())
	
// the following code is supposedly only necessary with library 4.2 or earlier (though I find it still happens with 4.6 and 4.7)
// this routine stops the BIOS chime sound trailing that some PlayStation BIOS's had
SsUtSetReverbDepth(0, 0);
SsUtReverbOff();
SpuClearReverbWorkArea(SPU_REV_MODE_OFF);
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

Laban
Interested PSXDEV User
Interested PSXDEV User
Posts: 7
Joined: Mar 23, 2019

Post by Laban » June 22nd, 2019, 10:56 pm

Ah thanks.
I ended up putting together this rather more verbose version (it waits for the audio + reverb to actually fade out and fades out the PS logo image):

Code: Select all

void WaitForBootLogo() {
	#define BOOT_LOGO_WAIT_TIME 5000

	u_char				flags[24];
	u_long 				currentTick;
	u_long 				lastTick;
	u_long 				elapsedMillis;
	int 				n;
	DR_TPAGE 			texPage;
	TILE 				tile;
	u_char 				audioFlags;
	
	// Is any audio channel currently playing?
	// If not we can assume that this is a quick boot that disables 
	// the logo sequence and just return immediately.
	SpuGetAllKeysStatus((char*)flags);
	audioFlags = 0;
	for(n = 0; n < 24; n++)
		audioFlags |= flags[n];
	if(!audioFlags)
		return;

	// We must reset the CD sub-system, but not call CdInit as that will
	// reset the SPU as well for whatever reason.
	CdReset(0);
	CdReadSync(0, flags);

	// We have to try to initialize this in a hot state as well
	ResetGraph(3);

	// Prepare texture page setting primitive for setting the blending mode to 2 (background - foreground)
	setDrawTPage(&texPage, 1, 0, (u_short)(2 << 5));
	// We can "draw" it immediately; this will send it to the GPU for processing; as there won't be anything resetting its effect,
	// it should then stay in effect until we're done here (and proceed to reset the graphics sub-system)
	DrawPrim(&texPage);

	// Prepare the constant settings of the overlay tile
	setlen(&tile, 3);
	setcode(&tile, 0x62);
	setXY0(&tile, 0, 0);
	setWH(&tile, 639, 511);					// The BIOS boot sequence seems to always run with a 640x512 display area
	setRGB0(&tile, 0x02, 0x02, 0x02);		// NOTE: Some emulators use 0x80 and some 0xff for full colours, we better anticipate 0xff even though I believe the actual hardware uses 0x80
	
	// Wait for the designated number of milliseconds
	SetRCnt(RCntCNT2, 4167, RCntMdINTR);	// Should reset approximately every millisecond (one tick per ~0.24:th microsecond)
	StartRCnt(RCntCNT2);
	currentTick 	= 0;
	elapsedMillis 	= 0;
	do {
		lastTick 	= currentTick;
		currentTick = GetRCnt(RCntCNT2);
		if(currentTick < lastTick) {	// It will reset back to zero for every 4167 ticks as set above
			elapsedMillis++;
		}
	} while(elapsedMillis < BOOT_LOGO_WAIT_TIME);
	StopRCnt(RCntCNT2);
	ResetRCnt(RCntCNT2);

	// Wait for any currently playing audio voices to stop
	do {
		SpuGetAllKeysStatus((char*)flags);
		audioFlags = 0;
		for(n = 0; n < 24; n++)
			audioFlags |= flags[n];
	} while(audioFlags & 1);	// Just wait until all 'keys' have been released, the release envelope can be active while we fade the image

	// Now we can draw our overlay tile every frame for 128 frames; this will subtract 2
	// from each pixel per frame to fully fade out any colour (if we assume white == 0xffffff, 
	// though it probably really is 0x7f7f7f or 0x808080; different emulators seem to handle 
	// this differently?) by the 128:th frame:
	n = 0;
	for(n = 0; n < 128; n++) {
		DrawPrim(&tile);
		VSync(0);
	}


	// And now we can wait for any voices still on their release envelope to fully fade out
	do {
		SpuGetAllKeysStatus((char*)flags);
		audioFlags = 0;
		for(n = 0; n < 24; n++)
			audioFlags |= flags[n];
	} while(audioFlags);

	// Finally initialize the SPU sub-system; this will reset its state.
	// Note that if this is done before all voices having ended on their own
	// there will be an abrupt break. If the voices' volumes are manually faded
	// to nothing there will still be an audible crack when SpuInit() is called
	// if any voices are still playing, silent or not. This is probably caused
	// by the routine restoring the volume settings before the buffered output
	// is fully stopped.
	SpuInit();

	#undef BOOT_LOGO_WAIT_TIME
}
The whole root counter thing could probably be replaced by VSync() calls after all. Initially I didn't get that to work as they seemed to require a prior call to ResetGraph(0), which in turn clears the VRAM and the logo display along with it. However ResetGraph(3) does retain VRAM contents.

User avatar
Shadow
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2670
Joined: Dec 31, 2012
PlayStation Model: H2000/5502
Discord: Shadow^PSXDEV

Post by Shadow » June 23rd, 2019, 3:45 am

Wow, very nice! Quite well done. I like it :)

You can also do this. Adjust VSync to how quickly or slowly you want it to fade out (or substitute it for your Root Counter logic):

Code: Select all

// fade out the BIOS chime sound
unsigned short val = 127;

while(val!=0)
{
	SsSetMVol(val, val);
	VSync(0);
	val--;
}
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests