HW/DVD: Rename DVDInterface namespace to DVD.

This commit is contained in:
Admiral H. Curtiss 2023-03-10 18:33:09 +01:00
parent dca8e9dc1e
commit ee35103ed9
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
11 changed files with 44 additions and 47 deletions

View File

@ -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, // 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) // 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; return true;
} }

View File

@ -63,7 +63,7 @@ constexpr u64 DVD_ECC_BLOCK_SIZE = 16 * DVD_SECTOR_SIZE;
// is already buffered. Measured in bytes per second. // is already buffered. Measured in bytes per second.
constexpr u64 BUFFER_TRANSFER_RATE = 32 * 1024 * 1024; constexpr u64 BUFFER_TRANSFER_RATE = 32 * 1024 * 1024;
namespace DVDInterface namespace DVD
{ {
// internal hardware addresses // internal hardware addresses
constexpr u32 DI_STATUS_REGISTER = 0x00; 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()); ticks_until_completion * 1000000 / SystemTimers::GetTicksPerSecond());
} }
} // namespace DVDInterface } // namespace DVD

View File

@ -33,7 +33,7 @@ namespace MMIO
class Mapping; class Mapping;
} }
namespace DVDInterface namespace DVD
{ {
enum class DICommand : u8 enum class DICommand : u8
{ {
@ -301,4 +301,4 @@ private:
Core::System& m_system; Core::System& m_system;
}; };
} // namespace DVDInterface } // namespace DVD

View File

@ -210,15 +210,14 @@ void DVDThreadManager::WaitUntilIdle()
} }
void DVDThreadManager::StartRead(u64 dvd_offset, u32 length, const DiscIO::Partition& partition, 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); StartReadInternal(false, 0, dvd_offset, length, partition, reply_type, ticks_until_completion);
} }
void DVDThreadManager::StartReadToEmulatedRAM(u32 output_address, u64 dvd_offset, u32 length, void DVDThreadManager::StartReadToEmulatedRAM(u32 output_address, u64 dvd_offset, u32 length,
const DiscIO::Partition& partition, const DiscIO::Partition& partition,
DVDInterface::ReplyType reply_type, DVD::ReplyType reply_type, s64 ticks_until_completion)
s64 ticks_until_completion)
{ {
StartReadInternal(true, output_address, dvd_offset, length, partition, reply_type, StartReadInternal(true, output_address, dvd_offset, length, partition, reply_type,
ticks_until_completion); 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, void DVDThreadManager::StartReadInternal(bool copy_to_ram, u32 output_address, u64 dvd_offset,
u32 length, const DiscIO::Partition& partition, u32 length, const DiscIO::Partition& partition,
DVDInterface::ReplyType reply_type, DVD::ReplyType reply_type, s64 ticks_until_completion)
s64 ticks_until_completion)
{ {
ASSERT(Core::IsCPUThread()); ASSERT(Core::IsCPUThread());
@ -306,14 +304,14 @@ void DVDThreadManager::FinishRead(u64 id, s64 cycles_late)
(SystemTimers::GetTicksPerSecond() / 1000000)); (SystemTimers::GetTicksPerSecond() / 1000000));
auto& dvd_interface = m_system.GetDVDInterface(); auto& dvd_interface = m_system.GetDVDInterface();
DVDInterface::DIInterruptType interrupt; DVD::DIInterruptType interrupt;
if (buffer.size() != request.length) if (buffer.size() != request.length)
{ {
PanicAlertFmtT("The disc could not be read (at {0:#x} - {1:#x}).", request.dvd_offset, PanicAlertFmtT("The disc could not be read (at {0:#x} - {1:#x}).", request.dvd_offset,
request.dvd_offset + request.length); request.dvd_offset + request.length);
dvd_interface.SetDriveError(DVDInterface::DriveError::ReadError); dvd_interface.SetDriveError(DVD::DriveError::ReadError);
interrupt = DVDInterface::DIInterruptType::DEINT; interrupt = DVD::DIInterruptType::DEINT;
} }
else else
{ {
@ -323,7 +321,7 @@ void DVDThreadManager::FinishRead(u64 id, s64 cycles_late)
memory.CopyToEmu(request.output_address, buffer.data(), request.length); 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 // Notify the emulated software that the command has been executed

View File

@ -34,7 +34,7 @@ namespace DiscIO
struct Partition; struct Partition;
} }
namespace DVDInterface namespace DVD
{ {
enum class ReplyType : u32; enum class ReplyType : u32;
} }
@ -84,10 +84,10 @@ public:
std::optional<u64> title_id = {}); std::optional<u64> title_id = {});
void StartRead(u64 dvd_offset, u32 length, const DiscIO::Partition& partition, 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, void StartReadToEmulatedRAM(u32 output_address, u64 dvd_offset, u32 length,
const DiscIO::Partition& partition, const DiscIO::Partition& partition, DVD::ReplyType reply_type,
DVDInterface::ReplyType reply_type, s64 ticks_until_completion); s64 ticks_until_completion);
private: private:
void StartDVDThread(); void StartDVDThread();
@ -95,7 +95,7 @@ private:
void WaitUntilIdle(); void WaitUntilIdle();
void StartReadInternal(bool copy_to_ram, u32 output_address, u64 dvd_offset, u32 length, 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); s64 ticks_until_completion);
static void GlobalFinishRead(Core::System& system, u64 id, s64 cycles_late); 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 // This determines which code DVDInterface will run to reply
// to the emulated software. We can't use callbacks, // to the emulated software. We can't use callbacks,
// because function pointers can't be stored in savestates. // 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 // IDs are used to uniquely identify a request. They must not be
// identical to IDs of any other requests that currently exist, but // identical to IDs of any other requests that currently exist, but

