diff --git a/src/VIDEO/vid_svga_render.c b/src/VIDEO/vid_svga_render.c index 43fe95bc1..7b4c0c136 100644 --- a/src/VIDEO/vid_svga_render.c +++ b/src/VIDEO/vid_svga_render.c @@ -26,6 +26,7 @@ int invert_display = 0; int video_grayscale = 0; +int video_graytype = 0; uint32_t shade[5][256] = { @@ -92,7 +93,15 @@ uint32_t svga_color_transform(uint32_t color) uint32_t temp = 0; if (video_grayscale != 0) { - temp = ((76 * (color & 0xff0000)) >> 24) + ((150 * (color & 0xff00)) >> 16) + ((29 * (color & 0xff)) >> 8); + if (video_graytype) + { + if (video_graytype == 1) + temp = ((54 * ((color & 0xff0000) >> 16)) + (183 * ((color & 0xff00) >> 8)) + (18 * (color & 0xff))) / 255; + else + temp = (((color & 0xff0000) >> 16) + ((color & 0xff00) >> 8) + (color & 0xff)) / 3; + } + else + temp = ((76 * ((color & 0xff0000) >> 16)) + (150 * ((color & 0xff00) >> 8)) + (29 * (color & 0xff))) / 255; switch (video_grayscale) { case 2: diff --git a/src/VIDEO/video.h b/src/VIDEO/video.h index f9b7fef85..53cb98c5c 100644 --- a/src/VIDEO/video.h +++ b/src/VIDEO/video.h @@ -113,6 +113,9 @@ void ddraw_fs_take_screenshot(wchar_t *fn); extern int cga_palette; extern int vid_cga_contrast; +extern int video_grayscale; +extern int video_graytype; + void loadfont(wchar_t *s, int format); void initvideo(); void video_init(); diff --git a/src/WIN/86Box.rc b/src/WIN/86Box.rc index 06f48c95b..aaa5519ef 100644 --- a/src/WIN/86Box.rc +++ b/src/WIN/86Box.rc @@ -1,4 +1,4 @@ -/* +/* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent @@ -81,7 +81,7 @@ BEGIN BEGIN MENUITEM "&Inverted VGA monitor", IDM_VID_INVERT MENUITEM "E&GA/(S)VGA overscan", IDM_VID_OVERSCAN - POPUP "VGA Screen &type" + POPUP "VGA screen &type" BEGIN MENUITEM "RGB &Color", IDM_VID_GRAY_RGB MENUITEM "&RGB Grayscale", IDM_VID_GRAY_MONO @@ -89,6 +89,12 @@ BEGIN MENUITEM "&Green monitor", IDM_VID_GRAY_GREEN MENUITEM "&White monitor", IDM_VID_GRAY_WHITE END + POPUP "Grayscale &conversion type" + BEGIN + MENUITEM "BT&601 (NTSC/PAL)", IDM_VID_GRAYCT_601 + MENUITEM "BT&709 (HDTV)", IDM_VID_GRAYCT_709 + MENUITEM "&Average", IDM_VID_GRAYCT_AVE + END END MENUITEM SEPARATOR MENUITEM "F&orce 4:3 display ratio", IDM_VID_FORCE43 diff --git a/src/WIN/resource.h b/src/WIN/resource.h index fb918a06f..02fa21a9f 100644 --- a/src/WIN/resource.h +++ b/src/WIN/resource.h @@ -410,6 +410,9 @@ #define IDM_VID_OVERSCAN 40076 #define IDM_VID_INVERT 40079 #define IDM_VID_CGACON 40080 +#define IDM_VID_GRAYCT_601 40085 +#define IDM_VID_GRAYCT_709 40086 +#define IDM_VID_GRAYCT_AVE 40087 #define IDM_VID_GRAY_RGB 40090 #define IDM_VID_GRAY_MONO 40091 #define IDM_VID_GRAY_AMBER 40092 diff --git a/src/WIN/win.c b/src/WIN/win.c index 9ec9977df..dc30da3fd 100644 --- a/src/WIN/win.c +++ b/src/WIN/win.c @@ -1532,6 +1532,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz CheckMenuItem(menu, IDM_VID_SCALE_1X + scale, MF_CHECKED); CheckMenuItem(menu, IDM_VID_CGACON, vid_cga_contrast ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(menu, IDM_VID_GRAYCT_601 + video_graytype, MF_CHECKED); CheckMenuItem(menu, IDM_VID_GRAY_RGB + video_grayscale, MF_CHECKED); d=romset; @@ -1971,6 +1972,16 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM saveconfig(); break; + case IDM_VID_GRAYCT_601: + case IDM_VID_GRAYCT_709: + case IDM_VID_GRAYCT_AVE: + CheckMenuItem(hmenu, IDM_VID_GRAYCT_601 + video_graytype, MF_UNCHECKED); + video_graytype = LOWORD(wParam) - IDM_VID_GRAYCT_601; + CheckMenuItem(hmenu, IDM_VID_GRAYCT_601 + video_graytype, MF_CHECKED); + saveconfig(); + device_force_redraw(); + break; + case IDM_VID_GRAY_RGB: case IDM_VID_GRAY_MONO: case IDM_VID_GRAY_AMBER: diff --git a/src/config.c b/src/config.c index c2b9869a0..e59225fed 100644 --- a/src/config.c +++ b/src/config.c @@ -805,6 +805,7 @@ static void loadconfig_general(void) enable_overscan = !!config_get_int(cat, "enable_overscan", 0); vid_cga_contrast = !!config_get_int(cat, "vid_cga_contrast", 0); video_grayscale = config_get_int(cat, "video_grayscale", 0); + video_graytype = config_get_int(cat, "video_graytype", 0); window_remember = config_get_int(cat, "window_remember", 0); @@ -1810,6 +1811,14 @@ static void saveconfig_general(void) config_set_int(cat, "video_grayscale", video_grayscale); } + if (video_graytype == 0) + { + config_delete_var(cat, "video_graytype"); + } + else + { + config_set_int(cat, "video_graytype", video_graytype); + } if (window_remember) { diff --git a/src/ibm.h b/src/ibm.h index 3f01ba0ec..5c508f539 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -468,6 +468,7 @@ enum ROM_SPC4200P, /*Samsung SPC-4200P / SCAT / Phoenix BIOS*/ ROM_SUPER286TR, /*Hyundai Super-286TR / SCAT / Award BIOS*/ + ROM_DW486, /*Daewoo CPC-2800 / SCAT / Phoenix BIOS*/ ROM_MEGAPCDX, /*386DX mdoel of the Mega PC - Note by Tohka: The documentation (that I have in German) clearly says such a model exists.*/ ROM_ZAPPA, /*Intel Advanced/ZP / 430FX / AMI BIOS / National Semiconductors PC87306*/ @@ -737,7 +738,6 @@ extern int serial_enabled[2]; extern int lpt_enabled, bugger_enabled; extern int invert_display; -extern int video_grayscale; uint32_t svga_color_transform(uint32_t color);