diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2023-10-27 00:27:44 +0200 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2023-10-27 06:29:52 +0200 |
commit | f26dddf3b59ace84626dc05e2699514579d4a5bc (patch) | |
tree | 6521620938a6f644ae848b4ed632cf3f8c3c192c /src/core/hle/service/caps/caps_su.cpp | |
parent | Merge pull request #11880 from abouvier/unbundle-stb (diff) | |
download | yuzu-f26dddf3b59ace84626dc05e2699514579d4a5bc.tar yuzu-f26dddf3b59ace84626dc05e2699514579d4a5bc.tar.gz yuzu-f26dddf3b59ace84626dc05e2699514579d4a5bc.tar.bz2 yuzu-f26dddf3b59ace84626dc05e2699514579d4a5bc.tar.lz yuzu-f26dddf3b59ace84626dc05e2699514579d4a5bc.tar.xz yuzu-f26dddf3b59ace84626dc05e2699514579d4a5bc.tar.zst yuzu-f26dddf3b59ace84626dc05e2699514579d4a5bc.zip |
Diffstat (limited to 'src/core/hle/service/caps/caps_su.cpp')
-rw-r--r-- | src/core/hle/service/caps/caps_su.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/src/core/hle/service/caps/caps_su.cpp b/src/core/hle/service/caps/caps_su.cpp index e85625ee4..296b07b00 100644 --- a/src/core/hle/service/caps/caps_su.cpp +++ b/src/core/hle/service/caps/caps_su.cpp @@ -2,10 +2,12 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "common/logging/log.h" +#include "core/core.h" #include "core/hle/service/caps/caps_manager.h" #include "core/hle/service/caps/caps_su.h" #include "core/hle/service/caps/caps_types.h" #include "core/hle/service/ipc_helpers.h" +#include "video_core/renderer_base.h" namespace Service::Capture { @@ -58,8 +60,10 @@ void IScreenShotApplicationService::SaveScreenShotEx0(HLERequestContext& ctx) { parameters.applet_resource_user_id); ApplicationAlbumEntry entry{}; - const auto result = manager->SaveScreenShot(entry, parameters.attribute, image_data_buffer, - parameters.applet_resource_user_id); + manager->FlipVerticallyOnWrite(false); + const auto result = + manager->SaveScreenShot(entry, parameters.attribute, parameters.report_option, + image_data_buffer, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 10}; rb.Push(result); @@ -88,13 +92,43 @@ void IScreenShotApplicationService::SaveScreenShotEx1(HLERequestContext& ctx) { ApplicationAlbumEntry entry{}; ApplicationData app_data{}; std::memcpy(&app_data, app_data_buffer.data(), sizeof(ApplicationData)); + manager->FlipVerticallyOnWrite(false); const auto result = - manager->SaveScreenShot(entry, parameters.attribute, app_data, image_data_buffer, - parameters.applet_resource_user_id); + manager->SaveScreenShot(entry, parameters.attribute, parameters.report_option, app_data, + image_data_buffer, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 10}; rb.Push(result); rb.PushRaw(entry); } +void IScreenShotApplicationService::CaptureAndSaveScreenshot(AlbumReportOption report_option) { + auto& renderer = system.Renderer(); + Layout::FramebufferLayout layout = + Layout::DefaultFrameLayout(screenshot_width, screenshot_height); + + const Capture::ScreenShotAttribute attribute{ + .unknown_0{}, + .orientation = Capture::AlbumImageOrientation::None, + .unknown_1{}, + .unknown_2{}, + }; + + renderer.RequestScreenshot( + image_data.data(), + [attribute, report_option, this](bool invert_y) { + // Convert from BGRA to RGBA + for (std::size_t i = 0; i < image_data.size(); i += bytes_per_pixel) { + const u8 temp = image_data[i]; + image_data[i] = image_data[i + 2]; + image_data[i + 2] = temp; + } + + Capture::ApplicationAlbumEntry entry{}; + manager->FlipVerticallyOnWrite(invert_y); + manager->SaveScreenShot(entry, attribute, report_option, image_data, {}); + }, + layout); +} + } // namespace Service::Capture |