-
Notifications
You must be signed in to change notification settings - Fork 1
Description
DAT content types
SmileBASIC DAT files are not just comprised of content types 3 to 5. Types 0, 1 and 2 are also valid, but left unused, as they were deemed unnecessary with the vanilla file types.
These are Int8, Uint8 and Int16, respectively. They would come in handy for PCM streams or custom waveforms for MML, as you won't have to convert them yourself then.
SmileBoom might have planned to add content type 0x06 in SB4, but it seems like the idea didn't get ground., as importing an SB3 DAT file with this content type will crash SB4 upon trying to load it.
Otherwise, any other invalid type simply cause the parser to stop reading after the dimension length values and just fill the array with zeroes.
SB3's creator name encoding
SmileBASIC 3's creator/uploader name fields do not use UTF-8 encoding.
Crafting a name with non-ASCII characters (in my case: H\x80\xFF\xCC\xF0\xA2䀵 lmao! XD
) will return like so:
The actual encoding that SmileBASIC 3 reads it, is ASCII. Should a byte not be decodable it throws it's usual method out of the window and read past the header and potentially also loop around to find valid characters. (Rough investigation, but far enough)
Nontheless, you should probably sanity-check the name and replace invalid characters with '?' before passing it off, when it's a SB3 file.
EDIT: Loving how I said the same thing twice but with different phrasing...