OBD:TSGA

From OniGalore
Revision as of 19:37, 19 February 2022 by Iritscen (talk | contribs) (wording; linking to OBD:Text encoding)
Jump to navigation Jump to search
ONI BINARY DATA
TSFT << Other file types >> TStr
TSGA : Glyph Array
switch to XML:TSGA page
Overview @ Oni Stuff
OBD.png


Every TSGA file contains 256 elements of 20 bytes each, thus taking up 5,120 bytes without the header. Together with the 8-byte header and 32-byte padding, each TSGA takes up 5,152 bytes in a .dat (another 20 bytes are taken up in the instance descriptor array).

For Western languages, a TSFT has only one TSGA which corresponds to an ASCII-style encoding table:

  • the first 32 symbols (0 to 31) are non-printable control characters, so these elements are always all-zero
  • the next 96 symbols (32 to 127) correspond to standard ASCII
  • the upper half of the table (128 to 255) is filled with non-standard punctuation and non-Latin characters

"Non-Latin" refers to European characters which use diacritics or to Cyrillic characters; the exact character set varies by language version of the game. Asian localizations of Oni use their own extended encoding system and glyph data in place of Oni's. See OBD:Text encoding for details on the encoding systems and the available characters in each language version.


Tsga a.gif


Offset Type Raw Hex Value Description
0x00 res_id 01 04 00 00 4 00004-.TSGA
0x04 lev_id 01 00 00 00 0 level 0
First element (black outline)
0x00 int16 00 00 unused character code
0x02 int16 00 00 unused width
0x04 int16 00 00 unused bitmap width
0x06 int16 00 00 unused bitmap height
0x08 int16 00 00 unused bitmap x origin
0x0A int16 00 00 unused bitmap y origin
0x0C int32 00 00 00 00 unused start element in the TSFT file
0x10 int32 00 00 00 00 unused runtime only


A glyph is basically a grayscale bitmap which is (width * height) pixels in size. Each pixel is stored in one byte in the TSFT file (fonts are antialiased so shades of gray are needed rather than storing each pixel in one bit; although for the smallest font size there is no antialiasing in use and the 8-bit pixels are either fully black or fully white).

The pixels stored in TSFT (packed 4-by-4 as little-Endian unsigned int32s) are treated as a scanline, row major, top to bottom and left to right. The width of a glyph is not always a multiple of 4 pixels, so the scanline can wrap around, i.e. a new row of pixels can start in the middle of a 4-byte element. The start of a glyph, however, is always aligned on a 4-byte element of the TSFT array. The end of a glyph is padded with 0xDEAD.


ONI BINARY DATA
TSFT << Other file types >> TStr
TSGA : Glyph Array
Global file