ROM and deviceID cleanups

start implementing a-z
This commit is contained in:
penfold42 2018-07-31 09:41:50 +10:00
parent b001959483
commit b809e3e70b
2 changed files with 77 additions and 86 deletions

View file

@ -386,8 +386,7 @@ FileBrowser::FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool di
, roms(roms)
, deviceID(deviceID)
, displayPNGIcons(displayPNGIcons)
, buttonChangedDevice(false)
, buttonSelectROM(false)
, buttonChangedROMDevice(false)
, screenMain(screenMain)
, screenLCD(screenLCD)
, scrollHighlightRate(scrollHighlightRate)
@ -823,54 +822,51 @@ void FileBrowser::UpdateInputFolders()
Keyboard* keyboard = Keyboard::Instance();
InputMappings* inputMappings = InputMappings::Instance();
buttonChangedROMDevice = false;
if (IEC_Bus::GetInputButtonHeld(4))
{
if (inputMappings->BrowseSelect())
{
GlobalSetDeviceID(8);
ShowDeviceAndROM();
buttonChangedDevice = true;
SelectROMOrDevice(7); // == device 8
buttonChangedROMDevice = true;
}
else if (inputMappings->BrowseUp())
{
GlobalSetDeviceID(9);
ShowDeviceAndROM();
buttonChangedDevice = true;
SelectROMOrDevice(8); // == device 9
buttonChangedROMDevice = true;
}
else if (inputMappings->BrowseDown())
{
GlobalSetDeviceID(10);
ShowDeviceAndROM();
buttonChangedDevice = true;
SelectROMOrDevice(9); // == device 10
buttonChangedROMDevice = true;
}
else if (inputMappings->BrowseBack())
{
GlobalSetDeviceID(11);
ShowDeviceAndROM();
buttonChangedDevice = true;
SelectROMOrDevice(10); // == device 11
buttonChangedROMDevice = true;
}
}
else if (IEC_Bus::GetInputButtonHeld(0))
{
if (inputMappings->BrowseUp())
{
SelectROM(0);
buttonSelectROM = true;
SelectROMOrDevice(0);
buttonChangedROMDevice = true;
}
else if (inputMappings->BrowseDown())
{
SelectROM(1);
buttonSelectROM = true;
SelectROMOrDevice(1);
buttonChangedROMDevice = true;
}
else if (inputMappings->BrowseBack())
{
SelectROM(2);
buttonSelectROM = true;
SelectROMOrDevice(2);
buttonChangedROMDevice = true;
}
else if (inputMappings->BrowseInsert())
{
SelectROM(3);
buttonSelectROM = true;
SelectROMOrDevice(3);
buttonChangedROMDevice = true;
}
}
else
@ -880,13 +876,7 @@ void FileBrowser::UpdateInputFolders()
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
bool dirty = false;
if (inputMappings->BrowseSelect())
{
if (buttonSelectROM)
{
buttonSelectROM = false;
}
else
if (inputMappings->BrowseSelect() && !buttonChangedROMDevice )
{
FileBrowser::BrowsableList::Entry* current = folder.current;
if (current)
@ -934,7 +924,6 @@ void FileBrowser::UpdateInputFolders()
}
}
}
}
else if (inputMappings->BrowseDone())
{
selectionsMade = FillCaddyWithSelections();
@ -954,13 +943,7 @@ void FileBrowser::UpdateInputFolders()
ClearSelections();
dirty = true;
}
else if (inputMappings->BrowseInsert())
{
if (buttonChangedDevice)
{
buttonChangedDevice = false;
}
else
else if (inputMappings->BrowseInsert() && !buttonChangedROMDevice )
{
FileBrowser::BrowsableList::Entry* current = folder.current;
if (current)
@ -968,7 +951,6 @@ void FileBrowser::UpdateInputFolders()
dirty = AddToCaddy(current);
}
}
}
else if (inputMappings->BrowseNewD64())
{
char newFileName[64];
@ -997,6 +979,7 @@ void FileBrowser::UpdateInputFolders()
}
else
{
// check for number keys for ROM and Drive Number changes
unsigned keySetIndex;
for (keySetIndex = 0; keySetIndex < 11; ++keySetIndex)
{
@ -1004,15 +987,16 @@ void FileBrowser::UpdateInputFolders()
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase])
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
{
if (SelectROM(keySetIndex))
{
SelectROMOrDevice(keySetIndex);
}
else if ( (keySetIndex >= 7) && (keySetIndex <= 10 ) )
// check for keys a-z
if ( keyboard->KeyAnyHeld() && !keyboard->KeyEitherAlt() )
for (unsigned i=KEY_A; i<=KEY_Z; i++)
{
GlobalSetDeviceID( keySetIndex+1 );
ShowDeviceAndROM();
}
if (keyboard->KeyPressed( i ))
{
char ascKey = i-KEY_A+'A';
}
}
@ -1033,7 +1017,9 @@ void FileBrowser::UpdateInputFolders()
}
}
bool FileBrowser::SelectROM(u32 index)
bool FileBrowser::SelectROMOrDevice(u32 index)
// 0-6 select ROM image
// 7-10 change deviceID to 8-11
{
if ((index < ROMs::MAX_ROMS) && (roms->ROMValid[index]))
{
@ -1043,6 +1029,12 @@ bool FileBrowser::SelectROM(u32 index)
ShowDeviceAndROM();
return true;
}
else if ( (index >= 7) && (index <= 10 ) )
{
GlobalSetDeviceID( index+1 );
ShowDeviceAndROM();
return true;
}
return false;
}

View file

@ -217,7 +217,7 @@ private:
bool CheckForPNG(const char* filename, FILINFO& filIcon);
void DisplayPNG();
bool SelectROM(u32 index);
bool SelectROMOrDevice(u32 index);
enum State
{
@ -232,8 +232,7 @@ private:
ROMs* roms;
u8* deviceID;
bool displayPNGIcons;
bool buttonChangedDevice;
bool buttonSelectROM;
bool buttonChangedROMDevice;
BrowsableList caddySelections;