Skip to content

Commit

Permalink
Fix savestate thumbnails - '.png' needs to be appended to the total
Browse files Browse the repository at this point in the history
filepath, so fill_pathname can't be used since it would overwrite
the existing extension
  • Loading branch information
LibretroAdmin committed Dec 30, 2024
1 parent 3a43302 commit 33ec893
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tasks/task_screenshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,13 @@ static bool screenshot_dump(
if (!fullpath)
{
if (savestate)
fill_pathname(state->filename,
name_base, ".png", sizeof(state->filename));
{
size_t _len = strlcpy(state->filename,
name_base, sizeof(state->filename));
strlcpy(state->filename + _len,
".png",
sizeof(state->filename) - _len);
}
else
{
char new_screenshot_dir[DIR_MAX_LENGTH];
Expand Down Expand Up @@ -361,9 +366,14 @@ static bool screenshot_dump(
IMG_EXT, sizeof(state->shotname));
}
else
fill_pathname(state->shotname,
path_basename_nocompression(name_base),
".png", sizeof(state->shotname));
{
size_t _len = strlcpy(state->shotname,
path_basename_nocompression(name_base),
sizeof(state->shotname));
strlcpy(state->shotname + _len,
".png",
sizeof(state->shotname) - _len);
}

if ( string_is_empty(new_screenshot_dir)
|| settings->bools.screenshots_in_content_dir)
Expand Down

0 comments on commit 33ec893

Please sign in to comment.