mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-10-24 23:02:25 +00:00
Fix bad_cast for inconsistent cmd-line options. Allow Parallel, SSC & VidHD card insertion into any slot. Allow floppy/HDD image insertion into any slot. . if inserting a floppy image, and the slot had no Disk II card, then insert one (consistent with HDD images).
This commit is contained in:
1 parent
fabc5104f3
commit
22dca96cbb
6 files changed
+132
-170
No files matched your search
+2
-1
@@ -30,7 +30,8 @@ enum SS_CARDTYPE
|
||||
CT_MegaAudio, // Soundcard
|
||||
CT_SDMusic, // Soundcard
|
||||
CT_BreakpointCard,
|
||||
CT_NUM_CARDS
|
||||
CT_NUM_CARDS,
|
||||
CT_Undefined = -1 // NB. Only for cmd line struct
|
||||
};
|
||||
|
||||
enum SLOTS { SLOT0=0, SLOT1, SLOT2, SLOT3, SLOT4, SLOT5, SLOT6, SLOT7, NUM_SLOTS, SLOT_AUX, GAME_IO_CONNECTOR };
|
||||
|
||||
+33
-32
@@ -163,13 +163,23 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||
lpNextArg = GetNextArg(lpNextArg);
|
||||
|
||||
if (strcmp(lpCmdLine, "empty") == 0)
|
||||
g_cmdLine.bSlotEmpty[SLOT0] = true;
|
||||
{
|
||||
g_cmdLine.slotInfo[SLOT0].card = CT_Empty;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "saturn") == 0 || strcmp(lpCmdLine, "saturn128") == 0)
|
||||
{
|
||||
g_cmdLine.uSaturnBanks = Saturn128K::kMaxSaturnBanks;
|
||||
g_cmdLine.slotInfo[SLOT0].card = CT_Saturn128K;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "saturn64") == 0)
|
||||
{
|
||||
g_cmdLine.uSaturnBanks = Saturn128K::kMaxSaturnBanks / 2;
|
||||
g_cmdLine.slotInfo[SLOT0].card = CT_Saturn128K;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "languagecard") == 0 || strcmp(lpCmdLine, "lc") == 0)
|
||||
g_cmdLine.bSlot0LanguageCard = true;
|
||||
{
|
||||
g_cmdLine.slotInfo[SLOT0].card = CT_LanguageCard;
|
||||
}
|
||||
}
|
||||
else if (lpCmdLine[0] == '-' && lpCmdLine[1] == 's' && lpCmdLine[2] >= '1' && lpCmdLine[2] <= '7')
|
||||
{
|
||||
@@ -181,53 +191,53 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||
lpNextArg = GetNextArg(lpNextArg);
|
||||
if (strcmp(lpCmdLine, "empty") == 0)
|
||||
{
|
||||
g_cmdLine.bSlotEmpty[slot] = true;
|
||||
g_cmdLine.slotInfo[slot].card = CT_Empty;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "diskii") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_Disk2;
|
||||
g_cmdLine.slotInfo[slot].card = CT_Disk2;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "diskii13") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_Disk2;
|
||||
g_cmdLine.slotInfo[slot].card = CT_Disk2;
|
||||
g_cmdLine.slotInfo[slot].isDiskII13 = true;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "hdc") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_GenericHDD;
|
||||
g_cmdLine.slotInfo[slot].card = CT_GenericHDD;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "hdc-sp") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_GenericHDD;
|
||||
g_cmdLine.slotInfo[slot].card = CT_GenericHDD;
|
||||
g_cmdLine.slotInfo[slot].useHdcFirmwareMode = HdcSmartPort;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "hdc-bm2") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_GenericHDD;
|
||||
g_cmdLine.slotInfo[slot].card = CT_GenericHDD;
|
||||
g_cmdLine.slotInfo[slot].useHdcFirmwareMode = HdcBlockMode2Devices;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "hdc-bm4") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_GenericHDD;
|
||||
g_cmdLine.slotInfo[slot].card = CT_GenericHDD;
|
||||
g_cmdLine.slotInfo[slot].useHdcFirmwareMode = HdcBlockMode4Devices;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "saturn") == 0 || strcmp(lpCmdLine, "saturn128") == 0) // Support Saturn128 card in slot 1-7 too (GH#1279)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_Saturn128K;
|
||||
g_cmdLine.slotInfo[slot].card = CT_Saturn128K;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "megaaudio") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_MegaAudio;
|
||||
g_cmdLine.slotInfo[slot].card = CT_MegaAudio;
|
||||
g_cmdLine.supportExtraMBCardTypes = true;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "sdmusic") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_SDMusic;
|
||||
g_cmdLine.slotInfo[slot].card = CT_SDMusic;
|
||||
g_cmdLine.supportExtraMBCardTypes = true;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "breakpointcard") == 0)
|
||||
{
|
||||
g_cmdLine.slotInsert[slot] = CT_BreakpointCard;
|
||||
g_cmdLine.slotInfo[slot].card = CT_BreakpointCard;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "6522a-bad") == 0)
|
||||
{
|
||||
@@ -239,27 +249,18 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "parallel") == 0)
|
||||
{
|
||||
if (slot == SLOT1)
|
||||
g_cmdLine.slotInsert[slot] = CT_GenericPrinter;
|
||||
else
|
||||
LogFileOutput("Parallel Printer card currently only supported in slot 1\n");
|
||||
g_cmdLine.slotInfo[slot].card = CT_GenericPrinter;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "ssc") == 0)
|
||||
{
|
||||
if (slot == SLOT2)
|
||||
g_cmdLine.slotInsert[slot] = CT_SSC;
|
||||
else
|
||||
LogFileOutput("SSC currently only supported in slot 2\n");
|
||||
g_cmdLine.slotInfo[slot].card = CT_SSC;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "vidhd") == 0)
|
||||
{
|
||||
if (slot == SLOT3)
|
||||
g_cmdLine.slotInsert[slot] = CT_VidHD;
|
||||
else
|
||||
LogFileOutput("VidHD currently only supported in slot 3\n");
|
||||
g_cmdLine.slotInfo[slot].card = CT_VidHD;
|
||||
}
|
||||
else if (strncmp(lpCmdLine, "socket", 6) == 0 &&
|
||||
(lpCmdLine[6] == '0' || lpCmdLine[6] == '1') && // 0=$Cs20(bottom of card), 1=$Cs40(top of card)
|
||||
(lpCmdLine[6] == '0' || lpCmdLine[6] == '1') && // 0=$Cs20(bottom of MB-C card), 1=$Cs40(top of MB-C card)
|
||||
lpCmdLine[7] == '=')
|
||||
{
|
||||
BYTE socket = lpCmdLine[6] - '0';
|
||||
@@ -308,7 +309,7 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||
const UINT drive = lpCmdLine[4] - '1';
|
||||
bool badDrive = drive >= NUM_HARDDISKS;
|
||||
|
||||
if (badDrive || (slot != SLOT5 && slot != SLOT7))
|
||||
if (badDrive)
|
||||
{
|
||||
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
|
||||
}
|
||||
@@ -334,19 +335,19 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||
lpNextArg = GetNextArg(lpNextArg);
|
||||
if (strcmp(lpCmdLine, "empty") == 0)
|
||||
{
|
||||
g_cmdLine.auxSlotEmpty = true;
|
||||
g_cmdLine.auxSlotCard = CT_Empty;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "std80") == 0)
|
||||
{
|
||||
g_cmdLine.auxSlotInsert = CT_80Col;
|
||||
g_cmdLine.auxSlotCard = CT_80Col;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "ext80") == 0)
|
||||
{
|
||||
g_cmdLine.auxSlotInsert = CT_Extended80Col;
|
||||
g_cmdLine.auxSlotCard = CT_Extended80Col;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "rw3") == 0)
|
||||
{
|
||||
g_cmdLine.auxSlotInsert = CT_RamWorksIII;
|
||||
g_cmdLine.auxSlotCard = CT_RamWorksIII;
|
||||
if (!g_cmdLine.uRamWorksExPages)
|
||||
g_cmdLine.uRamWorksExPages = kDefaultExMemoryBanksRealRW3;
|
||||
}
|
||||
@@ -452,7 +453,7 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||
g_cmdLine.uRamWorksExPages = kMaxExMemoryBanks;
|
||||
else if (g_cmdLine.uRamWorksExPages < 1)
|
||||
g_cmdLine.uRamWorksExPages = 1; // 1x64KB (aux mem)
|
||||
g_cmdLine.auxSlotInsert = CT_RamWorksIII; // Insert RW3 into aux slot
|
||||
g_cmdLine.auxSlotCard = CT_RamWorksIII; // Insert RW3 into aux slot
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(lpCmdLine, "-f8rom") == 0) // Use custom 2K ROM at [$F800..$FFFF]
|
||||
|
||||
+4
-10
@@ -13,6 +13,7 @@ struct CmdLine
|
||||
{
|
||||
SlotInfo()
|
||||
{
|
||||
card = CT_Undefined;
|
||||
isDiskII13 = false;
|
||||
useHdcFirmwareMode = HdcUndefinedFromCmdLine;
|
||||
useBad6522A = false;
|
||||
@@ -20,6 +21,7 @@ struct CmdLine
|
||||
socketSSI263[0] = socketSSI263[1] = socketSC01 = SSI263Unknown;
|
||||
}
|
||||
|
||||
SS_CARDTYPE card;
|
||||
bool isDiskII13;
|
||||
HdcMode useHdcFirmwareMode;
|
||||
bool useBad6522A;
|
||||
@@ -33,7 +35,6 @@ struct CmdLine
|
||||
bShutdown = false;
|
||||
setFullScreen = -1;
|
||||
bBoot = false;
|
||||
bSlot0LanguageCard = false;
|
||||
bSlot7EmptyOnExit = false;
|
||||
bSwapButtons0and1 = false;
|
||||
bRemoveNoSlotClock = false;
|
||||
@@ -63,15 +64,12 @@ struct CmdLine
|
||||
bestFullScreenResolution = false;
|
||||
userSpecifiedWidth = 0;
|
||||
userSpecifiedHeight = 0;
|
||||
auxSlotEmpty = false;
|
||||
auxSlotInsert = CT_Empty;
|
||||
auxSlotCard = CT_Undefined;
|
||||
sBootSectorFileName = "";
|
||||
nBootSectorFileSize = 0;
|
||||
|
||||
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
bSlotEmpty[i] = false;
|
||||
slotInsert[i] = CT_Empty;
|
||||
szImageName_drive[i][DRIVE_1] = NULL;
|
||||
szImageName_drive[i][DRIVE_2] = NULL;
|
||||
driveConnected[i][DRIVE_1] = true;
|
||||
@@ -84,8 +82,6 @@ struct CmdLine
|
||||
bool bShutdown;
|
||||
int setFullScreen; // tristate: -1 (no cmd line specified), 0="-no-full-screen", 1="-full-screen"
|
||||
bool bBoot;
|
||||
bool bSlot0LanguageCard;
|
||||
bool bSlotEmpty[NUM_SLOTS];
|
||||
bool bSlot7EmptyOnExit;
|
||||
bool bSwapButtons0and1;
|
||||
bool bRemoveNoSlotClock;
|
||||
@@ -97,7 +93,6 @@ struct CmdLine
|
||||
bool useHdcFirmwareV1; // debug
|
||||
bool useHdcFirmwareV2;
|
||||
bool useAltCpuEmulation; // debug
|
||||
SS_CARDTYPE slotInsert[NUM_SLOTS];
|
||||
SlotInfo slotInfo[NUM_SLOTS];
|
||||
LPCSTR szImageName_drive[NUM_SLOTS][NUM_DRIVES];
|
||||
bool driveConnected[NUM_SLOTS][NUM_DRIVES];
|
||||
@@ -123,8 +118,7 @@ struct CmdLine
|
||||
UINT userSpecifiedHeight;
|
||||
std::string wavFileSpeaker;
|
||||
std::string wavFileMockingboard;
|
||||
bool auxSlotEmpty;
|
||||
SS_CARDTYPE auxSlotInsert;
|
||||
SS_CARDTYPE auxSlotCard;
|
||||
std::string sBootSectorFileName;
|
||||
size_t nBootSectorFileSize;
|
||||
std::string debuggerAutoRunScriptFilename;
|
||||
|
||||
@@ -170,8 +170,15 @@ void Snapshot_GetDefaultFilenameAndPath(std::string& defaultFilename, std::strin
|
||||
// Attempt to get a default filename/path based on harddisk plugged-in or floppy disk inserted
|
||||
// . Priority given to harddisk over floppy images
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
|
||||
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).GetFilenameAndPathForSaveState(defaultFilename, defaultPath);
|
||||
for (int i = NUM_SLOTS - 1; i >= 0; i--) // scan slots backwards: 7->0
|
||||
{
|
||||
if (GetCardMgr().QuerySlot(i) == CT_GenericHDD)
|
||||
{
|
||||
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).GetFilenameAndPathForSaveState(defaultFilename, defaultPath);
|
||||
if (!defaultFilename.empty())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultFilename.empty())
|
||||
GetCardMgr().GetDisk2CardMgr().GetFilenameAndPathForSaveState(defaultFilename, defaultPath);
|
||||
|
||||
+33
-33
@@ -370,18 +370,18 @@ static void SetCurrentDir(const std::string & pathname)
|
||||
|
||||
static bool DoDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName)
|
||||
{
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
|
||||
Disk2InterfaceCard& card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
|
||||
|
||||
if (szFileName[0] == '\0')
|
||||
{
|
||||
disk2Card.EjectDisk(nDrive);
|
||||
card.EjectDisk(nDrive);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string strPathName = GetFullPath(szFileName);
|
||||
if (strPathName.empty()) return false;
|
||||
|
||||
ImageError_e Error = disk2Card.InsertDisk(nDrive, strPathName, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
||||
ImageError_e Error = card.InsertDisk(nDrive, strPathName, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
||||
bool res = (Error == eIMAGE_ERROR_NONE);
|
||||
if (res)
|
||||
SetCurrentDir(strPathName);
|
||||
@@ -390,20 +390,18 @@ static bool DoDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName)
|
||||
|
||||
static bool DoHardDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName)
|
||||
{
|
||||
_ASSERT(GetCardMgr().QuerySlot(slot) == CT_GenericHDD);
|
||||
if (GetCardMgr().QuerySlot(slot) != CT_GenericHDD)
|
||||
return false;
|
||||
HarddiskInterfaceCard& card = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(slot));
|
||||
|
||||
if (szFileName[0] == '\0')
|
||||
{
|
||||
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(slot)).Unplug(nDrive);
|
||||
card.Unplug(nDrive);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string strPathName = GetFullPath(szFileName);
|
||||
if (strPathName.empty()) return false;
|
||||
|
||||
BOOL bRes = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(slot)).Insert(nDrive, strPathName);
|
||||
BOOL bRes = card.Insert(nDrive, strPathName);
|
||||
bool res = (bRes == TRUE);
|
||||
if (res)
|
||||
SetCurrentDir(strPathName);
|
||||
@@ -412,40 +410,42 @@ static bool DoHardDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileNam
|
||||
|
||||
void InsertFloppyDisks(const UINT slot, LPCSTR szImageName_drive[NUM_DRIVES], bool driveConnected[NUM_DRIVES], bool& bBoot)
|
||||
{
|
||||
_ASSERT(slot == 5 || slot == 6);
|
||||
// If no FDDs then just return (and don't insert an FDC into this slot)
|
||||
bool res = true;
|
||||
for (UINT i = DRIVE_1; i < NUM_DRIVES; i++)
|
||||
res &= szImageName_drive[i] == NULL;
|
||||
if (res)
|
||||
return;
|
||||
|
||||
bool bRes = true;
|
||||
if (GetCardMgr().QuerySlot(slot) != CT_Disk2)
|
||||
GetCardMgr().Insert(slot, CT_Disk2); // Enable the Floppy drive controller card
|
||||
|
||||
if (!driveConnected[DRIVE_1])
|
||||
res = true;
|
||||
for (UINT i = DRIVE_1; i < NUM_DRIVES; i++)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot)).UnplugDrive(DRIVE_1);
|
||||
}
|
||||
else if (szImageName_drive[DRIVE_1])
|
||||
{
|
||||
bRes = DoDiskInsert(slot, DRIVE_1, szImageName_drive[DRIVE_1]);
|
||||
LogFileOutput("Init: S%d, DoDiskInsert(D1), res=%d\n", slot, bRes);
|
||||
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS); // floppy activity LEDs and floppy buttons
|
||||
bBoot = true;
|
||||
if (!driveConnected[i])
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot)).UnplugDrive(i);
|
||||
}
|
||||
else if (szImageName_drive[i])
|
||||
{
|
||||
res = DoDiskInsert(slot, i, szImageName_drive[i]);
|
||||
LogFileOutput("Init: S%d, DoDiskInsert(D%d), res=%d\n", slot, i+1, res);
|
||||
|
||||
if (i == DRIVE_1)
|
||||
{
|
||||
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS); // floppy activity LEDs and floppy buttons
|
||||
bBoot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!driveConnected[DRIVE_2])
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot)).UnplugDrive(DRIVE_2);
|
||||
}
|
||||
else if (szImageName_drive[DRIVE_2])
|
||||
{
|
||||
bRes &= DoDiskInsert(slot, DRIVE_2, szImageName_drive[DRIVE_2]);
|
||||
LogFileOutput("Init: S%d, DoDiskInsert(D2), res=%d\n", slot, bRes);
|
||||
}
|
||||
|
||||
if (!bRes)
|
||||
if (!res)
|
||||
GetFrame().FrameMessageBox("Failed to insert floppy disk(s) - see log file", "Warning", MB_ICONASTERISK | MB_OK);
|
||||
}
|
||||
|
||||
void InsertHardDisks(const UINT slot, LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot)
|
||||
{
|
||||
_ASSERT(slot == 5 || slot == 7);
|
||||
|
||||
// If no HDDs then just return (and don't insert an HDC into this slot)
|
||||
bool res = true;
|
||||
for (UINT i = 0; i < NUM_HARDDISKS; i++)
|
||||
@@ -457,7 +457,7 @@ void InsertHardDisks(const UINT slot, LPCSTR szImageName_harddisk[NUM_HARDDISKS]
|
||||
GetCardMgr().Insert(slot, CT_GenericHDD); // Enable the Harddisk controller card
|
||||
|
||||
res = true;
|
||||
for (UINT i = 0; i < NUM_HARDDISKS; i++)
|
||||
for (UINT i = HARDDISK_1; i < NUM_HARDDISKS; i++)
|
||||
{
|
||||
if (szImageName_harddisk[i])
|
||||
{
|
||||
|
||||
+51
-92
@@ -714,23 +714,18 @@ static void RepeatInitialization(void)
|
||||
g_cmdLine.clockMultiplier = 0.0;
|
||||
|
||||
// Apply the memory expansion switches after loading the Apple II machine type
|
||||
if (g_cmdLine.uSaturnBanks)
|
||||
if (IsApple2PlusOrClone(GetApple2Type()))
|
||||
{
|
||||
if (IsApple2PlusOrClone(GetApple2Type()))
|
||||
if (g_cmdLine.slotInfo[SLOT0].card == CT_Saturn128K)
|
||||
{
|
||||
Saturn128K::SetSaturnMemorySizeSlot0(g_cmdLine.uSaturnBanks); // Set number of banks before constructing Saturn card
|
||||
if (!g_cmdLine.bSlotEmpty[SLOT0])
|
||||
SetExpansionMemType(CT_Saturn128K);
|
||||
SetExpansionMemType(CT_Saturn128K);
|
||||
dynamic_cast<Saturn128K&>(GetCardMgr().GetRef(SLOT0)).SetSaturnMemorySize(g_cmdLine.uSaturnBanks);
|
||||
}
|
||||
g_cmdLine.uSaturnBanks = 0; // Don't reapply after a restart
|
||||
}
|
||||
|
||||
if (g_cmdLine.bSlot0LanguageCard)
|
||||
{
|
||||
if (!g_cmdLine.bSlotEmpty[SLOT0])
|
||||
else if (g_cmdLine.slotInfo[SLOT0].card == CT_LanguageCard)
|
||||
{
|
||||
SetExpansionMemType(CT_LanguageCard);
|
||||
g_cmdLine.bSlot0LanguageCard = false; // Don't reapply after a restart
|
||||
}
|
||||
}
|
||||
|
||||
if (g_cmdLine.bSwapButtons0and1)
|
||||
@@ -746,64 +741,36 @@ static void RepeatInitialization(void)
|
||||
VideoSwitchVideocardPalette(RGB_GetVideocard(), GetVideo().GetVideoType());
|
||||
|
||||
// Allow the slots to be configured as empty
|
||||
// NB. this state *is* persisted to the Registry/conf.ini (just like '-s7 empty' is)
|
||||
// . remove all first, so that single-instance cards can can switch slots
|
||||
// NB. this state is persisted to the Registry/conf.ini
|
||||
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_cmdLine.bSlotEmpty[i])
|
||||
if (g_cmdLine.slotInfo[i].card == CT_Empty)
|
||||
GetCardMgr().Remove(i);
|
||||
}
|
||||
|
||||
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_cmdLine.slotInfo[i].card != CT_Empty && g_cmdLine.slotInfo[i].card != CT_Undefined)
|
||||
{
|
||||
if (GetCardMgr().QuerySlot(i) != g_cmdLine.slotInfo[i].card)
|
||||
GetCardMgr().Insert(i, g_cmdLine.slotInfo[i].card);
|
||||
}
|
||||
|
||||
g_cmdLine.slotInfo[i].card = CT_Undefined; // Don't reapply after a restart
|
||||
}
|
||||
|
||||
if (g_cmdLine.supportDCD && GetCardMgr().IsSSCInstalled())
|
||||
{
|
||||
GetCardMgr().GetSSC()->SupportDCD(true);
|
||||
}
|
||||
|
||||
if (g_cmdLine.slotInsert[SLOT1] != CT_Empty && g_cmdLine.slotInsert[SLOT1] == CT_GenericPrinter) // For now just support Printer card in slot 1
|
||||
{
|
||||
GetCardMgr().Insert(SLOT1, g_cmdLine.slotInsert[SLOT1]);
|
||||
}
|
||||
|
||||
if (g_cmdLine.slotInsert[SLOT2] != CT_Empty && g_cmdLine.slotInsert[SLOT2] == CT_SSC) // For now just support SSC in slot 2
|
||||
{
|
||||
GetCardMgr().Insert(SLOT2, g_cmdLine.slotInsert[SLOT2]);
|
||||
}
|
||||
|
||||
if (g_cmdLine.enableDumpToRealPrinter && GetCardMgr().IsParallelPrinterCardInstalled())
|
||||
{
|
||||
GetCardMgr().GetParallelPrinterCard()->SetEnableDumpToRealPrinter(true);
|
||||
}
|
||||
|
||||
if (g_cmdLine.slotInsert[SLOT3] != CT_Empty)
|
||||
{
|
||||
// NB. Only support Saturn in slot 3, otherwise there's more Config UI to change
|
||||
if (g_cmdLine.slotInsert[SLOT3] == CT_VidHD || g_cmdLine.slotInsert[SLOT3] == CT_Saturn128K) // For now just support VidHD and Saturn128 in slot 3)
|
||||
GetCardMgr().Insert(SLOT3, g_cmdLine.slotInsert[SLOT3]);
|
||||
}
|
||||
|
||||
if (g_cmdLine.slotInsert[SLOT4] != CT_Empty)
|
||||
{
|
||||
GetCardMgr().Insert(SLOT4, g_cmdLine.slotInsert[SLOT4]);
|
||||
}
|
||||
|
||||
if (g_cmdLine.slotInsert[SLOT5] != CT_Empty)
|
||||
{
|
||||
if (GetCardMgr().QuerySlot(SLOT5) != g_cmdLine.slotInsert[SLOT5]) // Ignore if already got this card type in slot 5
|
||||
GetCardMgr().Insert(SLOT5, g_cmdLine.slotInsert[SLOT5]);
|
||||
}
|
||||
|
||||
if (g_cmdLine.slotInsert[SLOT6] == CT_Disk2) // For now just support Disk2 in slot 6
|
||||
{
|
||||
if (GetCardMgr().QuerySlot(SLOT6) != g_cmdLine.slotInsert[SLOT6]) // Ignore if already got this card type in slot 6
|
||||
GetCardMgr().Insert(SLOT6, g_cmdLine.slotInsert[SLOT6]);
|
||||
}
|
||||
|
||||
if (g_cmdLine.slotInsert[SLOT7] != CT_Empty)
|
||||
{
|
||||
if (GetCardMgr().QuerySlot(SLOT7) != g_cmdLine.slotInsert[SLOT7]) // Ignore if already got this card type in slot 7
|
||||
GetCardMgr().Insert(SLOT7, g_cmdLine.slotInsert[SLOT7]);
|
||||
}
|
||||
|
||||
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
|
||||
for (UINT i = SLOT1; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2 && g_cmdLine.slotInfo[i].isDiskII13)
|
||||
{
|
||||
@@ -842,30 +809,32 @@ static void RepeatInitialization(void)
|
||||
|
||||
// Aux slot
|
||||
|
||||
#ifdef RAMWORKS
|
||||
if (g_cmdLine.uRamWorksExPages)
|
||||
if (g_cmdLine.auxSlotCard != CT_Undefined)
|
||||
{
|
||||
if (!g_cmdLine.auxSlotEmpty)
|
||||
if (g_cmdLine.auxSlotCard == CT_Empty)
|
||||
{
|
||||
SetRamWorksMemorySize(g_cmdLine.uRamWorksExPages);
|
||||
_ASSERT(g_cmdLine.auxSlotInsert == CT_RamWorksIII); // Implicitly set when using cmd line "-r banks"
|
||||
GetCardMgr().RemoveAux();
|
||||
SetExpansionMemType(CT_Empty);
|
||||
}
|
||||
g_cmdLine.uRamWorksExPages = 0; // Don't reapply after a restart
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
if (GetCardMgr().QueryAux() != g_cmdLine.auxSlotCard) // Ignore if already got this card type in aux slot, ie. via LoadConfiguration()
|
||||
{
|
||||
GetCardMgr().InsertAux(g_cmdLine.auxSlotCard);
|
||||
SetExpansionMemType(g_cmdLine.auxSlotCard);
|
||||
}
|
||||
|
||||
if (g_cmdLine.auxSlotEmpty)
|
||||
{
|
||||
GetCardMgr().RemoveAux();
|
||||
SetExpansionMemType(CT_Empty);
|
||||
}
|
||||
else if (g_cmdLine.auxSlotInsert != CT_Empty)
|
||||
{
|
||||
if (GetCardMgr().QueryAux() != g_cmdLine.auxSlotInsert) // Ignore if already got this card type in aux slot, ie. via LoadConfiguration()
|
||||
{
|
||||
GetCardMgr().InsertAux(g_cmdLine.auxSlotInsert);
|
||||
SetExpansionMemType(g_cmdLine.auxSlotInsert);
|
||||
#ifdef RAMWORKS
|
||||
if (g_cmdLine.uRamWorksExPages)
|
||||
{
|
||||
_ASSERT(g_cmdLine.auxSlotCard == CT_RamWorksIII); // Implicitly set when using cmd line "-r banks"
|
||||
SetRamWorksMemorySize(g_cmdLine.uRamWorksExPages);
|
||||
g_cmdLine.uRamWorksExPages = 0; // Don't reapply after a restart
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
g_cmdLine.auxSlotCard = CT_Undefined; // Don't reapply after a restart
|
||||
}
|
||||
|
||||
// Create window after inserting/removing VidHD card (as it affects width & height)
|
||||
@@ -901,30 +870,20 @@ static void RepeatInitialization(void)
|
||||
}
|
||||
|
||||
// Pre: may need g_hFrameWindow for MessageBox errors
|
||||
// Post: may enable HDD, required for MemInitialize()->MemInitializeIO()
|
||||
// Post: may enable HDC card, required for MemInitialize()->MemInitializeIO(); and may enable DiskII card
|
||||
for (UINT i = SLOT1; i < NUM_SLOTS; i++)
|
||||
{
|
||||
bool temp = false;
|
||||
InsertFloppyDisks(SLOT5, g_cmdLine.szImageName_drive[SLOT5], g_cmdLine.driveConnected[SLOT5], temp);
|
||||
g_cmdLine.szImageName_drive[SLOT5][DRIVE_1] = g_cmdLine.szImageName_drive[SLOT5][DRIVE_2] = NULL; // Don't insert on a restart
|
||||
InsertFloppyDisks(i, g_cmdLine.szImageName_drive[i], g_cmdLine.driveConnected[i], temp);
|
||||
g_cmdLine.szImageName_drive[i][DRIVE_1] = g_cmdLine.szImageName_drive[i][DRIVE_2] = NULL; // Don't insert on a restart
|
||||
|
||||
InsertFloppyDisks(SLOT6, g_cmdLine.szImageName_drive[SLOT6], g_cmdLine.driveConnected[SLOT6], g_cmdLine.bBoot);
|
||||
g_cmdLine.szImageName_drive[SLOT6][DRIVE_1] = g_cmdLine.szImageName_drive[SLOT6][DRIVE_2] = NULL; // Don't insert on a restart
|
||||
|
||||
InsertHardDisks(SLOT5, g_cmdLine.szImageName_harddisk[SLOT5], temp);
|
||||
for (UINT i = 0; i < NUM_HARDDISKS; i++)
|
||||
g_cmdLine.szImageName_harddisk[SLOT5][i] = NULL; // Don't insert on a restart
|
||||
|
||||
InsertHardDisks(SLOT7, g_cmdLine.szImageName_harddisk[SLOT7], g_cmdLine.bBoot);
|
||||
for (UINT i = 0; i < NUM_HARDDISKS; i++)
|
||||
g_cmdLine.szImageName_harddisk[SLOT7][i] = NULL; // Don't insert on a restart
|
||||
|
||||
if (g_cmdLine.bSlotEmpty[SLOT7])
|
||||
{
|
||||
GetCardMgr().Remove(SLOT7); // Disable HDD controller, and persist this to Registry/conf.ini (consistent with other '-sn empty' cmds)
|
||||
Snapshot_UpdatePath(); // If save-state's filename is a harddisk, and the floppy is in the same path, then the filename won't be updated
|
||||
}
|
||||
InsertHardDisks(i, g_cmdLine.szImageName_harddisk[i], temp);
|
||||
for (UINT j = HARDDISK_1; j < NUM_HARDDISKS; j++)
|
||||
g_cmdLine.szImageName_harddisk[i][j] = NULL; // Don't insert on a restart
|
||||
}
|
||||
|
||||
Snapshot_UpdatePath(); // If save-state's filename is a harddisk, and the floppy is in the same path, then the filename won't be updated
|
||||
|
||||
// Set *after* InsertFloppyDisks() & InsertHardDisks(), which both update g_sCurrentDir
|
||||
if (!g_cmdLine.strCurrentDir.empty())
|
||||
SetCurrentImageDir(g_cmdLine.strCurrentDir);
|
||||
|
||||
Reference in new issue
Block a user