~ubuntu-branches/ubuntu/lucid/fceux/lucid

« back to all changes in this revision

Viewing changes to fceu/src/drawing.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2009-12-14 08:05:17 UTC
  • Revision ID: james.westby@ubuntu.com-20091214080517-abi5tj8avthfan7c
Tags: upstream-2.1.2+repack
ImportĀ upstreamĀ versionĀ 2.1.2+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "types.h"
 
2
#include "fceu.h"
 
3
#include "drawing.h"
 
4
#include "video.h"
 
5
#include "movie.h"
 
6
#include "driver.h"
 
7
 
 
8
static uint8 Font6x7[792] =
 
9
{
 
10
        6,  0,  0,  0,  0,  0,  0,  0,
 
11
        3, 64, 64, 64, 64, 64,  0, 64,
 
12
        5, 80, 80, 80,  0,  0,  0,  0,
 
13
        6, 80, 80,248, 80,248, 80, 80,
 
14
        6, 32,120,160,112, 40,240, 32,
 
15
        6, 64,168, 80, 32, 80,168, 16,
 
16
        6, 96,144,160, 64,168,144,104,
 
17
        3, 64, 64,  0,  0,  0,  0,  0,
 
18
        4, 32, 64, 64, 64, 64, 64, 32,
 
19
        4, 64, 32, 32, 32, 32, 32, 64,
 
20
        6,  0, 80, 32,248, 32, 80,  0,
 
21
        6,  0, 32, 32,248, 32, 32,  0,
 
22
        3,  0,  0,  0,  0,  0, 64,128,
 
23
        5,  0,  0,  0,240,  0,  0,  0,
 
24
        3,  0,  0,  0,  0,  0,  0, 64,
 
25
        5, 16, 16, 32, 32, 32, 64, 64,
 
26
        6,112,136,136,136,136,136,112, //0
 
27
        6, 32, 96, 32, 32, 32, 32, 32,
 
28
        6,112,136,  8, 48, 64,128,248,
 
29
        6,112,136,  8, 48,  8,136,112,
 
30
        6, 16, 48, 80,144,248, 16, 16,
 
31
        6,248,128,128,240,  8,  8,240,
 
32
        6, 48, 64,128,240,136,136,112,
 
33
        6,248,  8, 16, 16, 32, 32, 32,
 
34
        6,112,136,136,112,136,136,112,
 
35
        6,112,136,136,120,  8, 16, 96,
 
36
        3,  0,  0, 64,  0,  0, 64,  0,
 
37
        3,  0,  0, 64,  0,  0, 64,128,
 
38
        4,  0, 32, 64,128, 64, 32,  0,
 
39
        5,  0,  0,240,  0,240,  0,  0,
 
40
        4,  0,128, 64, 32, 64,128,  0,
 
41
        5,112,136,  8, 16, 32,  0, 32,
 
42
        6,112,136,136,184,176,128,112,
 
43
        6,112,136,136,248,136,136,136, //A
 
44
        6,240,136,136,240,136,136,240,
 
45
        6,112,136,128,128,128,136,112,
 
46
        6,224,144,136,136,136,144,224,
 
47
        6,248,128,128,240,128,128,248,
 
48
        6,248,128,128,240,128,128,128,
 
49
        6,112,136,128,184,136,136,120,
 
50
        6,136,136,136,248,136,136,136,
 
51
        4,224, 64, 64, 64, 64, 64,224,
 
52
        6,  8,  8,  8,  8,  8,136,112,
 
53
        6,136,144,160,192,160,144,136,
 
54
        6,128,128,128,128,128,128,248,
 
55
        6,136,216,168,168,136,136,136,
 
56
        6,136,136,200,168,152,136,136,
 
57
        7, 48, 72,132,132,132, 72, 48,
 
58
        6,240,136,136,240,128,128,128,
 
59
        6,112,136,136,136,168,144,104,
 
60
        6,240,136,136,240,144,136,136,
 
61
        6,112,136,128,112,  8,136,112,
 
62
        6,248, 32, 32, 32, 32, 32, 32,
 
63
        6,136,136,136,136,136,136,112,
 
64
        6,136,136,136, 80, 80, 32, 32,
 
65
        6,136,136,136,136,168,168, 80,
 
66
        6,136,136, 80, 32, 80,136,136,
 
67
        6,136,136, 80, 32, 32, 32, 32,
 
68
        6,248,  8, 16, 32, 64,128,248,
 
69
        3,192,128,128,128,128,128,192,
 
70
        5, 64, 64, 32, 32, 32, 16, 16,
 
71
        3,192, 64, 64, 64, 64, 64,192,
 
72
        4, 64,160,  0,  0,  0,  0,  0,
 
73
        6,  0,  0,  0,  0,  0,  0,248,
 
74
        3,128, 64,  0,  0,  0,  0,  0,
 
75
        5,  0,  0, 96, 16,112,144,112, //a
 
76
        5,128,128,224,144,144,144,224,
 
77
        5,  0,  0,112,128,128,128,112,
 
78
        5, 16, 16,112,144,144,144,112,
 
79
        5,  0,  0, 96,144,240,128,112,
 
80
        5, 48, 64,224, 64, 64, 64, 64,
 
81
        5,  0,112,144,144,112, 16,224,
 
82
        5,128,128,224,144,144,144,144,
 
83
        2,128,  0,128,128,128,128,128,
 
84
        4, 32,  0, 32, 32, 32, 32,192,
 
85
        5,128,128,144,160,192,160,144,
 
86
        2,128,128,128,128,128,128,128,
 
87
        6,  0,  0,208,168,168,168,168,
 
88
        5,  0,  0,224,144,144,144,144,
 
89
        5,  0,  0, 96,144,144,144, 96,
 
90
        5,  0,  0,224,144,144,224,128,
 
91
        5,  0,  0,112,144,144,112, 16,
 
92
        5,  0,  0,176,192,128,128,128,
 
93
        5,  0,  0,112,128, 96, 16,224,
 
94
        4, 64, 64,224, 64, 64, 64, 32,
 
95
        5,  0,  0,144,144,144,144,112,
 
96
        5,  0,  0,144,144,144,160,192,
 
97
        6,  0,  0,136,136,168,168, 80,
 
98
        5,  0,  0,144,144, 96,144,144,
 
99
        5,  0,144,144,144,112, 16, 96,
 
100
        5,  0,  0,240, 32, 64,128,240,
 
101
        4, 32, 64, 64,128, 64, 64, 32,
 
102
        3, 64, 64, 64, 64, 64, 64, 64,
 
103
        4,128, 64, 64, 32, 64, 64,128,
 
104
        6,  0,104,176,  0,  0,  0,  0
 
105
};
 
