auto generated filename can be specified in options.txt with:
AutoBaseName = autoname
This commit is contained in:
parent
1142e7ff45
commit
876f417edd
5 changed files with 25 additions and 11 deletions
|
@ -34,6 +34,8 @@ extern "C"
|
|||
|
||||
#include "iec_commands.h"
|
||||
extern IEC_Commands m_IEC_Commands;
|
||||
extern Options options;
|
||||
|
||||
|
||||
#define PNG_WIDTH 320
|
||||
#define PNG_HEIGHT 200
|
||||
|
@ -898,8 +900,8 @@ void FileBrowser::UpdateInputFolders()
|
|||
else if (inputMappings->BrowseNewD64())
|
||||
{
|
||||
char newFileName[64];
|
||||
int num = folder.FindNextAutoName("testfile");
|
||||
snprintf(newFileName, 64, "testfile%03d.d64", num);
|
||||
strncpy (newFileName, options.GetAutoBaseName(), 63);
|
||||
int num = folder.FindNextAutoName( newFileName );
|
||||
m_IEC_Commands.CreateD64(newFileName, "42");
|
||||
FolderChanged();
|
||||
}
|
||||
|
@ -1253,16 +1255,17 @@ void FileBrowser::AutoSelectImage(const char* image)
|
|||
}
|
||||
}
|
||||
|
||||
int FileBrowser::BrowsableList::FindNextAutoName(const char* basename)
|
||||
int FileBrowser::BrowsableList::FindNextAutoName(char* filename)
|
||||
{
|
||||
int index;
|
||||
int len = (int)entries.size();
|
||||
int baselen = strlen(basename);
|
||||
int lastNumber = 0;
|
||||
char matchname[64];
|
||||
|
||||
strcpy (matchname, basename);
|
||||
strncat (matchname, "%d",2);
|
||||
int inputlen = strlen(filename);
|
||||
int lastNumber = 0;
|
||||
|
||||
char scanfname[64];
|
||||
strncpy (scanfname, filename, 54);
|
||||
strncat (scanfname, "%d",2);
|
||||
|
||||
int foundnumber;
|
||||
|
||||
|
@ -1270,13 +1273,14 @@ int FileBrowser::BrowsableList::FindNextAutoName(const char* basename)
|
|||
{
|
||||
Entry* entry = &entries[index];
|
||||
if ( !(entry->filImage.fattrib & AM_DIR)
|
||||
&& strncasecmp(basename, entry->filImage.fname, baselen) == 0
|
||||
&& sscanf(entry->filImage.fname, matchname, &foundnumber) == 1
|
||||
&& strncasecmp(filename, entry->filImage.fname, inputlen) == 0
|
||||
&& sscanf(entry->filImage.fname, scanfname, &foundnumber) == 1
|
||||
)
|
||||
{
|
||||
if (foundnumber > lastNumber)
|
||||
lastNumber = foundnumber;
|
||||
}
|
||||
}
|
||||
snprintf(filename + inputlen, 54, "%03d.d64", lastNumber+1);
|
||||
return lastNumber+1;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
};
|
||||
|
||||
Entry* FindEntry(const char* name);
|
||||
int FindNextAutoName(const char* basename);
|
||||
int FindNextAutoName(char* basename);
|
||||
|
||||
void RefreshViews();
|
||||
void RefreshViewsHighlightScroll();
|
||||
|
|
|
@ -1129,6 +1129,8 @@ void DisplayOptions(int y_pos)
|
|||
screen.PrintText(false, 0, y_pos += 16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||
snprintf(tempBuffer, tempBufferSize, "LcdLogoName = %s\r\n", options.GetLcdLogoName());
|
||||
screen.PrintText(false, 0, y_pos += 16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||
snprintf(tempBuffer, tempBufferSize, "AutoBaseName = %s\r\n", options.GetAutoBaseName());
|
||||
screen.PrintText(false, 0, y_pos += 16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||
}
|
||||
|
||||
void DisplayI2CScan(int y_pos)
|
||||
|
|
|
@ -152,6 +152,7 @@ Options::Options(void)
|
|||
autoMountImageName[0] = 0;
|
||||
strcpy(ROMFontName, "chargen");
|
||||
strcpy(LcdLogoName, "1541ii");
|
||||
strcpy(autoBaseName, "autoname");
|
||||
starFileName[0] = 0;
|
||||
ROMName[0] = 0;
|
||||
ROMNameSlot2[0] = 0;
|
||||
|
@ -224,6 +225,10 @@ void Options::Process(char* buffer)
|
|||
ELSE_CHECK_DECIMAL_OPTION(i2cLcdDimTime)
|
||||
ELSE_CHECK_FLOAT_OPTION(scrollHighlightRate)
|
||||
ELSE_CHECK_DECIMAL_OPTION(keyboardBrowseLCDScreen)
|
||||
else if ((strcasecmp(pOption, "AutoBaseName") == 0))
|
||||
{
|
||||
strncpy(autoBaseName, pValue, 255);
|
||||
}
|
||||
else if ((strcasecmp(pOption, "StarFileName") == 0))
|
||||
{
|
||||
strncpy(starFileName, pValue, 255);
|
||||
|
|
|
@ -89,6 +89,8 @@ public:
|
|||
|
||||
const char* GetLCDName() const { return LCDName; }
|
||||
|
||||
const char* GetAutoBaseName() const { return autoBaseName; }
|
||||
|
||||
static unsigned GetDecimal(char* pString);
|
||||
static float GetFloat(char* pString);
|
||||
|
||||
|
@ -128,6 +130,7 @@ private:
|
|||
unsigned int keyboardBrowseLCDScreen;
|
||||
|
||||
char starFileName[256];
|
||||
char autoBaseName[256];
|
||||
char LCDName[256];
|
||||
char LcdLogoName[256];
|
||||
|
||||
|
|
Loading…
Reference in a new issue