@@ -819,6 +819,46 @@ retail's 0x136A7-byte image. `sce/sifdev.cpp` implements `sceOpen`,
819819device prefix stripped (the debug dump ` edit.cpp ` writes to ` host0: ` ), and
820820` WriteFile ` writes there too.
821821
822+ ## Game text
823+
824+ ` port/src/gametext.cpp ` writes the port's own text in the game's message
825+ font, so menus the port adds can match the game's. A message is an s16 code
826+ per character ending in ` MES_CODE_END ` (-0xFF); a space is
827+ ` MES_CODE_SPACE ` (-0xFE) and a line break ` MES_CODE_NEWLINE ` (-0x100). The
828+ PAL font draws only the external characters from -0x300: -0x300 to -0x2E0
829+ are the pad buttons and icons; -0x2DF to -0x288 are the 88 cells of
830+ ` gaiji.img ` 's letter grid in order (` A ` -` Z ` , ` a ` -` z ` ,
831+ ` '="!?#&+-*/%()@|<>{}[]:,.$ ` and ` 0 ` -` 9 ` ); -0x287 to -0x254 are `œ ¡ ¿ ß Œ
832+ Ç ç` and the letters ` DrawGaijiFont` draws an accent over ( ` ÀÁÂÄÈÉÊËÌÍÎÏÑ
833+ ÒÓÔÖÙÚÛÜàáâäèéêëìíîïñòóôöùúûü`). -0x263 to -0x261, -0x253 and -0x252
834+ draw a bare ` ? ` . There is no ` ; ` , ` _ ` , ` ~ ` , ` ^ ` , backquote or backslash.
835+ The table was read off the ` gaiji.img ` of every ` meswin/mes_tex_N.pak ` (all
836+ seven draw these characters in the same cells; only the pixels differ) and
837+ checked by decoding every ` .mes ` on the disc: each language uses only
838+ characters in it, and its own accents only.
839+
840+ ` GameTextEncode ` turns UTF-8 into codes. Curly quotes and dashes become the
841+ font's own; any other character the font lacks, and any byte that is not
842+ UTF-8, becomes ` ? ` and is counted. ` {N} ` writes code N as it is, for control
843+ codes and icons, and ` {{ ` a ` { ` ; ` GameTextDecode ` writes the same form, so
844+ any message reads back and encodes to the same codes. ` GameTextFile ` lays
845+ texts out as a message file for ` ClsMes::SetBuff ` . ` GameText ` is one piece of
846+ text drawn as the menus draw their help line (` InitMenuMesSet ` 's
847+ ` CommonMenuMes2 ` : the menu font, white with a black edge, shown whole): ` Set `
848+ the text, ` SetColour ` a ` FontColor ` , then ` Draw(x, y, alpha) ` from a menu's
849+ draw function; ` Width ` gives its width for aligning a value.
850+
851+ Both have retail's fixed sizes. A window lays out at most ` MES_WIN_LINE_MAX `
852+ (720) characters, counting the end and what a ` {N} ` name, value or system
853+ message code expands to; retail's ` SetMesWinTbl ` writes on past the table, so
854+ the port's (` port/src/clsmes.cpp ` ) takes no more, and ` GameText::Set ` gives back
855+ -1, draws nothing and has a width of 0 for a text that did not fit. A line past
856+ the window's ten ` line_pos ` entries draws in the block layout, as a line
857+ without one does. A message file is s16 throughout: an id is -0x8000 to
858+ 0x7FFF. Every message must start within 0x7FFF codes of ` &buff[1 + count] ` ;
859+ the last message by id may extend beyond that range. ` GameTextFile::Set `
860+ gives back -1 and leaves the file as it was where either would not hold.
861+
822862## Arenas
823863
824864` CDataAlloc2<1>::Alloc/Alloc64/Align64 ` and the carving in
0 commit comments