Skip to content

Commit

Permalink
gdrom: return blank sector if FAD miss
Browse files Browse the repository at this point in the history
Fixes NBA Hoopz (US) voice samples
Issue #1247
  • Loading branch information
flyinghead committed Oct 17, 2023
1 parent e96b38f commit e94b26f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions core/hw/gdrom/gdromv3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,14 @@ void gd_process_spi_cmd()
#define readcmd packet_cmd.GDReadBlock

cdda.status = cdda_t::NoInfo;
u32 sector_type=2048;
if (readcmd.head ==1 && readcmd.subh==1 && readcmd.data==1 && readcmd.expdtype==3 && readcmd.other==0)
sector_type=2340;
else if(readcmd.head ||readcmd.subh || readcmd.other || (!readcmd.data)) // assert
WARN_LOG(GDROM, "GDROM: *FIXME* ADD MORE CD READ SETTINGS %d %d %d %d 0x%01X",readcmd.head,readcmd.subh,readcmd.other,readcmd.data,readcmd.expdtype);
u32 sector_type = 2048;
if (readcmd.head == 1 && readcmd.subh == 1 && readcmd.data == 1 && readcmd.expdtype == 3 && readcmd.other == 0)
sector_type = 2340;
else if (readcmd.other == 1 || readcmd.expdtype == 1) // Expected Data Type: CD-DA
sector_type = 2352;
else if (readcmd.head == 1 || readcmd.subh == 1 || readcmd.other == 1 || readcmd.data == 0)
WARN_LOG(GDROM, "GDROM: *FIXME* ADD MORE CD READ SETTINGS head %d subh %d other %d data %d type %d",
readcmd.head, readcmd.subh, readcmd.other, readcmd.data, readcmd.expdtype);

read_params.start_sector = GetFAD(&readcmd.b[2], readcmd.prmtype);
if (packet_cmd.data_8[0] == SPI_CD_READ)
Expand Down
1 change: 1 addition & 0 deletions core/imgread/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ void Disc::ReadSectors(u32 FAD, u32 count, u8* dst, u32 fmt, LoadProgress *progr
else
{
WARN_LOG(GDROM, "Sector Read miss FAD: %d", FAD);
memset(dst, 0, fmt);
}
dst+=fmt;
FAD++;
Expand Down

0 comments on commit e94b26f

Please sign in to comment.