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; FileBrowser::BrowsableList::Entry* current = 0;
int index; int index;
@ -1088,7 +1088,7 @@ void FileBrowser::AutoSelectTestImage()
for (index = 0; index < maxEntries; ++index) for (index = 0; index < maxEntries; ++index)
{ {
current = &folder.entries[index]; current = &folder.entries[index];
if (strcmp(current->filImage.fname, "someimage.g64") == 0) if (strcasecmp(current->filImage.fname, image) == 0)
{ {
break; break;
} }

View File

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

View File

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

View File

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

View File

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