Merge branch 'master' into cleanup
This commit is contained in:
commit
209d73469c
9 changed files with 277 additions and 143 deletions
|
@ -60,6 +60,8 @@ GraphIEC = 1
|
||||||
|
|
||||||
// If you are using a LCD screen then specify it here
|
// If you are using a LCD screen then specify it here
|
||||||
//LCDName = ssd1306_128x64
|
//LCDName = ssd1306_128x64
|
||||||
|
//LCDName = ssd1306_128x32
|
||||||
|
//LCDName = sh1106_128x64
|
||||||
// If you are using a LCD screen and you would like PageUp and PageDown keys to work with it then specify this option
|
// If you are using a LCD screen and you would like PageUp and PageDown keys to work with it then specify this option
|
||||||
//KeyboardBrowseLCDScreen = 1
|
//KeyboardBrowseLCDScreen = 1
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ static char buffer[256] = { 0 };
|
||||||
static u32 white = RGBA(0xff, 0xff, 0xff, 0xff);
|
static u32 white = RGBA(0xff, 0xff, 0xff, 0xff);
|
||||||
static u32 red = RGBA(0xff, 0, 0, 0xff);
|
static u32 red = RGBA(0xff, 0, 0, 0xff);
|
||||||
|
|
||||||
|
#define LCDFONTHEIGHT 16
|
||||||
|
|
||||||
bool DiskCaddy::Empty()
|
bool DiskCaddy::Empty()
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
@ -62,7 +64,7 @@ bool DiskCaddy::Empty()
|
||||||
|
|
||||||
snprintf(buffer, 256, "Saving");
|
snprintf(buffer, 256, "Saving");
|
||||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
|
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
|
||||||
y += 16;
|
y += LCDFONTHEIGHT;
|
||||||
snprintf(buffer, 256, "%s ", disks[index].GetName());
|
snprintf(buffer, 256, "%s ", disks[index].GetName());
|
||||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
||||||
screenLCD->SwapBuffers();
|
screenLCD->SwapBuffers();
|
||||||
|
@ -91,7 +93,7 @@ bool DiskCaddy::Empty()
|
||||||
|
|
||||||
snprintf(buffer, 256, "Saving");
|
snprintf(buffer, 256, "Saving");
|
||||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
|
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
|
||||||
y += 16;
|
y += LCDFONTHEIGHT;
|
||||||
snprintf(buffer, 256, "Complete ");
|
snprintf(buffer, 256, "Complete ");
|
||||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
||||||
screenLCD->SwapBuffers();
|
screenLCD->SwapBuffers();
|
||||||
|
@ -130,7 +132,7 @@ bool DiskCaddy::Insert(const FILINFO* fileInfo, bool readOnly)
|
||||||
|
|
||||||
snprintf(buffer, 256, "Loading");
|
snprintf(buffer, 256, "Loading");
|
||||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
|
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
|
||||||
y += 16;
|
y += LCDFONTHEIGHT;
|
||||||
snprintf(buffer, 256, "%s ", fileInfo->fname);
|
snprintf(buffer, 256, "%s ", fileInfo->fname);
|
||||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
||||||
screenLCD->SwapBuffers();
|
screenLCD->SwapBuffers();
|
||||||
|
@ -282,24 +284,22 @@ void DiskCaddy::ShowSelectedImage(u32 index)
|
||||||
if (screenLCD)
|
if (screenLCD)
|
||||||
{
|
{
|
||||||
unsigned numberOfImages = GetNumberOfImages();
|
unsigned numberOfImages = GetNumberOfImages();
|
||||||
|
unsigned numberOfDisplayedImages = screenLCD->Height()/LCDFONTHEIGHT-1;
|
||||||
unsigned caddyIndex;
|
unsigned caddyIndex;
|
||||||
|
|
||||||
if (screenLCD)
|
|
||||||
{
|
|
||||||
RGBA BkColour = RGBA(0, 0, 0, 0xFF);
|
RGBA BkColour = RGBA(0, 0, 0, 0xFF);
|
||||||
//screenLCD->Clear(BkColour);
|
//screenLCD->Clear(BkColour);
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
//snprintf(buffer, 256, "Emulating %d/%d ", index + 1, numberOfImages);
|
|
||||||
snprintf(buffer, 256, " D %d/%d ", index + 1, numberOfImages);
|
snprintf(buffer, 256, " D %d/%d ", index + 1, numberOfImages);
|
||||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), RGBA(0xff, 0xff, 0xff, 0xff));
|
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), RGBA(0xff, 0xff, 0xff, 0xff));
|
||||||
y += 16;
|
y += LCDFONTHEIGHT;
|
||||||
|
|
||||||
if (numberOfImages > 3 && index > 2)
|
if (numberOfImages > numberOfDisplayedImages && index > numberOfDisplayedImages-1)
|
||||||
{
|
{
|
||||||
if (numberOfImages - index < 3)
|
if (numberOfImages - index < numberOfDisplayedImages)
|
||||||
caddyIndex = numberOfImages - 3;
|
caddyIndex = numberOfImages - numberOfDisplayedImages;
|
||||||
else
|
else
|
||||||
caddyIndex = index;
|
caddyIndex = index;
|
||||||
}
|
}
|
||||||
|
@ -316,14 +316,13 @@ void DiskCaddy::ShowSelectedImage(u32 index)
|
||||||
{
|
{
|
||||||
snprintf(buffer, 256, "%d %s ", caddyIndex + 1, name);
|
snprintf(buffer, 256, "%d %s ", caddyIndex + 1, name);
|
||||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), caddyIndex == index ? RGBA(0xff, 0xff, 0xff, 0xff) : BkColour);
|
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), caddyIndex == index ? RGBA(0xff, 0xff, 0xff, 0xff) : BkColour);
|
||||||
y += 16;
|
y += LCDFONTHEIGHT;
|
||||||
}
|
}
|
||||||
if (y >= screenLCD->Height())
|
if (y >= screenLCD->Height())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
screenLCD->SwapBuffers();
|
screenLCD->SwapBuffers();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiskCaddy::Update()
|
bool DiskCaddy::Update()
|
||||||
|
|
|
@ -41,6 +41,7 @@ extern Options options;
|
||||||
#define PNG_HEIGHT 200
|
#define PNG_HEIGHT 200
|
||||||
|
|
||||||
extern void GlobalSetDeviceID(u8 id);
|
extern void GlobalSetDeviceID(u8 id);
|
||||||
|
extern void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser);
|
||||||
|
|
||||||
unsigned char FileBrowser::LSTBuffer[FileBrowser::LSTBuffer_size];
|
unsigned char FileBrowser::LSTBuffer[FileBrowser::LSTBuffer_size];
|
||||||
|
|
||||||
|
@ -386,6 +387,7 @@ FileBrowser::FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool di
|
||||||
, deviceID(deviceID)
|
, deviceID(deviceID)
|
||||||
, displayPNGIcons(displayPNGIcons)
|
, displayPNGIcons(displayPNGIcons)
|
||||||
, buttonChangedDevice(false)
|
, buttonChangedDevice(false)
|
||||||
|
, buttonSelectROM(false)
|
||||||
, screenMain(screenMain)
|
, screenMain(screenMain)
|
||||||
, screenLCD(screenLCD)
|
, screenLCD(screenLCD)
|
||||||
, scrollHighlightRate(scrollHighlightRate)
|
, scrollHighlightRate(scrollHighlightRate)
|
||||||
|
@ -825,14 +827,12 @@ void FileBrowser::UpdateInputFolders()
|
||||||
{
|
{
|
||||||
if (inputMappings->BrowseSelect())
|
if (inputMappings->BrowseSelect())
|
||||||
{
|
{
|
||||||
DEBUG_LOG("DEv8\r\n");
|
|
||||||
GlobalSetDeviceID(8);
|
GlobalSetDeviceID(8);
|
||||||
ShowDeviceAndROM();
|
ShowDeviceAndROM();
|
||||||
buttonChangedDevice = true;
|
buttonChangedDevice = true;
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseUp())
|
else if (inputMappings->BrowseUp())
|
||||||
{
|
{
|
||||||
DEBUG_LOG("DEv9\r\n");
|
|
||||||
GlobalSetDeviceID(9);
|
GlobalSetDeviceID(9);
|
||||||
ShowDeviceAndROM();
|
ShowDeviceAndROM();
|
||||||
buttonChangedDevice = true;
|
buttonChangedDevice = true;
|
||||||
|
@ -850,6 +850,29 @@ void FileBrowser::UpdateInputFolders()
|
||||||
buttonChangedDevice = true;
|
buttonChangedDevice = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (IEC_Bus::GetInputButtonHeld(0))
|
||||||
|
{
|
||||||
|
if (inputMappings->BrowseUp())
|
||||||
|
{
|
||||||
|
SelectROM(0);
|
||||||
|
buttonSelectROM = true;
|
||||||
|
}
|
||||||
|
else if (inputMappings->BrowseDown())
|
||||||
|
{
|
||||||
|
SelectROM(1);
|
||||||
|
buttonSelectROM = true;
|
||||||
|
}
|
||||||
|
else if (inputMappings->BrowseBack())
|
||||||
|
{
|
||||||
|
SelectROM(2);
|
||||||
|
buttonSelectROM = true;
|
||||||
|
}
|
||||||
|
else if (inputMappings->BrowseInsert())
|
||||||
|
{
|
||||||
|
SelectROM(3);
|
||||||
|
buttonSelectROM = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (folder.entries.size() > 0)
|
if (folder.entries.size() > 0)
|
||||||
|
@ -858,6 +881,12 @@ void FileBrowser::UpdateInputFolders()
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
if (inputMappings->BrowseSelect())
|
if (inputMappings->BrowseSelect())
|
||||||
|
{
|
||||||
|
if (buttonSelectROM)
|
||||||
|
{
|
||||||
|
buttonSelectROM = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||||
if (current)
|
if (current)
|
||||||
|
@ -905,6 +934,7 @@ void FileBrowser::UpdateInputFolders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (inputMappings->BrowseDone())
|
else if (inputMappings->BrowseDone())
|
||||||
{
|
{
|
||||||
selectionsMade = FillCaddyWithSelections();
|
selectionsMade = FillCaddyWithSelections();
|
||||||
|
@ -947,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;
|
||||||
|
@ -957,12 +1005,8 @@ void FileBrowser::UpdateInputFolders()
|
||||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
||||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||||
{
|
{
|
||||||
if ( (keySetIndex < ROMs::MAX_ROMS) && (roms->ROMValid[keySetIndex]) )
|
if (SelectROM(keySetIndex))
|
||||||
{
|
{
|
||||||
roms->currentROMIndex = keySetIndex;
|
|
||||||
roms->lastManualSelectedROMIndex = keySetIndex;
|
|
||||||
DEBUG_LOG("Swap ROM %d %s\r\n", keySetIndex, roms->ROMNames[keySetIndex]);
|
|
||||||
ShowDeviceAndROM();
|
|
||||||
}
|
}
|
||||||
else if ( (keySetIndex >= 7) && (keySetIndex <= 10 ) )
|
else if ( (keySetIndex >= 7) && (keySetIndex <= 10 ) )
|
||||||
{
|
{
|
||||||
|
@ -982,9 +1026,27 @@ void FileBrowser::UpdateInputFolders()
|
||||||
if (inputMappings->BrowseBack())
|
if (inputMappings->BrowseBack())
|
||||||
PopFolder();
|
PopFolder();
|
||||||
}
|
}
|
||||||
|
if (inputMappings->BrowseAutoLoad())
|
||||||
|
{
|
||||||
|
CheckAutoMountImage(EXIT_RESET, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FileBrowser::SelectROM(u32 index)
|
||||||
|
{
|
||||||
|
if ((index < ROMs::MAX_ROMS) && (roms->ROMValid[index]))
|
||||||
|
{
|
||||||
|
roms->currentROMIndex = index;
|
||||||
|
roms->lastManualSelectedROMIndex = index;
|
||||||
|
DEBUG_LOG("Swap ROM %d %s\r\n", index, roms->ROMNames[index]);
|
||||||
|
ShowDeviceAndROM();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FileBrowser::SelectLST(const char* filenameLST)
|
bool FileBrowser::SelectLST(const char* filenameLST)
|
||||||
{
|
{
|
||||||
bool validImage = false;
|
bool validImage = false;
|
||||||
|
@ -1282,8 +1344,17 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::AutoSelectImage(const char* image)
|
void FileBrowser::SelectAutoMountImage(const char* image)
|
||||||
{
|
{
|
||||||
|
f_chdir("/1541");
|
||||||
|
RefreshFolderEntries();
|
||||||
|
|
||||||
|
if (SelectLST(image))
|
||||||
|
{
|
||||||
|
selectionsMade = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
FileBrowser::BrowsableList::Entry* current = 0;
|
FileBrowser::BrowsableList::Entry* current = 0;
|
||||||
int index;
|
int index;
|
||||||
int maxEntries = folder.entries.size();
|
int maxEntries = folder.entries.size();
|
||||||
|
@ -1303,6 +1374,7 @@ void FileBrowser::AutoSelectImage(const char* image)
|
||||||
caddySelections.entries.push_back(*current);
|
caddySelections.entries.push_back(*current);
|
||||||
selectionsMade = FillCaddyWithSelections();
|
selectionsMade = FillCaddyWithSelections();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int FileBrowser::BrowsableList::FindNextAutoName(char* filename)
|
int FileBrowser::BrowsableList::FindNextAutoName(char* filename)
|
||||||
|
|
|
@ -168,7 +168,7 @@ public:
|
||||||
|
|
||||||
FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool displayPNGIcons, ScreenBase* screenMain, ScreenBase* screenLCD, float scrollHighlightRate);
|
FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool displayPNGIcons, ScreenBase* screenMain, ScreenBase* screenLCD, float scrollHighlightRate);
|
||||||
|
|
||||||
void AutoSelectImage(const char* image);
|
void SelectAutoMountImage(const char* image);
|
||||||
void DisplayRoot();
|
void DisplayRoot();
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
@ -217,6 +217,8 @@ private:
|
||||||
bool CheckForPNG(const char* filename, FILINFO& filIcon);
|
bool CheckForPNG(const char* filename, FILINFO& filIcon);
|
||||||
void DisplayPNG();
|
void DisplayPNG();
|
||||||
|
|
||||||
|
bool SelectROM(u32 index);
|
||||||
|
|
||||||
enum State
|
enum State
|
||||||
{
|
{
|
||||||
State_Folders,
|
State_Folders,
|
||||||
|
@ -231,6 +233,7 @@ private:
|
||||||
u8* deviceID;
|
u8* deviceID;
|
||||||
bool displayPNGIcons;
|
bool displayPNGIcons;
|
||||||
bool buttonChangedDevice;
|
bool buttonChangedDevice;
|
||||||
|
bool buttonSelectROM;
|
||||||
|
|
||||||
BrowsableList caddySelections;
|
BrowsableList caddySelections;
|
||||||
|
|
||||||
|
|
|
@ -35,15 +35,18 @@ InputMappings::InputMappings()
|
||||||
: keyboardBrowseLCDScreen(false)
|
: keyboardBrowseLCDScreen(false)
|
||||||
, insertButtonPressedPrev(false)
|
, insertButtonPressedPrev(false)
|
||||||
, insertButtonPressed(false)
|
, insertButtonPressed(false)
|
||||||
|
, enterButtonPressedPrev(false)
|
||||||
|
, enterButtonPressed(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputMappings::CheckButtonsBrowseMode()
|
bool InputMappings::CheckButtonsBrowseMode()
|
||||||
{
|
{
|
||||||
buttonFlags = 0;
|
buttonFlags = 0;
|
||||||
if (IEC_Bus::GetInputButtonPressed(0))
|
//if (IEC_Bus::GetInputButtonPressed(0))
|
||||||
SetButtonFlag(ENTER_FLAG);
|
// SetButtonFlag(ENTER_FLAG);
|
||||||
else if (IEC_Bus::GetInputButtonRepeating(1))
|
//else
|
||||||
|
if (IEC_Bus::GetInputButtonRepeating(1))
|
||||||
SetButtonFlag(UP_FLAG);
|
SetButtonFlag(UP_FLAG);
|
||||||
else if (IEC_Bus::GetInputButtonRepeating(2))
|
else if (IEC_Bus::GetInputButtonRepeating(2))
|
||||||
SetButtonFlag(DOWN_FLAG);
|
SetButtonFlag(DOWN_FLAG);
|
||||||
|
@ -57,6 +60,11 @@ bool InputMappings::CheckButtonsBrowseMode()
|
||||||
SetButtonFlag(INSERT_FLAG);
|
SetButtonFlag(INSERT_FLAG);
|
||||||
insertButtonPressedPrev = insertButtonPressed;
|
insertButtonPressedPrev = insertButtonPressed;
|
||||||
|
|
||||||
|
enterButtonPressed = !IEC_Bus::GetInputButtonReleased(0);
|
||||||
|
if (enterButtonPressedPrev && !enterButtonPressed)
|
||||||
|
SetButtonFlag(ENTER_FLAG);
|
||||||
|
enterButtonPressedPrev = enterButtonPressed;
|
||||||
|
|
||||||
return buttonFlags != 0;
|
return buttonFlags != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +187,12 @@ bool InputMappings::CheckKeyboardBrowseMode()
|
||||||
// SetKeyboardFlag(PAGEDOWN_LCD_FLAG);
|
// SetKeyboardFlag(PAGEDOWN_LCD_FLAG);
|
||||||
else if (keyboard->KeyHeld(KEY_N) && keyboard->KeyEitherAlt() )
|
else if (keyboard->KeyHeld(KEY_N) && keyboard->KeyEitherAlt() )
|
||||||
SetKeyboardFlag(NEWD64_FLAG);
|
SetKeyboardFlag(NEWD64_FLAG);
|
||||||
|
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )
|
||||||
|
SetKeyboardFlag(AUTOLOAD_FLAG);
|
||||||
|
else if (keyboard->KeyHeld(KEY_R) && keyboard->KeyEitherAlt() )
|
||||||
|
SetKeyboardFlag(FAKERESET_FLAG);
|
||||||
|
else if (keyboard->KeyHeld(KEY_W) && keyboard->KeyEitherAlt())
|
||||||
|
SetKeyboardFlag(WRITEPROTECT_FLAG);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned index;
|
unsigned index;
|
||||||
|
@ -206,6 +220,10 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
|
||||||
SetKeyboardFlag(PREV_FLAG);
|
SetKeyboardFlag(PREV_FLAG);
|
||||||
else if (keyboard->KeyHeld(KEY_PAGEDOWN))
|
else if (keyboard->KeyHeld(KEY_PAGEDOWN))
|
||||||
SetKeyboardFlag(NEXT_FLAG);
|
SetKeyboardFlag(NEXT_FLAG);
|
||||||
|
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )
|
||||||
|
SetKeyboardFlag(AUTOLOAD_FLAG);
|
||||||
|
else if (keyboard->KeyHeld(KEY_R) && keyboard->KeyEitherAlt() )
|
||||||
|
SetKeyboardFlag(FAKERESET_FLAG);
|
||||||
else if (numberOfImages > 1)
|
else if (numberOfImages > 1)
|
||||||
{
|
{
|
||||||
unsigned index;
|
unsigned index;
|
||||||
|
|
|
@ -38,6 +38,9 @@
|
||||||
#define PAGEUP_LCD_FLAG (1 << 13)
|
#define PAGEUP_LCD_FLAG (1 << 13)
|
||||||
|
|
||||||
#define NEWD64_FLAG (1 << 14)
|
#define NEWD64_FLAG (1 << 14)
|
||||||
|
#define AUTOLOAD_FLAG (1 << 15)
|
||||||
|
#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>
|
||||||
|
@ -53,6 +56,9 @@ protected:
|
||||||
bool insertButtonPressedPrev;
|
bool insertButtonPressedPrev;
|
||||||
bool insertButtonPressed;
|
bool insertButtonPressed;
|
||||||
|
|
||||||
|
bool enterButtonPressedPrev;
|
||||||
|
bool enterButtonPressed;
|
||||||
|
|
||||||
//inline void SetUartFlag(unsigned flag) { uartFlags |= flag; }
|
//inline void SetUartFlag(unsigned flag) { uartFlags |= flag; }
|
||||||
//inline bool UartFlag(unsigned flag) { return (uartFlags & flag) != 0; }
|
//inline bool UartFlag(unsigned flag) { return (uartFlags & flag) != 0; }
|
||||||
inline void SetKeyboardFlag(unsigned flag) { keyboardFlags |= flag; }
|
inline void SetKeyboardFlag(unsigned flag) { keyboardFlags |= flag; }
|
||||||
|
@ -95,6 +101,16 @@ public:
|
||||||
return KeyboardFlag(PREV_FLAG)/* | UartFlag(PREV_FLAG)*/ | ButtonFlag(PREV_FLAG);
|
return KeyboardFlag(PREV_FLAG)/* | UartFlag(PREV_FLAG)*/ | ButtonFlag(PREV_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool AutoLoad()
|
||||||
|
{
|
||||||
|
return KeyboardFlag(AUTOLOAD_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool FakeReset()
|
||||||
|
{
|
||||||
|
return KeyboardFlag(FAKERESET_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool BrowseSelect()
|
inline bool BrowseSelect()
|
||||||
{
|
{
|
||||||
return KeyboardFlag(ENTER_FLAG)/* | UartFlag(ENTER_FLAG)*/ | ButtonFlag(ENTER_FLAG);
|
return KeyboardFlag(ENTER_FLAG)/* | UartFlag(ENTER_FLAG)*/ | ButtonFlag(ENTER_FLAG);
|
||||||
|
@ -148,6 +164,21 @@ public:
|
||||||
return KeyboardFlag(NEWD64_FLAG);
|
return KeyboardFlag(NEWD64_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool BrowseAutoLoad()
|
||||||
|
{
|
||||||
|
return KeyboardFlag(AUTOLOAD_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool BrowseFakeReset()
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
|
@ -51,12 +51,12 @@ bool IEC_Bus::ignoreReset = false;
|
||||||
|
|
||||||
u32 IEC_Bus::myOutsGPFSEL1 = 0;
|
u32 IEC_Bus::myOutsGPFSEL1 = 0;
|
||||||
u32 IEC_Bus::myOutsGPFSEL0 = 0;
|
u32 IEC_Bus::myOutsGPFSEL0 = 0;
|
||||||
bool IEC_Bus::InputButton[5];
|
bool IEC_Bus::InputButton[5] = { 0 };
|
||||||
bool IEC_Bus::InputButtonPrev[5];
|
bool IEC_Bus::InputButtonPrev[5] = { 0 };
|
||||||
u32 IEC_Bus::validInputCount[5];
|
u32 IEC_Bus::validInputCount[5] = { 0 };
|
||||||
u32 IEC_Bus::inputRepeatThreshold[5];
|
u32 IEC_Bus::inputRepeatThreshold[5];
|
||||||
u32 IEC_Bus::inputRepeat[5];
|
u32 IEC_Bus::inputRepeat[5] = { 0 };
|
||||||
u32 IEC_Bus::inputRepeatPrev[5];
|
u32 IEC_Bus::inputRepeatPrev[5] = { 0 };
|
||||||
|
|
||||||
m6522* IEC_Bus::VIA = 0;
|
m6522* IEC_Bus::VIA = 0;
|
||||||
|
|
||||||
|
|
79
src/main.cpp
79
src/main.cpp
|
@ -102,12 +102,6 @@ unsigned int screenHeight = 768;
|
||||||
const char* termainalTextRed = "\E[31m";
|
const char* termainalTextRed = "\E[31m";
|
||||||
const char* termainalTextNormal = "\E[0m";
|
const char* termainalTextNormal = "\E[0m";
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
EXIT_UNKNOWN,
|
|
||||||
EXIT_RESET,
|
|
||||||
EXIT_CD,
|
|
||||||
EXIT_KEYBOARD
|
|
||||||
} EXIT_TYPE;
|
|
||||||
EXIT_TYPE exitReason = EXIT_UNKNOWN;
|
EXIT_TYPE exitReason = EXIT_UNKNOWN;
|
||||||
|
|
||||||
// Hooks required for USPi library
|
// Hooks required for USPi library
|
||||||
|
@ -654,7 +648,7 @@ void GlobalSetDeviceID(u8 id)
|
||||||
SetVIAsDeviceID(id);
|
SetVIAsDeviceID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser)
|
void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser)
|
||||||
{
|
{
|
||||||
const char* autoMountImageName = options.GetAutoMountImageName();
|
const char* autoMountImageName = options.GetAutoMountImageName();
|
||||||
if (autoMountImageName[0] != 0)
|
if (autoMountImageName[0] != 0)
|
||||||
|
@ -662,8 +656,9 @@ static void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowse
|
||||||
switch (reset_reason)
|
switch (reset_reason)
|
||||||
{
|
{
|
||||||
case EXIT_UNKNOWN:
|
case EXIT_UNKNOWN:
|
||||||
|
case EXIT_AUTOLOAD:
|
||||||
case EXIT_RESET:
|
case EXIT_RESET:
|
||||||
fileBrowser->AutoSelectImage(autoMountImageName);
|
fileBrowser->SelectAutoMountImage(autoMountImageName);
|
||||||
break;
|
break;
|
||||||
case EXIT_CD:
|
case EXIT_CD:
|
||||||
case EXIT_KEYBOARD:
|
case EXIT_KEYBOARD:
|
||||||
|
@ -933,41 +928,16 @@ void emulator()
|
||||||
IEC_Bus::RefreshOuts(); // Now output all outputs.
|
IEC_Bus::RefreshOuts(); // Now output all outputs.
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have now output so HERE is where the next phi2 cycle starts.
|
|
||||||
pi1541.Update();
|
|
||||||
|
|
||||||
// Other core will check the uart (as it is slow) (could enable uart irqs - will they execute on this core?)
|
// Other core will check the uart (as it is slow) (could enable uart irqs - will they execute on this core?)
|
||||||
inputMappings->CheckKeyboardEmulationMode(numberOfImages, numberOfImagesMax);
|
inputMappings->CheckKeyboardEmulationMode(numberOfImages, numberOfImagesMax);
|
||||||
inputMappings->CheckButtonsEmulationMode();
|
inputMappings->CheckButtonsEmulationMode();
|
||||||
|
|
||||||
bool exitEmulation = inputMappings->Exit();
|
bool exitEmulation = inputMappings->Exit();
|
||||||
bool nextDisk = inputMappings->NextDisk();
|
bool exitDoAutoLoad = inputMappings->AutoLoad();
|
||||||
bool prevDisk = inputMappings->PrevDisk();
|
|
||||||
|
// We have now output so HERE is where the next phi2 cycle starts.
|
||||||
|
pi1541.Update();
|
||||||
|
|
||||||
if (nextDisk)
|
|
||||||
{
|
|
||||||
pi1541.drive.Insert(diskCaddy.PrevDisk());
|
|
||||||
}
|
|
||||||
else if (prevDisk)
|
|
||||||
{
|
|
||||||
pi1541.drive.Insert(diskCaddy.NextDisk());
|
|
||||||
}
|
|
||||||
else if (numberOfImages > 1 && inputMappings->directDiskSwapRequest != 0)
|
|
||||||
{
|
|
||||||
for (caddyIndex = 0; caddyIndex < numberOfImagesMax; ++caddyIndex)
|
|
||||||
{
|
|
||||||
if (inputMappings->directDiskSwapRequest & (1 << caddyIndex))
|
|
||||||
{
|
|
||||||
DiskImage* diskImage = diskCaddy.SelectImage(caddyIndex);
|
|
||||||
if (diskImage && diskImage != pi1541.drive.GetDiskImage())
|
|
||||||
{
|
|
||||||
pi1541.drive.Insert(diskImage);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputMappings->directDiskSwapRequest = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool reset = IEC_Bus::IsReset();
|
bool reset = IEC_Bus::IsReset();
|
||||||
if (reset)
|
if (reset)
|
||||||
|
@ -975,7 +945,7 @@ void emulator()
|
||||||
else
|
else
|
||||||
resetCount = 0;
|
resetCount = 0;
|
||||||
|
|
||||||
if (!emulating || (resetCount > 10) || exitEmulation)
|
if (!emulating || (resetCount > 10) || exitEmulation || exitDoAutoLoad)
|
||||||
{
|
{
|
||||||
// Clearing the caddy now
|
// Clearing the caddy now
|
||||||
// - will write back all changed/dirty/written to disk images now
|
// - will write back all changed/dirty/written to disk images now
|
||||||
|
@ -999,8 +969,9 @@ void emulator()
|
||||||
}
|
}
|
||||||
if (exitEmulation)
|
if (exitEmulation)
|
||||||
exitReason = EXIT_KEYBOARD;
|
exitReason = EXIT_KEYBOARD;
|
||||||
|
if (exitDoAutoLoad)
|
||||||
|
exitReason = EXIT_AUTOLOAD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cycleCount < FAST_BOOT_CYCLES) // cycleCount is used so we can quickly get through 1541's self test code. This will make the emulated 1541 responsive to commands asap.
|
if (cycleCount < FAST_BOOT_CYCLES) // cycleCount is used so we can quickly get through 1541's self test code. This will make the emulated 1541 responsive to commands asap.
|
||||||
|
@ -1024,6 +995,36 @@ void emulator()
|
||||||
while (ctAfter == ctBefore);
|
while (ctAfter == ctBefore);
|
||||||
}
|
}
|
||||||
ctBefore = ctAfter;
|
ctBefore = ctAfter;
|
||||||
|
|
||||||
|
if (numberOfImages > 1)
|
||||||
|
{
|
||||||
|
bool nextDisk = inputMappings->NextDisk();
|
||||||
|
bool prevDisk = inputMappings->PrevDisk();
|
||||||
|
if (nextDisk)
|
||||||
|
{
|
||||||
|
pi1541.drive.Insert(diskCaddy.PrevDisk());
|
||||||
|
}
|
||||||
|
else if (prevDisk)
|
||||||
|
{
|
||||||
|
pi1541.drive.Insert(diskCaddy.NextDisk());
|
||||||
|
}
|
||||||
|
else if (inputMappings->directDiskSwapRequest != 0)
|
||||||
|
{
|
||||||
|
for (caddyIndex = 0; caddyIndex < numberOfImagesMax; ++caddyIndex)
|
||||||
|
{
|
||||||
|
if (inputMappings->directDiskSwapRequest & (1 << caddyIndex))
|
||||||
|
{
|
||||||
|
DiskImage* diskImage = diskCaddy.SelectImage(caddyIndex);
|
||||||
|
if (diskImage && diskImage != pi1541.drive.GetDiskImage())
|
||||||
|
{
|
||||||
|
pi1541.drive.Insert(diskImage);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputMappings->directDiskSwapRequest = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,12 @@ typedef enum {
|
||||||
LCD_1106_128x64,
|
LCD_1106_128x64,
|
||||||
} LCD_MODEL;
|
} LCD_MODEL;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
EXIT_UNKNOWN,
|
||||||
|
EXIT_RESET,
|
||||||
|
EXIT_CD,
|
||||||
|
EXIT_KEYBOARD,
|
||||||
|
EXIT_AUTOLOAD
|
||||||
|
} EXIT_TYPE;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue