Skip to content

Commit

Permalink
Don't do automatic disc switching when running e.g. the Wii Menu
Browse files Browse the repository at this point in the history
We only want automatic disc switching to happen when the game actually
is running, but software like the Wii Menu also uses DVDLowStopMotor.
  • Loading branch information
JosJuice committed Jan 4, 2019
1 parent bd665aa commit b608e80
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/Core/Core/HW/DVD/DVDInterface.cpp
Expand Up @@ -1039,7 +1039,8 @@ void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_addr
INFO_LOG(DVDINTERFACE, "DVDLowStopMotor %s %s", command_1 ? "eject" : "", INFO_LOG(DVDINTERFACE, "DVDLowStopMotor %s %s", command_1 ? "eject" : "",
command_2 ? "kill!" : ""); command_2 ? "kill!" : "");


bool auto_disc_change = Config::Get(Config::MAIN_AUTO_DISC_CHANGE) && !Movie::IsPlayingInput(); bool auto_disc_change = Config::Get(Config::MAIN_AUTO_DISC_CHANGE) &&
!Movie::IsPlayingInput() && DVDThread::IsInsertedDiscRunning();
if (auto_disc_change) if (auto_disc_change)
auto_disc_change = AutoChangeDisc(); auto_disc_change = AutoChangeDisc();
if (auto_disc_change) if (auto_disc_change)
Expand Down
10 changes: 10 additions & 0 deletions Source/Core/Core/HW/DVD/DVDThread.cpp
Expand Up @@ -216,6 +216,16 @@ IOS::ES::TicketReader GetTicket(const DiscIO::Partition& partition)
return s_disc->GetTicket(partition); return s_disc->GetTicket(partition);
} }


bool IsInsertedDiscRunning()
{
if (!s_disc)
return false;

WaitUntilIdle();

return SConfig::GetInstance().GetGameID() == s_disc->GetGameID();
}

bool UpdateRunningGameMetadata(const DiscIO::Partition& partition, std::optional<u64> title_id) bool UpdateRunningGameMetadata(const DiscIO::Partition& partition, std::optional<u64> title_id)
{ {
if (!s_disc) if (!s_disc)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/HW/DVD/DVDThread.h
Expand Up @@ -47,6 +47,7 @@ DiscIO::Platform GetDiscType();
u64 PartitionOffsetToRawOffset(u64 offset, const DiscIO::Partition& partition); u64 PartitionOffsetToRawOffset(u64 offset, const DiscIO::Partition& partition);
IOS::ES::TMDReader GetTMD(const DiscIO::Partition& partition); IOS::ES::TMDReader GetTMD(const DiscIO::Partition& partition);
IOS::ES::TicketReader GetTicket(const DiscIO::Partition& partition); IOS::ES::TicketReader GetTicket(const DiscIO::Partition& partition);
bool IsInsertedDiscRunning();
// This function returns true and calls SConfig::SetRunningGameMetadata(Volume&, Partition&) // This function returns true and calls SConfig::SetRunningGameMetadata(Volume&, Partition&)
// if both of the following conditions are true: // if both of the following conditions are true:
// - A disc is inserted // - A disc is inserted
Expand Down

0 comments on commit b608e80

Please sign in to comment.