Template talk:BOM

From Custom Mario Kart
Jump to navigation Jump to search

BOM

I think it should say 0xFEFF and not 0xFE, 0xFF. The key is to see those bytes as a UInt16/u16, not as a byte[], so if you read 0xFEFF (as a UInt16) you have the correct endianess. But 0xFE, 0xFF makes it look like the key is a byte[], but it's not.
--Wexos (Talk | Contribs) 08:47, 10 December 2016 (UTC)

Agreed. Waiting for Wiimm to confirm it. —Atlas (talk) 12:00, 10 December 2016 (UTC)
Clearly NO. The value of BOM is always 0xfeff for both, little and big endian. But in BE it stored as bytes FE,FF and in LE as FF,FE.
Or in other words: Bytes FE,FF indicate BE, because BE interpretation is feff. Bytes FF,FE indicate LE, because LE interpretation is also feff. If a tool reads another value tahen feff (and especially fffe), it uses the wrong endian.
Hope I described it clearly. -- Wiimm (talk) 14:55, 10 December 2016 (UTC)
More other words: The 2 bytes are either FE,FF (BE) or FF,FE (LE). And if the tool use the correct endian, it reads FEFF. And here you see, that the single bytes are important and not the combined value.
-- Wiimm (talk) 14:59, 10 December 2016 (UTC)
Another comment could be: The value is always 0xfeff. If value 0xfffe is read, the false endian is used.
-- Wiimm (talk) 14:17, 11 December 2016 (UTC)
Does it mean that there can't be files using Little Endian in MKWii at least? —Atlas (talk) 21:30, 11 December 2016 (UTC)
First, it is the meaning of the member. And this meaning doesn't change if MKWii uses only big endian. And STATUS records are transmitted in little endian.
-- Wiimm (talk) 23:28, 11 December 2016 (UTC)
I see you point but I don't think "0xFF, 0xFE" makes it clearer. How about representing it with Unicode (UTF-16)? "U+FFFE for big endian and U+FEFF for little endian".
--Wexos (Talk | Contribs) 17:53, 12 December 2016 (UTC)
@Wexos: That maybe right for most MKWii files, but not for other platforms. Always right is my sentence of above: The value is always 0xfeff. If value 0xfffe is read, then the false endian is used. And that is the trick of BOM.
--Wiimm (talk) 22:04, 12 December 2016 (UTC)

Link to Endian

I know there is already a link to that page in the template, but I think it would be more newbie-friendly (or, at least, more me-friendly) to put another link to that page, like so:

Byte order mark (BOM): The value is always 0xFEFF. If value 0xFFFE is read, then the false endian is used. MKWii uses nearly always big endian (bytes 0xFE,0xFF).

-- Cealgair (talk|contribs) 20:52, 15 May 2021 (UTC)