diff --git a/Source/Core/Core/HW/DVD/DVDInterface.cpp b/Source/Core/Core/HW/DVD/DVDInterface.cpp index c5db7b09d6..cd3d6b10e6 100644 --- a/Source/Core/Core/HW/DVD/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVD/DVDInterface.cpp @@ -19,7 +19,6 @@ #include "Common/Logging/Log.h" #include "Core/ConfigManager.h" -#include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/HW/AudioInterface.h" #include "Core/HW/DVD/DVDMath.h" @@ -473,14 +472,8 @@ static void InsertDiscCallback(u64 userdata, s64 cyclesLate) s_disc_path_to_insert.clear(); } -// Can only be called by the host thread -void ChangeDiscAsHost(const std::string& new_path) -{ - Core::RunAsCPUThread([&] { ChangeDiscAsCPU(new_path); }); -} - -// Can only be called by the CPU thread -void ChangeDiscAsCPU(const std::string& new_path) +// Must only be called on the CPU thread +void ChangeDisc(const std::string& new_path) { if (!s_disc_path_to_insert.empty()) { diff --git a/Source/Core/Core/HW/DVD/DVDInterface.h b/Source/Core/Core/HW/DVD/DVDInterface.h index cc29e76c25..091d55a8a1 100644 --- a/Source/Core/Core/HW/DVD/DVDInterface.h +++ b/Source/Core/Core/HW/DVD/DVDInterface.h @@ -113,8 +113,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base); void SetDisc(std::unique_ptr disc); bool IsDiscInside(); -void ChangeDiscAsHost(const std::string& new_path); // Can only be called by the host thread -void ChangeDiscAsCPU(const std::string& new_path); // Can only be called by 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&) // if both of the following conditions are true: diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index b9c6f9867d..16ffdb7584 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -1180,7 +1180,7 @@ void PlayController(GCPadStatus* PadStatus, int controllerID) } if (found) { - DVDInterface::ChangeDiscAsCPU(path); + Core::RunAsCPUThread([&path] { DVDInterface::ChangeDisc(path); }); } else { diff --git a/Source/Core/DolphinQt2/GameList/GameList.cpp b/Source/Core/DolphinQt2/GameList/GameList.cpp index df4e9d161c..90510c5b04 100644 --- a/Source/Core/DolphinQt2/GameList/GameList.cpp +++ b/Source/Core/DolphinQt2/GameList/GameList.cpp @@ -417,7 +417,8 @@ void GameList::DeleteFile() void GameList::ChangeDisc() { - DVDInterface::ChangeDiscAsHost(GetSelectedGame()->GetFilePath().toStdString()); + Core::RunAsCPUThread( + [this] { DVDInterface::ChangeDisc(GetSelectedGame()->GetFilePath().toStdString()); }); } QSharedPointer GameList::GetSelectedGame() const diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 7bc9daab15..dd30bbd31c 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -143,7 +143,7 @@ void CRenderFrame::OnDropFiles(wxDropFilesEvent& event) } else { - DVDInterface::ChangeDiscAsHost(filepath); + Core::RunAsCPUThread([&filepath] { DVDInterface::ChangeDisc(filepath); }); } } diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 89726223dc..4c60ff9888 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -369,7 +369,7 @@ void CFrame::DoOpen(bool Boot) } else { - DVDInterface::ChangeDiscAsHost(WxStrToStr(path)); + Core::RunAsCPUThread([&path] { DVDInterface::ChangeDisc(WxStrToStr(path)); }); } } diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 5d91ca7193..ceb6894776 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -1557,7 +1557,7 @@ void GameListCtrl::OnChangeDisc(wxCommandEvent& WXUNUSED(event)) const GameListItem* iso = GetSelectedISO(); if (!iso || !Core::IsRunning()) return; - DVDInterface::ChangeDiscAsHost(WxStrToStr(iso->GetFileName())); + Core::RunAsCPUThread([&iso] { DVDInterface::ChangeDisc(WxStrToStr(iso->GetFileName())); }); } void GameListCtrl::OnSize(wxSizeEvent& event)