Merge branch 'master' of https://github.com/TASVideos/fceux
This commit is contained in:
commit
24600dece2
|
@ -97,7 +97,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
scalerSelect->addItem( tr("Prescale 2x"), 6 );
|
||||
scalerSelect->addItem( tr("Prescale 3x"), 7 );
|
||||
scalerSelect->addItem( tr("Prescale 4x"), 8 );
|
||||
scalerSelect->addItem( tr("PAL"), 9 );
|
||||
scalerSelect->addItem( tr("PAL 3x"), 9 );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
|
||||
|
|
|
@ -239,18 +239,10 @@ int ConsoleViewSDL_t::init(void)
|
|||
|
||||
windowHandle = this->winId();
|
||||
|
||||
//printf("Window Handle: %llu \n", windowHandle );
|
||||
|
||||
//sleep(1);
|
||||
|
||||
#ifdef WIN32
|
||||
if (sdlWindow == NULL)
|
||||
{
|
||||
sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle);
|
||||
}
|
||||
#else
|
||||
sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle);
|
||||
#endif
|
||||
|
||||
if (sdlWindow == NULL)
|
||||
{
|
||||
|
@ -258,6 +250,8 @@ int ConsoleViewSDL_t::init(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
SDL_ShowWindow( sdlWindow );
|
||||
|
||||
uint32_t baseFlags = vsyncEnabled ? SDL_RENDERER_PRESENTVSYNC : 0;
|
||||
|
||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, baseFlags | SDL_RENDERER_ACCELERATED);
|
||||
|
@ -304,6 +298,11 @@ void ConsoleViewSDL_t::cleanup(void)
|
|||
SDL_DestroyRenderer(sdlRenderer);
|
||||
sdlRenderer = NULL;
|
||||
}
|
||||
if ( sdlWindow )
|
||||
{
|
||||
SDL_DestroyWindow( sdlWindow );
|
||||
sdlWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::reset(void)
|
||||
|
|
|
@ -90,7 +90,7 @@ HotKeyConfDialog_t::HotKeyConfDialog_t(QWidget *parent)
|
|||
|
||||
}
|
||||
|
||||
connect( tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(hotKeyDoubleClicked(QTreeWidgetItem*,int) ) );
|
||||
//connect( tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(hotKeyDoubleClicked(QTreeWidgetItem*,int) ) );
|
||||
connect( tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(hotKeyActivated(QTreeWidgetItem*,int) ) );
|
||||
|
||||
mainLayout->addWidget(tree);
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
|
||||
// GLOBALS
|
||||
extern Config *g_config;
|
||||
extern bool force_grayscale;
|
||||
|
||||
// STATIC GLOBALS
|
||||
static int s_curbpp = 0;
|
||||
|
@ -363,21 +362,9 @@ FCEUD_SetPalette(uint8 index,
|
|||
uint8 g,
|
||||
uint8 b)
|
||||
{
|
||||
if ( force_grayscale )
|
||||
{
|
||||
// convert the palette entry to grayscale
|
||||
int gray = ((float)r * 0.299 + (float)g * 0.587 + (float)b * 0.114);
|
||||
|
||||
s_psdl[index].r = gray;
|
||||
s_psdl[index].g = gray;
|
||||
s_psdl[index].b = gray;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_psdl[index].r = r;
|
||||
s_psdl[index].g = g;
|
||||
s_psdl[index].b = b;
|
||||
}
|
||||
s_psdl[index].r = r;
|
||||
s_psdl[index].g = g;
|
||||
s_psdl[index].b = b;
|
||||
|
||||
s_paletterefresh = 1;
|
||||
}
|
||||
|
|
|
@ -115,19 +115,9 @@ int RestoreDD(int w)
|
|||
|
||||
void FCEUD_SetPalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
if (force_grayscale)
|
||||
{
|
||||
// convert the palette entry to grayscale
|
||||
int gray = ((float)r * 0.299 + (float)g * 0.587 + (float)b * 0.114);
|
||||
color_palette[index].peRed = gray;
|
||||
color_palette[index].peGreen = gray;
|
||||
color_palette[index].peBlue = gray;
|
||||
} else
|
||||
{
|
||||
color_palette[index].peRed = r;
|
||||
color_palette[index].peGreen = g;
|
||||
color_palette[index].peBlue = b;
|
||||
}
|
||||
color_palette[index].peRed = r;
|
||||
color_palette[index].peGreen = g;
|
||||
color_palette[index].peBlue = b;
|
||||
PaletteChanged=1;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <cstring>
|
||||
|
||||
bool force_grayscale = false;
|
||||
pal *grayscaled_palo = NULL;
|
||||
|
||||
pal palette_game[64*8]; //custom palette for an individual game. (formerly palettei)
|
||||
pal palette_user[64*8]; //user's overridden palette (formerly palettec)
|
||||
|
@ -526,6 +527,29 @@ static void ChoosePalette(void)
|
|||
//need to calcualte a deemph on the fly.. sorry. maybe support otherwise later
|
||||
ApplyDeemphasisComplete(palo);
|
||||
}
|
||||
if (force_grayscale)
|
||||
{
|
||||
// need to apply grayscale filter
|
||||
// allocate memory for grayscale palette
|
||||
if (grayscaled_palo == NULL)
|
||||
grayscaled_palo = (pal*)malloc(sizeof(pal) * 64 * 8);
|
||||
// make every color grayscale
|
||||
for (int x = 0; x < 64 * 8; x++)
|
||||
{
|
||||
uint8 gray = ((float)palo[x].r * 0.299 + (float)palo[x].g * 0.587 + (float)palo[x].b * 0.114);
|
||||
grayscaled_palo[x].r = gray;
|
||||
grayscaled_palo[x].g = gray;
|
||||
grayscaled_palo[x].b = gray;
|
||||
}
|
||||
// apply new palette
|
||||
palo = grayscaled_palo;
|
||||
}
|
||||
else if (grayscaled_palo != NULL)
|
||||
{
|
||||
// free allocated memory if the grayscale filter is not used anymore
|
||||
free(grayscaled_palo);
|
||||
grayscaled_palo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void WritePalette(void)
|
||||
|
|
Loading…
Reference in New Issue