Added option to lowercase all filenames passed back to FB*

This commit is contained in:
Stephen White 2018-12-15 15:44:37 +11:00
parent 7eccc56eda
commit cb04179fc9
5 changed files with 25 additions and 3 deletions

View file

@ -243,6 +243,7 @@ IEC_Commands::IEC_Commands()
starFileName = 0; starFileName = 0;
C128BootSectorName = 0; C128BootSectorName = 0;
displayingDevices = false; displayingDevices = false;
lowercaseBrowseModeFilenames = false;
} }
void IEC_Commands::Reset(void) void IEC_Commands::Reset(void)
@ -1602,6 +1603,14 @@ void IEC_Commands::SendError()
while (!finalByte); while (!finalByte);
} }
u8 IEC_Commands::GetFilenameCharacter(u8 value)
{
if (lowercaseBrowseModeFilenames)
value = tolower(value);
return ascii2petscii(value);
}
void IEC_Commands::AddDirectoryEntry(Channel& channel, const char* name, u16 blocks, int fileType) void IEC_Commands::AddDirectoryEntry(Channel& channel, const char* name, u16 blocks, int fileType)
{ {
u8* data = channel.buffer + channel.cursor; u8* data = channel.buffer + channel.cursor;
@ -1640,20 +1649,20 @@ void IEC_Commands::AddDirectoryEntry(Channel& channel, const char* name, u16 blo
do do
{ {
data[index + i++] = ascii2petscii(*name++); data[index + i++] = GetFilenameCharacter(*name++);
} }
while (!(*name == 0x22 || *name == 0 || i == CBM_NAME_LENGTH_MINUS_D64)); while (!(*name == 0x22 || *name == 0 || i == CBM_NAME_LENGTH_MINUS_D64));
for (int extIndex = 0; extIndex < 4; ++extIndex) for (int extIndex = 0; extIndex < 4; ++extIndex)
{ {
data[index + i++] = ascii2petscii(*extName++); data[index + i++] = GetFilenameCharacter(*extName++);
} }
} }
else else
{ {
do do
{ {
data[index + i++] = ascii2petscii(*name++); data[index + i++] = GetFilenameCharacter(*name++);
} }
while (!(*name == 0x22 || *name == 0 || i == CBM_NAME_LENGTH)); while (!(*name == 0x22 || *name == 0 || i == CBM_NAME_LENGTH));
} }

View file

@ -72,6 +72,8 @@ public:
void SetDeviceId(u8 id) { deviceID = id; } void SetDeviceId(u8 id) { deviceID = id; }
u8 GetDeviceId() { return deviceID; } u8 GetDeviceId() { return deviceID; }
void SetLowercaseBrowseModeFilenames(bool value) { lowercaseBrowseModeFilenames = value; }
void SetAutoBootFB128(bool autoBootFB128) { this->autoBootFB128 = autoBootFB128; } void SetAutoBootFB128(bool autoBootFB128) { this->autoBootFB128 = autoBootFB128; }
void Set128BootSectorName(const char* SectorName) void Set128BootSectorName(const char* SectorName)
{ {
@ -165,6 +167,8 @@ protected:
bool SendBuffer(Channel& channel, bool eoi); bool SendBuffer(Channel& channel, bool eoi);
u8 GetFilenameCharacter(u8 value);
UpdateAction updateAction; UpdateAction updateAction;
u8 commandCode; u8 commandCode;
bool receivedCommand : 1; bool receivedCommand : 1;
@ -188,6 +192,7 @@ protected:
const char* C128BootSectorName; const char* C128BootSectorName;
bool displayingDevices; bool displayingDevices;
bool lowercaseBrowseModeFilenames;
}; };
#endif #endif

View file

@ -1051,6 +1051,7 @@ void emulator()
m_IEC_Commands.SetAutoBootFB128(options.AutoBootFB128()); m_IEC_Commands.SetAutoBootFB128(options.AutoBootFB128());
m_IEC_Commands.Set128BootSectorName(options.Get128BootSectorName()); m_IEC_Commands.Set128BootSectorName(options.Get128BootSectorName());
m_IEC_Commands.SetLowercaseBrowseModeFilenames(options.LowercaseBrowseModeFilenames());
emulating = IEC_COMMANDS; emulating = IEC_COMMANDS;

View file

@ -139,6 +139,7 @@ Options::Options(void)
, splitIECLines(0) , splitIECLines(0)
, ignoreReset(0) , ignoreReset(0)
, autoBootFB128(0) , autoBootFB128(0)
, lowercaseBrowseModeFilenames(0)
, screenWidth(1024) , screenWidth(1024)
, screenHeight(768) , screenHeight(768)
, i2cBusMaster(1) , i2cBusMaster(1)
@ -223,6 +224,7 @@ void Options::Process(char* buffer)
ELSE_CHECK_DECIMAL_OPTION(invertIECOutputs) ELSE_CHECK_DECIMAL_OPTION(invertIECOutputs)
ELSE_CHECK_DECIMAL_OPTION(splitIECLines) ELSE_CHECK_DECIMAL_OPTION(splitIECLines)
ELSE_CHECK_DECIMAL_OPTION(ignoreReset) ELSE_CHECK_DECIMAL_OPTION(ignoreReset)
ELSE_CHECK_DECIMAL_OPTION(lowercaseBrowseModeFilenames)
ELSE_CHECK_DECIMAL_OPTION(autoBootFB128) ELSE_CHECK_DECIMAL_OPTION(autoBootFB128)
ELSE_CHECK_DECIMAL_OPTION(screenWidth) ELSE_CHECK_DECIMAL_OPTION(screenWidth)
ELSE_CHECK_DECIMAL_OPTION(screenHeight) ELSE_CHECK_DECIMAL_OPTION(screenHeight)

View file

@ -73,6 +73,9 @@ public:
inline unsigned int AutoBootFB128() const { return autoBootFB128; } inline unsigned int AutoBootFB128() const { return autoBootFB128; }
inline const char* Get128BootSectorName() const { return C128BootSectorName; } inline const char* Get128BootSectorName() const { return C128BootSectorName; }
inline unsigned int LowercaseBrowseModeFilenames() const { return lowercaseBrowseModeFilenames; }
inline unsigned int ScreenWidth() const { return screenWidth; } inline unsigned int ScreenWidth() const { return screenWidth; }
inline unsigned int ScreenHeight() const { return screenHeight; } inline unsigned int ScreenHeight() const { return screenHeight; }
@ -126,6 +129,8 @@ private:
unsigned int ignoreReset; unsigned int ignoreReset;
unsigned int autoBootFB128; unsigned int autoBootFB128;
unsigned int lowercaseBrowseModeFilenames;
unsigned int screenWidth; unsigned int screenWidth;
unsigned int screenHeight; unsigned int screenHeight;