Added the option to auto mount a disk image (when resetting)

This will enable poeple to use AR6, EFL or FC3 to load fb64. To do so create a disk image with FB64 on it. copy it to the SD card's 1541 folder. add the line "autoMountImage = fb.d64" to options.txt. Now whenever the drive is reset it will automatically mount the disk image. As it is emulating people can use their cart of choice to load it. Once loaded they can simply back out of the image and browse the SD card as usual.
This commit is contained in:
Stephen White 2018-06-24 14:37:11 +10:00
parent 99ddf7c31f
commit c41ea162a2
5 changed files with 27 additions and 4 deletions

View file

@ -1079,7 +1079,7 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
}
}
void FileBrowser::AutoSelectTestImage()
void FileBrowser::AutoSelectImage(const char* image)
{
FileBrowser::BrowsableList::Entry* current = 0;
int index;
@ -1088,7 +1088,7 @@ void FileBrowser::AutoSelectTestImage()
for (index = 0; index < maxEntries; ++index)
{
current = &folder.entries[index];
if (strcmp(current->filImage.fname, "someimage.g64") == 0)
if (strcasecmp(current->filImage.fname, image) == 0)
{
break;
}

View file

@ -135,7 +135,7 @@ public:
FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, unsigned deviceID, bool displayPNGIcons, ScreenBase* screenMain, ScreenBase* screenLCD);
void AutoSelectTestImage();
void AutoSelectImage(const char* image);
void DisplayRoot();
void UpdateInput();

View file

@ -593,6 +593,16 @@ static void SetVIAsDeviceID(u8 id)
if (id & 2) pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL1, true);
}
static void CheckAutoMountImage(bool CD_, FileBrowser* fileBrowser)
{
if (CD_ == false)
{
const char* autoMountImageName = options.GetAutoMountImageName();
if (autoMountImageName[0] != 0)
fileBrowser->AutoSelectImage(autoMountImageName);
}
}
void emulator()
{
bool oldLED = false;
@ -603,6 +613,7 @@ void emulator()
bool selectedViaIECCommands = false;
InputMappings* inputMappings = InputMappings::Instance();
FileBrowser* fileBrowser;
bool CD_ = false;
roms.lastManualSelectedROMIndex = 0;
@ -642,6 +653,8 @@ void emulator()
{
m_IEC_Commands.SimulateIECBegin();
CheckAutoMountImage(CD_, fileBrowser);
while (!emulating)
{
IEC_Commands::UpdateAction updateAction = m_IEC_Commands.SimulateIECUpdate();
@ -653,10 +666,10 @@ void emulator()
fileBrowser->DisplayRoot();
IEC_Bus::Reset();
m_IEC_Commands.SimulateIECBegin();
CheckAutoMountImage(false, fileBrowser);
break;
case IEC_Commands::NONE:
{
//fileBrowser->AutoSelectTestImage();
fileBrowser->UpdateInput();
// Check selections made via FileBrowser
@ -791,6 +804,7 @@ void emulator()
// Exit full emulation back to IEC commands level simulation.
snoopIndex = 0;
emulating = false;
CD_ = true;
}
}
else
@ -902,6 +916,8 @@ void emulator()
fileBrowser->DisplayRoot();//m_IEC_Commands.ChangeToRoot(); // TO CHECK
emulating = false;
resetWhileEmulating = true;
if (reset || exitEmulation)
CD_ = false;
break;
}

View file

@ -145,6 +145,7 @@ Options::Options(void)
, i2cLcdFlip(0)
, keyboardBrowseLCDScreen(0)
{
autoMountImageName[0] = 0;
strcpy(ROMFontName, "chargen");
starFileName[0] = 0;
ROMName[0] = 0;
@ -186,6 +187,10 @@ void Options::Process(char* buffer)
{
strncpy(ROMFontName, pValue, 255);
}
else if ((strcasecmp(pOption, "AutoMountImage") == 0))
{
strncpy(autoMountImageName, pValue, 255);
}
ELSE_CHECK_DECIMAL_OPTION(deviceID)
ELSE_CHECK_DECIMAL_OPTION(onResetChangeToStartingFolder)
ELSE_CHECK_DECIMAL_OPTION(extraRAM)

View file

@ -46,6 +46,7 @@ public:
inline unsigned int GetDeviceID() const { return deviceID; }
inline unsigned int GetOnResetChangeToStartingFolder() const { return onResetChangeToStartingFolder; }
inline const char* GetAutoMountImageName() const { return autoMountImageName; }
inline const char* GetRomFontName() const { return ROMFontName; }
const char* GetRomName(int index) const;
inline const char* GetStarFileName() const { return starFileName; }
@ -119,6 +120,7 @@ private:
char starFileName[256];
char LCDName[256];
char autoMountImageName[256];
char ROMFontName[256];
char ROMName[256];
char ROMNameSlot2[256];