From bb5e5fd8f2559ecb1be30d053761c9feeec91280 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 1 Feb 2020 13:40:52 -0800 Subject: [PATCH 1/2] Fix assignment of DI interrupt mask ioctls 0x85 is actually DVDLowMaskCoverInterrupt, while 0x89 is DVDLowUnmaskCoverInterrupt. I'm also fairly sure that 0x87 is DVDLowUnmaskStatusInterrupts. --- Source/Core/Core/IOS/DI/DI.cpp | 12 ++++++++---- Source/Core/Core/IOS/DI/DI.h | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/IOS/DI/DI.cpp b/Source/Core/Core/IOS/DI/DI.cpp index f6d8c249c3..8a828ce8a0 100644 --- a/Source/Core/Core/IOS/DI/DI.cpp +++ b/Source/Core/Core/IOS/DI/DI.cpp @@ -240,21 +240,25 @@ std::optional DI::StartIOCtl(const IOCtlRequest& request) INFO_LOG(IOS_DI, "DVDLowGetImmBuf 0x%08x", diimmbuf); return WriteIfFits(request, diimmbuf); } - case DIIoctl::DVDLowUnmaskCoverInterrupt: - INFO_LOG(IOS_DI, "DVDLowUnmaskCoverInterrupt"); + case DIIoctl::DVDLowMaskCoverInterrupt: + INFO_LOG(IOS_DI, "DVDLowMaskCoverInterrupt"); DVDInterface::SetInterruptEnabled(DVDInterface::DIInterruptType::CVRINT, false); return DIResult::Success; case DIIoctl::DVDLowClearCoverInterrupt: DEBUG_LOG(IOS_DI, "DVDLowClearCoverInterrupt"); DVDInterface::ClearInterrupt(DVDInterface::DIInterruptType::CVRINT); return DIResult::Success; + case DIIoctl::DVDLowUnmaskStatusInterrupts: + INFO_LOG(IOS_DI, "DVDLowUnmaskStatusInterrupts"); + // Dummied out + return DIResult::Success; case DIIoctl::DVDLowGetCoverStatus: // TODO: handle resetting case INFO_LOG(IOS_DI, "DVDLowGetCoverStatus: Disc %sInserted", DVDInterface::IsDiscInside() ? "" : "Not "); return WriteIfFits(request, DVDInterface::IsDiscInside() ? 2 : 1); - case DIIoctl::DVDLowEnableCoverInterrupt: - INFO_LOG(IOS_DI, "DVDLowEnableCoverInterrupt"); + case DIIoctl::DVDLowUnmaskCoverInterrupt: + INFO_LOG(IOS_DI, "DVDLowUnmaskCoverInterrupt"); DVDInterface::SetInterruptEnabled(DVDInterface::DIInterruptType::CVRINT, true); return DIResult::Success; case DIIoctl::DVDLowReset: diff --git a/Source/Core/Core/IOS/DI/DI.h b/Source/Core/Core/IOS/DI/DI.h index 975b0adc51..4b8afe1def 100644 --- a/Source/Core/Core/IOS/DI/DI.h +++ b/Source/Core/Core/IOS/DI/DI.h @@ -60,11 +60,11 @@ public: DVDLowReadDvdDiscKey = 0x82, DVDLowGetLength = 0x83, DVDLowGetImmBuf = 0x84, // Unconfirmed name - DVDLowUnmaskCoverInterrupt = 0x85, + DVDLowMaskCoverInterrupt = 0x85, DVDLowClearCoverInterrupt = 0x86, - // 0x87 is a dummied out command + DVDLowUnmaskStatusInterrupts = 0x87, // Dummied out, ID is educated guess DVDLowGetCoverStatus = 0x88, - DVDLowEnableCoverInterrupt = 0x89, // Unconfirmed name + DVDLowUnmaskCoverInterrupt = 0x89, DVDLowReset = 0x8a, DVDLowOpenPartition = 0x8b, // ioctlv only DVDLowClosePartition = 0x8c, From f527f382e8f666418b43fa12576ebc12b8f2376b Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 1 Feb 2020 13:41:20 -0800 Subject: [PATCH 2/2] Report use of DI interrupt mask commands as a game quirk --- Source/Core/Core/Analytics.cpp | 3 ++- Source/Core/Core/Analytics.h | 6 ++++++ Source/Core/Core/IOS/DI/DI.cpp | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Analytics.cpp b/Source/Core/Core/Analytics.cpp index 3b49173ed2..6b28eeb153 100644 --- a/Source/Core/Core/Analytics.cpp +++ b/Source/Core/Core/Analytics.cpp @@ -132,7 +132,7 @@ void DolphinAnalytics::ReportGameStart() } // Keep in sync with enum class GameQuirk definition. -constexpr std::array GAME_QUIRKS_NAMES{ +constexpr std::array GAME_QUIRKS_NAMES{ "icache-matters", "directly-reads-wiimote-input", "uses-DVDLowStopLaser", @@ -142,6 +142,7 @@ constexpr std::array GAME_QUIRKS_NAMES{ "uses-DVDLowRequestRetryNumber", "uses-DVDLowSerMeasControl", "uses-different-partition-command", + "uses-di-interrupt-command", }; static_assert(GAME_QUIRKS_NAMES.size() == static_cast(GameQuirk::COUNT), "Game quirks names and enum definition are out of sync."); diff --git a/Source/Core/Core/Analytics.h b/Source/Core/Core/Analytics.h index 2d35029a46..f78cafbac6 100644 --- a/Source/Core/Core/Analytics.h +++ b/Source/Core/Core/Analytics.h @@ -41,6 +41,12 @@ enum class GameQuirk // already-read data is provided USES_DIFFERENT_PARTITION_COMMAND, + // IOS has implementations for ioctls 0x85 and 0x89 and a stub for 0x87, but + // DVDLowMaskCoverInterrupt/DVDLowUnmaskCoverInterrupt/DVDLowUnmaskStatusInterrupts + // are all stubbed on the PPC side so they presumably will never be used. + // (DVDLowClearCoverInterrupt is used, though) + USES_DI_INTERRUPT_MASK_COMMAND, + COUNT, }; diff --git a/Source/Core/Core/IOS/DI/DI.cpp b/Source/Core/Core/IOS/DI/DI.cpp index 8a828ce8a0..ebc5016453 100644 --- a/Source/Core/Core/IOS/DI/DI.cpp +++ b/Source/Core/Core/IOS/DI/DI.cpp @@ -243,6 +243,7 @@ std::optional DI::StartIOCtl(const IOCtlRequest& request) case DIIoctl::DVDLowMaskCoverInterrupt: INFO_LOG(IOS_DI, "DVDLowMaskCoverInterrupt"); DVDInterface::SetInterruptEnabled(DVDInterface::DIInterruptType::CVRINT, false); + DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DI_INTERRUPT_MASK_COMMAND); return DIResult::Success; case DIIoctl::DVDLowClearCoverInterrupt: DEBUG_LOG(IOS_DI, "DVDLowClearCoverInterrupt"); @@ -250,6 +251,7 @@ std::optional DI::StartIOCtl(const IOCtlRequest& request) return DIResult::Success; case DIIoctl::DVDLowUnmaskStatusInterrupts: INFO_LOG(IOS_DI, "DVDLowUnmaskStatusInterrupts"); + DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DI_INTERRUPT_MASK_COMMAND); // Dummied out return DIResult::Success; case DIIoctl::DVDLowGetCoverStatus: @@ -260,6 +262,7 @@ std::optional DI::StartIOCtl(const IOCtlRequest& request) case DIIoctl::DVDLowUnmaskCoverInterrupt: INFO_LOG(IOS_DI, "DVDLowUnmaskCoverInterrupt"); DVDInterface::SetInterruptEnabled(DVDInterface::DIInterruptType::CVRINT, true); + DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DI_INTERRUPT_MASK_COMMAND); return DIResult::Success; case DIIoctl::DVDLowReset: {