Video: implemented PAL subcarrier emulation as a filter, with options in Palette dialog.

This commit is contained in:
feos-tas 2015-05-09 17:06:07 +00:00
parent 85ec4f169d
commit 72f5785c14
6 changed files with 240 additions and 32 deletions

View File

@ -91,7 +91,7 @@ static DECLFR(UNLSB2000Read) {
default:
FCEU_printf("unk read: %04x\n",A);
// break;
// return 0xff;
return 0xff; // needed to prevent C4715 warning?
}
}

View File

@ -33,14 +33,20 @@ uint8 burst_phase = 0;
static uint32 CBM[3];
static uint32 *palettetranslate=0;
static uint16 *specbuf=NULL; // 8bpp -> 16bpp, pre hq2x/hq3x
static uint32 *specbuf32bpp = NULL; // Buffer to hold output of hq2x/hq3x when converting to 16bpp and 24bpp
static uint16 *specbuf=NULL; // 8bpp -> 16bpp, pre hq2x/hq3x
static uint32 *specbuf32bpp = NULL; // Buffer to hold output of hq2x/hq3x when converting to 16bpp and 24bpp
static int backBpp, backshiftr[3], backshiftl[3];
//static uint32 backmask[3];
static uint8 *specbuf8bpp = NULL; // For 2xscale, 3xscale.
static uint8 *ntscblit = NULL; // For nes_ntsc
static uint32 *prescalebuf = NULL; // Prescale pointresizes to 2x-4x to allow less blur with hardware acceleration.
static uint8 *specbuf8bpp = NULL; // For 2xscale, 3xscale.
static uint8 *ntscblit = NULL; // For nes_ntsc
static uint32 *prescalebuf = NULL; // Prescale pointresizes to 2x-4x to allow less blur with hardware acceleration.
static uint32 *palrgb = NULL; // PAL filter buffer for lookup values of RGB with applied moir phases
static float *moire = NULL;
int palhue = 100;
bool palhdtv = 0;
bool palmonochrome = 0;
bool palupdate = 1;
static int silt;
@ -60,6 +66,11 @@ static int highefx;
*/
#define FVB_BLUR 2
static int Round(float value)
{
return (int) floor(value + 0.5);
}
static void CalculateShift(uint32 *CBM, int *cshiftr, int *cshiftl)
{
int a,x,z,y;
@ -176,6 +187,12 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int
int multi = specfilt - 4; // magic assuming prescales are specfilt >= 6
prescalebuf = (uint32 *)FCEU_dmalloc(256*240*multi*sizeof(uint32));
}
else if (specfilt == 9)
{
palrgb = (uint32 *)FCEU_dmalloc(265*16*sizeof(uint32));
moire = (float *)FCEU_dmalloc( 16*sizeof(float));
}
silt = specfilt;
Bpp=b;
highefx=efx;
@ -247,6 +264,10 @@ void KillBlitToHigh(void)
free(prescalebuf);
prescalebuf = NULL;
}
if (palrgb) {
free(palrgb);
palrgb = NULL;
}
}
@ -583,8 +604,8 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
if (Bpp == 4) // are other modes really needed?
{
int mult = silt - 4; // magic assuming prescales are silt >= 6
uint32 *s = prescalebuf; // use 32-bit pointers ftw
uint32 *d = (uint32 *)destbackup;
uint32 *s = prescalebuf;
uint32 *d = (uint32 *)destbackup; // use 32-bit pointers ftw
for (y=0; y<yr*yscale; y++)
{
@ -603,6 +624,134 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
}
return;
}
else if (palrgb) // pal moire
{
// skip usual palette translation, fill lookup array of RGB+moire values per palette update, and send directly to DX dest.
// hardcoded resolution is 768x240, makes moire mask cleaner, even though PAL consoles generate it at native res.
// source of this whole idea: http://forum.emu-russia.net/viewtopic.php?p=9410#p9410
if (palupdate) {
uint8 *source = (uint8 *)palettetranslate;
int16 R,G,B;
float Y,U,V;
float hue = (float) palhue/100;
bool hdtv = palhdtv;
bool monochrome = palmonochrome;
for (int i=0; i<256; i++) {
R = source[i*4 ];
G = source[i*4+1];
B = source[i*4+2];
if (hdtv) { // HDTV BT.709
Y = 0.2126 *R + 0.7152 *G + 0.0722 *B; // Y'
U = -0.09991*R - 0.33609*G + 0.436 *B; // B-Y
V = 0.615 *R - 0.55861*G - 0.05639*B; // R-Y
} else { // SDTV BT.601
Y = 0.299 *R + 0.587 *G + 0.114 *B;
U = -0.14713*R - 0.28886*G + 0.436 *B;
V = 0.615 *R - 0.51499*G - 0.10001*B;
}
if (Y == 0) Y = 1;
// WARNING: phase order is magical!
moire[0] = (U == 0 && V == 0) ? 1 : (Y + V)/Y;
moire[1] = (U == 0 && V == 0) ? 1 : (Y + U)/Y;
moire[2] = (U == 0 && V == 0) ? 1 : (Y - V)/Y;
moire[3] = (U == 0 && V == 0) ? 1 : (Y - U)/Y;
moire[4] = (U == 0 && V == 0) ? 1 : (Y - V)/Y;
moire[5] = (U == 0 && V == 0) ? 1 : (Y + U)/Y;
moire[6] = (U == 0 && V == 0) ? 1 : (Y + V)/Y;
moire[7] = (U == 0 && V == 0) ? 1 : (Y - U)/Y;
moire[8] = (U == 0 && V == 0) ? 1 : (Y - V)/Y;
moire[9] = (U == 0 && V == 0) ? 1 : (Y - U)/Y;
moire[10] = (U == 0 && V == 0) ? 1 : (Y + V)/Y;
moire[11] = (U == 0 && V == 0) ? 1 : (Y + U)/Y;
moire[12] = (U == 0 && V == 0) ? 1 : (Y + V)/Y;
moire[13] = (U == 0 && V == 0) ? 1 : (Y - U)/Y;
moire[14] = (U == 0 && V == 0) ? 1 : (Y - V)/Y;
moire[15] = (U == 0 && V == 0) ? 1 : (Y + U)/Y;
if (monochrome)
hue = 0;
for (int j=0; j<16; j++) {
if (hdtv) { // HDTV BT.709
R = Round((Y + 1.28033*V*hue)*moire[j]);
G = Round((Y - 0.21482*U*hue - 0.38059*V*hue)*moire[j]);
B = Round((Y + 2.12798*U*hue )*moire[j]);
} else { // SDTV BT.601
R = Round((Y + 1.13983*V*hue)*moire[j]);
G = Round((Y - 0.39465*U*hue - 0.58060*V*hue)*moire[j]);
B = Round((Y + 2.03211*U*hue )*moire[j]);
}
if (R > 0xff) R = 0xff; else if (R < 0) R = 0;
if (G > 0xff) G = 0xff; else if (G < 0) G = 0;
if (B > 0xff) B = 0xff; else if (B < 0) B = 0;
palrgb[i*16+j] = (B<<16)|(G<<8)|R;
}
}
palupdate = 0;
}
if (Bpp == 4) {
uint32 *d = (uint32 *)dest;
uint8 xsub = 0;
uint8 xabs = 0;
uint8 index = 0;
uint32 color;
for (y=0; y<yr; y++) {
for (x=0; x<xr; x++) {
index = *src++;
for (int xsub = 0; xsub < 3; xsub++) {
xabs = x*3 + xsub;
switch (y&3) {
case 0:
switch (xabs&3) {
case 0: color = palrgb[index*16 ]; break;
case 1: color = palrgb[index*16+ 1]; break;
case 2: color = palrgb[index*16+ 2]; break;
case 3: color = palrgb[index*16+ 3]; break;
}
break;
case 1:
switch (xabs&3) {
case 0: color = palrgb[index*16+ 4]; break;
case 1: color = palrgb[index*16+ 5]; break;
case 2: color = palrgb[index*16+ 6]; break;
case 3: color = palrgb[index*16+ 7]; break;
}
break;
case 2:
switch (xabs&3) {
case 0: color = palrgb[index*16+ 8]; break;
case 1: color = palrgb[index*16+ 9]; break;
case 2: color = palrgb[index*16+10]; break;
case 3: color = palrgb[index*16+11]; break;
}
break;
case 3:
switch (xabs&3) {
case 0: color = palrgb[index*16+12]; break;
case 1: color = palrgb[index*16+13]; break;
case 2: color = palrgb[index*16+14]; break;
case 3: color = palrgb[index*16+15]; break;
}
break;
}
*d++ = color;
}
}
}
}
return;
}
else if(specbuf) // hq2x/hq3x
{
destbackup=dest;
@ -799,7 +948,7 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
int too=xscale;
do
{
*(uint32 *)dest=palettetranslate[*src];
*(uint32 *)dest=palettetranslate[*src];
dest+=4;
} while(--too);
}

