extern HINSTANCE hInst;
static int inited;
-static uae_u8 *bitmap, *origbitmap;
+static uae_u8 *mbitmap, *origmbitmap;
+static uae_u32 *cbitmap;
static uae_u8 *numbers;
static int bm_width = LOGI_LCD_MONO_WIDTH;
static int bm_height = LOGI_LCD_MONO_HEIGHT;
static LOGILCDSHUTDOWN pLogiLcdShutdown;
typedef bool(__cdecl *LOGILCDUPDATE)(void);
static LOGILCDUPDATE pLogiLcdUpdate;
-typedef bool(__cdecl *LOGILCDMONOSETBACKGROUND)(BYTE[]);
-static LOGILCDMONOSETBACKGROUND pLogiLcdMonoSetBackground;
+typedef bool(__cdecl *LOGILCDSETBACKGROUND)(BYTE[]);
+static LOGILCDSETBACKGROUND pLogiLcdMonoSetBackground, pLogiLcdColorSetBackground;
#define LOGITECH_LCD_DLL _T("SOFTWARE\\Classes\\CLSID\\{d0e790a5-01a7-49ae-ae0b-e986bdd0c21b}\\ServerBinary")
if (!lcdlib)
return;
pLogiLcdShutdown();
- xfree(bitmap);
- bitmap = NULL;
- xfree(origbitmap);
- origbitmap = NULL;
+ xfree(mbitmap);
+ mbitmap = NULL;
+ xfree(cbitmap);
+ cbitmap = NULL;
+ xfree(origmbitmap);
+ origmbitmap = NULL;
inited = 0;
FreeLibrary(lcdlib);
lcdlib = NULL;
pLogiLcdIsConnected = (LOGILCDISCONNECTED)GetProcAddress(lcdlib, "LogiLcdIsConnected");
pLogiLcdShutdown = (LOGILCDSHUTDOWN)GetProcAddress(lcdlib, "LogiLcdShutdown");
pLogiLcdUpdate = (LOGILCDUPDATE)GetProcAddress(lcdlib, "LogiLcdUpdate");
- pLogiLcdMonoSetBackground = (LOGILCDMONOSETBACKGROUND)GetProcAddress(lcdlib, "LogiLcdMonoSetBackground");
- if (!pLogiLcdInit || !pLogiLcdIsConnected || !pLogiLcdShutdown || !pLogiLcdUpdate || !pLogiLcdMonoSetBackground)
+ pLogiLcdMonoSetBackground = (LOGILCDSETBACKGROUND)GetProcAddress(lcdlib, "LogiLcdMonoSetBackground");
+ pLogiLcdColorSetBackground = (LOGILCDSETBACKGROUND)GetProcAddress(lcdlib, "LogiLcdColorSetBackground");
+ if (!pLogiLcdInit || !pLogiLcdIsConnected || !pLogiLcdShutdown || !pLogiLcdUpdate || (!pLogiLcdMonoSetBackground && !pLogiLcdColorSetBackground))
goto err;
- if (!pLogiLcdInit(_T("WinUAE"), LOGI_LCD_TYPE_MONO))
+ if (!pLogiLcdInit(_T("WinUAE"), LOGI_LCD_TYPE_MONO | LOGI_LCD_TYPE_COLOR))
goto err;
bmp = LoadBitmap (hInst, MAKEINTRESOURCE(IDB_LCD160X43));
SelectObject (dc, bmp);
GetObject (bmp, sizeof (binfo), &binfo);
- bitmap = xcalloc(uae_u8, binfo.bmWidth * binfo.bmHeight);
- origbitmap = xcalloc(uae_u8, binfo.bmWidth * binfo.bmHeight);
+ cbitmap = xcalloc(uae_u32, LOGI_LCD_COLOR_WIDTH * LOGI_LCD_COLOR_HEIGHT);
+ mbitmap = xcalloc(uae_u8, binfo.bmWidth * binfo.bmHeight);
+ origmbitmap = xcalloc(uae_u8, binfo.bmWidth * binfo.bmHeight);
for (int y = 0; y < binfo.bmHeight; y++) {
for (int x = 0; x < binfo.bmWidth; x++) {
- bitmap[y * binfo.bmWidth + x] = GetPixel (dc, x, y) == 0 ? 0xff : 0;
+ mbitmap[y * binfo.bmWidth + x] = GetPixel (dc, x, y) == 0 ? 0xff : 0;
}
}
- numbers = bitmap + bm_width * bm_height;
- memcpy (origbitmap, bitmap, bm_width * bm_height);
+ numbers = mbitmap + bm_width * bm_height;
+ memcpy (origmbitmap, mbitmap, bm_width * bm_height);
DeleteDC (dc);
write_log (_T("LCD enabled\n"));
return 0;
}
+static void makecolorbm(void)
+{
+ int yoff = 16;
+ for (int y = 0; y < bm_height; y++) {
+ for (int x = 0; x < bm_width; x++) {
+ uae_u8 c = mbitmap[y * bm_width + x];
+ uae_u32 cc = c >= 0x80 ? 0xffffffff : 0x00000000;
+ cbitmap[(y * 3 + yoff + 0) * LOGI_LCD_COLOR_WIDTH + x * 2 + 0] = cc;
+ cbitmap[(y * 3 + yoff + 0) * LOGI_LCD_COLOR_WIDTH + x * 2 + 1] = cc;
+ cbitmap[(y * 3 + yoff + 1) * LOGI_LCD_COLOR_WIDTH + x * 2 + 0] = cc;
+ cbitmap[(y * 3 + yoff + 1) * LOGI_LCD_COLOR_WIDTH + x * 2 + 1] = cc;
+ cbitmap[(y * 3 + yoff + 2) * LOGI_LCD_COLOR_WIDTH + x * 2 + 0] = cc;
+ cbitmap[(y * 3 + yoff + 2) * LOGI_LCD_COLOR_WIDTH + x * 2 + 1] = cc;
+ }
+ }
+}
+
static void dorect (int *crd, int inv)
{
int yy, xx;
int x = crd[0], y = crd[1], w = crd[2], h = crd[3];
for (yy = y; yy < y + h; yy++) {
for (xx = x; xx < x + w; xx++) {
- uae_u8 b = origbitmap[yy * bm_width + xx];
+ uae_u8 b = origmbitmap[yy * bm_width + xx];
if (inv)
b = b == 0 ? 0xff : 0;
- bitmap[yy * bm_width + xx] = b;
+ mbitmap[yy * bm_width + xx] = b;
}
}
}
n = 10;
for (yy = 0; yy < numbers_height; yy++) {
for (xx = 0; xx < numbers_width; xx++) {
- dst = bitmap + (yy + y) * bm_width + (xx + x);
+ dst = mbitmap + (yy + y) * bm_width + (xx + x);
src = numbers + n * numbers_width + yy * bm_width + xx;
*dst = 0;
if (*src == 0)
}
if (otimeframes != timeframes) {
- c = pLogiLcdMonoSetBackground(bitmap);
+ if (pLogiLcdMonoSetBackground)
+ c = pLogiLcdMonoSetBackground(mbitmap);
+ if (pLogiLcdColorSetBackground) {
+ makecolorbm();
+ c = pLogiLcdColorSetBackground((uae_u8*)cbitmap);
+ }
c = pLogiLcdUpdate();
otimeframes = timeframes;
}