106
 
 
107
void DrawTextLineBG(uint8 *dest)
 
108
{
 
109
        int x,y;
 
110
        static int otable[7]={81,49,30,17,8,3,0};
 
111
        //100,40,15,10,7,5,2};
 
112
        for(y=0;y<14;y++)
 
113
        {
 
114
                int offs;
 
115
 
 
116
                if(y>=7) offs=otable[13-y];
 
117
                else offs=otable[y];  
 
118
 
 
119
                for(x=offs;x<(256-offs);x++)
 
120
                {
 
121
                        // Choose the dimmest set of colours and then dim that
 
122
                        dest[y*256+x]=(dest[y*256+x]&0x0F)|0xC0;
 
123
                }
 
124
        }
 
125
}
 
126
 
 
127
 
 
128
void DrawMessage(bool beforeMovie)
 
129
{
 
130
        if(guiMessage.howlong)
 
131
        {
 
132
                //don't display movie messages if we're not before the movie
 
133
                if(beforeMovie && !guiMessage.isMovieMessage)
 
134
                        return;
 
135
 
 
136
                uint8 *t;
 
137
                guiMessage.howlong--;
 
138
                t=XBuf+FCEU_TextScanlineOffsetFromBottom(20)+1;
 
139
 
 
140
                /*
 
141
                FCEU palette:
 
142
                $00: [8] unvpalette found in palettes/palettes.h
 
143
                black, white, black, greyish, redish, bright green, bluish
 
144
                $80:
 
145
                nes palette
 
146
                $C0:
 
147
                dim version of nes palette
 
148
 
 
149
                */
 
150
 
 
151
                if(t>=XBuf)
 
152
                {
 
153
                        int color = 0x20;
 
154
                        if(guiMessage.howlong <= 40) color = 0x3C;
 
155
                        if(guiMessage.howlong <= 32) color = 0x31;
 
156
                        if(guiMessage.howlong <= 24) color = 0x21;
 
157
                        if(guiMessage.howlong <= 16) color = 0x51;
 
158
                        if(guiMessage.howlong <=  8) color = 0x41;
 
159
                        DrawTextTrans(ClipSidesOffset+t, 256, (uint8 *)guiMessage.errmsg, color+0x80);
 
160
                }
 
161
        }
 
162
 
 
163
        if(subtitleMessage.howlong)
 
164
        {
 
165
                //don't display movie messages if we're not before the movie
 
166
                if(beforeMovie && !subtitleMessage.isMovieMessage)
 
167
                        return;
 
168
                
 
169
                uint8 *tt;
 
170
                subtitleMessage.howlong--;
 
171
                tt=XBuf+FCEU_TextScanlineOffsetFromBottom(216);
 
172
 
 
173
                if(tt>=XBuf)
 
174
                {
 
175
                        int color = 0x20;
 
176
                        if(subtitleMessage.howlong == 39) color = 0x38;
 
177
                        if(subtitleMessage.howlong <= 30) color = 0x2C;
 
178
                        if(subtitleMessage.howlong <= 20) color = 0x1C;
 
179
                        if(subtitleMessage.howlong <= 10) color = 0x11;
 
180
                        if(subtitleMessage.howlong <= 5) color = 0x1;
 
181
                        DrawTextTrans(ClipSidesOffset+tt, 256, (uint8 *)subtitleMessage.errmsg, color+0x80);
 
182
                }
 
183
        }
 
184
}
 
