From 171d9b8a3d196bf06168ad103488efdb0c397d0b Mon Sep 17 00:00:00 2001 From: HookedBehemoth Date: Wed, 19 Feb 2020 18:55:21 +0100 Subject: [PATCH] fix descriptions don't let user supply aruid don't use temp values for _capscCmdInU8NoOut --- nx/include/switch/services/capsa.h | 6 ++--- nx/include/switch/services/capsc.h | 42 +++++++++++++++++------------- nx/source/services/capsa.c | 4 +-- nx/source/services/capsc.c | 6 ++--- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/nx/include/switch/services/capsa.h b/nx/include/switch/services/capsa.h index d341dd2d..4f8f6906 100644 --- a/nx/include/switch/services/capsa.h +++ b/nx/include/switch/services/capsa.h @@ -333,13 +333,13 @@ Result capsaGetAlbumCache(CapsAlbumStorage storage, CapsAlbumCache *cache); Result capsaGetAlbumCacheEx(CapsAlbumStorage storage, CapsAlbumFileContents contents, CapsAlbumCache *cache); /** - * @brief Load an \ref CapsAlbumEntry from a \ref CapsApplicationAlbumEntry and an Applet Resource User Id. + * @brief Load an \ref CapsAlbumEntry from a \ref CapsApplicationAlbumEntry and an AppletResourceUserId. * @note Only available on [2.0.0+]. * @param[out] entry \ref CapsAlbumEntry * @param[in] application_entry \ref CapsApplicationAlbumEntry - * @param[in] appletResourceUserId Application Resouce User Id + * @param[in] appletResourceUserId AppletResourceUserId */ -Result capsaGetAlbumEntryFromApplicationAlbumEntryAruid(CapsAlbumEntry *entry, const CapsApplicationAlbumEntry *application_entry, u64 appletResourceUserId); +Result capsaGetAlbumEntryFromApplicationAlbumEntryAruid(CapsAlbumEntry *entry, const CapsApplicationAlbumEntry *application_entry); /** * @brief Opens an AlbumMovieStream. diff --git a/nx/include/switch/services/capsc.h b/nx/include/switch/services/capsc.h index a5d81901..ad054480 100644 --- a/nx/include/switch/services/capsc.h +++ b/nx/include/switch/services/capsc.h @@ -34,49 +34,55 @@ Result capscNotifyAlbumStorageIsUnAvailable(CapsAlbumStorage storage); /** * @brief Register an applet for later usage. - * @note Called at application launch. + * @note Called at application launch by the system. * @note Will generate a random AES-256 key for this application for use on Shim-Version 0. - * @param[in] appletResourceUserId Session unique applet identifier. - * @param[in] application_id Title unique identifier. + * @note Only available on [2.0.0+]. + * @param[in] appletResourceUserId AppletResourceUserId. + * @param[in] application_id ApplicationId. */ Result capscRegisterAppletResourceUserId(u64 appletResourceUserId, u64 application_id); /** * @brief Unregister an applet. - * @note Called at application exit. - * @param[in] appletResourceUserId Session unique applet identifier. - * @param[in] application_id Title unique identifier. + * @note Called at application exit by the system. + * @note Only available on [2.0.0+]. + * @param[in] appletResourceUserId AppletResourceUserId. + * @param[in] application_id ApplicationId. */ Result capscUnregisterAppletResourceUserId(u64 appletResourceUserId, u64 application_id); /** - * @brief Get an Application ID that corresponse to an Application Resource User ID. + * @brief Get an ApplicationId that corresponse to an AppletResourceUserId. * @note Returns value set by \ref capscRegisterAppletResourceUserId. - * @param[out] application_id Title unique identifier. - * @param[in] appletResourceUserId Session unique applet identifier. + * @note Only available on [2.0.0+]. + * @param[out] application_id ApplicationId. + * @param[in] appletResourceUserId AppletResourceUserId. */ Result capscGetApplicationIdFromAruid(u64 *application_id, u64 aruid); /** - * @brief Checks whether an Application ID is registered. - * @param[in] application_id Title unique identifier. + * @brief Checks whether an ApplicationId is registered. + * @note Only available on [2.0.0+]. + * @param[in] application_id ApplicationId. */ Result capscCheckApplicationIdRegistered(u64 application_id); /** - * @brief Generate an Album File ID based of parameters and current time. - * @param[in] application_id Title unique identifier. + * @brief Generate an AlbumFileId based of parameters and current time. + * @param[in] application_id ApplicationId. + * @note Only available on [2.0.0+]. * @param[in] contents \ref CapsAlbumFileContents * @param[out] file_id \ref CapsAlbumFileId */ Result capscGenerateCurrentAlbumFileId(u64 application_id, CapsAlbumFileContents contents, CapsAlbumFileId *file_id); /** - * @brief Generate an Application Album Entry based of parameters. + * @brief Generate an ApplicationAlbumEntry based of parameters. * @note Output will be different between Shim Version 0 and 1. + * @note Only available on [2.0.0+]. * @param[out] appEntry \ref CapsApplicationAlbumEntry * @param[in] entry \ref CapsAlbumEntry - * @param[in] application_id Title unique identifier. + * @param[in] application_id ApplicationId. */ Result capscGenerateApplicationAlbumEntry(CapsApplicationAlbumEntry *appEntry, const CapsAlbumEntry *entry, u64 application_id); @@ -104,7 +110,7 @@ Result capscSaveAlbumScreenShotFileEx(const CapsAlbumFileId *file_id, u64 versio /** * @brief Sets thumbnail data for the last taken screenshot. - * @note 96×54x4 Image will get saved. + * @note 96×54 Image will get saved. * @param[in] file_id \ref CapsAlbumFileId * @param[in] image RGBA8 image buffer. * @param[in] image_size size of the RGBA8 image buffer. @@ -114,7 +120,7 @@ Result capscSetOverlayScreenShotThumbnailData(const CapsAlbumFileId *file_id, co /** * @brief Sets thumbnail data for the last recorded movie. * @note Only availabe on [4.0.0+]. - * @note 96×54x4 Image will get saved. + * @note 96×54 Image will get saved. * @param[in] file_id \ref CapsAlbumFileId * @param[in] image RGBA8 image buffer. * @param[in] image_size size of the RGBA8 image buffer. @@ -123,7 +129,7 @@ Result capscSetOverlayMovieThumbnailData(const CapsAlbumFileId *file_id, const v /** * @brief Opens an AlbumMovieReadStream. - * @note This opens IAlbumControlSession if not previously opened, it's closed during \ref capsaExit. + * @note This opens IAlbumControlSession if not previously opened, it's closed during \ref capscExit. * @note Up to 4 streams can be open at the same time. Multiple streams can be open at the same time for the same \ref CapsAlbumFileId. * @note Only available on [4.0.0+]. * @param[out] stream Stream handle. diff --git a/nx/source/services/capsa.c b/nx/source/services/capsa.c index a7e50abf..257e5512 100644 --- a/nx/source/services/capsa.c +++ b/nx/source/services/capsa.c @@ -350,13 +350,13 @@ Result capsaGetAlbumCacheEx(CapsAlbumStorage storage, CapsAlbumFileContents cont return serviceDispatchInOut(&g_capsaSrv, 8013, in, *cache); } -Result capsaGetAlbumEntryFromApplicationAlbumEntryAruid(CapsAlbumEntry *entry, const CapsApplicationAlbumEntry *application_entry, u64 appletResourceUserId) { +Result capsaGetAlbumEntryFromApplicationAlbumEntryAruid(CapsAlbumEntry *entry, const CapsApplicationAlbumEntry *application_entry) { if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); const struct { CapsApplicationAlbumEntry application_entry; u64 aruid; - } in = { *application_entry, appletResourceUserId }; + } in = { *application_entry, appletGetAppletResourceUserId() }; return serviceDispatchInOut(&g_capsaSrv, 8021, in, *entry, .in_send_pid = true); } diff --git a/nx/source/services/capsc.c b/nx/source/services/capsc.c index c1b2bdfd..42088c03 100644 --- a/nx/source/services/capsc.c +++ b/nx/source/services/capsc.c @@ -47,13 +47,11 @@ static Result _capscCmdInU8NoOut(Service *srv, u32 cmd_id, u64 inval) { } Result capscNotifyAlbumStorageIsAvailable(CapsAlbumStorage storage) { - u8 inval = storage; - return _capscCmdInU8NoOut(&g_capscSrv, 2001, inval); + return _capscCmdInU8NoOut(&g_capscSrv, 2001, storage); } Result capscNotifyAlbumStorageIsUnAvailable(CapsAlbumStorage storage) { - u8 inval = storage; - return _capscCmdInU8NoOut(&g_capscSrv, 2002, inval); + return _capscCmdInU8NoOut(&g_capscSrv, 2002, storage); } Result capscRegisterAppletResourceUserId(u64 appletResourceUserId, u64 application_id) {