mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 18:42:15 +02:00
add more calls, add structs and add doc
This commit is contained in:
parent
8c7a414277
commit
d23427a24a
@ -18,13 +18,13 @@ typedef enum {
|
|||||||
|
|
||||||
/// AlbumReportOption
|
/// AlbumReportOption
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AlbumReportOption_Disable = 0, ///< Don't display the screenshot-taken Overlay-applet notification.
|
AlbumReportOption_Disable = 0, ///< Don't display the screenshot-taken Overlay-applet notification.
|
||||||
AlbumReportOption_Enable = 1, ///< Display the screenshot-taken Overlay notification.
|
AlbumReportOption_Enable = 1, ///< Display the screenshot-taken Overlay notification.
|
||||||
} AlbumReportOption;
|
} AlbumReportOption;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CapsAlbumStorage_Nand = 0, ///< Nand
|
CapsAlbumStorage_Nand = 0, ///< Nand
|
||||||
CapsAlbumStorage_Sd = 1, ///< Sd
|
CapsAlbumStorage_Sd = 1, ///< Sd
|
||||||
} CapsAlbumStorage;
|
} CapsAlbumStorage;
|
||||||
|
|
||||||
/// ContentType
|
/// ContentType
|
||||||
@ -70,38 +70,38 @@ typedef struct {
|
|||||||
|
|
||||||
/// AlbumFileDateTime. This corresponds to each field in the Album entry filename, prior to the "-": "YYYYMMDDHHMMSSII".
|
/// AlbumFileDateTime. This corresponds to each field in the Album entry filename, prior to the "-": "YYYYMMDDHHMMSSII".
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u16 year; ///< Year.
|
u16 year; ///< Year.
|
||||||
u8 month; ///< Month.
|
u8 month; ///< Month.
|
||||||
u8 day; ///< Day of the month.
|
u8 day; ///< Day of the month.
|
||||||
u8 hour; ///< Hour.
|
u8 hour; ///< Hour.
|
||||||
u8 minute; ///< Minute.
|
u8 minute; ///< Minute.
|
||||||
u8 second; ///< Second.
|
u8 second; ///< Second.
|
||||||
u8 id; ///< Unique ID for when there's multiple Album files with the same timestamp.
|
u8 id; ///< Unique ID for when there's multiple Album files with the same timestamp.
|
||||||
} CapsAlbumFileDateTime;
|
} CapsAlbumFileDateTime;
|
||||||
|
|
||||||
/// AlbumEntryId
|
/// AlbumEntryId
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 application_id; ///< ApplicationId
|
u64 application_id; ///< ApplicationId
|
||||||
CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
|
CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
|
||||||
u8 storage; ///< \ref CapsAlbumStorage
|
u8 storage; ///< \ref CapsAlbumStorage
|
||||||
u8 content; ///< \ref CapsAlbumFileContents
|
u8 content; ///< \ref CapsAlbumFileContents
|
||||||
u32 pad_x12; ///< Set to 0 by official software
|
u32 pad_x12; ///< Set to 0 by official software
|
||||||
u16 pad_x16; ///< Set to 0 by official software
|
u16 pad_x16; ///< Set to 0 by official software
|
||||||
} PACKED CapsAlbumFileId;
|
} PACKED CapsAlbumFileId;
|
||||||
|
|
||||||
/// AlbumEntry
|
/// AlbumEntry
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 size; ///< Size.
|
u64 size; ///< Size.
|
||||||
CapsAlbumFileId file_id; ///< \ref CapsAlbumFileId
|
CapsAlbumFileId file_id; ///< \ref CapsAlbumFileId
|
||||||
} CapsAlbumEntry;
|
} CapsAlbumEntry;
|
||||||
|
|
||||||
/// ApplicationAlbumEntry
|
/// ApplicationAlbumEntry
|
||||||
typedef struct {
|
typedef struct {
|
||||||
union {
|
union {
|
||||||
u8 data[0x20]; ///< Data.
|
u8 data[0x20]; ///< Data.
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u8 unk_x0[0x20]; ///< Unknown.
|
u8 unk_x0[0x20]; ///< Unknown.
|
||||||
} v0; ///< Pre-7.0.0
|
} v0; ///< Pre-7.0.0
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -115,15 +115,15 @@ typedef struct {
|
|||||||
|
|
||||||
/// ApplicationAlbumFileEntry
|
/// ApplicationAlbumFileEntry
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CapsApplicationAlbumEntry entry; ///< \ref CapsApplicationAlbumEntry
|
CapsApplicationAlbumEntry entry; ///< \ref CapsApplicationAlbumEntry
|
||||||
CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
|
CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
|
||||||
u64 unk_x28; ///< Unknown.
|
u64 unk_x28; ///< Unknown.
|
||||||
} CapsApplicationAlbumFileEntry;
|
} CapsApplicationAlbumFileEntry;
|
||||||
|
|
||||||
/// ApplicationData
|
/// ApplicationData
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 userdata[0x400]; ///< UserData.
|
u8 userdata[0x400]; ///< UserData.
|
||||||
u32 size; ///< UserData size.
|
u32 size; ///< UserData size.
|
||||||
} CapsApplicationData;
|
} CapsApplicationData;
|
||||||
|
|
||||||
/// AlbumFileContents
|
/// AlbumFileContents
|
||||||
@ -140,25 +140,31 @@ typedef enum {
|
|||||||
} CapsAlbumContentsUsageFlag;
|
} CapsAlbumContentsUsageFlag;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
s64 count;
|
s64 count; ///< Count.
|
||||||
s64 size;
|
s64 size; ///< Size. Used storage space.
|
||||||
u32 flags;
|
u32 flags; ///< \ref CapsAlbumContentsUsageFlag
|
||||||
u8 file_contents;
|
u8 file_contents; ///< \ref CapsAlbumFileContents
|
||||||
u8 pad_x15[0x3];
|
u8 pad_x15[0x3]; ///< Unused
|
||||||
} CapsAlbumContentsUsage;
|
} CapsAlbumContentsUsage;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CapsAlbumContentsUsage usages[2];
|
CapsAlbumContentsUsage usages[2]; ///< \ref CapsAlbumContentsUsage
|
||||||
} CapsAlbumUsage2;
|
} CapsAlbumUsage2;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CapsAlbumContentsUsage usages[3];
|
CapsAlbumContentsUsage usages[3]; ///< \ref CapsAlbumContentsUsage
|
||||||
} CapsAlbumUsage3;
|
} CapsAlbumUsage3;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CapsAlbumContentsUsage usages[16];
|
CapsAlbumContentsUsage usages[16]; ///< \ref CapsAlbumContentsUsage
|
||||||
} CapsAlbumUsage16;
|
} CapsAlbumUsage16;
|
||||||
|
|
||||||
|
/// OverlayThumbnailData
|
||||||
|
typedef struct {
|
||||||
|
CapsAlbumFileId file_id; ///< \ref CapsAlbumFileId
|
||||||
|
u64 size; ///< Size.
|
||||||
|
} CapsOverlayThumbnailData;
|
||||||
|
|
||||||
/// UserIdList
|
/// UserIdList
|
||||||
typedef struct {
|
typedef struct {
|
||||||
AccountUid uids[ACC_USER_LIST_SIZE]; ///< \ref AccountUid
|
AccountUid uids[ACC_USER_LIST_SIZE]; ///< \ref AccountUid
|
||||||
@ -183,6 +189,12 @@ typedef struct {
|
|||||||
u8 unk_x50[0x400]; ///< Unused.
|
u8 unk_x50[0x400]; ///< Unused.
|
||||||
} CapsLoadAlbumScreenShotImageOutput;
|
} CapsLoadAlbumScreenShotImageOutput;
|
||||||
|
|
||||||
|
/// AlbumCache
|
||||||
|
typedef struct {
|
||||||
|
u64 count; ///< Count
|
||||||
|
u8 unk_x8[8]; ///< Unknown
|
||||||
|
} CapsAlbumCache;
|
||||||
|
|
||||||
/// Gets the ShimLibraryVersion.
|
/// Gets the ShimLibraryVersion.
|
||||||
u64 capsGetShimLibraryVersion(void);
|
u64 capsGetShimLibraryVersion(void);
|
||||||
|
|
||||||
|
@ -169,6 +169,7 @@ Result capsaGetAlbumUsage3(CapsAlbumStorage storage, CapsAlbumUsage3 *out);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the result for a AlbumStorage mount.
|
* @brief Returns the result for a AlbumStorage mount.
|
||||||
|
* @note Only available on [4.0.0+].
|
||||||
* @param[in] storage \ref CapsAlbumStorage
|
* @param[in] storage \ref CapsAlbumStorage
|
||||||
*/
|
*/
|
||||||
Result capsaGetAlbumMountResult(CapsAlbumStorage storage);
|
Result capsaGetAlbumMountResult(CapsAlbumStorage storage);
|
||||||
@ -181,6 +182,52 @@ Result capsaGetAlbumMountResult(CapsAlbumStorage storage);
|
|||||||
*/
|
*/
|
||||||
Result capsaGetAlbumUsage16(CapsAlbumStorage storage, CapsAlbumUsage16 *out);
|
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.
|
* @brief Gets the currently set autosaving storage.
|
||||||
* @note Wrapper around setsysGetPrimaryAlbumStorage but defaults to NAND if SD isn't available.
|
* @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);
|
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.
|
* @brief Opens an AlbumMovieStream.
|
||||||
* @note This opens IAlbumAccessorSession if not previously opened, it's closed during \ref capsaExit.
|
* @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) {
|
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);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
const struct {
|
const struct {
|
||||||
CapsAlbumFileId file_id;
|
CapsAlbumFileId file_id;
|
||||||
@ -184,6 +184,68 @@ Result capsaGetAlbumUsage16(CapsAlbumStorage storage, CapsAlbumUsage16 *out) {
|
|||||||
return serviceDispatchInOut(&g_capsaSrv, 17, inval, *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) {
|
Result capsaGetAutoSavingStorage(CapsAlbumStorage *storage) {
|
||||||
u8 tmpval = 0;
|
u8 tmpval = 0;
|
||||||
Result rc = serviceDispatchOut(&g_capsaSrv, 401, tmpval);
|
Result rc = serviceDispatchOut(&g_capsaSrv, 401, tmpval);
|
||||||
@ -236,6 +298,20 @@ Result capsaRefreshAlbumCache(CapsAlbumStorage storage) {
|
|||||||
return _capsaCmdInU8NoOut(&g_capsaSrv, storage, 8011);
|
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) {
|
static Result _capsaOpenAccessorSession(Service *srv_out) {
|
||||||
u64 AppletResourceUserId = 0;
|
u64 AppletResourceUserId = 0;
|
||||||
appletGetAppletResourceUserId(&AppletResourceUserId);
|
appletGetAppletResourceUserId(&AppletResourceUserId);
|
||||||
|
Loading…
Reference in New Issue
Block a user