diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index fa272e7f9a..01f7c6cc22 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -344,7 +344,7 @@ bool CBoot::DVDReadDiscID(Core::System& system, const DiscIO::VolumeDisc& disc, // Transition out of the DiscIdNotRead state (which the drive should be in at this point, // on the assumption that this is only used for the first read) - system.GetDVDInterface().SetDriveState(DVDInterface::DriveState::ReadyNoReadsMade); + system.GetDVDInterface().SetDriveState(DVD::DriveState::ReadyNoReadsMade); return true; } diff --git a/Source/Core/Core/HW/DVD/DVDInterface.cpp b/Source/Core/Core/HW/DVD/DVDInterface.cpp index d7e4c08e98..b76a923236 100644 --- a/Source/Core/Core/HW/DVD/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVD/DVDInterface.cpp @@ -63,7 +63,7 @@ constexpr u64 DVD_ECC_BLOCK_SIZE = 16 * DVD_SECTOR_SIZE; // is already buffered. Measured in bytes per second. constexpr u64 BUFFER_TRANSFER_RATE = 32 * 1024 * 1024; -namespace DVDInterface +namespace DVD { // internal hardware addresses constexpr u32 DI_STATUS_REGISTER = 0x00; @@ -1517,4 +1517,4 @@ void DVDInterfaceManager::ScheduleReads(u64 offset, u32 length, const DiscIO::Pa ticks_until_completion * 1000000 / SystemTimers::GetTicksPerSecond()); } -} // namespace DVDInterface +} // namespace DVD diff --git a/Source/Core/Core/HW/DVD/DVDInterface.h b/Source/Core/Core/HW/DVD/DVDInterface.h index e4a3f29506..911f545dce 100644 --- a/Source/Core/Core/HW/DVD/DVDInterface.h +++ b/Source/Core/Core/HW/DVD/DVDInterface.h @@ -33,7 +33,7 @@ namespace MMIO class Mapping; } -namespace DVDInterface +namespace DVD { enum class DICommand : u8 { @@ -301,4 +301,4 @@ private: Core::System& m_system; }; -} // namespace DVDInterface +} // namespace DVD diff --git a/Source/Core/Core/HW/DVD/DVDThread.cpp b/Source/Core/Core/HW/DVD/DVDThread.cpp index 1e64aa9fd4..71b00a3709 100644 --- a/Source/Core/Core/HW/DVD/DVDThread.cpp +++ b/Source/Core/Core/HW/DVD/DVDThread.cpp @@ -210,15 +210,14 @@ void DVDThreadManager::WaitUntilIdle() } void DVDThreadManager::StartRead(u64 dvd_offset, u32 length, const DiscIO::Partition& partition, - DVDInterface::ReplyType reply_type, s64 ticks_until_completion) + DVD::ReplyType reply_type, s64 ticks_until_completion) { StartReadInternal(false, 0, dvd_offset, length, partition, reply_type, ticks_until_completion); } void DVDThreadManager::StartReadToEmulatedRAM(u32 output_address, u64 dvd_offset, u32 length, const DiscIO::Partition& partition, - DVDInterface::ReplyType reply_type, - s64 ticks_until_completion) + DVD::ReplyType reply_type, s64 ticks_until_completion) { StartReadInternal(true, output_address, dvd_offset, length, partition, reply_type, ticks_until_completion); @@ -226,8 +225,7 @@ void DVDThreadManager::StartReadToEmulatedRAM(u32 output_address, u64 dvd_offset void DVDThreadManager::StartReadInternal(bool copy_to_ram, u32 output_address, u64 dvd_offset, u32 length, const DiscIO::Partition& partition, - DVDInterface::ReplyType reply_type, - s64 ticks_until_completion) + DVD::ReplyType reply_type, s64 ticks_until_completion) { ASSERT(Core::IsCPUThread()); @@ -306,14 +304,14 @@ void DVDThreadManager::FinishRead(u64 id, s64 cycles_late) (SystemTimers::GetTicksPerSecond() / 1000000)); auto& dvd_interface = m_system.GetDVDInterface(); - DVDInterface::DIInterruptType interrupt; + DVD::DIInterruptType interrupt; if (buffer.size() != request.length) { PanicAlertFmtT("The disc could not be read (at {0:#x} - {1:#x}).", request.dvd_offset, request.dvd_offset + request.length); - dvd_interface.SetDriveError(DVDInterface::DriveError::ReadError); - interrupt = DVDInterface::DIInterruptType::DEINT; + dvd_interface.SetDriveError(DVD::DriveError::ReadError); + interrupt = DVD::DIInterruptType::DEINT; } else { @@ -323,7 +321,7 @@ void DVDThreadManager::FinishRead(u64 id, s64 cycles_late) memory.CopyToEmu(request.output_address, buffer.data(), request.length); } - interrupt = DVDInterface::DIInterruptType::TCINT; + interrupt = DVD::DIInterruptType::TCINT; } // Notify the emulated software that the command has been executed diff --git a/Source/Core/Core/HW/DVD/DVDThread.h b/Source/Core/Core/HW/DVD/DVDThread.h index fee48ea1ad..a8d59f6a53 100644 --- a/Source/Core/Core/HW/DVD/DVDThread.h +++ b/Source/Core/Core/HW/DVD/DVDThread.h @@ -34,7 +34,7 @@ namespace DiscIO struct Partition; } -namespace DVDInterface +namespace DVD { enum class ReplyType : u32; } @@ -84,10 +84,10 @@ public: std::optional title_id = {}); void StartRead(u64 dvd_offset, u32 length, const DiscIO::Partition& partition, - DVDInterface::ReplyType reply_type, s64 ticks_until_completion); + DVD::ReplyType reply_type, s64 ticks_until_completion); void StartReadToEmulatedRAM(u32 output_address, u64 dvd_offset, u32 length, - const DiscIO::Partition& partition, - DVDInterface::ReplyType reply_type, s64 ticks_until_completion); + const DiscIO::Partition& partition, DVD::ReplyType reply_type, + s64 ticks_until_completion); private: void StartDVDThread(); @@ -95,7 +95,7 @@ private: void WaitUntilIdle(); void StartReadInternal(bool copy_to_ram, u32 output_address, u64 dvd_offset, u32 length, - const DiscIO::Partition& partition, DVDInterface::ReplyType reply_type, + const DiscIO::Partition& partition, DVD::ReplyType reply_type, s64 ticks_until_completion); static void GlobalFinishRead(Core::System& system, u64 id, s64 cycles_late); @@ -114,7 +114,7 @@ private: // This determines which code DVDInterface will run to reply // to the emulated software. We can't use callbacks, // because function pointers can't be stored in savestates. - DVDInterface::ReplyType reply_type = DVDInterface::ReplyType::NoReply; + DVD::ReplyType reply_type = DVD::ReplyType::NoReply; // IDs are used to uniquely identify a request. They must not be // identical to IDs of any other requests that currently exist, but diff --git a/Source/Core/Core/HW/WII_IPC.cpp b/Source/Core/Core/HW/WII_IPC.cpp index 5aba56709d..24e1c0a3be 100644 --- a/Source/Core/Core/HW/WII_IPC.cpp +++ b/Source/Core/Core/HW/WII_IPC.cpp @@ -214,7 +214,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) if (g_gpio_out[GPIO::DO_EJECT]) { INFO_LOG_FMT(WII_IPC, "Ejecting disc due to GPIO write"); - system.GetDVDInterface().EjectDisc(DVDInterface::EjectCause::Software); + system.GetDVDInterface().EjectDisc(DVD::EjectCause::Software); } // SENSOR_BAR is checked by WiimoteEmu::CameraLogic // TODO: AVE, SLOT_LED @@ -247,7 +247,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) if (g_gpio_out[GPIO::DO_EJECT]) { INFO_LOG_FMT(WII_IPC, "Ejecting disc due to GPIO write"); - system.GetDVDInterface().EjectDisc(DVDInterface::EjectCause::Software); + system.GetDVDInterface().EjectDisc(DVD::EjectCause::Software); } // SENSOR_BAR is checked by WiimoteEmu::CameraLogic // TODO: AVE, SLOT_LED diff --git a/Source/Core/Core/IOS/DI/DI.cpp b/Source/Core/Core/IOS/DI/DI.cpp index abf26512a7..a270e7351a 100644 --- a/Source/Core/Core/IOS/DI/DI.cpp +++ b/Source/Core/Core/IOS/DI/DI.cpp @@ -214,8 +214,8 @@ std::optional DIDevice::StartIOCtl(const IOCtlRequest& reque return DIResult::SecurityError; } m_last_length = position; // An actual mistake in IOS - system.GetDVDInterface().PerformDecryptingRead( - position, length, request.buffer_out, m_current_partition, DVDInterface::ReplyType::IOS); + system.GetDVDInterface().PerformDecryptingRead(position, length, request.buffer_out, + m_current_partition, DVD::ReplyType::IOS); return {}; } case DIIoctl::DVDLowWaitForCoverClose: @@ -274,12 +274,12 @@ std::optional DIDevice::StartIOCtl(const IOCtlRequest& reque } case DIIoctl::DVDLowMaskCoverInterrupt: INFO_LOG_FMT(IOS_DI, "DVDLowMaskCoverInterrupt"); - system.GetDVDInterface().SetInterruptEnabled(DVDInterface::DIInterruptType::CVRINT, false); + system.GetDVDInterface().SetInterruptEnabled(DVD::DIInterruptType::CVRINT, false); DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DI_INTERRUPT_MASK_COMMAND); return DIResult::Success; case DIIoctl::DVDLowClearCoverInterrupt: DEBUG_LOG_FMT(IOS_DI, "DVDLowClearCoverInterrupt"); - system.GetDVDInterface().ClearInterrupt(DVDInterface::DIInterruptType::CVRINT); + system.GetDVDInterface().ClearInterrupt(DVD::DIInterruptType::CVRINT); return DIResult::Success; case DIIoctl::DVDLowUnmaskStatusInterrupts: INFO_LOG_FMT(IOS_DI, "DVDLowUnmaskStatusInterrupts"); @@ -295,7 +295,7 @@ std::optional DIDevice::StartIOCtl(const IOCtlRequest& reque } case DIIoctl::DVDLowUnmaskCoverInterrupt: INFO_LOG_FMT(IOS_DI, "DVDLowUnmaskCoverInterrupt"); - system.GetDVDInterface().SetInterruptEnabled(DVDInterface::DIInterruptType::CVRINT, true); + system.GetDVDInterface().SetInterruptEnabled(DVD::DIInterruptType::CVRINT, true); DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DI_INTERRUPT_MASK_COMMAND); return DIResult::Success; case DIIoctl::DVDLowReset: @@ -364,7 +364,7 @@ std::optional DIDevice::StartIOCtl(const IOCtlRequest& reque DIMAR = request.buffer_out; m_last_length = length; DILENGTH = length; - system.GetDVDInterface().ForceOutOfBoundsRead(DVDInterface::ReplyType::IOS); + system.GetDVDInterface().ForceOutOfBoundsRead(DVD::ReplyType::IOS); return {}; } else @@ -581,7 +581,7 @@ std::optional DIDevice::StartDMATransfer(u32 command_length, m_last_length = command_length; DILENGTH = command_length; - Core::System::GetInstance().GetDVDInterface().ExecuteCommand(DVDInterface::ReplyType::IOS); + Core::System::GetInstance().GetDVDInterface().ExecuteCommand(DVD::ReplyType::IOS); // Reply will be posted when done by FinishIOCtl. return {}; } @@ -599,7 +599,7 @@ std::optional DIDevice::StartImmediateTransfer(const IOCtlRe m_executing_command->m_copy_diimmbuf = write_to_buf; - Core::System::GetInstance().GetDVDInterface().ExecuteCommand(DVDInterface::ReplyType::IOS); + Core::System::GetInstance().GetDVDInterface().ExecuteCommand(DVD::ReplyType::IOS); // Reply will be posted when done by FinishIOCtl. return {}; } @@ -614,15 +614,15 @@ static std::shared_ptr GetDevice() return std::static_pointer_cast(di); } -void DIDevice::InterruptFromDVDInterface(DVDInterface::DIInterruptType interrupt_type) +void DIDevice::InterruptFromDVDInterface(DVD::DIInterruptType interrupt_type) { DIResult result; switch (interrupt_type) { - case DVDInterface::DIInterruptType::TCINT: + case DVD::DIInterruptType::TCINT: result = DIResult::Success; break; - case DVDInterface::DIInterruptType::DEINT: + case DVD::DIInterruptType::DEINT: result = DIResult::DriveError; break; default: @@ -818,12 +818,12 @@ void DIDevice::ResetDIRegisters() // Clear transfer complete and error interrupts (normally r/z, but here we just directly write // zero) auto& di = Core::System::GetInstance().GetDVDInterface(); - di.ClearInterrupt(DVDInterface::DIInterruptType::TCINT); - di.ClearInterrupt(DVDInterface::DIInterruptType::DEINT); + di.ClearInterrupt(DVD::DIInterruptType::TCINT); + di.ClearInterrupt(DVD::DIInterruptType::DEINT); // Enable transfer complete and error interrupts, and disable cover interrupt - di.SetInterruptEnabled(DVDInterface::DIInterruptType::TCINT, true); - di.SetInterruptEnabled(DVDInterface::DIInterruptType::DEINT, true); - di.SetInterruptEnabled(DVDInterface::DIInterruptType::CVRINT, false); + di.SetInterruptEnabled(DVD::DIInterruptType::TCINT, true); + di.SetInterruptEnabled(DVD::DIInterruptType::DEINT, true); + di.SetInterruptEnabled(DVD::DIInterruptType::CVRINT, false); // Close the current partition, if there is one ChangePartition(DiscIO::PARTITION_NONE); } diff --git a/Source/Core/Core/IOS/DI/DI.h b/Source/Core/Core/IOS/DI/DI.h index f2d5307f68..9b8acb37b9 100644 --- a/Source/Core/Core/IOS/DI/DI.h +++ b/Source/Core/Core/IOS/DI/DI.h @@ -15,7 +15,7 @@ class CBoot; class PointerWrap; -namespace DVDInterface +namespace DVD { enum class DIInterruptType : int; } @@ -40,7 +40,7 @@ class DIDevice : public Device public: DIDevice(Kernel& ios, const std::string& device_name); - static void InterruptFromDVDInterface(DVDInterface::DIInterruptType interrupt_type); + static void InterruptFromDVDInterface(DVD::DIInterruptType interrupt_type); static DiscIO::Partition GetCurrentPartition(); void DoState(PointerWrap& p) override; diff --git a/Source/Core/Core/System.cpp b/Source/Core/Core/System.cpp index 361d837875..e274b07cca 100644 --- a/Source/Core/Core/System.cpp +++ b/Source/Core/Core/System.cpp @@ -50,7 +50,7 @@ struct System::Impl CommandProcessor::CommandProcessorManager m_command_processor; CPU::CPUManager m_cpu; DSP::DSPManager m_dsp; - DVDInterface::DVDInterfaceManager m_dvd_interface; + DVD::DVDInterfaceManager m_dvd_interface; DVDThread::DVDThreadManager m_dvd_thread; ExpansionInterface::ExpansionInterfaceState m_expansion_interface_state; Fifo::FifoManager m_fifo; @@ -138,7 +138,7 @@ DSP::DSPManager& System::GetDSP() const return m_impl->m_dsp; } -DVDInterface::DVDInterfaceManager& System::GetDVDInterface() const +DVD::DVDInterfaceManager& System::GetDVDInterface() const { return m_impl->m_dvd_interface; } diff --git a/Source/Core/Core/System.h b/Source/Core/Core/System.h index 2ec79e3051..6ad44d59f7 100644 --- a/Source/Core/Core/System.h +++ b/Source/Core/Core/System.h @@ -31,7 +31,7 @@ namespace DSP { class DSPManager; } -namespace DVDInterface +namespace DVD { class DVDInterfaceManager; } @@ -127,7 +127,7 @@ public: CoreTiming::CoreTimingManager& GetCoreTiming() const; CommandProcessor::CommandProcessorManager& GetCommandProcessor() const; DSP::DSPManager& GetDSP() const; - DVDInterface::DVDInterfaceManager& GetDVDInterface() const; + DVD::DVDInterfaceManager& GetDVDInterface() const; DVDThread::DVDThreadManager& GetDVDThread() const; ExpansionInterface::ExpansionInterfaceState& GetExpansionInterfaceState() const; Fifo::FifoManager& GetFifo() const; diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 604400f1c3..ac34999c4d 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -752,9 +752,8 @@ void MainWindow::ChangeDisc() void MainWindow::EjectDisc() { - Core::RunAsCPUThread([] { - Core::System::GetInstance().GetDVDInterface().EjectDisc(DVDInterface::EjectCause::User); - }); + Core::RunAsCPUThread( + [] { Core::System::GetInstance().GetDVDInterface().EjectDisc(DVD::EjectCause::User); }); } void MainWindow::OpenUserFolder()