AppleWin/source/CardManager.h
TomCh 769d4c6927
Support 2nd Disk][ card and improved card management (#726) (PR #741)
Support 2nd Disk][ in slot-5, via command line:
- -s5 diskii
- -s5d1 \<imagefile\>
- -s5d2 \<imagefile\>

NB. there's currently no Configuration UI support, except the Drive icons' tooltips show what's in slot-5 & slot-6 (for drive-n). So there's no way to eject the disks or insert new disks. The use-case I'm supporting it Wasteland which just has the 4 disks in the 4 drives.

Improved card management:
- Added `class Card` (in Card.h) which all other cards (that exist as classes) derive from (eg. LC,SSC,Mouse,Disk2).
- Added `class CardManager` (in CardManager.cpp\h) which now manages the 8 slots (and aux slot).
- Added `class Disk2CardManager` (in Disk2CardManager.cpp\h) which provides methods for operations that act on all Disk2 instances at the same time.
- Currently limited to just 1x SSC and 1x Mouse card (why would you need more?). This simplifies things, meaning there's no need to have dedicated SSCManager / MouseCardManager objects.
- Currently the 2nd Disk2 card can only be put into slot-5. This limitation is just due to the complexity of the Configuration UI. Having a more general drop-down per slot UI would remove this limitation.
2019-12-19 19:42:30 +00:00

57 lines
1.5 KiB
C++

#pragma once
#include "Card.h"
#include "Disk2CardManager.h"
class CardManager
{
public:
CardManager(void) :
m_pMouseCard(NULL),
m_pSSC(NULL)
{
Insert(0, CT_Empty);
Insert(1, CT_GenericPrinter);
Insert(2, CT_SSC);
Insert(3, CT_Uthernet);
Insert(4, CT_Empty);
Insert(5, CT_Empty);
Insert(6, CT_Disk2);
Insert(7, CT_Empty);
InsertAux(CT_Extended80Col); // For Apple //e and above
}
~CardManager(void)
{
for (UINT i=0; i<NUM_SLOTS; i++)
Remove(i);
RemoveAux();
}
void Insert(UINT slot, SS_CARDTYPE type);
void Remove(UINT slot);
SS_CARDTYPE QuerySlot(UINT slot) { return m_slot[slot]->QueryType(); }
Card* GetObj(UINT slot) { SS_CARDTYPE t=QuerySlot(slot); _ASSERT(t==CT_SSC || t==CT_MouseInterface || t==CT_Disk2); return m_slot[slot]; }
void InsertAux(SS_CARDTYPE type);
void RemoveAux(void);
SS_CARDTYPE QueryAux(void) { return m_aux->QueryType(); }
Card* GetObjAux(void) { _ASSERT(0); return m_aux; } // ASSERT because this is a DummyCard
//
Disk2CardManager& GetDisk2CardMgr(void) { return m_disk2CardMgr; }
class CMouseInterface* GetMouseCard(void) { return m_pMouseCard; }
bool IsMouseCardInstalled(void) { return m_pMouseCard != NULL; }
class CSuperSerialCard* GetSSC(void) { return m_pSSC; }
bool IsSSCInstalled(void) { return m_pSSC != NULL; }
private:
void RemoveInternal(UINT slot);
Card* m_slot[NUM_SLOTS];
Card* m_aux;
Disk2CardManager m_disk2CardMgr;
class CMouseInterface* m_pMouseCard;
class CSuperSerialCard* m_pSSC;
};