About CD Audio stopping working after executing Quake

Discussion of development and patch submission.
Post Reply
EluanCM
Posts: 72
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

About CD Audio stopping working after executing Quake

Post by EluanCM » Wed 08 Jan, 2020 11:51 pm

CD Audio stops working completely in a PCem session after running Quake (the original, DOS version) under Win9x (haven't tested under DOS with MSCDEx).

I've done some digging and here is what I found (the offending code is here: https://github.com/id-Software/Quake/blob/master/WinQuake/cd_audio.c ).

What happens is that Quake issues two Mode Select commands, but they get truncated somewhere.
Quake should send:

Code: Select all

00 00 00 00 00 00 00 00 0E 0E 04 04 00 80 00 4B 01  00 02  00 00 00 00 00

00 00 00 00 00 00 00 00 0E 0E 04 04 00 80 00 4B 01 VOL 02 VOL 00 00 00 00
But the bytes that reach scsi_cd_read() are:

Code: Select all

00 00 00 00 00 00 00 00 0E 0E 04 04 00 80 00 4B 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 0E 0E 04 04 00 80 00 4B 00 00 00 00 00 00 00 00
Note that everything after the byte 0x4B is zeroed out in both commands, so all outputs are not connected to any channel and volumes are set to zero. Since most programs set CD volume through the soundcard's mixer and not ATAPI commands, it stays that way.

I don't know much about ATAPI and SCSI, so I don't really know where to go next to find where the truncation occurs and decided to post my findings here before trying something else.

Post Reply