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: Oct 11, 2018

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
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2670
Joined: Dec 31, 2012
PlayStation Model: H2000/5502
Discord: Shadow^PSXDEV

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), 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