mirror of
https://github.com/libretro/Mesen.git
synced 2025-02-25 19:11:20 +00:00
Cheats: Fixed crash when creating a custom memory cheat with an address above $FFFF
This commit is contained in:
parent
f536f62dd1
commit
6d768cda0a
@ -85,6 +85,11 @@ CodeInfo CheatManager::GetPARCodeInfo(uint32_t parCode)
|
||||
void CheatManager::AddCode(CodeInfo &code)
|
||||
{
|
||||
if(code.IsRelativeAddress) {
|
||||
if(code.Address > 0xFFFF) {
|
||||
//Invalid cheat, ignore it
|
||||
return;
|
||||
}
|
||||
|
||||
if(_relativeCheatCodes[code.Address] == nullptr) {
|
||||
_relativeCheatCodes[code.Address].reset(new vector<CodeInfo>());
|
||||
}
|
||||
|
@ -123,6 +123,10 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
if(!UInt32.TryParse(txtAddress.Text, System.Globalization.NumberStyles.AllowHexSpecifier, null, out val)) {
|
||||
return false;
|
||||
}
|
||||
if(radRelativeAddress.Checked && val > 0xFFFF) {
|
||||
//Do not allow cheats outside the 0-0xFFFF range in relative addressing mode
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!Byte.TryParse(txtValue.Text, System.Globalization.NumberStyles.AllowHexSpecifier, null, out byteVal)) {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user