View File

@ -214,7 +214,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
if (g_gpio_out[GPIO::DO_EJECT]) if (g_gpio_out[GPIO::DO_EJECT])
{ {
INFO_LOG_FMT(WII_IPC, "Ejecting disc due to GPIO write"); 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 // SENSOR_BAR is checked by WiimoteEmu::CameraLogic
// TODO: AVE, SLOT_LED // TODO: AVE, SLOT_LED
@ -247,7 +247,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
if (g_gpio_out[GPIO::DO_EJECT]) if (g_gpio_out[GPIO::DO_EJECT])
{ {
INFO_LOG_FMT(WII_IPC, "Ejecting disc due to GPIO write"); 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 // SENSOR_BAR is checked by WiimoteEmu::CameraLogic
// TODO: AVE, SLOT_LED // TODO: AVE, SLOT_LED

View File

@ -214,8 +214,8 @@ std::optional<DIDevice::DIResult> DIDevice::StartIOCtl(const IOCtlRequest& reque
return DIResult::SecurityError; return DIResult::SecurityError;
} }
m_last_length = position; // An actual mistake in IOS m_last_length = position; // An actual mistake in IOS
system.GetDVDInterface().PerformDecryptingRead( system.GetDVDInterface().PerformDecryptingRead(position, length, request.buffer_out,
position, length, request.buffer_out, m_current_partition, DVDInterface::ReplyType::IOS); m_current_partition, DVD::ReplyType::IOS);
return {}; return {};
} }
case DIIoctl::DVDLowWaitForCoverClose: case DIIoctl::DVDLowWaitForCoverClose:
@ -274,12 +274,12 @@ std::optional<DIDevice::DIResult> DIDevice::StartIOCtl(const IOCtlRequest& reque
} }
case DIIoctl::DVDLowMaskCoverInterrupt: case DIIoctl::DVDLowMaskCoverInterrupt:
INFO_LOG_FMT(IOS_DI, "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); DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DI_INTERRUPT_MASK_COMMAND);
return DIResult::Success; return DIResult::Success;
case DIIoctl::DVDLowClearCoverInterrupt: case DIIoctl::DVDLowClearCoverInterrupt:
DEBUG_LOG_FMT(IOS_DI, "DVDLowClearCoverInterrupt"); DEBUG_LOG_FMT(IOS_DI, "DVDLowClearCoverInterrupt");
system.GetDVDInterface().ClearInterrupt(DVDInterface::DIInterruptType::CVRINT); system.GetDVDInterface().ClearInterrupt(DVD::DIInterruptType::CVRINT);
return DIResult::Success; return DIResult::Success;
case DIIoctl::DVDLowUnmaskStatusInterrupts: case DIIoctl::DVDLowUnmaskStatusInterrupts:
INFO_LOG_FMT(IOS_DI, "DVDLowUnmaskStatusInterrupts"); INFO_LOG_FMT(IOS_DI, "DVDLowUnmaskStatusInterrupts");
@ -295,7 +295,7 @@ std::optional<DIDevice::DIResult> DIDevice::StartIOCtl(const IOCtlRequest& reque
} }
case DIIoctl::DVDLowUnmaskCoverInterrupt: case DIIoctl::DVDLowUnmaskCoverInterrupt:
INFO_LOG_FMT(IOS_DI, "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); DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DI_INTERRUPT_MASK_COMMAND);
return DIResult::Success; return DIResult::Success;
case DIIoctl::DVDLowReset: case DIIoctl::DVDLowReset:
@ -364,7 +364,7 @@ std::optional<DIDevice::DIResult> DIDevice::StartIOCtl(const IOCtlRequest& reque
DIMAR = request.buffer_out; DIMAR = request.buffer_out;
m_last_length = length; m_last_length = length;
DILENGTH = length; DILENGTH = length;
system.GetDVDInterface().ForceOutOfBoundsRead(DVDInterface::ReplyType::IOS); system.GetDVDInterface().ForceOutOfBoundsRead(DVD::ReplyType::IOS);
return {}; return {};
} }
else else
@ -581,7 +581,7 @@ std::optional<DIDevice::DIResult> DIDevice::StartDMATransfer(u32 command_length,
m_last_length = command_length; m_last_length = command_length;
DILENGTH = 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. // Reply will be posted when done by FinishIOCtl.
return {}; return {};
} }
@ -599,7 +599,7 @@ std::optional<DIDevice::DIResult> DIDevice::StartImmediateTransfer(const IOCtlRe
m_executing_command->m_copy_diimmbuf = write_to_buf; 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. // Reply will be posted when done by FinishIOCtl.
return {}; return {};
} }
@ -614,15 +614,15 @@ static std::shared_ptr<DIDevice> GetDevice()
return std::static_pointer_cast<DIDevice>(di); return std::static_pointer_cast<DIDevice>(di);
} }
void DIDevice::InterruptFromDVDInterface(DVDInterface::DIInterruptType interrupt_type) void DIDevice::InterruptFromDVDInterface(DVD::DIInterruptType interrupt_type)
{ {
DIResult result; DIResult result;
switch (interrupt_type) switch (interrupt_type)
{ {
case DVDInterface::DIInterruptType::TCINT: case DVD::DIInterruptType::TCINT:
result = DIResult::Success; result = DIResult::Success;
break; break;
case DVDInterface::DIInterruptType::DEINT: case DVD::DIInterruptType::DEINT:
result = DIResult::DriveError; result = DIResult::DriveError;
break; break;
default: default:
@ -818,12 +818,12 @@ void DIDevice::ResetDIRegisters()
// Clear transfer complete and error interrupts (normally r/z, but here we just directly write // Clear transfer complete and error interrupts (normally r/z, but here we just directly write
// zero) // zero)
auto& di = Core::System::GetInstance().GetDVDInterface(); auto& di = Core::System::GetInstance().GetDVDInterface();
di.ClearInterrupt(DVDInterface::DIInterruptType::TCINT); di.ClearInterrupt(DVD::DIInterruptType::TCINT);
di.ClearInterrupt(DVDInterface::DIInterruptType::DEINT); di.ClearInterrupt(DVD::DIInterruptType::DEINT);
// Enable transfer complete and error interrupts, and disable cover interrupt // Enable transfer complete and error interrupts, and disable cover interrupt
di.SetInterruptEnabled(DVDInterface::DIInterruptType::TCINT, true); di.SetInterruptEnabled(DVD::DIInterruptType::TCINT, true);
di.SetInterruptEnabled(DVDInterface::DIInterruptType::DEINT, true); di.SetInterruptEnabled(DVD::DIInterruptType::DEINT, true);
di.SetInterruptEnabled(DVDInterface::DIInterruptType::CVRINT, false); di.SetInterruptEnabled(DVD::DIInterruptType::CVRINT, false);
// Close the current partition, if there is one // Close the current partition, if there is one
ChangePartition(DiscIO::PARTITION_NONE); ChangePartition(DiscIO::PARTITION_NONE);
} }

View File

@ -15,7 +15,7 @@
class CBoot; class CBoot;
class PointerWrap; class PointerWrap;
namespace DVDInterface namespace DVD
{ {
enum class DIInterruptType : int; enum class DIInterruptType : int;
} }
@ -40,7 +40,7 @@ class DIDevice : public Device
public: public:
DIDevice(Kernel& ios, const std::string& device_name); 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(); static DiscIO::Partition GetCurrentPartition();
void DoState(PointerWrap& p) override; void DoState(PointerWrap& p) override;

View File

@ -50,7 +50,7 @@ struct System::Impl
CommandProcessor::CommandProcessorManager m_command_processor; CommandProcessor::CommandProcessorManager m_command_processor;
CPU::CPUManager m_cpu; CPU::CPUManager m_cpu;
DSP::DSPManager m_dsp; DSP::DSPManager m_dsp;
DVDInterface::DVDInterfaceManager m_dvd_interface; DVD::DVDInterfaceManager m_dvd_interface;
DVDThread::DVDThreadManager m_dvd_thread; DVDThread::DVDThreadManager m_dvd_thread;
ExpansionInterface::ExpansionInterfaceState m_expansion_interface_state; ExpansionInterface::ExpansionInterfaceState m_expansion_interface_state;
Fifo::FifoManager m_fifo; Fifo::FifoManager m_fifo;
@ -138,7 +138,7 @@ DSP::DSPManager& System::GetDSP() const
return m_impl->m_dsp; return m_impl->m_dsp;
} }
DVDInterface::DVDInterfaceManager& System::GetDVDInterface() const DVD::DVDInterfaceManager& System::GetDVDInterface() const
{ {
return m_impl->m_dvd_interface; return m_impl->m_dvd_interface;
} }