185
 
 
186
 
 
187
 
 
188
 
 
189
static uint8 sstat[2541] =
 
190
{
 
191
        0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
 
192
        0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
 
193
        0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x83,
 
194
        0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x80,0x83,
 
195
        0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,
 
196
        0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,
 
197
        0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
 
198
        0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
 
199
        0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x81,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
 
200
        0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
 
201
        0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,
 
202
        0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,
 
203
        0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
 
204
        0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
 
205
        0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
 
206
};
 
207
 
 
208
 
 
209
 
 
210
 
 
211
 
 
212
static uint8 play_slines[]=
 
213
{
 
214
        0, 0, 1,
 
215
        1, 0, 2,
 
216
        2, 0, 3,
 
217
        3, 0, 4,
 
218
        4, 0, 5,
 
219
        5, 0, 6,
 
220
        6, 0, 7,
 
221
        7, 0, 8,
 
222
        8, 0, 7,
 
223
        9, 0, 6,
 
224
        10, 0, 5,
 
225
        11, 0, 4,
 
226
        12, 0, 3,
 
227
        13, 0, 2,
 
228
        14, 0, 1,
 
229
        99,
 
230
};
 
231
 
 
232
static uint8 record_slines[]=
 
233
{
 
234
        0, 5, 9,
 
235
        1, 3, 11,
 
236
        2, 2, 12,
 
237
        3, 1, 13,
 
238
        4, 1, 13,
 
239
        5, 0, 14,
 
240
        6, 0, 14,
 
241
        7, 0, 14,
 
242
        8, 0, 14,
 
243
        9, 0, 14,
 
244
        10, 1, 13,
 
245
        11, 1, 13,
 
246
        12, 2, 12,
 
247
        13, 3, 11,
 
248
        14, 5, 9,
 
249
        99,
 
250
};
 
251
 
 
252
static uint8 pause_slines[]=
 
253
{
 
254
        0, 2, 6,
 
255
        1, 2, 6,
 
256
        2, 2, 6,
 
257
        3, 2, 6,
 
258
        4, 2, 6,
 
259
        5, 2, 6,
 
260
        6, 2, 6,
 
261
        7, 2, 6,
 
262
        8, 2, 6,
 
263
        9, 2, 6,
 
264
        10, 2, 6,
 
265
        11, 2, 6,
 
266
        12, 2, 6,
 
267
        13, 2, 6,
 
268
        14, 2, 6,
 
269
 
 
270
        0, 9, 13,
 
271
        1, 9, 13,
 
272
        2, 9, 13,
 
273
        3, 9, 13,
 
274
        4, 9, 13,
 
275
        5, 9, 13,
 
276
        6, 9, 13,
 
277
        7, 9, 13,
 
278
        8, 9, 13,
 
279
        9, 9, 13,
 
280
        10, 9, 13,
 
281
        11, 9, 13,
 
282
        12, 9, 13,
 
283
        13, 9, 13,
 
284
        14, 9, 13,
 
285
        99,
 
286
};
 
