From 490d12ea4e85aae7a19156d09a75de85d7d75374 Mon Sep 17 00:00:00 2001 From: Ryzee119 Date: Mon, 10 Jun 2024 12:19:00 +0930 Subject: [PATCH] xdvd: Force small XISOs to report as DVD roms --- hw/ide/atapi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 13b30cb6a7..85ac5decd2 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -73,11 +73,27 @@ static inline int media_present(IDEState *s) /* XXX: DVDs that could fit on a CD will be reported as a CD */ static inline int media_is_dvd(IDEState *s) { +#ifdef XBOX + // We need to prevent small XISOs from being reported as CD-ROMs + // If the DVD security path is set, we can assume it is an XISO. + const char *dvd_security_path = g_config.sys.files.dvd_security_path; + if (strlen(dvd_security_path) > 0) { + return 1; + } +#endif return (media_present(s) && s->nb_sectors > CD_MAX_SECTORS); } static inline int media_is_cd(IDEState *s) { +#ifdef XBOX + // We need to prevent small XISOs from being reported as CD-ROMs + // If the DVD security path is set, we can assume it is an XISO. + const char *dvd_security_path = g_config.sys.files.dvd_security_path; + if (strlen(dvd_security_path) > 0) { + return 0; + } +#endif return (media_present(s) && s->nb_sectors <= CD_MAX_SECTORS); }