PAL filter:

- redo moire from scratch using formulas and greater LUT
- add contrast and brightness (no idea how bad they are)
- kill hdtv and monochrome options
todo: figure out color edge stuff and add fringing (rainbow)
This commit is contained in:
feos-tas 2015-10-08 18:52:16 +00:00
parent 6cb7a141ff
commit 51071963c1
5 changed files with 207 additions and 242 deletions

View File

@ -41,36 +41,49 @@ uint8 burst_phase = 0;
static uint32 CBM[3]; static uint32 CBM[3];
static uint32 *palettetranslate=0; 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 int backBpp, backshiftr[3], backshiftl[3]; static int backBpp, backshiftr[3], backshiftl[3];
static int silt;
static int Bpp; // BYTES per pixel
static int highefx;
//static uint32 backmask[3]; //static uint32 backmask[3];
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 uint8 *specbuf8bpp = NULL; // For 2xscale, 3xscale. static uint8 *specbuf8bpp = NULL; // For 2xscale, 3xscale.
static uint8 *ntscblit = NULL; // For nes_ntsc 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 *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 uint32 *palrgb2 = NULL; // PAL filter buffer for lookup values of blended moir phases
static float *moire = NULL;
int palsaturation = 100;
int palnotch = 100;
int palsharpness = 50;
bool palhdtv = 0;
bool palmonochrome = 0;
bool palupdate = 1;
bool paldeemphswap = 0;
static int silt; //////////////////////
// PAL filter start //
static int Bpp; // BYTES per pixel //////////////////////
static int highefx; #define PAL_PHASES 108 // full vertical subcarrier cycle for 3x resolution (18) * full horizontal cycle (6)
static uint32 *palrgb = NULL; // buffer for lookup values of RGB with applied moir phases
static uint32 *palrgb2 = NULL; // buffer for lookup values of blended moir phases
static float *moire = NULL; // modulated signal
const float phasex = (float) 5/18*2;
const float phasey = (float) 1/ 6*2;
const float pi = 3.14f;
int palnotch = 90;
int palsaturation = 100;
int palsharpness = 50;
int palcontrast = 100;
int palbrightness = 50;
bool palupdate = 1;
bool paldeemphswap = 0;
static int Round(float value) static int Round(float value)
{ {
return (int) floor(value + 0.5); return (int) floor(value + 0.5);
} }
static int PAL_LUT(uint32 *buffer, int index, int x, int y)
{
return buffer[index*PAL_PHASES + (x%18) + 18*(y%6)];
}
////////////////////
// PAL filter end //
////////////////////
static void CalculateShift(uint32 *CBM, int *cshiftr, int *cshiftl) static void CalculateShift(uint32 *CBM, int *cshiftr, int *cshiftl)
{ {
int a,x,z,y; int a,x,z,y;
@ -191,9 +204,9 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int
} }
else if (specfilt == 9) else if (specfilt == 9)
{ {
palrgb = (uint32 *)FCEU_dmalloc((256+512)*16*sizeof(uint32)); palrgb = (uint32 *)FCEU_dmalloc((256+512)*PAL_PHASES*sizeof(uint32));
palrgb2 = (uint32 *)FCEU_dmalloc((256+512)*16*sizeof(uint32)); palrgb2 = (uint32 *)FCEU_dmalloc((256+512)*PAL_PHASES*sizeof(uint32));
moire = (float *)FCEU_dmalloc( 16*sizeof(float)); moire = (float *)FCEU_dmalloc( PAL_PHASES*sizeof(float));
paldeemphswap = 1; paldeemphswap = 1;
} }
@ -466,53 +479,6 @@ u32 ModernDeemphColorMap(u8* src)
return color; return color;
} }
int PAL_LUT(uint32 *buffer, int index, int x, int y)
{
int color = 0;
switch (y&3)
{
case 0:
switch (x&3)
{
case 0: color = buffer[index*16 ]; break;
case 1: color = buffer[index*16+ 1]; break;
case 2: color = buffer[index*16+ 2]; break;
case 3: color = buffer[index*16+ 3]; break;
}
break;
case 1:
switch (x&3)
{
case 0: color = buffer[index*16+ 4]; break;
case 1: color = buffer[index*16+ 5]; break;
case 2: color = buffer[index*16+ 6]; break;
case 3: color = buffer[index*16+ 7]; break;
}
break;
case 2:
switch (x&3)
{
case 0: color = buffer[index*16+ 8]; break;
case 1: color = buffer[index*16+ 9]; break;
case 2: color = buffer[index*16+10]; break;
case 3: color = buffer[index*16+11]; break;
}
break;
case 3:
switch (x&3)
{
case 0: color = buffer[index*16+12]; break;
case 1: color = buffer[index*16+13]; break;
case 2: color = buffer[index*16+14]; break;
case 3: color = buffer[index*16+15]; break;
}
break;
}
return color;
}
void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, int yscale) void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, int yscale)
{ {
int x,y; int x,y;
@ -633,94 +599,74 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
} }
else if (palrgb) // pal moire 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. // 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. // written by feos in 2015, credits to HardWareMan and r57shell
// source of this whole idea: http://forum.emu-russia.net/viewtopic.php?p=9410#p9410
if (palupdate) if (palupdate)
{ {
uint8 *source = (uint8 *)palettetranslate; uint8 *source = (uint8 *)palettetranslate;
int16 R,G,B; int16 R,G,B;
float Y,U,V; float Y,U,V;
float alpha;
float sat = (float) palsaturation/100; float sat = (float) palsaturation/100;
bool hdtv = palhdtv; float contrast = (float) palcontrast/100;
bool monochrome = palmonochrome; int bright = palbrightness - 50;
int notch = palnotch; int notch = palnotch;
int unnotch = 100 - palnotch; int unnotch = 100 - palnotch;
int mixR[16], mixG[16], mixB[16]; int mixR[PAL_PHASES], mixG[PAL_PHASES], mixB[PAL_PHASES];
for (int i=0; i<256+512; i++) for (int i=0; i<256+512; i++)
{ {
// fetch color
R = source[i*4 ]; R = source[i*4 ];
G = source[i*4+1]; G = source[i*4+1];
B = source[i*4+2]; B = source[i*4+2];
if (hdtv) // HDTV BT.709 // rgb -> yuv, 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;
// all variants of this color
for (int x=0; x<18; x++)
{ {
Y = 0.2126 *R + 0.7152 *G + 0.0722 *B; // Y' for (y=0; y<6; 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 alpha = (x*phasex + y*phasey)*pi; // 2*pi*freq*t
} if (y%2 == 0) alpha = -alpha; // phase alternating line!
else // SDTV BT.601 moire[x+y*18] = Y + U*sin(alpha) + V*cos(alpha); // modulated composite signal
{ }
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; for (int j=0; j<PAL_PHASES; j++)
if (monochrome) sat = 0;
// 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;
for (int j=0; j<16; j++)
{ {
if (hdtv) // HDTV BT.709 // yuv -> rgb, sdtv bt.601
{ R = Round(moire[j]*contrast+bright + 1.13983*V*sat);
R = Round((Y + 1.28033*V*sat)*moire[j]); G = Round(moire[j]*contrast+bright - 0.39465*U*sat - 0.58060*V*sat);
G = Round((Y - 0.21482*U*sat - 0.38059*V*sat)*moire[j]); B = Round(moire[j]*contrast+bright + 2.03211*U*sat );
B = Round((Y + 2.12798*U*sat )*moire[j]);
}
else // SDTV BT.601
{
R = Round((Y + 1.13983*V*sat)*moire[j]);
G = Round((Y - 0.39465*U*sat - 0.58060*V*sat)*moire[j]);
B = Round((Y + 2.03211*U*sat )*moire[j]);
}
// clamp
if (R > 0xff) R = 0xff; else if (R < 0) R = 0; if (R > 0xff) R = 0xff; else if (R < 0) R = 0;
if (G > 0xff) G = 0xff; else if (G < 0) G = 0; if (G > 0xff) G = 0xff; else if (G < 0) G = 0;
if (B > 0xff) B = 0xff; else if (B < 0) B = 0; if (B > 0xff) B = 0xff; else if (B < 0) B = 0;
// store colors to mix
mixR[j] = R; mixR[j] = R;
mixG[j] = G; mixG[j] = G;
mixB[j] = B; mixB[j] = B;
palrgb[i*16+j] = (B<<16)|(G<<8)|R; // moirecolor
palrgb[i*PAL_PHASES+j] = (B<<16)|(G<<8)|R;
} }
for (int j=0; j<16; j++) for (int j=0; j<PAL_PHASES; j++)
{ {
R = (mixR[j]*unnotch + (mixR[0]+mixR[1]+mixR[2]+mixR[3])/4*notch)/100; // mix to simulate notch
G = (mixG[j]*unnotch + (mixG[0]+mixG[1]+mixG[2]+mixG[3])/4*notch)/100; R = (mixR[j]*unnotch + (mixR[0]+mixR[1]+mixR[2]+mixR[3]+mixR[4]+mixR[5])/6*notch)/100;
B = (mixB[j]*unnotch + (mixB[0]+mixB[1]+mixB[2]+mixB[3])/4*notch)/100; G = (mixG[j]*unnotch + (mixG[0]+mixG[1]+mixG[2]+mixG[3]+mixG[4]+mixG[5])/6*notch)/100;
B = (mixB[j]*unnotch + (mixB[0]+mixB[1]+mixB[2]+mixB[3]+mixB[4]+mixB[5])/6*notch)/100;
palrgb2[i*16+j] = (B<<16)|(G<<8)|R; // notchcolor
palrgb2[i*PAL_PHASES+j] = (B<<16)|(G<<8)|R;
} }
} }
palupdate = 0; palupdate = 0;
@ -730,12 +676,12 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
{ {
uint32 *d = (uint32 *)dest; uint32 *d = (uint32 *)dest;
uint8 xsub = 0; uint8 xsub = 0;
uint8 xabs = 0; uint16 xabs = 0;
uint32 index = 0; uint32 index = 0;
uint32 lastindex = 0; uint32 lastindex = 0;
uint32 newindex = 0; uint32 newindex = 0;
int sharp = palsharpness; int sharp = 50 + palsharpness;
int unsharp = 100 - palsharpness; int unsharp = 50 - palsharpness;
int rmask = 0xff0000; int rmask = 0xff0000;
int gmask = 0x00ff00; int gmask = 0x00ff00;
int bmask = 0x0000ff; int bmask = 0x0000ff;
@ -767,62 +713,68 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
*d++ = palettetranslate[temp]; *d++ = palettetranslate[temp];
} }
else else
for (int xsub = 0; xsub < 3; xsub++)
{ {
xabs = x*3 + xsub; for (xsub = 0; xsub < 3; xsub++)
moirecolor = PAL_LUT(palrgb, index, xabs, y);
notchcolor = PAL_LUT(palrgb2, index, xabs, y);
// | | |*|*| | |
if (index != newindex && xsub == 2 ||
index != lastindex && xsub == 0)
{ {
color = moirecolor; xabs = x*3 + xsub;
} moirecolor = PAL_LUT(palrgb, index, xabs, y);
// | |*| | |*| | notchcolor = PAL_LUT(palrgb2, index, xabs, y);
else if (index != newindex && xsub == 1 ||
index != lastindex && xsub == 1)
{
r = ((moirecolor&rmask)*70 + (notchcolor&rmask)*30)/100;
g = ((moirecolor&gmask)*70 + (notchcolor&gmask)*30)/100;
b = ((moirecolor&bmask)*70 + (notchcolor&bmask)*30)/100;
color = r&rmask | g&gmask | b&bmask;
}
// |*| | | | |*|
else if (index != newindex && xsub == 0 ||
index != lastindex && xsub == 2)
{
r = ((moirecolor&rmask)*30 + (notchcolor&rmask)*70)/100;
g = ((moirecolor&gmask)*30 + (notchcolor&gmask)*70)/100;
b = ((moirecolor&bmask)*30 + (notchcolor&bmask)*70)/100;
color = r&rmask | g&gmask | b&bmask;
}
else
{
color = notchcolor;
}
if (color != lastcolor && sharp < 100) // | | |*|*| | |
{ if (index != newindex && xsub == 2 ||
r = ((color&rmask)*sharp + (lastcolor&rmask)*unsharp)/100; index != lastindex && xsub == 0)
g = ((color&gmask)*sharp + (lastcolor&gmask)*unsharp)/100; {
b = ((color&bmask)*sharp + (lastcolor&bmask)*unsharp)/100; r = ((moirecolor&rmask)*90 + (notchcolor&rmask)*10)/100;
finalcolor = r&rmask | g&gmask | b&bmask; g = ((moirecolor&gmask)*90 + (notchcolor&gmask)*10)/100;
b = ((moirecolor&bmask)*90 + (notchcolor&bmask)*10)/100;
color = r&rmask | g&gmask | b&bmask;
}
// | |*| | |*| |
else if (index != newindex && xsub == 1 ||
index != lastindex && xsub == 1)
{
r = ((moirecolor&rmask)*60 + (notchcolor&rmask)*40)/100;
g = ((moirecolor&gmask)*60 + (notchcolor&gmask)*40)/100;
b = ((moirecolor&bmask)*60 + (notchcolor&bmask)*40)/100;
color = r&rmask | g&gmask | b&bmask;
}
// |*| | | | |*|
else if (index != newindex && xsub == 0 ||
index != lastindex && xsub == 2)
{
r = ((moirecolor&rmask)*30 + (notchcolor&rmask)*70)/100;
g = ((moirecolor&gmask)*30 + (notchcolor&gmask)*70)/100;
b = ((moirecolor&bmask)*30 + (notchcolor&bmask)*70)/100;
color = r&rmask | g&gmask | b&bmask;
}
else
{
color = notchcolor;
}
if (color != lastcolor && sharp < 100)
{
r = ((color&rmask)*sharp + (lastcolor&rmask)*unsharp)/100;
g = ((color&gmask)*sharp + (lastcolor&gmask)*unsharp)/100;
b = ((color&bmask)*sharp + (lastcolor&bmask)*unsharp)/100;
finalcolor = r&rmask | g&gmask | b&bmask;
r = ((lastcolor&rmask)*sharp + (color&rmask)*unsharp)/100; r = ((lastcolor&rmask)*sharp + (color&rmask)*unsharp)/100;
g = ((lastcolor&gmask)*sharp + (color&gmask)*unsharp)/100; g = ((lastcolor&gmask)*sharp + (color&gmask)*unsharp)/100;
b = ((lastcolor&bmask)*sharp + (color&bmask)*unsharp)/100; b = ((lastcolor&bmask)*sharp + (color&bmask)*unsharp)/100;
lastcolor = r&rmask | g&gmask | b&bmask; lastcolor = r&rmask | g&gmask | b&bmask;
*d-- = lastcolor; *d-- = lastcolor;
d++; d++;
}
else
finalcolor = color;
lastcolor = color;
*d++ = finalcolor;
} }
else lastindex = index;
finalcolor = color;
lastcolor = *d++ = finalcolor;
} }
lastindex = index;
} }
} }

