Mousecard: fix persisting card in slot-4 after a VM restart. (Fixes #993)

This commit is contained in:
tomcw 2021-10-19 21:56:19 +01:00
parent fa18382757
commit ca611eaa64
4 changed files with 6 additions and 6 deletions

View File

@ -137,9 +137,9 @@ void CardManager::RemoveInternal(UINT slot)
m_slot[slot] = NULL;
}
void CardManager::Remove(UINT slot)
void CardManager::Remove(UINT slot, bool updateRegistry/*=true*/)
{
Insert(slot, CT_Empty);
Insert(slot, CT_Empty, updateRegistry);
}
void CardManager::InsertAuxInternal(SS_CARDTYPE type)

View File

@ -29,7 +29,7 @@ public:
}
void Insert(UINT slot, SS_CARDTYPE type, bool updateRegistry = true);
void Remove(UINT slot);
void Remove(UINT slot, bool updateRegistry = true);
SS_CARDTYPE QuerySlot(UINT slot) { _ASSERT(slot<NUM_SLOTS); return m_slot[slot]->QueryType(); }
Card& GetRef(UINT slot)
{

View File

@ -292,7 +292,7 @@ void CPageInput::DlgOK(HWND hWnd)
UINT uNewJoyType1 = SendDlgItemMessage(hWnd, IDC_JOYSTICK1, CB_GETCURSEL, 0, 0);
if (uNewJoyType1 >= J1C_MAX) uNewJoyType1 = 0; // GH#434
const bool bIsSlot4Mouse = m_PropertySheetHelper.GetConfigNew().m_Slot[4] == CT_MouseInterface;
const bool bIsSlot4Mouse = m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT4] == CT_MouseInterface;
if (JoySetEmulationType(hWnd, m_nJoy0ChoiceTranlationTbl[uNewJoyType0], JN_JOYSTICK0, bIsSlot4Mouse))
{
@ -381,7 +381,7 @@ void CPageInput::InitJoystickChoices(HWND hWnd, int nJoyNum, int nIdcValue)
pszMem += strlen(ppszJoyChoices[nJC_JOYSTICK])+1;
pnJoyTranslationTbl[nIdx++] = nJC_JOYSTICK;
const bool bIsSlot4Mouse = m_PropertySheetHelper.GetConfigNew().m_Slot[4] == CT_MouseInterface;
const bool bIsSlot4Mouse = m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT4] == CT_MouseInterface;
// Now exclude:
// . the other Joystick type (if it exists) from this new list

View File

@ -552,7 +552,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
if (pMouseCard)
{
// dtor removes event from g_SynchronousEventMgr - do before g_SynchronousEventMgr.Reset()
GetCardMgr().Remove( pMouseCard->GetSlot() );
GetCardMgr().Remove( pMouseCard->GetSlot(), false );
LogFileOutput("Main: CMouseInterface::dtor\n");
}