Seperated grayscale conversion type

BT601, BT709, and average.
This commit is contained in:
basic2004
2017-07-19 15:08:40 +09:00
committed by GitHub
parent 021befa12c
commit 7f978f5a30
7 changed files with 45 additions and 4 deletions

View File

@@ -26,6 +26,7 @@
int invert_display = 0; int invert_display = 0;
int video_grayscale = 0; int video_grayscale = 0;
int video_graytype = 0;
uint32_t shade[5][256] = uint32_t shade[5][256] =
{ {
@@ -92,7 +93,15 @@ uint32_t svga_color_transform(uint32_t color)
uint32_t temp = 0; uint32_t temp = 0;
if (video_grayscale != 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) switch (video_grayscale)
{ {
case 2: case 2:

View File

@@ -113,6 +113,9 @@ void ddraw_fs_take_screenshot(wchar_t *fn);
extern int cga_palette; extern int cga_palette;
extern int vid_cga_contrast; extern int vid_cga_contrast;
extern int video_grayscale;
extern int video_graytype;
void loadfont(wchar_t *s, int format); void loadfont(wchar_t *s, int format);
void initvideo(); void initvideo();
void video_init(); void video_init();

View File

@@ -1,4 +1,4 @@
/* /*
* 86Box A hypervisor and IBM PC system emulator that specializes in * 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM * running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent * PC systems and compatibles from 1981 through fairly recent
@@ -81,7 +81,7 @@ BEGIN
BEGIN BEGIN
MENUITEM "&Inverted VGA monitor", IDM_VID_INVERT MENUITEM "&Inverted VGA monitor", IDM_VID_INVERT
MENUITEM "E&GA/(S)VGA overscan", IDM_VID_OVERSCAN MENUITEM "E&GA/(S)VGA overscan", IDM_VID_OVERSCAN
POPUP "VGA Screen &type" POPUP "VGA screen &type"
BEGIN BEGIN
MENUITEM "RGB &Color", IDM_VID_GRAY_RGB MENUITEM "RGB &Color", IDM_VID_GRAY_RGB
MENUITEM "&RGB Grayscale", IDM_VID_GRAY_MONO MENUITEM "&RGB Grayscale", IDM_VID_GRAY_MONO
@@ -89,6 +89,12 @@ BEGIN
MENUITEM "&Green monitor", IDM_VID_GRAY_GREEN MENUITEM "&Green monitor", IDM_VID_GRAY_GREEN
MENUITEM "&White monitor", IDM_VID_GRAY_WHITE MENUITEM "&White monitor", IDM_VID_GRAY_WHITE
END 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 END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "F&orce 4:3 display ratio", IDM_VID_FORCE43 MENUITEM "F&orce 4:3 display ratio", IDM_VID_FORCE43

View File

@@ -410,6 +410,9 @@
#define IDM_VID_OVERSCAN 40076 #define IDM_VID_OVERSCAN 40076
#define IDM_VID_INVERT 40079 #define IDM_VID_INVERT 40079
#define IDM_VID_CGACON 40080 #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_RGB 40090
#define IDM_VID_GRAY_MONO 40091 #define IDM_VID_GRAY_MONO 40091
#define IDM_VID_GRAY_AMBER 40092 #define IDM_VID_GRAY_AMBER 40092

View File

@@ -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_SCALE_1X + scale, MF_CHECKED);
CheckMenuItem(menu, IDM_VID_CGACON, vid_cga_contrast ? MF_CHECKED : MF_UNCHECKED); 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); CheckMenuItem(menu, IDM_VID_GRAY_RGB + video_grayscale, MF_CHECKED);
d=romset; d=romset;
@@ -1971,6 +1972,16 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
saveconfig(); saveconfig();
break; 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_RGB:
case IDM_VID_GRAY_MONO: case IDM_VID_GRAY_MONO:
case IDM_VID_GRAY_AMBER: case IDM_VID_GRAY_AMBER:

View File

@@ -805,6 +805,7 @@ static void loadconfig_general(void)
enable_overscan = !!config_get_int(cat, "enable_overscan", 0); enable_overscan = !!config_get_int(cat, "enable_overscan", 0);
vid_cga_contrast = !!config_get_int(cat, "vid_cga_contrast", 0); vid_cga_contrast = !!config_get_int(cat, "vid_cga_contrast", 0);
video_grayscale = config_get_int(cat, "video_grayscale", 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); 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); 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) if (window_remember)
{ {

View File

@@ -468,6 +468,7 @@ enum
ROM_SPC4200P, /*Samsung SPC-4200P / SCAT / Phoenix BIOS*/ ROM_SPC4200P, /*Samsung SPC-4200P / SCAT / Phoenix BIOS*/
ROM_SUPER286TR, /*Hyundai Super-286TR / SCAT / Award 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_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*/ 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 lpt_enabled, bugger_enabled;
extern int invert_display; extern int invert_display;
extern int video_grayscale;
uint32_t svga_color_transform(uint32_t color); uint32_t svga_color_transform(uint32_t color);