diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index 463ec411c..78e7592a0 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -2318,7 +2318,7 @@ void CommonHostInterface::StopDumpingAudio() } bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, bool full_resolution /* = true */, - bool apply_aspect_ratio /* = true */) + bool apply_aspect_ratio /* = true */, bool compress_on_thread /* = true */) { if (System::IsShutdown()) return false; @@ -2342,7 +2342,14 @@ bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, b filename = auto_filename.c_str(); } - const bool screenshot_saved = m_display->WriteDisplayTextureToFile(filename, full_resolution, apply_aspect_ratio); + if (FileSystem::FileExists(filename)) + { + AddFormattedOSDMessage(10.0f, TranslateString("OSDMessage", "Screenshot file '%s' already exists."), filename); + return false; + } + + const bool screenshot_saved = + m_display->WriteDisplayTextureToFile(filename, full_resolution, apply_aspect_ratio, compress_on_thread); if (!screenshot_saved) { AddFormattedOSDMessage(10.0f, TranslateString("OSDMessage", "Failed to save screenshot to '%s'"), filename); diff --git a/src/frontend-common/common_host_interface.h b/src/frontend-common/common_host_interface.h index 733333591..af57c6df6 100644 --- a/src/frontend-common/common_host_interface.h +++ b/src/frontend-common/common_host_interface.h @@ -151,7 +151,8 @@ public: void StopDumpingAudio(); /// Saves a screenshot to the specified file. IF no file name is provided, one will be generated automatically. - bool SaveScreenshot(const char* filename = nullptr, bool full_resolution = true, bool apply_aspect_ratio = true); + bool SaveScreenshot(const char* filename = nullptr, bool full_resolution = true, bool apply_aspect_ratio = true, + bool compress_on_thread = true); /// Loads the cheat list from the specified file. bool LoadCheatList(const char* filename);