View File

@ -67,11 +67,11 @@ extern int frameSkipAmt;
extern int32 fps_scale_frameadvance; extern int32 fps_scale_frameadvance;
extern bool symbDebugEnabled; extern bool symbDebugEnabled;
extern bool symbRegNames; extern bool symbRegNames;
extern int palsaturation;
extern int palnotch; extern int palnotch;
extern int palsaturation;
extern int palsharpness; extern int palsharpness;
extern bool palmonochrome; extern int palcontrast;
extern bool palhdtv; extern int palbrightness;
extern TASEDITOR_CONFIG taseditorConfig; extern TASEDITOR_CONFIG taseditorConfig;
extern char* recentProjectsArray[]; extern char* recentProjectsArray[];
@ -185,11 +185,11 @@ static CFGSTRUCT fceuconfig[] =
AC(extrascanlines), AC(extrascanlines),
AC(overclocked), AC(overclocked),
AC(skip_7bit_overclocking), AC(skip_7bit_overclocking),
AC(palsaturation),
AC(palnotch), AC(palnotch),
AC(palsaturation),
AC(palsharpness), AC(palsharpness),
AC(palmonochrome), AC(palcontrast),
AC(palhdtv), AC(palbrightness),
NAC("palyo",pal_emulation), NAC("palyo",pal_emulation),
NAC("genie",genie), NAC("genie",genie),

