System: Generate hash serials when running PS-EXE

Allows for per-game settings.
This commit is contained in:
Stenzek
2024-05-30 22:21:51 +10:00
parent 25bf2b3adc
commit 7682cd2c10
6 changed files with 75 additions and 36 deletions

View File

@ -1347,12 +1347,16 @@ void MainWindow::onViewGamePropertiesActionTriggered()
if (!s_system_valid)
return;
const std::string& path = System::GetDiscPath();
const std::string& serial = System::GetGameSerial();
if (path.empty() || serial.empty())
return;
Host::RunOnCPUThread([]() {
const std::string& path = System::GetDiscPath();
const std::string& serial = System::GetGameSerial();
if (path.empty() || serial.empty())
return;
SettingsWindow::openGamePropertiesDialog(path, serial, System::GetDiscRegion());
QtHost::RunOnUIThread([path = path, serial = serial]() {
SettingsWindow::openGamePropertiesDialog(path, System::GetGameTitle(), serial, System::GetDiscRegion());
});
});
}
void MainWindow::onGitHubRepositoryActionTriggered()
@ -1448,8 +1452,9 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
{
if (!entry->IsDiscSet())
{
connect(menu.addAction(tr("Properties...")), &QAction::triggered,
[entry]() { SettingsWindow::openGamePropertiesDialog(entry->path, entry->serial, entry->region); });
connect(menu.addAction(tr("Properties...")), &QAction::triggered, [entry]() {
SettingsWindow::openGamePropertiesDialog(entry->path, entry->title, entry->serial, entry->region);
});
connect(menu.addAction(tr("Open Containing Directory...")), &QAction::triggered, [this, entry]() {
const QFileInfo fi(QString::fromStdString(entry->path));
@ -1516,7 +1521,10 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
auto lock = GameList::GetLock();
const GameList::Entry* first_disc = GameList::GetFirstDiscSetMember(disc_set_name);
if (first_disc)
SettingsWindow::openGamePropertiesDialog(first_disc->path, first_disc->serial, first_disc->region);
{
SettingsWindow::openGamePropertiesDialog(first_disc->path, first_disc->title, first_disc->serial,
first_disc->region);
}
});
connect(menu.addAction(tr("Set Cover Image...")), &QAction::triggered,

View File

@ -611,7 +611,8 @@ void SettingsWindow::saveAndReloadGameSettings()
g_emu_thread->reloadGameSettings(false);
}
void SettingsWindow::openGamePropertiesDialog(const std::string& path, const std::string& serial, DiscRegion region)
void SettingsWindow::openGamePropertiesDialog(const std::string& path, const std::string& title,
const std::string& serial, DiscRegion region)
{
const GameDatabase::Entry* dentry = nullptr;
if (!System::IsExeFileName(path) && !System::IsPsfFileName(path))
@ -652,9 +653,8 @@ void SettingsWindow::openGamePropertiesDialog(const std::string& path, const std
if (FileSystem::FileExists(sif->GetFileName().c_str()))
sif->Load();
const QString window_title(tr("%1 [%2]")
.arg(dentry ? QtUtils::StringViewToQString(dentry->title) : QStringLiteral("<UNKNOWN>"))
.arg(QtUtils::StringViewToQString(real_serial)));
const QString window_title(
tr("%1 [%2]").arg(QString::fromStdString(dentry ? dentry->title : title)).arg(QString::fromStdString(real_serial)));
SettingsWindow* dialog = new SettingsWindow(path, real_serial, region, dentry, std::move(sif));
dialog->setWindowTitle(window_title);

View File

@ -44,7 +44,8 @@ public:
const GameDatabase::Entry* entry, std::unique_ptr<INISettingsInterface> sif);
~SettingsWindow();
static void openGamePropertiesDialog(const std::string& path, const std::string& serial, DiscRegion region);
static void openGamePropertiesDialog(const std::string& path, const std::string& title, const std::string& serial,
DiscRegion region);
static void closeGamePropertiesDialogs();
// Helper for externally setting fields in game settings ini.