1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

copy only modified pixels to RDRAM

0 is used as test color. If pixels are 0 they are not copied. This fixes
the crash in Donkey Kong 64 (E) issue #355
This commit is contained in:
purplemarshmallow 2015-11-18 19:28:56 +01:00 committed by Sergey Lipskiy
parent 2b95cc4037
commit 84611502c6

View File

@ -1066,7 +1066,8 @@ void FrameBufferToRDRAM::CopyToRDRAM(u32 _address, bool _sync)
for (u32 y = 0; y < height; ++y) {
for (u32 x = 0; x < pBuffer->m_width; ++x) {
c.raw = ptr_src[x + (height - y - 1)*pBuffer->m_width];
ptr_dst[(x + y*pBuffer->m_width)] = (c.r << 24) | (c.g << 16) | (c.b << 8) | c.a;
if (c.raw != 0)
ptr_dst[(x + y*pBuffer->m_width)] = (c.r << 24) | (c.g << 16) | (c.b << 8) | c.a;
}
}
} else if (pBuffer->m_size == G_IM_SIZ_16b) {
@ -1077,7 +1078,8 @@ void FrameBufferToRDRAM::CopyToRDRAM(u32 _address, bool _sync)
for (u32 y = 0; y < height; ++y) {
for (u32 x = 0; x < pBuffer->m_width; ++x) {
c.raw = ptr_src[x + (height - y - 1)*pBuffer->m_width];
ptr_dst[(x + y*pBuffer->m_width) ^ 1] = ((c.r >> 3) << 11) | ((c.g >> 3) << 6) | ((c.b >> 3) << 1) | (c.a == 0 ? 0 : 1);
if (c.raw != 0)
ptr_dst[(x + y*pBuffer->m_width) ^ 1] = ((c.r >> 3) << 11) | ((c.g >> 3) << 6) | ((c.b >> 3) << 1) | (c.a == 0 ? 0 : 1);
}
}
}