View File

@ -6,11 +6,11 @@
int cpalette_count = 0; int cpalette_count = 0;
u8 cpalette[64*8*3] = {0}; u8 cpalette[64*8*3] = {0};
extern int palsaturation; extern int palnotch;
extern int palnotch; extern int palsaturation;
extern int palsharpness; extern int palsharpness;
extern bool palhdtv; extern int palcontrast;
extern bool palmonochrome; extern int palbrightness;
bool SetPalette(const char* nameo) bool SetPalette(const char* nameo)
{ {
@ -77,25 +77,33 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if(ntsccol_enable) if(ntsccol_enable)
CheckDlgButton(hwndDlg, CHECK_PALETTE_ENABLED, BST_CHECKED); CheckDlgButton(hwndDlg, CHECK_PALETTE_ENABLED, BST_CHECKED);
SendDlgItemMessage(hwndDlg, CTL_TINT_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_HUE_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 128));
SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 200)); SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 200));
SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR,TBM_SETRANGE, 1, MAKELONG(0, 100)); SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 100));
SendDlgItemMessage(hwndDlg, CTL_PALSHARP_TRACKBAR,TBM_SETRANGE, 1, MAKELONG(0, 100)); SendDlgItemMessage(hwndDlg, CTL_PALSHARP_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 50));
SendDlgItemMessage(hwndDlg, CTL_PALCONTRAST_TRACKBAR,TBM_SETRANGE, 1, MAKELONG(0, 200));
SendDlgItemMessage(hwndDlg, CTL_PALBRIGHT_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 100));
FCEUI_GetNTSCTH(&ntsctint, &ntschue); FCEUI_GetNTSCTH(&ntsctint, &ntschue);
sprintf(text, "Saturation: %d%%", palsaturation);
SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Notch: %d%", palnotch); sprintf(text, "Notch: %d%", palnotch);
SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text); SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Saturation: %d%%", palsaturation);
SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Sharpness: %d%", palsharpness); sprintf(text, "Sharpness: %d%", palsharpness);
SendDlgItemMessage(hwndDlg, STATIC_SHARPVALUE, WM_SETTEXT, 0, (LPARAM) text); SendDlgItemMessage(hwndDlg, STATIC_SHARPVALUE, WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Contrast: %d%", palcontrast);
SendDlgItemMessage(hwndDlg, STATIC_CONTRASTVALUE,WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Brightness: %d%", palbrightness);
SendDlgItemMessage(hwndDlg, STATIC_BRIGHTVALUE, WM_SETTEXT, 0, (LPARAM) text);
SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_SETPOS, 1, ntsctint); SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_SETPOS, 1, ntsctint);
SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_SETPOS, 1, ntschue); SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_SETPOS, 1, ntschue);
SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETPOS, 1, palsaturation); SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETPOS, 1, palsaturation);
SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR,TBM_SETPOS, 1, palnotch); SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR, TBM_SETPOS, 1, palnotch);
SendDlgItemMessage(hwndDlg, CTL_PALSHARP_TRACKBAR,TBM_SETPOS, 1, palsharpness); SendDlgItemMessage(hwndDlg, CTL_PALSHARP_TRACKBAR, TBM_SETPOS, 1, palsharpness);
SendDlgItemMessage(hwndDlg, CTL_PALCONTRAST_TRACKBAR,TBM_SETPOS, 1, palnotch);
SendDlgItemMessage(hwndDlg, CTL_PALBRIGHT_TRACKBAR, TBM_SETPOS, 1, palsharpness);
if(force_grayscale) if(force_grayscale)
CheckDlgButton(hwndDlg, CHECK_PALETTE_GRAYSCALE, BST_CHECKED); CheckDlgButton(hwndDlg, CHECK_PALETTE_GRAYSCALE, BST_CHECKED);
@ -103,29 +111,30 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (eoptions & EO_CPALETTE) if (eoptions & EO_CPALETTE)
CheckDlgButton(hwndDlg, CHECK_PALETTE_CUSTOM, BST_CHECKED); 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); CenterWindowOnScreen(hwndDlg);
break; break;
case WM_HSCROLL: case WM_HSCROLL:
ntsctint = SendDlgItemMessage(hwndDlg, CTL_TINT_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); ntschue = SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
palsaturation = SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0); palnotch = SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
palnotch = SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR,TBM_GETPOS, 0, (LPARAM)(LPSTR)0); palsaturation = SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
palsharpness = SendDlgItemMessage(hwndDlg, CTL_PALSHARP_TRACKBAR,TBM_GETPOS, 0, (LPARAM)(LPSTR)0); palsharpness = SendDlgItemMessage(hwndDlg, CTL_PALSHARP_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
palcontrast = SendDlgItemMessage(hwndDlg, CTL_PALCONTRAST_TRACKBAR,TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
palbrightness = SendDlgItemMessage(hwndDlg, CTL_PALBRIGHT_TRACKBAR, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
FCEUI_SetNTSCTH(ntsccol_enable, ntsctint, ntschue); FCEUI_SetNTSCTH(ntsccol_enable, ntsctint, ntschue);
sprintf(text, "Saturation: %d%%", palsaturation);
SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Notch: %d%", palnotch); sprintf(text, "Notch: %d%", palnotch);
SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text); SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Saturation: %d%%", palsaturation);
SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Sharpness: %d%", palsharpness); sprintf(text, "Sharpness: %d%", palsharpness);
SendDlgItemMessage(hwndDlg, STATIC_SHARPVALUE, WM_SETTEXT, 0, (LPARAM) text); SendDlgItemMessage(hwndDlg, STATIC_SHARPVALUE, WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Contrast: %d%", palcontrast);
SendDlgItemMessage(hwndDlg, STATIC_CONTRASTVALUE,WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Brightness: %d%", palbrightness);
SendDlgItemMessage(hwndDlg, STATIC_BRIGHTVALUE, WM_SETTEXT, 0, (LPARAM) text);
break; break;
case WM_CLOSE: case WM_CLOSE:
@ -153,28 +162,29 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
break; break;
case BTN_PALETTE_RESET: case BTN_PALETTE_RESET:
palnotch = 90;
palsaturation = 100; palsaturation = 100;
SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETPOS, 1, palsaturation); palsharpness = 50;
palcontrast = 50;
palbrightness = 50;
sprintf(text, "Saturation: %d%%", palsaturation); sprintf(text, "Saturation: %d%%", palsaturation);
SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text); SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text);
palnotch = 64;
SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR, TBM_SETPOS, 1, palnotch);
sprintf(text, "Notch: %d%", palnotch); sprintf(text, "Notch: %d%", palnotch);
SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text); SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text);
palsharpness = 100;
SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETPOS, 1, palsharpness);
sprintf(text, "Sharpness: %d%", palsharpness); sprintf(text, "Sharpness: %d%", palsharpness);
SendDlgItemMessage(hwndDlg, STATIC_SHARPVALUE, WM_SETTEXT, 0, (LPARAM) text); SendDlgItemMessage(hwndDlg, STATIC_SHARPVALUE, WM_SETTEXT, 0, (LPARAM) text);
FCEUI_SetNTSCTH(ntsccol_enable, ntsctint, ntschue); sprintf(text, "Contrast: %d%", palcontrast);
break; SendDlgItemMessage(hwndDlg, STATIC_CONTRASTVALUE,WM_SETTEXT, 0, (LPARAM) text);
sprintf(text, "Brightness: %d%", palbrightness);
SendDlgItemMessage(hwndDlg, STATIC_BRIGHTVALUE, WM_SETTEXT, 0, (LPARAM) text);
SendDlgItemMessage(hwndDlg, CTL_PALBRIGHT_TRACKBAR, TBM_SETPOS, 1, palsharpness);
SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETPOS, 1, palsaturation);
SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR, TBM_SETPOS, 1, palnotch);
SendDlgItemMessage(hwndDlg, CTL_PALSHARP_TRACKBAR, TBM_SETPOS, 1, palsharpness);
SendDlgItemMessage(hwndDlg, CTL_PALCONTRAST_TRACKBAR,TBM_SETPOS, 1, palnotch);
case CHECK_PALETTE_MONOCHROME:
palmonochrome ^= 1;
FCEUI_SetNTSCTH(ntsccol_enable, ntsctint, ntschue);
break;
case CHECK_PALETTE_HDTV:
palhdtv ^= 1;
FCEUI_SetNTSCTH(ntsccol_enable, ntsctint, ntschue); FCEUI_SetNTSCTH(ntsccol_enable, ntsctint, ntschue);
break; break;

