DVDInterface: Remove GetVolume

For thread safety reasons, the currently inserted volume must
only be accessed by the DVD thread (or by the CPU thread if it
calls DVDThread::WaitUntilIdle() first). After this commit,
only DVDThread.cpp can access the volume, which prevents code in
other files from accessing the volume in a non-threadsafe way.
This commit is contained in:
JosJuice 2016-09-24 14:43:03 +02:00
commit 2a2db16087
8 changed files with 157 additions and 81 deletions

View file

@ -761,20 +761,11 @@ void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd)
// the disc header instead of the TMD. They can differ.
// (IOS HLE ES calls us with a TMDReader rather than a volume when launching
// a disc game, because ES has no reason to be accessing the disc directly.)
if (DVDInterface::IsDiscInside())
if (!DVDThread::UpdateRunningGameMetadata(tmd_title_id))
{
DVDThread::WaitUntilIdle();
const DiscIO::IVolume& volume = DVDInterface::GetVolume();
u64 volume_title_id;
if (volume.GetTitleID(&volume_title_id) && volume_title_id == tmd_title_id)
{
SetRunningGameMetadata(volume.GetGameID(), volume_title_id, volume.GetRevision());
return;
}
// If not launching a disc game, just read everything from the TMD.
SetRunningGameMetadata(tmd.GetGameID(), tmd_title_id, tmd.GetTitleVersion());
}
// If not launching a disc game, just read everything from the TMD.
SetRunningGameMetadata(tmd.GetGameID(), tmd_title_id, tmd.GetTitleVersion());
}
void SConfig::SetRunningGameMetadata(const std::string& game_id, u64 title_id, u16 revision)