rlm@1: /* FCE Ultra - NES/Famicom Emulator rlm@1: * rlm@1: * Copyright notice for this file: rlm@1: * Copyright (C) 2002 Ben Parnell rlm@1: * rlm@1: * This program is free software; you can redistribute it and/or modify rlm@1: * it under the terms of the GNU General Public License as published by rlm@1: * the Free Software Foundation; either version 2 of the License, or rlm@1: * (at your option) any later version. rlm@1: * rlm@1: * This program is distributed in the hope that it will be useful, rlm@1: * but WITHOUT ANY WARRANTY; without even the implied warranty of rlm@1: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the rlm@1: * GNU General Public License for more details. rlm@1: * rlm@1: * You should have received a copy of the GNU General Public License rlm@1: * along with this program; if not, write to the Free Software rlm@1: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rlm@1: */ rlm@1: rlm@1: /* Code originally from fceu/drawing.h file, adapted by Forgotten rlm@1: */ rlm@1: #include "System.h" rlm@1: rlm@1: bool outlinedText = true, transparentText = false; rlm@1: int textColor = 0, textMethod = 1; rlm@1: rlm@1: extern u32 RGB_LOW_BITS_MASK; rlm@1: rlm@1: static const u8 fontdata2[2048] = { rlm@1: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, rlm@1: 0xc3, 0xe7, 0xff, 0x7e, 0x36, 0x7f, 0x7f, 0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x08, 0x00, rlm@1: 0x1c, rlm@1: 0x3e, 0x1c, 0x7f, 0x7f, 0x3e, 0x1c, 0x3e, 0x08, 0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x3e, 0x00, 0x00, 0x18, 0x3c, 0x3c, rlm@1: 0x18, rlm@1: 0x00, 0x00, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0xff, 0xc3, rlm@1: 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xf0, 0xe0, 0xf0, 0xbe, 0x33, 0x33, 0x33, 0x1e, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, rlm@1: 0x7e, rlm@1: 0x18, 0xfc, 0xcc, 0xfc, 0x0c, 0x0c, 0x0e, 0x0f, 0x07, 0xfe, 0xc6, 0xfe, 0xc6, 0xc6, 0xe6, 0x67, 0x03, 0x99, 0x5a, 0x3c, rlm@1: 0xe7, rlm@1: 0xe7, 0x3c, 0x5a, 0x99, 0x01, 0x07, 0x1f, 0x7f, 0x1f, 0x07, 0x01, 0x00, 0x40, 0x70, 0x7c, 0x7f, 0x7c, 0x70, 0x40, 0x00, rlm@1: 0x18, rlm@1: 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, 0xfe, 0xdb, 0xdb, 0xde, 0xd8, rlm@1: 0xd8, rlm@1: 0xd8, 0x00, 0x7c, 0xc6, 0x1c, 0x36, 0x36, 0x1c, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00, 0x18, 0x3c, rlm@1: 0x7e, rlm@1: 0x18, 0x7e, 0x3c, 0x18, 0xff, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, rlm@1: 0x00, rlm@1: 0x00, 0x18, 0x30, 0x7f, 0x30, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x06, 0x7f, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, rlm@1: 0x03, rlm@1: 0x7f, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00, 0x00, rlm@1: 0xff, rlm@1: 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00, rlm@1: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1e, 0x1e, 0x0c, 0x0c, 0x00, 0x0c, 0x00, 0x36, 0x36, 0x36, 0x00, rlm@1: 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x36, 0x7f, 0x36, 0x36, 0x00, 0x0c, 0x3e, 0x03, 0x1e, 0x30, 0x1f, 0x0c, 0x00, rlm@1: 0x00, rlm@1: 0x63, 0x33, 0x18, 0x0c, 0x66, 0x63, 0x00, 0x1c, 0x36, 0x1c, 0x6e, 0x3b, 0x33, 0x6e, 0x00, 0x06, 0x06, 0x03, 0x00, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x00, 0x18, 0x0c, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x00, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x66, rlm@1: 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, rlm@1: 0x0c, rlm@1: 0x06, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x60, 0x30, 0x18, rlm@1: 0x0c, rlm@1: 0x06, 0x03, 0x01, 0x00, 0x3e, 0x63, 0x73, 0x7b, 0x6f, 0x67, 0x3e, 0x00, 0x0c, 0x0e, 0x0c, 0x0c, 0x0c, 0x0c, 0x3f, 0x00, rlm@1: 0x1e, rlm@1: 0x33, 0x30, 0x1c, 0x06, 0x33, 0x3f, 0x00, 0x1e, 0x33, 0x30, 0x1c, 0x30, 0x33, 0x1e, 0x00, 0x38, 0x3c, 0x36, 0x33, 0x7f, rlm@1: 0x30, rlm@1: 0x78, 0x00, 0x3f, 0x03, 0x1f, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x1c, 0x06, 0x03, 0x1f, 0x33, 0x33, 0x1e, 0x00, 0x3f, 0x33, rlm@1: 0x30, rlm@1: 0x18, 0x0c, 0x0c, 0x0c, 0x00, 0x1e, 0x33, 0x33, 0x1e, 0x33, 0x33, 0x1e, 0x00, 0x1e, 0x33, 0x33, 0x3e, 0x30, 0x18, 0x0e, rlm@1: 0x00, rlm@1: 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x06, 0x18, 0x0c, 0x06, 0x03, rlm@1: 0x06, rlm@1: 0x0c, 0x18, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x1e, rlm@1: 0x33, rlm@1: 0x30, 0x18, 0x0c, 0x00, 0x0c, 0x00, rlm@1: 0x3e, 0x63, 0x7b, 0x7b, 0x7b, 0x03, 0x1e, 0x00, 0x0c, 0x1e, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x00, 0x3f, 0x66, 0x66, 0x3e, rlm@1: 0x66, 0x66, 0x3f, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3c, 0x00, 0x1f, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1f, 0x00, rlm@1: 0x7f, rlm@1: 0x46, 0x16, 0x1e, 0x16, 0x46, 0x7f, 0x00, 0x7f, 0x46, 0x16, 0x1e, 0x16, 0x06, 0x0f, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x73, rlm@1: 0x66, rlm@1: 0x7c, 0x00, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x33, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x78, 0x30, rlm@1: 0x30, 0x30, 0x33, 0x33, 0x1e, 0x00, 0x67, 0x66, 0x36, 0x1e, 0x36, 0x66, 0x67, 0x00, 0x0f, 0x06, 0x06, 0x06, 0x46, 0x66, rlm@1: 0x7f, rlm@1: 0x00, 0x63, 0x77, 0x7f, 0x7f, 0x6b, 0x63, 0x63, 0x00, 0x63, 0x67, 0x6f, 0x7b, 0x73, 0x63, 0x63, 0x00, 0x1c, 0x36, 0x63, rlm@1: 0x63, rlm@1: 0x63, 0x36, 0x1c, 0x00, 0x3f, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x0f, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x3b, 0x1e, 0x38, 0x00, rlm@1: 0x3f, rlm@1: 0x66, 0x66, 0x3e, 0x36, 0x66, 0x67, 0x00, 0x1e, 0x33, 0x07, 0x0e, 0x38, 0x33, 0x1e, 0x00, 0x3f, 0x2d, 0x0c, 0x0c, 0x0c, rlm@1: 0x0c, rlm@1: 0x1e, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3f, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x00, 0x63, 0x63, rlm@1: 0x63, rlm@1: 0x6b, 0x7f, 0x77, 0x63, 0x00, 0x63, 0x63, 0x36, 0x1c, 0x1c, 0x36, 0x63, 0x00, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x0c, 0x1e, rlm@1: 0x00, rlm@1: 0x7f, 0x63, 0x31, 0x18, 0x4c, 0x66, 0x7f, 0x00, 0x1e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1e, 0x00, 0x03, 0x06, 0x0c, 0x18, rlm@1: 0x30, rlm@1: 0x60, 0x40, 0x00, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1e, 0x00, 0x08, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, rlm@1: 0x0c, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x6e, 0x00, 0x07, 0x06, 0x06, 0x3e, rlm@1: 0x66, 0x66, 0x3b, 0x00, 0x00, 0x00, 0x1e, 0x33, 0x03, 0x33, 0x1e, 0x00, 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6e, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x1e, 0x33, 0x3f, 0x03, 0x1e, 0x00, 0x1c, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x6e, 0x33, 0x33, rlm@1: 0x3e, rlm@1: 0x30, 0x1f, 0x07, 0x06, 0x36, 0x6e, 0x66, 0x66, 0x67, 0x00, 0x0c, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x30, 0x00, rlm@1: 0x30, 0x30, 0x30, 0x33, 0x33, 0x1e, 0x07, 0x06, 0x66, 0x36, 0x1e, 0x36, 0x67, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, rlm@1: 0x1e, rlm@1: 0x00, 0x00, 0x00, 0x33, 0x7f, 0x7f, 0x6b, 0x63, 0x00, 0x00, 0x00, 0x1f, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x1e, rlm@1: 0x33, rlm@1: 0x33, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x3b, 0x66, 0x66, 0x3e, 0x06, 0x0f, 0x00, 0x00, 0x6e, 0x33, 0x33, 0x3e, 0x30, 0x78, rlm@1: 0x00, rlm@1: 0x00, 0x3b, 0x6e, 0x66, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x3e, 0x03, 0x1e, 0x30, 0x1f, 0x00, 0x08, 0x0c, 0x3e, 0x0c, 0x0c, rlm@1: 0x2c, rlm@1: 0x18, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x00, 0x00, 0x00, rlm@1: 0x63, rlm@1: 0x6b, 0x7f, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x63, 0x36, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x3e, 0x30, rlm@1: 0x1f, rlm@1: 0x00, 0x00, 0x3f, 0x19, 0x0c, 0x26, 0x3f, 0x00, 0x38, 0x0c, 0x0c, 0x07, 0x0c, 0x0c, 0x38, 0x00, 0x18, 0x18, 0x18, 0x00, rlm@1: 0x18, rlm@1: 0x18, 0x18, 0x00, 0x07, 0x0c, 0x0c, 0x38, 0x0c, 0x0c, 0x07, 0x00, 0x6e, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, rlm@1: 0x08, rlm@1: 0x1c, 0x36, 0x63, 0x63, 0x7f, 0x00, rlm@1: 0x1e, 0x33, 0x03, 0x33, 0x1e, 0x18, 0x30, 0x1e, 0x00, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x38, 0x00, 0x1e, 0x33, rlm@1: 0x3f, 0x03, 0x1e, 0x00, 0x7e, 0xc3, 0x3c, 0x60, 0x7c, 0x66, 0xfc, 0x00, 0x33, 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x7e, 0x00, rlm@1: 0x07, rlm@1: 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x7e, 0x00, 0x0c, 0x0c, 0x1e, 0x30, 0x3e, 0x33, 0x7e, 0x00, 0x00, 0x00, 0x1e, 0x03, 0x03, rlm@1: 0x1e, rlm@1: 0x30, 0x1c, 0x7e, 0xc3, 0x3c, 0x66, 0x7e, 0x06, 0x3c, 0x00, 0x33, 0x00, 0x1e, 0x33, 0x3f, 0x03, 0x1e, 0x00, 0x07, 0x00, rlm@1: 0x1e, 0x33, 0x3f, 0x03, 0x1e, 0x00, 0x33, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x3e, 0x63, 0x1c, 0x18, 0x18, 0x18, rlm@1: 0x3c, rlm@1: 0x00, 0x07, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x63, 0x1c, 0x36, 0x63, 0x7f, 0x63, 0x63, 0x00, 0x0c, 0x0c, 0x00, rlm@1: 0x1e, rlm@1: 0x33, 0x3f, 0x33, 0x00, 0x38, 0x00, 0x3f, 0x06, 0x1e, 0x06, 0x3f, 0x00, 0x00, 0x00, 0xfe, 0x30, 0xfe, 0x33, 0xfe, 0x00, rlm@1: 0x7c, rlm@1: 0x36, 0x33, 0x7f, 0x33, 0x33, 0x73, 0x00, 0x1e, 0x33, 0x00, 0x1e, 0x33, 0x33, 0x1e, 0x00, 0x00, 0x33, 0x00, 0x1e, 0x33, rlm@1: 0x33, rlm@1: 0x1e, 0x00, 0x00, 0x07, 0x00, 0x1e, 0x33, 0x33, 0x1e, 0x00, 0x1e, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x07, rlm@1: 0x00, rlm@1: 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x33, 0x00, 0x33, 0x33, 0x3e, 0x30, 0x1f, 0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, rlm@1: 0x00, rlm@1: 0x33, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1e, 0x00, 0x18, 0x18, 0x7e, 0x03, 0x03, 0x7e, 0x18, 0x18, 0x1c, 0x36, 0x26, 0x0f, rlm@1: 0x06, rlm@1: 0x67, 0x3f, 0x00, 0x33, 0x33, 0x1e, 0x3f, 0x0c, 0x3f, 0x0c, 0x0c, 0x1f, 0x33, 0x33, 0x5f, 0x63, 0xf3, 0x63, 0xe3, 0x70, rlm@1: 0xd8, rlm@1: 0x18, 0x3c, 0x18, 0x18, 0x1b, 0x0e, rlm@1: 0x38, 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x7e, 0x00, 0x1c, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x38, 0x00, 0x1e, rlm@1: 0x33, 0x33, 0x1e, 0x00, 0x00, 0x38, 0x00, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x33, 0x33, 0x33, 0x00, rlm@1: 0x3f, rlm@1: 0x00, 0x33, 0x37, 0x3f, 0x3b, 0x33, 0x00, 0x3c, 0x36, 0x36, 0x7c, 0x00, 0x7e, 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x00, rlm@1: 0x3e, rlm@1: 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x06, 0x03, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, rlm@1: 0x00, 0x3f, 0x30, 0x30, 0x00, 0x00, 0xc3, 0x63, 0x33, 0x7b, 0xcc, 0x66, 0x33, 0xf0, 0xc3, 0x63, 0x33, 0xdb, 0xec, 0xf6, rlm@1: 0xf3, rlm@1: 0xc0, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x33, 0x66, rlm@1: 0xcc, rlm@1: 0x66, 0x33, 0x00, 0x00, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, rlm@1: 0xdb, rlm@1: 0xee, 0xdb, 0x77, 0xdb, 0xee, 0xdb, 0x77, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, rlm@1: 0x18, rlm@1: 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x6c, 0x6c, 0x6c, 0x6c, 0x6f, 0x6c, 0x6c, 0x6c, 0x00, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x7f, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x6c, 0x6c, 0x6f, 0x60, 0x6f, 0x6c, 0x6c, rlm@1: 0x6c, rlm@1: 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x7f, 0x60, 0x6f, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6f, 0x60, rlm@1: 0x7f, rlm@1: 0x00, 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x7f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, rlm@1: 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, rlm@1: 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, rlm@1: 0x18, rlm@1: 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x6c, 0x6c, 0x6c, 0x6c, 0xec, rlm@1: 0x6c, rlm@1: 0x6c, 0x6c, 0x6c, 0x6c, 0xec, 0x0c, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0c, 0xec, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, rlm@1: 0xef, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xec, 0x0c, 0xec, 0x6c, rlm@1: 0x6c, rlm@1: 0x6c, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xef, 0x00, 0xef, 0x6c, 0x6c, 0x6c, 0x18, 0x18, 0xff, rlm@1: 0x00, rlm@1: 0xff, 0x00, 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, rlm@1: 0x00, rlm@1: 0x00, 0x00, 0x00, 0xff, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfc, 0x00, 0x00, 0x00, 0x18, 0x18, 0xf8, 0x18, 0xf8, rlm@1: 0x00, rlm@1: 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, rlm@1: 0x6c, rlm@1: 0x6c, 0xff, 0x6c, 0x6c, 0x6c, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, rlm@1: 0xff, rlm@1: 0xff, 0xff, 0xff, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, rlm@1: 0xff, rlm@1: 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, rlm@1: 0x00, 0x00, 0x6e, 0x3b, 0x13, 0x3b, 0x6e, 0x00, 0x00, 0x1e, 0x33, 0x1f, 0x33, 0x1f, 0x03, 0x03, 0x00, 0x3f, 0x33, 0x03, rlm@1: 0x03, 0x03, 0x03, 0x00, 0x00, 0x7f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x3f, 0x33, 0x06, 0x0c, 0x06, 0x33, 0x3f, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x7e, 0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x03, 0x00, 0x6e, 0x3b, 0x18, 0x18, rlm@1: 0x18, rlm@1: 0x18, 0x00, 0x3f, 0x0c, 0x1e, 0x33, 0x33, 0x1e, 0x0c, 0x3f, 0x1c, 0x36, 0x63, 0x7f, 0x63, 0x36, 0x1c, 0x00, 0x1c, 0x36, rlm@1: 0x63, 0x63, 0x36, 0x36, 0x77, 0x00, 0x38, 0x0c, 0x18, 0x3e, 0x33, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, rlm@1: 0x00, rlm@1: 0x00, 0x60, 0x30, 0x7e, 0xdb, 0xdb, 0x7e, 0x06, 0x03, 0x1c, 0x06, 0x03, 0x1f, 0x03, 0x06, 0x1c, 0x00, 0x1e, 0x33, 0x33, rlm@1: 0x33, rlm@1: 0x33, 0x33, 0x33, 0x00, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x00, 0x3f, 0x00, rlm@1: 0x06, rlm@1: 0x0c, 0x18, 0x0c, 0x06, 0x00, 0x3f, 0x00, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x00, 0x3f, 0x00, 0x70, 0xd8, 0xd8, 0x18, 0x18, rlm@1: 0x18, rlm@1: 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x1b, 0x0e, 0x0c, 0x0c, 0x00, 0x3f, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x6e, rlm@1: 0x3b, rlm@1: 0x00, 0x6e, 0x3b, 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xf0, 0x30, 0x30, 0x30, 0x37, 0x36, 0x3c, 0x38, 0x1e, 0x36, 0x36, 0x36, rlm@1: 0x36, rlm@1: 0x00, 0x00, 0x00, 0x0e, 0x18, 0x0c, 0x06, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, rlm@1: 0x00, rlm@1: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 rlm@1: }; rlm@1: rlm@1: static void calcColors(const int colorNum, int & lo, int & hi, int & out) rlm@1: { rlm@1: int redLo, redHi, greenLo, greenHi, blueLo, blueHi; rlm@1: rlm@1: if (colorNum == 0 || colorNum == 1 || colorNum == 2 || colorNum == 6) // white, red, yellow, or magenta rlm@1: redLo = (0xf) << systemRedShift, redHi = (0x1f) << systemRedShift; rlm@1: else rlm@1: redLo = redHi = 0; rlm@1: rlm@1: if (colorNum == 0 || colorNum == 2 || colorNum == 3 || colorNum == 4) // white, yellow, green, or cyan rlm@1: greenLo = (0xf) << systemGreenShift, greenHi = (0x1f) << systemGreenShift; rlm@1: else rlm@1: greenLo = greenHi = 0; rlm@1: rlm@1: if (colorNum == 0 || colorNum == 4 || colorNum == 5 || colorNum == 6) // white, cyan, blue, or magenta rlm@1: blueLo = (0xf) << systemBlueShift, blueHi = (0x1f) << systemBlueShift; rlm@1: else rlm@1: blueLo = blueHi = 0; rlm@1: rlm@1: lo = redLo + greenLo + blueLo; rlm@1: hi = redHi + greenHi + blueHi; rlm@1: rlm@1: if (colorNum == 7) // black rlm@1: out = 0xffffffff; // white border rlm@1: else rlm@1: out = 0; // black border rlm@1: } rlm@1: rlm@1: int lastColID = 0; rlm@1: static void progressColorList(const char *& colorList, int & lo, int & hi, int & out) rlm@1: { rlm@1: if (*colorList) rlm@1: { rlm@1: if (*colorList != lastColID) rlm@1: { rlm@1: calcColors((int)(*colorList)-1, lo, hi, out); rlm@1: lastColID = *colorList; rlm@1: } rlm@1: colorList++; rlm@1: } rlm@1: else rlm@1: { rlm@1: colorList = NULL; rlm@1: } rlm@1: } rlm@1: rlm@1: static void drawTextInternal(u8 *screen, int pitch, int x, int y, rlm@1: const char *string, bool trans, const char *colorList = NULL) rlm@1: { rlm@1: if (colorList && !*colorList) rlm@1: colorList = NULL; rlm@1: rlm@1: int loCol, hiCol, outCol; rlm@1: calcColors(textColor, loCol, hiCol, outCol); rlm@1: rlm@1: lastColID = 0; rlm@1: rlm@1: const static int xd [8] = {-1, 0, 1, 1, 1, 0, -1, -1}; rlm@1: const static int yd [8] = {-1, -1, -1, 0, 1, 1, 1, 0}; rlm@1: rlm@1: screen += y*pitch; rlm@1: int inc = 2; rlm@1: switch (systemColorDepth) rlm@1: { rlm@1: case 24: rlm@1: inc = 3; rlm@1: break; rlm@1: case 32: rlm@1: inc = 4; rlm@1: break; rlm@1: } rlm@1: screen += x*inc; rlm@1: rlm@1: int xpos = x; rlm@1: switch (systemColorDepth) rlm@1: { rlm@1: case 16: rlm@1: { rlm@1: while (*string) rlm@1: { rlm@1: char c = *string++; rlm@1: u8 * scr = screen; rlm@1: rlm@1: if (colorList) rlm@1: progressColorList(colorList, loCol, hiCol, outCol); rlm@1: rlm@1: u16 mask = u16(~RGB_LOW_BITS_MASK); rlm@1: u16 *s = (u16 *)scr; rlm@1: for (int h = 0-1; h < 8+1; h++) rlm@1: { rlm@1: for (int w = 0-1; w < 8+1; w++, s++) rlm@1: { rlm@1: int on = (h < 0 || w < 0 || h >= 8 || w >= 8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; rlm@1: rlm@1: int border = 0; rlm@1: if (outlinedText) rlm@1: for (int i = 0; i < 8; i++) rlm@1: { rlm@1: int h2 = h+yd[i], w2 = w+xd[i]; rlm@1: border = (h2 < 0 || w2 < 0 || h2 >= 8 || w2 >= 8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; rlm@1: if (border) rlm@1: break; rlm@1: } rlm@1: rlm@1: if (trans) rlm@1: { rlm@1: if (on) rlm@1: *s = loCol + rlm@1: ((*s & mask) >>1); rlm@1: else if (border) rlm@1: { rlm@1: *s = outCol + rlm@1: ((*s & mask) >>1); rlm@1: } rlm@1: } rlm@1: else rlm@1: { rlm@1: if (on) rlm@1: *s = hiCol; rlm@1: else if (border) rlm@1: *s = outCol; rlm@1: } rlm@1: } rlm@1: scr += pitch; rlm@1: s = (u16 *)scr; rlm@1: } rlm@1: screen += inc*8; rlm@1: rlm@1: xpos += 8; rlm@1: if (xpos+8 > pitch>>1) // cut off text at right boundary rlm@1: break; rlm@1: } rlm@1: break; rlm@1: } rlm@1: case 24: // TODO: verify this code's correctness rlm@1: { rlm@1: while (*string) rlm@1: { rlm@1: char c = *string++; rlm@1: u8 * scr = screen; rlm@1: rlm@1: if (colorList) rlm@1: progressColorList(colorList, loCol, hiCol, outCol); rlm@1: rlm@1: int h, w; rlm@1: u8 *s = (u8 *)scr; rlm@1: for (h = 0-1; h < 8+1; h++) rlm@1: { rlm@1: for (w = 0-1; w < 8+1; w++, s++) rlm@1: { rlm@1: int on = (h < 0 || w < 0 || h >= 8 || w >= 8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; rlm@1: rlm@1: int border = 0; rlm@1: if (outlinedText) rlm@1: for (int i = 0; i < 8; i++) rlm@1: { rlm@1: int h2 = h+yd[i], w2 = w+xd[i]; rlm@1: border = (h2 < 0 || w2 < 0 || h2 >= 8 || w2 >= 8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; rlm@1: if (border) rlm@1: break; rlm@1: } rlm@1: rlm@1: if (trans) rlm@1: { rlm@1: if (on) rlm@1: { rlm@1: u32 color = hiCol; rlm@1: *s = ((color & 255)>>1)+(*s>>1); rlm@1: *(s+1) = (((color >> 8) & 255)>>1)+(*(s+1)>>1); rlm@1: *(s+2) = (((color >> 16) & 255)>>1)+(*(s+2)>>1); rlm@1: } rlm@1: else if (border) rlm@1: { rlm@1: u32 color = outCol; rlm@1: *s = ((color & 255)>>1)+(*s>>1); rlm@1: *(s+1) = (((color >> 8) & 255)>>1)+(*(s+1)>>1); rlm@1: *(s+2) = (((color >> 16) & 255)>>1)+(*(s+2)>>1); rlm@1: } rlm@1: } rlm@1: else rlm@1: { rlm@1: if (on) rlm@1: { rlm@1: u32 color = hiCol; rlm@1: *s = (color & 255); rlm@1: *(s+1) = (color >> 8) & 255; rlm@1: *(s+2) = (color >> 16) & 255; rlm@1: } rlm@1: else if (border) rlm@1: { rlm@1: u32 color = outCol; rlm@1: *s = (color & 255); rlm@1: *(s+1) = (color >> 8) & 255; rlm@1: *(s+2) = (color >> 16) & 255; rlm@1: } rlm@1: } rlm@1: } rlm@1: scr += pitch; rlm@1: s = (u8 *)scr; rlm@1: } rlm@1: screen += inc*8; rlm@1: rlm@1: xpos += 8; rlm@1: if (xpos+8 > pitch/3) // cut off text at right boundary rlm@1: break; rlm@1: } rlm@1: break; rlm@1: } rlm@1: case 32: rlm@1: { rlm@1: while (*string) rlm@1: { rlm@1: char c = *string++; rlm@1: u8 * scr = screen; rlm@1: rlm@1: if (colorList) rlm@1: progressColorList(colorList, loCol, hiCol, outCol); rlm@1: rlm@1: int h, w; rlm@1: u32 mask = 0xfefefe; rlm@1: u32 *s = (u32 *)scr; rlm@1: for (h = 0-1; h < 8+1; h++) rlm@1: { rlm@1: for (w = 0-1; w < 8+1; w++, s++) rlm@1: { rlm@1: int on = (h < 0 || w < 0 || h >= 8 || w >= 8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; rlm@1: rlm@1: int border = 0; rlm@1: if (outlinedText) rlm@1: for (int i = 0; i < 8; i++) rlm@1: { rlm@1: int h2 = h+yd[i], w2 = w+xd[i]; rlm@1: border = (h2 < 0 || w2 < 0 || h2 >= 8 || w2 >= 8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; rlm@1: if (border) rlm@1: break; rlm@1: } rlm@1: rlm@1: if (trans) rlm@1: { rlm@1: if (on) rlm@1: *s = loCol + rlm@1: ((*s & mask)>>1); rlm@1: else if (border) rlm@1: { rlm@1: *s = outCol + rlm@1: ((*s & mask)>>1); rlm@1: } rlm@1: } rlm@1: else rlm@1: { rlm@1: if (on) rlm@1: *s = hiCol; rlm@1: else if (border) rlm@1: *s = outCol; rlm@1: } rlm@1: } rlm@1: scr += pitch; rlm@1: s = (u32 *)scr; rlm@1: } rlm@1: screen += inc*8; rlm@1: rlm@1: xpos += 8; rlm@1: if (xpos+8 > pitch>>2) // cut off text at right boundary rlm@1: break; rlm@1: } rlm@1: break; rlm@1: } rlm@1: } rlm@1: } rlm@1: rlm@1: void drawText(u8 *screen, int pitch, int x, int y, const char *string, const char *colorList) rlm@1: { rlm@1: drawTextInternal(screen, pitch, x, y, string, transparentText, colorList); rlm@1: } rlm@1: rlm@1: void drawTextTransp(u8 *screen, int pitch, int x, int y, const char *string, const char *colorList) rlm@1: { rlm@1: drawTextInternal(screen, pitch, x, y, string, true, colorList); rlm@1: } rlm@1: