From 90c564a032fa1141106974c1f38af5bb12a3dccd Mon Sep 17 00:00:00 2001 From: tomcw Date: Mon, 19 Jan 2026 22:09:52 +0000 Subject: [PATCH] WIP: 'Reset all to Default' button: Input tab: cursor, swap, autofire, centering --- source/Configuration/Config.cpp | 19 ++++++++++++++++--- source/Configuration/Config.h | 7 +++++++ source/Configuration/IPropertySheet.h | 1 + source/Configuration/PageConfig.cpp | 9 +++++++++ source/Configuration/PageInput.h | 14 ++++++++++---- source/Configuration/PropertySheet.h | 1 + 6 files changed, 44 insertions(+), 7 deletions(-) diff --git a/source/Configuration/Config.cpp b/source/Configuration/Config.cpp index 49707f07..5755bd3c 100644 --- a/source/Configuration/Config.cpp +++ b/source/Configuration/Config.cpp @@ -53,6 +53,10 @@ CConfigNeedingRestart::CConfigNeedingRestart() m_enhanceDiskAccessSpeed = false; m_scrollLockToggle = 0; m_machineSpeed = 0; + m_cursorControl = 0; + m_centeringControl = 0; + m_autofire = 0; + m_swapButtons0and1 = false; m_RamWorksMemorySize = 0; m_serialPortItem = 0; } @@ -109,6 +113,10 @@ void CConfigNeedingRestart::Reload() m_scrollLockToggle = GetPropertySheet().GetScrollLockToggle(); m_enhanceDiskAccessSpeed = GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk(); m_machineSpeed = g_dwSpeed; + m_cursorControl = GetPropertySheet().GetJoystickCursorControl(); + m_centeringControl = GetPropertySheet().GetJoystickCenteringControl(); + m_autofire = GetPropertySheet().GetAutofire(); + m_swapButtons0and1 = GetPropertySheet().GetButtonsSwapState(); m_RamWorksMemorySize = GetRamWorksMemorySize(); if (cardManager.IsParallelPrinterCardInstalled()) @@ -138,6 +146,10 @@ const CConfigNeedingRestart& CConfigNeedingRestart::operator= (const CConfigNeed m_enhanceDiskAccessSpeed = other.m_enhanceDiskAccessSpeed; m_scrollLockToggle = other.m_scrollLockToggle; m_machineSpeed = other.m_machineSpeed; + m_cursorControl = other.m_cursorControl; + m_centeringControl = other.m_centeringControl; + m_autofire = other.m_autofire; + m_swapButtons0and1 = other.m_swapButtons0and1; m_RamWorksMemorySize = other.m_RamWorksMemorySize; m_parallelPrinterCard = other.m_parallelPrinterCard; m_serialPortItem = other.m_serialPortItem; @@ -154,9 +166,10 @@ const CConfigNeedingRestart& CConfigNeedingRestart::operator= (const CConfigNeed bool CConfigNeedingRestart::operator== (const CConfigNeedingRestart& other) const { // Ignore: (as they don't require the VM to be restarted) - // . m_confirmReboot, m_masterVolume - // . m_videoType, m_videoStyle, m_monochromeRGB, m_fullScreen_ShowSubunitStatus - // . m_enhanceDiskAccessSpeed, m_scrollLockToggle, m_machineSpeed + // . [Config] m_confirmReboot, m_masterVolume + // . [Config] m_videoType, m_videoStyle, m_monochromeRGB, m_fullScreen_ShowSubunitStatus + // . [Config] m_enhanceDiskAccessSpeed, m_scrollLockToggle, m_machineSpeed + // . [Input] m_cursorControl, m_centeringControl, m_autofire, m_swapButtons0and1 return m_Apple2Type == other.m_Apple2Type && m_CpuType == other.m_CpuType && diff --git a/source/Configuration/Config.h b/source/Configuration/Config.h index 18d4793b..22c705a1 100644 --- a/source/Configuration/Config.h +++ b/source/Configuration/Config.h @@ -44,6 +44,7 @@ public: bool m_tfeVirtualDNS; UINT m_bEnableTheFreezesF8Rom; UINT m_uSaveLoadStateMsg; + // Configuration bool m_confirmReboot; uint32_t m_masterVolume; VideoType_e m_videoType; @@ -54,6 +55,12 @@ public: bool m_enhanceDiskAccessSpeed; UINT m_scrollLockToggle; UINT m_machineSpeed; + // Input + UINT m_cursorControl; + UINT m_centeringControl; + UINT m_autofire; + bool m_swapButtons0and1; + // Slots uint32_t m_RamWorksMemorySize; // Size in 64K banks ParallelPrinterCard m_parallelPrinterCard; // Use entire card object, as there are many config vars UINT m_serialPortItem; // SSC: Just one config var for this card (at the moment) diff --git a/source/Configuration/IPropertySheet.h b/source/Configuration/IPropertySheet.h index 7d4e0b7d..b12a6d45 100644 --- a/source/Configuration/IPropertySheet.h +++ b/source/Configuration/IPropertySheet.h @@ -21,6 +21,7 @@ public: virtual UINT GetJoystickCenteringControl(void) = 0; virtual void SetJoystickCenteringControl(UINT uValue) = 0; virtual UINT GetAutofire(UINT uButton) = 0; + virtual UINT GetAutofire(void) = 0; virtual void SetAutofire(UINT uValue) = 0; virtual bool GetButtonsSwapState(void) = 0; virtual void SetButtonsSwapState(bool value) = 0; diff --git a/source/Configuration/PageConfig.cpp b/source/Configuration/PageConfig.cpp index ac0ce935..e417cc3f 100644 --- a/source/Configuration/PageConfig.cpp +++ b/source/Configuration/PageConfig.cpp @@ -415,6 +415,8 @@ void CPageConfig::ui_tfe_settings_dialog(HWND hWnd) void CPageConfig::ResetAllToDefault(HWND hWnd) { + // Configuration + const eApple2Type apple2Type = A2TYPE_APPLE2EENHANCED; m_PropertySheetHelper.GetConfigNew().m_Apple2Type = apple2Type; m_PropertySheetHelper.GetConfigNew().m_CpuType = ProbeMainCpuDefault(apple2Type); @@ -433,6 +435,13 @@ void CPageConfig::ResetAllToDefault(HWND hWnd) m_PropertySheetHelper.GetConfigNew().m_scrollLockToggle = kScrollLockToggle_Default; m_PropertySheetHelper.GetConfigNew().m_machineSpeed = kMachineSpeed_Default; + // Input + + m_PropertySheetHelper.GetConfigNew().m_cursorControl = CPageInput::kCursorControl_Default; + m_PropertySheetHelper.GetConfigNew().m_centeringControl = CPageInput::kCenteringControl_Default; + m_PropertySheetHelper.GetConfigNew().m_autofire = CPageInput::kAutofire_Default; + m_PropertySheetHelper.GetConfigNew().m_swapButtons0and1 = CPageInput::kSwapButtons0and1_Default; + // Slots m_PropertySheetHelper.ResetSlotsToDefault(); diff --git a/source/Configuration/PageInput.h b/source/Configuration/PageInput.h index d5e84fc0..f12e2449 100644 --- a/source/Configuration/PageInput.h +++ b/source/Configuration/PageInput.h @@ -12,10 +12,10 @@ public: CPageInput(CPropertySheetHelper& PropertySheetHelper) : m_Page(PG_INPUT), m_PropertySheetHelper(PropertySheetHelper), - m_uCursorControl(1), - m_uCenteringControl(JOYSTICK_MODE_CENTERING), - m_bmAutofire(0), - m_bSwapButtons0and1(false) + m_uCursorControl(kCursorControl_Default), + m_uCenteringControl(kCenteringControl_Default), + m_bmAutofire(kAutofire_Default), + m_bSwapButtons0and1(kSwapButtons0and1_Default) { CPageInput::ms_this = this; } @@ -28,10 +28,16 @@ public: UINT GetJoystickCenteringControl(void){ return m_uCenteringControl; } void SetJoystickCenteringControl(UINT uValue){ m_uCenteringControl = uValue; } UINT GetAutofire(UINT uButton) { return (m_bmAutofire >> uButton) & 1; } // Get a specific button + UINT GetAutofire(void) { return m_bmAutofire; } // Get all buttons void SetAutofire(UINT uValue) { m_bmAutofire = uValue; } // Set all buttons bool GetButtonsSwapState(void){ return m_bSwapButtons0and1; } void SetButtonsSwapState(bool value){ m_bSwapButtons0and1 = value; } + static const UINT kCursorControl_Default = 1; + static const UINT kCenteringControl_Default = JOYSTICK_MODE_CENTERING; + static const UINT kAutofire_Default = 0; + static const bool kSwapButtons0and1_Default = false; + protected: // IPropertySheetPage virtual INT_PTR DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam); diff --git a/source/Configuration/PropertySheet.h b/source/Configuration/PropertySheet.h index 9066587d..bb829f70 100644 --- a/source/Configuration/PropertySheet.h +++ b/source/Configuration/PropertySheet.h @@ -42,6 +42,7 @@ public: virtual UINT GetJoystickCenteringControl(void){ return m_PageInput.GetJoystickCenteringControl(); } virtual void SetJoystickCenteringControl(UINT uValue){ m_PageInput.SetJoystickCenteringControl(uValue); } virtual UINT GetAutofire(UINT uButton) { return m_PageInput.GetAutofire(uButton); } + virtual UINT GetAutofire(void) { return m_PageInput.GetAutofire(); } virtual void SetAutofire(UINT uValue) { m_PageInput.SetAutofire(uValue); } virtual bool GetButtonsSwapState(void) { return m_PageInput.GetButtonsSwapState(); } virtual void SetButtonsSwapState(bool value) { m_PageInput.SetButtonsSwapState(value); }