Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DoSafeMemoryAccess return true properly for RAM, BIOS, dcache writes #2624

Merged
merged 1 commit into from
Sep 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make DoSafeMemoryAccess return true properly for RAM, BIOS, dcache wr…
…ites

Fixes broken cheats when writing to unaligned addresses,
maybe also achievements.
  • Loading branch information
CookiePLMonster committed Sep 24, 2021
commit 270899dbdb264174458963a707b7a323662812f8
21 changes: 13 additions & 8 deletions src/core/bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,10 @@ static ALWAYS_INLINE bool DoSafeMemoryAccess(VirtualMemoryAddress address, u32&
{
address &= PHYSICAL_MEMORY_ADDRESS_MASK;
if ((address & DCACHE_LOCATION_MASK) == DCACHE_LOCATION)
return DoScratchpadAccess<type, size>(address, value);
{
DoScratchpadAccess<type, size>(address, value);
return true;
}
}
break;

Expand All @@ -1937,16 +1940,18 @@ static ALWAYS_INLINE bool DoSafeMemoryAccess(VirtualMemoryAddress address, u32&

if (address < RAM_MIRROR_END)
{
return DoRAMAccess<type, size, true>(address, value);
}
else if (address >= BIOS_BASE && address < (BIOS_BASE + BIOS_SIZE))
{
return DoBIOSAccess<type, size>(static_cast<u32>(address - BIOS_BASE), value);
DoRAMAccess<type, size, true>(address, value);
return true;
}
else
if constexpr (type == MemoryAccessType::Read)
{
return false;
if (address >= BIOS_BASE && address < (BIOS_BASE + BIOS_SIZE))
{
DoBIOSAccess<type, size>(static_cast<u32>(address - BIOS_BASE), value);
return true;
}
}
return false;
}

bool SafeReadMemoryByte(VirtualMemoryAddress addr, u8* value)
Expand Down