Exemplo n.º 1
0
void SetNESDeemph(uint8 d, int force) {
	static uint16 rtmul[7] = { 32768 * 1.239, 32768 * .794, 32768 * 1.019, 32768 * .905, 32768 * 1.023, 32768 * .741, 32768 * .75 };
	static uint16 gtmul[7] = { 32768 * .915, 32768 * 1.086, 32768 * .98, 32768 * 1.026, 32768 * .908, 32768 * .987, 32768 * .75 };
	static uint16 btmul[7] = { 32768 * .743, 32768 * .882, 32768 * .653, 32768 * 1.277, 32768 * .979, 32768 * .101, 32768 * .75 };
	uint32 r, g, b;
	int x;

	/* If it's not forced(only forced when the palette changes),
	don't waste cpu time if the same deemphasis bits are set as the last call. */
	if (!force) {
		if (d == lastd)
			return;
	} else {	/* Only set this when palette has changed. */
		r = rtmul[6];
		g = rtmul[6];
		b = rtmul[6];

		for (x = 0; x < 0x40; x++) {
			uint32 m, n, o;
			m = palo[x].r;
			n = palo[x].g;
			o = palo[x].b;
			m = (m * r) >> 15;
			n = (n * g) >> 15;
			o = (o * b) >> 15;
			if (m > 0xff) m = 0xff;
			if (n > 0xff) n = 0xff;
			if (o > 0xff) o = 0xff;
			FCEUD_SetPalette(x | 0xC0, m, n, o);
		}
	}
	if (!d) return;	/* No deemphasis, so return. */

	r = rtmul[d - 1];
	g = gtmul[d - 1];
	b = btmul[d - 1];

	for (x = 0; x < 0x40; x++) {
		uint32 m, n, o;

		m = palo[x].r;
		n = palo[x].g;
		o = palo[x].b;
		m = (m * r) >> 15;
		n = (n * g) >> 15;
		o = (o * b) >> 15;
		if (m > 0xff) m = 0xff;
		if (n > 0xff) n = 0xff;
		if (o > 0xff) o = 0xff;

		FCEUD_SetPalette(x | 0x40, m, n, o);
	}

	lastd = d;
}
Exemplo n.º 2
0
void WritePalette(void)
{
	int x;

	for(x=0;x<7;x++)
		FCEUD_SetPalette(x,unvpalette[x].r,unvpalette[x].g,unvpalette[x].b);

	for(x=0;x<64;x++)
		FCEUD_SetPalette(128+x,palo[x].r,palo[x].g,palo[x].b);
	SetNESDeemph(lastd,1);
}
Exemplo n.º 3
0
void WritePalette(void) {
	int x;

	for (x = 0; x < 7; x++)
		FCEUD_SetPalette(x, unvpalette[x].r, unvpalette[x].g, unvpalette[x].b);
	if (GameInfo->type == GIT_NSF) {
	} else {
		for (x = 0; x < 64; x++)
			FCEUD_SetPalette(128 + x, palo[x].r, palo[x].g, palo[x].b);
		SetNESDeemph(lastd, 1);
	}
}
Exemplo n.º 4
0
void WritePalette(void)
{
	int x;

	for(x=0;x<7;x++)
		FCEUD_SetPalette(x,unvpalette[x].r,unvpalette[x].g,unvpalette[x].b);
	if(GameInfo->type==GIT_NSF)
	{
		#ifdef _S9XLUA_H
		FCEU_LuaUpdatePalette();
		#endif
		//for(x=0;x<128;x++)
		// FCEUD_SetPalette(x,x,0,x);
	}
	else
	{
		for(x=0;x<64;x++)
			FCEUD_SetPalette(128+x,palo[x].r,palo[x].g,palo[x].b);
		SetNESDeemph(lastd,1);
	}
}
Exemplo n.º 5
0
void WritePalette(void)
{
	int x;

	//set the 'unvarying' palettes to low < 64 palette entries
	for(x=0;x<7;x++)
		FCEUD_SetPalette(x,palette_unvarying[x].r,palette_unvarying[x].g,palette_unvarying[x].b);

	//clear everything else to a deterministic state.
	//it seems likely that the text rendering on NSF has been broken since the beginning of fceux, depending on palette entries 205,205,205 everywhere
	//this was just whatever msvc filled malloc with. on non-msvc platforms, there was no backdrop on the rendering.
	for(x=7;x<256;x++)
		FCEUD_SetPalette(x,205,205,205);

	//sets palette entries >= 128 with the 64 selected main colors
	for(x=0;x<64;x++)
		FCEUD_SetPalette(128+x,palo[x].r,palo[x].g,palo[x].b);
	SetNESDeemph_OldHacky(lastd,1);
	#ifdef _S9XLUA_H
	FCEU_LuaUpdatePalette();
	#endif
}
Exemplo n.º 6
0
void SetNESDeemph_OldHacky(uint8 d, int force)
{
	static uint16 rtmul[]={
        static_cast<uint16>(32768*1.239),
        static_cast<uint16>(32768*.794),
        static_cast<uint16>(32768*1.019),
        static_cast<uint16>(32768*.905),
        static_cast<uint16>(32768*1.023),
        static_cast<uint16>(32768*.741),
        static_cast<uint16>(32768*.75)
    };
	static uint16 gtmul[]={
        static_cast<uint16>(32768*.915),
        static_cast<uint16>(32768*1.086),
        static_cast<uint16>(32768*.98),
        static_cast<uint16>(32768*1.026),
        static_cast<uint16>(32768*.908),
        static_cast<uint16>(32768*.987),
        static_cast<uint16>(32768*.75)
    };
	static uint16 btmul[]={
        static_cast<uint16>(32768*.743),
        static_cast<uint16>(32768*.882),
        static_cast<uint16>(32768*.653),
        static_cast<uint16>(32768*1.277),
        static_cast<uint16>(32768*.979),
        static_cast<uint16>(32768*.101),
        static_cast<uint16>(32768*.75)
    };

	uint32 r,g,b;
	int x;

	/* If it's not forced(only forced when the palette changes),
	don't waste cpu time if the same deemphasis bits are set as the last call.
	*/
	if(!force)
	{
		if(d==lastd)
			return;
	}
	else   /* Only set this when palette has changed. */
	{
		#ifdef _S9XLUA_H
		FCEU_LuaUpdatePalette();
		#endif

		r=rtmul[6];
		g=rtmul[6];
		b=rtmul[6];

		for(x=0;x<0x40;x++)
		{
			uint32 m,n,o;
			m=palo[x].r;
			n=palo[x].g;
			o=palo[x].b;
			m=(m*r)>>15;
			n=(n*g)>>15;
			o=(o*b)>>15;
			if(m>0xff) m=0xff;
			if(n>0xff) n=0xff;
			if(o>0xff) o=0xff;
			FCEUD_SetPalette(x|0xC0,m,n,o);
		}
	}
	if(!d) return; /* No deemphasis, so return. */

	r=rtmul[d-1];
	g=gtmul[d-1];
	b=btmul[d-1];

	for(x=0;x<0x40;x++)
	{
		uint32 m,n,o;

		m=palo[x].r;
		n=palo[x].g;
		o=palo[x].b;
		m=(m*r)>>15;
		n=(n*g)>>15;
		o=(o*b)>>15;
		if(m>0xff) m=0xff;
		if(n>0xff) n=0xff;
		if(o>0xff) o=0xff;

		FCEUD_SetPalette(x|0x40,m,n,o);
	}

	lastd=d;
	#ifdef _S9XLUA_H
	FCEU_LuaUpdatePalette();
	#endif
}
Exemplo n.º 7
0
int VideoEnhancements()
{	
	int menu = 0;
	int quit = 0;
	short j;
	int redraw = 1;
	int i;
	unsigned char r,g,b;

	line = 0;
	scrollerx = 320 - MARGIN;

	while ( quit == 0)
	{
		if ( redraw )
			DrawMenu(&vemenu[0], vecount, menu );

		redraw = 0;

		j = PAD_ButtonsDown(0);

		if ( j & PAD_BUTTON_DOWN ) {
			menu++;
			redraw = 1;
		}

		if ( j & PAD_BUTTON_UP ) {
			menu--;
			redraw = 1;
		}

		if ( j & PAD_BUTTON_A ) {
			redraw = 1;
			switch ( menu ) {
				case 0:	/*** Scaler ***/
					screenscaler++;
					screenscaler = ( screenscaler > 2 ) ? 0 : screenscaler;

					switch ( screenscaler )
					{
						case 2: strcpy(vemenu[0], "Screen Scaler - GX"); break;
						case 1: strcpy(vemenu[0], "Screen Scaler - Cheesy"); break;
						case 0:	strcpy(vemenu[0], "Screen Scaler - 2x"); break;
					}
					break;
				case 1: /*** Palette ***/
					currpal++;
					if ( currpal > MAXPAL )
						currpal = 0;

					if ( currpal == 0 ) {
						strcpy(vemenu[1],"Palette - Default");
						/*** Do palette reset ***/
						FCEU_ResetPalette();
					} else {
						strcpy(vemenu[1],"Palette - ");
						strcat(vemenu[1], palettes[currpal-1].name);

						/*** Now setup this palette ***/
						for ( i = 0; i < 64; i++ )
						{
							r = palettes[currpal-1].data[i] >> 16;
							g = ( palettes[currpal-1].data[i] & 0xff00 ) >> 8;
							b = ( palettes[currpal-1].data[i] & 0xff );
							FCEUD_SetPalette( i, r, g, b);
							FCEUD_SetPalette( i+64, r, g, b);
							FCEUD_SetPalette( i+128, r, g, b);
							FCEUD_SetPalette( i+192, r, g, b);

						}
					}

					break;

				case 2: slimit ^=1;
					if ( slimit )
						strcpy(vemenu[2], "8 Sprite Limit - ON ");
					else
						strcpy(vemenu[2], "8 Sprite Limit - OFF");
					FCEUI_DisableSpriteLimitation( slimit );
					break;

				case 3: timing ^= 1;
					if ( timing )
						strcpy(vemenu[3], "Timing - PAL ");
					else
						strcpy(vemenu[3], "Timing - NTSC");

					FCEUI_SetVidSystem( timing );
					
					break;

				case 4: quit = 1; break;

				default: break;

			}
		}
		
		if ( j & PAD_BUTTON_B ) quit = 1;
		if ( menu < 0 )
			menu = vecount - 1;

		if ( menu == vecount )
			menu = 0;

		scroller(SCROLLY, &vestext[0], 2);	
        VIDEO_WaitVSync();

	}