citra-emu
/
citra
Archived
1
0
Fork 0

memory: Fix order of checks in PhysicalToVirtualAddressForRasterizer. (#7328)

This commit is contained in:
Steveice10 2024-01-06 22:49:32 -08:00 committed by GitHub
parent b2c740ee0e
commit 96aa1b3a08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -691,12 +691,7 @@ std::vector<VAddr> MemorySystem::PhysicalToVirtualAddressForRasterizer(PAddr add
if (addr >= VRAM_PADDR && addr < VRAM_PADDR_END) { if (addr >= VRAM_PADDR && addr < VRAM_PADDR_END) {
return {addr - VRAM_PADDR + VRAM_VADDR}; return {addr - VRAM_PADDR + VRAM_VADDR};
} }
if (addr >= FCRAM_PADDR && addr < FCRAM_PADDR_END) { // NOTE: Order matters here.
return {addr - FCRAM_PADDR + LINEAR_HEAP_VADDR, addr - FCRAM_PADDR + NEW_LINEAR_HEAP_VADDR};
}
if (addr >= FCRAM_PADDR_END && addr < FCRAM_N3DS_PADDR_END) {
return {addr - FCRAM_PADDR + NEW_LINEAR_HEAP_VADDR};
}
auto plg_ldr = Service::PLGLDR::GetService(impl->system); auto plg_ldr = Service::PLGLDR::GetService(impl->system);
if (plg_ldr) { if (plg_ldr) {
auto fb_addr = plg_ldr->GetPluginFBAddr(); auto fb_addr = plg_ldr->GetPluginFBAddr();
@ -704,6 +699,12 @@ std::vector<VAddr> MemorySystem::PhysicalToVirtualAddressForRasterizer(PAddr add
return {addr - fb_addr + PLUGIN_3GX_FB_VADDR}; return {addr - fb_addr + PLUGIN_3GX_FB_VADDR};
} }
} }
if (addr >= FCRAM_PADDR && addr < FCRAM_PADDR_END) {
return {addr - FCRAM_PADDR + LINEAR_HEAP_VADDR, addr - FCRAM_PADDR + NEW_LINEAR_HEAP_VADDR};
}
if (addr >= FCRAM_PADDR_END && addr < FCRAM_N3DS_PADDR_END) {
return {addr - FCRAM_PADDR + NEW_LINEAR_HEAP_VADDR};
}
// While the physical <-> virtual mapping is 1:1 for the regions supported by the cache, // While the physical <-> virtual mapping is 1:1 for the regions supported by the cache,
// some games (like Pokemon Super Mystery Dungeon) will try to use textures that go beyond // some games (like Pokemon Super Mystery Dungeon) will try to use textures that go beyond
// the end address of VRAM, causing the Virtual->Physical translation to fail when flushing // the end address of VRAM, causing the Virtual->Physical translation to fail when flushing