287
 
 
288
static uint8 no_slines[]=
 
289
{
 
290
        99
 
291
};
 
292
 
 
293
static uint8* sline_icons[4]=
 
294
{
 
295
        no_slines,
 
296
        play_slines,
 
297
        record_slines,
 
298
        pause_slines
 
299
};
 
300
 
 
301
static void drawstatus(uint8* XBuf, int n, int y, int xofs)
 
302
{
 
303
        uint8* slines=sline_icons[n];
 
304
        int i;
 
305
 
 
306
        
 
307
        XBuf += FCEU_TextScanlineOffsetFromBottom(y) + 240 + 255 + xofs;
 
308
        for(i=0; slines[i]!=99; i+=3)
 
309
        {
 
310
                int y=slines[i];
 
311
                uint8* dest=XBuf+(y*256);
 
312
                int x;
 
313
                for(x=slines[i+1]; x!=slines[i+2]; ++x)
 
314
                        dest[x]=0;
 
315
        }
 
316
 
 
317
        XBuf -= 255;
 
318
        for(i=0; slines[i]!=99; i+=3)
 
319
        {
 
320
                int y=slines[i];
 
321
                uint8* dest=XBuf+(y*256);
 
322
                int x;
 
323
                for(x=slines[i+1]; x!=slines[i+2]; ++x)
 
324
                        dest[x]=4;
 
325
        }
 
326
}
 
327
 
 
328
/// this draws the recording icon (play/pause/record)
 
329
void FCEU_DrawRecordingStatus(uint8* XBuf)
 
330
{
 
331
        if(FCEUD_ShowStatusIcon())
 
332
        {
 
333
                bool hasPlayRecIcon = false;    
 
334
                if(FCEUMOV_Mode(MOVIEMODE_RECORD))
 
335
                {
 
336
                        drawstatus(XBuf-ClipSidesOffset,2,28,0);
 
337
                        hasPlayRecIcon = true;
 
338
                }
 
339
                else if(FCEUMOV_Mode(MOVIEMODE_PLAY))
 
340
                {
 
341
                        drawstatus(XBuf-ClipSidesOffset,1,28,0);
 
342
                        hasPlayRecIcon = true;
 
343
                }
 
344
 
 
345
                if(FCEUI_EmulationPaused())
 
346
                        drawstatus(XBuf-ClipSidesOffset,3,28,hasPlayRecIcon?-16:0);
 
347
        }
 
348
}
 
349
 
 
350
 
 
351
void FCEU_DrawNumberRow(uint8 *XBuf, int *nstatus, int cur)
 
352
{
 
353
        uint8 *XBaf;
 
354
        int z,x,y;
 
355
 
 
356
        XBaf=XBuf - 4 + (FSettings.LastSLine-34)*256;
 
357
        if(XBaf>=XBuf)
 
358
                for(z=1;z<11;z++)
 
359
                {
 
360
                        if(nstatus[z%10])
 
361
                        {
 
362
                                for(y=0;y<13;y++)
 
363
                                        for(x=0;x<21;x++)
 
364
                                                XBaf[y*256+x+z*21+z]=sstat[y*21+x+(z-1)*21*12]^0x80;
 
365
                        } else {
 
366
                                for(y=0;y<13;y++)
 
367
                                        for(x=0;x<21;x++)
 
368
                                                if(sstat[y*21+x+(z-1)*21*12]!=0x83)
 
369
                                                        XBaf[y*256+x+z*21+z]=sstat[y*21+x+(z-1)*21*12]^0x80;
 
370
 
 
371
                                                else
 
372
                                                        XBaf[y*256+x+z*21+z]=(XBaf[y*256+x+z*21+z]&0xF)|0xC0;
 
373
                        }
 
374
                        if(cur==z%10)
 
375
                        {
 
376
                                for(x=0;x<21;x++)
 
377
                                        XBaf[x+z*21+z*1]=4;
 
378
                                for(x=1;x<12;x++)
 
379
                                {
 
380
                                        XBaf[256*x+z*21+z*1]=
 
381
                                                XBaf[256*x+z*21+z*1+20]=4;
 
382
                                }
 
383
                                for(x=0;x<21;x++)
 
384
                                        XBaf[12*256+x+z*21+z*1]=4;
 
385
                        }
 
386
                }
 
387
}  
 
