From e4d80261fa1d9325a2e91f9339936bb9612fd470 Mon Sep 17 00:00:00 2001 From: suchmememanyskill Date: Tue, 6 Jul 2021 20:18:58 +0200 Subject: [PATCH] support 12.1.0, bump version --- Makefile | 2 +- source/hos/pkg1.c | 50 +++++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index acd2819..f88173a 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ include $(DEVKITARM)/base_rules IPL_LOAD_ADDR := 0x40008000 LPVERSION_MAJOR := 3 LPVERSION_MINOR := 0 -LPVERSION_BUGFX := 5 +LPVERSION_BUGFX := 6 ################################################################################ diff --git a/source/hos/pkg1.c b/source/hos/pkg1.c index ee9ac0f..b9059e9 100644 --- a/source/hos/pkg1.c +++ b/source/hos/pkg1.c @@ -23,31 +23,43 @@ #include static const pkg1_id_t _pkg1_ids[] = { - { "20161121183008", 0 }, //1.0.0 - { "20170210155124", 0 }, //2.0.0 - 2.3.0 - { "20170519101410", 1 }, //3.0.0 - { "20170710161758", 2 }, //3.0.1 - 3.0.2 - { "20170921172629", 3 }, //4.0.0 - 4.1.0 - { "20180220163747", 4 }, //5.0.0 - 5.1.0 - { "20180802162753", 5 }, //6.0.0 - 6.1.0 - { "20181107105733", 6 }, //6.2.0 - { "20181218175730", 7 }, //7.0.0 - { "20190208150037", 7 }, //7.0.1 - { "20190314172056", 7 }, //8.0.0 - 8.0.1 - { "20190531152432", 8 }, //8.1.0 - { "20190809135709", 9 }, //9.0.0 - 9.0.1 - { "20191021113848", 10}, //9.1.0 - { "20200303104606", 10}, //10.0.0 - 10.2.0 - { "20201030110855", 10}, //11.0.0 - { "20210129111626", 10}, //12.0.0 - { "20210422145837", 10}, //12.0.2 + { "20161121", 0 }, //1.0.0 + { "20170210", 0 }, //2.0.0 - 2.3.0 + { "20170519", 1 }, //3.0.0 + { "20170710", 2 }, //3.0.1 - 3.0.2 + { "20170921", 3 }, //4.0.0 - 4.1.0 + { "20180220", 4 }, //5.0.0 - 5.1.0 + { "20180802", 5 }, //6.0.0 - 6.1.0 + { "20181107", 6 }, //6.2.0 + { "20181218", 7 }, //7.0.0 + { "20190208", 7 }, //7.0.1 + { "20190314", 7 }, //8.0.0 - 8.0.1 + { "20190531", 8 }, //8.1.0 - 8.1.1 + { "20190809", 9 }, //9.0.0 - 9.0.1 + { "20191021", 10}, //9.1.0 - 9.2.0 + { "20200303", 10}, //10.0.0 - 10.2.0 + { "20201030", 10}, //11.0.0 - 11.0.1 + { "20210129", 10}, //12.0.0 - 12.0.1 + { "20210422", 10}, //12.0.2 - 12.0.3 + { "20210607", 11}, //12.1.0 { NULL } //End. }; +#define KB_FIRMWARE_VERSION_MAX 11 + const pkg1_id_t *pkg1_identify(u8 *pkg1) { for (u32 i = 0; _pkg1_ids[i].id; i++) if (!memcmp(pkg1 + 0x10, _pkg1_ids[i].id, 8)) return &_pkg1_ids[i]; - return NULL; + + char build_date[15]; + memcpy(build_date, (char *)(pkg1 + 0x10), 14); + build_date[14] = 0; + + if (*(pkg1 + 0xE) != KB_FIRMWARE_VERSION_MAX + 1) { + return NULL; + } + + return &_pkg1_ids[ARRAY_SIZE(_pkg1_ids)-1]; }