BPStructs: Use static cast for XFB/EFB copies

This commit is contained in:
iwubcode
2017-12-21 21:16:21 -06:00
parent e1332b1d7e
commit 50d96a4411

View File

@ -214,14 +214,14 @@ static void BPWritten(const BPCmd& bp)
u32 destStride = bpmem.copyMipMapStrideChannels << 5; u32 destStride = bpmem.copyMipMapStrideChannels << 5;
EFBRectangle srcRect; EFBRectangle srcRect;
srcRect.left = (int)bpmem.copyTexSrcXY.x; srcRect.left = static_cast<int>(bpmem.copyTexSrcXY.x);
srcRect.top = (int)bpmem.copyTexSrcXY.y; srcRect.top = static_cast<int>(bpmem.copyTexSrcXY.y);
// Here Width+1 like Height, otherwise some textures are corrupted already since the native // Here Width+1 like Height, otherwise some textures are corrupted already since the native
// resolution. // resolution.
// TODO: What's the behavior of out of bound access? // TODO: What's the behavior of out of bound access?
srcRect.right = (int)(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1); srcRect.right = static_cast<int>(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1);
srcRect.bottom = (int)(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1); srcRect.bottom = static_cast<int>(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1);
UPE_Copy PE_copy = bpmem.triggerEFBCopy; UPE_Copy PE_copy = bpmem.triggerEFBCopy;
@ -246,13 +246,13 @@ static void BPWritten(const BPCmd& bp)
float yScale; float yScale;
if (PE_copy.scale_invert) if (PE_copy.scale_invert)
yScale = 256.0f / (float)bpmem.dispcopyyscale; yScale = 256.0f / static_cast<float>(bpmem.dispcopyyscale);
else else
yScale = (float)bpmem.dispcopyyscale / 256.0f; yScale = static_cast<float>(bpmem.dispcopyyscale) / 256.0f;
float num_xfb_lines = 1.0f + bpmem.copyTexSrcWH.y * yScale; float num_xfb_lines = 1.0f + bpmem.copyTexSrcWH.y * yScale;
srcRect.bottom = (int)(bpmem.copyTexSrcXY.y + num_xfb_lines); srcRect.bottom = static_cast<int>(bpmem.copyTexSrcXY.y + num_xfb_lines);
u32 height = static_cast<u32>(num_xfb_lines); u32 height = static_cast<u32>(num_xfb_lines);