From 2d2ba86f4f86b8224dae95f4d1374467626db43f Mon Sep 17 00:00:00 2001 From: Andrea Date: Sun, 20 Dec 2020 15:32:51 +0000 Subject: [PATCH] IPropertySheet: make it a standard C++ class with pure virtual functions (PR #892) * Interface.h: ensure that functions in the interface are not exported by other header files. This is generally harmless, except for the presence of default arguments, in which case the version with default arguments must come first. To avoid the issue, these functions are only ever exported in the Interface.h header file. --- source/Configuration/About.cpp | 2 +- source/Configuration/IPropertySheet.h | 45 ++++++++++---------- source/Configuration/PageConfig.cpp | 1 + source/Configuration/PageDisk.cpp | 2 +- source/Configuration/PropertySheet.cpp | 2 +- source/Configuration/PropertySheetHelper.cpp | 5 ++- source/Core.cpp | 3 -- source/Core.h | 2 - source/Debugger/Debug.cpp | 1 + source/Debugger/Debugger_Commands.cpp | 2 +- source/Debugger/Debugger_Display.cpp | 2 +- source/Interface.h | 4 ++ source/Joystick.cpp | 9 ++-- source/Keyboard.cpp | 3 +- source/Memory.cpp | 4 +- source/SaveState.cpp | 2 +- source/SerialComms.cpp | 2 +- source/Utilities.cpp | 28 ++++++------ source/Windows/AppleWin.cpp | 11 ++++- source/Windows/AppleWin.h | 3 -- source/Windows/WinFrame.cpp | 19 +++++---- source/Windows/WinFrame.h | 18 -------- source/Windows/WinVideo.cpp | 1 + source/Windows/WinVideo.h | 1 - 24 files changed, 82 insertions(+), 90 deletions(-) diff --git a/source/Configuration/About.cpp b/source/Configuration/About.cpp index 5bb57219..dab470bf 100644 --- a/source/Configuration/About.cpp +++ b/source/Configuration/About.cpp @@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "About.h" #include "../Core.h" +#include "../Interface.h" #include "../Windows/AppleWin.h" -#include "../Windows/WinFrame.h" #include "../resource/resource.h" static const TCHAR g_szGPL[] = diff --git a/source/Configuration/IPropertySheet.h b/source/Configuration/IPropertySheet.h index f3061104..9664e673 100644 --- a/source/Configuration/IPropertySheet.h +++ b/source/Configuration/IPropertySheet.h @@ -4,28 +4,29 @@ class CConfigNeedingRestart; -__interface IPropertySheet +class IPropertySheet { - void Init(void); - DWORD GetVolumeMax(void); // TODO:TC: Move out of here - bool SaveStateSelectImage(HWND hWindow, bool bSave); // TODO:TC: Move out of here - void ApplyNewConfig(const CConfigNeedingRestart& ConfigNew, const CConfigNeedingRestart& ConfigOld); - void ConfigSaveApple2Type(eApple2Type apple2Type); +public: + virtual void Init(void) = 0; + virtual DWORD GetVolumeMax(void) = 0; // TODO:TC: Move out of here + virtual bool SaveStateSelectImage(HWND hWindow, bool bSave) = 0; // TODO:TC: Move out of here + virtual void ApplyNewConfig(const CConfigNeedingRestart& ConfigNew, const CConfigNeedingRestart& ConfigOld) = 0; + virtual void ConfigSaveApple2Type(eApple2Type apple2Type) = 0; - UINT GetScrollLockToggle(void); - void SetScrollLockToggle(UINT uValue); - UINT GetJoystickCursorControl(void); - void SetJoystickCursorControl(UINT uValue); - UINT GetJoystickCenteringControl(void); - void SetJoystickCenteringControl(UINT uValue); - UINT GetAutofire(UINT uButton); - void SetAutofire(UINT uValue); - bool GetButtonsSwapState(void); - void SetButtonsSwapState(bool value); - UINT GetMouseShowCrosshair(void); - void SetMouseShowCrosshair(UINT uValue); - UINT GetMouseRestrictToWindow(void); - void SetMouseRestrictToWindow(UINT uValue); - UINT GetTheFreezesF8Rom(void); - void SetTheFreezesF8Rom(UINT uValue); + virtual UINT GetScrollLockToggle(void) = 0; + virtual void SetScrollLockToggle(UINT uValue) = 0; + virtual UINT GetJoystickCursorControl(void) = 0; + virtual void SetJoystickCursorControl(UINT uValue) = 0; + virtual UINT GetJoystickCenteringControl(void) = 0; + virtual void SetJoystickCenteringControl(UINT uValue) = 0; + virtual UINT GetAutofire(UINT uButton) = 0; + virtual void SetAutofire(UINT uValue) = 0; + virtual bool GetButtonsSwapState(void) = 0; + virtual void SetButtonsSwapState(bool value) = 0; + virtual UINT GetMouseShowCrosshair(void) = 0; + virtual void SetMouseShowCrosshair(UINT uValue) = 0; + virtual UINT GetMouseRestrictToWindow(void) = 0; + virtual void SetMouseRestrictToWindow(UINT uValue) = 0; + virtual UINT GetTheFreezesF8Rom(void) = 0; + virtual void SetTheFreezesF8Rom(UINT uValue) = 0; }; diff --git a/source/Configuration/PageConfig.cpp b/source/Configuration/PageConfig.cpp index 37c27cd8..b0944722 100644 --- a/source/Configuration/PageConfig.cpp +++ b/source/Configuration/PageConfig.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "PageConfig.h" #include "PropertySheetHelper.h" +#include "../Interface.h" #include "../Windows/AppleWin.h" #include "../Windows/WinFrame.h" #include "../Registry.h" diff --git a/source/Configuration/PageDisk.cpp b/source/Configuration/PageDisk.cpp index 98ce4370..6fb51f15 100644 --- a/source/Configuration/PageDisk.cpp +++ b/source/Configuration/PageDisk.cpp @@ -26,10 +26,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "PageDisk.h" #include "PropertySheetHelper.h" +#include "../Interface.h" #include "../Windows/AppleWin.h" #include "../CardManager.h" #include "../Disk.h" // Drive_e, Disk_Status_e -#include "../Windows/WinFrame.h" #include "../Registry.h" #include "../resource/resource.h" diff --git a/source/Configuration/PropertySheet.cpp b/source/Configuration/PropertySheet.cpp index e9278206..018a8b37 100644 --- a/source/Configuration/PropertySheet.cpp +++ b/source/Configuration/PropertySheet.cpp @@ -31,8 +31,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "PropertySheet.h" +#include "../Interface.h" #include "../Windows/AppleWin.h" -#include "../Windows/WinFrame.h" #include "../resource/resource.h" void CPropertySheet::Init(void) diff --git a/source/Configuration/PropertySheetHelper.cpp b/source/Configuration/PropertySheetHelper.cpp index 5a4249f9..9d30968b 100644 --- a/source/Configuration/PropertySheetHelper.cpp +++ b/source/Configuration/PropertySheetHelper.cpp @@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../Log.h" #include "../Registry.h" #include "../SaveState.h" +#include "../Interface.h" /* Config causing AfterClose msgs: @@ -386,7 +387,7 @@ void CPropertySheetHelper::SaveCurrentConfig(void) m_ConfigOld.m_Slot[SLOT4] = GetCardMgr().QuerySlot(SLOT4); m_ConfigOld.m_Slot[SLOT5] = GetCardMgr().QuerySlot(SLOT5); m_ConfigOld.m_bEnableHDD = HD_CardIsEnabled(); - m_ConfigOld.m_bEnableTheFreezesF8Rom = sg_PropertySheet.GetTheFreezesF8Rom(); + m_ConfigOld.m_bEnableTheFreezesF8Rom = GetPropertySheet().GetTheFreezesF8Rom(); m_ConfigOld.m_videoRefreshRate = GetVideoRefreshRate(); // Reset flags each time: @@ -405,7 +406,7 @@ void CPropertySheetHelper::RestoreCurrentConfig(void) GetCardMgr().Insert(SLOT4, m_ConfigOld.m_Slot[SLOT4]); GetCardMgr().Insert(SLOT5, m_ConfigOld.m_Slot[SLOT5]); HD_SetEnabled(m_ConfigOld.m_bEnableHDD); - sg_PropertySheet.SetTheFreezesF8Rom(m_ConfigOld.m_bEnableTheFreezesF8Rom); + GetPropertySheet().SetTheFreezesF8Rom(m_ConfigOld.m_bEnableTheFreezesF8Rom); m_ConfigNew.m_videoRefreshRate = m_ConfigOld.m_videoRefreshRate; // Not SetVideoRefreshRate(), as this re-inits much Video/NTSC state! } diff --git a/source/Core.cpp b/source/Core.cpp index f8f0bdbb..fe118b9e 100644 --- a/source/Core.cpp +++ b/source/Core.cpp @@ -38,7 +38,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Speaker.h" #include "Registry.h" #include "SynchronousEventManager.h" -#include "Configuration/PropertySheet.h" #ifdef USE_SPEECH_API #include "Speech.h" @@ -80,8 +79,6 @@ int g_nMemoryClearType = MIP_FF_FF_00_00; // Note: -1 = random MIP in Memory.c SynchronousEventManager g_SynchronousEventMgr; -IPropertySheet& sg_PropertySheet = *new CPropertySheet; - HANDLE g_hCustomRomF8 = INVALID_HANDLE_VALUE; // Cmd-line specified custom F8 ROM at $F800..$FFFF bool g_bCustomRomF8Failed = false; // Set if custom F8 ROM file failed HANDLE g_hCustomRom = INVALID_HANDLE_VALUE; // Cmd-line specified custom ROM at $C000..$FFFF(16KiB) or $D000..$FFFF(12KiB) diff --git a/source/Core.h b/source/Core.h index 7eb8d34d..58bf1c41 100644 --- a/source/Core.h +++ b/source/Core.h @@ -67,8 +67,6 @@ extern bool g_bDisableDirectInput; // Cmd line switch: don't init DI (s extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (so no MB/Speaker support) extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support -extern __interface IPropertySheet& sg_PropertySheet; - //#define LOG_PERF_TIMINGS #ifdef LOG_PERF_TIMINGS class PerfMarker diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index e92cb623..4f714fc2 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../Windows/AppleWin.h" #include "../Core.h" +#include "../Interface.h" #include "../CardManager.h" #include "../CPU.h" #include "../Disk.h" diff --git a/source/Debugger/Debugger_Commands.cpp b/source/Debugger/Debugger_Commands.cpp index 28abcff4..1a75bbe4 100644 --- a/source/Debugger/Debugger_Commands.cpp +++ b/source/Debugger/Debugger_Commands.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Debug.h" -#include "../Windows/WinFrame.h" +#include "../Interface.h" // Commands _______________________________________________________________________________________ diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index 1977f5bb..fdbe117d 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -32,8 +32,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Debug.h" #include "Debugger_Display.h" -#include "../Windows/AppleWin.h" #include "../Core.h" +#include "../Interface.h" #include "../CPU.h" #include "../Frame.h" #include "../Windows/WinFrame.h" diff --git a/source/Interface.h b/source/Interface.h index fdaa5094..dd4b45b8 100644 --- a/source/Interface.h +++ b/source/Interface.h @@ -1,5 +1,7 @@ #pragma once +class IPropertySheet; + extern HINSTANCE g_hInstance; extern HWND g_hFrameWindow; extern BOOL g_bConfirmReboot; // saved PageConfig REGSAVE @@ -19,3 +21,5 @@ int SetViewportScale(int nNewScale, bool bForce = false); void SetAltEnterToggleFullScreen(bool mode); void SetLoadedSaveStateFlag(const bool bFlag); + +IPropertySheet& GetPropertySheet(); diff --git a/source/Joystick.cpp b/source/Joystick.cpp index ee65b5d5..192ef4fa 100644 --- a/source/Joystick.cpp +++ b/source/Joystick.cpp @@ -44,6 +44,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "CPU.h" #include "Memory.h" #include "YamlHelper.h" +#include "Interface.h" #include "Configuration/PropertySheet.h" @@ -344,7 +345,7 @@ BOOL JoyProcessKey(int virtkey, bool extended, bool down, bool autorep) BOOL keychange = 0; bool bIsCursorKey = false; - const bool swapButtons0and1 = sg_PropertySheet.GetButtonsSwapState(); + const bool swapButtons0and1 = GetPropertySheet().GetButtonsSwapState(); if (virtKeyWithExtended == g_buttonVirtKey[!swapButtons0and1 ? 0 : 1]) { @@ -433,7 +434,7 @@ BOOL JoyProcessKey(int virtkey, bool extended, bool down, bool autorep) buttonlatch[1] = BUTTONTIME; } } - else if ((down && !autorep) || (sg_PropertySheet.GetJoystickCenteringControl() == JOYSTICK_MODE_CENTERING)) + else if ((down && !autorep) || (GetPropertySheet().GetJoystickCenteringControl() == JOYSTICK_MODE_CENTERING)) { int xkeys = 0; int ykeys = 0; @@ -488,7 +489,7 @@ BOOL JoyProcessKey(int virtkey, bool extended, bool down, bool autorep) ypos[nJoyNum] = PDL_CENTRAL + g_nPdlTrimY; } - if (bIsCursorKey && sg_PropertySheet.GetJoystickCursorControl()) + if (bIsCursorKey && GetPropertySheet().GetJoystickCursorControl()) { // Allow AppleII keyboard to see this cursor keypress too return 0; @@ -505,7 +506,7 @@ static void DoAutofire(UINT uButton, BOOL& pressed) static BOOL lastPressed[3] = {0}; BOOL nowPressed = pressed; - if (sg_PropertySheet.GetAutofire(uButton) && pressed) + if (GetPropertySheet().GetAutofire(uButton) && pressed) { toggle[uButton] = (!lastPressed[uButton]) ? TRUE : !toggle[uButton]; pressed = pressed && toggle[uButton]; diff --git a/source/Keyboard.cpp b/source/Keyboard.cpp index bb814f52..20b577c0 100644 --- a/source/Keyboard.cpp +++ b/source/Keyboard.cpp @@ -31,7 +31,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Keyboard.h" #include "Windows/AppleWin.h" #include "Core.h" -#include "Windows/WinFrame.h" +#include "Interface.h" +#include "Utilities.h" #include "Pravets.h" #include "Tape.h" #include "YamlHelper.h" diff --git a/source/Memory.cpp b/source/Memory.cpp index 9c222f9d..72bbf516 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -1572,7 +1572,7 @@ void MemInitializeROM(void) default: { _tcscpy(sRomFileName, TEXT("Unknown type!")); - sg_PropertySheet.ConfigSaveApple2Type(A2TYPE_APPLE2EENHANCED); + GetPropertySheet().ConfigSaveApple2Type(A2TYPE_APPLE2EENHANCED); } } @@ -1674,7 +1674,7 @@ void MemInitializeCustomF8ROM(void) } } - if (sg_PropertySheet.GetTheFreezesF8Rom() && IS_APPLE2) + if (GetPropertySheet().GetTheFreezesF8Rom() && IS_APPLE2) { HGLOBAL hResData = NULL; BYTE* pData = NULL; diff --git a/source/SaveState.cpp b/source/SaveState.cpp index ccb4c29e..08e4b484 100644 --- a/source/SaveState.cpp +++ b/source/SaveState.cpp @@ -515,7 +515,7 @@ static void Snapshot_LoadState_v2(void) // . A change in h/w via loading a save-state avoids this VM restart // The latter is the desired approach (as the former needs a "power-on" / F2 to start things again) - sg_PropertySheet.ApplyNewConfig(m_ConfigNew, ConfigOld); // Mainly just saves (some) new state to Registry + GetPropertySheet().ApplyNewConfig(m_ConfigNew, ConfigOld); // Mainly just saves (some) new state to Registry MemInitializeROM(); MemInitializeCustomROM(); diff --git a/source/SerialComms.cpp b/source/SerialComms.cpp index 2bf386ac..f286cefa 100644 --- a/source/SerialComms.cpp +++ b/source/SerialComms.cpp @@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "SerialComms.h" #include "CPU.h" -#include "Windows/WinFrame.h" +#include "Interface.h" #include "Log.h" #include "Memory.h" #include "YamlHelper.h" diff --git a/source/Utilities.cpp b/source/Utilities.cpp index 156cd15b..3f6bfd74 100644 --- a/source/Utilities.cpp +++ b/source/Utilities.cpp @@ -75,11 +75,11 @@ static void LoadConfigOldJoystick_v1(const UINT uJoyNum) break; case 2: // Keyboard (standard) uNewJoyType = J0C_KEYBD_NUMPAD; - sg_PropertySheet.SetJoystickCenteringControl(JOYSTICK_MODE_FLOATING); + GetPropertySheet().SetJoystickCenteringControl(JOYSTICK_MODE_FLOATING); break; case 3: // Keyboard (centering) uNewJoyType = J0C_KEYBD_NUMPAD; - sg_PropertySheet.SetJoystickCenteringControl(JOYSTICK_MODE_CENTERING); + GetPropertySheet().SetJoystickCenteringControl(JOYSTICK_MODE_CENTERING); break; case 4: // Mouse uNewJoyType = J0C_MOUSE; @@ -124,7 +124,7 @@ void LoadConfiguration(void) "Load Configuration", MB_ICONSTOP | MB_SETFOREGROUND); - sg_PropertySheet.ConfigSaveApple2Type((eApple2Type)dwComputerType); + GetPropertySheet().ConfigSaveApple2Type((eApple2Type)dwComputerType); } apple2Type = (eApple2Type) dwComputerType; @@ -211,13 +211,13 @@ void LoadConfiguration(void) SetFullScreenShowSubunitStatus(dwTmp ? true : false); if(REGLOAD(TEXT(REGVALUE_THE_FREEZES_F8_ROM), &dwTmp)) - sg_PropertySheet.SetTheFreezesF8Rom(dwTmp); + GetPropertySheet().SetTheFreezesF8Rom(dwTmp); if(REGLOAD(TEXT(REGVALUE_SPKR_VOLUME), &dwTmp)) - SpkrSetVolume(dwTmp, sg_PropertySheet.GetVolumeMax()); + SpkrSetVolume(dwTmp, GetPropertySheet().GetVolumeMax()); if(REGLOAD(TEXT(REGVALUE_MB_VOLUME), &dwTmp)) - MB_SetVolume(dwTmp, sg_PropertySheet.GetVolumeMax()); + MB_SetVolume(dwTmp, GetPropertySheet().GetVolumeMax()); if(REGLOAD(TEXT(REGVALUE_SAVE_STATE_ON_EXIT), &dwTmp)) g_bSaveStateOnExit = dwTmp ? true : false; @@ -245,21 +245,21 @@ void LoadConfiguration(void) JoySetTrim((short)dwTmp, false); if(REGLOAD(TEXT(REGVALUE_SCROLLLOCK_TOGGLE), &dwTmp)) - sg_PropertySheet.SetScrollLockToggle(dwTmp); + GetPropertySheet().SetScrollLockToggle(dwTmp); if(REGLOAD(TEXT(REGVALUE_CURSOR_CONTROL), &dwTmp)) - sg_PropertySheet.SetJoystickCursorControl(dwTmp); + GetPropertySheet().SetJoystickCursorControl(dwTmp); if(REGLOAD(TEXT(REGVALUE_AUTOFIRE), &dwTmp)) - sg_PropertySheet.SetAutofire(dwTmp); + GetPropertySheet().SetAutofire(dwTmp); if(REGLOAD(TEXT(REGVALUE_SWAP_BUTTONS_0_AND_1), &dwTmp)) - sg_PropertySheet.SetButtonsSwapState(dwTmp ? true : false); + GetPropertySheet().SetButtonsSwapState(dwTmp ? true : false); if(REGLOAD(TEXT(REGVALUE_CENTERING_CONTROL), &dwTmp)) - sg_PropertySheet.SetJoystickCenteringControl(dwTmp); + GetPropertySheet().SetJoystickCenteringControl(dwTmp); if(REGLOAD(TEXT(REGVALUE_MOUSE_CROSSHAIR), &dwTmp)) - sg_PropertySheet.SetMouseShowCrosshair(dwTmp); + GetPropertySheet().SetMouseShowCrosshair(dwTmp); if(REGLOAD(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW), &dwTmp)) - sg_PropertySheet.SetMouseRestrictToWindow(dwTmp); + GetPropertySheet().SetMouseRestrictToWindow(dwTmp); if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp)) GetCardMgr().Insert(4, (SS_CARDTYPE)dwTmp); @@ -503,7 +503,7 @@ void GetAppleWindowTitle() if (g_hCustomRomF8 != INVALID_HANDLE_VALUE) g_pAppTitle += TEXT(" (custom rom)"); - else if (sg_PropertySheet.GetTheFreezesF8Rom() && IS_APPLE2) + else if (GetPropertySheet().GetTheFreezesF8Rom() && IS_APPLE2) g_pAppTitle += TEXT(" (The Freeze's non-autostart F8 rom)"); switch (g_nAppMode) diff --git a/source/Windows/AppleWin.cpp b/source/Windows/AppleWin.cpp index 3ad400d3..ca3ae324 100644 --- a/source/Windows/AppleWin.cpp +++ b/source/Windows/AppleWin.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "Windows/AppleWin.h" +#include "Interface.h" #include "Utilities.h" #include "CmdLine.h" #include "Debug.h" @@ -143,7 +144,7 @@ static void ContinueExecution(void) // bool bScrollLock_FullSpeed = false; - if (sg_PropertySheet.GetScrollLockToggle()) + if (GetPropertySheet().GetScrollLockToggle()) { bScrollLock_FullSpeed = g_bScrollLock_FullSpeed; } @@ -833,7 +834,7 @@ static void RepeatInitialization(void) if (g_cmdLine.bSwapButtons0and1) { - sg_PropertySheet.SetButtonsSwapState(true); + GetPropertySheet().SetButtonsSwapState(true); // Reapply after a restart - TODO: grey-out the Config UI for "Swap 0/1" when this cmd line is passed in } @@ -1047,3 +1048,9 @@ static void Shutdown(void) if (g_cmdLine.bSlot7EmptyOnExit) UnplugHardDiskControllerCard(); } + +IPropertySheet& GetPropertySheet() +{ + static CPropertySheet sg_PropertySheet; + return sg_PropertySheet; +} diff --git a/source/Windows/AppleWin.h b/source/Windows/AppleWin.h index cc05e0e9..0042829e 100644 --- a/source/Windows/AppleWin.h +++ b/source/Windows/AppleWin.h @@ -5,10 +5,7 @@ void SingleStep(bool bReinit); //=========================================== // Win32 -extern HINSTANCE g_hInstance; - bool GetLoadedSaveStateFlag(void); -void SetLoadedSaveStateFlag(const bool bFlag); bool GetHookAltGrControl(void); extern bool g_bRestartFullScreen; diff --git a/source/Windows/WinFrame.cpp b/source/Windows/WinFrame.cpp index c774cf53..03bed907 100644 --- a/source/Windows/WinFrame.cpp +++ b/source/Windows/WinFrame.cpp @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Windows/WinFrame.h" #include "Windows/AppleWin.h" +#include "Interface.h" #include "Keyboard.h" #include "Log.h" #include "Memory.h" @@ -246,10 +247,10 @@ static void RevealCursor() FrameShowCursor(TRUE); - if (sg_PropertySheet.GetMouseShowCrosshair()) // Erase crosshairs if they are being drawn + if (GetPropertySheet().GetMouseShowCrosshair()) // Erase crosshairs if they are being drawn DrawCrosshairs(0,0); - if (sg_PropertySheet.GetMouseRestrictToWindow()) + if (GetPropertySheet().GetMouseRestrictToWindow()) SetUsingCursor(FALSE); g_bLastCursorInAppleViewport = false; @@ -1294,7 +1295,7 @@ LRESULT CALLBACK FrameWndProc ( else if (wparam == VK_F11 && !KeybGetCtrlStatus()) // Save state (F11) { SoundCore_SetFade(FADE_OUT); - if(sg_PropertySheet.SaveStateSelectImage(window, true)) + if(GetPropertySheet().SaveStateSelectImage(window, true)) { Snapshot_SaveState(); } @@ -1303,7 +1304,7 @@ LRESULT CALLBACK FrameWndProc ( else if (wparam == VK_F12) // Load state (F12 or Ctrl+F12) { SoundCore_SetFade(FADE_OUT); - if(sg_PropertySheet.SaveStateSelectImage(window, false)) + if(GetPropertySheet().SaveStateSelectImage(window, false)) { Snapshot_LoadState(); } @@ -1337,7 +1338,7 @@ LRESULT CALLBACK FrameWndProc ( if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG)) VideoRedrawScreen(); } - else if ((wparam == VK_SCROLL) && sg_PropertySheet.GetScrollLockToggle()) + else if ((wparam == VK_SCROLL) && GetPropertySheet().GetScrollLockToggle()) { g_bScrollLock_FullSpeed = !g_bScrollLock_FullSpeed; } @@ -2070,7 +2071,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/) case BTN_SETUP: { - sg_PropertySheet.Init(); + GetPropertySheet().Init(); } break; @@ -2716,7 +2717,7 @@ static void DrawCrosshairsMouse() if (!GetCardMgr().IsMouseCardInstalled()) return; - if (!sg_PropertySheet.GetMouseShowCrosshair()) + if (!GetPropertySheet().GetMouseShowCrosshair()) return; int iX, iMinX, iMaxX; @@ -2743,7 +2744,7 @@ static void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int if (bOutsideAppleViewport) { - if (sg_PropertySheet.GetMouseRestrictToWindow()) + if (GetPropertySheet().GetMouseRestrictToWindow()) return; g_bLastCursorInAppleViewport = false; @@ -2775,7 +2776,7 @@ static void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int // - if (sg_PropertySheet.GetMouseRestrictToWindow()) + if (GetPropertySheet().GetMouseRestrictToWindow()) SetUsingCursor(TRUE); } else diff --git a/source/Windows/WinFrame.h b/source/Windows/WinFrame.h index b9eacc17..a9b18a41 100644 --- a/source/Windows/WinFrame.h +++ b/source/Windows/WinFrame.h @@ -1,40 +1,24 @@ #pragma once // Win32 - extern HWND g_hFrameWindow; extern int g_nViewportCX; extern int g_nViewportCY; - extern BOOL g_bConfirmReboot; // saved PageConfig REGSAVE - extern BOOL g_bMultiMon; // Emulator - extern bool g_bFreshReset; - extern std::string PathFilename[2]; extern bool g_bScrollLock_FullSpeed; // Prototypes - void CtrlReset(); - void FrameCreateWindow(void); HDC FrameGetDC (); void FrameReleaseDC (); - void FrameRefreshStatus (int, bool bUpdateDiskStatus = true ); void FrameRegisterClass (); - void FrameSetCursorPosByMousePos(); int GetViewportScale(void); - int SetViewportScale(int nNewScale, bool bForce = false); void GetViewportCXCY(int& nViewportCX, int& nViewportCY); - void FrameUpdateApple2Type(void); - bool GetBestDisplayResolutionForFullScreen(UINT& bestWidth, UINT& bestHeight, UINT userSpecifiedHeight=0); bool IsFullScreen(void); bool GetFullScreenShowSubunitStatus(void); - void SetFullScreenShowSubunitStatus(bool bShow); - - void FrameDrawDiskLEDS( HDC hdc ); - void FrameDrawDiskStatus( HDC hdc ); LRESULT CALLBACK FrameWndProc ( HWND window, @@ -47,5 +31,3 @@ UINT Get3DBorderWidth(void); UINT Get3DBorderHeight(void); - - void SetAltEnterToggleFullScreen(bool mode); diff --git a/source/Windows/WinVideo.cpp b/source/Windows/WinVideo.cpp index a6152530..dc06b16f 100644 --- a/source/Windows/WinVideo.cpp +++ b/source/Windows/WinVideo.cpp @@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Windows/WinVideo.h" #include "Windows/WinFrame.h" #include "Windows/AppleWin.h" +#include "Interface.h" #include "Video.h" #include "Core.h" #include "CPU.h" diff --git a/source/Windows/WinVideo.h b/source/Windows/WinVideo.h index 3f9820cd..1f6018e0 100644 --- a/source/Windows/WinVideo.h +++ b/source/Windows/WinVideo.h @@ -10,7 +10,6 @@ void VideoChooseMonochromeColor (); // FIXME: Should be moved to PageConfig a void VideoDisplayLogo (); void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = false); void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame); -void VideoRedrawScreen (void); void VideoRefreshScreen (uint32_t uRedrawWholeScreenVideoMode = 0, bool bRedrawWholeScreen = false); void Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename);