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)
|
||||
, displayPNGIcons(displayPNGIcons)
|
||||
, buttonChangedDevice(false)
|
||||
, buttonSelectROM(false)
|
||||
, screenMain(screenMain)
|
||||
, screenLCD(screenLCD)
|
||||
, scrollHighlightRate(scrollHighlightRate)
|
||||
|
@ -825,14 +826,12 @@ void FileBrowser::UpdateInputFolders()
|
|||
{
|
||||
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;
|
||||
|
@ -850,6 +849,29 @@ void FileBrowser::UpdateInputFolders()
|
|||
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
|
||||
{
|
||||
if (folder.entries.size() > 0)
|
||||
|
@ -858,6 +880,12 @@ void FileBrowser::UpdateInputFolders()
|
|||
bool dirty = false;
|
||||
|
||||
if (inputMappings->BrowseSelect())
|
||||
{
|
||||
if (buttonSelectROM)
|
||||
{
|
||||
buttonSelectROM = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
|
@ -905,6 +933,7 @@ void FileBrowser::UpdateInputFolders()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (inputMappings->BrowseDone())
|
||||
{
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
|
@ -957,12 +986,8 @@ void FileBrowser::UpdateInputFolders()
|
|||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
||||
|| 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 ) )
|
||||
{
|
||||
|
@ -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 validImage = false;
|
||||
|
|
|
@ -217,6 +217,8 @@ private:
|
|||
bool CheckForPNG(const char* filename, FILINFO& filIcon);
|
||||
void DisplayPNG();
|
||||
|
||||
bool SelectROM(u32 index);
|
||||
|
||||
enum State
|
||||
{
|
||||
State_Folders,
|
||||
|
@ -231,6 +233,7 @@ private:
|
|||
u8* deviceID;
|
||||
bool displayPNGIcons;
|
||||
bool buttonChangedDevice;
|
||||
bool buttonSelectROM;
|
||||
|
||||
BrowsableList caddySelections;
|
||||
|
||||
|
|
|
@ -35,15 +35,18 @@ InputMappings::InputMappings()
|
|||
: keyboardBrowseLCDScreen(false)
|
||||
, insertButtonPressedPrev(false)
|
||||
, insertButtonPressed(false)
|
||||
, enterButtonPressedPrev(false)
|
||||
, enterButtonPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool InputMappings::CheckButtonsBrowseMode()
|
||||
{
|
||||
buttonFlags = 0;
|
||||
if (IEC_Bus::GetInputButtonPressed(0))
|
||||
SetButtonFlag(ENTER_FLAG);
|
||||
else if (IEC_Bus::GetInputButtonRepeating(1))
|
||||
//if (IEC_Bus::GetInputButtonPressed(0))
|
||||
// SetButtonFlag(ENTER_FLAG);
|
||||
//else
|
||||
if (IEC_Bus::GetInputButtonRepeating(1))
|
||||
SetButtonFlag(UP_FLAG);
|
||||
else if (IEC_Bus::GetInputButtonRepeating(2))
|
||||
SetButtonFlag(DOWN_FLAG);
|
||||
|
@ -57,6 +60,11 @@ bool InputMappings::CheckButtonsBrowseMode()
|
|||
SetButtonFlag(INSERT_FLAG);
|
||||
insertButtonPressedPrev = insertButtonPressed;
|
||||
|
||||
enterButtonPressed = !IEC_Bus::GetInputButtonReleased(0);
|
||||
if (enterButtonPressedPrev && !enterButtonPressed)
|
||||
SetButtonFlag(ENTER_FLAG);
|
||||
enterButtonPressedPrev = enterButtonPressed;
|
||||
|
||||
return buttonFlags != 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,9 @@ protected:
|
|||
bool insertButtonPressedPrev;
|
||||
bool insertButtonPressed;
|
||||
|
||||
bool enterButtonPressedPrev;
|
||||
bool enterButtonPressed;
|
||||
|
||||
//inline void SetUartFlag(unsigned flag) { uartFlags |= flag; }
|
||||
//inline bool UartFlag(unsigned flag) { return (uartFlags & flag) != 0; }
|
||||
inline void SetKeyboardFlag(unsigned flag) { keyboardFlags |= flag; }
|
||||
|
|
|
@ -51,12 +51,12 @@ bool IEC_Bus::ignoreReset = false;
|
|||
|
||||
u32 IEC_Bus::myOutsGPFSEL1 = 0;
|
||||
u32 IEC_Bus::myOutsGPFSEL0 = 0;
|
||||
bool IEC_Bus::InputButton[5];
|
||||
bool IEC_Bus::InputButtonPrev[5];
|
||||
u32 IEC_Bus::validInputCount[5];
|
||||
bool IEC_Bus::InputButton[5] = { 0 };
|
||||
bool IEC_Bus::InputButtonPrev[5] = { 0 };
|
||||
u32 IEC_Bus::validInputCount[5] = { 0 };
|
||||
u32 IEC_Bus::inputRepeatThreshold[5];
|
||||
u32 IEC_Bus::inputRepeat[5];
|
||||
u32 IEC_Bus::inputRepeatPrev[5];
|
||||
u32 IEC_Bus::inputRepeat[5] = { 0 };
|
||||
u32 IEC_Bus::inputRepeatPrev[5] = { 0 };
|
||||
|
||||
m6522* IEC_Bus::VIA = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue