Skip to content

Commit 17c207b

Browse files
committed
atapi: redump hack
1 parent b4ce2b5 commit 17c207b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hw/ide/atapi.c

+8
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,13 @@ static void cmd_read(IDEState *s, uint8_t* buf)
993993
}
994994

995995
lba = ldl_be_p(buf + 2);
996+
997+
#ifdef XBOX
998+
#define XGD1_LSEEK_OFFSET 0x18300000UL
999+
lba += XGD1_LSEEK_OFFSET / ATAPI_SECTOR_SIZE;
1000+
total_sectors -= (XGD1_LSEEK_OFFSET / ATAPI_SECTOR_SIZE);
1001+
#endif
1002+
9961003
if (lba >= total_sectors || lba + nb_sectors - 1 >= total_sectors) {
9971004
ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR);
9981005
return;
@@ -1007,6 +1014,7 @@ static void cmd_read_cd(IDEState *s, uint8_t* buf)
10071014

10081015
/* Total logical sectors of ATAPI_SECTOR_SIZE(=2048) bytes */
10091016
uint64_t total_sectors = s->nb_sectors >> 2;
1017+
total_sectors -= (XGD1_LSEEK_OFFSET / ATAPI_SECTOR_SIZE);
10101018

10111019
nb_sectors = (buf[6] << 16) | (buf[7] << 8) | buf[8];
10121020
if (nb_sectors == 0) {

0 commit comments

Comments
 (0)