mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 17:19:18 +01:00
GraphicPacksWindow: Disable update button when a game is running (#1137)
This commit is contained in:
parent
111e383d1b
commit
4f3d4624f5
@ -110,14 +110,6 @@ void deleteDownloadedGraphicPacks()
|
|||||||
|
|
||||||
void DownloadGraphicPacksWindow::UpdateThread()
|
void DownloadGraphicPacksWindow::UpdateThread()
|
||||||
{
|
{
|
||||||
if (CafeSystem::IsTitleRunning())
|
|
||||||
{
|
|
||||||
wxMessageBox(_("Graphic packs cannot be updated while a game is running."), _("Graphic packs"), 5, this->GetParent());
|
|
||||||
// cancel update
|
|
||||||
m_threadState = ThreadFinished;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get github url
|
// get github url
|
||||||
std::string githubAPIUrl;
|
std::string githubAPIUrl;
|
||||||
curlDownloadFileState_t tempDownloadState;
|
curlDownloadFileState_t tempDownloadState;
|
||||||
@ -326,8 +318,6 @@ DownloadGraphicPacksWindow::DownloadGraphicPacksWindow(wxWindow* parent)
|
|||||||
|
|
||||||
|
|
||||||
m_downloadState = std::make_unique<curlDownloadFileState_t>();
|
m_downloadState = std::make_unique<curlDownloadFileState_t>();
|
||||||
|
|
||||||
m_thread = std::thread(&DownloadGraphicPacksWindow::UpdateThread, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadGraphicPacksWindow::~DownloadGraphicPacksWindow()
|
DownloadGraphicPacksWindow::~DownloadGraphicPacksWindow()
|
||||||
@ -344,6 +334,12 @@ const std::string& DownloadGraphicPacksWindow::GetException() const
|
|||||||
|
|
||||||
int DownloadGraphicPacksWindow::ShowModal()
|
int DownloadGraphicPacksWindow::ShowModal()
|
||||||
{
|
{
|
||||||
|
if(CafeSystem::IsTitleRunning())
|
||||||
|
{
|
||||||
|
wxMessageBox(_("Graphic packs cannot be updated while a game is running."), _("Graphic packs"), 5, this->GetParent());
|
||||||
|
return wxID_CANCEL;
|
||||||
|
}
|
||||||
|
m_thread = std::thread(&DownloadGraphicPacksWindow::UpdateThread, this);
|
||||||
wxDialog::ShowModal();
|
wxDialog::ShowModal();
|
||||||
return m_threadState == ThreadCanceled ? wxID_CANCEL : wxID_OK;
|
return m_threadState == ThreadCanceled ? wxID_CANCEL : wxID_OK;
|
||||||
}
|
}
|
||||||
|
@ -319,6 +319,7 @@ GraphicPacksWindow2::GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_fil
|
|||||||
|
|
||||||
SetSizer(main_sizer);
|
SetSizer(main_sizer);
|
||||||
|
|
||||||
|
UpdateTitleRunning(CafeSystem::IsTitleRunning());
|
||||||
FillGraphicPackList();
|
FillGraphicPackList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,6 +677,15 @@ void GraphicPacksWindow2::OnInstalledGamesChanged(wxCommandEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicPacksWindow2::UpdateTitleRunning(bool running)
|
||||||
|
{
|
||||||
|
m_update_graphicPacks->Enable(!running);
|
||||||
|
if(running)
|
||||||
|
m_update_graphicPacks->SetToolTip(_("Graphic packs cannot be updated while a game is running."));
|
||||||
|
else
|
||||||
|
m_update_graphicPacks->SetToolTip(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicPacksWindow2::ReloadPack(const GraphicPackPtr& graphic_pack) const
|
void GraphicPacksWindow2::ReloadPack(const GraphicPackPtr& graphic_pack) const
|
||||||
{
|
{
|
||||||
if (graphic_pack->HasShaders() || graphic_pack->HasPatches() || graphic_pack->HasCustomVSyncFrequency())
|
if (graphic_pack->HasShaders() || graphic_pack->HasPatches() || graphic_pack->HasCustomVSyncFrequency())
|
||||||
|
@ -21,6 +21,7 @@ public:
|
|||||||
~GraphicPacksWindow2();
|
~GraphicPacksWindow2();
|
||||||
|
|
||||||
static void RefreshGraphicPacks();
|
static void RefreshGraphicPacks();
|
||||||
|
void UpdateTitleRunning(bool running);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_filter;
|
std::string m_filter;
|
||||||
|
@ -625,6 +625,7 @@ bool MainWindow::FileLoad(const fs::path launchPath, wxLaunchGameEvent::INITIATE
|
|||||||
CreateCanvas();
|
CreateCanvas();
|
||||||
CafeSystem::LaunchForegroundTitle();
|
CafeSystem::LaunchForegroundTitle();
|
||||||
RecreateMenu();
|
RecreateMenu();
|
||||||
|
UpdateChildWindowTitleRunningState();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -683,6 +684,7 @@ void MainWindow::OnFileMenu(wxCommandEvent& event)
|
|||||||
RecreateMenu();
|
RecreateMenu();
|
||||||
CreateGameListAndStatusBar();
|
CreateGameListAndStatusBar();
|
||||||
DoLayout();
|
DoLayout();
|
||||||
|
UpdateChildWindowTitleRunningState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2320,6 +2322,14 @@ void MainWindow::RecreateMenu()
|
|||||||
SetMenuVisible(false);
|
SetMenuVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::UpdateChildWindowTitleRunningState()
|
||||||
|
{
|
||||||
|
const bool running = CafeSystem::IsTitleRunning();
|
||||||
|
|
||||||
|
if(m_graphic_pack_window)
|
||||||
|
m_graphic_pack_window->UpdateTitleRunning(running);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::RestoreSettingsAfterGameExited()
|
void MainWindow::RestoreSettingsAfterGameExited()
|
||||||
{
|
{
|
||||||
RecreateMenu();
|
RecreateMenu();
|
||||||
|
@ -21,6 +21,7 @@ class DebuggerWindow2;
|
|||||||
struct GameEntry;
|
struct GameEntry;
|
||||||
class DiscordPresence;
|
class DiscordPresence;
|
||||||
class TitleManager;
|
class TitleManager;
|
||||||
|
class GraphicPacksWindow2;
|
||||||
class wxLaunchGameEvent;
|
class wxLaunchGameEvent;
|
||||||
|
|
||||||
wxDECLARE_EVENT(wxEVT_LAUNCH_GAME, wxLaunchGameEvent);
|
wxDECLARE_EVENT(wxEVT_LAUNCH_GAME, wxLaunchGameEvent);
|
||||||
@ -146,6 +147,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void RecreateMenu();
|
void RecreateMenu();
|
||||||
|
void UpdateChildWindowTitleRunningState();
|
||||||
static wxString GetInitialWindowTitle();
|
static wxString GetInitialWindowTitle();
|
||||||
void ShowGettingStartedDialog();
|
void ShowGettingStartedDialog();
|
||||||
|
|
||||||
@ -163,7 +165,7 @@ private:
|
|||||||
MemorySearcherTool* m_toolWindow = nullptr;
|
MemorySearcherTool* m_toolWindow = nullptr;
|
||||||
TitleManager* m_title_manager = nullptr;
|
TitleManager* m_title_manager = nullptr;
|
||||||
PadViewFrame* m_padView = nullptr;
|
PadViewFrame* m_padView = nullptr;
|
||||||
wxWindow* m_graphic_pack_window = nullptr;
|
GraphicPacksWindow2* m_graphic_pack_window = nullptr;
|
||||||
|
|
||||||
wxTimer* m_timer;
|
wxTimer* m_timer;
|
||||||
wxPoint m_mouse_position{};
|
wxPoint m_mouse_position{};
|
||||||
|
Loading…
Reference in New Issue
Block a user