Cheats/Patches - add mask_jump32 (#2477)

* mask_jump32

* fix qt/sdl

* fix dangling pointer?

fixes the warning: "clang-diagnostic-dangling-gls: object backing the pointer will be destroyed at the end of the full-expression"
This commit is contained in:
DanielSvoboda 2025-02-19 08:29:04 -03:00 committed by GitHub
parent 7d756e79ae
commit 48c621532c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 137 additions and 54 deletions

View file

@ -1346,7 +1346,7 @@ void CheatsPatches::applyCheat(const QString& modName, bool enabled) {
// Determine if the hint field is present
bool isHintPresent = m_cheats[modName].hasHint;
MemoryPatcher::PatchMemory(modNameStr, offsetStr, valueStr, !isHintPresent, false);
MemoryPatcher::PatchMemory(modNameStr, offsetStr, valueStr, "", "", !isHintPresent, false);
}
}
@ -1368,28 +1368,23 @@ void CheatsPatches::applyPatch(const QString& patchName, bool enabled) {
bool littleEndian = false;
if (type == "bytes16") {
littleEndian = true;
} else if (type == "bytes32") {
littleEndian = true;
} else if (type == "bytes64") {
if (type == "bytes16" || type == "bytes32" || type == "bytes64") {
littleEndian = true;
}
MemoryPatcher::PatchMask patchMask = MemoryPatcher::PatchMask::None;
int maskOffsetValue = 0;
if (type == "mask") {
if (type == "mask")
patchMask = MemoryPatcher::PatchMask::Mask;
// im not sure if this works, there is no games to test the mask offset on yet
if (!maskOffsetStr.toStdString().empty())
maskOffsetValue = std::stoi(maskOffsetStr.toStdString(), 0, 10);
}
if (type == "mask_jump32")
patchMask = MemoryPatcher::PatchMask::Mask_Jump32;
if (type == "mask" || type == "mask_jump32" && !maskOffsetStr.toStdString().empty()) {
maskOffsetValue = std::stoi(maskOffsetStr.toStdString(), 0, 10);
}
if (MemoryPatcher::g_eboot_address == 0) {
MemoryPatcher::patchInfo addingPatch;
addingPatch.gameSerial = patchInfo.serial.toStdString();
@ -1405,7 +1400,8 @@ void CheatsPatches::applyPatch(const QString& patchName, bool enabled) {
continue;
}
MemoryPatcher::PatchMemory(patchName.toStdString(), address.toStdString(),
patchValue.toStdString(), false, littleEndian, patchMask);
patchValue.toStdString(), "", "", false, littleEndian,
patchMask);
}
}
}