fix palettes, widescreen correction

This commit is contained in:
dborth 2008-11-05 08:36:01 +00:00
parent b5297f450e
commit c8aeaea342
4 changed files with 35 additions and 25 deletions

View File

@ -148,6 +148,7 @@ int main(int argc, char *argv[])
setFrameTimer(); // set frametimer method before emulation
FCEUI_SetVidSystem(GCSettings.timing);
SetPalette();
FCEUI_SetSoundQuality(1); // 0 - low, 1 - high, 2 - high (alt.)
ResetVideo_Emu();

View File

@ -23,6 +23,8 @@
#include "menudraw.h"
#include "images/nesback.h"
extern void FCEU_ResetPalette(void);
extern unsigned int SMBTimer;
int FDSTimer = 0;
u32 FrameTimer = 0;
@ -499,7 +501,7 @@ InitGCVideo ()
/* we have component cables, but the preferred mode is interlaced
* why don't we switch into progressive?
* on the Wii, the user can do this themselves on their Wii Settings */
if(VIDEO_HaveComponentCable() && vmode == &TVNtsc480IntDf)
if(VIDEO_HaveComponentCable())
vmode = &TVNtsc480Prog;
#endif
@ -507,6 +509,10 @@ InitGCVideo ()
if (vmode->viTVMode == VI_TVMODE_NTSC_PROG)
progressive = true;
// widescreen fix
vmode->viWidth = 678;
vmode->viXOrigin = (VI_MAX_WIDTH_PAL - 678) / 2;
// configure VI
VIDEO_Configure (vmode);
@ -846,6 +852,31 @@ void FCEUD_GetPalette(unsigned char i, unsigned char *r, unsigned char *g,
*b = pcpalette[i].b;
}
void SetPalette()
{
if ( GCSettings.currpal == 0 )
{
// Do palette reset
FCEU_ResetPalette();
}
else
{
// Now setup this palette
unsigned char i,r,g,b;
for ( i = 0; i < 64; i++ )
{
r = palettes[GCSettings.currpal-1].data[i] >> 16;
g = ( palettes[GCSettings.currpal-1].data[i] & 0xff00 ) >> 8;
b = ( palettes[GCSettings.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);
}
}
}
struct st_palettes palettes[] = {
/* The default NES palette must be the first entry in the array */
{ "loopy", "Loopy's NES palette",

View File

@ -21,12 +21,13 @@ void RenderFrame(unsigned char *XBuf);
void setFrameTimer();
void zoom (float speed);
void zoom_reset ();
void SetPalette();
// color palettes
#define MAXPAL 12
struct st_palettes {
char *name, *desc;
char name[32], desc[32];
unsigned int data[64];
};

View File

@ -39,7 +39,6 @@
extern void ResetNES(void);
extern void PowerNES(void);
extern void FCEU_ResetPalette(void);
extern int menu;
extern bool romLoaded;
@ -172,28 +171,6 @@ VideoOptions ()
case 2: // palette
if ( ++GCSettings.currpal > MAXPAL )
GCSettings.currpal = 0;
if ( GCSettings.currpal == 0 )
{
// Do palette reset
FCEU_ResetPalette();
}
else
{
// Now setup this palette
unsigned char i,r,g,b;
for ( i = 0; i < 64; i++ )
{
r = palettes[GCSettings.currpal-1].data[i] >> 16;
g = ( palettes[GCSettings.currpal-1].data[i] & 0xff00 ) >> 8;
b = ( palettes[GCSettings.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 3: