From 5892d49599d506441973a1cbf6e34680d5aa37c0 Mon Sep 17 00:00:00 2001 From: MCMrARM Date: Tue, 15 May 2018 18:31:46 +0200 Subject: [PATCH] Print system title version when dumping sys update partition --- source/dumper.c | 7 +++++++ source/fsext.c | 42 ++++++++++++++++++++++++++++++++++++++++++ source/fsext.h | 1 + 3 files changed, 50 insertions(+) diff --git a/source/dumper.c b/source/dumper.c index f1b8b71..a362fe9 100644 --- a/source/dumper.c +++ b/source/dumper.c @@ -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))) { diff --git a/source/fsext.c b/source/fsext.c index 3ea3a8e..9349d75 100644 --- a/source/fsext.c +++ b/source/fsext.c @@ -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); diff --git a/source/fsext.h b/source/fsext.h index e709f9f..55045bb 100644 --- a/source/fsext.h +++ b/source/fsext.h @@ -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