mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 10:32:15 +02:00
add more calls, add structs and add doc
This commit is contained in:
parent
8c7a414277
commit
d23427a24a
@ -140,25 +140,31 @@ typedef enum {
|
||||
} CapsAlbumContentsUsageFlag;
|
||||
|
||||
typedef struct {
|
||||
s64 count;
|
||||
s64 size;
|
||||
u32 flags;
|
||||
u8 file_contents;
|
||||
u8 pad_x15[0x3];
|
||||
s64 count; ///< Count.
|
||||
s64 size; ///< Size. Used storage space.
|
||||
u32 flags; ///< \ref CapsAlbumContentsUsageFlag
|
||||
u8 file_contents; ///< \ref CapsAlbumFileContents
|
||||
u8 pad_x15[0x3]; ///< Unused
|
||||
} CapsAlbumContentsUsage;
|
||||
|
||||
typedef struct {
|
||||
CapsAlbumContentsUsage usages[2];
|
||||
CapsAlbumContentsUsage usages[2]; ///< \ref CapsAlbumContentsUsage
|
||||
} CapsAlbumUsage2;
|
||||
|
||||
typedef struct {
|
||||
CapsAlbumContentsUsage usages[3];
|
||||
CapsAlbumContentsUsage usages[3]; ///< \ref CapsAlbumContentsUsage
|
||||
} CapsAlbumUsage3;
|
||||
|
||||
typedef struct {
|
||||
CapsAlbumContentsUsage usages[16];
|
||||
CapsAlbumContentsUsage usages[16]; ///< \ref CapsAlbumContentsUsage
|
||||
} CapsAlbumUsage16;
|
||||
|
||||
/// OverlayThumbnailData
|
||||
typedef struct {
|
||||
CapsAlbumFileId file_id; ///< \ref CapsAlbumFileId
|
||||
u64 size; ///< Size.
|
||||
} CapsOverlayThumbnailData;
|
||||
|
||||
/// UserIdList
|
||||
typedef struct {
|
||||
AccountUid uids[ACC_USER_LIST_SIZE]; ///< \ref AccountUid
|
||||
@ -183,6 +189,12 @@ typedef struct {
|
||||
u8 unk_x50[0x400]; ///< Unused.
|
||||
} CapsLoadAlbumScreenShotImageOutput;
|
||||
|
||||
/// AlbumCache
|
||||
typedef struct {
|
||||
u64 count; ///< Count
|
||||
u8 unk_x8[8]; ///< Unknown
|
||||
} CapsAlbumCache;
|
||||
|
||||
/// Gets the ShimLibraryVersion.
|
||||
u64 capsGetShimLibraryVersion(void);
|
||||
|
||||
|
@ -169,6 +169,7 @@ Result capsaGetAlbumUsage3(CapsAlbumStorage storage, CapsAlbumUsage3 *out);
|
||||
|
||||
/**
|
||||
* @brief Returns the result for a AlbumStorage mount.
|
||||
* @note Only available on [4.0.0+].
|
||||
* @param[in] storage \ref CapsAlbumStorage
|
||||
*/
|
||||
Result capsaGetAlbumMountResult(CapsAlbumStorage storage);
|
||||
@ -181,6 +182,52 @@ Result capsaGetAlbumMountResult(CapsAlbumStorage storage);
|
||||
*/
|
||||
Result capsaGetAlbumUsage16(CapsAlbumStorage storage, CapsAlbumUsage16 *out);
|
||||
|
||||
/**
|
||||
* @brief Returns the start and end of the Applet Id range.
|
||||
* @note Only available on [6.0.0+].
|
||||
* @param[out] success Returns bool over wether the call was handled or not.
|
||||
* @param[out] min Mimimum applet id. Always 0x0100000000001000
|
||||
* @param[out] max Maximum applet id. Always 0x0100000000001FFF
|
||||
*/
|
||||
Result capsaGetMinMaxAppletId(bool* success, u64* min, u64* max);
|
||||
|
||||
/**
|
||||
* @brief Gets the amount of files of the specified type at a AlbumStorage.
|
||||
* @note Only available on [5.0.0+].
|
||||
* @param[in] storage \ref CapsAlbumStorage
|
||||
* @param[in] contents \ref CapsAlbumFileContents
|
||||
* @param[out] count Amount of files.
|
||||
*/
|
||||
Result capsaGetAlbumFileCountEx0(CapsAlbumStorage storage, CapsAlbumFileContents contents, u64 *count);
|
||||
|
||||
/**
|
||||
* @brief Gets a listing of \ref CapsAlbumEntry, where the AlbumFile's storage and type matches the input one.
|
||||
* @note Only available on [5.0.0+].
|
||||
* @param[in] storage \ref CapsAlbumStorage
|
||||
* @param[in] contents \ref CapsAlbumFileContents
|
||||
* @param[out] count Total output entries.
|
||||
* @param[out] entries Output array of \ref CapsAlbumEntry.
|
||||
* @param[in] size Reserved size at entries
|
||||
*/
|
||||
Result capsaGetAlbumFileListEx0(CapsAlbumStorage storage, CapsAlbumFileContents contents, u64 *count, CapsAlbumEntry *entries, u64 size);
|
||||
|
||||
/**
|
||||
* @brief Returns the image from the last shown ScreenShot Overlay.
|
||||
* @param[out] data \ref CapsOverlayThumbnailData
|
||||
* @param[out] image RGBA8 image output buffer.
|
||||
* @param[in] image_size Image buffer size, should be at least large enough for RGBA8 96×54.
|
||||
*/
|
||||
Result capsaGetLastOverlayScreenShotThumbnail(CapsOverlayThumbnailData *data, void* image, u64 image_size);
|
||||
|
||||
/**
|
||||
* @brief Returns the image from the last shown Movie Overlay.
|
||||
* @note Only available on [4.0.0+].
|
||||
* @param[out] data \ref CapsOverlayThumbnailData
|
||||
* @param[out] image RGBA8 image output buffer.
|
||||
* @param[in] image_size Image buffer size, should be at least large enough for RGBA8 96×54.
|
||||
*/
|
||||
Result capsaGetLastOverlayMovieThumbnail(CapsOverlayThumbnailData *data, void* image, u64 image_size);
|
||||
|
||||
/**
|
||||
* @brief Gets the currently set autosaving storage.
|
||||
* @note Wrapper around setsysGetPrimaryAlbumStorage but defaults to NAND if SD isn't available.
|
||||
@ -256,6 +303,23 @@ Result capsaResetAlbumMountStatus(CapsAlbumStorage storage);
|
||||
*/
|
||||
Result capsaRefreshAlbumCache(CapsAlbumStorage storage);
|
||||
|
||||
/**
|
||||
* @brief Gets the AlbumCache of the specified AlbumStorage.
|
||||
* @note use \ref capsaGetAlbumCacheEx instead.
|
||||
* @param[in] storage \ref CapsAlbumStorage
|
||||
* @param[out] cache \ref CapsAlbumCache
|
||||
*/
|
||||
Result capsaGetAlbumCache(CapsAlbumStorage storage, CapsAlbumCache *cache);
|
||||
|
||||
/**
|
||||
* @brief Gets the AlbumCache for the specified type of the specified AlbumStorage.
|
||||
* @note Stubbed on [4.0.0+].
|
||||
* @param[in] storage \ref CapsAlbumStorage
|
||||
* @param[in] contents \ref CapsAlbumFileContents
|
||||
* @param[out] cache \ref CapsAlbumCache
|
||||
*/
|
||||
Result capsaGetAlbumCacheEx(CapsAlbumStorage storage, CapsAlbumFileContents contents, CapsAlbumCache *cache);
|
||||
|
||||
/**
|
||||
* @brief Opens an AlbumMovieStream.
|
||||
* @note This opens IAlbumAccessorSession if not previously opened, it's closed during \ref capsaExit.
|
||||
|
@ -139,7 +139,7 @@ Result capsaLoadAlbumScreenShotThumbnailImageEx(u64 *width, u64 *height, const C
|
||||
}
|
||||
|
||||
Result _capsaLoadAlbumScreenShotEx0(u64 *width, u64 *height, CapsScreenShotAttributeForApplication *attr, const CapsAlbumFileId *file_id, const CapsScreenShotDecodeOption *opts, void* image, u64 image_size, void* workbuf, u64 workbuf_size, u32 cmd_id) {
|
||||
if (hosversionBefore(4,0,0))
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
const struct {
|
||||
CapsAlbumFileId file_id;
|
||||
@ -184,6 +184,68 @@ Result capsaGetAlbumUsage16(CapsAlbumStorage storage, CapsAlbumUsage16 *out) {
|
||||
return serviceDispatchInOut(&g_capsaSrv, 17, inval, *out);
|
||||
}
|
||||
|
||||
Result capsaGetMinMaxAppletId(bool *success, u64* min, u64* max) {
|
||||
if (hosversionBefore(6,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
u64 app_ids[2];
|
||||
struct {
|
||||
bool success;
|
||||
u8 pad[0x3];
|
||||
} out;
|
||||
Result rc = serviceDispatchOut(&g_capsaSrv, 18, out,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out | SfBufferAttr_HipcMapTransferAllowsNonSecure, },
|
||||
.buffers = { { app_ids, sizeof(app_ids) }, },
|
||||
);
|
||||
*min = app_ids[0];
|
||||
*max = app_ids[1];
|
||||
*success = out.success;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result capsaGetAlbumFileCountEx0(CapsAlbumStorage storage, CapsAlbumFileContents contents, u64 *count) {
|
||||
if (hosversionBefore(5,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
struct {
|
||||
CapsAlbumStorage storage;
|
||||
u8 pad_x1[0x7];
|
||||
CapsAlbumFileContents contents;
|
||||
u8 pad_x9[0x7];
|
||||
} in = { storage, {0}, contents, {0} };
|
||||
return serviceDispatchInOut(&g_capsaSrv, 100, in, *count);
|
||||
}
|
||||
|
||||
Result capsaGetAlbumFileListEx0(CapsAlbumStorage storage, CapsAlbumFileContents contents, u64 *count, CapsAlbumEntry *entries, u64 size) {
|
||||
if (hosversionBefore(5,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
struct {
|
||||
CapsAlbumStorage storage;
|
||||
u8 pad_x1[0x7];
|
||||
CapsAlbumFileContents contents;
|
||||
u8 pad_x9[0x7];
|
||||
} in = { storage, {0}, contents, {0} };
|
||||
return serviceDispatchInOut(&g_capsaSrv, 101, in, *count,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { entries, size } },
|
||||
);
|
||||
}
|
||||
|
||||
Result _capsaGetLastOverlayThumbnail(CapsOverlayThumbnailData *data, void* image, u64 image_size, u32 cmd_id) {
|
||||
return serviceDispatchOut(&g_capsaSrv, cmd_id, *data,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out, },
|
||||
.buffers = { { image, image_size }, },
|
||||
);
|
||||
}
|
||||
|
||||
Result capsaGetLastOverlayScreenShotThumbnail(CapsOverlayThumbnailData *data, void* image, u64 image_size) {
|
||||
return _capsaGetLastOverlayThumbnail(data, image, image_size, 301);
|
||||
}
|
||||
|
||||
Result capsaGetLastOverlayMovieThumbnail(CapsOverlayThumbnailData *data, void* image, u64 image_size) {
|
||||
if (hosversionBefore(4,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _capsaGetLastOverlayThumbnail(data, image, image_size, 302);
|
||||
}
|
||||
|
||||
Result capsaGetAutoSavingStorage(CapsAlbumStorage *storage) {
|
||||
u8 tmpval = 0;
|
||||
Result rc = serviceDispatchOut(&g_capsaSrv, 401, tmpval);
|
||||
@ -236,6 +298,20 @@ Result capsaRefreshAlbumCache(CapsAlbumStorage storage) {
|
||||
return _capsaCmdInU8NoOut(&g_capsaSrv, storage, 8011);
|
||||
}
|
||||
|
||||
Result capsaGetAlbumCache(CapsAlbumStorage storage, CapsAlbumCache *cache) {
|
||||
return serviceDispatchInOut(&g_capsaSrv, 8012, storage, *cache);
|
||||
}
|
||||
|
||||
Result capsaGetAlbumCacheEx(CapsAlbumStorage storage, CapsAlbumFileContents contents, CapsAlbumCache *cache) {
|
||||
if (hosversionBefore(4,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
struct {
|
||||
u8 storage;
|
||||
u8 contents;
|
||||
} in = { storage, contents };
|
||||
return serviceDispatchInOut(&g_capsaSrv, 8013, in, *cache);
|
||||
}
|
||||
|
||||
static Result _capsaOpenAccessorSession(Service *srv_out) {
|
||||
u64 AppletResourceUserId = 0;
|
||||
appletGetAppletResourceUserId(&AppletResourceUserId);
|
||||
|
Loading…
Reference in New Issue
Block a user