cellAvconfExt: add some trivial param checks

This commit is contained in:
Megamouse 2021-11-11 22:23:45 +01:00
parent aea1ec2594
commit 88d0b7d135
2 changed files with 12 additions and 2 deletions

View File

@ -201,6 +201,11 @@ error_code cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> gamma)
{ {
cellAvconfExt.warning("cellVideoOutGetGamma(videoOut=%d, gamma=*0x%x)", videoOut, gamma); cellAvconfExt.warning("cellVideoOutGetGamma(videoOut=%d, gamma=*0x%x)", videoOut, gamma);
if (!gamma)
{
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
}
if (videoOut != CELL_VIDEO_OUT_PRIMARY) if (videoOut != CELL_VIDEO_OUT_PRIMARY)
{ {
return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
@ -301,6 +306,11 @@ error_code cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<f32> screenSize)
{ {
cellAvconfExt.warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize=*0x%x)", videoOut, screenSize); cellAvconfExt.warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize=*0x%x)", videoOut, screenSize);
if (!screenSize)
{
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
}
if (videoOut != CELL_VIDEO_OUT_PRIMARY) if (videoOut != CELL_VIDEO_OUT_PRIMARY)
{ {
return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;

View File

@ -626,7 +626,7 @@ void gs_frame::take_screenshot(std::vector<u8> data, const u32 sshot_width, cons
const auto& avconf = g_fxo->get<rsx::avconf>(); const auto& avconf = g_fxo->get<rsx::avconf>();
auto new_size = avconf.aspect_convert_dimensions(size2u{ u32(img.width()), u32(img.height()) }); auto new_size = avconf.aspect_convert_dimensions(size2u{ u32(img.width()), u32(img.height()) });
if (new_size.width != img.width() || new_size.height != img.height()) if (new_size.width != static_cast<u32>(img.width()) || new_size.height != static_cast<u32>(img.height()))
{ {
img = img.scaled(QSize(new_size.width, new_size.height), Qt::AspectRatioMode::IgnoreAspectRatio, Qt::TransformationMode::SmoothTransformation); img = img.scaled(QSize(new_size.width, new_size.height), Qt::AspectRatioMode::IgnoreAspectRatio, Qt::TransformationMode::SmoothTransformation);
img.convertTo(QImage::Format_RGBA8888); // The current Qt version changes the image format during smooth scaling, so we have to change it back. img.convertTo(QImage::Format_RGBA8888); // The current Qt version changes the image format during smooth scaling, so we have to change it back.
@ -679,7 +679,7 @@ void gs_frame::take_screenshot(std::vector<u8> data, const u32 sshot_width, cons
// Scale the resolution first (as seen before with the image) // Scale the resolution first (as seen before with the image)
new_size = avconf.aspect_convert_dimensions(size2u{ avconf.resolution_x, avconf.resolution_y }); new_size = avconf.aspect_convert_dimensions(size2u{ avconf.resolution_x, avconf.resolution_y });
if (new_size.width != img.width() || new_size.height != img.height()) if (new_size.width != static_cast<u32>(img.width()) || new_size.height != static_cast<u32>(img.height()))
{ {
const int scale = rsx::get_resolution_scale_percent(); const int scale = rsx::get_resolution_scale_percent();
const int x = (scale * manager.overlay_offset_x) / 100; const int x = (scale * manager.overlay_offset_x) / 100;