mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-05-01 12:45:42 -04:00
GPU: Prevent potential overflow in CRTC visible area calculation
This commit is contained in:
parent
78e42d9b4c
commit
866cbdca4b
@ -568,6 +568,14 @@ void GPU::UpdateCRTCDisplayParameters()
|
|||||||
cs.vertical_visible_end = vertical_display_end;
|
cs.vertical_visible_end = vertical_display_end;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
cs.horizontal_visible_start =
|
||||||
|
std::clamp<u16>(cs.horizontal_visible_start, PAL_HORIZONTAL_ACTIVE_START, PAL_HORIZONTAL_ACTIVE_END);
|
||||||
|
cs.horizontal_visible_end =
|
||||||
|
std::clamp<u16>(cs.horizontal_visible_end, cs.horizontal_visible_start, PAL_HORIZONTAL_ACTIVE_END);
|
||||||
|
cs.vertical_visible_start =
|
||||||
|
std::clamp<u16>(cs.vertical_visible_start, PAL_VERTICAL_ACTIVE_START, PAL_VERTICAL_ACTIVE_END);
|
||||||
|
cs.vertical_visible_end =
|
||||||
|
std::clamp<u16>(cs.vertical_visible_end, cs.vertical_visible_start, PAL_VERTICAL_ACTIVE_END);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -597,6 +605,14 @@ void GPU::UpdateCRTCDisplayParameters()
|
|||||||
cs.vertical_visible_end = vertical_display_end;
|
cs.vertical_visible_end = vertical_display_end;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
cs.horizontal_visible_start =
|
||||||
|
std::clamp<u16>(cs.horizontal_visible_start, NTSC_HORIZONTAL_ACTIVE_START, NTSC_HORIZONTAL_ACTIVE_END);
|
||||||
|
cs.horizontal_visible_end =
|
||||||
|
std::clamp<u16>(cs.horizontal_visible_end, cs.horizontal_visible_start, NTSC_HORIZONTAL_ACTIVE_END);
|
||||||
|
cs.vertical_visible_start =
|
||||||
|
std::clamp<u16>(cs.vertical_visible_start, NTSC_VERTICAL_ACTIVE_START, NTSC_VERTICAL_ACTIVE_END);
|
||||||
|
cs.vertical_visible_end =
|
||||||
|
std::clamp<u16>(cs.vertical_visible_end, cs.vertical_visible_start, NTSC_VERTICAL_ACTIVE_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If force-progressive is enabled, we only double the height in 480i mode. This way non-interleaved 480i framebuffers
|
// If force-progressive is enabled, we only double the height in 480i mode. This way non-interleaved 480i framebuffers
|
||||||
|
@ -497,6 +497,7 @@ protected:
|
|||||||
u16 display_vram_width;
|
u16 display_vram_width;
|
||||||
u16 display_vram_height;
|
u16 display_vram_height;
|
||||||
|
|
||||||
|
// Visible range of the screen, in GPU ticks/lines. Clamped to lie within the active video region.
|
||||||
u16 horizontal_visible_start;
|
u16 horizontal_visible_start;
|
||||||
u16 horizontal_visible_end;
|
u16 horizontal_visible_end;
|
||||||
u16 vertical_visible_start;
|
u16 vertical_visible_start;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user