Clear framebuffer, thanks Gonetz! http://www.emutalk.net/threads/15818-How-to-implement-quot-emulate-clear-quot-Answer-and-Question This fixes the jumpy camera in DK64, also the sun and flames glare in Zelda
| 1071 | //Clear framebuffer, thanks Gonetz! http://www.emutalk.net/threads/15818-How-to-implement-quot-emulate-clear-quot-Answer-and-Question |
| 1072 | //This fixes the jumpy camera in DK64, also the sun and flames glare in Zelda |
| 1073 | void Clear_N64DepthBuffer( MicroCodeCommand command ) |
| 1074 | { |
| 1075 | u32 x0 {(u32)(command.fillrect.x0 + 1)}; |
| 1076 | u32 x1 {(u32)(command.fillrect.x1 + 1)}; |
| 1077 | u32 y1 {command.fillrect.y1}; |
| 1078 | u32 y0 {command.fillrect.y0}; |
| 1079 | |
| 1080 | // Using s32 to force min/max to be done in a single op code for the PSP |
| 1081 | x0 = Min<s32>(Max<s32>(x0, scissors.left), scissors.right); |
| 1082 | x1 = Min<s32>(Max<s32>(x1, scissors.left), scissors.right); |
| 1083 | y1 = Min<s32>(Max<s32>(y1, scissors.top), scissors.bottom); |
| 1084 | y0 = Min<s32>(Max<s32>(y0, scissors.top), scissors.bottom); |
| 1085 | x0 >>= 1; |
| 1086 | x1 >>= 1; |
| 1087 | u32 zi_width_in_dwords {g_CI.Width >> 1}; |
| 1088 | u32 fill_colour {gRenderer->GetFillColour()}; |
| 1089 | u32 * dst {(u32*)(g_pu8RamBase + g_CI.Address) + y0 * zi_width_in_dwords}; |
| 1090 | |
| 1091 | for( u32 y = y0; y <y1; y++ ) |
| 1092 | { |
| 1093 | for( u32 x = x0; x < x1; x++ ) |
| 1094 | { |
| 1095 | dst[x] = fill_colour; |
| 1096 | } |
| 1097 | dst += zi_width_in_dwords; |
| 1098 | } |
| 1099 | } |
| 1100 | |
| 1101 | //***************************************************************************** |
| 1102 | // |
no test coverage detected