cheats: fix parsing cheat codes on some platforms
using strtol here instead of strtoul when cheat code values are expected to be unsigned and are above 7fffffff breaks on platforms like Windows where long is 32-bit even on 64-bit platforms, capping out at 2147483647 and causing some cheat codes to break.
This commit is contained in:
parent
6d69598800
commit
d4fa3c441e
|
@ -677,7 +677,7 @@ static std::vector<u32> parseCodes(const std::string& s)
|
|||
curCode += c;
|
||||
if (curCode.length() == 8)
|
||||
{
|
||||
codes.push_back(strtol(curCode.c_str(), nullptr, 16));
|
||||
codes.push_back(strtoul(curCode.c_str(), nullptr, 16));
|
||||
curCode.clear();
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ static std::vector<u32> parseCodes(const std::string& s)
|
|||
{
|
||||
if (curCode.length() != 8)
|
||||
throw FlycastException("Invalid cheat code");
|
||||
codes.push_back(strtol(curCode.c_str(), nullptr, 16));
|
||||
codes.push_back(strtoul(curCode.c_str(), nullptr, 16));
|
||||
}
|
||||
|
||||
return codes;
|
||||
|
|
Loading…
Reference in New Issue