View File

@ -362,16 +362,18 @@ BEGIN
CONTROL "Force Grayscale",CHECK_PALETTE_GRAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,67,85,12 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 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 GROUPBOX "PAL Emulation",IDC_STATIC,10,89,208,61
CONTROL "",CTL_PALSAT_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,11,110,63,15 CONTROL "",CTL_PALSAT_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,78,110,70,15
LTEXT "Saturation:",STATIC_SATVALUE,17,100,58,8 LTEXT "Saturation:",STATIC_SATVALUE,83,100,58,8
PUSHBUTTON "Reset",BTN_PALETTE_RESET,22,132,50,14 PUSHBUTTON "Reset",BTN_PALETTE_RESET,161,132,50,14
CONTROL "Monochrome",CHECK_PALETTE_MONOCHROME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,134,57,10 CONTROL "",CTL_PALNOTCH_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,11,110,68,15
CONTROL "HDTV Colormatrix",CHECK_PALETTE_HDTV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,135,72,10 LTEXT "Notch:",STATIC_NOTCHVALUE,16,100,46,8
CONTROL "",CTL_PALNOTCH_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,79,110,64,15 CONTROL "",CTL_PALSHARP_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,156,109,61,15
LTEXT "Notch:",STATIC_NOTCHVALUE,85,100,46,8 LTEXT "Sharpness:",STATIC_SHARPVALUE,161,99,50,8
CONTROL "",CTL_PALSHARP_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,147,109,70,15
LTEXT "Sharpness:",STATIC_SHARPVALUE,153,99,50,8
LTEXT "NTSC Color Emulation overrides Internal default Palette.\nIndividual Game Palette overrides Internal+NTSC Palettes.\nCustom Palette overrides all of the above.\nPAL Emulation overrides other choices when PAL filter is selected",IDC_STATIC,10,156,208,33 LTEXT "NTSC Color Emulation overrides Internal default Palette.\nIndividual Game Palette overrides Internal+NTSC Palettes.\nCustom Palette overrides all of the above.\nPAL Emulation overrides other choices when PAL filter is selected",IDC_STATIC,10,156,208,33
CONTROL "",CTL_PALCONTRAST_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,11,134,67,15
LTEXT "Contrast: ",STATIC_CONTRASTVALUE,16,126,55,8
CONTROL "",CTL_PALBRIGHT_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,78,133,70,15
LTEXT "Brightness: ",STATIC_BRIGHTVALUE,83,125,61,8
END END
POWERPADDIALOG DIALOG 30, 123, 131, 119 POWERPADDIALOG DIALOG 30, 123, 131, 119

