mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 02:52:13 +02:00
Various fixes
This commit is contained in:
parent
494e97ff60
commit
ad75075082
@ -54,14 +54,14 @@ typedef struct {
|
||||
u8 c[0x10];
|
||||
} NcmRightsId;
|
||||
|
||||
Result ncmInitialize();
|
||||
void ncmExit();
|
||||
Result ncmInitialize(void);
|
||||
void ncmExit(void);
|
||||
|
||||
Result ncmOpenContentStorage(FsStorageId storage, NcmContentStorage* out);
|
||||
Result ncmOpenContentMetaDatabase(FsStorageId storage, NcmContentMetaDatabase* out);
|
||||
|
||||
Result ncmContentStorageHas(NcmContentStorage* cs, const NcmNcaId* ncaId, bool* out);
|
||||
Result ncmContentStorageGetPath(NcmContentStorage* cs, const NcmNcaId* ncaId, char* out);
|
||||
Result ncmContentStorageGetPath(NcmContentStorage* cs, const NcmNcaId* ncaId, char* out, size_t outSize);
|
||||
Result ncmContentStorageGetSize(NcmContentStorage* cs, const NcmNcaId* ncaId, u64* out);
|
||||
Result ncmContentStorageReadContentIdFile(NcmContentStorage* cs, const NcmNcaId* ncaId, u64 offset, void* outBuf, size_t bufSize);
|
||||
Result ncmContentStorageGetRightsIdFromContentId(NcmContentStorage* cs, const NcmNcaId* ncaId, NcmRightsId* rightsIdOut, u32* keyGenerationOut);
|
||||
@ -74,4 +74,4 @@ Result ncmContentMetaDatabaseListContentInfo(NcmContentMetaDatabase* db, const N
|
||||
Result ncmContentMetaDatabaseGetLatestContentMetaKey(NcmContentMetaDatabase* db, u64 titleId, NcmMetaRecord* out);
|
||||
Result ncmContentMetaDatabaseListApplication(NcmContentMetaDatabase* db, u8 filter, NcmApplicationContentMetaKey* outBuf, size_t outBufSize, u32* numEntriesWritten, u32* numEntriesTotal);
|
||||
Result ncmContentMetaDatabaseHas(NcmContentMetaDatabase* db, const NcmMetaRecord* record, bool* out);
|
||||
Result ncmContentMetaDatabaseCommit(NcmContentMetaDatabase* db);
|
||||
Result ncmContentMetaDatabaseCommit(NcmContentMetaDatabase* db);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "services/ncm.h"
|
||||
#include <string.h>
|
||||
#include "services/ncm.h"
|
||||
#include "arm/atomics.h"
|
||||
|
||||
static Service g_ncmSrv;
|
||||
@ -129,11 +129,11 @@ Result ncmContentStorageHas(NcmContentStorage* cs, const NcmNcaId* ncaId, bool*
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result ncmContentStorageGetPath(NcmContentStorage* cs, const NcmNcaId* ncaId, char* out) {
|
||||
Result ncmContentStorageGetPath(NcmContentStorage* cs, const NcmNcaId* ncaId, char* out, size_t outSize) {
|
||||
char out_path[FS_MAX_PATH] = {0};
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
ipcAddRecvStatic(&c, out_path, FS_MAX_PATH, 0);
|
||||
ipcAddRecvStatic(&c, out_path, FS_MAX_PATH - 1, 0);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
@ -160,7 +160,8 @@ Result ncmContentStorageGetPath(NcmContentStorage* cs, const NcmNcaId* ncaId, ch
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
strncpy(out, out_path, FS_MAX_PATH);
|
||||
if (outSize > FS_MAX_PATH - 1) outSize = FS_MAX_PATH - 1;
|
||||
strncpy(out, out_path, outSize);
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +271,7 @@ Result ncmContentStorageGetRightsIdFromContentId(NcmContentStorage* cs, const Nc
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
memcpy(rightsIdOut, &resp->rights_id, sizeof(NcmRightsId));
|
||||
if (rightsIdOut) memcpy(rightsIdOut, &resp->rights_id, sizeof(NcmRightsId));
|
||||
if (keyGenerationOut) *keyGenerationOut = resp->key_generation;
|
||||
}
|
||||
}
|
||||
@ -604,4 +605,4 @@ Result ncmContentMetaDatabaseCommit(NcmContentMetaDatabase* db) {
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user