From: Toni Wilen Date: Sat, 3 Jun 2017 18:05:24 +0000 (+0300) Subject: Do not enable Logitech LCD if no display available, added disable command line option. X-Git-Tag: 3500~17 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=8c426d56f302fe55ea728bb3c5c8dc64949a70d5;p=francis%2Fwinuae.git Do not enable Logitech LCD if no display available, added disable command line option. --- diff --git a/od-win32/lcd.cpp b/od-win32/lcd.cpp index 1bc44203..950656bb 100644 --- a/od-win32/lcd.cpp +++ b/od-win32/lcd.cpp @@ -24,6 +24,7 @@ static const int numbers_width = 7, numbers_height = 10; static HMODULE lcdlib; static volatile int lcd_thread_active; static volatile bool lcd_updated; +int logitech_lcd = 1; extern unsigned long timeframes; @@ -77,6 +78,9 @@ static int lcd_init (void) DWORD size = sizeof(path) / sizeof(TCHAR); HKEY key; + if (!logitech_lcd) + return 0; + lcdlib = NULL; ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, LOGITECH_LCD_DLL, 0, KEY_READ, &key); if (ret != ERROR_SUCCESS) @@ -100,6 +104,13 @@ static int lcd_init (void) if (!pLogiLcdInit(_T("WinUAE"), LOGI_LCD_TYPE_MONO | LOGI_LCD_TYPE_COLOR)) goto err; + bool lcd_mono = pLogiLcdIsConnected(LOGI_LCD_TYPE_MONO); + bool lcd_color = pLogiLcdIsConnected(LOGI_LCD_TYPE_COLOR); + if (!lcd_mono && !lcd_color) { + pLogiLcdShutdown(); + goto err; + } + bmp = LoadBitmap (hInst, MAKEINTRESOURCE(IDB_LCD160X43)); dc = CreateCompatibleDC (NULL); SelectObject (dc, bmp); @@ -118,7 +129,7 @@ static int lcd_init (void) memcpy (origmbitmap, mbitmap, bm_width * bm_height); DeleteDC (dc); - write_log (_T("LCD enabled\n")); + write_log (_T("LCD enabled. Mono=%d Color=%d\n"), lcd_mono, lcd_color); lcd_thread_active = 1; uae_start_thread(_T("lcd"), lcd_thread, 0, NULL); diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 21563176..78ba7916 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -5532,6 +5532,7 @@ extern float sound_sync_multiplier; extern int log_cd32; extern int scanline_adjust; extern int log_ld; +extern int logitech_lcd; extern DWORD_PTR cpu_affinity, cpu_paffinity; static DWORD_PTR original_affinity = -1; @@ -5854,6 +5855,10 @@ static int parseargs (const TCHAR *argx, const TCHAR *np, const TCHAR *np2) log_cd32 = 2; return 1; } + if (!_tcscmp(arg, _T("nolcd"))) { + logitech_lcd = 0; + return 1; + } if (!_tcscmp(arg, _T("romlist"))) { void dumpromlist(void); dumpromlist();