Added option to specify which file LOAD"*" will actually load.

This commit is contained in:
Stephen White 2018-05-30 20:38:14 +10:00
parent d970e0ec73
commit 746c9efb1d
5 changed files with 28 additions and 0 deletions

View File

@ -232,6 +232,7 @@ IEC_Commands::IEC_Commands()
deviceID = 8; deviceID = 8;
usingVIC20 = false; usingVIC20 = false;
Reset(); Reset();
starFileName = 0;
} }
void IEC_Commands::Reset(void) void IEC_Commands::Reset(void)
@ -1810,6 +1811,20 @@ void IEC_Commands::OpenFile()
text = ParseNextName(text, filemode, true); text = ParseNextName(text, filemode, true);
} }
if (starFileName && starFileName[0] != 0 && filename[0] == '*')
{
char cwd[1024];
if (f_getcwd(cwd, 1024) == FR_OK)
{
if (strcasecmp(cwd, "/1541") == 0)
{
DEBUG_LOG("use star %s\r\n", starFileName);
strncpy(filename, starFileName, sizeof(filename) - 1);
}
}
}
if (toupper(filetype[0]) == 'L') if (toupper(filetype[0]) == 'L')
{ {
//DEBUG_LOG("Rel file\r\n"); //DEBUG_LOG("Rel file\r\n");

View File

@ -77,6 +77,7 @@ public:
const char* GetNameOfImageSelected() const { return selectedImageName; } const char* GetNameOfImageSelected() const { return selectedImageName; }
const FILINFO* GetImageSelected() const { return &filInfoSelectedImage; } const FILINFO* GetImageSelected() const { return &filInfoSelectedImage; }
void SetStarFileName(const char* fileName) { starFileName = fileName; }
protected: protected:
enum ATNSequence enum ATNSequence
{ {
@ -164,5 +165,7 @@ protected:
char selectedImageName[256]; char selectedImageName[256];
FILINFO filInfoSelectedImage; FILINFO filInfoSelectedImage;
const char* starFileName;
}; };
#endif #endif

View File

@ -1204,6 +1204,8 @@ extern "C"
f_chdir("/1541"); f_chdir("/1541");
m_IEC_Commands.SetDeviceId(deviceID); m_IEC_Commands.SetDeviceId(deviceID);
m_IEC_Commands.SetStarFileName(options.GetStarFileName());
SetVIAsDeviceID(deviceID); SetVIAsDeviceID(deviceID);
pi1541.drive.SetVIA(&pi1541.VIA[1]); pi1541.drive.SetVIA(&pi1541.VIA[1]);

View File

@ -137,6 +137,7 @@ Options::Options(void)
, screenHeight(768) , screenHeight(768)
{ {
strcpy(ROMFontName, "chargen"); strcpy(ROMFontName, "chargen");
starFileName[0] = 0;
ROMName[0] = 0; ROMName[0] = 0;
ROMNameSlot2[0] = 0; ROMNameSlot2[0] = 0;
ROMNameSlot3[0] = 0; ROMNameSlot3[0] = 0;
@ -257,6 +258,10 @@ void Options::Process(char* buffer)
{ {
strncpy(ROMFontName, pValue, 255); strncpy(ROMFontName, pValue, 255);
} }
else if ((strcasecmp(pOption, "StarFileName") == 0))
{
strncpy(starFileName, pValue, 255);
}
else if ((strcasecmp(pOption, "ROM") == 0) || (strcasecmp(pOption, "ROM1") == 0)) else if ((strcasecmp(pOption, "ROM") == 0) || (strcasecmp(pOption, "ROM1") == 0))
{ {
strncpy(ROMName, pValue, 255); strncpy(ROMName, pValue, 255);

View File

@ -48,6 +48,7 @@ public:
unsigned int GetOnResetChangeToStartingFolder() const { return onResetChangeToStartingFolder; } unsigned int GetOnResetChangeToStartingFolder() const { return onResetChangeToStartingFolder; }
const char* GetRomFontName() const { return ROMFontName; } const char* GetRomFontName() const { return ROMFontName; }
const char* GetRomName(int index) const; const char* GetRomName(int index) const;
const char* GetStarFileName() const { return starFileName; }
unsigned int GetExtraRAM() const { return extraRAM; } unsigned int GetExtraRAM() const { return extraRAM; }
unsigned int GetRAMBOard() const { return enableRAMBOard; } unsigned int GetRAMBOard() const { return enableRAMBOard; }
unsigned int GetDisableSD2IECCommands() const { return disableSD2IECCommands; } unsigned int GetDisableSD2IECCommands() const { return disableSD2IECCommands; }
@ -86,6 +87,8 @@ private:
unsigned int screenWidth; unsigned int screenWidth;
unsigned int screenHeight; unsigned int screenHeight;
char starFileName[256];
char ROMFontName[256]; char ROMFontName[256];
char ROMName[256]; char ROMName[256];
char ROMNameSlot2[256]; char ROMNameSlot2[256];