4 * This work is licensed under the terms of the GNU GPLv2 or later.
5 * See the COPYING file in the top-level directory.
10 #include "externals.h"
18 #include "plugin_lib.h"
24 BOOL bIsFirstFrame = TRUE;
25 BOOL bCheckMask = FALSE;
26 unsigned short sSetMask = 0;
27 unsigned long lSetMask = 0;
31 int iMaintainAspect = 0;
32 int iUseNoStretchBlt = 0;
35 PSXPoint_t ptCursorPoint[8];
36 unsigned short usCursorActive = 0;
40 #define bgr555_to_rgb565 memcpy
41 #define bgr888_to_rgb888 memcpy
44 static void blit(void)
46 extern void bgr555_to_rgb565(void *dst, void *src, int bytes);
47 extern void bgr888_to_rgb888(void *dst, void *src, int bytes);
48 int x = PSXDisplay.DisplayPosition.x;
49 int y = PSXDisplay.DisplayPosition.y;
50 int w = PreviousPSXDisplay.Range.x1;
51 int h = PreviousPSXDisplay.DisplayMode.y;
52 int pitch = PreviousPSXDisplay.DisplayMode.x;
53 unsigned short *srcs = psxVuw + y * 1024 + x;
54 unsigned char *dest = pl_fbdev_buf;
59 // TODO: clear border if centering
61 pitch *= PSXDisplay.RGB24 ? 3 : 2;
63 // account for centering
64 h -= PreviousPSXDisplay.Range.y0;
65 dest += PreviousPSXDisplay.Range.y0 / 2 * pitch;
66 dest += PreviousPSXDisplay.Range.x0 * 2; // XXX
70 for (; h-- > 0; dest += pitch, srcs += 1024)
72 bgr888_to_rgb888(dest, srcs, w * 3);
77 for (; h-- > 0; dest += pitch, srcs += 1024)
79 bgr555_to_rgb565(dest, srcs, w * 2);
84 static int fbw, fbh, fb24bpp;
88 void DoBufferSwap(void)
90 static int fps_counter;
91 if (PSXDisplay.DisplayMode.x == 0 || PSXDisplay.DisplayMode.y == 0)
94 if (PSXDisplay.DisplayMode.x != fbw || PSXDisplay.DisplayMode.y != fbh
95 || PSXDisplay.RGB24 != fb24bpp) {
96 fbw = PSXDisplay.DisplayMode.x;
97 fbh = PSXDisplay.DisplayMode.y;
98 fb24bpp = PSXDisplay.RGB24;
99 pl_fbdev_set_mode(fbw, fbh, fb24bpp ? 24 : 16);
107 if (++fps_counter == 60/6) {
108 //printf("%2.1f\n", fps_cur);
113 pcnt_start(PCNT_ALL);
116 void DoClearScreenBuffer(void) // CLEAR DX BUFFER
120 void DoClearFrontBuffer(void) // CLEAR DX BUFFER
124 static int initialize(void)
129 bIsFirstFrame = FALSE; // done
134 ulKeybits|=KEY_SHOWFPS;
142 unsigned long ulInitDisplay(void)
147 if (pl_fbdev_init() != 0)
153 void CloseDisplay(void)
160 void CreatePic(unsigned char * pMem)
164 void DestroyPic(void)
168 void HandleKey(int keycode)