Skip to content

Commit

Permalink
RAchievements: Fix off by one error in scratchpad reads
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Feb 14, 2024
1 parent e1fc414 commit 71c8ad6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pcsx2/Achievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ void Achievements::ClientMessageCallback(const char* message, const rc_client_t*

uint32_t Achievements::ClientReadMemory(uint32_t address, uint8_t* buffer, uint32_t num_bytes, rc_client_t* client)
{
if ((static_cast<u64>(address) + num_bytes) >= EXPOSED_EE_MEMORY_SIZE) [[unlikely]]
if ((static_cast<u64>(address) + num_bytes) > EXPOSED_EE_MEMORY_SIZE) [[unlikely]]
{
DevCon.Warning("[Achievements] Ignoring out of bounds memory peek of %u bytes at %08X.", num_bytes, address);
return 0u;
Expand Down Expand Up @@ -3097,7 +3097,7 @@ void Achievements::RAIntegration::RACallbackLoadROM(const char* unused)

unsigned char Achievements::RAIntegration::RACallbackReadMemory(unsigned int address)
{
if ((static_cast<u64>(address) + sizeof(unsigned char)) >= EXPOSED_EE_MEMORY_SIZE)
if ((static_cast<u64>(address) + sizeof(unsigned char)) > EXPOSED_EE_MEMORY_SIZE)
{
DevCon.Warning("[Achievements] Ignoring out of bounds memory peek at %08X.", address);
return 0u;
Expand Down Expand Up @@ -3134,7 +3134,7 @@ unsigned int Achievements::RAIntegration::RACallbackReadBlock(unsigned int addre

void Achievements::RAIntegration::RACallbackWriteMemory(unsigned int address, unsigned char value)
{
if ((static_cast<u64>(address) + sizeof(value)) >= EXPOSED_EE_MEMORY_SIZE) [[unlikely]]
if ((static_cast<u64>(address) + sizeof(value)) > EXPOSED_EE_MEMORY_SIZE) [[unlikely]]
{
DevCon.Warning("[Achievements] Ignoring out of bounds memory poke at %08X (value %08X).", address, value);
return;
Expand Down

0 comments on commit 71c8ad6

Please sign in to comment.