Press N to crete a new .d64 image
Still need to implement finding the highest existing numbered filename
This commit is contained in:
parent
9d10bcb3ef
commit
53de164fbe
7 changed files with 52 additions and 5 deletions
|
@ -32,6 +32,9 @@ extern "C"
|
|||
#include "rpi-gpio.h"
|
||||
}
|
||||
|
||||
#include "iec_commands.h"
|
||||
extern IEC_Commands m_IEC_Commands;
|
||||
|
||||
#define PNG_WIDTH 320
|
||||
#define PNG_HEIGHT 200
|
||||
|
||||
|
@ -892,6 +895,14 @@ void FileBrowser::UpdateInputFolders()
|
|||
dirty = AddToCaddy(current);
|
||||
}
|
||||
}
|
||||
else if (inputMappings->BrowseNewD64())
|
||||
{
|
||||
char newFileName[64];
|
||||
int num = folder.FindNextAutoName("testfile");
|
||||
snprintf(newFileName, 64, "testfile%03d.d64", num);
|
||||
m_IEC_Commands.CreateD64(newFileName, "42");
|
||||
FolderChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned keySetIndex;
|
||||
|
@ -1241,3 +1252,21 @@ void FileBrowser::AutoSelectImage(const char* image)
|
|||
selectionsMade = FillCaddyWithSelections();
|
||||
}
|
||||
}
|
||||
|
||||
int FileBrowser::BrowsableList::FindNextAutoName(const char* basename)
|
||||
{
|
||||
int index;
|
||||
int len = (int)entries.size();
|
||||
int baselen = strlen(basename);
|
||||
int lastNumber = 0;
|
||||
|
||||
for (index = 0; index < len; ++index)
|
||||
{
|
||||
Entry* entry = &entries[index];
|
||||
if (!(entry->filImage.fattrib & AM_DIR) && strncasecmp(basename, entry->filImage.fname, baselen) == 0)
|
||||
{
|
||||
lastNumber = 55;
|
||||
}
|
||||
}
|
||||
return lastNumber+1;
|
||||
}
|
||||
|
|
|
@ -151,6 +151,7 @@ public:
|
|||
};
|
||||
|
||||
Entry* FindEntry(const char* name);
|
||||
int FindNextAutoName(const char* basename);
|
||||
|
||||
void RefreshViews();
|
||||
void RefreshViewsHighlightScroll();
|
||||
|
|
|
@ -170,6 +170,8 @@ bool InputMappings::CheckKeyboardBrowseMode()
|
|||
// SetKeyboardFlag(PAGEUP_LCD_FLAG);
|
||||
//else if (keyboard->KeyHeld(KEY_END))
|
||||
// SetKeyboardFlag(PAGEDOWN_LCD_FLAG);
|
||||
else if (keyboard->KeyHeld(KEY_N))
|
||||
SetKeyboardFlag(NEWD64_FLAG);
|
||||
else
|
||||
{
|
||||
unsigned index;
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
#define PAGEDOWN_LCD_FLAG (1 << 12)
|
||||
#define PAGEUP_LCD_FLAG (1 << 13)
|
||||
|
||||
#define NEWD64_FLAG (1 << 14)
|
||||
// dont exceed 32!!
|
||||
|
||||
class InputMappings : public Singleton<InputMappings>
|
||||
{
|
||||
protected:
|
||||
|
@ -137,6 +140,11 @@ public:
|
|||
return KeyboardFlag(INSERT_FLAG)/* | UartFlag(INSERT_FLAG)*/ | ButtonFlag(INSERT_FLAG);
|
||||
}
|
||||
|
||||
inline bool BrowseNewD64()
|
||||
{
|
||||
return KeyboardFlag(NEWD64_FLAG);
|
||||
}
|
||||
|
||||
// Used by the 2 cores so need to be volatile
|
||||
//volatile static unsigned directDiskSwapRequest;
|
||||
static unsigned directDiskSwapRequest;
|
||||
|
|
|
@ -344,5 +344,9 @@ public:
|
|||
{
|
||||
return (keyStatus[0] | keyStatus[1]);
|
||||
}
|
||||
inline bool KeyLeftAlt()
|
||||
{
|
||||
return (modifier & 1<<2);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -78,6 +78,9 @@ public:
|
|||
const char* GetNameOfImageSelected() const { return selectedImageName; }
|
||||
const FILINFO* GetImageSelected() const { return &filInfoSelectedImage; }
|
||||
void SetStarFileName(const char* fileName) { starFileName = fileName; }
|
||||
|
||||
int CreateD64(char* filenameNew, char* ID);
|
||||
|
||||
protected:
|
||||
enum ATNSequence
|
||||
{
|
||||
|
@ -128,7 +131,6 @@ protected:
|
|||
void CloseAllChannels();
|
||||
void SendError();
|
||||
|
||||
int CreateD64(char* filenameNew, char* ID);
|
||||
|
||||
bool Enter(DIR& dir, FILINFO& filInfo);
|
||||
bool FindFirst(DIR& dir, const char* matchstr, FILINFO& filInfo);
|
||||
|
|
|
@ -793,7 +793,7 @@ void emulator()
|
|||
deviceID = m_IEC_Commands.GetDeviceId();
|
||||
fileBrowser->SetDeviceID(deviceID);
|
||||
fileBrowser->ShowDeviceAndROM();
|
||||
SetVIAsDeviceID(deviceID); // Let the emilated VIA know
|
||||
SetVIAsDeviceID(deviceID); // Let the emulated VIA know
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1361,3 +1361,4 @@ extern "C"
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue