mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-30 14:26:16 +00:00
Cheats/Patches (#493)
* Cheats/Patches Adds the possibility of applying cheats/patches according to the specific game serial+version The logic for adding modifications has not yet been implemented! Interface based on issues/372 https://github.com/shadps4-emu/shadPS4/issues/372 [X]Front-end []Back-end Create a synchronized fork of the cheats/patches repository * Clang Format * separate files The code has been separated into separate files as suggested by georgemoralis. Added the Patch tab, which has not been implemented yet. Added the 'applyCheat' area to apply the modification, not implemented yet... And added LOG_INFO. * reuse * initial implementation of cheat functionality * Update cheats_patches.cpp sets all added buttons to the size of the largest button. and fixes some aesthetic issues. * move eboot_address to module.h fixes the non-qt builds and makes more sense to be there anyway * Patchs menu and fixes adds the possibility to download Patches, it does not modify the memory yet. and some other fixes * MemoryPatcher namespace, activate cheats on start * format * initial patch implementation * format * format again... * convertValueToHex * Fixes Choosing which cheat file to use. And some other fixes * fix bytes16, bytes32, bytes64 type patches If a patch is any of these types we convert it from little endian to big endian * format * format again :( * Implement pattern scanning for mask type patches * add check to stop patches applying to wrong game previously if you added a patch to a game, but closed the window and opened a different game it would still try to apply the patch, this is now fixed * format * Fix 'Hint' 0x400000 | and Author * Management |save checkbox | shadps4 repository MENU - Cheats/Patches Management (implementing Patches) save patches checkbox add shadps4 repository * Load saved patches, miscellaneous fixes * Fix an issue with mask patches not being saved * format + remove debug log * multiple patches | TR translation for cheats/patches * clang * ENABLE_QT_GUI * OK * move memory_patcher to qt_gui * clang * add cheats hu_HU * fix log * Remove the item from the patchesListView if no patches were added (the game has patches, but not for the current version) --------- Co-authored-by: CrazyBloo <CrazyBloo@users.noreply.github.com>
This commit is contained in:
parent
a6a9fff666
commit
614a23b369
35 changed files with 12003 additions and 798 deletions
115
src/qt_gui/cheats_patches.h
Normal file
115
src/qt_gui/cheats_patches.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#ifndef CHEATS_PATCHES_H
|
||||
#define CHEATS_PATCHES_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QGroupBox>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QLabel>
|
||||
#include <QListView>
|
||||
#include <QMap>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QString>
|
||||
#include <QTabWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
|
||||
class CheatsPatches : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CheatsPatches(const QString& gameName, const QString& gameSerial, const QString& gameVersion,
|
||||
const QString& gameSize, const QPixmap& gameImage, QWidget* parent = nullptr);
|
||||
~CheatsPatches();
|
||||
|
||||
// Public Methods
|
||||
void downloadCheats(const QString& source, const QString& m_gameSerial,
|
||||
const QString& m_gameVersion, bool showMessageBox);
|
||||
void downloadPatches(const QString repository, const bool showMessageBox);
|
||||
|
||||
signals:
|
||||
void downloadFinished();
|
||||
|
||||
private:
|
||||
// UI Setup and Event Handlers
|
||||
void setupUI();
|
||||
void onSaveButtonClicked();
|
||||
QCheckBox* findCheckBoxByName(const QString& name);
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
void onPatchCheckBoxHovered(QCheckBox* checkBox, bool hovered);
|
||||
|
||||
// Cheat and Patch Management
|
||||
void populateFileListCheats();
|
||||
void populateFileListPatches();
|
||||
|
||||
void addCheatsToLayout(const QJsonArray& modsArray, const QJsonArray& creditsArray);
|
||||
void addPatchesToLayout(const QString& serial);
|
||||
|
||||
void applyCheat(const QString& modName, bool enabled);
|
||||
void applyPatch(const QString& patchName, bool enabled);
|
||||
|
||||
void createFilesJson(const QString& repository);
|
||||
void uncheckAllCheatCheckBoxes();
|
||||
void updateNoteTextEdit(const QString& patchName);
|
||||
|
||||
// Network Manager
|
||||
QNetworkAccessManager* manager;
|
||||
|
||||
// Patch Info Structures
|
||||
struct MemoryMod {
|
||||
QString offset;
|
||||
QString on;
|
||||
QString off;
|
||||
};
|
||||
|
||||
struct Cheat {
|
||||
QString name;
|
||||
QString type;
|
||||
bool hasHint;
|
||||
QVector<MemoryMod> memoryMods;
|
||||
};
|
||||
|
||||
struct PatchInfo {
|
||||
QString name;
|
||||
QString author;
|
||||
QString note;
|
||||
QJsonArray linesArray;
|
||||
QString serial;
|
||||
};
|
||||
|
||||
// Members
|
||||
QString m_gameName;
|
||||
QString m_gameSerial;
|
||||
QString m_gameVersion;
|
||||
QString m_gameSize;
|
||||
QPixmap m_gameImage;
|
||||
QString m_cheatFilePath;
|
||||
QMap<QString, Cheat> m_cheats;
|
||||
QMap<QString, PatchInfo> m_patchInfos;
|
||||
QVector<QCheckBox*> m_cheatCheckBoxes;
|
||||
|
||||
// UI Elements
|
||||
QVBoxLayout* rightLayout;
|
||||
QVBoxLayout* patchesGroupBoxLayout;
|
||||
QGroupBox* patchesGroupBox;
|
||||
QVBoxLayout* patchesLayout;
|
||||
QTextEdit* instructionsTextEdit;
|
||||
QListView* listView_selectFile;
|
||||
QItemSelectionModel* selectionModel;
|
||||
QComboBox* patchesComboBox;
|
||||
QListView* patchesListView;
|
||||
|
||||
QString defaultTextEdit;
|
||||
};
|
||||
|
||||
#endif // CHEATS_PATCHES_H
|
Loading…
Add table
Add a link
Reference in a new issue