From 816e22524fde183c4c69212a0ac5527318cdf539 Mon Sep 17 00:00:00 2001 From: Andrea Date: Wed, 13 Jan 2021 22:02:48 +0000 Subject: [PATCH 1/2] VideoReinitialize(): remove default arg & refactor out common code (PR #911) --- source/Configuration/PageConfig.cpp | 9 +-------- source/NTSC.cpp | 2 +- source/SaveState.cpp | 2 +- source/Video.cpp | 2 +- source/Video.h | 2 +- source/Windows/Win32Frame.cpp | 31 +++++++++++++++++++++++------ source/Windows/Win32Frame.h | 1 + source/Windows/WinFrame.cpp | 23 ++------------------- 8 files changed, 33 insertions(+), 39 deletions(-) diff --git a/source/Configuration/PageConfig.cpp b/source/Configuration/PageConfig.cpp index 1b24a08b..c753589b 100644 --- a/source/Configuration/PageConfig.cpp +++ b/source/Configuration/PageConfig.cpp @@ -312,15 +312,8 @@ void CPageConfig::DlgOK(HWND hWnd) if (bVideoReinit) { - GetVideo().Config_Save_Video(); - win32Frame.FrameRefreshStatus(DRAW_TITLE); - - GetVideo().VideoReinitialize(); - if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG)) - { - win32Frame.VideoRedrawScreen(); - } + win32Frame.ApplyVideoModeChange(); } // diff --git a/source/NTSC.cpp b/source/NTSC.cpp index 45bafa9f..0eaccfeb 100644 --- a/source/NTSC.cpp +++ b/source/NTSC.cpp @@ -2117,7 +2117,7 @@ void NTSC_VideoInit( uint8_t* pFramebuffer ) // wsVideoInit g_pFuncUpdateTextScreen = updateScreenText40; g_pFuncUpdateGraphicsScreen = updateScreenText40; - GetVideo().VideoReinitialize(); // Setup g_pFunc_ntsc*Pixel() + GetVideo().VideoReinitialize(true); // Setup g_pFunc_ntsc*Pixel() bgra_t baseColors[kNumBaseColors]; GenerateBaseColors(&baseColors); diff --git a/source/SaveState.cpp b/source/SaveState.cpp index 9dcefd0a..ad236090 100644 --- a/source/SaveState.cpp +++ b/source/SaveState.cpp @@ -287,7 +287,7 @@ static void ParseUnitApple2(YamlLoadHelper& yamlLoadHelper, UINT version) MemLoadSnapshot(yamlLoadHelper, version); // g_Apple2Type may've changed: so redraw frame (title, buttons, leds, etc) - GetVideo().VideoReinitialize(); // g_CharsetType changed + GetVideo().VideoReinitialize(true); // g_CharsetType changed GetFrame().FrameUpdateApple2Type(); // Calls VideoRedrawScreen() before the aux mem has been loaded (so if DHGR is enabled, then aux mem will be zeros at this stage) } diff --git a/source/Video.cpp b/source/Video.cpp index 7b47c426..f096cd31 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -126,7 +126,7 @@ UINT Video::GetFrameBufferHeight(void) //=========================================================================== -void Video::VideoReinitialize(bool bInitVideoScannerAddress /*= true*/) +void Video::VideoReinitialize(bool bInitVideoScannerAddress) { NTSC_VideoReinitialize( g_dwCyclesThisFrame, bInitVideoScannerAddress ); NTSC_VideoInitAppleType(); diff --git a/source/Video.h b/source/Video.h index 72bef838..acde3915 100644 --- a/source/Video.h +++ b/source/Video.h @@ -211,7 +211,7 @@ public: COLORREF GetMonochromeRGB(void) { return g_nMonochromeRGB; } void SetMonochromeRGB(COLORREF colorRef) { g_nMonochromeRGB = colorRef; } - void VideoReinitialize(bool bInitVideoScannerAddress = true); + void VideoReinitialize(bool bInitVideoScannerAddress); void VideoResetState(void); void VideoRefreshBuffer(uint32_t uRedrawWholeScreenVideoMode, bool bRedrawWholeScreen); diff --git a/source/Windows/Win32Frame.cpp b/source/Windows/Win32Frame.cpp index b0ea09fe..bfded0a9 100644 --- a/source/Windows/Win32Frame.cpp +++ b/source/Windows/Win32Frame.cpp @@ -9,6 +9,7 @@ #include "Log.h" #include "Memory.h" #include "CardManager.h" +#include "Debugger/Debug.h" #include "../resource/resource.h" // Win32Frame methods are implemented in AppleWin, WinFrame and WinVideo. @@ -306,12 +307,7 @@ void Win32Frame::ChooseMonochromeColor(void) if (ChooseColor(&cc)) { video.SetMonochromeRGB(cc.rgbResult); - video.VideoReinitialize(); - if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG)) - { - VideoRedrawScreen(); - } - video.Config_Save_Video(); + ApplyVideoModeChange(); } } @@ -514,6 +510,29 @@ void Win32Frame::DDUninit(void) #undef SAFE_RELEASE +void Win32Frame::ApplyVideoModeChange(void) +{ + Video& video = GetVideo(); + video.Config_Save_Video(); + video.VideoReinitialize(false); + + if (g_nAppMode != MODE_LOGO) + { + if (g_nAppMode == MODE_DEBUG) + { + UINT debugVideoMode; + if (DebugGetVideoMode(&debugVideoMode)) + VideoRefreshScreen(debugVideoMode, true); + else + VideoPresentScreen(); + } + else + { + VideoPresentScreen(); + } + } +} + Win32Frame& Win32Frame::GetWin32Frame() { FrameBase& frameBase = GetFrame(); diff --git a/source/Windows/Win32Frame.h b/source/Windows/Win32Frame.h index 08a401fd..a9055a2f 100644 --- a/source/Windows/Win32Frame.h +++ b/source/Windows/Win32Frame.h @@ -44,6 +44,7 @@ public: void ChooseMonochromeColor(void); UINT Get3DBorderWidth(void); UINT Get3DBorderHeight(void); + void ApplyVideoModeChange(void); LRESULT WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam); private: diff --git a/source/Windows/WinFrame.cpp b/source/Windows/WinFrame.cpp index be5c9ad9..1c6ff0b9 100644 --- a/source/Windows/WinFrame.cpp +++ b/source/Windows/WinFrame.cpp @@ -1113,7 +1113,7 @@ LRESULT Win32Frame::WndProc( } case WM_DISPLAYCHANGE: - GetVideo().VideoReinitialize(); + GetVideo().VideoReinitialize(false); break; case WM_DROPFILES: @@ -1223,26 +1223,7 @@ LRESULT Win32Frame::WndProc( // TODO: Clean up code:FrameRefreshStatus(DRAW_TITLE) DrawStatusArea((HDC)0,DRAW_TITLE) DrawStatusArea( (HDC)0, DRAW_TITLE ); - - GetVideo().VideoReinitialize(false); - - if (g_nAppMode != MODE_LOGO) - { - if (g_nAppMode == MODE_DEBUG) - { - UINT debugVideoMode; - if ( DebugGetVideoMode(&debugVideoMode) ) - VideoRefreshScreen(debugVideoMode, true); - else - VideoPresentScreen(); - } - else - { - VideoPresentScreen(); - } - } - - GetVideo().Config_Save_Video(); + ApplyVideoModeChange(); } else if (wparam == VK_F10) { From 960e5d99bcf54d8339532908ff1848339d03f819 Mon Sep 17 00:00:00 2001 From: TomCh Date: Thu, 14 Jan 2021 12:15:29 +0000 Subject: [PATCH 2/2] Update README.md + LC, Saturn & NSC --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b0844104..ebfc0b06 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Peripheral cards supported: - RGB cards: Apple's Extended 80-Column Text/AppleColor Adaptor Card, 'Le Chat Mauve' FĂ©line and Eve. - CP/M SoftCard - Uthernet I (ethernet card) +- Language Card and Saturn 64/128K for Apple II/II+ +- No Slot Clock (NSC) Download latest (stable) release: [AppleWin v1.29.16.0](https://github.com/AppleWin/AppleWin/releases/download/v1.29.16.0/AppleWin1.29.16.0.zip)