mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 19:02:14 +02:00
Various fixes
This commit is contained in:
parent
494e97ff60
commit
ad75075082
@ -54,14 +54,14 @@ typedef struct {
|
|||||||
u8 c[0x10];
|
u8 c[0x10];
|
||||||
} NcmRightsId;
|
} NcmRightsId;
|
||||||
|
|
||||||
Result ncmInitialize();
|
Result ncmInitialize(void);
|
||||||
void ncmExit();
|
void ncmExit(void);
|
||||||
|
|
||||||
Result ncmOpenContentStorage(FsStorageId storage, NcmContentStorage* out);
|
Result ncmOpenContentStorage(FsStorageId storage, NcmContentStorage* out);
|
||||||
Result ncmOpenContentMetaDatabase(FsStorageId storage, NcmContentMetaDatabase* out);
|
Result ncmOpenContentMetaDatabase(FsStorageId storage, NcmContentMetaDatabase* out);
|
||||||
|
|
||||||
Result ncmContentStorageHas(NcmContentStorage* cs, const NcmNcaId* ncaId, bool* 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 ncmContentStorageGetSize(NcmContentStorage* cs, const NcmNcaId* ncaId, u64* out);
|
||||||
Result ncmContentStorageReadContentIdFile(NcmContentStorage* cs, const NcmNcaId* ncaId, u64 offset, void* outBuf, size_t bufSize);
|
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);
|
Result ncmContentStorageGetRightsIdFromContentId(NcmContentStorage* cs, const NcmNcaId* ncaId, NcmRightsId* rightsIdOut, u32* keyGenerationOut);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "services/ncm.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "services/ncm.h"
|
||||||
#include "arm/atomics.h"
|
#include "arm/atomics.h"
|
||||||
|
|
||||||
static Service g_ncmSrv;
|
static Service g_ncmSrv;
|
||||||
@ -129,11 +129,11 @@ Result ncmContentStorageHas(NcmContentStorage* cs, const NcmNcaId* ncaId, bool*
|
|||||||
return rc;
|
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};
|
char out_path[FS_MAX_PATH] = {0};
|
||||||
IpcCommand c;
|
IpcCommand c;
|
||||||
ipcInitialize(&c);
|
ipcInitialize(&c);
|
||||||
ipcAddRecvStatic(&c, out_path, FS_MAX_PATH, 0);
|
ipcAddRecvStatic(&c, out_path, FS_MAX_PATH - 1, 0);
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u64 magic;
|
u64 magic;
|
||||||
@ -160,7 +160,8 @@ Result ncmContentStorageGetPath(NcmContentStorage* cs, const NcmNcaId* ncaId, ch
|
|||||||
rc = resp->result;
|
rc = resp->result;
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
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;
|
rc = resp->result;
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
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;
|
if (keyGenerationOut) *keyGenerationOut = resp->key_generation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user