Remove DVDInterface::ChangeDiscAsHost

There isn't much point in keeping this utility function around
now that RunAsCPUThread provides a simple way of running things
on the CPU thread.
This commit is contained in:
JosJuice 2017-09-17 11:12:02 +02:00
parent 29bfdbb36b
commit b6bc3bc7c9
7 changed files with 9 additions and 16 deletions

View file

@ -19,7 +19,6 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/HW/AudioInterface.h" #include "Core/HW/AudioInterface.h"
#include "Core/HW/DVD/DVDMath.h" #include "Core/HW/DVD/DVDMath.h"
@ -473,14 +472,8 @@ static void InsertDiscCallback(u64 userdata, s64 cyclesLate)
s_disc_path_to_insert.clear(); s_disc_path_to_insert.clear();
} }
// Can only be called by the host thread // Must only be called on the CPU thread
void ChangeDiscAsHost(const std::string& new_path) void ChangeDisc(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)
{ {
if (!s_disc_path_to_insert.empty()) if (!s_disc_path_to_insert.empty())
{ {

View file

@ -113,8 +113,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
void SetDisc(std::unique_ptr<DiscIO::Volume> disc); void SetDisc(std::unique_ptr<DiscIO::Volume> disc);
bool IsDiscInside(); bool IsDiscInside();
void ChangeDiscAsHost(const std::string& new_path); // Can only be called by the host thread void ChangeDisc(const std::string& new_path); // Must only be called on the CPU thread
void ChangeDiscAsCPU(const std::string& new_path); // Can only be called by the CPU thread
// 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:

View file

@ -1180,7 +1180,7 @@ void PlayController(GCPadStatus* PadStatus, int controllerID)
} }
if (found) if (found)
{ {
DVDInterface::ChangeDiscAsCPU(path); Core::RunAsCPUThread([&path] { DVDInterface::ChangeDisc(path); });
} }
else else
{ {

View file

@ -417,7 +417,8 @@ void GameList::DeleteFile()
void GameList::ChangeDisc() void GameList::ChangeDisc()
{ {
DVDInterface::ChangeDiscAsHost(GetSelectedGame()->GetFilePath().toStdString()); Core::RunAsCPUThread(
[this] { DVDInterface::ChangeDisc(GetSelectedGame()->GetFilePath().toStdString()); });
} }
QSharedPointer<GameFile> GameList::GetSelectedGame() const QSharedPointer<GameFile> GameList::GetSelectedGame() const

View file

@ -143,7 +143,7 @@ void CRenderFrame::OnDropFiles(wxDropFilesEvent& event)
} }
else else
{ {
DVDInterface::ChangeDiscAsHost(filepath); Core::RunAsCPUThread([&filepath] { DVDInterface::ChangeDisc(filepath); });
} }
} }

View file

@ -369,7 +369,7 @@ void CFrame::DoOpen(bool Boot)
} }
else else
{ {
DVDInterface::ChangeDiscAsHost(WxStrToStr(path)); Core::RunAsCPUThread([&path] { DVDInterface::ChangeDisc(WxStrToStr(path)); });
} }
} }

View file

@ -1557,7 +1557,7 @@ void GameListCtrl::OnChangeDisc(wxCommandEvent& WXUNUSED(event))
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso || !Core::IsRunning()) if (!iso || !Core::IsRunning())
return; return;
DVDInterface::ChangeDiscAsHost(WxStrToStr(iso->GetFileName())); Core::RunAsCPUThread([&iso] { DVDInterface::ChangeDisc(WxStrToStr(iso->GetFileName())); });
} }
void GameListCtrl::OnSize(wxSizeEvent& event) void GameListCtrl::OnSize(wxSizeEvent& event)