mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-08-15 18:27:29 +00:00
WIP: NTSC Full screen support
This commit is contained in:
@@ -143,8 +143,7 @@ int g_nCharsetType = 0;
|
|||||||
// Direct Draw -- For Full Screen
|
// Direct Draw -- For Full Screen
|
||||||
LPDIRECTDRAW g_pDD = (LPDIRECTDRAW)0;
|
LPDIRECTDRAW g_pDD = (LPDIRECTDRAW)0;
|
||||||
LPDIRECTDRAWSURFACE g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
|
LPDIRECTDRAWSURFACE g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
|
||||||
IDirectDrawPalette* g_pDDPal = (IDirectDrawPalette*)0;
|
HDC g_hDDdc = 0;
|
||||||
|
|
||||||
|
|
||||||
static bool g_bShowingCursor = true;
|
static bool g_bShowingCursor = true;
|
||||||
static bool g_bLastCursorInAppleViewport = false;
|
static bool g_bLastCursorInAppleViewport = false;
|
||||||
@@ -516,8 +515,6 @@ static void DrawFrameWindow ()
|
|||||||
? BeginPaint(g_hFrameWindow,&ps)
|
? BeginPaint(g_hFrameWindow,&ps)
|
||||||
: GetDC(g_hFrameWindow));
|
: GetDC(g_hFrameWindow));
|
||||||
|
|
||||||
VideoRealizePalette(dc);
|
|
||||||
|
|
||||||
if (!g_bIsFullScreen)
|
if (!g_bIsFullScreen)
|
||||||
{
|
{
|
||||||
// DRAW THE 3D BORDER AROUND THE EMULATED SCREEN
|
// DRAW THE 3D BORDER AROUND THE EMULATED SCREEN
|
||||||
@@ -563,7 +560,7 @@ static void DrawFrameWindow ()
|
|||||||
else if (g_nAppMode == MODE_DEBUG)
|
else if (g_nAppMode == MODE_DEBUG)
|
||||||
DebugDisplay(1);
|
DebugDisplay(1);
|
||||||
else
|
else
|
||||||
// Win7: In fullscreen mode with 1 redraw, the the screen doesn't get redraw.
|
// Win7: In fullscreen mode with 1 redraw the screen doesn't get redrawn.
|
||||||
//VideoRedrawScreen(g_bIsFullScreen ? 2 : 1); // TC: 22/06/2014: Why 2 redraws in full-screen mode (32-bit only)? (8-bit doesn't need this nor does Win8, just Win7 or older OS's)
|
//VideoRedrawScreen(g_bIsFullScreen ? 2 : 1); // TC: 22/06/2014: Why 2 redraws in full-screen mode (32-bit only)? (8-bit doesn't need this nor does Win8, just Win7 or older OS's)
|
||||||
//VideoRefreshScreen(0);
|
//VideoRefreshScreen(0);
|
||||||
VideoRedrawScreen();
|
VideoRedrawScreen();
|
||||||
@@ -2068,9 +2065,11 @@ void SetFullScreenMode ()
|
|||||||
ddsd.dwSize = sizeof(ddsd);
|
ddsd.dwSize = sizeof(ddsd);
|
||||||
ddsd.dwFlags = DDSD_CAPS;
|
ddsd.dwFlags = DDSD_CAPS;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
ddsd.dwBackBufferCount = 1;
|
||||||
|
|
||||||
if (DirectDrawCreate(NULL,&g_pDD,NULL) != DD_OK ||
|
if (DirectDrawCreate(NULL,&g_pDD,NULL) != DD_OK ||
|
||||||
g_pDD->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK ||
|
g_pDD->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK ||
|
||||||
g_pDD->SetDisplayMode(640,480,g_bFullScreen32Bit ? 32 : 8) != DD_OK ||
|
g_pDD->SetDisplayMode(640,480,32) != DD_OK ||
|
||||||
g_pDD->CreateSurface(&ddsd,&g_pDDPrimarySurface,NULL) != DD_OK)
|
g_pDD->CreateSurface(&ddsd,&g_pDDPrimarySurface,NULL) != DD_OK)
|
||||||
{
|
{
|
||||||
g_pDDPrimarySurface = NULL;
|
g_pDDPrimarySurface = NULL;
|
||||||
@@ -2078,9 +2077,6 @@ void SetFullScreenMode ()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: DD Full-Screen Palette
|
|
||||||
// if( !g_bIsFullScreen )
|
|
||||||
|
|
||||||
InvalidateRect(g_hFrameWindow,NULL,1);
|
InvalidateRect(g_hFrameWindow,NULL,1);
|
||||||
|
|
||||||
#endif // NO_DIRECT_X
|
#endif // NO_DIRECT_X
|
||||||
@@ -2105,15 +2101,6 @@ void SetNormalMode ()
|
|||||||
framerect.right - framerect.left,
|
framerect.right - framerect.left,
|
||||||
framerect.bottom - framerect.top,
|
framerect.bottom - framerect.top,
|
||||||
SWP_NOZORDER | SWP_FRAMECHANGED);
|
SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||||
|
|
||||||
// DD Full-Screen Palette: BUGFIX: Re-attach new palette on next new surface
|
|
||||||
// Delete Palette
|
|
||||||
if (g_pDDPal)
|
|
||||||
{
|
|
||||||
g_pDDPal->Release();
|
|
||||||
g_pDDPal = (LPDIRECTDRAWPALETTE)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_pDDPrimarySurface)
|
if (g_pDDPrimarySurface)
|
||||||
{
|
{
|
||||||
g_pDDPrimarySurface->Release();
|
g_pDDPrimarySurface->Release();
|
||||||
@@ -2359,6 +2346,8 @@ HDC FrameGetDC () {
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
HDC FrameGetVideoDC (LPBYTE *pAddr_, LONG *pPitch_)
|
HDC FrameGetVideoDC (LPBYTE *pAddr_, LONG *pPitch_)
|
||||||
{
|
{
|
||||||
|
HDC hDC = 0;
|
||||||
|
|
||||||
// ASSERT( pAddr_ );
|
// ASSERT( pAddr_ );
|
||||||
// ASSERT( pPitch_ );
|
// ASSERT( pPitch_ );
|
||||||
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
|
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
|
||||||
@@ -2374,23 +2363,23 @@ HDC FrameGetVideoDC (LPBYTE *pAddr_, LONG *pPitch_)
|
|||||||
{
|
{
|
||||||
g_pDDPrimarySurface->Restore();
|
g_pDDPrimarySurface->Restore();
|
||||||
g_pDDPrimarySurface->Lock(&rect,&surfacedesc,DDLOCK_WAIT,NULL);
|
g_pDDPrimarySurface->Lock(&rect,&surfacedesc,DDLOCK_WAIT,NULL);
|
||||||
|
|
||||||
// DD Full Screen Palette
|
|
||||||
// if (g_pDDPal)
|
|
||||||
// {
|
|
||||||
// g_pDDPrimarySurface->SetPalette(g_pDDPal); // this sets the palette for the primary surface
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
*pAddr_ = (LPBYTE)surfacedesc.lpSurface + (g_nViewportCY-1) * surfacedesc.lPitch;
|
*pAddr_ = (LPBYTE)surfacedesc.lpSurface + (g_nViewportCY-1) * surfacedesc.lPitch;
|
||||||
*pPitch_ = -surfacedesc.lPitch;
|
*pPitch_ = -surfacedesc.lPitch;
|
||||||
return (HDC)0;
|
|
||||||
|
if( g_pDDPrimarySurface->GetDC( &hDC ) == DD_OK )
|
||||||
|
g_hDDdc = hDC; // intentional "null" copy
|
||||||
|
else
|
||||||
|
hDC = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pAddr_ = g_pFramebufferbits;
|
*pAddr_ = g_pFramebufferbits;
|
||||||
*pPitch_ = FRAMEBUFFER_W;
|
*pPitch_ = FRAMEBUFFER_W;
|
||||||
return FrameGetDC();
|
hDC = FrameGetDC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return hDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@@ -2445,6 +2434,9 @@ void FrameReleaseVideoDC ()
|
|||||||
|
|
||||||
// BUT THIS SEEMS TO BE WORKING
|
// BUT THIS SEEMS TO BE WORKING
|
||||||
g_pDDPrimarySurface->Unlock(NULL);
|
g_pDDPrimarySurface->Unlock(NULL);
|
||||||
|
|
||||||
|
g_pDDPrimarySurface->ReleaseDC( g_hDDdc ); // NTSC Full Screen
|
||||||
|
g_hDDdc = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1065,16 +1065,6 @@ void VideoDisplayLogo ()
|
|||||||
DeleteObject(font);
|
DeleteObject(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
void VideoRealizePalette(HDC dc)
|
|
||||||
{
|
|
||||||
if (g_hPalette)
|
|
||||||
{
|
|
||||||
SelectPalette(dc,g_hPalette,0);
|
|
||||||
RealizePalette(dc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void VideoRedrawScreen ()
|
void VideoRedrawScreen ()
|
||||||
@@ -1131,7 +1121,7 @@ void VideoRefreshScreen ( int bVideoModeFlags )
|
|||||||
NTSC_VideoUpdateCycles( VIDEO_SCANNER_6502_CYCLES );
|
NTSC_VideoUpdateCycles( VIDEO_SCANNER_6502_CYCLES );
|
||||||
}
|
}
|
||||||
|
|
||||||
// NTSC_BEGIN: wsVideoRefresh()
|
// NTSC_BEGIN
|
||||||
LPBYTE pDstFrameBufferBits = 0;
|
LPBYTE pDstFrameBufferBits = 0;
|
||||||
LONG pitch = 0;
|
LONG pitch = 0;
|
||||||
HDC hFrameDC = FrameGetVideoDC(&pDstFrameBufferBits,&pitch);
|
HDC hFrameDC = FrameGetVideoDC(&pDstFrameBufferBits,&pitch);
|
||||||
@@ -1149,6 +1139,8 @@ void VideoRefreshScreen ( int bVideoModeFlags )
|
|||||||
GdiFlush();
|
GdiFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FrameReleaseVideoDC();
|
||||||
|
|
||||||
if (g_VideoForceFullRedraw)
|
if (g_VideoForceFullRedraw)
|
||||||
--g_VideoForceFullRedraw;
|
--g_VideoForceFullRedraw;
|
||||||
// NTSC_END
|
// NTSC_END
|
||||||
@@ -1761,4 +1753,3 @@ void videoCreateDIBSection()
|
|||||||
|
|
||||||
NTSC_VideoInit( g_pFramebufferbits );
|
NTSC_VideoInit( g_pFramebufferbits );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user