From 98427685e04950e4223621e640df84f33f58171c Mon Sep 17 00:00:00 2001 From: LeandroLP23 Date: Fri, 9 Oct 2026 10:40:55 +0200 Subject: [PATCH] fix(agc): stop the profile output at shutdown only if it was created Co-Authored-By: Claude Opus 5.5 --- .../libSceAgcDriver/Execution/include/ProfileOutput.hpp | 8 ++++++++ .../libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp | 2 +- core/libs/prx/libSceVideoOut/CMakeLists.txt | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/libs/prx/libSceAgcDriver/Execution/include/ProfileOutput.hpp b/core/libs/prx/libSceAgcDriver/Execution/include/ProfileOutput.hpp index e64473e6c..6daec3ba8 100644 --- a/core/libs/prx/libSceAgcDriver/Execution/include/ProfileOutput.hpp +++ b/core/libs/prx/libSceAgcDriver/Execution/include/ProfileOutput.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include #include @@ -135,14 +136,21 @@ private: std::thread worker; }; +inline std::atomic createdProfileOutput{nullptr}; + inline ProfileOutput& ProfileOutput_nid_no_patch() { static ProfileOutput output([](std::string_view text) { if (std::fwrite(text.data(), 1, text.size(), stderr) != text.size() || std::fflush(stderr) != 0) throw std::runtime_error("profile output write failed"); }); + createdProfileOutput.store(&output, std::memory_order_release); return output; } +inline void StopProfileOutput_nid_no_patch() { + if (auto* output = createdProfileOutput.load(std::memory_order_acquire)) output->Stop(); +} + template void ProfilePrint_nid_no_patch(const char* format, TArgs... args) { ProfileOutput_nid_no_patch().Print(format, args...); diff --git a/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp index 8eae6d210..ebe789113 100644 --- a/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp +++ b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp @@ -45,7 +45,7 @@ void Driver::stop() { device.Reset(); replacedDevices.clear(); Graphics::ShutdownGuestBufferWorkers(); - ProfileOutput_nid_no_patch().Stop(); + StopProfileOutput_nid_no_patch(); stopped = true; } diff --git a/core/libs/prx/libSceVideoOut/CMakeLists.txt b/core/libs/prx/libSceVideoOut/CMakeLists.txt index 35c71425e..2a15963e5 100644 --- a/core/libs/prx/libSceVideoOut/CMakeLists.txt +++ b/core/libs/prx/libSceVideoOut/CMakeLists.txt @@ -48,6 +48,10 @@ if(BUILD_TESTING) if(WIN32) set_tests_properties(guest_video_out_wqhd_detection PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$") + add_test(NAME guest_video_out_wqhd_detection_no_vulkan COMMAND guest_video_out_wqhd_detection_tests) + set_tests_properties(guest_video_out_wqhd_detection_no_vulkan PROPERTIES TIMEOUT 20 SKIP_RETURN_CODE 77 + ENVIRONMENT "VK_DRIVER_FILES=${CMAKE_CURRENT_BINARY_DIR}/missing_icd.json;VK_ICD_FILENAMES=${CMAKE_CURRENT_BINARY_DIR}/missing_icd.json" + ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$") endif() endif()