Merge pull request #9912 from Pokechu22/memory-viewer-physical-mem2

Fix MEM2 in the memory viewer in physical mode
This commit is contained in:
Léo Lam 2021-07-21 11:37:15 +02:00 committed by GitHub
commit 9a91b867ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -246,22 +246,22 @@ struct CompositeAddressSpaceAccessors : Accessors
u8 ReadU8(u32 address) const override u8 ReadU8(u32 address) const override
{ {
auto it = FindAppropriateAccessor(address); auto mapping = FindAppropriateAccessor(address);
if (it == m_accessor_mappings.end()) if (mapping == m_accessor_mappings.end())
{ {
return 0; return 0;
} }
return it->accessors->ReadU8(address); return mapping->accessors->ReadU8(address - mapping->base);
} }
void WriteU8(u32 address, u8 value) override void WriteU8(u32 address, u8 value) override
{ {
auto it = FindAppropriateAccessor(address); auto mapping = FindAppropriateAccessor(address);
if (it == m_accessor_mappings.end()) if (mapping == m_accessor_mappings.end())
{ {
return; return;
} }
return it->accessors->WriteU8(address, value); return mapping->accessors->WriteU8(address - mapping->base, value);
} }
std::optional<u32> Search(u32 haystack_offset, const u8* needle_start, std::size_t needle_size, std::optional<u32> Search(u32 haystack_offset, const u8* needle_start, std::size_t needle_size,