I haven’t really made much progress over the holidays (lack of motivation), but I have gotten controllers almost fully working! This means instead of using my keyboard to use the emulator I can use an actual controller (e.g a dualshock 4).
Getting basic controller input was pretty simple, although it took a while since i was a bit rusty from doing basically no coding since SoM. Initially I made Gilrs (the gamepad input library) select the first controller that connects to receive from, but for some reason my computer has a non-existent gamepad called HID-compliant game controller which always connects first, so annoyingly I had to hardcode it to not connect to controllers with that name :/.
Getting analog input to work was a bit more complicated, as in the emulator i was emulating the digital controller (which doesnt have joysticks). I decided to instead emulate the dual analog joypad (which was only on sale for a year before it was replaced with the dualshock 1), which has two joysticks but doesn’t have vibration motors. I chose not to emulate the dualshock 1 because it uses a different communication sequence which can stop games from booting if not implemented perfectly.
After that i wanted to start improving the CDROM drive emulation - in particular I wanted to improve CDDA audio sound quality (there is a buzzing noise in the background of every CDDA track for some reason), and get the BIOS CD player/audio visualiser working. For now I have hacked in support for the CD player by making the bios think all CDs are audio CDs. To get the audio visualiser working I needed to implement a weird edge case where 16-bit writes to the DMA controller are treated like 32-bit writes (the BIOS writes 16 bits when it should be writing 32 bits). Getting all this working should hopefully make debugging CDDA audio easier.
Video: the BIOS CD player / audio visualiser (i’m also using a controller in this clip, but you cant see that obviously).