{
s16 viewport_start_x = list[0] & 0x3FF;
s16 viewport_start_y = (list[0] >> 10) & 0x1FF;
- u32 d;
+ u32 w;
+ s32 d;
if(viewport_start_x == psx_gpu->viewport_start_x &&
viewport_start_y == psx_gpu->viewport_start_y)
psx_gpu->saved_viewport_start_x = viewport_start_x;
psx_gpu->saved_viewport_start_y = viewport_start_y;
- d = (u32)psx_gpu->viewport_end_x - (u32)viewport_start_x + 1;
- if((u32)psx_gpu->enhancement_x_threshold - d <= 16)
+ w = (u32)psx_gpu->viewport_end_x - (u32)viewport_start_x + 1;
+ d = psx_gpu->enhancement_x_threshold - w;
+ if(-16 <= d && d <= 16)
{
update_enhancement_buf_table_from_x(psx_gpu,
- viewport_start_x, d);
+ viewport_start_x, w);
}
select_enhancement_buf(psx_gpu);
{
s16 viewport_end_x = list[0] & 0x3FF;
s16 viewport_end_y = (list[0] >> 10) & 0x1FF;
- u32 d;
+ u32 w;
+ s32 d;
if(viewport_end_x == psx_gpu->viewport_end_x &&
viewport_end_y == psx_gpu->viewport_end_y)
psx_gpu->saved_viewport_end_x = viewport_end_x;
psx_gpu->saved_viewport_end_y = viewport_end_y;
- d = (u32)viewport_end_x - (u32)psx_gpu->viewport_start_x + 1;
- if((u32)psx_gpu->enhancement_x_threshold - d <= 16)
+ w = (u32)viewport_end_x - (u32)psx_gpu->viewport_start_x + 1;
+ d = psx_gpu->enhancement_x_threshold - w;
+ if(-16 <= d && d <= 16)
{
update_enhancement_buf_table_from_x(psx_gpu,
- psx_gpu->viewport_start_x, d);
+ psx_gpu->viewport_start_x, w);
}
select_enhancement_buf(psx_gpu);