View File

@ -5,6 +5,10 @@
#include "gui.h"
uint8 cpalette[192] = {0};
extern int palhue;
extern bool palhdtv;
extern bool palprecision;
extern bool palmonochrome;
bool SetPalette(const char* nameo)
{
@ -62,6 +66,7 @@ int LoadPaletteFile()
**/
BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
char text[10];
switch(uMsg)
{
case WM_INITDIALOG:
@ -69,13 +74,17 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if(ntsccol)
CheckDlgButton(hwndDlg, CHECK_PALETTE_ENABLED, BST_CHECKED);
SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 128));
SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 128));
SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 128));
SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 128));
SendDlgItemMessage(hwndDlg, CTL_PALHUE_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 200));
FCEUI_GetNTSCTH(&ntsctint, &ntschue);
sprintf(text, "Hue: %d%%", palhue);
SendDlgItemMessage(hwndDlg, STATIC_HUEVALUE, WM_SETTEXT, 0, (LPARAM) text);
SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_SETPOS, 1, ntsctint);
SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_SETPOS, 1, ntschue);
SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_SETPOS, 1, ntsctint);
SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_SETPOS, 1, ntschue);
SendDlgItemMessage(hwndDlg, CTL_PALHUE_TRACKBAR, TBM_SETPOS, 1, palhue);
if(force_grayscale)
CheckDlgButton(hwndDlg, CHECK_PALETTE_GRAYSCALE, BST_CHECKED);
@ -83,14 +92,23 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (eoptions & EO_CPALETTE)
CheckDlgButton(hwndDlg, CHECK_PALETTE_CUSTOM, BST_CHECKED);
if (palmonochrome)
CheckDlgButton(hwndDlg, CHECK_PALETTE_MONOCHROME, BST_CHECKED);
if (palhdtv)
CheckDlgButton(hwndDlg, CHECK_PALETTE_HDTV, BST_CHECKED);
CenterWindowOnScreen(hwndDlg);
break;
case WM_HSCROLL:
ntsctint = SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
ntschue = SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
ntsctint = SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
ntschue = SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
palhue = SendDlgItemMessage(hwndDlg, CTL_PALHUE_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
sprintf(text, "Hue: %d%%", palhue);
SendDlgItemMessage(hwndDlg, STATIC_HUEVALUE, WM_SETTEXT, 0, (LPARAM) text);
break;
case WM_CLOSE:
@ -104,7 +122,7 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
case CHECK_PALETTE_ENABLED:
ntsccol ^= 1;
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue); // it recalculates everything, use it for PAL block too!
break;
case CHECK_PALETTE_GRAYSCALE:
@ -117,6 +135,24 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
CheckDlgButton(hwndDlg, CHECK_PALETTE_CUSTOM, BST_CHECKED);
break;
case BTN_PALETTE_RESET:
palhue = 100;
SendDlgItemMessage(hwndDlg, CTL_PALHUE_TRACKBAR, TBM_SETPOS, 1, palhue);
sprintf(text, "Hue: %d%%", palhue);
SendDlgItemMessage(hwndDlg, STATIC_HUEVALUE, WM_SETTEXT, 0, (LPARAM) text);
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
break;
case CHECK_PALETTE_MONOCHROME:
palmonochrome ^= 1;
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
break;
case CHECK_PALETTE_HDTV:
palhdtv ^= 1;
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
break;
case CHECK_PALETTE_CUSTOM:
{
if (eoptions & EO_CPALETTE)

View File

@ -7,7 +7,8 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@ -345,12 +346,12 @@ BEGIN
PUSHBUTTON "OK",BTN_OK,40,45,50,14
END
PALCONFIG DIALOGEX 16, 81, 228, 116
PALCONFIG DIALOGEX 16, 81, 228, 175
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Palette Configuration"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",BUTTON_CLOSE,162,94,56,14
DEFPUSHBUTTON "Close",BUTTON_CLOSE,162,153,56,14
GROUPBOX "NES Palette",302,10,8,102,81,WS_GROUP
DEFPUSHBUTTON "&Load Palette...",BTN_PALETTE_LOAD,18,40,58,14
CONTROL "Enabled",CHECK_PALETTE_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,22,87,12
@ -361,6 +362,12 @@ BEGIN
CTEXT "Tint",65463,123,34,85,8
CONTROL "Force Grayscale",CHECK_PALETTE_GRAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,67,85,12
CONTROL "Use Custom Palette",CHECK_PALETTE_CUSTOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,22,85,12
GROUPBOX "PAL Emulation",IDC_STATIC,10,89,208,61
CONTROL "",CTL_PALHUE_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,15,111,86,15
LTEXT "Hue:",STATIC_HUEVALUE,41,102,46,8
PUSHBUTTON "Reset",BTN_PALETTE_RESET,35,128,50,14
CONTROL "Monochrome",CHECK_PALETTE_MONOCHROME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,101,57,10
CONTROL "HDTV Colormatrix",CHECK_PALETTE_HDTV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,118,72,10
END
POWERPADDIALOG DIALOG 30, 123, 131, 119
@ -1554,7 +1561,7 @@ BEGIN
LEFTMARGIN, 10
RIGHTMARGIN, 218
TOPMARGIN, 8
BOTTOMMARGIN, 108
BOTTOMMARGIN, 167
END
"SOUNDCONFIG", DIALOG
@ -2520,7 +2527,8 @@ IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp"
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -635,6 +635,7 @@
#define IDC_AUTORESUMECDLOGGING 1203
#define IDC_MASK_UNUSED_GRAPHICS 1203
#define CHECK_SOUND_SWAPDUTY 1203
#define CHECK_PALETTE_MONOCHROME 1203
#define IDC_VOLUMEGROUP 1204
#define IDC_OMITBLANK 1204
#define IDC_CHECK3 1204
@ -758,6 +759,9 @@
#define ID_STATIC 1286
#define ID_CDL_OPTIONS 1287
#define ID_CDL_GENERATEROM 1288
#define CTL_PALHUE_TRACKBAR 1291
#define CHECK_PALETTE_HDTV 1292
#define STATIC_HUEVALUE 1293
#define MENU_NETWORK 40040
#define MENU_PALETTE 40041
#define MENU_SOUND 40042
@ -1222,7 +1226,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 291
#define _APS_NEXT_COMMAND_VALUE 40596
#define _APS_NEXT_CONTROL_VALUE 1291
#define _APS_NEXT_CONTROL_VALUE 1294
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -67,6 +67,7 @@ vmdef vmodes[11] =
};
extern uint8 PALRAM[0x20];
extern bool palupdate;
PALETTEENTRY *color_palette;
@ -337,8 +338,10 @@ int SetVideoMode(int fs)
specmul = 2;
else if(winspecial >= 4 && winspecial <= 5)
specmul = 3;
else if(winspecial >= 6)
else if(winspecial >= 6 && winspecial <=8)
specmul = winspecial - 4; // magic assuming prescales are winspecial >= 6
else if(winspecial == 9)
specmul = 3;
else
specmul = 1;
@ -374,7 +377,7 @@ int SetVideoMode(int fs)
ddsdback.ddsCaps.dwCaps= DDSCAPS_OFFSCREENPLAIN;
ddsdback.dwWidth=256 * specmul;
ddsdback.dwHeight=FSettings.TotalScanlines() * specmul;
ddsdback.dwHeight=FSettings.TotalScanlines() * ((winspecial == 9) ? 1 : specmul);
if (directDrawModeWindowed == DIRECTDRAW_MODE_SURFACE_IN_RAM)
// create the buffer in system memory
@ -437,8 +440,10 @@ int SetVideoMode(int fs)
specmul = 2;
else if(vmodes[0].special >= 4 && vmodes[0].special <= 5)
specmul = 3;
else if(vmodes[0].special >= 6)
else if(vmodes[0].special >= 6 && vmodes[0].special <= 8)
specmul = vmodes[0].special - 4; // magic assuming prescales are vmodes[0].special >= 6
else if(vmodes[0].special == 9)
specmul = 3;
else
specmul = 1;
}
@ -467,7 +472,7 @@ int SetVideoMode(int fs)
ddsdback.ddsCaps.dwCaps= DDSCAPS_OFFSCREENPLAIN;
ddsdback.dwWidth=256 * specmul; //vmodes[vmod].srect.right;
ddsdback.dwHeight=FSettings.TotalScanlines() * specmul; //vmodes[vmod].srect.bottom;
ddsdback.dwHeight=FSettings.TotalScanlines() * ((vmodes[0].special == 9) ? 1 : specmul); //vmodes[vmod].srect.bottom;
if (directDrawModeFullscreen == DIRECTDRAW_MODE_SURFACE_IN_RAM)
// create the buffer in system memory
@ -603,16 +608,19 @@ static void BlitScreenWindow(unsigned char *XBuf)
specialmul = 2;
else if(winspecial >= 4 && winspecial <= 5)
specialmul = 3;
else if(winspecial >= 6)
else if(winspecial >= 6 && winspecial <= 8)
specialmul = winspecial - 4; // magic assuming prescales are winspecial >= 6
else if(winspecial == 9)
specialmul = 3;
else specialmul = 1;
srect.top=srect.left=0;
srect.right=VNSWID * specialmul;
srect.bottom=FSettings.TotalScanlines() * specialmul;
srect.bottom=FSettings.TotalScanlines() * ((winspecial == 9) ? 1 : specialmul);
if(PaletteChanged==1)
{
palupdate = 1;
FixPaletteHi();
PaletteChanged=0;
}
@ -743,8 +751,10 @@ static void BlitScreenFull(uint8 *XBuf)
specmul = 2;
else if(vmodes[0].special >= 4 && vmodes[0].special <= 5)
specmul = 3;
else if(vmodes[0].special >= 6)
else if(vmodes[0].special >= 6 && vmodes[0].special <= 8)
specmul = vmodes[0].special - 4; // magic assuming prescales are vmodes[0].special >= 6
else if(vmodes[0].special == 9)
specmul = 3;
else
specmul = 1;
@ -757,6 +767,7 @@ static void BlitScreenFull(uint8 *XBuf)
if(PaletteChanged==1)
{
palupdate = 1;
if(bpp>=16)
FixPaletteHi();
else
@ -786,7 +797,7 @@ static void BlitScreenFull(uint8 *XBuf)
srect.top=0;
srect.left=0;
srect.right=VNSWID * specmul;
srect.bottom=FSettings.TotalScanlines() * specmul;
srect.bottom=FSettings.TotalScanlines() * ((vmodes[0].special == 9) ? 1 : specmul);
//if(vmodes[vmod].flags&VMDF_STRFS)
//{
@ -1266,9 +1277,9 @@ BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
//CheckRadioButton(hwndDlg,IDC_RADIO_SCALE,IDC_RADIO_STRETCH,(vmodes[0].flags&VMDF_STRFS)?IDC_RADIO_STRETCH:IDC_RADIO_SCALE);
// -Video Modes Tag-
char *str[]={"<none>","hq2x","Scale2x","NTSC 2x","hq3x","Scale3x","Prescale2x","Prescale3x","Prescale4x"};
char *str[]={"<none>","hq2x","Scale2x","NTSC 2x","hq3x","Scale3x","Prescale2x","Prescale3x","Prescale4x","PAL"};
int x;
for(x=0;x<9;x++)
for(x=0;x<10;x++)
{
SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SCALER_FS,CB_ADDSTRING,0,(LPARAM)(LPSTR)str[x]);
SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SCALER_WIN,CB_ADDSTRING,0,(LPARAM)(LPSTR)str[x]);