mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-24 07:30:24 +00:00
Direct Draw Palette Debugging
This commit is contained in:
parent
ed83e55a68
commit
d0964e0d42
@ -398,15 +398,18 @@ static void DrawCrosshairs (int x, int y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
static void DrawFrameWindow () {
|
static void DrawFrameWindow ()
|
||||||
|
{
|
||||||
FrameReleaseDC();
|
FrameReleaseDC();
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
HDC dc = (g_bPaintingWindow ? BeginPaint(g_hFrameWindow,&ps)
|
HDC dc = (g_bPaintingWindow
|
||||||
|
? BeginPaint(g_hFrameWindow,&ps)
|
||||||
: GetDC(g_hFrameWindow));
|
: GetDC(g_hFrameWindow));
|
||||||
|
|
||||||
VideoRealizePalette(dc);
|
VideoRealizePalette(dc);
|
||||||
|
|
||||||
if (!g_bIsFullScreen) {
|
if (!g_bIsFullScreen)
|
||||||
|
{
|
||||||
// DRAW THE 3D BORDER AROUND THE EMULATED SCREEN
|
// DRAW THE 3D BORDER AROUND THE EMULATED SCREEN
|
||||||
Draw3dRect(dc,
|
Draw3dRect(dc,
|
||||||
VIEWPORTX-2,VIEWPORTY-2,
|
VIEWPORTX-2,VIEWPORTY-2,
|
||||||
@ -425,17 +428,15 @@ static void DrawFrameWindow () {
|
|||||||
VIEWPORTX+VIEWPORTCX+5,VIEWPORTY+VIEWPORTCY+5);
|
VIEWPORTX+VIEWPORTCX+5,VIEWPORTY+VIEWPORTCY+5);
|
||||||
|
|
||||||
// DRAW THE TOOLBAR BUTTONS
|
// DRAW THE TOOLBAR BUTTONS
|
||||||
int loop = BUTTONS;
|
int iButton = BUTTONS;
|
||||||
while (loop--)
|
while (iButton--)
|
||||||
DrawButton(dc,loop);
|
{
|
||||||
|
DrawButton(dc,iButton);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DRAW THE STATUS AREA
|
// DRAW THE STATUS AREA
|
||||||
DrawStatusArea(dc,DRAW_BACKGROUND | DRAW_LEDS);
|
DrawStatusArea(dc,DRAW_BACKGROUND | DRAW_LEDS);
|
||||||
if (g_bPaintingWindow)
|
|
||||||
EndPaint(g_hFrameWindow,&ps);
|
|
||||||
else
|
|
||||||
ReleaseDC(g_hFrameWindow,dc);
|
|
||||||
|
|
||||||
// DRAW THE CONTENTS OF THE EMULATED SCREEN
|
// DRAW THE CONTENTS OF THE EMULATED SCREEN
|
||||||
if (g_nAppMode == MODE_LOGO)
|
if (g_nAppMode == MODE_LOGO)
|
||||||
@ -444,6 +445,13 @@ static void DrawFrameWindow () {
|
|||||||
DebugDisplay(1);
|
DebugDisplay(1);
|
||||||
else
|
else
|
||||||
VideoRedrawScreen();
|
VideoRedrawScreen();
|
||||||
|
|
||||||
|
// DD Full-Screen Palette: BUGFIX: needs to come _after_ all drawing...
|
||||||
|
if (g_bPaintingWindow)
|
||||||
|
EndPaint(g_hFrameWindow,&ps);
|
||||||
|
else
|
||||||
|
ReleaseDC(g_hFrameWindow,dc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@ -613,6 +621,10 @@ static void EraseButton (int number) {
|
|||||||
rect.right = rect.left+BUTTONCX;
|
rect.right = rect.left+BUTTONCX;
|
||||||
rect.top = buttony+number*BUTTONCY;
|
rect.top = buttony+number*BUTTONCY;
|
||||||
rect.bottom = rect.top+BUTTONCY;
|
rect.bottom = rect.top+BUTTONCY;
|
||||||
|
|
||||||
|
// TODO: DD Full-Screen Palette
|
||||||
|
// if( !g_bIsFullScreen )
|
||||||
|
|
||||||
InvalidateRect(g_hFrameWindow,&rect,1);
|
InvalidateRect(g_hFrameWindow,&rect,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,7 +928,9 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
KeybQueueKeypress((int)wparam,NOT_ASCII);
|
KeybQueueKeypress((int)wparam,NOT_ASCII);
|
||||||
}
|
}
|
||||||
else if (g_nAppMode == MODE_DEBUG)
|
else if (g_nAppMode == MODE_DEBUG)
|
||||||
|
{
|
||||||
DebuggerProcessKey(wparam);
|
DebuggerProcessKey(wparam);
|
||||||
|
}
|
||||||
|
|
||||||
if (wparam == VK_F10)
|
if (wparam == VK_F10)
|
||||||
{
|
{
|
||||||
@ -1142,11 +1156,30 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PALETTECHANGED:
|
case WM_PALETTECHANGED:
|
||||||
|
// To avoid creating an infinite loop, a window that receives this
|
||||||
|
// message must not realize its palette, unless it determines that
|
||||||
|
// wParam does not contain its own window handle.
|
||||||
if ((HWND)wparam == window)
|
if ((HWND)wparam == window)
|
||||||
|
{
|
||||||
|
#if DEBUG_DD_PALETTE
|
||||||
|
if( g_bIsFullScreen )
|
||||||
|
OutputDebugString( "WM_PALETTECHANGED: Full Screen\n" );
|
||||||
|
else
|
||||||
|
OutputDebugString( "WM_PALETTECHANGED: Windowed\n" );
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
// fall through
|
}
|
||||||
|
// else fall through
|
||||||
|
|
||||||
case WM_QUERYNEWPALETTE:
|
case WM_QUERYNEWPALETTE:
|
||||||
|
#if DEBUG_DD_PALETTE
|
||||||
|
if( g_bIsFullScreen )
|
||||||
|
OutputDebugString( "WM_QUERYNEWPALETTE: Full Screen\n" );
|
||||||
|
else
|
||||||
|
OutputDebugString( "WM_QUERYNEWPALETTE: Windowed\n" );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// TODO: DD Full-Screen Palette
|
||||||
DrawFrameWindow();
|
DrawFrameWindow();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1208,6 +1241,14 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SYSCOLORCHANGE:
|
case WM_SYSCOLORCHANGE:
|
||||||
|
#if DEBUG_DD_PALETTE
|
||||||
|
if( g_bIsFullScreen )
|
||||||
|
OutputDebugString( "WM_SYSCOLORCHANGE: Full Screen\n" );
|
||||||
|
else
|
||||||
|
OutputDebugString( "WM_SYSCOLORCHANGE: Windowed\n" );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// TODO: DD Full-Screen Palette
|
||||||
DeleteGdiObjects();
|
DeleteGdiObjects();
|
||||||
CreateGdiObjects();
|
CreateGdiObjects();
|
||||||
break;
|
break;
|
||||||
@ -1329,10 +1370,16 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void ProcessButtonClick (int button) {
|
void ProcessButtonClick (int button)
|
||||||
|
{
|
||||||
SoundCore_SetFade(FADE_OUT);
|
SoundCore_SetFade(FADE_OUT);
|
||||||
|
|
||||||
|
#if DEBUG_DD_PALETTE
|
||||||
|
char _text[ 80 ];
|
||||||
|
sprintf( _text, "Button: F%d Full Screen: %d\n", button+1, g_bIsFullScreen );
|
||||||
|
OutputDebugString( _text );
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (button) {
|
switch (button) {
|
||||||
|
|
||||||
case BTN_HELP:
|
case BTN_HELP:
|
||||||
@ -1418,6 +1465,10 @@ void ProcessButtonClick (int button) {
|
|||||||
{
|
{
|
||||||
g_bDebugDelayBreakCheck = true;
|
g_bDebugDelayBreakCheck = true;
|
||||||
ProcessButtonClick(BTN_RUN);
|
ProcessButtonClick(BTN_RUN);
|
||||||
|
|
||||||
|
// TODO: DD Full-Screen Palette
|
||||||
|
// exiting debugger using wrong palette, but this makes problem worse...
|
||||||
|
//InvalidateRect(g_hFrameWindow,NULL,1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1625,6 +1676,10 @@ void SetFullScreenMode ()
|
|||||||
SetNormalMode();
|
SetNormalMode();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: DD Full-Screen Palette
|
||||||
|
// if( !g_bIsFullScreen )
|
||||||
|
|
||||||
InvalidateRect(g_hFrameWindow,NULL,1);
|
InvalidateRect(g_hFrameWindow,NULL,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1647,11 +1702,21 @@ 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();
|
||||||
g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
|
g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pDD->Release();
|
g_pDD->Release();
|
||||||
g_pDD = (LPDIRECTDRAW)0;
|
g_pDD = (LPDIRECTDRAW)0;
|
||||||
}
|
}
|
||||||
@ -1843,14 +1908,17 @@ void FrameReleaseDC () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void FrameReleaseVideoDC () {
|
void FrameReleaseVideoDC ()
|
||||||
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow) {
|
{
|
||||||
|
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
|
||||||
|
{
|
||||||
// THIS IS CORRECT ACCORDING TO THE DIRECTDRAW DOCS
|
// THIS IS CORRECT ACCORDING TO THE DIRECTDRAW DOCS
|
||||||
RECT rect = {FSVIEWPORTX,
|
RECT rect = {
|
||||||
|
FSVIEWPORTX,
|
||||||
FSVIEWPORTY,
|
FSVIEWPORTY,
|
||||||
FSVIEWPORTX+VIEWPORTCX,
|
FSVIEWPORTX+VIEWPORTCX,
|
||||||
FSVIEWPORTY+VIEWPORTCY};
|
FSVIEWPORTY+VIEWPORTCY
|
||||||
|
};
|
||||||
g_pDDPrimarySurface->Unlock(&rect);
|
g_pDDPrimarySurface->Unlock(&rect);
|
||||||
|
|
||||||
// BUT THIS SEEMS TO BE WORKING
|
// BUT THIS SEEMS TO BE WORKING
|
||||||
|
Loading…
Reference in New Issue
Block a user