Actually check whether float instructions should execute

This commit is contained in:
Aly 2021-04-10 13:49:48 -07:00
parent a3be4673b1
commit 84e64220ab

View File

@ -1310,11 +1310,16 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, CheatDescription* const
switch (subcode)
{
case 0x0:
{
if(!skipExecution)
{
cheat_state.floatMode = arg1 & 0x1;
}
}
break;
case 0x1:
{
if (!skipExecution)
{
if (cheat_state.floatMode)
{
@ -1348,8 +1353,11 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, CheatDescription* const
}
}
}
}
break;
case 0x2:
{
if (!skipExecution)
{
if (cheat_state.floatMode)
{
@ -1383,8 +1391,11 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, CheatDescription* const
}
}
}
}
break;
case 0x3:
{
if (!skipExecution)
{
if (cheat_state.floatMode)
{
@ -1418,8 +1429,11 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, CheatDescription* const
}
}
}
}
break;
case 0x4:
{
if (!skipExecution)
{
if (cheat_state.data1Mode)
{
@ -1435,8 +1449,11 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, CheatDescription* const
*activeData() *= arg1;
}
}
}
break;
case 0x5:
{
if (!skipExecution)
{
if (cheat_state.data1Mode)
{
@ -1452,38 +1469,59 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, CheatDescription* const
*activeData() /= arg1;
}
}
}
break;
case 0x6:
{
if (!skipExecution)
{
*activeData() &= arg1;
}
}
break;
case 0x7:
{
if (!skipExecution)
{
*activeData() |= arg1;
}
}
break;
case 0x8:
{
if (!skipExecution)
{
*activeData() ^= arg1;
}
}
break;
case 0x9:
{
if (!skipExecution)
{
*activeData() = ~*activeData();
}
}
break;
case 0xA:
{
if (!skipExecution)
{
*activeData() <<= arg1;
}
}
break;
case 0xB:
{
if (!skipExecution)
{
*activeData() >>= arg1;
}
}
break;
case 0xC:
{
if (!skipExecution)
{
u8 origActiveOffset = cheat_state.activeOffset;
for (size_t i = 0; i < arg1; i++)
@ -1502,6 +1540,7 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, CheatDescription* const
}
cheat_state.activeOffset = origActiveOffset;
}
}
break;
// Search for pattern
case 0xE:
@ -1552,11 +1591,14 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, CheatDescription* const
}
break;
case 0xF:
{
if (!skipExecution)
{
u32 range = arg1 - (arg0 & 0xFFFFFF);
u32 number = Cheat_GetRandomNumber() % range;
*activeData() = (arg0 & 0xFFFFFF) + number;
}
}
break;
default:
return 0;