mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-26 12:16:20 +00:00
DVDThread: Fix thread safety
GetFileSystem will read from the volume the first time it is called, so it should only be called after WaitUntilIdle.
This commit is contained in:
parent
6658cf8a2f
commit
e97b78d8c7
1 changed files with 7 additions and 4 deletions
|
@ -396,16 +396,19 @@ static void DVDThread()
|
|||
}
|
||||
}
|
||||
|
||||
void ReadFile(std::string& fileName, std::vector<u8>& buf) {
|
||||
if (HasDisc()) {
|
||||
void ReadFile(std::string& fileName, std::vector<u8>& buf)
|
||||
{
|
||||
if (HasDisc())
|
||||
{
|
||||
WaitUntilIdle();
|
||||
const DiscIO::FileSystem* filesystem = s_disc->GetFileSystem(DiscIO::PARTITION_NONE);
|
||||
auto fileInfo = filesystem->FindFileInfo(fileName);
|
||||
auto fileSize = fileInfo->GetSize();
|
||||
WaitUntilIdle();
|
||||
buf.resize(fileSize);
|
||||
DiscIO::ReadFile(*s_disc, DiscIO::PARTITION_NONE, fileInfo.get(), buf.data(), fileSize);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
INFO_LOG(SLIPPI, "Failed to open file: %s", fileName.c_str());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue