Moved most ncm types into ncm_types.h. Renamed FsStorageId to NcmStorageId, with updated names for some values (now located in ncm_types.h). Various improvements + improved docs.

This commit is contained in:
yellows8 2019-11-11 18:19:45 -05:00
parent ce570a70f1
commit 9888df18da
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
17 changed files with 204 additions and 192 deletions

View File

@ -10,6 +10,7 @@
#include "../../types.h"
#include "../../services/fs.h"
#include "../../services/ncm_types.h"
/// RomFS header.
typedef struct
@ -95,7 +96,7 @@ Result romfsMountFromFsdev(const char *path, u64 offset, const char *name);
* @param storageId Storage ID to mount from.
* @param name Device mount name.
*/
Result romfsMountFromDataArchive(u64 dataId, FsStorageId storageId, const char *name);
Result romfsMountFromDataArchive(u64 dataId, NcmStorageId storageId, const char *name);
/// Unmounts the RomFS device.
Result romfsUnmount(const char *name);

View File

@ -12,7 +12,7 @@
#include "../services/pdm.h"
#include "../services/caps.h"
#include "../services/pm.h"
#include "../services/fs.h"
#include "../services/ncm_types.h"
#include "../services/acc.h"
#include "../kernel/tmem.h"
#include "../kernel/event.h"
@ -291,8 +291,8 @@ typedef struct {
typedef struct {
u64 application_id; ///< ApplicationId.
u32 version; ///< Application version.
u8 app_storageId; ///< FsStorageId for the Application.
u8 update_storageId; ///< FsStorageId for the Application update.
u8 app_storageId; ///< \ref NcmStorageId for the Application.
u8 update_storageId; ///< \ref NcmStorageId for the Application update.
u8 unk_xa; ///< Unknown.
u8 pad; ///< Padding.
} AppletApplicationLaunchProperty;
@ -1298,7 +1298,7 @@ Result appletGetDisplayVersion(char *displayVersion);
* @param[out] app_storageId Same as AppletApplicationLaunchProperty::app_storageId.
* @param[out] update_storageId Same as AppletApplicationLaunchProperty::update_storageId.
*/
Result appletGetLaunchStorageInfoForDebug(FsStorageId *app_storageId, FsStorageId *update_storageId);
Result appletGetLaunchStorageInfoForDebug(NcmStorageId *app_storageId, NcmStorageId *update_storageId);
/**
* @brief Blocks the usage of the home button, for short (Home Menu) and long (Overlay) presses.
@ -1927,11 +1927,11 @@ Result appletGetCallerAppletIdentityInfo(AppletIdentityInfo *info);
Result appletGetMainAppletApplicationControlProperty(NacpStruct *nacp);
/**
* @brief Gets the FsStorageId for the MainApplet.
* @brief Gets the NcmStorageId for the MainApplet.
* @note Only available with AppletType_LibraryApplet on [2.0.0+].
* @param[out] storageId FsStorageId
* @param[out] storageId \ref NcmStorageId
*/
Result appletGetMainAppletStorageId(FsStorageId *storageId);
Result appletGetMainAppletStorageId(NcmStorageId *storageId);
/**
* @brief Gets an array of \ref AppletIdentityInfo for the CallerStack.

View File

@ -9,6 +9,7 @@
#pragma once
#include "../types.h"
#include "../kernel/event.h"
#include "../services/ncm_types.h"
#include "../services/acc.h"
#include "../sf/service.h"
@ -157,16 +158,6 @@ typedef enum {
FsWriteOption_Flush = BIT(0), ///< Forces a flush after write.
} FsWriteOption;
/// StorageId
typedef enum {
FsStorageId_None = 0, ///< None
FsStorageId_Host = 1, ///< Host
FsStorageId_GameCard = 2, ///< GameCard
FsStorageId_NandSystem = 3, ///< NandSystem
FsStorageId_NandUser = 4, ///< NandUser
FsStorageId_SdCard = 5, ///< SdCard
} FsStorageId;
typedef enum {
FsContentStorageId_NandSystem = 0,
FsContentStorageId_NandUser = 1,
@ -317,7 +308,7 @@ Result fsOpenContentStorageFileSystem(FsFileSystem* out, FsContentStorageId cont
Result fsOpenCustomStorageFileSystem(FsFileSystem* out, FsCustomStorageId custom_storage_id); /// [7.0.0+]
Result fsOpenDataStorageByCurrentProcess(FsStorage* out);
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, FsStorageId storageId);
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storageId);
Result fsOpenDeviceOperator(FsDeviceOperator* out);
Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out);

View File

@ -7,7 +7,7 @@
#pragma once
#include "../types.h"
#include "../sf/service.h"
#include "../services/fs.h"
#include "../services/ncm_types.h"
/// Initialize fsp-pr.
Result fsprInitialize(void);
@ -18,7 +18,7 @@ void fsprExit(void);
/// Gets the Service object for the actual fsp-pr service session.
Service* fsprGetServiceSession(void);
Result fsprRegisterProgram(u64 pid, u64 tid, FsStorageId sid, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size);
Result fsprRegisterProgram(u64 pid, u64 tid, NcmStorageId sid, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size);
Result fsprUnregisterProgram(u64 pid);
Result fsprSetCurrentProcess(void);
Result fsprSetEnabledProgramVerification(bool enabled);

View File

@ -7,8 +7,7 @@
#pragma once
#include "../types.h"
#include "../sf/service.h"
#include "../services/fs.h"
#include "../services/ncm.h"
#include "../services/ncm_types.h"
typedef struct {
u8 main_thread_priority;

View File

@ -7,7 +7,7 @@
#pragma once
#include "../types.h"
#include "../sf/service.h"
#include "../services/fs.h"
#include "../services/ncm_types.h"
typedef struct {
Service s;
@ -26,7 +26,7 @@ void lrExit(void);
/// Gets the Service object for the actual lr service session.
Service* lrGetServiceSession(void);
Result lrOpenLocationResolver(FsStorageId storage, LrLocationResolver* out);
Result lrOpenLocationResolver(NcmStorageId storage, LrLocationResolver* out);
Result lrOpenRegisteredLocationResolver(LrRegisteredLocationResolver* out);
// TODO: Other ILocationResolverManager commands

View File

@ -6,6 +6,7 @@
*/
#pragma once
#include "../types.h"
#include "../services/ncm_types.h"
#include "../services/fs.h"
#include "../sf/service.h"
@ -19,117 +20,6 @@ typedef struct {
Service s; ///< IContentMetaDatabase
} NcmContentMetaDatabase;
/// ContentType
typedef enum {
NcmContentType_Meta = 0, ///< Meta
NcmContentType_Program = 1, ///< Program
NcmContentType_Data = 2, ///< Data
NcmContentType_Control = 3, ///< Control
NcmContentType_HtmlDocument = 4, ///< HtmlDocument
NcmContentType_LegalInformation = 5, ///< LegalInformation
NcmContentType_DeltaFragment = 6, ///< DeltaFragment
} NcmContentType;
/// ContentMetaType
typedef enum {
NcmContentMetaType_Unknown = 0x0, ///< Unknown
NcmContentMetaType_SystemProgram = 0x1, ///< SystemProgram
NcmContentMetaType_SystemData = 0x2, ///< SystemData
NcmContentMetaType_SystemUpdate = 0x3, ///< SystemUpdate
NcmContentMetaType_BootImagePackage = 0x4, ///< BootImagePackage
NcmContentMetaType_BootImagePackageSafe = 0x5, ///< BootImagePackageSafe
NcmContentMetaType_Application = 0x80, ///< Application
NcmContentMetaType_Patch = 0x81, ///< Patch
NcmContentMetaType_AddOnContent = 0x82, ///< AddOnContent
NcmContentMetaType_Delta = 0x83, ///< Delta
} NcmContentMetaType;
/// ContentMetaAttribute
typedef enum {
NcmContentMetaAttribute_None = 0, ///< None
NcmContentMetaAttribute_IncludesExFatDriver = BIT(0), ///< IncludesExFatDriver
NcmContentMetaAttribute_Rebootless = BIT(1), ///< Rebootless
} NcmContentMetaAttribute;
/// ContentInstallType
typedef enum {
NcmContentInstallType_Full = 0, ///< Full
NcmContentInstallType_FragmentOnly = 1, ///< FragmentOnly
NcmContentInstallType_Unknown = 7, ///< Unknown
} NcmContentInstallType;
/// ContentId
typedef struct {
alignas(4) u8 c[0x10]; ///< Id
} NcmContentId;
/// PlaceHolderId
typedef struct {
alignas(8) u8 c[0x10]; ///< Id
} NcmPlaceHolderId;
/// ContentMetaKey
typedef struct {
u64 id; ///< Id.
u32 version; ///< Version.
u8 type; ///< \ref NcmContentMetaType
u8 install_type; ///< \ref NcmContentInstallType
u8 padding[2]; ///< Padding.
} NcmContentMetaKey;
/// ApplicationContentMetaKey
typedef struct {
NcmContentMetaKey key; ///< \ref NcmContentMetaKey
u64 application_id; ///< ApplicationId.
} NcmApplicationContentMetaKey;
/// ContentInfo
typedef struct {
NcmContentId content_id; ///< \ref NcmContentId
u8 size[0x6]; ///< Content size.
u8 content_type; ///< \ref NcmContentType.
u8 id_offset; ///< Offset of this content. Unused by most applications.
} NcmContentInfo;
/// Used by system updates. They share the exact same struct as NcmContentMetaKey
typedef NcmContentMetaKey NcmContentMetaInfo;
/// ContentMetaHeader
typedef struct {
u16 extended_header_size; ///< Size of optional struct that comes after this one.
u16 content_count; ///< Number of NcmContentInfos after the extra bytes.
u16 content_meta_count; ///< Number of NcmContentMetaInfos that come after the NcmContentInfos.
u8 attributes; ///< Usually None (0).
u8 storage_id; ///< Usually None (0).
} NcmContentMetaHeader;
/// ApplicationMetaExtendedHeader
typedef struct {
u64 patch_id; ///< PatchId of this application's patch.
u32 required_system_version; ///< Firmware version required by this application.
u32 required_application_version; ///< [9.0.0+] Owner application version required by this application. Previously padding.
} NcmApplicationMetaExtendedHeader;
/// PatchMetaExtendedHeader
typedef struct {
u64 application_id; ///< ApplicationId of this patch's corresponding application.
u32 required_system_version; ///< Firmware version required by this patch.
u32 extended_data_size; ///< Size of the extended data following the NcmContentInfos.
u8 reserved[0x8]; ///< Unused.
} NcmPatchMetaExtendedHeader;
/// AddOnContentMetaExtendedHeader
typedef struct {
u64 application_id; ///< ApplicationId of this add-on-content's corresponding application.
u32 required_application_version; ///< Version of the application required by this add-on-content.
u32 padding; ///< Padding.
} NcmAddOnContentMetaExtendedHeader;
/// SystemUpdateMetaExtendedHeader
typedef struct {
u32 extended_data_size; ///< Size of the extended data after NcmContentInfos and NcmContentMetaInfos.
} NcmSystemUpdateMetaExtendedHeader;
/// RightsId
typedef struct {
FsRightsId rights_id;
@ -137,13 +27,6 @@ typedef struct {
u8 pad[7]; ///< [3.0.0+]
} NcmRightsId;
/// ProgramLocation
typedef struct {
u64 program_id; ///< ProgramId
u8 storageID; ///< \ref FsStorageId
u8 pad[7];
} NcmProgramLocation;
/// Initialize ncm.
Result ncmInitialize(void);
@ -153,19 +36,19 @@ void ncmExit(void);
/// Gets the Service object for the actual ncm service session.
Service* ncmGetServiceSession(void);
Result ncmCreateContentStorage(FsStorageId storage_id);
Result ncmCreateContentMetaDatabase(FsStorageId storage_id);
Result ncmVerifyContentStorage(FsStorageId storage_id);
Result ncmVerifyContentMetaDatabase(FsStorageId storage_id);
Result ncmOpenContentStorage(NcmContentStorage* out_content_storage, FsStorageId storage_id);
Result ncmOpenContentMetaDatabase(NcmContentMetaDatabase* out_content_meta_database, FsStorageId storage_id);
Result ncmCloseContentStorageForcibly(FsStorageId storage_id); ///< [1.0.0]
Result ncmCloseContentMetaDatabaseForcibly(FsStorageId storage_id); ///< [1.0.0]
Result ncmCleanupContentMetaDatabase(FsStorageId storage_id);
Result ncmActivateContentStorage(FsStorageId storage_id); ///< [2.0.0+]
Result ncmInactivateContentStorage(FsStorageId storage_id); ///< [2.0.0+]
Result ncmActivateContentMetaDatabase(FsStorageId storage_id); ///< [2.0.0+]
Result ncmInactivateContentMetaDatabase(FsStorageId storage_id); ///< [2.0.0+]
Result ncmCreateContentStorage(NcmStorageId storage_id);
Result ncmCreateContentMetaDatabase(NcmStorageId storage_id);
Result ncmVerifyContentStorage(NcmStorageId storage_id);
Result ncmVerifyContentMetaDatabase(NcmStorageId storage_id);
Result ncmOpenContentStorage(NcmContentStorage* out_content_storage, NcmStorageId storage_id);
Result ncmOpenContentMetaDatabase(NcmContentMetaDatabase* out_content_meta_database, NcmStorageId storage_id);
Result ncmCloseContentStorageForcibly(NcmStorageId storage_id); ///< [1.0.0]
Result ncmCloseContentMetaDatabaseForcibly(NcmStorageId storage_id); ///< [1.0.0]
Result ncmCleanupContentMetaDatabase(NcmStorageId storage_id);
Result ncmActivateContentStorage(NcmStorageId storage_id); ///< [2.0.0+]
Result ncmInactivateContentStorage(NcmStorageId storage_id); ///< [2.0.0+]
Result ncmActivateContentMetaDatabase(NcmStorageId storage_id); ///< [2.0.0+]
Result ncmInactivateContentMetaDatabase(NcmStorageId storage_id); ///< [2.0.0+]
Result ncmInvalidateRightsIdCache(void); ///< [9.0.0+]
void ncmContentStorageClose(NcmContentStorage* cs);

View File

@ -0,0 +1,137 @@
/**
* @file ncm_types.h
* @brief Content Manager (ncm) service types (see ncm.h for the rest).
* @author Adubbz, zhuowei, and yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
/// StorageId
typedef enum {
NcmStorageId_None = 0, ///< None
NcmStorageId_Host = 1, ///< Host
NcmStorageId_GameCard = 2, ///< GameCard
NcmStorageId_BuiltInSystem = 3, ///< BuiltInSystem
NcmStorageId_BuiltInUser = 4, ///< BuiltInUser
NcmStorageId_SdCard = 5, ///< SdCard
NcmStorageId_Any = 6, ///< Any
} NcmStorageId;
/// ContentType
typedef enum {
NcmContentType_Meta = 0, ///< Meta
NcmContentType_Program = 1, ///< Program
NcmContentType_Data = 2, ///< Data
NcmContentType_Control = 3, ///< Control
NcmContentType_HtmlDocument = 4, ///< HtmlDocument
NcmContentType_LegalInformation = 5, ///< LegalInformation
NcmContentType_DeltaFragment = 6, ///< DeltaFragment
} NcmContentType;
/// ContentMetaType
typedef enum {
NcmContentMetaType_Unknown = 0x0, ///< Unknown
NcmContentMetaType_SystemProgram = 0x1, ///< SystemProgram
NcmContentMetaType_SystemData = 0x2, ///< SystemData
NcmContentMetaType_SystemUpdate = 0x3, ///< SystemUpdate
NcmContentMetaType_BootImagePackage = 0x4, ///< BootImagePackage
NcmContentMetaType_BootImagePackageSafe = 0x5, ///< BootImagePackageSafe
NcmContentMetaType_Application = 0x80, ///< Application
NcmContentMetaType_Patch = 0x81, ///< Patch
NcmContentMetaType_AddOnContent = 0x82, ///< AddOnContent
NcmContentMetaType_Delta = 0x83, ///< Delta
} NcmContentMetaType;
/// ContentMetaAttribute
typedef enum {
NcmContentMetaAttribute_None = 0, ///< None
NcmContentMetaAttribute_IncludesExFatDriver = BIT(0), ///< IncludesExFatDriver
NcmContentMetaAttribute_Rebootless = BIT(1), ///< Rebootless
} NcmContentMetaAttribute;
/// ContentInstallType
typedef enum {
NcmContentInstallType_Full = 0, ///< Full
NcmContentInstallType_FragmentOnly = 1, ///< FragmentOnly
NcmContentInstallType_Unknown = 7, ///< Unknown
} NcmContentInstallType;
/// ContentId
typedef struct {
alignas(4) u8 c[0x10]; ///< Id
} NcmContentId;
/// PlaceHolderId
typedef struct {
alignas(8) u8 c[0x10]; ///< Id
} NcmPlaceHolderId;
/// ContentMetaKey
typedef struct {
u64 id; ///< Id.
u32 version; ///< Version.
u8 type; ///< \ref NcmContentMetaType
u8 install_type; ///< \ref NcmContentInstallType
u8 padding[2]; ///< Padding.
} NcmContentMetaKey;
/// ApplicationContentMetaKey
typedef struct {
NcmContentMetaKey key; ///< \ref NcmContentMetaKey
u64 application_id; ///< ApplicationId.
} NcmApplicationContentMetaKey;
/// ContentInfo
typedef struct {
NcmContentId content_id; ///< \ref NcmContentId
u8 size[0x6]; ///< Content size.
u8 content_type; ///< \ref NcmContentType.
u8 id_offset; ///< Offset of this content. Unused by most applications.
} NcmContentInfo;
/// Used by system updates. They share the exact same struct as NcmContentMetaKey
typedef NcmContentMetaKey NcmContentMetaInfo;
/// ContentMetaHeader
typedef struct {
u16 extended_header_size; ///< Size of optional struct that comes after this one.
u16 content_count; ///< Number of NcmContentInfos after the extra bytes.
u16 content_meta_count; ///< Number of NcmContentMetaInfos that come after the NcmContentInfos.
u8 attributes; ///< Usually None (0).
u8 storage_id; ///< Usually None (0).
} NcmContentMetaHeader;
/// ApplicationMetaExtendedHeader
typedef struct {
u64 patch_id; ///< PatchId of this application's patch.
u32 required_system_version; ///< Firmware version required by this application.
u32 required_application_version; ///< [9.0.0+] Owner application version required by this application. Previously padding.
} NcmApplicationMetaExtendedHeader;
/// PatchMetaExtendedHeader
typedef struct {
u64 application_id; ///< ApplicationId of this patch's corresponding application.
u32 required_system_version; ///< Firmware version required by this patch.
u32 extended_data_size; ///< Size of the extended data following the NcmContentInfos.
u8 reserved[0x8]; ///< Unused.
} NcmPatchMetaExtendedHeader;
/// AddOnContentMetaExtendedHeader
typedef struct {
u64 application_id; ///< ApplicationId of this add-on-content's corresponding application.
u32 required_application_version; ///< Version of the application required by this add-on-content.
u32 padding; ///< Padding.
} NcmAddOnContentMetaExtendedHeader;
/// SystemUpdateMetaExtendedHeader
typedef struct {
u32 extended_data_size; ///< Size of the extended data after NcmContentInfos and NcmContentMetaInfos.
} NcmSystemUpdateMetaExtendedHeader;
/// ProgramLocation
typedef struct {
u64 program_id; ///< ProgramId
u8 storageID; ///< \ref NcmStorageId
u8 pad[7];
} NcmProgramLocation;

View File

@ -8,8 +8,7 @@
#include "../types.h"
#include "../nacp.h"
#include "../sf/service.h"
#include "../services/fs.h"
#include "../services/ncm.h"
#include "../services/ncm_types.h"
#include "../services/async.h"
#include "../kernel/event.h"
#include "../kernel/tmem.h"
@ -59,7 +58,7 @@ typedef struct {
/// NsApplicationContentMetaStatus
typedef struct {
u8 meta_type; ///< \ref NcmContentMetaType
u8 storageID; ///< \ref FsStorageId
u8 storageID; ///< \ref NcmStorageId
u8 unk_x02; ///< Unknown.
u8 padding; ///< Padding.
u32 version; ///< Application version.
@ -80,7 +79,7 @@ typedef struct {
typedef struct {
u64 program_id; ///< program_id.
u32 version; ///< Program version.
u8 storageID; ///< \ref FsStorageId
u8 storageID; ///< \ref NcmStorageId
u8 index; ///< Index.
u8 is_application; ///< Whether this is an Application.
} NsLaunchProperties;
@ -186,17 +185,17 @@ Result nsGetApplicationControlData(NsApplicationControlSource source, u64 applic
/**
* @brief Returns the total storage capacity (used + free) from content manager services.
* @param[in] storage_id Specified FsStorageId. (Must be FsStorageId_SdCard)
* @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
* @param[out] size Pointer to output the total storage size to.
*/
Result nsGetTotalSpaceSize(FsStorageId storage_id, u64 *size);
Result nsGetTotalSpaceSize(NcmStorageId storage_id, u64 *size);
/**
* @brief Returns the available storage capacity from content manager services.
* @param[in] storage_id Specified FsStorageId. (Must be FsStorageId_SdCard)
* @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
* @param[out] size Pointer to output the free storage size to.
*/
Result nsGetFreeSpaceSize(FsStorageId storage_id, u64 *size);
Result nsGetFreeSpaceSize(NcmStorageId storage_id, u64 *size);
/**
* @brief Generates a \ref NsSystemDeliveryInfo using the currently installed SystemUpdate meta.
@ -308,9 +307,9 @@ Result nsEstimateRequiredSize(const NcmContentMetaKey *meta, s32 count, s64 *out
* @param[in] application_id ApplicationId
* @param[in] meta Input array of \ref NcmContentMetaKey. The ::NcmContentMetaType must match ::NcmContentMetaType_Patch.
* @param[in] count Size of the meta array in entries.
* @param[in] storage_id ::FsStorageId. qlaunch uses value 6.
* @param[in] storage_id \ref NcmStorageId. qlaunch uses ::NcmStorageId_Any.
*/
Result nsRequestReceiveApplication(AsyncResult *a, u32 addr, u16 port, u64 application_id, const NcmContentMetaKey *meta, s32 count, FsStorageId storage_id);
Result nsRequestReceiveApplication(AsyncResult *a, u32 addr, u16 port, u64 application_id, const NcmContentMetaKey *meta, s32 count, NcmStorageId storage_id);
/**
* @brief CommitReceiveApplication

View File

@ -98,7 +98,7 @@ typedef struct {
} unk_x8;
u8 appletId; ///< \ref AppletId
u8 storageId; ///< See FsStorageId.
u8 storageId; ///< \ref NcmStorageId
u8 logPolicy; ///< \ref PdmPlayLogPolicy
u8 eventType; ///< \ref PdmAppletEventType
u8 unused[0xc]; ///< Unused.

View File

@ -12,6 +12,7 @@
#include "runtime/devices/fs_dev.h"
#include "runtime/util/utf.h"
#include "services/fs.h"
#include "services/ncm_types.h"
#include "runtime/env.h"
#include "nro.h"
@ -326,7 +327,7 @@ Result romfsMountFromFsdev(const char *path, u64 offset, const char *name)
return romfsMountCommon(name, mount);
}
Result romfsMountFromDataArchive(u64 dataId, FsStorageId storageId, const char *name) {
Result romfsMountFromDataArchive(u64 dataId, NcmStorageId storageId, const char *name) {
FsStorage storage;
Result rc = fsOpenDataStorageByDataId(&storage, dataId, storageId);

View File

@ -8,7 +8,7 @@
#include "services/apm.h"
#include "services/caps.h"
#include "services/pm.h"
#include "services/fs.h"
#include "services/ncm_types.h"
#include "services/acc.h"
#include "runtime/env.h"
#include "runtime/hosversion.h"
@ -1953,7 +1953,7 @@ Result appletGetDisplayVersion(char *displayVersion) {
return rc;
}
Result appletGetLaunchStorageInfoForDebug(FsStorageId *app_storageId, FsStorageId *update_storageId) {
Result appletGetLaunchStorageInfoForDebug(NcmStorageId *app_storageId, NcmStorageId *update_storageId) {
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication())
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(2,0,0))
@ -2502,7 +2502,7 @@ IPC_MAKE_CMD_IMPL_INITEXPR( Result appletCanUseApplicationCore(bool *out),
IPC_MAKE_CMD_IMPL_INITEXPR( Result appletGetCallerAppletIdentityInfo(AppletIdentityInfo *info), &g_appletILibraryAppletSelfAccessor, 14, _appletGetIdentityInfo, __nx_applet_type != AppletType_LibraryApplet, info)
IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletGetMainAppletApplicationControlProperty(NacpStruct *nacp), &g_appletILibraryAppletSelfAccessor, 15, _appletCmdNoInRecvBuf, __nx_applet_type != AppletType_LibraryApplet, (2,0,0), nacp, sizeof(*nacp))
Result appletGetMainAppletStorageId(FsStorageId *storageId) {
Result appletGetMainAppletStorageId(NcmStorageId *storageId) {
u8 tmp=0;
Result rc=0;

View File

@ -4,6 +4,7 @@
#include "sf/sessionmgr.h"
#include "runtime/hosversion.h"
#include "services/fs.h"
#include "services/ncm_types.h"
#include "services/acc.h"
__attribute__((weak)) u32 __nx_fs_num_sessions = 3;
@ -375,7 +376,7 @@ Result fsOpenDataStorageByCurrentProcess(FsStorage* out) {
return _fsCmdGetSession(&g_fsSrv, &out->s, 200);
}
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, FsStorageId storageId) {
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storageId) {
const struct {
u8 storage_id;
u64 data_id;

View File

@ -32,7 +32,7 @@ Service* fsprGetServiceSession(void) {
static const uint32_t g_fspr_default_fah[] = {0x1, 0xFFFFFFFF, 0xFFFFFFFF, 0x1C, 0, 0x1C, 0};
static const uint32_t g_fspr_default_fac[] = {0x1, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF};
Result fsprRegisterProgram(u64 pid, u64 tid, FsStorageId sid, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size) {
Result fsprRegisterProgram(u64 pid, u64 tid, NcmStorageId sid, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size) {
if (fs_access_header == NULL) {
fs_access_header = g_fspr_default_fah;
fah_size = sizeof(g_fspr_default_fah);

View File

@ -2,6 +2,7 @@
#include <string.h>
#include "service_guard.h"
#include "services/lr.h"
#include "services/fs.h"
#include "runtime/hosversion.h"
static Service g_lrSrv;
@ -20,7 +21,7 @@ Service* lrGetServiceSession(void) {
return &g_lrSrv;
}
Result lrOpenLocationResolver(FsStorageId storage, LrLocationResolver* out) {
Result lrOpenLocationResolver(NcmStorageId storage, LrLocationResolver* out) {
const u8 in = (u8)storage;
return serviceDispatchIn(&g_lrSrv, 0, in,
.out_num_objects = 1,

View File

@ -59,60 +59,60 @@ static Result _ncmCmdInPlaceHolderIdOutU64(Service* srv, const NcmPlaceHolderId*
return serviceDispatchInOut(srv, cmd_id, *inval, *outval);
}
Result ncmCreateContentStorage(FsStorageId storage_id) {
Result ncmCreateContentStorage(NcmStorageId storage_id) {
return _ncmCmdInU8(&g_ncmSrv, storage_id, 0);
}
Result ncmCreateContentMetaDatabase(FsStorageId storage_id) {
Result ncmCreateContentMetaDatabase(NcmStorageId storage_id) {
return _ncmCmdInU8(&g_ncmSrv, storage_id, 1);
}
Result ncmVerifyContentStorage(FsStorageId storage_id) {
Result ncmVerifyContentStorage(NcmStorageId storage_id) {
return _ncmCmdInU8(&g_ncmSrv, storage_id, 2);
}
Result ncmVerifyContentMetaDatabase(FsStorageId storage_id) {
Result ncmVerifyContentMetaDatabase(NcmStorageId storage_id) {
return _ncmCmdInU8(&g_ncmSrv, storage_id, 3);
}
Result ncmOpenContentStorage(NcmContentStorage* out_content_storage, FsStorageId storage_id) {
Result ncmOpenContentStorage(NcmContentStorage* out_content_storage, NcmStorageId storage_id) {
return _ncmGetInterfaceInU8(&out_content_storage->s, storage_id, 4);
}
Result ncmOpenContentMetaDatabase(NcmContentMetaDatabase* out_content_meta_database, FsStorageId storage_id) {
Result ncmOpenContentMetaDatabase(NcmContentMetaDatabase* out_content_meta_database, NcmStorageId storage_id) {
return _ncmGetInterfaceInU8(&out_content_meta_database->s, storage_id, 5);
}
Result ncmCloseContentStorageForcibly(FsStorageId storage_id) {
Result ncmCloseContentStorageForcibly(NcmStorageId storage_id) {
if (hosversionAtLeast(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _ncmCmdInU8(&g_ncmSrv, storage_id, 6);
}
Result ncmCloseContentMetaDatabaseForcibly(FsStorageId storage_id) {
Result ncmCloseContentMetaDatabaseForcibly(NcmStorageId storage_id) {
if (hosversionAtLeast(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _ncmCmdInU8(&g_ncmSrv, storage_id, 7);
}
Result ncmCleanupContentMetaDatabase(FsStorageId storage_id) {
Result ncmCleanupContentMetaDatabase(NcmStorageId storage_id) {
return _ncmCmdInU8(&g_ncmSrv, storage_id, 8);
}
Result ncmActivateContentStorage(FsStorageId storage_id) {
Result ncmActivateContentStorage(NcmStorageId storage_id) {
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _ncmCmdInU8(&g_ncmSrv, storage_id, 9);
}
Result ncmInactivateContentStorage(FsStorageId storage_id) {
Result ncmInactivateContentStorage(NcmStorageId storage_id) {
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _ncmCmdInU8(&g_ncmSrv, storage_id, 10);
}
Result ncmActivateContentMetaDatabase(FsStorageId storage_id) {
Result ncmActivateContentMetaDatabase(NcmStorageId storage_id) {
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _ncmCmdInU8(&g_ncmSrv, storage_id, 11);
}
Result ncmInactivateContentMetaDatabase(FsStorageId storage_id) {
Result ncmInactivateContentMetaDatabase(NcmStorageId storage_id) {
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _ncmCmdInU8(&g_ncmSrv, storage_id, 12);
}

View File

@ -3,8 +3,7 @@
#include "service_guard.h"
#include "runtime/hosversion.h"
#include "services/ns.h"
#include "services/fs.h"
#include "services/ncm.h"
#include "services/ncm_types.h"
#include "services/async.h"
#include "kernel/tmem.h"
@ -206,11 +205,11 @@ Result nsGetApplicationControlData(NsApplicationControlSource source, u64 applic
return rc;
}
Result nsGetTotalSpaceSize(FsStorageId storage_id, u64 *size) {
Result nsGetTotalSpaceSize(NcmStorageId storage_id, u64 *size) {
return _nsCmdInU64OutU64(&g_nsAppManSrv, storage_id, size, 47);
}
Result nsGetFreeSpaceSize(FsStorageId storage_id, u64 *size) {
Result nsGetFreeSpaceSize(NcmStorageId storage_id, u64 *size) {
return _nsCmdInU64OutU64(&g_nsAppManSrv, storage_id, size, 48);
}
@ -361,7 +360,7 @@ Result nsEstimateRequiredSize(const NcmContentMetaKey *meta, s32 count, s64 *out
);
}
Result nsRequestReceiveApplication(AsyncResult *a, u32 addr, u16 port, u64 application_id, const NcmContentMetaKey *meta, s32 count, FsStorageId storage_id) {
Result nsRequestReceiveApplication(AsyncResult *a, u32 addr, u16 port, u64 application_id, const NcmContentMetaKey *meta, s32 count, NcmStorageId storage_id) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);