PSY-Q library initialization sequence

General help for the PSY-Q SDK, such as setting the SDK up, compiling correctly, linking and debugging
Post Reply
User avatar
lamb_of_senpai
Curious PSXDEV User
Curious PSXDEV User
Posts: 14
Joined: October 11th, 2018, 9:00 am

PSY-Q library initialization sequence

Post by lamb_of_senpai » November 29th, 2018, 8:58 am

I can't seem to find a clear answer from the documentation in what order the various libraries should be initialized. It doesn't seem to *really* matter, although in the libmcx section of the library overview it does mention that libmcx's interrupts can interfere with libcard or libmcrd if they're not initialized in a particular order.

I noticed this as I was implementing libds, where calling DsInit() resets the SPU (same thing happens with CdInit). So when running in mednafen or epsxe with the bios intro turned on, it leads to the last bit of the playstation boot sound looping infinitely, since it is evidently trapped in the buffer and doesn't know it's still playing (i think... i suppose it could something to do with the reverb). So it got me wondering if there's a proper boot sequence to follow, since none of the games I run in the same emulators have this issue, so they must be doing something different.

The documentation does say to only call SpuInit() after DsInit(), but I see no mention anywhere of any callbacks you should to wait for before initializing libraries, and I can't seem to find an example with a really complete init sequence.

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2232
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: PSY-Q library initialization sequence

Post by Shadow » November 29th, 2018, 6:08 pm

The Memory Card libs need to be initialised in a particular order because I think it trashes the interrupt vector table if you get it wrong. You must also de-init them in the reverse order the same way you initialised them or you will trash the interrupt vector.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

Development Computer: Windows 98, Pentium 3 [400MHz], 128MB SDRAM, DTL-H2000, DTL-H201A, 21" Sony Trinitron CRT, CD-ROM burner, 3.25" and 5.25" Floppy Diskette Drives and a ZIP 100 Diskette Drive.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest