1.29.1.1: test improved TV modes for #650. Use Ctrl-9 to toggle 1.29.1.0 and 1.29.1.1.

This commit is contained in:
tomcw 2019-08-30 21:58:03 +01:00
parent 7495d0d9cc
commit bad963026c
4 changed files with 46 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#define APPLEWIN_VERSION 1,29,1,0
#define APPLEWIN_VERSION 1,29,1,1
#define xstr(a) str(a)
#define str(a) #a

View File

@ -246,6 +246,7 @@ UINT Get3DBorderHeight(void)
}
// ==========================================================================
extern bool g_VideoTVMode1_29_1_0;
static void GetAppleWindowTitle()
{
static TCHAR g_pAppleWindowTitle[ 128 ] = "";
@ -268,6 +269,7 @@ 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;
@ -1414,6 +1416,9 @@ 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;
}

View File

@ -493,13 +493,17 @@ inline uint32_t* getScanlineNextInbetween()
return (uint32_t*) (g_pVideoAddress - 1*g_kFrameBufferWidth);
}
inline uint32_t* getScanlineNext()
{
return (uint32_t*) (g_pVideoAddress - 2*g_kFrameBufferWidth);
}
//===========================================================================
inline uint32_t* getScanlinePreviousInbetween()
{
return (uint32_t*) (g_pVideoAddress + 1*g_kFrameBufferWidth);
}
//===========================================================================
inline uint32_t* getScanlinePrevious()
{
return (uint32_t*) (g_pVideoAddress + 2*g_kFrameBufferWidth);
@ -551,13 +555,13 @@ inline void updateFlashRate() // TODO: Flash rate should be constant (regardless
// prevp is never used nor blended with!
#define updateFramebufferColorTVSingleScanline(signal,table) \
do { \
uint32_t ntscp, prevp, betwp; \
uint32_t ntscp, /*prevp,*/ betwp; \
uint32_t *prevlin, *between; \
g_nSignalBitsNTSC = ((g_nSignalBitsNTSC << 1) | signal) & 0xFFF; \
prevlin = (uint32_t*)(g_pVideoAddress + 2*FRAMEBUFFER_W); \
/*prevlin = (uint32_t*)(g_pVideoAddress + 2*FRAMEBUFFER_W);*/ \
between = (uint32_t*)(g_pVideoAddress + 1*FRAMEBUFFER_W); \
ntscp = *(uint32_t*) &table[g_nSignalBitsNTSC]; /* raw current NTSC color */ \
prevp = *prevlin; \
/*prevp = *prevlin;*/ \
betwp = ntscp - ((ntscp & 0x00fcfcfc) >> 2); \
*between = betwp | ALPHA32_MASK; \
*(uint32_t*)g_pVideoAddress = ntscp; \
@ -591,9 +595,11 @@ inline void updateFlashRate() // TODO: Flash rate should be constant (regardless
#else
//===========================================================================
extern bool g_VideoTVMode1_29_1_0;
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();
@ -613,6 +619,17 @@ inline void updateFramebufferColorTVSingleScanline( uint16_t signal, bgra_t *pTa
*pLine1Prev = color1 | ALPHA32_MASK;
*pLine0Curr = color0;
} else {
uint32_t *pLine1Next = getScanlineNextInbetween();
uint32_t *pLine2Next = getScanlineNext();
const uint32_t color0 = getScanlineColor( signal, pTable );
const uint32_t color2 = *pLine2Next;
uint32_t color1 = ((color0 & 0x00fefefe) >> 1) + ((color2 & 0x00fefefe) >> 1); // 50% Blend
color1 = (color1 & 0x00fefefe) >> 1; // ... then 50% brightness for inbetween line
*pLine1Next = color1 | ALPHA32_MASK;
*pLine0Curr = color0;
}
g_pVideoAddress++;
}
@ -620,6 +637,7 @@ inline void updateFramebufferColorTVSingleScanline( uint16_t signal, bgra_t *pTa
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();
@ -629,6 +647,16 @@ inline void updateFramebufferColorTVDoubleScanline( uint16_t signal, bgra_t *pTa
*pLine1Prev = color1 | ALPHA32_MASK;
*pLine0Curr = color0;
} else {
uint32_t *pLine1Next = getScanlineNextInbetween();
uint32_t *pLine2Next = getScanlineNext();
const uint32_t color0 = getScanlineColor( signal, pTable );
const uint32_t color2 = *pLine2Next;
const uint32_t color1 = ((color0 & 0x00fefefe) >> 1) + ((color2 & 0x00fefefe) >> 1); // 50% Blend
*pLine1Next = color1 | ALPHA32_MASK;
*pLine0Curr = color0;
}
g_pVideoAddress++;
}

View File

@ -96,6 +96,8 @@ 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
@ -568,6 +570,7 @@ static void VideoFrameBufferAdjust(int& xSrc, int& ySrc, bool bInvertY=false)
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;
}
@ -588,6 +591,11 @@ void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRe
if (bRedrawWholeScreen)
NTSC_SetVideoMode( uRedrawWholeScreenVideoMode );
NTSC_VideoRedrawWholeScreen();
// MODE_DEBUG|PAUSED: Need to refresh a 2nd time if changing video-type, otherwise could have residue from prev image!
// . eg. Amber -> B&W TV
if (g_nAppMode == MODE_DEBUG || g_nAppMode == MODE_PAUSED)
NTSC_VideoRedrawWholeScreen();
}
HDC hFrameDC = FrameGetDC();