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
43 static void blit(void)
45 extern void bgr555_to_rgb565(void *dst, void *src, int bytes);
46 int x = PSXDisplay.DisplayPosition.x;
47 int y = PSXDisplay.DisplayPosition.y;
48 int w = PreviousPSXDisplay.Range.x1;
49 int h = PreviousPSXDisplay.DisplayMode.y;
50 int pitch = PreviousPSXDisplay.DisplayMode.x * 2;
51 unsigned char *dest = pl_fbdev_buf;
56 // TODO: clear border if centering
58 // account for centering
59 h -= PreviousPSXDisplay.Range.y0;
60 dest += PreviousPSXDisplay.Range.y0 / 2 * pitch;
61 dest += PreviousPSXDisplay.Range.x0 * 2; // XXX
64 unsigned short *srcs = psxVuw + y * 1024 + x;
65 for (; h-- > 0; dest += pitch, srcs += 1024)
67 bgr555_to_rgb565(dest, srcs, w * 2);
72 static int fbw, fbh, fb24bpp;
76 void DoBufferSwap(void)
78 static int fps_counter;
79 if (PSXDisplay.DisplayMode.x == 0 || PSXDisplay.DisplayMode.y == 0)
82 if (PSXDisplay.DisplayMode.x != fbw || PSXDisplay.DisplayMode.y != fbh
83 || PSXDisplay.RGB24 != fb24bpp) {
84 fbw = PSXDisplay.DisplayMode.x;
85 fbh = PSXDisplay.DisplayMode.y;
86 fb24bpp = PSXDisplay.RGB24;
87 pl_fbdev_set_mode(fbw, fbh, fb24bpp ? 24 : 16);
95 if (++fps_counter == 60/6) {
96 //printf("%2.1f\n", fps_cur);
101 pcnt_start(PCNT_ALL);
104 void DoClearScreenBuffer(void) // CLEAR DX BUFFER
108 void DoClearFrontBuffer(void) // CLEAR DX BUFFER
112 static int initialize(void)
117 bIsFirstFrame = FALSE; // done
122 ulKeybits|=KEY_SHOWFPS;
130 unsigned long ulInitDisplay(void)
135 if (pl_fbdev_init() != 0)
141 void CloseDisplay(void)
148 void CreatePic(unsigned char * pMem)
152 void DestroyPic(void)
156 void HandleKey(int keycode)