Button 5 can be used to change device ID.

Whilst in browse mode, holding button 5 (ie Insert) and pressing one of the other buttons will change the device ID. Button 1 = 8, 2 = 9, 3 = 10 and 4 = 11.
This commit is contained in:
Stephen White 2018-07-22 18:43:08 +10:00
parent 86131addf0
commit 70fddc97c5
4 changed files with 162 additions and 111 deletions

View File

@ -385,6 +385,7 @@ FileBrowser::FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool di
, roms(roms)
, deviceID(deviceID)
, displayPNGIcons(displayPNGIcons)
, buttonChangedDevice(false)
, screenMain(screenMain)
, screenLCD(screenLCD)
, scrollHighlightRate(scrollHighlightRate)
@ -820,6 +821,37 @@ void FileBrowser::UpdateInputFolders()
Keyboard* keyboard = Keyboard::Instance();
InputMappings* inputMappings = InputMappings::Instance();
if (IEC_Bus::GetInputButtonHeld(4))
{
if (inputMappings->BrowseSelect())
{
DEBUG_LOG("DEv8\r\n");
GlobalSetDeviceID(8);
ShowDeviceAndROM();
buttonChangedDevice = true;
}
else if (inputMappings->BrowseUp())
{
DEBUG_LOG("DEv9\r\n");
GlobalSetDeviceID(9);
ShowDeviceAndROM();
buttonChangedDevice = true;
}
else if (inputMappings->BrowseDown())
{
GlobalSetDeviceID(10);
ShowDeviceAndROM();
buttonChangedDevice = true;
}
else if (inputMappings->BrowseBack())
{
GlobalSetDeviceID(11);
ShowDeviceAndROM();
buttonChangedDevice = true;
}
}
else
{
if (folder.entries.size() > 0)
{
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
@ -893,6 +925,12 @@ void FileBrowser::UpdateInputFolders()
dirty = true;
}
else if (inputMappings->BrowseInsert())
{
if (buttonChangedDevice)
{
buttonChangedDevice = false;
}
else
{
FileBrowser::BrowsableList::Entry* current = folder.current;
if (current)
@ -900,6 +938,7 @@ void FileBrowser::UpdateInputFolders()
dirty = AddToCaddy(current);
}
}
}
else if (inputMappings->BrowseNewD64())
{
char newFileName[64];
@ -944,6 +983,7 @@ void FileBrowser::UpdateInputFolders()
PopFolder();
}
}
}
bool FileBrowser::SelectLST(const char* filenameLST)
{

View File

@ -230,6 +230,7 @@ private:
ROMs* roms;
u8* deviceID;
bool displayPNGIcons;
bool buttonChangedDevice;
BrowsableList caddySelections;

View File

@ -33,6 +33,8 @@ unsigned InputMappings::directDiskSwapRequest = 0;
InputMappings::InputMappings()
: keyboardBrowseLCDScreen(false)
, insertButtonPressedPrev(false)
, insertButtonPressed(false)
{
}
@ -47,8 +49,13 @@ bool InputMappings::CheckButtonsBrowseMode()
SetButtonFlag(DOWN_FLAG);
else if (IEC_Bus::GetInputButtonPressed(3))
SetButtonFlag(BACK_FLAG);
else if (IEC_Bus::GetInputButtonPressed(4))
//else if (IEC_Bus::GetInputButtonPressed(4))
// SetButtonFlag(INSERT_FLAG);
insertButtonPressed = !IEC_Bus::GetInputButtonReleased(4);
if (insertButtonPressedPrev && !insertButtonPressed)
SetButtonFlag(INSERT_FLAG);
insertButtonPressedPrev = insertButtonPressed;
return buttonFlags != 0;
}

View File

@ -50,6 +50,9 @@ protected:
bool keyboardBrowseLCDScreen;
bool insertButtonPressedPrev;
bool insertButtonPressed;
//inline void SetUartFlag(unsigned flag) { uartFlags |= flag; }
//inline bool UartFlag(unsigned flag) { return (uartFlags & flag) != 0; }
inline void SetKeyboardFlag(unsigned flag) { keyboardFlags |= flag; }