1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-26 12:12:02 +00:00

nxdt_includes: properly handle old sysver fields.

Turns out old system versions just use 16-bit long relstep values in their lower half. The major/minor/micro combination in the upper half remains the same.

Thanks to @liamadvance for clarifying this.
This commit is contained in:
Pablo Curiel 2023-05-26 11:01:34 +02:00
parent 6bbe964f42
commit 55d744b5c2
2 changed files with 18 additions and 14 deletions

View file

@ -78,16 +78,21 @@
#include "lz4.h" #include "lz4.h"
/// Used to store version numbers expressed in dot notation: "{major}.{minor}.{micro}-{major_relstep}.{minor_relstep}". /// Used to store version numbers expressed in dot notation: "{major}.{minor}.{micro}-{major_relstep}.{minor_relstep}".
/// Used by system version fields. /// Used by system version fields. 16-bit long relstep values were used by system version fields prior to HOS 3.0.0.
typedef struct { typedef struct {
union { union {
u32 value; u32 value;
struct { struct {
u32 minor_relstep : 8; union {
u32 major_relstep : 8; u16 relstep;
u32 micro : 4; struct {
u32 minor : 6; u16 minor_relstep : 8;
u32 major : 6; u16 major_relstep : 8;
};
};
u16 micro : 4;
u16 minor : 6;
u16 major : 6;
}; };
}; };
} SystemVersion; } SystemVersion;
@ -109,7 +114,7 @@ typedef struct {
NXDT_ASSERT(ApplicationVersion, 0x4); NXDT_ASSERT(ApplicationVersion, 0x4);
/// Used to store version numbers expressed in dot notation: "{major}.{minor}.{micro}-{relstep}". /// Used to store version numbers expressed in dot notation: "{major}.{minor}.{micro}-{relstep}".
/// Used by SDK version fields. This format was also used for system version fields prior to HOS 3.0.0. /// Used by SDK version fields.
typedef struct { typedef struct {
union { union {
u32 value; u32 value;

View file

@ -162,14 +162,13 @@ namespace nxdt::views
gamecardGetDecryptedCardInfoArea(&card_info); gamecardGetDecryptedCardInfoArea(&card_info);
const SystemVersion upp_version = card_info.upp_version.system_version; const SystemVersion upp_version = card_info.upp_version.system_version;
const SdkAddOnVersion upp_version_old = card_info.upp_version.sdk_addon_version;
/* TODO: move somewhere else? */ /* TODO: move somewhere else? */
if (upp_version_old.major == 0 && upp_version_old.minor == 0) if (upp_version.major == 0 && upp_version.minor == 0)
{ {
std::string upp_version_display = ""; std::string upp_version_display = "";
switch(upp_version_old.micro) switch(upp_version.micro)
{ {
case 0: /* v450 / 0.0.0-450 */ case 0: /* v450 / 0.0.0-450 */
upp_version_display = "1.0.0"; upp_version_display = "1.0.0";
@ -192,11 +191,11 @@ namespace nxdt::views
if (upp_version_display != "") if (upp_version_display != "")
{ {
update_version->setValue(fmt::format("{} ({}.{}.{}-{}) (v{})", upp_version_display, upp_version_old.major, upp_version_old.minor, upp_version_old.micro, \ update_version->setValue(fmt::format("{} ({}.{}.{}-{}) (v{})", upp_version_display, upp_version.major, upp_version.minor, upp_version.micro, \
upp_version_old.relstep, upp_version_old.value)); upp_version.relstep, upp_version.value));
} else { } else {
update_version->setValue(fmt::format("{}.{}.{}-{} (v{})", upp_version_old.major, upp_version_old.minor, upp_version_old.micro, \ update_version->setValue(fmt::format("{}.{}.{}-{} (v{})", upp_version.major, upp_version.minor, upp_version.micro, \
upp_version_old.relstep, upp_version_old.value)); upp_version.relstep, upp_version.value));
} }
} else { } else {
update_version->setValue(fmt::format("{}.{}.{}-{}.{} (v{})", upp_version.major, upp_version.minor, upp_version.micro, \ update_version->setValue(fmt::format("{}.{}.{}-{}.{} (v{})", upp_version.major, upp_version.minor, upp_version.micro, \