mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-21 12:04:45 +00:00
Fix an issue with mask patches not being saved
This commit is contained in:
parent
c7e08c879d
commit
908f202d75
3 changed files with 32 additions and 9 deletions
|
@ -6,13 +6,13 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "common/path_util.h"
|
||||
#ifdef ENABLE_QT_GUI
|
||||
#include <QFile>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QListView>
|
||||
#include <QMessageBox>
|
||||
#include <QFile>
|
||||
#include <QXmlStreamReader>
|
||||
#endif
|
||||
#include "memory_patcher.h"
|
||||
|
||||
|
@ -93,9 +93,8 @@ QString convertValueToHex(const QString& type, const QString& valueStr) {
|
|||
|
||||
void OnGameLoaded() {
|
||||
|
||||
// We use the QT headers for the xml and json parsing, this define is only true on QT builds
|
||||
#ifdef ENABLE_QT_GUI
|
||||
printf("we good?\n");
|
||||
// We use the QT headers for the xml and json parsing, this define is only true on QT builds
|
||||
#ifdef ENABLE_QT_GUI
|
||||
QString patchDir =
|
||||
QString::fromStdString(Common::FS::GetUserPath(Common::FS::PathType::PatchesDir).string());
|
||||
|
||||
|
@ -236,7 +235,7 @@ void OnGameLoaded() {
|
|||
} else {
|
||||
LOG_INFO(Loader, "Patches loaded successfully");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ApplyPendingPatches();
|
||||
}
|
||||
|
|
|
@ -300,6 +300,7 @@ void CheatsPatches::onSaveButtonClicked() {
|
|||
QString name = xmlReader.attributes().value("Name").toString();
|
||||
bool isEnabled = false;
|
||||
bool hasIsEnabled = false;
|
||||
bool foundPatchInfo = false;
|
||||
|
||||
// Check and update the isEnabled attribute
|
||||
for (const QXmlStreamAttribute& attr : xmlReader.attributes()) {
|
||||
|
@ -309,10 +310,24 @@ void CheatsPatches::onSaveButtonClicked() {
|
|||
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());
|
||||
}
|
||||
|
@ -323,9 +338,20 @@ void CheatsPatches::onSaveButtonClicked() {
|
|||
if (it != m_patchInfos.end()) {
|
||||
QCheckBox* checkBox = findCheckBoxByName(it->name);
|
||||
if (checkBox) {
|
||||
foundPatchInfo = true;
|
||||
isEnabled = checkBox->isChecked();
|
||||
}
|
||||
}
|
||||
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 {
|
||||
|
@ -369,7 +395,7 @@ QCheckBox* CheatsPatches::findCheckBoxByName(const QString& name) {
|
|||
QWidget* widget = item->widget();
|
||||
QCheckBox* checkBox = qobject_cast<QCheckBox*>(widget);
|
||||
if (checkBox) {
|
||||
if (checkBox->text() == name) {
|
||||
if (checkBox->text().toStdString().find(name.toStdString()) != std::string::npos) {
|
||||
return checkBox;
|
||||
}
|
||||
}
|
||||
|
@ -1089,7 +1115,6 @@ void CheatsPatches::applyPatch(const QString& patchName, bool enabled) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool CheatsPatches::eventFilter(QObject* obj, QEvent* event) {
|
||||
if (event->type() == QEvent::HoverEnter || event->type() == QEvent::HoverLeave) {
|
||||
QCheckBox* checkBox = qobject_cast<QCheckBox*>(obj);
|
||||
|
|
|
@ -58,7 +58,6 @@ private:
|
|||
|
||||
void applyCheat(const QString& modName, bool enabled);
|
||||
void applyPatch(const QString& patchName, bool enabled);
|
||||
|
||||
|
||||
// Event Filtering
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
|
Loading…
Add table
Reference in a new issue