Skip to content

Commit

Permalink
xdvd: Handle redump and xiso style dvd images
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryzee119 committed Jun 11, 2024
1 parent ba54f6f commit c5e1274
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hw/ide/atapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,12 @@ static void cmd_read(IDEState *s, uint8_t* buf)
}

lba = ldl_be_p(buf + 2);

#ifdef XBOX
lba = xdvd_get_lba_offset(&s->xdvd_security, total_sectors, lba);
total_sectors = xdvd_get_sector_cnt(&s->xdvd_security, total_sectors);
#endif

if (lba >= total_sectors || lba + nb_sectors - 1 >= total_sectors) {
ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR);
return;
Expand Down Expand Up @@ -1256,6 +1262,10 @@ static void cmd_read_cdvd_capacity(IDEState *s, uint8_t* buf)
{
uint64_t total_sectors = s->nb_sectors >> 2;

#ifdef XBOX
total_sectors = xdvd_get_sector_cnt(&s->xdvd_security, total_sectors);
#endif

/* NOTE: it is really the number of sectors minus 1 */
stl_be_p(buf, total_sectors - 1);
stl_be_p(buf + 4, 2048);
Expand Down

0 comments on commit c5e1274

Please sign in to comment.