From d2f28b69260276417af9cecbb4a9b196e356f379 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 23 May 2024 19:52:56 +1000 Subject: [PATCH] GPU: Explicit RemovePathLimits() is no longer needed --- src/core/gpu.cpp | 9 +++++---- src/core/system.cpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index 8c61a88c5..570fd11a8 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -19,6 +19,7 @@ #include "util/state_wrapper.h" #include "common/align.h" +#include "common/error.h" #include "common/file_system.h" #include "common/heap_array.h" #include "common/log.h" @@ -2702,15 +2703,15 @@ bool GPU::RenderScreenshotToFile(std::string filename, DisplayScreenshotMode mod if (!RenderScreenshotToBuffer(width, height, draw_rect, !internal_resolution, &pixels, &pixels_stride, &pixels_format)) { - Log_ErrorPrintf("Failed to render %ux%u screenshot", width, height); + Log_ErrorFmt("Failed to render {}x{} screenshot", width, height); return false; } - // These filenames tend to be fairly long, so remove any MAX_PATH limit. - auto fp = FileSystem::OpenManagedCFile(Path::RemoveLengthLimits(filename).c_str(), "wb"); + Error error; + auto fp = FileSystem::OpenManagedCFile(filename.c_str(), "wb", &error); if (!fp) { - Log_ErrorPrintf("Can't open file '%s': errno %d", filename.c_str(), errno); + Log_ErrorFmt("Can't open file '{}': {}", Path::GetFileName(filename), error.GetDescription()); return false; } diff --git a/src/core/system.cpp b/src/core/system.cpp index 9c4ccf9da..41fb8182c 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -4595,7 +4595,7 @@ bool System::SaveScreenshot(const char* filename, DisplayScreenshotMode mode, Di // handle quick screenshots to the same filename u32 next_suffix = 1; - while (FileSystem::FileExists(Path::RemoveLengthLimits(auto_filename).c_str())) + while (FileSystem::FileExists(auto_filename.c_str())) { auto_filename = fmt::format("{}" FS_OSPATH_SEPARATOR_STR "{} ({}).{}", EmuFolders::Screenshots, basename, next_suffix, extension);