Merge pull request #6921 from lioncash/mmu

MMU: Avoid sign conversions in EFB_Read and EFB_Write
This commit is contained in:
Markus Wick 2018-05-20 22:18:40 +02:00 committed by GitHub
commit 7563c82162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -117,8 +117,8 @@ static u32 EFB_Read(const u32 addr)
u32 var = 0; u32 var = 0;
// Convert address to coordinates. It's possible that this should be done // Convert address to coordinates. It's possible that this should be done
// differently depending on color depth, especially regarding PeekColor. // differently depending on color depth, especially regarding PeekColor.
int x = (addr & 0xfff) >> 2; const u32 x = (addr & 0xfff) >> 2;
int y = (addr >> 12) & 0x3ff; const u32 y = (addr >> 12) & 0x3ff;
if (addr & 0x00800000) if (addr & 0x00800000)
{ {
@ -127,12 +127,12 @@ static u32 EFB_Read(const u32 addr)
else if (addr & 0x00400000) else if (addr & 0x00400000)
{ {
var = g_video_backend->Video_AccessEFB(EFBAccessType::PeekZ, x, y, 0); var = g_video_backend->Video_AccessEFB(EFBAccessType::PeekZ, x, y, 0);
DEBUG_LOG(MEMMAP, "EFB Z Read @ %i, %i\t= 0x%08x", x, y, var); DEBUG_LOG(MEMMAP, "EFB Z Read @ %u, %u\t= 0x%08x", x, y, var);
} }
else else
{ {
var = g_video_backend->Video_AccessEFB(EFBAccessType::PeekColor, x, y, 0); var = g_video_backend->Video_AccessEFB(EFBAccessType::PeekColor, x, y, 0);
DEBUG_LOG(MEMMAP, "EFB Color Read @ %i, %i\t= 0x%08x", x, y, var); DEBUG_LOG(MEMMAP, "EFB Color Read @ %u, %u\t= 0x%08x", x, y, var);
} }
return var; return var;
@ -140,8 +140,8 @@ static u32 EFB_Read(const u32 addr)
static void EFB_Write(u32 data, u32 addr) static void EFB_Write(u32 data, u32 addr)
{ {
int x = (addr & 0xfff) >> 2; const u32 x = (addr & 0xfff) >> 2;
int y = (addr >> 12) & 0x3ff; const u32 y = (addr >> 12) & 0x3ff;
if (addr & 0x00800000) if (addr & 0x00800000)
{ {
@ -152,12 +152,12 @@ static void EFB_Write(u32 data, u32 addr)
else if (addr & 0x00400000) else if (addr & 0x00400000)
{ {
g_video_backend->Video_AccessEFB(EFBAccessType::PokeZ, x, y, data); g_video_backend->Video_AccessEFB(EFBAccessType::PokeZ, x, y, data);
DEBUG_LOG(MEMMAP, "EFB Z Write %08x @ %i, %i", data, x, y); DEBUG_LOG(MEMMAP, "EFB Z Write %08x @ %u, %u", data, x, y);
} }
else else
{ {
g_video_backend->Video_AccessEFB(EFBAccessType::PokeColor, x, y, data); g_video_backend->Video_AccessEFB(EFBAccessType::PokeColor, x, y, data);
DEBUG_LOG(MEMMAP, "EFB Color Write %08x @ %i, %i", data, x, y); DEBUG_LOG(MEMMAP, "EFB Color Write %08x @ %u, %u", data, x, y);
} }
} }