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 "rpi-gpio.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "iec_commands.h"
|
||||||
|
extern IEC_Commands m_IEC_Commands;
|
||||||
|
|
||||||
#define PNG_WIDTH 320
|
#define PNG_WIDTH 320
|
||||||
#define PNG_HEIGHT 200
|
#define PNG_HEIGHT 200
|
||||||
|
|
||||||
|
@ -892,6 +895,14 @@ void FileBrowser::UpdateInputFolders()
|
||||||
dirty = AddToCaddy(current);
|
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
|
else
|
||||||
{
|
{
|
||||||
unsigned keySetIndex;
|
unsigned keySetIndex;
|
||||||
|
@ -1241,3 +1252,21 @@ void FileBrowser::AutoSelectImage(const char* image)
|
||||||
selectionsMade = FillCaddyWithSelections();
|
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);
|
Entry* FindEntry(const char* name);
|
||||||
|
int FindNextAutoName(const char* basename);
|
||||||
|
|
||||||
void RefreshViews();
|
void RefreshViews();
|
||||||
void RefreshViewsHighlightScroll();
|
void RefreshViewsHighlightScroll();
|
||||||
|
|
|
@ -170,6 +170,8 @@ bool InputMappings::CheckKeyboardBrowseMode()
|
||||||
// SetKeyboardFlag(PAGEUP_LCD_FLAG);
|
// SetKeyboardFlag(PAGEUP_LCD_FLAG);
|
||||||
//else if (keyboard->KeyHeld(KEY_END))
|
//else if (keyboard->KeyHeld(KEY_END))
|
||||||
// SetKeyboardFlag(PAGEDOWN_LCD_FLAG);
|
// SetKeyboardFlag(PAGEDOWN_LCD_FLAG);
|
||||||
|
else if (keyboard->KeyHeld(KEY_N))
|
||||||
|
SetKeyboardFlag(NEWD64_FLAG);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned index;
|
unsigned index;
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
#define PAGEDOWN_LCD_FLAG (1 << 12)
|
#define PAGEDOWN_LCD_FLAG (1 << 12)
|
||||||
#define PAGEUP_LCD_FLAG (1 << 13)
|
#define PAGEUP_LCD_FLAG (1 << 13)
|
||||||
|
|
||||||
|
#define NEWD64_FLAG (1 << 14)
|
||||||
|
// dont exceed 32!!
|
||||||
|
|
||||||
class InputMappings : public Singleton<InputMappings>
|
class InputMappings : public Singleton<InputMappings>
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -137,6 +140,11 @@ public:
|
||||||
return KeyboardFlag(INSERT_FLAG)/* | UartFlag(INSERT_FLAG)*/ | ButtonFlag(INSERT_FLAG);
|
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
|
// Used by the 2 cores so need to be volatile
|
||||||
//volatile static unsigned directDiskSwapRequest;
|
//volatile static unsigned directDiskSwapRequest;
|
||||||
static unsigned directDiskSwapRequest;
|
static unsigned directDiskSwapRequest;
|
||||||
|
|
|
@ -344,5 +344,9 @@ public:
|
||||||
{
|
{
|
||||||
return (keyStatus[0] | keyStatus[1]);
|
return (keyStatus[0] | keyStatus[1]);
|
||||||
}
|
}
|
||||||
|
inline bool KeyLeftAlt()
|
||||||
|
{
|
||||||
|
return (modifier & 1<<2);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -78,6 +78,9 @@ 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; }
|
void SetStarFileName(const char* fileName) { starFileName = fileName; }
|
||||||
|
|
||||||
|
int CreateD64(char* filenameNew, char* ID);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum ATNSequence
|
enum ATNSequence
|
||||||
{
|
{
|
||||||
|
@ -128,7 +131,6 @@ protected:
|
||||||
void CloseAllChannels();
|
void CloseAllChannels();
|
||||||
void SendError();
|
void SendError();
|
||||||
|
|
||||||
int CreateD64(char* filenameNew, char* ID);
|
|
||||||
|
|
||||||
bool Enter(DIR& dir, FILINFO& filInfo);
|
bool Enter(DIR& dir, FILINFO& filInfo);
|
||||||
bool FindFirst(DIR& dir, const char* matchstr, FILINFO& filInfo);
|
bool FindFirst(DIR& dir, const char* matchstr, FILINFO& filInfo);
|
||||||
|
|
|
@ -793,7 +793,7 @@ void emulator()
|
||||||
deviceID = m_IEC_Commands.GetDeviceId();
|
deviceID = m_IEC_Commands.GetDeviceId();
|
||||||
fileBrowser->SetDeviceID(deviceID);
|
fileBrowser->SetDeviceID(deviceID);
|
||||||
fileBrowser->ShowDeviceAndROM();
|
fileBrowser->ShowDeviceAndROM();
|
||||||
SetVIAsDeviceID(deviceID); // Let the emilated VIA know
|
SetVIAsDeviceID(deviceID); // Let the emulated VIA know
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1361,3 +1361,4 @@ extern "C"
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue