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