388
 
 
389
static int FixJoedChar(uint8 ch)
 
390
{
 
391
        int c = ch; c -= 32;
 
392
        return (c < 0 || c > 98) ? 0 : c;
 
393
}
 
394
static int JoedCharWidth(uint8 ch)
 
395
{
 
396
        return Font6x7[FixJoedChar(ch)*8];
 
397
}
 
398
 
 
399
void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, int max_w, int max_h, int border)
 
400
{
 
401
        unsigned beginx=2, x=beginx;
 
402
        unsigned y=2;
 
403
 
 
404
        char target[64][256] = {{0}};
 
405
 
 
406
        assert(width==256);
 
407
        if (max_w > 256) max_w = 256;
 
408
        if (max_h >  64) max_h =  64;
 
409
 
 
410
        for(; *textmsg; ++textmsg)
 
411
        {
 
412
                int ch, wid;
 
413
 
 
414
                if(*textmsg == '\n') { x=beginx; y+=8; continue; }
 
415
                ch  = FixJoedChar(*textmsg);
 
416
                wid = JoedCharWidth(*textmsg);
 
417
 
 
418
                for(int ny=0; ny<7; ++ny)
 
419
                {
 
420
                        uint8 d = Font6x7[ch*8 + 1+ny];
 
421
                        for(int nx=0; nx<wid; ++nx)
 
422
                        {
 
423
                                int c = (d >> (7-nx)) & 1;
 
424
                                if(c)
 
425
                                {
 
426
                                        if(y+ny >= 62) goto textoverflow;
 
427
                                        target[y+ny][x+nx] = 2;
 
428
                                }
 
429
                                else
 
430
                                        target[y+ny][x+nx] = 1;
 
431
                        }
 
432
                }
 
433
                x += wid;
 
434
                if(x >= width) { x=beginx; y+=8; }
 
435
        }
 
436
textoverflow:
 
437
        for(y=0; y<62; ++y)                     //Max border is 2, so the max safe y is 62 (since 64 is the max for the target array
 
438
                for(x=0; x<width; ++x)
 
439
                {
 
440
                        int offs = y*width+x;
 
441
                        int c = 0;
 
442
 
 
443
                        c += target[y][x] * 100;
 
444
 
 
445
                        if(border>=1){
 
446
                                x>=(     1) && (c += target[y][x-1]);
 
447
                                x<(width-1) && (c += target[y][x+1]);
 
448
                                y>=(     1) && (c += target[y-1][x]);
 
449
                                y<(16   -1) && (c += target[y+1][x]);
 
450
                        }
 
451
                        if(border>=2){
 
452
                                x>=(     1) && (c += target[y][x-1]*10);
 
453
                                x<(width-1) && (c += target[y][x+1]*10);
 
454
                                y>=(     1) && (c += target[y-1][x]*10);
 
455
                                y<(16   -1) && (c += target[y+1][x]*10);
 
456
 
 
457
                                x>=(     1) && y>=(  1) && (c += target[y-1][x-1]);
 
458
                                x<(width-1) && y>=(  1) && (c += target[y-1][x+1]);
 
459
                                x>=(     1) && y<(16-1) && (c += target[y+1][x-1]);
 
460
                                x<(width-1) && y<(16-1) && (c += target[y+1][x+1]);
 
461
 
 
462
                                x>=(     2) && (c += target[y][x-2]);
 
463
                                x<(width-2) && (c += target[y][x+2]);
 
464
                                y>=(     2) && (c += target[y-2][x]);
 
465
                                y<(16   -2) && (c += target[y+2][x]);
 
466
                        }
 
467
 
 
468
                        if(c >= 200)
 
469
                                dest[offs] = fgcolor;
 
470
                        else if(c >= 10)
 
471
                        {
 
472
                                if(dest[offs] < 0xA0)
 
473
                                        dest[offs] = 0xC1;
 
474
                                else
 
475
                                        dest[offs] = 0xD1;
 
476
                        }
 
477
                        else if(c > 0)
 
478
                        {
 
479
                                dest[offs] = 0xCF;
 
480
                        }
 
481
                }
 
482
}
 
483
 
 
484
void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor)
 
485
{
 
486
        DrawTextTransWH(dest, width, textmsg, fgcolor, 256, 16, 2);
 
487
}