Mercurial > vba-clojure
diff src/common/Text.cpp @ 19:5e8e5083da94
brought in common and gba, fixed problems with outdated Makefile.am files in both of these packages
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 04 Mar 2012 14:33:52 -0600 |
parents | f9f4f1b99eed |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/common/Text.cpp Sun Mar 04 14:33:52 2012 -0600 1.3 @@ -0,0 +1,496 @@ 1.4 +/* FCE Ultra - NES/Famicom Emulator 1.5 + * 1.6 + * Copyright notice for this file: 1.7 + * Copyright (C) 2002 Ben Parnell 1.8 + * 1.9 + * This program is free software; you can redistribute it and/or modify 1.10 + * it under the terms of the GNU General Public License as published by 1.11 + * the Free Software Foundation; either version 2 of the License, or 1.12 + * (at your option) any later version. 1.13 + * 1.14 + * This program is distributed in the hope that it will be useful, 1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.17 + * GNU General Public License for more details. 1.18 + * 1.19 + * You should have received a copy of the GNU General Public License 1.20 + * along with this program; if not, write to the Free Software 1.21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1.22 + */ 1.23 + 1.24 +/* Code originally from fceu/drawing.h file, adapted by Forgotten 1.25 + */ 1.26 +#include "System.h" 1.27 + 1.28 +bool outlinedText = true, transparentText = false; 1.29 +int textColor = 0, textMethod = 1; 1.30 + 1.31 +extern u32 RGB_LOW_BITS_MASK; 1.32 + 1.33 +static const u8 fontdata2[2048] = { 1.34 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 1.35 + 0xc3, 0xe7, 0xff, 0x7e, 0x36, 0x7f, 0x7f, 0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x08, 0x00, 1.36 + 0x1c, 1.37 + 0x3e, 0x1c, 0x7f, 0x7f, 0x3e, 0x1c, 0x3e, 0x08, 0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x3e, 0x00, 0x00, 0x18, 0x3c, 0x3c, 1.38 + 0x18, 1.39 + 0x00, 0x00, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0xff, 0xc3, 1.40 + 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xf0, 0xe0, 0xf0, 0xbe, 0x33, 0x33, 0x33, 0x1e, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 1.41 + 0x7e, 1.42 + 0x18, 0xfc, 0xcc, 0xfc, 0x0c, 0x0c, 0x0e, 0x0f, 0x07, 0xfe, 0xc6, 0xfe, 0xc6, 0xc6, 0xe6, 0x67, 0x03, 0x99, 0x5a, 0x3c, 1.43 + 0xe7, 1.44 + 0xe7, 0x3c, 0x5a, 0x99, 0x01, 0x07, 0x1f, 0x7f, 0x1f, 0x07, 0x01, 0x00, 0x40, 0x70, 0x7c, 0x7f, 0x7c, 0x70, 0x40, 0x00, 1.45 + 0x18, 1.46 + 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, 0xfe, 0xdb, 0xdb, 0xde, 0xd8, 1.47 + 0xd8, 1.48 + 0xd8, 0x00, 0x7c, 0xc6, 0x1c, 0x36, 0x36, 0x1c, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00, 0x18, 0x3c, 1.49 + 0x7e, 1.50 + 0x18, 0x7e, 0x3c, 0x18, 0xff, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 1.51 + 0x00, 1.52 + 0x00, 0x18, 0x30, 0x7f, 0x30, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x06, 0x7f, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 1.53 + 0x03, 1.54 + 0x7f, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00, 0x00, 1.55 + 0xff, 1.56 + 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00, 1.57 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1e, 0x1e, 0x0c, 0x0c, 0x00, 0x0c, 0x00, 0x36, 0x36, 0x36, 0x00, 1.58 + 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x36, 0x7f, 0x36, 0x36, 0x00, 0x0c, 0x3e, 0x03, 0x1e, 0x30, 0x1f, 0x0c, 0x00, 1.59 + 0x00, 1.60 + 0x63, 0x33, 0x18, 0x0c, 0x66, 0x63, 0x00, 0x1c, 0x36, 0x1c, 0x6e, 0x3b, 0x33, 0x6e, 0x00, 0x06, 0x06, 0x03, 0x00, 0x00, 1.61 + 0x00, 1.62 + 0x00, 0x00, 0x18, 0x0c, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x00, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x66, 1.63 + 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 1.64 + 0x0c, 1.65 + 0x06, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x60, 0x30, 0x18, 1.66 + 0x0c, 1.67 + 0x06, 0x03, 0x01, 0x00, 0x3e, 0x63, 0x73, 0x7b, 0x6f, 0x67, 0x3e, 0x00, 0x0c, 0x0e, 0x0c, 0x0c, 0x0c, 0x0c, 0x3f, 0x00, 1.68 + 0x1e, 1.69 + 0x33, 0x30, 0x1c, 0x06, 0x33, 0x3f, 0x00, 0x1e, 0x33, 0x30, 0x1c, 0x30, 0x33, 0x1e, 0x00, 0x38, 0x3c, 0x36, 0x33, 0x7f, 1.70 + 0x30, 1.71 + 0x78, 0x00, 0x3f, 0x03, 0x1f, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x1c, 0x06, 0x03, 0x1f, 0x33, 0x33, 0x1e, 0x00, 0x3f, 0x33, 1.72 + 0x30, 1.73 + 0x18, 0x0c, 0x0c, 0x0c, 0x00, 0x1e, 0x33, 0x33, 0x1e, 0x33, 0x33, 0x1e, 0x00, 0x1e, 0x33, 0x33, 0x3e, 0x30, 0x18, 0x0e, 1.74 + 0x00, 1.75 + 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x06, 0x18, 0x0c, 0x06, 0x03, 1.76 + 0x06, 1.77 + 0x0c, 0x18, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x1e, 1.78 + 0x33, 1.79 + 0x30, 0x18, 0x0c, 0x00, 0x0c, 0x00, 1.80 + 0x3e, 0x63, 0x7b, 0x7b, 0x7b, 0x03, 0x1e, 0x00, 0x0c, 0x1e, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x00, 0x3f, 0x66, 0x66, 0x3e, 1.81 + 0x66, 0x66, 0x3f, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3c, 0x00, 0x1f, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1f, 0x00, 1.82 + 0x7f, 1.83 + 0x46, 0x16, 0x1e, 0x16, 0x46, 0x7f, 0x00, 0x7f, 0x46, 0x16, 0x1e, 0x16, 0x06, 0x0f, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x73, 1.84 + 0x66, 1.85 + 0x7c, 0x00, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x33, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x78, 0x30, 1.86 + 0x30, 0x30, 0x33, 0x33, 0x1e, 0x00, 0x67, 0x66, 0x36, 0x1e, 0x36, 0x66, 0x67, 0x00, 0x0f, 0x06, 0x06, 0x06, 0x46, 0x66, 1.87 + 0x7f, 1.88 + 0x00, 0x63, 0x77, 0x7f, 0x7f, 0x6b, 0x63, 0x63, 0x00, 0x63, 0x67, 0x6f, 0x7b, 0x73, 0x63, 0x63, 0x00, 0x1c, 0x36, 0x63, 1.89 + 0x63, 1.90 + 0x63, 0x36, 0x1c, 0x00, 0x3f, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x0f, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x3b, 0x1e, 0x38, 0x00, 1.91 + 0x3f, 1.92 + 0x66, 0x66, 0x3e, 0x36, 0x66, 0x67, 0x00, 0x1e, 0x33, 0x07, 0x0e, 0x38, 0x33, 0x1e, 0x00, 0x3f, 0x2d, 0x0c, 0x0c, 0x0c, 1.93 + 0x0c, 1.94 + 0x1e, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3f, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x00, 0x63, 0x63, 1.95 + 0x63, 1.96 + 0x6b, 0x7f, 0x77, 0x63, 0x00, 0x63, 0x63, 0x36, 0x1c, 0x1c, 0x36, 0x63, 0x00, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x0c, 0x1e, 1.97 + 0x00, 1.98 + 0x7f, 0x63, 0x31, 0x18, 0x4c, 0x66, 0x7f, 0x00, 0x1e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1e, 0x00, 0x03, 0x06, 0x0c, 0x18, 1.99 + 0x30, 1.100 + 0x60, 0x40, 0x00, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1e, 0x00, 0x08, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 1.101 + 0x00, 1.102 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 1.103 + 0x0c, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x6e, 0x00, 0x07, 0x06, 0x06, 0x3e, 1.104 + 0x66, 0x66, 0x3b, 0x00, 0x00, 0x00, 0x1e, 0x33, 0x03, 0x33, 0x1e, 0x00, 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6e, 0x00, 1.105 + 0x00, 1.106 + 0x00, 0x1e, 0x33, 0x3f, 0x03, 0x1e, 0x00, 0x1c, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x6e, 0x33, 0x33, 1.107 + 0x3e, 1.108 + 0x30, 0x1f, 0x07, 0x06, 0x36, 0x6e, 0x66, 0x66, 0x67, 0x00, 0x0c, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x30, 0x00, 1.109 + 0x30, 0x30, 0x30, 0x33, 0x33, 0x1e, 0x07, 0x06, 0x66, 0x36, 0x1e, 0x36, 0x67, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 1.110 + 0x1e, 1.111 + 0x00, 0x00, 0x00, 0x33, 0x7f, 0x7f, 0x6b, 0x63, 0x00, 0x00, 0x00, 0x1f, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x1e, 1.112 + 0x33, 1.113 + 0x33, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x3b, 0x66, 0x66, 0x3e, 0x06, 0x0f, 0x00, 0x00, 0x6e, 0x33, 0x33, 0x3e, 0x30, 0x78, 1.114 + 0x00, 1.115 + 0x00, 0x3b, 0x6e, 0x66, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x3e, 0x03, 0x1e, 0x30, 0x1f, 0x00, 0x08, 0x0c, 0x3e, 0x0c, 0x0c, 1.116 + 0x2c, 1.117 + 0x18, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x00, 0x00, 0x00, 1.118 + 0x63, 1.119 + 0x6b, 0x7f, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x63, 0x36, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x3e, 0x30, 1.120 + 0x1f, 1.121 + 0x00, 0x00, 0x3f, 0x19, 0x0c, 0x26, 0x3f, 0x00, 0x38, 0x0c, 0x0c, 0x07, 0x0c, 0x0c, 0x38, 0x00, 0x18, 0x18, 0x18, 0x00, 1.122 + 0x18, 1.123 + 0x18, 0x18, 0x00, 0x07, 0x0c, 0x0c, 0x38, 0x0c, 0x0c, 0x07, 0x00, 0x6e, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.124 + 0x08, 1.125 + 0x1c, 0x36, 0x63, 0x63, 0x7f, 0x00, 1.126 + 0x1e, 0x33, 0x03, 0x33, 0x1e, 0x18, 0x30, 0x1e, 0x00, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x38, 0x00, 0x1e, 0x33, 1.127 + 0x3f, 0x03, 0x1e, 0x00, 0x7e, 0xc3, 0x3c, 0x60, 0x7c, 0x66, 0xfc, 0x00, 0x33, 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x7e, 0x00, 1.128 + 0x07, 1.129 + 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x7e, 0x00, 0x0c, 0x0c, 0x1e, 0x30, 0x3e, 0x33, 0x7e, 0x00, 0x00, 0x00, 0x1e, 0x03, 0x03, 1.130 + 0x1e, 1.131 + 0x30, 0x1c, 0x7e, 0xc3, 0x3c, 0x66, 0x7e, 0x06, 0x3c, 0x00, 0x33, 0x00, 0x1e, 0x33, 0x3f, 0x03, 0x1e, 0x00, 0x07, 0x00, 1.132 + 0x1e, 0x33, 0x3f, 0x03, 0x1e, 0x00, 0x33, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x3e, 0x63, 0x1c, 0x18, 0x18, 0x18, 1.133 + 0x3c, 1.134 + 0x00, 0x07, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x63, 0x1c, 0x36, 0x63, 0x7f, 0x63, 0x63, 0x00, 0x0c, 0x0c, 0x00, 1.135 + 0x1e, 1.136 + 0x33, 0x3f, 0x33, 0x00, 0x38, 0x00, 0x3f, 0x06, 0x1e, 0x06, 0x3f, 0x00, 0x00, 0x00, 0xfe, 0x30, 0xfe, 0x33, 0xfe, 0x00, 1.137 + 0x7c, 1.138 + 0x36, 0x33, 0x7f, 0x33, 0x33, 0x73, 0x00, 0x1e, 0x33, 0x00, 0x1e, 0x33, 0x33, 0x1e, 0x00, 0x00, 0x33, 0x00, 0x1e, 0x33, 1.139 + 0x33, 1.140 + 0x1e, 0x00, 0x00, 0x07, 0x00, 0x1e, 0x33, 0x33, 0x1e, 0x00, 0x1e, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x07, 1.141 + 0x00, 1.142 + 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x33, 0x00, 0x33, 0x33, 0x3e, 0x30, 0x1f, 0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 1.143 + 0x00, 1.144 + 0x33, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1e, 0x00, 0x18, 0x18, 0x7e, 0x03, 0x03, 0x7e, 0x18, 0x18, 0x1c, 0x36, 0x26, 0x0f, 1.145 + 0x06, 1.146 + 0x67, 0x3f, 0x00, 0x33, 0x33, 0x1e, 0x3f, 0x0c, 0x3f, 0x0c, 0x0c, 0x1f, 0x33, 0x33, 0x5f, 0x63, 0xf3, 0x63, 0xe3, 0x70, 1.147 + 0xd8, 1.148 + 0x18, 0x3c, 0x18, 0x18, 0x1b, 0x0e, 1.149 + 0x38, 0x00, 0x1e, 0x30, 0x3e, 0x33, 0x7e, 0x00, 0x1c, 0x00, 0x0e, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x38, 0x00, 0x1e, 1.150 + 0x33, 0x33, 0x1e, 0x00, 0x00, 0x38, 0x00, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x33, 0x33, 0x33, 0x00, 1.151 + 0x3f, 1.152 + 0x00, 0x33, 0x37, 0x3f, 0x3b, 0x33, 0x00, 0x3c, 0x36, 0x36, 0x7c, 0x00, 0x7e, 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x00, 1.153 + 0x3e, 1.154 + 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x06, 0x03, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 1.155 + 0x00, 0x3f, 0x30, 0x30, 0x00, 0x00, 0xc3, 0x63, 0x33, 0x7b, 0xcc, 0x66, 0x33, 0xf0, 0xc3, 0x63, 0x33, 0xdb, 0xec, 0xf6, 1.156 + 0xf3, 1.157 + 0xc0, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x33, 0x66, 1.158 + 0xcc, 1.159 + 0x66, 0x33, 0x00, 0x00, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 1.160 + 0xdb, 1.161 + 0xee, 0xdb, 0x77, 0xdb, 0xee, 0xdb, 0x77, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 1.162 + 0x18, 1.163 + 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x6c, 0x6c, 0x6c, 0x6c, 0x6f, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 1.164 + 0x00, 1.165 + 0x00, 0x7f, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x6c, 0x6c, 0x6f, 0x60, 0x6f, 0x6c, 0x6c, 1.166 + 0x6c, 1.167 + 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x7f, 0x60, 0x6f, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6f, 0x60, 1.168 + 0x7f, 1.169 + 0x00, 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x7f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 1.170 + 0x00, 1.171 + 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 1.172 + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.173 + 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 1.174 + 0x18, 1.175 + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x6c, 0x6c, 0x6c, 0x6c, 0xec, 1.176 + 0x6c, 1.177 + 0x6c, 0x6c, 0x6c, 0x6c, 0xec, 0x0c, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0c, 0xec, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 1.178 + 0xef, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xec, 0x0c, 0xec, 0x6c, 1.179 + 0x6c, 1.180 + 0x6c, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xef, 0x00, 0xef, 0x6c, 0x6c, 0x6c, 0x18, 0x18, 0xff, 1.181 + 0x00, 1.182 + 0xff, 0x00, 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 1.183 + 0x00, 1.184 + 0x00, 0x00, 0x00, 0xff, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfc, 0x00, 0x00, 0x00, 0x18, 0x18, 0xf8, 0x18, 0xf8, 1.185 + 0x00, 1.186 + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 1.187 + 0x6c, 1.188 + 0x6c, 0xff, 0x6c, 0x6c, 0x6c, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 1.189 + 0x00, 1.190 + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 1.191 + 0xff, 1.192 + 0xff, 0xff, 0xff, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 1.193 + 0xff, 1.194 + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 1.195 + 0x00, 0x00, 0x6e, 0x3b, 0x13, 0x3b, 0x6e, 0x00, 0x00, 0x1e, 0x33, 0x1f, 0x33, 0x1f, 0x03, 0x03, 0x00, 0x3f, 0x33, 0x03, 1.196 + 0x03, 0x03, 0x03, 0x00, 0x00, 0x7f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x3f, 0x33, 0x06, 0x0c, 0x06, 0x33, 0x3f, 0x00, 1.197 + 0x00, 1.198 + 0x00, 0x7e, 0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x03, 0x00, 0x6e, 0x3b, 0x18, 0x18, 1.199 + 0x18, 1.200 + 0x18, 0x00, 0x3f, 0x0c, 0x1e, 0x33, 0x33, 0x1e, 0x0c, 0x3f, 0x1c, 0x36, 0x63, 0x7f, 0x63, 0x36, 0x1c, 0x00, 0x1c, 0x36, 1.201 + 0x63, 0x63, 0x36, 0x36, 0x77, 0x00, 0x38, 0x0c, 0x18, 0x3e, 0x33, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, 1.202 + 0x00, 1.203 + 0x00, 0x60, 0x30, 0x7e, 0xdb, 0xdb, 0x7e, 0x06, 0x03, 0x1c, 0x06, 0x03, 0x1f, 0x03, 0x06, 0x1c, 0x00, 0x1e, 0x33, 0x33, 1.204 + 0x33, 1.205 + 0x33, 0x33, 0x33, 0x00, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x00, 0x3f, 0x00, 1.206 + 0x06, 1.207 + 0x0c, 0x18, 0x0c, 0x06, 0x00, 0x3f, 0x00, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x00, 0x3f, 0x00, 0x70, 0xd8, 0xd8, 0x18, 0x18, 1.208 + 0x18, 1.209 + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x1b, 0x0e, 0x0c, 0x0c, 0x00, 0x3f, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x6e, 1.210 + 0x3b, 1.211 + 0x00, 0x6e, 0x3b, 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 1.212 + 0x00, 1.213 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xf0, 0x30, 0x30, 0x30, 0x37, 0x36, 0x3c, 0x38, 0x1e, 0x36, 0x36, 0x36, 1.214 + 0x36, 1.215 + 0x00, 0x00, 0x00, 0x0e, 0x18, 0x0c, 0x06, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, 1.216 + 0x00, 1.217 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 1.218 +}; 1.219 + 1.220 +static void calcColors(const int colorNum, int & lo, int & hi, int & out) 1.221 +{ 1.222 + int redLo, redHi, greenLo, greenHi, blueLo, blueHi; 1.223 + 1.224 + if (colorNum == 0 || colorNum == 1 || colorNum == 2 || colorNum == 6) // white, red, yellow, or magenta 1.225 + redLo = (0xf) << systemRedShift, redHi = (0x1f) << systemRedShift; 1.226 + else 1.227 + redLo = redHi = 0; 1.228 + 1.229 + if (colorNum == 0 || colorNum == 2 || colorNum == 3 || colorNum == 4) // white, yellow, green, or cyan 1.230 + greenLo = (0xf) << systemGreenShift, greenHi = (0x1f) << systemGreenShift; 1.231 + else 1.232 + greenLo = greenHi = 0; 1.233 + 1.234 + if (colorNum == 0 || colorNum == 4 || colorNum == 5 || colorNum == 6) // white, cyan, blue, or magenta 1.235 + blueLo = (0xf) << systemBlueShift, blueHi = (0x1f) << systemBlueShift; 1.236 + else 1.237 + blueLo = blueHi = 0; 1.238 + 1.239 + lo = redLo + greenLo + blueLo; 1.240 + hi = redHi + greenHi + blueHi; 1.241 + 1.242 + if (colorNum == 7) // black 1.243 + out = 0xffffffff; // white border 1.244 + else 1.245 + out = 0; // black border 1.246 +} 1.247 + 1.248 +int lastColID = 0; 1.249 +static void progressColorList(const char *& colorList, int & lo, int & hi, int & out) 1.250 +{ 1.251 + if (*colorList) 1.252 + { 1.253 + if (*colorList != lastColID) 1.254 + { 1.255 + calcColors((int)(*colorList)-1, lo, hi, out); 1.256 + lastColID = *colorList; 1.257 + } 1.258 + colorList++; 1.259 + } 1.260 + else 1.261 + { 1.262 + colorList = NULL; 1.263 + } 1.264 +} 1.265 + 1.266 +static void drawTextInternal(u8 *screen, int pitch, int x, int y, 1.267 + const char *string, bool trans, const char *colorList = NULL) 1.268 +{ 1.269 + if (colorList && !*colorList) 1.270 + colorList = NULL; 1.271 + 1.272 + int loCol, hiCol, outCol; 1.273 + calcColors(textColor, loCol, hiCol, outCol); 1.274 + 1.275 + lastColID = 0; 1.276 + 1.277 + const static int xd [8] = {-1, 0, 1, 1, 1, 0, -1, -1}; 1.278 + const static int yd [8] = {-1, -1, -1, 0, 1, 1, 1, 0}; 1.279 + 1.280 + screen += y*pitch; 1.281 + int inc = 2; 1.282 + switch (systemColorDepth) 1.283 + { 1.284 + case 24: 1.285 + inc = 3; 1.286 + break; 1.287 + case 32: 1.288 + inc = 4; 1.289 + break; 1.290 + } 1.291 + screen += x*inc; 1.292 + 1.293 + int xpos = x; 1.294 + switch (systemColorDepth) 1.295 + { 1.296 + case 16: 1.297 + { 1.298 + while (*string) 1.299 + { 1.300 + char c = *string++; 1.301 + u8 * scr = screen; 1.302 + 1.303 + if (colorList) 1.304 + progressColorList(colorList, loCol, hiCol, outCol); 1.305 + 1.306 + u16 mask = u16(~RGB_LOW_BITS_MASK); 1.307 + u16 *s = (u16 *)scr; 1.308 + for (int h = 0-1; h < 8+1; h++) 1.309 + { 1.310 + for (int w = 0-1; w < 8+1; w++, s++) 1.311 + { 1.312 + int on = (h < 0 || w < 0 || h >= 8 || w >= 8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; 1.313 + 1.314 + int border = 0; 1.315 + if (outlinedText) 1.316 + for (int i = 0; i < 8; i++) 1.317 + { 1.318 + int h2 = h+yd[i], w2 = w+xd[i]; 1.319 + border = (h2 < 0 || w2 < 0 || h2 >= 8 || w2 >= 8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; 1.320 + if (border) 1.321 + break; 1.322 + } 1.323 + 1.324 + if (trans) 1.325 + { 1.326 + if (on) 1.327 + *s = loCol + 1.328 + ((*s & mask) >>1); 1.329 + else if (border) 1.330 + { 1.331 + *s = outCol + 1.332 + ((*s & mask) >>1); 1.333 + } 1.334 + } 1.335 + else 1.336 + { 1.337 + if (on) 1.338 + *s = hiCol; 1.339 + else if (border) 1.340 + *s = outCol; 1.341 + } 1.342 + } 1.343 + scr += pitch; 1.344 + s = (u16 *)scr; 1.345 + } 1.346 + screen += inc*8; 1.347 + 1.348 + xpos += 8; 1.349 + if (xpos+8 > pitch>>1) // cut off text at right boundary 1.350 + break; 1.351 + } 1.352 + break; 1.353 + } 1.354 + case 24: // TODO: verify this code's correctness 1.355 + { 1.356 + while (*string) 1.357 + { 1.358 + char c = *string++; 1.359 + u8 * scr = screen; 1.360 + 1.361 + if (colorList) 1.362 + progressColorList(colorList, loCol, hiCol, outCol); 1.363 + 1.364 + int h, w; 1.365 + u8 *s = (u8 *)scr; 1.366 + for (h = 0-1; h < 8+1; h++) 1.367 + { 1.368 + for (w = 0-1; w < 8+1; w++, s++) 1.369 + { 1.370 + int on = (h < 0 || w < 0 || h >= 8 || w >= 8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; 1.371 + 1.372 + int border = 0; 1.373 + if (outlinedText) 1.374 + for (int i = 0; i < 8; i++) 1.375 + { 1.376 + int h2 = h+yd[i], w2 = w+xd[i]; 1.377 + border = (h2 < 0 || w2 < 0 || h2 >= 8 || w2 >= 8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; 1.378 + if (border) 1.379 + break; 1.380 + } 1.381 + 1.382 + if (trans) 1.383 + { 1.384 + if (on) 1.385 + { 1.386 + u32 color = hiCol; 1.387 + *s = ((color & 255)>>1)+(*s>>1); 1.388 + *(s+1) = (((color >> 8) & 255)>>1)+(*(s+1)>>1); 1.389 + *(s+2) = (((color >> 16) & 255)>>1)+(*(s+2)>>1); 1.390 + } 1.391 + else if (border) 1.392 + { 1.393 + u32 color = outCol; 1.394 + *s = ((color & 255)>>1)+(*s>>1); 1.395 + *(s+1) = (((color >> 8) & 255)>>1)+(*(s+1)>>1); 1.396 + *(s+2) = (((color >> 16) & 255)>>1)+(*(s+2)>>1); 1.397 + } 1.398 + } 1.399 + else 1.400 + { 1.401 + if (on) 1.402 + { 1.403 + u32 color = hiCol; 1.404 + *s = (color & 255); 1.405 + *(s+1) = (color >> 8) & 255; 1.406 + *(s+2) = (color >> 16) & 255; 1.407 + } 1.408 + else if (border) 1.409 + { 1.410 + u32 color = outCol; 1.411 + *s = (color & 255); 1.412 + *(s+1) = (color >> 8) & 255; 1.413 + *(s+2) = (color >> 16) & 255; 1.414 + } 1.415 + } 1.416 + } 1.417 + scr += pitch; 1.418 + s = (u8 *)scr; 1.419 + } 1.420 + screen += inc*8; 1.421 + 1.422 + xpos += 8; 1.423 + if (xpos+8 > pitch/3) // cut off text at right boundary 1.424 + break; 1.425 + } 1.426 + break; 1.427 + } 1.428 + case 32: 1.429 + { 1.430 + while (*string) 1.431 + { 1.432 + char c = *string++; 1.433 + u8 * scr = screen; 1.434 + 1.435 + if (colorList) 1.436 + progressColorList(colorList, loCol, hiCol, outCol); 1.437 + 1.438 + int h, w; 1.439 + u32 mask = 0xfefefe; 1.440 + u32 *s = (u32 *)scr; 1.441 + for (h = 0-1; h < 8+1; h++) 1.442 + { 1.443 + for (w = 0-1; w < 8+1; w++, s++) 1.444 + { 1.445 + int on = (h < 0 || w < 0 || h >= 8 || w >= 8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; 1.446 + 1.447 + int border = 0; 1.448 + if (outlinedText) 1.449 + for (int i = 0; i < 8; i++) 1.450 + { 1.451 + int h2 = h+yd[i], w2 = w+xd[i]; 1.452 + border = (h2 < 0 || w2 < 0 || h2 >= 8 || w2 >= 8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; 1.453 + if (border) 1.454 + break; 1.455 + } 1.456 + 1.457 + if (trans) 1.458 + { 1.459 + if (on) 1.460 + *s = loCol + 1.461 + ((*s & mask)>>1); 1.462 + else if (border) 1.463 + { 1.464 + *s = outCol + 1.465 + ((*s & mask)>>1); 1.466 + } 1.467 + } 1.468 + else 1.469 + { 1.470 + if (on) 1.471 + *s = hiCol; 1.472 + else if (border) 1.473 + *s = outCol; 1.474 + } 1.475 + } 1.476 + scr += pitch; 1.477 + s = (u32 *)scr; 1.478 + } 1.479 + screen += inc*8; 1.480 + 1.481 + xpos += 8; 1.482 + if (xpos+8 > pitch>>2) // cut off text at right boundary 1.483 + break; 1.484 + } 1.485 + break; 1.486 + } 1.487 + } 1.488 +} 1.489 + 1.490 +void drawText(u8 *screen, int pitch, int x, int y, const char *string, const char *colorList) 1.491 +{ 1.492 + drawTextInternal(screen, pitch, x, y, string, transparentText, colorList); 1.493 +} 1.494 + 1.495 +void drawTextTransp(u8 *screen, int pitch, int x, int y, const char *string, const char *colorList) 1.496 +{ 1.497 + drawTextInternal(screen, pitch, x, y, string, true, colorList); 1.498 +} 1.499 +