Config: Input: Added 'Swap 0/1' toggle for swapping buttons 0 & 1
This commit is contained in:
parent
53342d5550
commit
045d7b6509
12 changed files with 23 additions and 13 deletions
|
@ -33,6 +33,7 @@ then you should leave these values at 0.</li>
|
|||
<li>When cursor keys are used for joystick emulation <strong>and</strong> are allowed to be read from the keyboard, then some games won't work correctly (eg. Lode Runner).</li>
|
||||
<li>When cursor keys are blocked from being read from the keyboard, then simple command-line cursor editing in AppleSoft won't work.</li>
|
||||
</ul>
|
||||
<li>Swap 0/1: Swap buttons 0 and 1.</li>
|
||||
<li>Auto-fire (all 3 buttons): For each button pressed, the button's state will be toggled when read.</li>
|
||||
<li>Keyboard auto-centering: When keys used for joystick emulation are released then the joystick will return to the central position.</li>
|
||||
</ul>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 34 KiB |
|
@ -130,8 +130,9 @@ BEGIN
|
|||
LTEXT "&Y-trim:",IDC_STATIC,115,56,28,8
|
||||
CTEXT "0",IDC_STATIC,137,49,24,20,SS_CENTERIMAGE
|
||||
CONTROL "Spin1",IDC_SPIN_YTRIM,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY,161,53,10,14
|
||||
CONTROL "Allow cursor keys to be read from keyboard ",IDC_CURSORCONTROL,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,75,155,10
|
||||
CONTROL "Allow cursor keys to be read from keyboard",IDC_CURSORCONTROL,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,75,150,10
|
||||
CONTROL "Swap 0/1",IDC_SWAPBUTTONS0AND1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,75,41,10
|
||||
CONTROL "Auto-fire (all 3 buttons)",IDC_AUTOFIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,90,89,10
|
||||
CONTROL "Keyboard auto-centering",IDC_CENTERINGCONTROL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,90,96,10
|
||||
CONTROL "&Scroll Lock acts as toggle for full-speed CPU",IDC_SCROLLLOCK_TOGGLE,
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
#define IDC_CURSORCONTROL 1066
|
||||
#define IDC_AUTOFIRE 1067
|
||||
#define IDC_CENTERINGCONTROL 1068
|
||||
#define IDC_SWAPBUTTONS0AND1 1069
|
||||
#define IDC_COMBO_HDD1 1078
|
||||
#define IDC_COMBO_HDD2 1079
|
||||
#define IDC_COMBO_DISK1 1080
|
||||
|
|
|
@ -702,6 +702,8 @@ void LoadConfiguration(void)
|
|||
sg_PropertySheet.SetJoystickCursorControl(dwTmp);
|
||||
if(REGLOAD(TEXT(REGVALUE_AUTOFIRE), &dwTmp))
|
||||
sg_PropertySheet.SetAutofire(dwTmp);
|
||||
if(REGLOAD(TEXT(REGVALUE_SWAP_BUTTONS_0_AND_1), &dwTmp))
|
||||
sg_PropertySheet.SetButtonsSwapState(dwTmp ? true : false);
|
||||
if(REGLOAD(TEXT(REGVALUE_CENTERING_CONTROL), &dwTmp))
|
||||
sg_PropertySheet.SetJoystickCenteringControl(dwTmp);
|
||||
|
||||
|
@ -1591,7 +1593,7 @@ static bool ProcessCmdLine(LPSTR lpCmdLine)
|
|||
}
|
||||
else if (strcmp(lpCmdLine, "-swap-buttons") == 0)
|
||||
{
|
||||
JoySwapButton0and1(true);
|
||||
sg_PropertySheet.SetButtonsSwapState(true);
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-spkr-inc") == 0)
|
||||
{
|
||||
|
|
|
@ -85,6 +85,7 @@ enum AppMode_e
|
|||
#define REGVALUE_CURSOR_CONTROL "Joystick Cursor Control"
|
||||
#define REGVALUE_CENTERING_CONTROL "Joystick Centering Control"
|
||||
#define REGVALUE_AUTOFIRE "Autofire"
|
||||
#define REGVALUE_SWAP_BUTTONS_0_AND_1 "Swap buttons 0 and 1"
|
||||
#define REGVALUE_MOUSE_CROSSHAIR "Mouse crosshair"
|
||||
#define REGVALUE_MOUSE_RESTRICT_TO_WINDOW "Mouse restrict to window"
|
||||
#define REGVALUE_THE_FREEZES_F8_ROM "The Freeze's F8 Rom"
|
||||
|
|
|
@ -18,6 +18,8 @@ __interface IPropertySheet
|
|||
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);
|
||||
|
|
|
@ -197,6 +197,7 @@ BOOL CPageInput::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
|
|||
|
||||
CheckDlgButton(hWnd, IDC_CURSORCONTROL, m_uCursorControl ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_AUTOFIRE, m_bmAutofire ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_SWAPBUTTONS0AND1, m_bSwapButtons0and1 ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_CENTERINGCONTROL, m_uCenteringControl == JOYSTICK_MODE_CENTERING ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_SCROLLLOCK_TOGGLE, m_uScrollLockToggle ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
|
@ -234,6 +235,7 @@ void CPageInput::DlgOK(HWND hWnd)
|
|||
|
||||
m_uCursorControl = IsDlgButtonChecked(hWnd, IDC_CURSORCONTROL) ? 1 : 0;
|
||||
m_bmAutofire = IsDlgButtonChecked(hWnd, IDC_AUTOFIRE) ? 7 : 0; // bitmap of 3 bits
|
||||
m_bSwapButtons0and1 = IsDlgButtonChecked(hWnd, IDC_SWAPBUTTONS0AND1) ? true : false;
|
||||
m_uCenteringControl = IsDlgButtonChecked(hWnd, IDC_CENTERINGCONTROL) ? 1 : 0;
|
||||
m_uMouseShowCrosshair = IsDlgButtonChecked(hWnd, IDC_MOUSE_CROSSHAIR) ? 1 : 0;
|
||||
m_uMouseRestrictToWindow = IsDlgButtonChecked(hWnd, IDC_MOUSE_RESTRICT_TO_WINDOW) ? 1 : 0;
|
||||
|
@ -243,6 +245,7 @@ void CPageInput::DlgOK(HWND hWnd)
|
|||
REGSAVE(TEXT(REGVALUE_SCROLLLOCK_TOGGLE), m_uScrollLockToggle);
|
||||
REGSAVE(TEXT(REGVALUE_CURSOR_CONTROL), m_uCursorControl);
|
||||
REGSAVE(TEXT(REGVALUE_AUTOFIRE), m_bmAutofire);
|
||||
REGSAVE(TEXT(REGVALUE_SWAP_BUTTONS_0_AND_1), m_bSwapButtons0and1);
|
||||
REGSAVE(TEXT(REGVALUE_CENTERING_CONTROL), m_uCenteringControl);
|
||||
REGSAVE(TEXT(REGVALUE_MOUSE_CROSSHAIR), m_uMouseShowCrosshair);
|
||||
REGSAVE(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW), m_uMouseRestrictToWindow);
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
m_uCursorControl(1),
|
||||
m_uCenteringControl(JOYSTICK_MODE_CENTERING),
|
||||
m_bmAutofire(0),
|
||||
m_bSwapButtons0and1(false),
|
||||
m_uMouseShowCrosshair(0),
|
||||
m_uMouseRestrictToWindow(0),
|
||||
m_CPMChoice(CPM_UNPLUGGED)
|
||||
|
@ -34,6 +35,8 @@ public:
|
|||
void SetJoystickCenteringControl(UINT uValue){ m_uCenteringControl = uValue; }
|
||||
UINT GetAutofire(UINT uButton) { return (m_bmAutofire >> uButton) & 1; } // Get a specific button
|
||||
void SetAutofire(UINT uValue) { m_bmAutofire = uValue; } // Set all buttons
|
||||
bool GetButtonsSwapState(void){ return m_bSwapButtons0and1; }
|
||||
void SetButtonsSwapState(bool value){ m_bSwapButtons0and1 = value; }
|
||||
UINT GetMouseShowCrosshair(void){ return m_uMouseShowCrosshair; }
|
||||
void SetMouseShowCrosshair(UINT uValue){ m_uMouseShowCrosshair = uValue; }
|
||||
UINT GetMouseRestrictToWindow(void){ return m_uMouseRestrictToWindow; }
|
||||
|
@ -81,6 +84,7 @@ private:
|
|||
UINT m_uCursorControl; // 1 = Allow AppleII to read cursor keys from $C000 (when using keyboard for joystick emu)
|
||||
UINT m_uCenteringControl; // 1 = Centering, 0=Floating (when using keyboard for joystick emu)
|
||||
UINT m_bmAutofire; // bitmask b2:0
|
||||
bool m_bSwapButtons0and1;
|
||||
UINT m_uMouseShowCrosshair;
|
||||
UINT m_uMouseRestrictToWindow;
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
virtual void SetJoystickCenteringControl(UINT uValue){ m_PageInput.SetJoystickCenteringControl(uValue); }
|
||||
virtual UINT GetAutofire(UINT uButton) { return m_PageInput.GetAutofire(uButton); }
|
||||
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); }
|
||||
virtual UINT GetMouseShowCrosshair(void){ return m_PageInput.GetMouseShowCrosshair(); }
|
||||
virtual void SetMouseShowCrosshair(UINT uValue){ m_PageInput.SetMouseShowCrosshair(uValue); }
|
||||
virtual UINT GetMouseRestrictToWindow(void){ return m_PageInput.GetMouseRestrictToWindow(); }
|
||||
|
|
|
@ -303,13 +303,6 @@ void JoyInitialize()
|
|||
|
||||
//===========================================================================
|
||||
|
||||
static bool g_swapButton0and1 = false;
|
||||
|
||||
void JoySwapButton0and1(bool swap)
|
||||
{
|
||||
g_swapButton0and1 = swap;
|
||||
}
|
||||
|
||||
static UINT g_buttonVirtKey[2] = { VK_MENU, VK_MENU | KF_EXTENDED }; // VK_MENU == ALT Key
|
||||
|
||||
void JoySetButtonVirtualKey(UINT button, UINT virtKey)
|
||||
|
@ -350,13 +343,14 @@ BOOL JoyProcessKey(int virtkey, bool extended, bool down, bool autorep)
|
|||
|
||||
BOOL keychange = 0;
|
||||
bool bIsCursorKey = false;
|
||||
const bool swapButtons0and1 = sg_PropertySheet.GetButtonsSwapState();
|
||||
|
||||
if (virtKeyWithExtended == g_buttonVirtKey[!g_swapButton0and1 ? 0 : 1])
|
||||
if (virtKeyWithExtended == g_buttonVirtKey[!swapButtons0and1 ? 0 : 1])
|
||||
{
|
||||
keychange = 1;
|
||||
keydown[JK_OPENAPPLE] = down;
|
||||
}
|
||||
else if (virtKeyWithExtended == g_buttonVirtKey[!g_swapButton0and1 ? 1 : 0])
|
||||
else if (virtKeyWithExtended == g_buttonVirtKey[!swapButtons0and1 ? 1 : 0])
|
||||
{
|
||||
keychange = 1;
|
||||
keydown[JK_CLOSEDAPPLE] = down;
|
||||
|
|
|
@ -25,7 +25,6 @@ void JoySetTrim(short nValue, bool bAxisX);
|
|||
short JoyGetTrim(bool bAxisX);
|
||||
void JoyportControl(const UINT uControl);
|
||||
void JoySetHookAltKeys(bool hook);
|
||||
void JoySwapButton0and1(bool swap);
|
||||
void JoySetButtonVirtualKey(UINT button, UINT virtKey);
|
||||
void JoySaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
void JoyLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||
|
|
Loading…
Add table
Reference in a new issue