Add an option to eject the disc

This commit is contained in:
JosJuice
2017-09-17 11:35:26 +02:00
parent 3c770693a2
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&)

View File

@ -23,6 +23,7 @@
const std::string hotkey_labels[] = {
_trans("Open"),
_trans("Change Disc"),
_trans("Eject Disc"),
_trans("Refresh List"),
_trans("Toggle Pause"),
_trans("Stop"),

View File

@ -21,6 +21,7 @@ enum Hotkey
{
HK_OPEN,
HK_CHANGE_DISC,
HK_EJECT_DISC,
HK_REFRESH_LIST,
HK_PLAY_PAUSE,
HK_STOP,