Qt: Disable Game Properties for PSF/GPUDump

This commit is contained in:
Stenzek
2025-11-30 14:53:45 +10:00
parent 6f80a199f1
commit 4a445a051d
5 changed files with 18 additions and 3 deletions

View File

@@ -1604,8 +1604,9 @@ void FullscreenUI::DrawPauseMenu()
DoToggleAnalogMode();
}
if (MenuButtonWithoutSummary(FSUI_ICONVSTR(ICON_FA_WRENCH, "Game Properties"),
has_game && !GPUThread::GetGameSerial().empty()))
if (MenuButtonWithoutSummary(
FSUI_ICONVSTR(ICON_FA_WRENCH, "Game Properties"),
has_game && GameList::CanEditGameSettingsForPath(GPUThread::GetGameSerial(), GPUThread::GetGamePath())))
{
BeginTransition([]() { SwitchToGameSettings(); });
}

View File

@@ -214,6 +214,11 @@ bool GameList::IsScannableFilename(std::string_view path)
return (System::IsDiscPath(path) || System::IsExePath(path) || System::IsPsfPath(path));
}
bool GameList::CanEditGameSettingsForPath(const std::string_view path, const std::string_view serial)
{
return (!path.empty() && !serial.empty() && !System::IsPsfPath(path) && !System::IsGPUDumpPath(path));
}
bool GameList::GetExeListEntry(const std::string& path, GameList::Entry* entry)
{
const auto fp = FileSystem::OpenManagedCFile(path.c_str(), "rb");

View File

@@ -115,6 +115,9 @@ size_t GetEntryCount();
bool IsGameListLoaded();
bool ShouldShowLocalizedTitles();
/// Returns true if the specified path should not have game properties saved.
bool CanEditGameSettingsForPath(const std::string_view path, const std::string_view serial);
/// Populates the game list with files in the configured directories.
/// If invalidate_cache is set, all files will be re-scanned.
/// If only_cache is set, no new files will be scanned, only those present in the cache.

View File

@@ -4251,7 +4251,7 @@ void System::UpdateRunningGame(const std::string& path, CDImage* image, bool boo
bool System::PopulateGameListEntryFromCurrentGame(GameList::Entry* entry, Error* error)
{
if (!IsValid() || IsReplayingGPUDump() || IsPsfPath(s_state.running_game_path))
if (!IsValid() || !GameList::CanEditGameSettingsForPath(s_state.running_game_path, s_state.running_game_serial))
{
Error::SetStringView(error, TRANSLATE_SV("System", "No valid game is running."));
return false;

View File

@@ -635,6 +635,7 @@ void MainWindow::onSystemGameChanged(const QString& path, const QString& game_se
s_locals.current_game_icon = getIconForGame(path);
updateWindowTitle();
updateEmulationActions();
}
void MainWindow::onSystemUndoStateAvailabilityChanged(bool available, quint64 timestamp)
@@ -2195,6 +2196,11 @@ void MainWindow::updateEmulationActions()
m_ui.toolBar->insertAction(m_ui.actionResumeLastState, m_ui.actionCloseGame);
m_ui.toolBar->removeAction(m_ui.actionResumeLastState);
}
m_ui.actionViewGameProperties->setEnabled(
!s_locals.current_game_path.isEmpty() && !s_locals.current_game_serial.isEmpty() &&
GameList::CanEditGameSettingsForPath(s_locals.current_game_path.toStdString(),
s_locals.current_game_serial.toStdString()));
}
else
{