mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-06 02:19:47 +00:00
only apply cheats at runtime
This commit is contained in:
parent
7551f061ad
commit
5b2779d548
@ -1158,6 +1158,13 @@ void CheatsPatches::applyCheat(const QString& modName, bool enabled) {
|
|||||||
if (!m_cheats.contains(modName))
|
if (!m_cheats.contains(modName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (MemoryPatcher::g_eboot_address == 0 && enabled) {
|
||||||
|
QMessageBox::critical(this, tr("Error"),
|
||||||
|
tr("Can't apply cheats before the game is started"));
|
||||||
|
uncheckAllCheatCheckBoxes();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Cheat cheat = m_cheats[modName];
|
Cheat cheat = m_cheats[modName];
|
||||||
|
|
||||||
for (const MemoryMod& memoryMod : cheat.memoryMods) {
|
for (const MemoryMod& memoryMod : cheat.memoryMods) {
|
||||||
@ -1167,16 +1174,9 @@ void CheatsPatches::applyCheat(const QString& modName, bool enabled) {
|
|||||||
std::string offsetStr = memoryMod.offset.toStdString();
|
std::string offsetStr = memoryMod.offset.toStdString();
|
||||||
std::string valueStr = value.toStdString();
|
std::string valueStr = value.toStdString();
|
||||||
|
|
||||||
if (MemoryPatcher::g_eboot_address == 0) {
|
if (MemoryPatcher::g_eboot_address == 0)
|
||||||
MemoryPatcher::patchInfo addingPatch;
|
return;
|
||||||
addingPatch.modNameStr = modNameStr;
|
|
||||||
addingPatch.offsetStr = offsetStr;
|
|
||||||
addingPatch.valueStr = valueStr;
|
|
||||||
addingPatch.isOffset = true;
|
|
||||||
|
|
||||||
MemoryPatcher::AddPatchToQueue(addingPatch);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Determine if the hint field is present
|
// Determine if the hint field is present
|
||||||
bool isHintPresent = m_cheats[modName].hasHint;
|
bool isHintPresent = m_cheats[modName].hasHint;
|
||||||
MemoryPatcher::PatchMemory(modNameStr, offsetStr, valueStr, !isHintPresent, false);
|
MemoryPatcher::PatchMemory(modNameStr, offsetStr, valueStr, !isHintPresent, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user