From e6830abc40e5889296014ecf0e69008ec231d278 Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sat, 31 May 2025 19:29:38 +0200 Subject: [PATCH 1/4] Update SetSysEdid to include different types of Extension blocks --- nx/include/switch/services/set.h | 38 +++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/nx/include/switch/services/set.h b/nx/include/switch/services/set.h index 85fad53b..9533fcab 100644 --- a/nx/include/switch/services/set.h +++ b/nx/include/switch/services/set.h @@ -487,6 +487,30 @@ typedef struct { u8 padding[2]; } SetSysDataBlock; +typedef struct { + u8 extension_tag; ///< 2 = CEA EDID timing extension, 0x70 = DisplayID Extension Block, 0xF0 = EDID Extension Block Map + union { + struct { + u8 revision; + u8 dtd_start; + u8 native_dtd_count : 4; + u8 native_dtd_feature_bitmap : 4; + SetSysDataBlock data_block; + SetSysModeLine extended_timing_descriptor[5]; + u8 padding[5]; + } NX_PACKED cea; ///< CEA EDID timing extension + struct { + u8 data[0x7E]; + } NX_PACKED display_id; ///< [13.0.0+] DisplayID Extension Block + struct { + u8 second_block_extension_tag; + u8 third_block_extension_tag; + u8 padding[0x7C]; + } NX_PACKED block_map; ///< [13.0.0+] EDID Extension Block Map + } extension_block; + u8 extended_checksum; ///< Sum of 128 extended bytes should equal 0 mod 256. +} SetSysExtensionBlock; + /// Edid typedef struct { u8 pattern[8]; ///< Fixed pattern 00 FF FF FF FF FF FF 00. @@ -548,17 +572,9 @@ typedef struct { u8 extension_count; ///< Always 1. u8 checksum; ///< Sum of all 128 bytes should equal 0 mod 256. ///< Extended data. - u8 extension_tag; ///< Always 2 = CEA EDID timing extension. - u8 revision; - u8 dtd_start; - u8 native_dtd_count : 4; - u8 native_dtd_feature_bitmap : 4; - SetSysDataBlock data_block; - SetSysModeLine extended_timing_descriptor[5]; - u8 padding[5]; - u8 extended_checksum; ///< Sum of 128 extended bytes should equal 0 mod 256. - u8 data2[0x80]; ///< [13.0.0+] - u8 data3[0x80]; ///< [13.0.0+] + SetSysExtensionBlock data1; + SetSysExtensionBlock data2; ///< [13.0.0+] + SetSysExtensionBlock data3; ///< [13.0.0+] } SetSysEdid; /// DataDeletionSettings From cbc050b779e0e91bff2267e12b8bbb114784a733 Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sat, 31 May 2025 19:51:04 +0200 Subject: [PATCH 2/4] Fix comment --- nx/include/switch/services/set.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/services/set.h b/nx/include/switch/services/set.h index 9533fcab..e37345a4 100644 --- a/nx/include/switch/services/set.h +++ b/nx/include/switch/services/set.h @@ -518,7 +518,7 @@ typedef struct { u16 product_code; u32 serial_number; u8 manufacture_week; - u8 manufacture_year; ///< Real value is val - 10. + u8 manufacture_year; ///< Real year is 1990 + val. u8 edid_version; u8 edid_revision; u8 video_input_parameters_bitmap; @@ -569,7 +569,7 @@ typedef struct { u8 extended_timing_info; u8 padding[7]; } display_descriptor_range_limits; - u8 extension_count; ///< Always 1. + u8 extension_count; u8 checksum; ///< Sum of all 128 bytes should equal 0 mod 256. ///< Extended data. SetSysExtensionBlock data1; From 7e363696cdf82c82506d8f5be3536b6785de442c Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 1 Jun 2025 08:38:03 +0200 Subject: [PATCH 3/4] Remove unnecesary NX_PACKED --- nx/include/switch/services/set.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/services/set.h b/nx/include/switch/services/set.h index e37345a4..09c2b845 100644 --- a/nx/include/switch/services/set.h +++ b/nx/include/switch/services/set.h @@ -501,12 +501,12 @@ typedef struct { } NX_PACKED cea; ///< CEA EDID timing extension struct { u8 data[0x7E]; - } NX_PACKED display_id; ///< [13.0.0+] DisplayID Extension Block + } display_id; ///< [13.0.0+] DisplayID Extension Block struct { u8 second_block_extension_tag; u8 third_block_extension_tag; u8 padding[0x7C]; - } NX_PACKED block_map; ///< [13.0.0+] EDID Extension Block Map + } block_map; ///< [13.0.0+] EDID Extension Block Map } extension_block; u8 extended_checksum; ///< Sum of 128 extended bytes should equal 0 mod 256. } SetSysExtensionBlock; From d9050a55aee9310d5fdb5fdf73eb8b2d208e03ef Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 1 Jun 2025 08:38:36 +0200 Subject: [PATCH 4/4] Fix comments --- nx/include/switch/services/set.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/services/set.h b/nx/include/switch/services/set.h index 09c2b845..0c7c1dc3 100644 --- a/nx/include/switch/services/set.h +++ b/nx/include/switch/services/set.h @@ -501,12 +501,12 @@ typedef struct { } NX_PACKED cea; ///< CEA EDID timing extension struct { u8 data[0x7E]; - } display_id; ///< [13.0.0+] DisplayID Extension Block + } display_id; ///< [13.0.0+] DisplayID Extension Block struct { u8 second_block_extension_tag; u8 third_block_extension_tag; u8 padding[0x7C]; - } block_map; ///< [13.0.0+] EDID Extension Block Map + } block_map; ///< [13.0.0+] EDID Extension Block Map } extension_block; u8 extended_checksum; ///< Sum of 128 extended bytes should equal 0 mod 256. } SetSysExtensionBlock;