Buttons in browse mode can change the selected ROM
Holding down the first button and pressing one of the other buttons will select different ROMs (if they have been specified in the options.txt file)
This commit is contained in:
parent
369e2ff800
commit
5ac2fe8c45
5 changed files with 102 additions and 49 deletions
|
@ -386,6 +386,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 +826,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 +849,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 +880,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 +933,7 @@ void FileBrowser::UpdateInputFolders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (inputMappings->BrowseDone())
|
else if (inputMappings->BrowseDone())
|
||||||
{
|
{
|
||||||
selectionsMade = FillCaddyWithSelections();
|
selectionsMade = FillCaddyWithSelections();
|
||||||
|
@ -957,12 +986,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 ) )
|
||||||
{
|
{
|
||||||
|
@ -985,6 +1010,20 @@ void FileBrowser::UpdateInputFolders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,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; }
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue