|
|
|
|
@ -976,39 +976,6 @@ void MainWindow::populateSaveStateMenu(std::string_view game_serial, QMenu* menu
|
|
|
|
|
add_slot(tr("Global Save %1 (%2)"), tr("Global Save %1 (Empty)"), empty_serial, static_cast<s32>(slot));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::populateChangeDiscSubImageMenu(QMenu* menu, QActionGroup* action_group)
|
|
|
|
|
{
|
|
|
|
|
if (!s_system_valid)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (System::HasMediaSubImages())
|
|
|
|
|
{
|
|
|
|
|
const u32 count = System::GetMediaSubImageCount();
|
|
|
|
|
const u32 current = System::GetMediaSubImageIndex();
|
|
|
|
|
for (u32 i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
QAction* action = action_group->addAction(QString::fromStdString(System::GetMediaSubImageTitle(i)));
|
|
|
|
|
action->setCheckable(true);
|
|
|
|
|
action->setChecked(i == current);
|
|
|
|
|
connect(action, &QAction::triggered, [i]() { g_emu_thread->changeDiscFromPlaylist(i); });
|
|
|
|
|
menu->addAction(action);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (const GameDatabase::Entry* entry = System::GetGameDatabaseEntry(); entry && !entry->disc_set_serials.empty())
|
|
|
|
|
{
|
|
|
|
|
auto lock = GameList::GetLock();
|
|
|
|
|
for (const auto& [title, glentry] : GameList::GetMatchingEntriesForSerial(entry->disc_set_serials))
|
|
|
|
|
{
|
|
|
|
|
QAction* action = action_group->addAction(QString::fromStdString(title));
|
|
|
|
|
QString path = QString::fromStdString(glentry->path);
|
|
|
|
|
action->setCheckable(true);
|
|
|
|
|
action->setChecked(path == s_current_game_path);
|
|
|
|
|
connect(action, &QAction::triggered, [path = std::move(path)]() { g_emu_thread->changeDisc(path, false, true); });
|
|
|
|
|
menu->addAction(action);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::onCheatsActionTriggered()
|
|
|
|
|
{
|
|
|
|
|
m_ui.menuCheats->exec(QCursor::pos());
|
|
|
|
|
@ -1020,12 +987,8 @@ void MainWindow::onCheatsMenuAboutToShow()
|
|
|
|
|
connect(m_ui.menuCheats->addAction(tr("Select Cheats...")), &QAction::triggered, this,
|
|
|
|
|
[this]() { openGamePropertiesForCurrentGame("Cheats"); });
|
|
|
|
|
m_ui.menuCheats->addSeparator();
|
|
|
|
|
populateCheatsMenu(m_ui.menuCheats);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::populateCheatsMenu(QMenu* menu)
|
|
|
|
|
{
|
|
|
|
|
Host::RunOnCPUThread([menu]() {
|
|
|
|
|
Host::RunOnCPUThread([menu = m_ui.menuCheats]() {
|
|
|
|
|
if (!System::IsValid())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
@ -1237,16 +1200,41 @@ void MainWindow::onChangeDiscFromDeviceActionTriggered()
|
|
|
|
|
|
|
|
|
|
void MainWindow::onChangeDiscMenuAboutToShow()
|
|
|
|
|
{
|
|
|
|
|
populateChangeDiscSubImageMenu(m_ui.menuChangeDisc, m_ui.actionGroupChangeDiscSubImages);
|
|
|
|
|
}
|
|
|
|
|
// clean up temporary menu items, they're owned by the QMenu so they get deleted here. the main QActions do not
|
|
|
|
|
m_ui.menuChangeDisc->clear();
|
|
|
|
|
|
|
|
|
|
m_ui.menuChangeDisc->addAction(m_ui.actionChangeDiscFromFile);
|
|
|
|
|
m_ui.menuChangeDisc->addAction(m_ui.actionChangeDiscFromDevice);
|
|
|
|
|
m_ui.menuChangeDisc->addAction(m_ui.actionChangeDiscFromGameList);
|
|
|
|
|
m_ui.menuChangeDisc->addAction(m_ui.actionRemoveDisc);
|
|
|
|
|
m_ui.menuChangeDisc->addSeparator();
|
|
|
|
|
|
|
|
|
|
if (!s_system_valid)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
void MainWindow::onChangeDiscMenuAboutToHide()
|
|
|
|
|
if (System::HasMediaSubImages())
|
|
|
|
|
{
|
|
|
|
|
for (QAction* action : m_ui.actionGroupChangeDiscSubImages->actions())
|
|
|
|
|
const u32 count = System::GetMediaSubImageCount();
|
|
|
|
|
const u32 current = System::GetMediaSubImageIndex();
|
|
|
|
|
for (u32 i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
m_ui.actionGroupChangeDiscSubImages->removeAction(action);
|
|
|
|
|
m_ui.menuChangeDisc->removeAction(action);
|
|
|
|
|
action->deleteLater();
|
|
|
|
|
QAction* action = m_ui.menuChangeDisc->addAction(QString::fromStdString(System::GetMediaSubImageTitle(i)));
|
|
|
|
|
action->setCheckable(true);
|
|
|
|
|
action->setChecked(i == current);
|
|
|
|
|
connect(action, &QAction::triggered, [i]() { g_emu_thread->changeDiscFromPlaylist(i); });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (const GameDatabase::Entry* entry = System::GetGameDatabaseEntry(); entry && !entry->disc_set_serials.empty())
|
|
|
|
|
{
|
|
|
|
|
auto lock = GameList::GetLock();
|
|
|
|
|
for (const auto& [title, glentry] : GameList::GetMatchingEntriesForSerial(entry->disc_set_serials))
|
|
|
|
|
{
|
|
|
|
|
QAction* action = m_ui.menuChangeDisc->addAction(QString::fromStdString(title));
|
|
|
|
|
QString path = QString::fromStdString(glentry->path);
|
|
|
|
|
action->setCheckable(true);
|
|
|
|
|
action->setChecked(path == s_current_game_path);
|
|
|
|
|
connect(action, &QAction::triggered, [path = std::move(path)]() { g_emu_thread->changeDisc(path, false, true); });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -2029,7 +2017,6 @@ void MainWindow::connectSignals()
|
|
|
|
|
connect(m_ui.actionChangeDiscFromGameList, &QAction::triggered, this,
|
|
|
|
|
&MainWindow::onChangeDiscFromGameListActionTriggered);
|
|
|
|
|
connect(m_ui.menuChangeDisc, &QMenu::aboutToShow, this, &MainWindow::onChangeDiscMenuAboutToShow);
|
|
|
|
|
connect(m_ui.menuChangeDisc, &QMenu::aboutToHide, this, &MainWindow::onChangeDiscMenuAboutToHide);
|
|
|
|
|
connect(m_ui.menuLoadState, &QMenu::aboutToShow, this, &MainWindow::onLoadStateMenuAboutToShow);
|
|
|
|
|
connect(m_ui.menuSaveState, &QMenu::aboutToShow, this, &MainWindow::onSaveStateMenuAboutToShow);
|
|
|
|
|
connect(m_ui.menuCheats, &QMenu::aboutToShow, this, &MainWindow::onCheatsMenuAboutToShow);
|
|
|
|
|
|