View File

@ -31,7 +31,7 @@ namespace DSP
{ {
class DSPManager; class DSPManager;
} }
namespace DVDInterface namespace DVD
{ {
class DVDInterfaceManager; class DVDInterfaceManager;
} }
@ -127,7 +127,7 @@ public:
CoreTiming::CoreTimingManager& GetCoreTiming() const; CoreTiming::CoreTimingManager& GetCoreTiming() const;
CommandProcessor::CommandProcessorManager& GetCommandProcessor() const; CommandProcessor::CommandProcessorManager& GetCommandProcessor() const;
DSP::DSPManager& GetDSP() const; DSP::DSPManager& GetDSP() const;
DVDInterface::DVDInterfaceManager& GetDVDInterface() const; DVD::DVDInterfaceManager& GetDVDInterface() const;
DVDThread::DVDThreadManager& GetDVDThread() const; DVDThread::DVDThreadManager& GetDVDThread() const;
ExpansionInterface::ExpansionInterfaceState& GetExpansionInterfaceState() const; ExpansionInterface::ExpansionInterfaceState& GetExpansionInterfaceState() const;
Fifo::FifoManager& GetFifo() const; Fifo::FifoManager& GetFifo() const;

View File

@ -752,9 +752,8 @@ void MainWindow::ChangeDisc()
void MainWindow::EjectDisc() void MainWindow::EjectDisc()
{ {
Core::RunAsCPUThread([] { Core::RunAsCPUThread(
Core::System::GetInstance().GetDVDInterface().EjectDisc(DVDInterface::EjectCause::User); [] { Core::System::GetInstance().GetDVDInterface().EjectDisc(DVD::EjectCause::User); });
});
} }
void MainWindow::OpenUserFolder() void MainWindow::OpenUserFolder()