mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-10-02 14:18:36 +00:00
Patch is enabled only when game version matches patch version (#3336)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Removed redundancies from CheatsPatches::onSaveButtonClicked()
This commit is contained in:
parent
968cfe1180
commit
d286631798
1 changed files with 23 additions and 43 deletions
|
@ -389,42 +389,19 @@ void CheatsPatches::onSaveButtonClicked() {
|
||||||
xmlWriter.writeStartElement(xmlReader.name().toString());
|
xmlWriter.writeStartElement(xmlReader.name().toString());
|
||||||
|
|
||||||
QString name = xmlReader.attributes().value("Name").toString();
|
QString name = xmlReader.attributes().value("Name").toString();
|
||||||
|
QString version = xmlReader.attributes().value("AppVer").toString();
|
||||||
|
|
||||||
|
bool versionMatch = version == m_gameVersion;
|
||||||
bool isEnabled = false;
|
bool isEnabled = false;
|
||||||
bool hasIsEnabled = false;
|
|
||||||
bool foundPatchInfo = false;
|
bool foundPatchInfo = false;
|
||||||
|
|
||||||
// Check and update the isEnabled attribute
|
// Check and update the isEnabled attribute
|
||||||
for (const QXmlStreamAttribute& attr : xmlReader.attributes()) {
|
for (const QXmlStreamAttribute& attr : xmlReader.attributes()) {
|
||||||
if (attr.name() == QStringLiteral("isEnabled")) {
|
if (attr.name() == QStringLiteral("isEnabled"))
|
||||||
hasIsEnabled = true;
|
continue;
|
||||||
auto it = m_patchInfos.find(name);
|
|
||||||
if (it != m_patchInfos.end()) {
|
|
||||||
QCheckBox* checkBox = findCheckBoxByName(it->name);
|
|
||||||
if (checkBox) {
|
|
||||||
foundPatchInfo = true;
|
|
||||||
isEnabled = checkBox->isChecked();
|
|
||||||
xmlWriter.writeAttribute("isEnabled", isEnabled ? "true" : "false");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!foundPatchInfo) {
|
|
||||||
auto maskIt = m_patchInfos.find(name + " (any version)");
|
|
||||||
if (maskIt != m_patchInfos.end()) {
|
|
||||||
QCheckBox* checkBox = findCheckBoxByName(maskIt->name);
|
|
||||||
if (checkBox) {
|
|
||||||
foundPatchInfo = true;
|
|
||||||
isEnabled = checkBox->isChecked();
|
|
||||||
xmlWriter.writeAttribute("isEnabled",
|
|
||||||
isEnabled ? "true" : "false");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
xmlWriter.writeAttribute(attr.name().toString(), attr.value().toString());
|
xmlWriter.writeAttribute(attr.name().toString(), attr.value().toString());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasIsEnabled) {
|
|
||||||
auto it = m_patchInfos.find(name);
|
auto it = m_patchInfos.find(name);
|
||||||
if (it != m_patchInfos.end()) {
|
if (it != m_patchInfos.end()) {
|
||||||
QCheckBox* checkBox = findCheckBoxByName(it->name);
|
QCheckBox* checkBox = findCheckBoxByName(it->name);
|
||||||
|
@ -438,12 +415,15 @@ void CheatsPatches::onSaveButtonClicked() {
|
||||||
if (maskIt != m_patchInfos.end()) {
|
if (maskIt != m_patchInfos.end()) {
|
||||||
QCheckBox* checkBox = findCheckBoxByName(maskIt->name);
|
QCheckBox* checkBox = findCheckBoxByName(maskIt->name);
|
||||||
if (checkBox) {
|
if (checkBox) {
|
||||||
|
versionMatch = true;
|
||||||
foundPatchInfo = true;
|
foundPatchInfo = true;
|
||||||
isEnabled = checkBox->isChecked();
|
isEnabled = checkBox->isChecked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xmlWriter.writeAttribute("isEnabled", isEnabled ? "true" : "false");
|
if (foundPatchInfo) {
|
||||||
|
xmlWriter.writeAttribute("isEnabled",
|
||||||
|
(isEnabled && versionMatch) ? "true" : "false");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xmlWriter.writeStartElement(xmlReader.name().toString());
|
xmlWriter.writeStartElement(xmlReader.name().toString());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue