fix gun handling in enhancement mode
[pcsx_rearmed.git] / plugins / dfxvideo / draw_pl.c
... / ...
CommitLineData
1/*
2 * (C) notaz, 2010-2011
3 *
4 * This work is licensed under the terms of the GNU GPLv2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7
8#define _IN_DRAW
9
10#include "gpu.h"
11
12#include "../gpulib/cspace.h"
13#include "../../frontend/plugin_lib.h"
14#include "../../frontend/pcnt.h"
15
16// misc globals
17long lLowerpart;
18BOOL bCheckMask = FALSE;
19unsigned short sSetMask;
20unsigned long lSetMask;
21
22static void blit(void)
23{
24 int px = PSXDisplay.DisplayPosition.x & ~1; // XXX: align needed by bgr*_to_...
25 int py = PSXDisplay.DisplayPosition.y;
26 int w = PreviousPSXDisplay.Range.x1;
27 int h = PreviousPSXDisplay.DisplayMode.y;
28 unsigned short *srcs = psxVuw + py * 1024 + px;
29
30 if (w <= 0)
31 return;
32
33 // account for centering
34 h -= PreviousPSXDisplay.Range.y0;
35
36 rcbs->pl_vout_flip(srcs, 1024, PSXDisplay.RGB24, w, h);
37}
38
39void DoBufferSwap(void)
40{
41 static int fbw, fbh, fb24bpp;
42
43 if (PreviousPSXDisplay.DisplayMode.x == 0 || PreviousPSXDisplay.DisplayMode.y == 0)
44 return;
45
46 /* careful if rearranging this code, we try to set mode and flip
47 * to get the hardware apply both changes at the same time */
48 if (PreviousPSXDisplay.DisplayMode.x != fbw || PreviousPSXDisplay.DisplayMode.y != fbh
49 || PSXDisplay.RGB24 != fb24bpp) {
50 fbw = PreviousPSXDisplay.DisplayMode.x;
51 fbh = PreviousPSXDisplay.DisplayMode.y;
52 fb24bpp = PSXDisplay.RGB24;
53 rcbs->pl_vout_set_mode(fbw, fbh, fbw, fbh, fb24bpp ? 24 : 16);
54 }
55
56 pcnt_start(PCNT_BLIT);
57 blit();
58 pcnt_end(PCNT_BLIT);
59}
60
61void DoClearScreenBuffer(void)
62{
63}
64
65unsigned long ulInitDisplay(void)
66{
67 if (rcbs->pl_vout_open() != 0)
68 return 0;
69
70 return 1; /* ok */
71}
72
73void CloseDisplay(void)
74{
75 rcbs->pl_vout_close();
76}