1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-22 10:16:39 +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"
/// 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 {
union {
u32 value;
struct {
u32 minor_relstep : 8;
u32 major_relstep : 8;
u32 micro : 4;
u32 minor : 6;
u32 major : 6;
union {
u16 relstep;
struct {
u16 minor_relstep : 8;
u16 major_relstep : 8;
};
};
u16 micro : 4;
u16 minor : 6;
u16 major : 6;
};
};
} SystemVersion;
@ -109,7 +114,7 @@ typedef struct {
NXDT_ASSERT(ApplicationVersion, 0x4);
/// 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 {
union {
u32 value;

View file

@ -162,14 +162,13 @@ namespace nxdt::views
gamecardGetDecryptedCardInfoArea(&card_info);
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? */
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 = "";
switch(upp_version_old.micro)
switch(upp_version.micro)
{
case 0: /* v450 / 0.0.0-450 */
upp_version_display = "1.0.0";
@ -192,11 +191,11 @@ namespace nxdt::views
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, \
upp_version_old.relstep, upp_version_old.value));
update_version->setValue(fmt::format("{} ({}.{}.{}-{}) (v{})", upp_version_display, upp_version.major, upp_version.minor, upp_version.micro, \
upp_version.relstep, upp_version.value));
} else {
update_version->setValue(fmt::format("{}.{}.{}-{} (v{})", upp_version_old.major, upp_version_old.minor, upp_version_old.micro, \
upp_version_old.relstep, upp_version_old.value));
update_version->setValue(fmt::format("{}.{}.{}-{} (v{})", upp_version.major, upp_version.minor, upp_version.micro, \
upp_version.relstep, upp_version.value));
}
} else {
update_version->setValue(fmt::format("{}.{}.{}-{}.{} (v{})", upp_version.major, upp_version.minor, upp_version.micro, \