BizHawk icon indicating copy to clipboard operation
BizHawk copied to clipboard

Playing Sega CD data track leads to BizHawk crash

Open getCursorsExe opened this issue 2 years ago • 4 comments

Remember the bug in Sega CD BIOS that causes out of bounds data to be read and interpreted as audio? This is done by playing track 02, then using Search to rewind the track into 01. You will then hear ear-deafening noises. What's weird is that these noises do not appear in upstream, but I have no idea if this happens on hardware. However, towards the end of the data track (around 12:14), BizHawk crashes with System.InvalidOperationException. Either a waterbox issue, audio processing issue or FFMPEG issue.

System.InvalidOperationException: Unsupported scenario: reading 2048 bytes from an unhandled sector type
   w BizHawk.Emulation.DiscSystem.DiscSectorReader.ReadLBA_2048(Int32 lba, Byte[] buffer, Int32 offset)
   w BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX.CDRead(Int32 lba, IntPtr dest, Boolean audio)
   w Bizhawk.BizInvokeProxyLibGPGX.gpgx_advance()
   w BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX.FrameAdvance(IController controller, Boolean render, Boolean renderSound)
   w BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(Boolean force)
   w BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop()
   w BizHawk.Client.EmuHawk.Program.SubMain(String[] args)

BizHawk crashes somewhere around here. image

Tested in BizHawk 2.7 It seems that 2.3.2 bypasses BizHawk's crash handler.

getCursorsExe avatar Feb 09 '22 12:02 getCursorsExe

To actually fix this we'd need to know what the real hardware does in these scenarios. Maybe we should just ignore the exception here.

It seems that 2.3.2 bypasses BizHawk's crash handler.

Yes, this is known and was fixed in later versions.

nattthebear avatar Feb 21 '22 22:02 nattthebear

We should ignore this exception here. The upstream uses CD decoding method that differs from BizHawk.

getCursorsExe avatar Feb 22 '22 13:02 getCursorsExe

Yeah, no guarantee it's doing the right thing either though.

nattthebear avatar Feb 22 '22 23:02 nattthebear

Although we can fix the crash, we cannot change the CD decoding system as this will break other CD cores.

getCursorsExe avatar Aug 12 '22 12:08 getCursorsExe

This was probably fixed already by the GPGX core update (which changed CD handling to always do 2352 byte sector reads for both data and audio)

CasualPokePlayer avatar May 14 '24 22:05 CasualPokePlayer