Cheats: Add extension 32-bit instructions variants

This commit is contained in:
Connor McLaughlin
2020-12-17 23:33:00 +10:00
parent 412b5073db
commit d2c98639a8
2 changed files with 87 additions and 1 deletions

View File

@ -880,6 +880,13 @@ void CheatCode::Apply() const
}
break;
case InstructionCode::ExtConstantWrite32:
{
DoMemoryWrite<u32>(inst.address, inst.value32);
index++;
}
break;
case InstructionCode::ScratchpadWrite16:
{
DoMemoryWrite<u16>(CPU::DCACHE_LOCATION | (inst.address & CPU::DCACHE_OFFSET_MASK), inst.value16);
@ -887,6 +894,29 @@ void CheatCode::Apply() const
}
break;
case InstructionCode::ExtScratchpadWrite32:
{
DoMemoryWrite<u32>(CPU::DCACHE_LOCATION | (inst.address & CPU::DCACHE_OFFSET_MASK), inst.value32);
index++;
}
break;
case InstructionCode::ExtIncrement32:
{
const u32 value = DoMemoryRead<u32>(inst.address);
DoMemoryWrite<u32>(inst.address, value + inst.value32);
index++;
}
break;
case InstructionCode::ExtDecrement32:
{
const u32 value = DoMemoryRead<u32>(inst.address);
DoMemoryWrite<u32>(inst.address, value - inst.value32);
index++;
}
break;
case InstructionCode::Increment16:
{
const u16 value = DoMemoryRead<u16>(inst.address);
@ -919,6 +949,46 @@ void CheatCode::Apply() const
}
break;
case InstructionCode::ExtCompareEqual32:
{
const u32 value = DoMemoryRead<u32>(inst.address);
if (value == inst.value32)
index++;
else
index = GetNextNonConditionalInstruction(index);
}
break;
case InstructionCode::ExtCompareNotEqual32:
{
const u32 value = DoMemoryRead<u32>(inst.address);
if (value != inst.value32)
index++;
else
index = GetNextNonConditionalInstruction(index);
}
break;
case InstructionCode::ExtCompareLess32:
{
const u32 value = DoMemoryRead<u32>(inst.address);
if (value < inst.value32)
index++;
else
index = GetNextNonConditionalInstruction(index);
}
break;
case InstructionCode::ExtCompareGreater32:
{
const u32 value = DoMemoryRead<u32>(inst.address);
if (value > inst.value32)
index++;
else
index = GetNextNonConditionalInstruction(index);
}
break;
case InstructionCode::CompareEqual16:
{
const u16 value = DoMemoryRead<u16>(inst.address);
@ -1009,6 +1079,7 @@ void CheatCode::Apply() const
break;
case InstructionCode::SkipIfNotEqual16: // C0
case InstructionCode::ExtSkipIfNotEqual32: // A4
case InstructionCode::SkipIfButtonsNotEqual: // D5
case InstructionCode::SkipIfButtonsEqual: // D6
{
@ -1020,6 +1091,9 @@ void CheatCode::Apply() const
case InstructionCode::SkipIfNotEqual16: // C0
activate_codes = (DoMemoryRead<u16>(inst.address) == inst.value16);
break;
case InstructionCode::ExtSkipIfNotEqual32: // A4
activate_codes = (DoMemoryRead<u32>(inst.address) == inst.value32);
break;
case InstructionCode::SkipIfButtonsNotEqual: // D5
activate_codes = (GetControllerButtonBits() == inst.value16);
break;