Skip to content

Commit

Permalink
Separate fire buttons on BBC joystick
Browse files Browse the repository at this point in the history
Map first two PC joystick or gamepad fire buttons to two BBC joystick
buttons separately.

Fixes #74
  • Loading branch information
monkeyman79 authored and chrisn committed Jun 19, 2021
1 parent 279eb92 commit 88c0fa7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Src/beebwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,10 +1293,10 @@ void BeebWin::InitJoystick(void)
}

/****************************************************************************/
void BeebWin::SetJoystickButton(bool button)
void BeebWin::SetJoystickButton(int index, bool button)
{
if (m_MenuIdSticks == IDM_JOYSTICK)
JoystickButton[0] = button;
JoystickButton[index] = button;
}

/****************************************************************************/
Expand Down Expand Up @@ -1878,7 +1878,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, // window handle

case MM_JOY1BUTTONDOWN:
case MM_JOY1BUTTONUP:
mainWin->SetJoystickButton(((UINT)uParam & (JOY_BUTTON1 | JOY_BUTTON2)) != 0);
mainWin->SetJoystickButton(0, ((UINT)uParam & JOY_BUTTON1) != 0);
mainWin->SetJoystickButton(1, ((UINT)uParam & JOY_BUTTON2) != 0);
break;

case MM_JOY2MOVE:
Expand Down
2 changes: 1 addition & 1 deletion Src/beebwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class BeebWin {
bool IsWindowMinimized() const;
void DisplayClientAreaText(HDC hdc);
void DisplayFDCBoardInfo(HDC hDC, int x, int y);
void SetJoystickButton(bool button);
void SetJoystickButton(int index, bool button);
void ScaleJoystick(unsigned int x, unsigned int y);
unsigned int GetJoystickAxes(JOYCAPS& caps, unsigned int deadband, JOYINFOEX& joyInfoEx);
void TranslateOrSendKey(int vkey, bool keyUp);
Expand Down

0 comments on commit 88c0fa7

Please sign in to comment.