Merge pull request #4048 from EmptyChaos/wx-cheat-notice

WX: ISOProperties: Add notice when cheats are disabled (Issue 9690)
This commit is contained in:
shuffle2
2016-10-02 22:06:26 -07:00
committed by GitHub
21 changed files with 879 additions and 502 deletions

View File

@ -454,7 +454,7 @@ static int alphatobin(u32* dst, const std::vector<std::string>& alpha, int size)
return ret;
}
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>& ops)
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>* ops)
{
// The almighty buildseeds() function!! without this, the crypto routines are useless
buildseeds();
@ -469,9 +469,9 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>& ops)
if ((ret = alphatobin(uCodes, vCodes, (int)vCodes.size())))
{
// Return value is index + 1, 0 being the success flag value.
PanicAlertT("Action Replay Code Decryption Error:\nParity Check Failed\n\nCulprit Code:\n%s",
vCodes[ret].c_str());
batchdecrypt(uCodes, (u16)vCodes.size() << 1);
vCodes[ret - 1].c_str());
}
else if (!batchdecrypt(uCodes, (u16)vCodes.size() << 1))
{
@ -481,10 +481,7 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>& ops)
for (size_t i = 0; i < (vCodes.size() << 1); i += 2)
{
AREntry op;
op.cmd_addr = uCodes[i];
op.value = uCodes[i + 1];
ops.push_back(op);
ops->emplace_back(uCodes[i], uCodes[i + 1]);
// PanicAlert("Decrypted AR Code without verification code:\n%08X %08X", uCodes[i],
// uCodes[i+1]);
}
@ -494,10 +491,7 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>& ops)
// Skip passing the verification code back
for (size_t i = 2; i < (vCodes.size() << 1); i += 2)
{
AREntry op;
op.cmd_addr = uCodes[i];
op.value = uCodes[i + 1];
ops.push_back(op);
ops->emplace_back(uCodes[i], uCodes[i + 1]);
// PanicAlert("Decrypted AR Code:\n%08X %08X", uCodes[i], uCodes[i+1]);
}
}

View File

@ -11,6 +11,6 @@
namespace ActionReplay
{
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>& ops);
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>* ops);
} // namespace

View File

@ -184,7 +184,7 @@ std::vector<ARCode> LoadCodes(const IniFile& global_ini, const IniFile& local_in
}
if (encrypted_lines.size())
{
DecryptARCode(encrypted_lines, current_code.ops);
DecryptARCode(encrypted_lines, &current_code.ops);
codes.push_back(current_code);
current_code.ops.clear();
encrypted_lines.clear();
@ -242,7 +242,7 @@ std::vector<ARCode> LoadCodes(const IniFile& global_ini, const IniFile& local_in
}
if (encrypted_lines.size())
{
DecryptARCode(encrypted_lines, current_code.ops);
DecryptARCode(encrypted_lines, &current_code.ops);
codes.push_back(current_code);
}
}

View File

@ -19,6 +19,10 @@ struct AREntry
u32 cmd_addr;
u32 value;
};
constexpr bool operator==(const AREntry& left, const AREntry& right)
{
return left.cmd_addr == right.cmd_addr && left.value == right.value;
}
struct ARCode
{