mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-09 13:19:00 +00:00
QT: Fix Patches 'Incompatibility Notice' (#3597)
This commit is contained in:
@@ -767,7 +767,7 @@ void CheatsPatches::compatibleVersionNotice(const QString repository) {
|
|||||||
QDir dir = patchesDir.filePath(repository);
|
QDir dir = patchesDir.filePath(repository);
|
||||||
|
|
||||||
QStringList xmlFiles = dir.entryList(QStringList() << "*.xml", QDir::Files);
|
QStringList xmlFiles = dir.entryList(QStringList() << "*.xml", QDir::Files);
|
||||||
QSet<QString> appVersionsSet;
|
QStringList incompatMessages;
|
||||||
|
|
||||||
foreach (const QString& xmlFile, xmlFiles) {
|
foreach (const QString& xmlFile, xmlFiles) {
|
||||||
QFile file(dir.filePath(xmlFile));
|
QFile file(dir.filePath(xmlFile));
|
||||||
@@ -778,6 +778,7 @@ void CheatsPatches::compatibleVersionNotice(const QString repository) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QXmlStreamReader xmlReader(&file);
|
QXmlStreamReader xmlReader(&file);
|
||||||
|
QSet<QString> appVersionsSet;
|
||||||
bool foundMatchingID = false;
|
bool foundMatchingID = false;
|
||||||
|
|
||||||
while (!xmlReader.atEnd() && !xmlReader.hasError()) {
|
while (!xmlReader.atEnd() && !xmlReader.hasError()) {
|
||||||
@@ -804,39 +805,33 @@ void CheatsPatches::compatibleVersionNotice(const QString repository) {
|
|||||||
QString(tr("XML ERROR:") + "\n%1").arg(xmlReader.errorString()));
|
QString(tr("XML ERROR:") + "\n%1").arg(xmlReader.errorString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundMatchingID) {
|
if (!foundMatchingID) {
|
||||||
QStringList incompatibleVersions;
|
continue;
|
||||||
bool hasMatchingVersion = false;
|
}
|
||||||
|
|
||||||
foreach (const QString& appVer, appVersionsSet) {
|
for (const QString& appVer : appVersionsSet) {
|
||||||
if (appVer != m_gameVersion) {
|
if (appVer == QLatin1String("mask") || appVer == m_gameVersion) {
|
||||||
incompatibleVersions.append(appVer);
|
return;
|
||||||
} else {
|
|
||||||
hasMatchingVersion = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!incompatibleVersions.isEmpty() ||
|
|
||||||
(hasMatchingVersion && incompatibleVersions.isEmpty())) {
|
|
||||||
QString message;
|
|
||||||
|
|
||||||
if (!incompatibleVersions.isEmpty()) {
|
|
||||||
QString versionsList = incompatibleVersions.join(", ");
|
|
||||||
message += QString(tr("The game is in version: %1")).arg(m_gameVersion) + "\n" +
|
|
||||||
QString(tr("The downloaded patch only works on version: %1"))
|
|
||||||
.arg(versionsList);
|
|
||||||
|
|
||||||
if (hasMatchingVersion) {
|
|
||||||
message += QString(", %1").arg(m_gameVersion);
|
|
||||||
}
|
|
||||||
message += QString("\n" + tr("You may need to update your game."));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!message.isEmpty()) {
|
|
||||||
QMessageBox::information(this, tr("Incompatibility Notice"), message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!appVersionsSet.isEmpty()) {
|
||||||
|
QStringList versionsList;
|
||||||
|
for (const QString& v : appVersionsSet) {
|
||||||
|
versionsList << v;
|
||||||
|
}
|
||||||
|
QString versions = versionsList.join(", ");
|
||||||
|
QString message =
|
||||||
|
QString(tr("The game is in version: %1")).arg(m_gameVersion) + "\n" +
|
||||||
|
QString(tr("The downloaded patch only works on version: %1")).arg(versions) +
|
||||||
|
QString("\n" + tr("You may need to update your game."));
|
||||||
|
incompatMessages << message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!incompatMessages.isEmpty()) {
|
||||||
|
QString finalMsg = incompatMessages.join("\n\n---\n\n");
|
||||||
|
QMessageBox::information(this, tr("Incompatibility Notice"), finalMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user