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