From 3d6923b2a153e8b05c85e8948eb9d95af9612235 Mon Sep 17 00:00:00 2001 From: Haruka Date: Mon, 19 Dec 2022 23:53:53 +0900 Subject: [PATCH] CDVD: implement SetSpindleSpeed on macOS --- pcsx2/CDVD/Darwin/IOCtlSrc.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pcsx2/CDVD/Darwin/IOCtlSrc.cpp b/pcsx2/CDVD/Darwin/IOCtlSrc.cpp index 3e792dc04b..f9ebe04f94 100644 --- a/pcsx2/CDVD/Darwin/IOCtlSrc.cpp +++ b/pcsx2/CDVD/Darwin/IOCtlSrc.cpp @@ -66,8 +66,17 @@ bool IOCtlSrc::Reopen() void IOCtlSrc::SetSpindleSpeed(bool restore_defaults) const { - // TODO: Seems it's actually able to set it (DKIOCCDSETSPEED) but I don't have - // physical drives right now to test + u16 speed = restore_defaults ? 0xFFFF : m_media_type >= 0 ? 5540 : + 3600; + int ioctl_code = m_media_type >= 0 ? DKIOCDVDSETSPEED : DKIOCCDSETSPEED; + if (ioctl(m_device, ioctl_code, &speed) == -1) + { + fprintf(stderr, " * CDVD: Failed to set spindle speed: %s\n", strerror(errno)); + } + else if (!restore_defaults) + { + printf(" * CDVD: Spindle speed set to %d\n", speed); + } } u32 IOCtlSrc::GetSectorCount() const