diff --git a/source/Frame.cpp b/source/Frame.cpp index 8040acb6..dad6123e 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -246,7 +246,7 @@ UINT Get3DBorderHeight(void) } // ========================================================================== -extern bool g_VideoTVMode1_29_1_0; + static void GetAppleWindowTitle() { static TCHAR g_pAppleWindowTitle[ 128 ] = ""; @@ -269,7 +269,6 @@ static void GetAppleWindowTitle() #if _DEBUG _tcscat( g_pAppleWindowTitle, " *DEBUG* " ); #endif - if (g_VideoTVMode1_29_1_0) _tcscat( g_pAppleWindowTitle, " 1.29.1 " ); if (g_nAppMode == MODE_LOGO) return; @@ -1416,9 +1415,6 @@ LRESULT CALLBACK FrameWndProc ( case '3': // Speed = Full-Speed g_dwSpeed = SPEED_MAX; keyHandled = true; break; - case '9': - g_VideoTVMode1_29_1_0 = !g_VideoTVMode1_29_1_0; - DrawStatusArea( (HDC)0, DRAW_TITLE ); default: break; } diff --git a/source/NTSC.cpp b/source/NTSC.cpp index 1bed5241..63e8cd86 100644 --- a/source/NTSC.cpp +++ b/source/NTSC.cpp @@ -499,6 +499,7 @@ inline uint32_t* getScanlineNext() } //=========================================================================== +#if 0 inline uint32_t* getScanlinePreviousInbetween() { return (uint32_t*) (g_pVideoAddress + 1*g_kFrameBufferWidth); @@ -508,7 +509,7 @@ inline uint32_t* getScanlinePrevious() { return (uint32_t*) (g_pVideoAddress + 2*g_kFrameBufferWidth); } - +#endif //=========================================================================== inline uint32_t* getScanlineCurrent() { @@ -595,31 +596,13 @@ inline void updateFlashRate() // TODO: Flash rate should be constant (regardless #else //=========================================================================== -extern bool g_VideoTVMode1_29_1_0; +// GH#650: Changed TV-Single/Double to use next scanline for blending (was previous). + +// Original: Prev1(inbetween) = current - 25% of previous AppleII scanline +// GH#650: Next1(inbetween) = 50% of (50% current + 50% of next AppleII scanline) inline void updateFramebufferColorTVSingleScanline( uint16_t signal, bgra_t *pTable ) { uint32_t *pLine0Curr = getScanlineCurrent(); - if (g_VideoTVMode1_29_1_0) { - uint32_t *pLine1Prev = getScanlinePreviousInbetween(); // NB. TV mode uses previous 2 lines - const uint32_t *pLine2Prev = getScanlinePrevious(); - - const uint32_t color0 = getScanlineColor( signal, pTable ); - const uint32_t color2 = *pLine2Prev; -// const uint32_t color1 = color0 - ((color2 & 0x00fcfcfc) >> 2); // BUG? color0 - color0? not color0-color2? - // TC: The above operation "color0 - ((color2 & 0x00fcfcfc) >> 2)" causes underflow, so I've recoded to clamp on underflow: - uint32_t color1; - { - int r=(color0>>16)&0xff, g=(color0>>8)&0xff, b=color0&0xff; - uint32_t color2_prime = (color2 & 0x00fcfcfc) >> 2; - r -= (color2_prime>>16)&0xff; if (r<0) r=0; // clamp to 0 on underflow - g -= (color2_prime>>8)&0xff; if (g<0) g=0; // clamp to 0 on underflow - b -= (color2_prime)&0xff; if (b<0) b=0; // clamp to 0 on underflow - color1 = (r<<16)|(g<<8)|(b); - } - - *pLine1Prev = color1 | ALPHA32_MASK; - *pLine0Curr = color0; - } else { uint32_t *pLine1Next = getScanlineNextInbetween(); uint32_t *pLine2Next = getScanlineNext(); const uint32_t color0 = getScanlineColor( signal, pTable ); @@ -629,25 +612,16 @@ inline void updateFramebufferColorTVSingleScanline( uint16_t signal, bgra_t *pTa *pLine1Next = color1 | ALPHA32_MASK; *pLine0Curr = color0; - } g_pVideoAddress++; } //=========================================================================== + +// Original: Prev1(inbetween) = 50% current + 50% of previous AppleII scanline +// GH#650: Next1(inbetween) = 50% current + 50% of next AppleII scanline inline void updateFramebufferColorTVDoubleScanline( uint16_t signal, bgra_t *pTable ) { uint32_t *pLine0Curr = getScanlineCurrent(); - if (g_VideoTVMode1_29_1_0) { - uint32_t *pLine1Prev = getScanlinePreviousInbetween(); // NB. TV mode uses previous 2 lines - const uint32_t *pLine2Prev = getScanlinePrevious(); - - const uint32_t color0 = getScanlineColor( signal, pTable ); - const uint32_t color2 = *pLine2Prev; - const uint32_t color1 = ((color0 & 0x00fefefe) >> 1) + ((color2 & 0x00fefefe) >> 1); // 50% Blend - - *pLine1Prev = color1 | ALPHA32_MASK; - *pLine0Curr = color0; - } else { uint32_t *pLine1Next = getScanlineNextInbetween(); uint32_t *pLine2Next = getScanlineNext(); const uint32_t color0 = getScanlineColor( signal, pTable ); @@ -656,7 +630,6 @@ inline void updateFramebufferColorTVDoubleScanline( uint16_t signal, bgra_t *pTa *pLine1Next = color1 | ALPHA32_MASK; *pLine0Curr = color0; - } g_pVideoAddress++; } @@ -664,7 +637,7 @@ inline void updateFramebufferColorTVDoubleScanline( uint16_t signal, bgra_t *pTa inline void updateFramebufferMonitorSingleScanline( uint16_t signal, bgra_t *pTable ) { uint32_t *pLine0Curr = getScanlineCurrent(); - uint32_t *pLine1Next = getScanlineNextInbetween(); // NB. Monitor mode just uses next (inbetween) line + uint32_t *pLine1Next = getScanlineNextInbetween(); const uint32_t color0 = getScanlineColor( signal, pTable ); const uint32_t color1 = 0; // Remove blending for consistent DHGR MIX mode (GH#631) // const uint32_t color1 = ((color0 & 0x00fcfcfc) >> 2); // 25% Blend (original) @@ -678,7 +651,7 @@ inline void updateFramebufferMonitorSingleScanline( uint16_t signal, bgra_t *pTa inline void updateFramebufferMonitorDoubleScanline( uint16_t signal, bgra_t *pTable ) { uint32_t *pLine0Curr = getScanlineCurrent(); - uint32_t *pLine1Next = getScanlineNextInbetween(); // NB. Monitor mode just uses next (inbetween) line + uint32_t *pLine1Next = getScanlineNextInbetween(); const uint32_t color0 = getScanlineColor( signal, pTable ); *pLine1Next = color0; diff --git a/source/Video.cpp b/source/Video.cpp index a0f079e8..e02a7739 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -96,8 +96,6 @@ static bool g_bVideoScannerNTSC = true; // NTSC video scanning (or PAL) static LPDIRECTDRAW g_lpDD = NULL; -bool g_VideoTVMode1_29_1_0 = false; - //------------------------------------- // NOTE: KEEP IN SYNC: VideoType_e g_aVideoChoices g_apVideoModeDesc @@ -561,26 +559,6 @@ void VideoRedrawScreen (void) //=========================================================================== -// TC: Hacky-fix for GH#341 - better to draw to the correct position in the framebuffer to start with! (in NTSC.cpp) -// . NB. Now the dx is corrected in NTSC.cpp, updateVideoScannerAddress() -static void VideoFrameBufferAdjust(int& xSrc, int& ySrc, bool bInvertY=false) -{ - int dx=0, dy=0; - - if (g_eVideoType == VT_MONO_TV || g_eVideoType == VT_COLOR_TV) - { - // Adjust the src locations for the NTSC video modes - if (g_VideoTVMode1_29_1_0) - dy = -1; - } - - if (bInvertY) - dy =- dy; - - xSrc += dx; - ySrc += dy; -} - void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRedrawWholeScreen /* =false*/ ) { if (bRedrawWholeScreen || g_nAppMode == MODE_PAUSED) @@ -604,7 +582,6 @@ void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRe { int xSrc = GetFrameBufferBorderWidth(); int ySrc = GetFrameBufferBorderHeight(); - VideoFrameBufferAdjust(xSrc, ySrc); // TC: Hacky-fix for GH#341 int xdest = IsFullScreen() ? GetFullScreenOffsetX() : 0; int ydest = IsFullScreen() ? GetFullScreenOffsetY() : 0; @@ -1165,8 +1142,6 @@ static void Video_MakeScreenShot(FILE *pFile, const VideoScreenShot_e ScreenShot int xSrc = GetFrameBufferBorderWidth(); int ySrc = GetFrameBufferBorderHeight(); - VideoFrameBufferAdjust(xSrc, ySrc, true); // TC: Hacky-fix for GH#341 & GH#356 - // Lines stored in reverse, so invert the y-adjust value pSrc += xSrc; // Skip left border pSrc += ySrc * GetFrameBufferWidth(); // Skip top border