View File

@ -636,7 +636,6 @@
#define IDC_AUTORESUMECDLOGGING 1203 #define IDC_AUTORESUMECDLOGGING 1203
#define IDC_MASK_UNUSED_GRAPHICS 1203 #define IDC_MASK_UNUSED_GRAPHICS 1203
#define CHECK_SOUND_SWAPDUTY 1203 #define CHECK_SOUND_SWAPDUTY 1203
#define CHECK_PALETTE_MONOCHROME 1203
#define CB_OVERCLOCKING 1203 #define CB_OVERCLOCKING 1203
#define IDC_VOLUMEGROUP 1204 #define IDC_VOLUMEGROUP 1204
#define IDC_OMITBLANK 1204 #define IDC_OMITBLANK 1204
@ -764,14 +763,16 @@
#define ID_CDL_OPTIONS 1287 #define ID_CDL_OPTIONS 1287
#define ID_CDL_GENERATEROM 1288 #define ID_CDL_GENERATEROM 1288
#define CTL_PALSAT_TRACKBAR 1291 #define CTL_PALSAT_TRACKBAR 1291
#define CHECK_PALETTE_HDTV 1292
#define CB_SKIP_7BIT 1293 #define CB_SKIP_7BIT 1293
#define STATIC_SATVALUE 1294 #define STATIC_SATVALUE 1294
#define CTL_PALNOTCH_TRACKBAR 1295 #define CTL_PALNOTCH_TRACKBAR 1295
#define STATIC_NOTCHVALUE 1296 #define STATIC_NOTCHVALUE 1296
#define CTL_PALSHARP_TRACKBAR 1297 #define CTL_PALSHARP_TRACKBAR 1297
#define IDC_SLIDER1 1297
#define STATIC_SHARPVALUE 1298 #define STATIC_SHARPVALUE 1298
#define CTL_PALCONTRAST_TRACKBAR 1299
#define STATIC_CONTRASTVALUE 1300
#define CTL_PALBRIGHT_TRACKBAR 1301
#define STATIC_BRIGHTVALUE 1302
#define MENU_NETWORK 40040 #define MENU_NETWORK 40040
#define MENU_PALETTE 40041 #define MENU_PALETTE 40041
#define MENU_SOUND 40042 #define MENU_SOUND 40042
@ -1236,7 +1237,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 291 #define _APS_NEXT_RESOURCE_VALUE 291
#define _APS_NEXT_COMMAND_VALUE 40596 #define _APS_NEXT_COMMAND_VALUE 40596
#define _APS_NEXT_CONTROL_VALUE 1298 #define _APS_NEXT_CONTROL_VALUE 1303
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif