Skip to content

Commit d90ff21

Browse files
committed
Fix crash on HW core savestate screenshot size larger than display
1 parent 9081fc0 commit d90ff21

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tasks/task_screenshot.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,21 @@ static bool screenshot_dump(
323323
video_driver_state_t *video_st = video_state_get_ptr();
324324
if (video_st)
325325
{
326-
state->out_width = (video_st->frame_cache_width <= 4)
326+
state->out_width = (video_st->frame_cache_width <= 4)
327327
? video_st->av_info.geometry.base_width
328328
: video_st->frame_cache_width;
329-
state->out_height = (video_st->frame_cache_height <= 4)
329+
state->out_height = (video_st->frame_cache_height <= 4)
330330
? video_st->av_info.geometry.base_height
331331
: video_st->frame_cache_height;
332332
}
333333

334+
/* Fallback to display size if smaller than core output */
335+
if (state->out_width > width || state->out_height > height)
336+
{
337+
state->out_width = width;
338+
state->out_height = height;
339+
}
340+
334341
state->flags |= SS_TASK_FLAG_SILENCE;
335342
}
336343

0 commit comments

Comments
 (0)