mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 18:42:15 +02:00
Misc fixes
This commit is contained in:
parent
0a2d094fe9
commit
4fcee01114
@ -65,7 +65,7 @@ typedef struct {
|
||||
|
||||
/// ContentMetaKey
|
||||
typedef struct {
|
||||
u64 id; ///< Title id.
|
||||
u64 title_id; ///< Title id.
|
||||
u32 version; ///< Title version.
|
||||
NcmContentMetaType type; ///< \ref NcmContentMetaType
|
||||
NcmContentInstallType install_type; ///< \ref NcmContentInstallType
|
||||
@ -172,6 +172,7 @@ Result ncmContentStorageFlushPlaceHolder(NcmContentStorage* cs);
|
||||
Result ncmContentStorageGetSizeFromPlaceHolderId(NcmContentStorage* cs, u64* out_size, const NcmNcaId* placeholder_id);
|
||||
Result ncmContentStorageRepairInvalidFileAttribute(NcmContentStorage* cs);
|
||||
Result ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(NcmContentStorage* cs, FsRightsId* out_rights_id, u32* out_key_generation, const NcmNcaId* placeholder_id, const NcmNcaId* cache_content_id);
|
||||
void ncmContentStorageClose(NcmContentStorage* cs);
|
||||
|
||||
Result ncmContentMetaDatabaseSet(NcmContentMetaDatabase* db, const NcmContentMetaKey* key, const void* data, u64 data_size);
|
||||
Result ncmContentMetaDatabaseGet(NcmContentMetaDatabase* db, const NcmContentMetaKey* key, u64* out_size, void* out_data, u64 out_data_size);
|
||||
@ -193,4 +194,5 @@ Result ncmContentMetaDatabaseHasContent(NcmContentMetaDatabase* db, bool* out, c
|
||||
Result ncmContentMetaDatabaseListContentMetaInfo(NcmContentMetaDatabase* db, u32* out_entries_written, void* out_meta_info, size_t out_meta_info_size, const NcmContentMetaKey* key, u32 start_index);
|
||||
Result ncmContentMetaDatabaseGetAttributes(NcmContentMetaDatabase* db, const NcmContentMetaKey* key, u8* out);
|
||||
Result ncmContentMetaDatabaseGetRequiredApplicationVersion(NcmContentMetaDatabase* db, u64* out_version, const NcmContentMetaKey* key);
|
||||
Result ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(NcmContentMetaDatabase* db, NcmNcaId* out_content_id, const NcmContentMetaKey* key, NcmContentType type, u8 id_offset);
|
||||
Result ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(NcmContentMetaDatabase* db, NcmNcaId* out_content_id, const NcmContentMetaKey* key, NcmContentType type, u8 id_offset);
|
||||
void ncmContentMetaDatabaseClose(NcmContentMetaDatabase* db);
|
||||
|
@ -20,68 +20,73 @@ Service* ncmGetServiceSession(void) {
|
||||
return &g_ncmSrv;
|
||||
}
|
||||
|
||||
static Result _ncmGetInterfaceInU8(Service* srv_out, u32 cmd_id, u8 inval) {
|
||||
return serviceDispatchIn(&g_ncmSrv, cmd_id, inval,
|
||||
.out_num_objects = 1,
|
||||
.out_objects = srv_out,
|
||||
);
|
||||
}
|
||||
|
||||
static Result _ncmCmdInU8(Service* srv, u32 cmd_id, u8 inval) {
|
||||
return serviceDispatchIn(srv, cmd_id, inval);
|
||||
}
|
||||
|
||||
Result ncmCreateContentStorage(FsStorageId storage_id) {
|
||||
return serviceDispatchIn(&g_ncmSrv, 0, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 0, storage_id);
|
||||
}
|
||||
|
||||
Result ncmCreateContentMetaDatabase(FsStorageId storage_id) {
|
||||
return serviceDispatchIn(&g_ncmSrv, 1, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 1, storage_id);
|
||||
}
|
||||
|
||||
Result ncmVerifyContentStorage(FsStorageId storage_id) {
|
||||
return serviceDispatchIn(&g_ncmSrv, 2, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 2, storage_id);
|
||||
}
|
||||
|
||||
Result ncmVerifyContentMetaDatabase(FsStorageId storage_id) {
|
||||
return serviceDispatchIn(&g_ncmSrv, 3, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 3, storage_id);
|
||||
}
|
||||
|
||||
Result ncmOpenContentStorage(NcmContentStorage* out_content_storage, FsStorageId storage_id) {
|
||||
return serviceDispatchIn(&g_ncmSrv, 4, storage_id,
|
||||
.out_num_objects = 1,
|
||||
.out_objects = &out_content_storage->s,
|
||||
);
|
||||
return serviceDispatchIn(&g_ncmSrv, 4, storage_id);
|
||||
}
|
||||
|
||||
Result ncmOpenContentMetaDatabase(NcmContentMetaDatabase* out_content_meta_database, FsStorageId storage_id) {
|
||||
return serviceDispatchIn(&g_ncmSrv, 5, storage_id,
|
||||
.out_num_objects = 1,
|
||||
.out_objects = &out_content_meta_database->s,
|
||||
);
|
||||
return _ncmGetInterfaceInU8(&g_ncmSrv, 5, storage_id);
|
||||
}
|
||||
|
||||
Result ncmCloseContentStorageForcibly(FsStorageId storage_id) {
|
||||
if (hosversionAtLeast(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return serviceDispatchIn(&g_ncmSrv, 6, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 6, storage_id);
|
||||
}
|
||||
|
||||
Result ncmCloseContentMetaDatabaseForcibly(FsStorageId storage_id) {
|
||||
if (hosversionAtLeast(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return serviceDispatchIn(&g_ncmSrv, 7, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 7, storage_id);
|
||||
}
|
||||
|
||||
Result ncmCleanupContentMetaDatabase(FsStorageId storage_id) {
|
||||
return serviceDispatchIn(&g_ncmSrv, 8, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 8, storage_id);
|
||||
}
|
||||
|
||||
Result ncmActivateContentStorage(FsStorageId storage_id) {
|
||||
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return serviceDispatchIn(&g_ncmSrv, 9, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 9, storage_id);
|
||||
}
|
||||
|
||||
Result ncmInactivateContentStorage(FsStorageId storage_id) {
|
||||
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return serviceDispatchIn(&g_ncmSrv, 10, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 10, storage_id);
|
||||
}
|
||||
|
||||
Result ncmActivateContentMetaDatabase(FsStorageId storage_id) {
|
||||
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return serviceDispatchIn(&g_ncmSrv, 11, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 11, storage_id);
|
||||
}
|
||||
|
||||
Result ncmInactivateContentMetaDatabase(FsStorageId storage_id) {
|
||||
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return serviceDispatchIn(&g_ncmSrv, 12, storage_id);
|
||||
return _ncmCmdInU8(&g_ncmSrv, 12, storage_id);
|
||||
}
|
||||
|
||||
Result ncmInvalidateRightsIdCache(void) {
|
||||
@ -295,6 +300,10 @@ Result ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(NcmContentStorage*
|
||||
return rc;
|
||||
}
|
||||
|
||||
void ncmContentStorageClose(NcmContentStorage* cs) {
|
||||
serviceClose(&cs->s);
|
||||
}
|
||||
|
||||
Result ncmContentMetaDatabaseSet(NcmContentMetaDatabase* db, const NcmContentMetaKey* key, const void* data, u64 data_size) {
|
||||
return serviceDispatchIn(&db->s, 0, *key,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
|
||||
@ -449,3 +458,7 @@ Result ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(NcmContentMetaDatabas
|
||||
} in = { type, id_offset, {0}, *key };
|
||||
return serviceDispatchInOut(&db->s, 20, in, *out_content_id);
|
||||
}
|
||||
|
||||
void ncmContentMetaDatabaseClose(NcmContentMetaDatabase* db) {
|
||||
serviceClose(&db->s);
|
||||
}
|
Loading…
Reference in New Issue
Block a user