Add an option to eject the disc

This commit is contained in:
JosJuice 2017-09-17 11:35:26 +02:00
commit e4faabb763
9 changed files with 24 additions and 3 deletions

View file

@ -468,6 +468,12 @@ static void InsertDiscCallback(u64 userdata, s64 cyclesLate)
s_disc_path_to_insert.clear();
}
// Must only be called on the CPU thread
void EjectDisc()
{
CoreTiming::ScheduleEvent(0, s_eject_disc);
}
// Must only be called on the CPU thread
void ChangeDisc(const std::string& new_path)
{
@ -477,10 +483,10 @@ void ChangeDisc(const std::string& new_path)
return;
}
s_disc_path_to_insert = new_path;
CoreTiming::ScheduleEvent(0, s_eject_disc);
CoreTiming::ScheduleEvent(SystemTimers::GetTicksPerSecond(), s_insert_disc);
EjectDisc();
s_disc_path_to_insert = new_path;
CoreTiming::ScheduleEvent(SystemTimers::GetTicksPerSecond(), s_insert_disc);
Movie::SignalDiscChange(new_path);
}

View file

@ -113,6 +113,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
void SetDisc(std::unique_ptr<DiscIO::Volume> disc);
bool IsDiscInside();
void EjectDisc(); // Must only be called on the CPU thread
void ChangeDisc(const std::string& new_path); // Must only be called on the CPU thread
// This function returns true and calls SConfig::SetRunningGameMetadata(Volume&, Partition&)