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) , roms(roms)
, deviceID(deviceID) , deviceID(deviceID)
, displayPNGIcons(displayPNGIcons) , displayPNGIcons(displayPNGIcons)
, buttonChangedDevice(false)
, screenMain(screenMain) , screenMain(screenMain)
, screenLCD(screenLCD) , screenLCD(screenLCD)
, scrollHighlightRate(scrollHighlightRate) , scrollHighlightRate(scrollHighlightRate)
@ -820,6 +821,37 @@ void FileBrowser::UpdateInputFolders()
Keyboard* keyboard = Keyboard::Instance(); Keyboard* keyboard = Keyboard::Instance();
InputMappings* inputMappings = InputMappings::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) if (folder.entries.size() > 0)
{ {
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1; //u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
@ -893,6 +925,12 @@ void FileBrowser::UpdateInputFolders()
dirty = true; dirty = true;
} }
else if (inputMappings->BrowseInsert()) else if (inputMappings->BrowseInsert())
{
if (buttonChangedDevice)
{
buttonChangedDevice = false;
}
else
{ {
FileBrowser::BrowsableList::Entry* current = folder.current; FileBrowser::BrowsableList::Entry* current = folder.current;
if (current) if (current)
@ -900,6 +938,7 @@ void FileBrowser::UpdateInputFolders()
dirty = AddToCaddy(current); dirty = AddToCaddy(current);
} }
} }
}
else if (inputMappings->BrowseNewD64()) else if (inputMappings->BrowseNewD64())
{ {
char newFileName[64]; char newFileName[64];
@ -943,6 +982,7 @@ void FileBrowser::UpdateInputFolders()
if (inputMappings->BrowseBack()) if (inputMappings->BrowseBack())
PopFolder(); PopFolder();
} }
}
} }
bool FileBrowser::SelectLST(const char* filenameLST) bool FileBrowser::SelectLST(const char* filenameLST)

View File

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

View File

@ -33,6 +33,8 @@ unsigned InputMappings::directDiskSwapRequest = 0;
InputMappings::InputMappings() InputMappings::InputMappings()
: keyboardBrowseLCDScreen(false) : keyboardBrowseLCDScreen(false)
, insertButtonPressedPrev(false)
, insertButtonPressed(false)
{ {
} }
@ -47,8 +49,13 @@ bool InputMappings::CheckButtonsBrowseMode()
SetButtonFlag(DOWN_FLAG); SetButtonFlag(DOWN_FLAG);
else if (IEC_Bus::GetInputButtonPressed(3)) else if (IEC_Bus::GetInputButtonPressed(3))
SetButtonFlag(BACK_FLAG); 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); SetButtonFlag(INSERT_FLAG);
insertButtonPressedPrev = insertButtonPressed;
return buttonFlags != 0; return buttonFlags != 0;
} }

View File

@ -50,6 +50,9 @@ protected:
bool keyboardBrowseLCDScreen; bool keyboardBrowseLCDScreen;
bool insertButtonPressedPrev;
bool insertButtonPressed;
//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; }