1 /* FCE Ultra - NES/Famicom Emulator
2 *
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Xodnizel
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <string.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <stdarg.h>
25
26 #include "fceu-types.h"
27 #include "video.h"
28 #include "fceu.h"
29 #include "general.h"
30 #include "fceu-memory.h"
31 #include "crc32.h"
32 #include "state.h"
33 #include "palette.h"
34 #include "nsf.h"
35 #include "input.h"
36 #include "vsuni.h"
37
38 uint8 *XBuf = NULL;
39 uint8 *XDBuf = NULL;
40 int show_crosshair = 0;
41
FCEU_KillVirtualVideo(void)42 void FCEU_KillVirtualVideo(void)
43 {
44 if (XBuf)
45 free(XBuf);
46 XBuf = 0;
47 if (XDBuf)
48 free(XDBuf);
49 XDBuf = 0;
50 }
51
FCEU_InitVirtualVideo(void)52 int FCEU_InitVirtualVideo(void)
53 {
54 /* 256 bytes per scanline, * 240 scanline maximum, +8 for alignment, */
55 if (!XBuf)
56 XBuf = (uint8*)(FCEU_malloc(256 * (256 + extrascanlines + 8)));
57 if (!XDBuf)
58 XDBuf = (uint8*)(FCEU_malloc(256 * (256 + extrascanlines + 8)));
59
60 if (!XBuf || !XDBuf)
61 return 0;
62
63 memset(XBuf, 128, 256 * (256 + extrascanlines + 8));
64 memset(XDBuf, 128, 256 * (256 + extrascanlines + 8));
65 return 1;
66 }
67
68 static int howlong;
69 static char errmsg[65];
70
71 #include "drawing.h"
72
FCEUI_SaveSnapshot(void)73 void FCEUI_SaveSnapshot(void) { }
74
FCEU_PutImage(void)75 void FCEU_PutImage(void)
76 {
77 if (GameInfo->type == GIT_NSF)
78 DrawNSF(XBuf);
79 else
80 {
81 if (GameInfo->type == GIT_VSUNI)
82 FCEU_VSUniDraw(XBuf);
83 }
84 if (howlong) howlong--;
85 if (show_crosshair)
86 FCEU_DrawInput(XBuf);
87 }
88
FCEU_PutImageDummy(void)89 void FCEU_PutImageDummy(void)
90 {
91 }
92
FCEU_DispMessage(char * format,...)93 void FCEU_DispMessage(char *format, ...)
94 {
95 va_list ap;
96
97 va_start(ap, format);
98 vsprintf(errmsg, format, ap);
99 va_end(ap);
100
101 howlong = 180;
102 FCEUD_DispMessage(errmsg);
103 }
104
FCEU_ResetMessages(void)105 void FCEU_ResetMessages(void)
106 {
107 howlong = 180;
108 }
109
SaveSnapshot(void)110 int SaveSnapshot(void)
111 {
112 return(0);
113 }
114