Whilst in browse mode pressing Alt-W toggles write protection on a disk image.

This commit is contained in:
Stephen White 2018-07-29 15:55:46 +10:00
parent 5491711446
commit 09cfc4ec86
3 changed files with 26 additions and 0 deletions

View file

@ -977,6 +977,24 @@ void FileBrowser::UpdateInputFolders()
m_IEC_Commands.CreateD64(newFileName, "42", true); m_IEC_Commands.CreateD64(newFileName, "42", true);
FolderChanged(); FolderChanged();
} }
else if (inputMappings->BrowseWriteProtect())
{
FileBrowser::BrowsableList::Entry* current = folder.current;
if (current)
{
if (current->filImage.fattrib & AM_RDO)
{
current->filImage.fattrib &= ~AM_RDO;
f_chmod(current->filImage.fname, 0, AM_RDO);
}
else
{
current->filImage.fattrib |= AM_RDO;
f_chmod(current->filImage.fname, AM_RDO, AM_RDO);
}
dirty = true;
}
}
else else
{ {
unsigned keySetIndex; unsigned keySetIndex;

View file

@ -191,6 +191,8 @@ bool InputMappings::CheckKeyboardBrowseMode()
SetKeyboardFlag(AUTOLOAD_FLAG); SetKeyboardFlag(AUTOLOAD_FLAG);
else if (keyboard->KeyHeld(KEY_R) && keyboard->KeyEitherAlt() ) else if (keyboard->KeyHeld(KEY_R) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(FAKERESET_FLAG); SetKeyboardFlag(FAKERESET_FLAG);
else if (keyboard->KeyHeld(KEY_W) && keyboard->KeyEitherAlt())
SetKeyboardFlag(WRITEPROTECT_FLAG);
else else
{ {
unsigned index; unsigned index;

View file

@ -40,6 +40,7 @@
#define NEWD64_FLAG (1 << 14) #define NEWD64_FLAG (1 << 14)
#define AUTOLOAD_FLAG (1 << 15) #define AUTOLOAD_FLAG (1 << 15)
#define FAKERESET_FLAG (1 << 16) #define FAKERESET_FLAG (1 << 16)
#define WRITEPROTECT_FLAG (1 << 17)
// dont exceed 32!! // dont exceed 32!!
class InputMappings : public Singleton<InputMappings> class InputMappings : public Singleton<InputMappings>
@ -173,6 +174,11 @@ public:
return KeyboardFlag(FAKERESET_FLAG); return KeyboardFlag(FAKERESET_FLAG);
} }
inline bool BrowseWriteProtect()
{
return KeyboardFlag(WRITEPROTECT_FLAG);
}
// Used by the 2 cores so need to be volatile // Used by the 2 cores so need to be volatile
//volatile static unsigned directDiskSwapRequest; //volatile static unsigned directDiskSwapRequest;
static unsigned directDiskSwapRequest; static unsigned directDiskSwapRequest;