DVDInterface: Call SetDiscInside when setting volume

SetDiscInside is an implementation detail that callers shouldn't
have to call on their own.
This commit is contained in:
JosJuice 2016-01-30 18:35:19 +01:00
parent 489d90b6f3
commit 0abf875a3f
3 changed files with 11 additions and 14 deletions

View File

@ -267,7 +267,6 @@ bool CBoot::BootUp()
case SConfig::BOOT_ISO:
{
DVDInterface::SetVolumeName(_StartupPara.m_strFilename);
DVDInterface::SetDiscInside(DVDInterface::VolumeIsValid());
if (!DVDInterface::VolumeIsValid())
return false;
@ -353,8 +352,6 @@ bool CBoot::BootUp()
BS2Success = EmulatedBS2(dolWii);
}
DVDInterface::SetDiscInside(DVDInterface::VolumeIsValid());
if (!BS2Success)
{
// Set up MSR and the BAT SPR registers.
@ -414,8 +411,6 @@ bool CBoot::BootUp()
DVDInterface::SetVolumeDirectory(_StartupPara.m_strFilename, _StartupPara.bWii);
}
DVDInterface::SetDiscInside(DVDInterface::VolumeIsValid());
// Poor man's bootup
if (_StartupPara.bWii)
{
@ -450,13 +445,11 @@ bool CBoot::BootUp()
else if (!_StartupPara.m_strDefaultISO.empty())
DVDInterface::SetVolumeName(_StartupPara.m_strDefaultISO);
DVDInterface::SetDiscInside(DVDInterface::VolumeIsValid());
break;
// Bootstrap 2 (AKA: Initial Program Loader, "BIOS")
case SConfig::BOOT_BS2:
{
DVDInterface::SetDiscInside(DVDInterface::VolumeIsValid());
if (Load_BS2(_StartupPara.m_strBootROM))
{
if (LoadMapFromFilename())

View File

@ -264,7 +264,8 @@ static void EjectDiscCallback(u64 userdata, s64 cyclesLate);
static void InsertDiscCallback(u64 userdata, s64 cyclesLate);
static void FinishExecutingCommandCallback(u64 userdata, s64 cycles_late);
void SetLidOpen(bool _bOpen);
void SetDiscInside(bool disc_inside);
void SetLidOpen(bool open);
void UpdateInterrupts();
void GenerateDIInterrupt(DIInterruptType _DVDInterrupt);
@ -418,6 +419,8 @@ static void DTKStreamingCallback(const std::vector<u8>& audio_data, s64 cycles_l
void Init()
{
_assert_(!VolumeIsValid());
DVDThread::Start();
Reset();
@ -483,6 +486,7 @@ bool SetVolumeName(const std::string& disc_path)
{
DVDThread::WaitUntilIdle();
s_inserted_volume = DiscIO::CreateVolumeFromFilename(disc_path);
SetDiscInside(VolumeIsValid());
return VolumeIsValid();
}
@ -492,6 +496,7 @@ bool SetVolumeDirectory(const std::string& full_path, bool is_wii,
DVDThread::WaitUntilIdle();
s_inserted_volume =
DiscIO::CreateVolumeFromDirectory(full_path, is_wii, apploader_path, DOL_path);
SetDiscInside(VolumeIsValid());
return VolumeIsValid();
}
@ -534,7 +539,6 @@ static void InsertDiscCallback(u64 userdata, s64 cyclesLate)
SetVolumeName(old_path);
PanicAlertT("The disc that was about to be inserted couldn't be found.");
}
SetDiscInside(VolumeIsValid());
s_disc_path_to_insert.clear();
}

View File

@ -108,23 +108,23 @@ void DoState(PointerWrap& p);
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
// Direct disc access
// Disc access (don't call GetVolume unless you know that VolumeIsValid() == true)
const DiscIO::IVolume& GetVolume();
bool SetVolumeName(const std::string& disc_path);
bool SetVolumeDirectory(const std::string& disc_path, bool is_wii,
const std::string& apploader_path = "", const std::string& DOL_path = "");
bool VolumeIsValid();
// Disc detection and swapping
void SetDiscInside(bool _DiscInside);
bool IsDiscInside();
void ChangeDiscAsHost(const std::string& new_path); // Can only be called by the host thread
void ChangeDiscAsCPU(const std::string& new_path); // Can only be called by the CPU thread
// DVD Access Functions
// Direct access to DI for IOS HLE (simpler to implement than how real IOS accesses DI,
// and lets us skip encrypting/decrypting in some cases)
bool ChangePartition(u64 offset);
void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_address,
u32 output_length, bool reply_to_ios);
// Used by DVDThread
void FinishExecutingCommand(ReplyType reply_type, DIInterruptType interrupt_type, s64 cycles_late,
const std::vector<u8>& data = std::vector<u8>());