From 224a75d83958eda9c563fb4a9c656db285438f9d Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 31 Mar 2020 19:16:36 -0400 Subject: [PATCH] capsrv: Split Capture services into individual files and stub GetAlbumContentsFileListForApplication (#3571) * Organize capture services into individual files * Stub GetAlbumContentsFileListForApplication * Address feedback --- src/core/CMakeLists.txt | 12 ++ src/core/hle/service/caps/caps.cpp | 158 ++------------------------ src/core/hle/service/caps/caps.h | 71 ++++++++++++ src/core/hle/service/caps/caps_a.cpp | 78 +++++++++++++ src/core/hle/service/caps/caps_a.h | 21 ++++ src/core/hle/service/caps/caps_c.cpp | 75 ++++++++++++ src/core/hle/service/caps/caps_c.h | 21 ++++ src/core/hle/service/caps/caps_sc.cpp | 40 +++++++ src/core/hle/service/caps/caps_sc.h | 21 ++++ src/core/hle/service/caps/caps_ss.cpp | 26 +++++ src/core/hle/service/caps/caps_ss.h | 21 ++++ src/core/hle/service/caps/caps_su.cpp | 22 ++++ src/core/hle/service/caps/caps_su.h | 21 ++++ src/core/hle/service/caps/caps_u.cpp | 76 +++++++++++++ src/core/hle/service/caps/caps_u.h | 24 ++++ 15 files changed, 536 insertions(+), 151 deletions(-) create mode 100644 src/core/hle/service/caps/caps_a.cpp create mode 100644 src/core/hle/service/caps/caps_a.h create mode 100644 src/core/hle/service/caps/caps_c.cpp create mode 100644 src/core/hle/service/caps/caps_c.h create mode 100644 src/core/hle/service/caps/caps_sc.cpp create mode 100644 src/core/hle/service/caps/caps_sc.h create mode 100644 src/core/hle/service/caps/caps_ss.cpp create mode 100644 src/core/hle/service/caps/caps_ss.h create mode 100644 src/core/hle/service/caps/caps_su.cpp create mode 100644 src/core/hle/service/caps/caps_su.h create mode 100644 src/core/hle/service/caps/caps_u.cpp create mode 100644 src/core/hle/service/caps/caps_u.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b31a0328c1..e836bf3965 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -287,6 +287,18 @@ add_library(core STATIC hle/service/btm/btm.h hle/service/caps/caps.cpp hle/service/caps/caps.h + hle/service/caps/caps_a.cpp + hle/service/caps/caps_a.h + hle/service/caps/caps_c.cpp + hle/service/caps/caps_c.h + hle/service/caps/caps_u.cpp + hle/service/caps/caps_u.h + hle/service/caps/caps_sc.cpp + hle/service/caps/caps_sc.h + hle/service/caps/caps_ss.cpp + hle/service/caps/caps_ss.h + hle/service/caps/caps_su.cpp + hle/service/caps/caps_su.h hle/service/erpt/erpt.cpp hle/service/erpt/erpt.h hle/service/es/es.cpp diff --git a/src/core/hle/service/caps/caps.cpp b/src/core/hle/service/caps/caps.cpp index 907f464ab1..26c8a70813 100644 --- a/src/core/hle/service/caps/caps.cpp +++ b/src/core/hle/service/caps/caps.cpp @@ -2,168 +2,24 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include - #include "core/hle/service/caps/caps.h" +#include "core/hle/service/caps/caps_a.h" +#include "core/hle/service/caps/caps_c.h" +#include "core/hle/service/caps/caps_sc.h" +#include "core/hle/service/caps/caps_ss.h" +#include "core/hle/service/caps/caps_su.h" +#include "core/hle/service/caps/caps_u.h" #include "core/hle/service/service.h" -#include "core/hle/service/sm/sm.h" namespace Service::Capture { -class CAPS_A final : public ServiceFramework { -public: - explicit CAPS_A() : ServiceFramework{"caps:a"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetAlbumFileCount"}, - {1, nullptr, "GetAlbumFileList"}, - {2, nullptr, "LoadAlbumFile"}, - {3, nullptr, "DeleteAlbumFile"}, - {4, nullptr, "StorageCopyAlbumFile"}, - {5, nullptr, "IsAlbumMounted"}, - {6, nullptr, "GetAlbumUsage"}, - {7, nullptr, "GetAlbumFileSize"}, - {8, nullptr, "LoadAlbumFileThumbnail"}, - {9, nullptr, "LoadAlbumScreenShotImage"}, - {10, nullptr, "LoadAlbumScreenShotThumbnailImage"}, - {11, nullptr, "GetAlbumEntryFromApplicationAlbumEntry"}, - {12, nullptr, "Unknown12"}, - {13, nullptr, "Unknown13"}, - {14, nullptr, "Unknown14"}, - {15, nullptr, "Unknown15"}, - {16, nullptr, "Unknown16"}, - {17, nullptr, "Unknown17"}, - {18, nullptr, "Unknown18"}, - {202, nullptr, "SaveEditedScreenShot"}, - {301, nullptr, "GetLastThumbnail"}, - {401, nullptr, "GetAutoSavingStorage"}, - {501, nullptr, "GetRequiredStorageSpaceSizeToCopyAll"}, - {1001, nullptr, "Unknown1001"}, - {1002, nullptr, "Unknown1002"}, - {1003, nullptr, "Unknown1003"}, - {8001, nullptr, "ForceAlbumUnmounted"}, - {8002, nullptr, "ResetAlbumMountStatus"}, - {8011, nullptr, "RefreshAlbumCache"}, - {8012, nullptr, "GetAlbumCache"}, - {8013, nullptr, "Unknown8013"}, - {8021, nullptr, "GetAlbumEntryFromApplicationAlbumEntryAruid"}, - {10011, nullptr, "SetInternalErrorConversionEnabled"}, - {50000, nullptr, "Unknown50000"}, - {60002, nullptr, "Unknown60002"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; - -class CAPS_C final : public ServiceFramework { -public: - explicit CAPS_C() : ServiceFramework{"caps:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {33, nullptr, "Unknown33"}, - {2001, nullptr, "Unknown2001"}, - {2002, nullptr, "Unknown2002"}, - {2011, nullptr, "Unknown2011"}, - {2012, nullptr, "Unknown2012"}, - {2013, nullptr, "Unknown2013"}, - {2014, nullptr, "Unknown2014"}, - {2101, nullptr, "Unknown2101"}, - {2102, nullptr, "Unknown2102"}, - {2201, nullptr, "Unknown2201"}, - {2301, nullptr, "Unknown2301"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; - -class CAPS_SC final : public ServiceFramework { -public: - explicit CAPS_SC() : ServiceFramework{"caps:sc"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "Unknown1"}, - {2, nullptr, "Unknown2"}, - {1001, nullptr, "Unknown3"}, - {1002, nullptr, "Unknown4"}, - {1003, nullptr, "Unknown5"}, - {1011, nullptr, "Unknown6"}, - {1012, nullptr, "Unknown7"}, - {1201, nullptr, "Unknown8"}, - {1202, nullptr, "Unknown9"}, - {1203, nullptr, "Unknown10"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; - -class CAPS_SS final : public ServiceFramework { -public: - explicit CAPS_SS() : ServiceFramework{"caps:ss"} { - // clang-format off - static const FunctionInfo functions[] = { - {201, nullptr, "Unknown1"}, - {202, nullptr, "Unknown2"}, - {203, nullptr, "Unknown3"}, - {204, nullptr, "Unknown4"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; - -class CAPS_SU final : public ServiceFramework { -public: - explicit CAPS_SU() : ServiceFramework{"caps:su"} { - // clang-format off - static const FunctionInfo functions[] = { - {201, nullptr, "SaveScreenShot"}, - {203, nullptr, "SaveScreenShotEx0"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; - -class CAPS_U final : public ServiceFramework { -public: - explicit CAPS_U() : ServiceFramework{"caps:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {32, nullptr, "SetShimLibraryVersion"}, - {102, nullptr, "GetAlbumFileListByAruid"}, - {103, nullptr, "DeleteAlbumFileByAruid"}, - {104, nullptr, "GetAlbumFileSizeByAruid"}, - {105, nullptr, "DeleteAlbumFileByAruidForDebug"}, - {110, nullptr, "LoadAlbumScreenShotImageByAruid"}, - {120, nullptr, "LoadAlbumScreenShotThumbnailImageByAruid"}, - {130, nullptr, "PrecheckToCreateContentsByAruid"}, - {140, nullptr, "GetAlbumFileList1AafeAruidDeprecated"}, - {141, nullptr, "GetAlbumFileList2AafeUidAruidDeprecated"}, - {142, nullptr, "GetAlbumFileList3AaeAruid"}, - {143, nullptr, "GetAlbumFileList4AaeUidAruid"}, - {60002, nullptr, "OpenAccessorSessionForApplication"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; - void InstallInterfaces(SM::ServiceManager& sm) { std::make_shared()->InstallAsService(sm); std::make_shared()->InstallAsService(sm); + std::make_shared()->InstallAsService(sm); std::make_shared()->InstallAsService(sm); std::make_shared()->InstallAsService(sm); std::make_shared()->InstallAsService(sm); - std::make_shared()->InstallAsService(sm); } } // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps.h b/src/core/hle/service/caps/caps.h index 471185dfa0..fc70a4c27a 100644 --- a/src/core/hle/service/caps/caps.h +++ b/src/core/hle/service/caps/caps.h @@ -4,12 +4,83 @@ #pragma once +#include "core/hle/service/service.h" + namespace Service::SM { class ServiceManager; } namespace Service::Capture { +enum AlbumImageOrientation { + Orientation0 = 0, + Orientation1 = 1, + Orientation2 = 2, + Orientation3 = 3, +}; + +enum AlbumReportOption { + Disable = 0, + Enable = 1, +}; + +enum ContentType : u8 { + Screenshot = 0, + Movie = 1, + ExtraMovie = 3, +}; + +enum AlbumStorage : u8 { + NAND = 0, + SD = 1, +}; + +struct AlbumFileDateTime { + u16 year; + u8 month; + u8 day; + u8 hour; + u8 minute; + u8 second; + u8 uid; +}; + +struct AlbumEntry { + u64 size; + u64 application_id; + AlbumFileDateTime datetime; + AlbumStorage storage; + ContentType content; + u8 padding[6]; +}; + +struct AlbumFileEntry { + u64 size; + u64 hash; + AlbumFileDateTime datetime; + AlbumStorage storage; + ContentType content; + u8 padding[5]; + u8 unknown; +}; + +struct ApplicationAlbumEntry { + u64 size; + u64 hash; + AlbumFileDateTime datetime; + AlbumStorage storage; + ContentType content; + u8 padding[5]; + u8 unknown; +}; + +struct ApplicationAlbumFileEntry { + ApplicationAlbumEntry entry; + AlbumFileDateTime datetime; + u64 unknown; +}; + +/// Registers all Capture services with the specified service manager. void InstallInterfaces(SM::ServiceManager& sm); } // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_a.cpp b/src/core/hle/service/caps/caps_a.cpp new file mode 100644 index 0000000000..88a3fdc055 --- /dev/null +++ b/src/core/hle/service/caps/caps_a.cpp @@ -0,0 +1,78 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/caps/caps_a.h" + +namespace Service::Capture { + +class IAlbumAccessorSession final : public ServiceFramework { +public: + explicit IAlbumAccessorSession() : ServiceFramework{"IAlbumAccessorSession"} { + // clang-format off + static const FunctionInfo functions[] = { + {2001, nullptr, "OpenAlbumMovieReadStream"}, + {2002, nullptr, "CloseAlbumMovieReadStream"}, + {2003, nullptr, "GetAlbumMovieReadStreamMovieDataSize"}, + {2004, nullptr, "ReadMovieDataFromAlbumMovieReadStream"}, + {2005, nullptr, "GetAlbumMovieReadStreamBrokenReason"}, + {2006, nullptr, "GetAlbumMovieReadStreamImageDataSize"}, + {2007, nullptr, "ReadImageDataFromAlbumMovieReadStream"}, + {2008, nullptr, "ReadFileAttributeFromAlbumMovieReadStream"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + +CAPS_A::CAPS_A() : ServiceFramework("caps:a") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetAlbumFileCount"}, + {1, nullptr, "GetAlbumFileList"}, + {2, nullptr, "LoadAlbumFile"}, + {3, nullptr, "DeleteAlbumFile"}, + {4, nullptr, "StorageCopyAlbumFile"}, + {5, nullptr, "IsAlbumMounted"}, + {6, nullptr, "GetAlbumUsage"}, + {7, nullptr, "GetAlbumFileSize"}, + {8, nullptr, "LoadAlbumFileThumbnail"}, + {9, nullptr, "LoadAlbumScreenShotImage"}, + {10, nullptr, "LoadAlbumScreenShotThumbnailImage"}, + {11, nullptr, "GetAlbumEntryFromApplicationAlbumEntry"}, + {12, nullptr, "LoadAlbumScreenShotImageEx"}, + {13, nullptr, "LoadAlbumScreenShotThumbnailImageEx"}, + {14, nullptr, "LoadAlbumScreenShotImageEx0"}, + {15, nullptr, "GetAlbumUsage3"}, + {16, nullptr, "GetAlbumMountResult"}, + {17, nullptr, "GetAlbumUsage16"}, + {18, nullptr, "Unknown18"}, + {100, nullptr, "GetAlbumFileCountEx0"}, + {101, nullptr, "GetAlbumFileListEx0"}, + {202, nullptr, "SaveEditedScreenShot"}, + {301, nullptr, "GetLastThumbnail"}, + {302, nullptr, "GetLastOverlayMovieThumbnail"}, + {401, nullptr, "GetAutoSavingStorage"}, + {501, nullptr, "GetRequiredStorageSpaceSizeToCopyAll"}, + {1001, nullptr, "LoadAlbumScreenShotThumbnailImageEx0"}, + {1002, nullptr, "LoadAlbumScreenShotImageEx1"}, + {1003, nullptr, "LoadAlbumScreenShotThumbnailImageEx1"}, + {8001, nullptr, "ForceAlbumUnmounted"}, + {8002, nullptr, "ResetAlbumMountStatus"}, + {8011, nullptr, "RefreshAlbumCache"}, + {8012, nullptr, "GetAlbumCache"}, + {8013, nullptr, "GetAlbumCacheEx"}, + {8021, nullptr, "GetAlbumEntryFromApplicationAlbumEntryAruid"}, + {10011, nullptr, "SetInternalErrorConversionEnabled"}, + {50000, nullptr, "LoadMakerNoteInfoForDebug"}, + {60002, nullptr, "OpenAccessorSession"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +CAPS_A::~CAPS_A() = default; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h new file mode 100644 index 0000000000..8de832491c --- /dev/null +++ b/src/core/hle/service/caps/caps_a.h @@ -0,0 +1,21 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service::Capture { + +class CAPS_A final : public ServiceFramework { +public: + explicit CAPS_A(); + ~CAPS_A() override; +}; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_c.cpp b/src/core/hle/service/caps/caps_c.cpp new file mode 100644 index 0000000000..ea6452ffa1 --- /dev/null +++ b/src/core/hle/service/caps/caps_c.cpp @@ -0,0 +1,75 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/caps/caps_c.h" + +namespace Service::Capture { + +class IAlbumControlSession final : public ServiceFramework { +public: + explicit IAlbumControlSession() : ServiceFramework{"IAlbumControlSession"} { + // clang-format off + static const FunctionInfo functions[] = { + {2001, nullptr, "OpenAlbumMovieReadStream"}, + {2002, nullptr, "CloseAlbumMovieReadStream"}, + {2003, nullptr, "GetAlbumMovieReadStreamMovieDataSize"}, + {2004, nullptr, "ReadMovieDataFromAlbumMovieReadStream"}, + {2005, nullptr, "GetAlbumMovieReadStreamBrokenReason"}, + {2006, nullptr, "GetAlbumMovieReadStreamImageDataSize"}, + {2007, nullptr, "ReadImageDataFromAlbumMovieReadStream"}, + {2008, nullptr, "ReadFileAttributeFromAlbumMovieReadStream"}, + {2401, nullptr, "OpenAlbumMovieWriteStream"}, + {2402, nullptr, "FinishAlbumMovieWriteStream"}, + {2403, nullptr, "CommitAlbumMovieWriteStream"}, + {2404, nullptr, "DiscardAlbumMovieWriteStream"}, + {2405, nullptr, "DiscardAlbumMovieWriteStreamNoDelete"}, + {2406, nullptr, "CommitAlbumMovieWriteStreamEx"}, + {2411, nullptr, "StartAlbumMovieWriteStreamDataSection"}, + {2412, nullptr, "EndAlbumMovieWriteStreamDataSection"}, + {2413, nullptr, "StartAlbumMovieWriteStreamMetaSection"}, + {2414, nullptr, "EndAlbumMovieWriteStreamMetaSection"}, + {2421, nullptr, "ReadDataFromAlbumMovieWriteStream"}, + {2422, nullptr, "WriteDataToAlbumMovieWriteStream"}, + {2424, nullptr, "WriteMetaToAlbumMovieWriteStream"}, + {2431, nullptr, "GetAlbumMovieWriteStreamBrokenReason"}, + {2433, nullptr, "GetAlbumMovieWriteStreamDataSize"}, + {2434, nullptr, "SetAlbumMovieWriteStreamDataSize"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + +CAPS_C::CAPS_C() : ServiceFramework("caps:c") { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "CaptureRawImage"}, + {2, nullptr, "CaptureRawImageWithTimeout"}, + {33, nullptr, "Unknown33"}, + {1001, nullptr, "RequestTakingScreenShot"}, + {1002, nullptr, "RequestTakingScreenShotWithTimeout"}, + {1011, nullptr, "NotifyTakingScreenShotRefused"}, + {2001, nullptr, "NotifyAlbumStorageIsAvailable"}, + {2002, nullptr, "NotifyAlbumStorageIsUnavailable"}, + {2011, nullptr, "RegisterAppletResourceUserId"}, + {2012, nullptr, "UnregisterAppletResourceUserId"}, + {2013, nullptr, "GetApplicationIdFromAruid"}, + {2014, nullptr, "CheckApplicationIdRegistered"}, + {2101, nullptr, "GenerateCurrentAlbumFileId"}, + {2102, nullptr, "GenerateApplicationAlbumEntry"}, + {2201, nullptr, "SaveAlbumScreenShotFile"}, + {2202, nullptr, "SaveAlbumScreenShotFileEx"}, + {2301, nullptr, "SetOverlayScreenShotThumbnailData"}, + {2302, nullptr, "SetOverlayMovieThumbnailData"}, + {60001, nullptr, "OpenControlSession"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +CAPS_C::~CAPS_C() = default; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_c.h b/src/core/hle/service/caps/caps_c.h new file mode 100644 index 0000000000..d07cdb4413 --- /dev/null +++ b/src/core/hle/service/caps/caps_c.h @@ -0,0 +1,21 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service::Capture { + +class CAPS_C final : public ServiceFramework { +public: + explicit CAPS_C(); + ~CAPS_C() override; +}; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_sc.cpp b/src/core/hle/service/caps/caps_sc.cpp new file mode 100644 index 0000000000..d01a8a58ee --- /dev/null +++ b/src/core/hle/service/caps/caps_sc.cpp @@ -0,0 +1,40 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/caps/caps_sc.h" + +namespace Service::Capture { + +CAPS_SC::CAPS_SC() : ServiceFramework("caps:sc") { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "CaptureRawImage"}, + {2, nullptr, "CaptureRawImageWithTimeout"}, + {3, nullptr, "AttachSharedBuffer"}, + {5, nullptr, "CaptureRawImageToAttachedSharedBuffer"}, + {210, nullptr, "Unknown210"}, + {1001, nullptr, "RequestTakingScreenShot"}, + {1002, nullptr, "RequestTakingScreenShotWithTimeout"}, + {1003, nullptr, "RequestTakingScreenShotEx"}, + {1004, nullptr, "RequestTakingScreenShotEx1"}, + {1009, nullptr, "CancelTakingScreenShot"}, + {1010, nullptr, "SetTakingScreenShotCancelState"}, + {1011, nullptr, "NotifyTakingScreenShotRefused"}, + {1012, nullptr, "NotifyTakingScreenShotFailed"}, + {1101, nullptr, "SetupOverlayMovieThumbnail"}, + {1106, nullptr, "Unknown1106"}, + {1107, nullptr, "Unknown1107"}, + {1201, nullptr, "OpenRawScreenShotReadStream"}, + {1202, nullptr, "CloseRawScreenShotReadStream"}, + {1203, nullptr, "ReadRawScreenShotReadStream"}, + {1204, nullptr, "Unknown1204"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +CAPS_SC::~CAPS_SC() = default; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_sc.h b/src/core/hle/service/caps/caps_sc.h new file mode 100644 index 0000000000..9ba372f7ac --- /dev/null +++ b/src/core/hle/service/caps/caps_sc.h @@ -0,0 +1,21 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service::Capture { + +class CAPS_SC final : public ServiceFramework { +public: + explicit CAPS_SC(); + ~CAPS_SC() override; +}; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_ss.cpp b/src/core/hle/service/caps/caps_ss.cpp new file mode 100644 index 0000000000..eaa3a7494f --- /dev/null +++ b/src/core/hle/service/caps/caps_ss.cpp @@ -0,0 +1,26 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/caps/caps_ss.h" + +namespace Service::Capture { + +CAPS_SS::CAPS_SS() : ServiceFramework("caps:ss") { + // clang-format off + static const FunctionInfo functions[] = { + {201, nullptr, "SaveScreenShot"}, + {202, nullptr, "SaveEditedScreenShot"}, + {203, nullptr, "SaveScreenShotEx0"}, + {204, nullptr, "SaveEditedScreenShotEx0"}, + {206, nullptr, "Unknown206"}, + {208, nullptr, "SaveScreenShotOfMovieEx1"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +CAPS_SS::~CAPS_SS() = default; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_ss.h b/src/core/hle/service/caps/caps_ss.h new file mode 100644 index 0000000000..e258a69259 --- /dev/null +++ b/src/core/hle/service/caps/caps_ss.h @@ -0,0 +1,21 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service::Capture { + +class CAPS_SS final : public ServiceFramework { +public: + explicit CAPS_SS(); + ~CAPS_SS() override; +}; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_su.cpp b/src/core/hle/service/caps/caps_su.cpp new file mode 100644 index 0000000000..2b4c2d8081 --- /dev/null +++ b/src/core/hle/service/caps/caps_su.cpp @@ -0,0 +1,22 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/caps/caps_su.h" + +namespace Service::Capture { + +CAPS_SU::CAPS_SU() : ServiceFramework("caps:su") { + // clang-format off + static const FunctionInfo functions[] = { + {201, nullptr, "SaveScreenShot"}, + {203, nullptr, "SaveScreenShotEx0"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +CAPS_SU::~CAPS_SU() = default; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_su.h b/src/core/hle/service/caps/caps_su.h new file mode 100644 index 0000000000..cb11f7c9ae --- /dev/null +++ b/src/core/hle/service/caps/caps_su.h @@ -0,0 +1,21 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service::Capture { + +class CAPS_SU final : public ServiceFramework { +public: + explicit CAPS_SU(); + ~CAPS_SU() override; +}; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp new file mode 100644 index 0000000000..78bab6ed8e --- /dev/null +++ b/src/core/hle/service/caps/caps_u.cpp @@ -0,0 +1,76 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/service/caps/caps.h" +#include "core/hle/service/caps/caps_u.h" + +namespace Service::Capture { + +class IAlbumAccessorApplicationSession final + : public ServiceFramework { +public: + explicit IAlbumAccessorApplicationSession() + : ServiceFramework{"IAlbumAccessorApplicationSession"} { + // clang-format off + static const FunctionInfo functions[] = { + {2001, nullptr, "OpenAlbumMovieReadStream"}, + {2002, nullptr, "CloseAlbumMovieReadStream"}, + {2003, nullptr, "GetAlbumMovieReadStreamMovieDataSize"}, + {2004, nullptr, "ReadMovieDataFromAlbumMovieReadStream"}, + {2005, nullptr, "GetAlbumMovieReadStreamBrokenReason"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + +CAPS_U::CAPS_U() : ServiceFramework("caps:u") { + // clang-format off + static const FunctionInfo functions[] = { + {31, nullptr, "GetShimLibraryVersion"}, + {32, nullptr, "SetShimLibraryVersion"}, + {102, &CAPS_U::GetAlbumContentsFileListForApplication, "GetAlbumContentsFileListForApplication"}, + {103, nullptr, "DeleteAlbumContentsFileForApplication"}, + {104, nullptr, "GetAlbumContentsFileSizeForApplication"}, + {105, nullptr, "DeleteAlbumFileByAruidForDebug"}, + {110, nullptr, "LoadAlbumContentsFileScreenShotImageForApplication"}, + {120, nullptr, "LoadAlbumContentsFileThumbnailImageForApplication"}, + {130, nullptr, "PrecheckToCreateContentsForApplication"}, + {140, nullptr, "GetAlbumFileList1AafeAruidDeprecated"}, + {141, nullptr, "GetAlbumFileList2AafeUidAruidDeprecated"}, + {142, nullptr, "GetAlbumFileList3AaeAruid"}, + {143, nullptr, "GetAlbumFileList4AaeUidAruid"}, + {60002, nullptr, "OpenAccessorSessionForApplication"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +CAPS_U::~CAPS_U() = default; + +void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& ctx) { + // Takes a type-0x6 output buffer containing an array of ApplicationAlbumFileEntry, a PID, an + // u8 ContentType, two s64s, and an u64 AppletResourceUserId. Returns an output u64 for total + // output entries (which is copied to a s32 by official SW). + IPC::RequestParser rp{ctx}; + [[maybe_unused]] const auto application_album_file_entries = rp.PopRaw>(); + const auto pid = rp.Pop(); + const auto content_type = rp.PopRaw(); + [[maybe_unused]] const auto start_datetime = rp.PopRaw(); + [[maybe_unused]] const auto end_datetime = rp.PopRaw(); + const auto applet_resource_user_id = rp.Pop(); + LOG_WARNING(Service_Capture, + "(STUBBED) called. pid={}, content_type={}, applet_resource_user_id={}", pid, + content_type, applet_resource_user_id); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.Push(0); +} + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_u.h b/src/core/hle/service/caps/caps_u.h new file mode 100644 index 0000000000..e6e0716ff2 --- /dev/null +++ b/src/core/hle/service/caps/caps_u.h @@ -0,0 +1,24 @@ +// Copyright 2020 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service::Capture { + +class CAPS_U final : public ServiceFramework { +public: + explicit CAPS_U(); + ~CAPS_U() override; + +private: + void GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& ctx); +}; + +} // namespace Service::Capture