Use macro and minor offset adjustment

This commit is contained in:
negative 2024-01-25 18:10:48 +08:00
parent 8e935a05a6
commit 82a99060e5
No known key found for this signature in database
2 changed files with 9 additions and 7 deletions

View File

@ -62,8 +62,10 @@ static int s_fullscreen = 0;
static int noframe = 0; static int noframe = 0;
static int initBlitToHighDone = 0; static int initBlitToHighDone = 0;
#define NWIDTH (256 - (s_clipSides ? 16 : 0)) #define NWIDTH (256 - (s_clipSides ? 16 : 0))
#define NOFFSET (s_clipSides ? 8 : 0) #define NOFFSET (s_clipSides ? 8 : 0)
#define NTSCWIDTH (301 - (s_clipSides ? 19 : 0))
static int s_paletterefresh = 1; static int s_paletterefresh = 1;
@ -168,7 +170,7 @@ void CalcVideoDimensions(void)
int iScale = nes_shm->video.xscale; int iScale = nes_shm->video.xscale;
if ( s_sponge == 3 ) if ( s_sponge == 3 )
{ {
nes_shm->video.ncol = iScale*(301-(ClipSidesOffset ? 21 : 0)); nes_shm->video.ncol = iScale*NTSCWIDTH;
} }
else else
{ {
@ -264,7 +266,7 @@ int InitVideo(FCEUGI *gi)
int iScale = nes_shm->video.xscale; int iScale = nes_shm->video.xscale;
if ( s_sponge == 3 ) if ( s_sponge == 3 )
{ {
nes_shm->video.ncol = iScale*(301-(ClipSidesOffset ? 21 : 0)); nes_shm->video.ncol = iScale*NTSCWIDTH;
} }
else else
{ {
@ -446,7 +448,7 @@ doBlitScreen(uint8_t *XBuf, uint8_t *dest)
if ( s_sponge == 3 ) if ( s_sponge == 3 )
{ {
w = ixScale*(301-(ClipSidesOffset ? 21 : 0)); w = ixScale*NTSCWIDTH;
bw = 256; bw = 256;
} }
else else
@ -539,7 +541,7 @@ uint32 PtoV(double nx, double ny)
if ( nes_shm->video.preScaler == 3 ) if ( nes_shm->video.preScaler == 3 )
{ {
x = (int)( nx * (double)nes_shm->video.ncol * (256.0/(301.0-(ClipSidesOffset ? 21 : 0))) ); x = (int)( nx * (double)nes_shm->video.ncol * (256.0/301.0) );
} }
else else
{ {

View File

@ -859,7 +859,7 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
{ {
case 4: case 4:
if ( nes_ntsc && GameInfo && GameInfo->type!=GIT_NSF) { if ( nes_ntsc && GameInfo && GameInfo->type!=GIT_NSF) {
int outxr = 301 - (ClipSidesOffset ? 21 : 0); int outxr = 301 - (ClipSidesOffset ? 19 : 0);
//if(xr == 282) outxr = 282; //hack for windows //if(xr == 282) outxr = 282; //hack for windows
burst_phase ^= 1; burst_phase ^= 1;
u8* srcD = XDBuf + (src-XBuf); // get deemphasis buffer u8* srcD = XDBuf + (src-XBuf); // get deemphasis buffer