Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resource/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define APPLEWIN_VERSION 1,31,0,4
#define APPLEWIN_VERSION 1,31,0,5

#define xstr(a) str(a)
#define str(a) #a
Expand Down
3 changes: 2 additions & 1 deletion source/Card.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
111 changes: 56 additions & 55 deletions source/CmdLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ static LPSTR GetNextArg(LPSTR lpCmdLine)

//---------------------------------------------------------------------------

bool CardInstanceExists(SS_CARDTYPE cardType)
{
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
{
if (g_cmdLine.slotInfo[i].card == cardType)
return true;
}
return false;
}

//---------------------------------------------------------------------------

bool ProcessCmdLine(LPSTR lpCmdLine)
{
const std::string strCmdLine(lpCmdLine); // Keep a copy for log ouput
Expand Down Expand Up @@ -163,13 +175,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')
{
Expand All @@ -181,53 +203,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)
{
Expand All @@ -239,27 +261,21 @@ 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");
if (!CardInstanceExists(CT_GenericPrinter))
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");
if (!CardInstanceExists(CT_SSC))
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");
if (!CardInstanceExists(CT_VidHD))
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';
Expand Down Expand Up @@ -288,36 +304,21 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
LogFileOutput("Unsupported slot-%d card: %s\n", slot, lpCmdLine);
}
}
else if (lpCmdLine[3] == 'd' && (lpCmdLine[4] == '1' || lpCmdLine[4] == '2')) // -s[1..7]d[1|2] <dsk-image>
else if (lpCmdLine[3] == 'd' && (lpCmdLine[4] >= '1' && lpCmdLine[4] <= '2')) // -s[1..7]d[1|2] <dsk-image>
{
const UINT drive = lpCmdLine[4] == '1' ? DRIVE_1 : DRIVE_2;
const UINT drive = lpCmdLine[4] - '1';

if (slot != SLOT5 && slot != SLOT6)
{
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
}
else
{
lpCmdLine = GetCurrArg(lpNextArg);
lpNextArg = GetNextArg(lpNextArg);
g_cmdLine.szImageName_drive[slot][drive] = lpCmdLine;
}
lpCmdLine = GetCurrArg(lpNextArg);
lpNextArg = GetNextArg(lpNextArg);
g_cmdLine.szImageName_drive[slot][drive] = lpCmdLine;
}
else if (lpCmdLine[3] == 'h' && (lpCmdLine[4] >= '1' || lpCmdLine[4] <= '8')) // -s[1..7]h[1|2|...|8] <dsk-image>
else if (lpCmdLine[3] == 'h' && (lpCmdLine[4] >= '1' && lpCmdLine[4] <= '8')) // -s[1..7]h[1|2|...|8] <dsk-image>
{
const UINT drive = lpCmdLine[4] - '1';
bool badDrive = drive >= NUM_HARDDISKS;

if (badDrive || (slot != SLOT5 && slot != SLOT7))
{
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
}
else
{
lpCmdLine = GetCurrArg(lpNextArg);
lpNextArg = GetNextArg(lpNextArg);
g_cmdLine.szImageName_harddisk[slot][drive] = lpCmdLine;
}
lpCmdLine = GetCurrArg(lpNextArg);
lpNextArg = GetNextArg(lpNextArg);
g_cmdLine.szImageName_harddisk[slot][drive] = lpCmdLine;
}
else if (strcmp(lpCmdLine, "-s7-empty-on-exit") == 0)
{
Expand All @@ -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;
}
Expand Down Expand Up @@ -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]
Expand Down
14 changes: 4 additions & 10 deletions source/CmdLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ struct CmdLine
{
SlotInfo()
{
card = CT_Undefined;
isDiskII13 = false;
useHdcFirmwareMode = HdcUndefinedFromCmdLine;
useBad6522A = false;
useBad6522B = false;
socketSSI263[0] = socketSSI263[1] = socketSC01 = SSI263Unknown;
}

SS_CARDTYPE card;
bool isDiskII13;
HdcMode useHdcFirmwareMode;
bool useBad6522A;
Expand All @@ -33,7 +35,6 @@ struct CmdLine
bShutdown = false;
setFullScreen = -1;
bBoot = false;
bSlot0LanguageCard = false;
bSlot7EmptyOnExit = false;
bSwapButtons0and1 = false;
bRemoveNoSlotClock = false;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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];
Expand All @@ -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;
Expand Down
Loading
Loading