1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-12-27 19:06:01 +00:00

Print system title version when dumping sys update partition

This commit is contained in:
MCMrARM 2018-05-15 18:31:46 +02:00
parent f4b900d0f6
commit 5892d49599
3 changed files with 50 additions and 0 deletions

View file

@ -11,6 +11,13 @@ bool dumpPartitionRaw(FsDeviceOperator* fsOperator, u32 partition) {
printf("GetGameCardHandle failed\n");
return false;
}
if (partition == 0) {
u32 title_ver;
fsDeviceOperatorUpdatePartitionInfo(fsOperator, handle, &title_ver, NULL);
printf("System title-version = %i\n", title_ver);
}
FsStorage gameCardStorage;
Result result;
if (R_FAILED(result = fsOpenGameCard(&gameCardStorage, handle, partition))) {

View file

@ -81,6 +81,48 @@ Result fsDeviceOperatorIsGameCardInserted(FsDeviceOperator* d, bool* out) {
return rc;
}
Result fsDeviceOperatorUpdatePartitionInfo(FsDeviceOperator* d, u32 handle, u32* out_title_version, u64* out_title_id) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
u32 handle;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 203;
raw->handle = handle;
Result rc = serviceIpcDispatch(&d->s);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u32 title_ver;
u64 title_id;
} *resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc)) {
if (out_title_version != NULL)
*out_title_version = resp->title_ver;
if (out_title_id != NULL)
*out_title_id = resp->title_id;
}
}
return rc;
}
Result fsDeviceOperatorGetGameCardHandle(FsDeviceOperator* d, u32* out) {
IpcCommand c;
ipcInitialize(&c);

View file

@ -10,6 +10,7 @@ Result fsOpenGameCard(FsStorage* out, u32 handle, u32 partition);
// IDeviceOperator
Result fsDeviceOperatorIsGameCardInserted(FsDeviceOperator* d, bool* out);
Result fsDeviceOperatorGetGameCardHandle(FsDeviceOperator* d, u32* out);
Result fsDeviceOperatorUpdatePartitionInfo(FsDeviceOperator* d, u32 handle, u32* out_title_version, u64* out_title_id);
// FsStorage