This commit is contained in:
DanielSvoboda 2024-08-28 19:20:47 -03:00
parent b78c249b31
commit 693c68c65d
3 changed files with 6 additions and 14 deletions

View File

@ -310,8 +310,6 @@ set(COMMON src/common/logging/backend.cpp
src/common/enum.h src/common/enum.h
src/common/io_file.cpp src/common/io_file.cpp
src/common/io_file.h src/common/io_file.h
src/qt_gui/memory_patcher.cpp
src/qt_gui/memory_patcher.h
src/common/error.cpp src/common/error.cpp
src/common/error.h src/common/error.h
src/common/scope_exit.h src/common/scope_exit.h
@ -567,6 +565,8 @@ set(QT_GUI src/qt_gui/about_dialog.cpp
src/qt_gui/about_dialog.ui src/qt_gui/about_dialog.ui
src/qt_gui/cheats_patches.cpp src/qt_gui/cheats_patches.cpp
src/qt_gui/cheats_patches.h src/qt_gui/cheats_patches.h
src/qt_gui/memory_patcher.cpp
src/qt_gui/memory_patcher.h
src/qt_gui/main_window_ui.h src/qt_gui/main_window_ui.h
src/qt_gui/main_window.cpp src/qt_gui/main_window.cpp
src/qt_gui/main_window.h src/qt_gui/main_window.h

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#ifdef ENABLE_QT_GUI
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <QFile> #include <QFile>
@ -144,12 +143,11 @@ void OnGameLoaded() {
bool insideMetadata = false; bool insideMetadata = false;
bool isEnabled = false; bool isEnabled = false;
std::string currentPatchName;
while (!xmlReader.atEnd()) { while (!xmlReader.atEnd()) {
xmlReader.readNext(); xmlReader.readNext();
if (xmlReader.isStartElement()) { if (xmlReader.isStartElement()) {
std::string currentPatchName;
QJsonArray patchLines; QJsonArray patchLines;
if (xmlReader.name() == QStringLiteral("Metadata")) { if (xmlReader.name() == QStringLiteral("Metadata")) {
insideMetadata = true; insideMetadata = true;
@ -297,8 +295,8 @@ void PatchMemory(std::string modNameStr, std::string offsetStr, std::string valu
std::memcpy(cheatAddress, bytePatch.data(), bytePatch.size()); std::memcpy(cheatAddress, bytePatch.data(), bytePatch.size());
LOG_INFO(Loader, "Applied patch:{}, Offset:{}, Value:{}", modNameStr, (uintptr_t)cheatAddress, LOG_INFO(Loader, "Applied patch: {}, Offset: {}, Value: {}", modNameStr,
valueStr); (uintptr_t)cheatAddress, valueStr);
} }
static std::vector<int32_t> PatternToByte(const std::string& pattern) { static std::vector<int32_t> PatternToByte(const std::string& pattern) {
@ -346,6 +344,4 @@ uintptr_t PatternScan(const std::string& signature) {
return 0; return 0;
} }
} // namespace MemoryPatcher } // namespace MemoryPatcher
#endif

View File

@ -5,9 +5,7 @@
#include <cstring> #include <cstring>
#include <string> #include <string>
#include <vector> #include <vector>
#ifdef ENABLE_QT_GUI
#include <QString> #include <QString>
#endif
namespace MemoryPatcher { namespace MemoryPatcher {
@ -34,9 +32,7 @@ struct patchInfo {
extern std::vector<patchInfo> pending_patches; extern std::vector<patchInfo> pending_patches;
#ifdef ENABLE_QT_GUI
QString convertValueToHex(const QString& type, const QString& valueStr); QString convertValueToHex(const QString& type, const QString& valueStr);
#endif
void OnGameLoaded(); void OnGameLoaded();
void AddPatchToQueue(patchInfo patchToAdd); void AddPatchToQueue(patchInfo patchToAdd);