From e4ac90f5c1d1be19378858af7d64b2278a0e460a Mon Sep 17 00:00:00 2001 From: Dave Allie Date: Tue, 30 Dec 2025 12:36:25 +1000 Subject: [PATCH] Accept big endian version in XTC files (#159) ## Summary * Accept big endian version in XTC files * Recently, two issues (https://github.com/daveallie/crosspoint-reader/issues/157 and https://github.com/daveallie/crosspoint-reader/issues/146) have popped up with XTC files with a big endian encoded version. This is read out as 256. * We should be more lax and accept these values. --- lib/Xtc/Xtc/XtcParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Xtc/Xtc/XtcParser.cpp b/lib/Xtc/Xtc/XtcParser.cpp index f4bf62f8..6d34b353 100644 --- a/lib/Xtc/Xtc/XtcParser.cpp +++ b/lib/Xtc/Xtc/XtcParser.cpp @@ -101,7 +101,9 @@ XtcError XtcParser::readHeader() { m_bitDepth = (m_header.magic == XTCH_MAGIC) ? 2 : 1; // Check version - if (m_header.version > 1) { + // Currently, version 1 is the only valid version, however some generators are using big endian for the version code + // so we also accept version 256 (0x0100) + if (m_header.version != 1 && m_header.version != 256) { Serial.printf("[%lu] [XTC] Unsupported version: %d\n", millis(), m_header.version); return XtcError::INVALID_VERSION; }