Feature Request #206 Command line switch: -memclear #

This commit is contained in:
michaelangel007 2014-07-17 20:18:59 -07:00
parent 9ded7f0926
commit f4b09e1f8f
4 changed files with 26 additions and 6 deletions

View File

@ -79,6 +79,7 @@ FILE* g_fh = NULL;
bool g_bDisableDirectInput = false;
bool g_bDisableDirectSound = false;
bool g_bDisableDirectSoundMockingboard = false;
int g_nMemoryClearType = -1;
IPropertySheet& sg_PropertySheet = * new CPropertySheet;
CSuperSerialCard sg_SSC;
@ -839,6 +840,17 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
{
g_bDisableDirectSoundMockingboard = true;
}
else if (strcmp(lpCmdLine, "-memclear") == 0)
{
lpCmdLine = GetCurrArg(lpNextArg);
lpNextArg = GetNextArg(lpNextArg);
g_nMemoryClearType = atoi(lpCmdLine);
if (g_nMemoryClearType < 0)
g_nMemoryClearType = 0;
else
if (g_nMemoryClearType >= NUM_MIP)
g_nMemoryClearType = NUM_MIP - 1;
}
#ifdef RAMWORKS
else if (strcmp(lpCmdLine, "-r") == 0) // RamWorks size [1..127]
{

View File

@ -42,6 +42,7 @@ extern FILE* g_fh; // Filehandle for log file
extern bool g_bDisableDirectInput; // Cmd line switch: don't init DI (so no DIMouse support)
extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (so no MB/Speaker support)
extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support
extern int g_nMemoryClearType; // Cmd line switch: use specific MIP (Memory Initialization Pattern)
extern SS_CARDTYPE g_Slot4; // Mockingboard, Z80, Mouse in slot4
extern SS_CARDTYPE g_Slot5; // Mockingboard, Z80, in slot5

View File

@ -1391,9 +1391,15 @@ void MemReset ()
// OR
// F2, Ctrl-F2, F7, HGR
DWORD clock = getRandomTime();
g_eMemoryInitPattern = static_cast<MemoryInitPattern_e>( clock % NUM_MIP );
if( g_eMemoryInitPattern == MIP_ZERO )
g_eMemoryInitPattern = MIP_FF_FF_00_00;
if ((g_nMemoryClearType >= 0) && (g_nMemoryClearType != MIP_RANDOM))
g_eMemoryInitPattern = static_cast<MemoryInitPattern_e>(g_nMemoryClearType);
else // random
{
g_eMemoryInitPattern = static_cast<MemoryInitPattern_e>( clock % NUM_MIP );
if (g_eMemoryInitPattern == MIP_RANDOM) // Twice Lucky! Force a choice.
g_eMemoryInitPattern = MIP_FF_FF_00_00;
}
switch( g_eMemoryInitPattern )
{

View File

@ -15,10 +15,11 @@ enum
enum MemoryInitPattern_e
{
MIP_ZERO
, MIP_RANDOM
, MIP_FF_FF_00_00
, MIP_FF_00_FULL_PAGE
, MIP_00_FF_HALF_PAGE
, MIP_FF_00_HALF_PAGE
, MIP_FF_00_FULL_PAGE
, MIP_00_FF_HALF_PAGE
, MIP_FF_00_HALF_PAGE
, NUM_MIP
};
extern MemoryInitPattern_e g_eMemoryInitPattern;