ROM and deviceID cleanups
start implementing a-z
This commit is contained in:
parent
b001959483
commit
b809e3e70b
2 changed files with 77 additions and 86 deletions
|
@ -386,8 +386,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)
|
, buttonChangedROMDevice(false)
|
||||||
, buttonSelectROM(false)
|
|
||||||
, screenMain(screenMain)
|
, screenMain(screenMain)
|
||||||
, screenLCD(screenLCD)
|
, screenLCD(screenLCD)
|
||||||
, scrollHighlightRate(scrollHighlightRate)
|
, scrollHighlightRate(scrollHighlightRate)
|
||||||
|
@ -823,54 +822,51 @@ void FileBrowser::UpdateInputFolders()
|
||||||
Keyboard* keyboard = Keyboard::Instance();
|
Keyboard* keyboard = Keyboard::Instance();
|
||||||
InputMappings* inputMappings = InputMappings::Instance();
|
InputMappings* inputMappings = InputMappings::Instance();
|
||||||
|
|
||||||
|
buttonChangedROMDevice = false;
|
||||||
if (IEC_Bus::GetInputButtonHeld(4))
|
if (IEC_Bus::GetInputButtonHeld(4))
|
||||||
{
|
{
|
||||||
if (inputMappings->BrowseSelect())
|
if (inputMappings->BrowseSelect())
|
||||||
{
|
{
|
||||||
GlobalSetDeviceID(8);
|
SelectROMOrDevice(7); // == device 8
|
||||||
ShowDeviceAndROM();
|
buttonChangedROMDevice = true;
|
||||||
buttonChangedDevice = true;
|
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseUp())
|
else if (inputMappings->BrowseUp())
|
||||||
{
|
{
|
||||||
GlobalSetDeviceID(9);
|
SelectROMOrDevice(8); // == device 9
|
||||||
ShowDeviceAndROM();
|
buttonChangedROMDevice = true;
|
||||||
buttonChangedDevice = true;
|
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseDown())
|
else if (inputMappings->BrowseDown())
|
||||||
{
|
{
|
||||||
GlobalSetDeviceID(10);
|
SelectROMOrDevice(9); // == device 10
|
||||||
ShowDeviceAndROM();
|
buttonChangedROMDevice = true;
|
||||||
buttonChangedDevice = true;
|
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseBack())
|
else if (inputMappings->BrowseBack())
|
||||||
{
|
{
|
||||||
GlobalSetDeviceID(11);
|
SelectROMOrDevice(10); // == device 11
|
||||||
ShowDeviceAndROM();
|
buttonChangedROMDevice = true;
|
||||||
buttonChangedDevice = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IEC_Bus::GetInputButtonHeld(0))
|
else if (IEC_Bus::GetInputButtonHeld(0))
|
||||||
{
|
{
|
||||||
if (inputMappings->BrowseUp())
|
if (inputMappings->BrowseUp())
|
||||||
{
|
{
|
||||||
SelectROM(0);
|
SelectROMOrDevice(0);
|
||||||
buttonSelectROM = true;
|
buttonChangedROMDevice = true;
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseDown())
|
else if (inputMappings->BrowseDown())
|
||||||
{
|
{
|
||||||
SelectROM(1);
|
SelectROMOrDevice(1);
|
||||||
buttonSelectROM = true;
|
buttonChangedROMDevice = true;
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseBack())
|
else if (inputMappings->BrowseBack())
|
||||||
{
|
{
|
||||||
SelectROM(2);
|
SelectROMOrDevice(2);
|
||||||
buttonSelectROM = true;
|
buttonChangedROMDevice = true;
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseInsert())
|
else if (inputMappings->BrowseInsert())
|
||||||
{
|
{
|
||||||
SelectROM(3);
|
SelectROMOrDevice(3);
|
||||||
buttonSelectROM = true;
|
buttonChangedROMDevice = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -880,57 +876,50 @@ void FileBrowser::UpdateInputFolders()
|
||||||
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
if (inputMappings->BrowseSelect())
|
if (inputMappings->BrowseSelect() && !buttonChangedROMDevice )
|
||||||
{
|
{
|
||||||
if (buttonSelectROM)
|
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||||
|
if (current)
|
||||||
{
|
{
|
||||||
buttonSelectROM = false;
|
if (current->filImage.fattrib & AM_DIR)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
|
||||||
if (current)
|
|
||||||
{
|
{
|
||||||
if (current->filImage.fattrib & AM_DIR)
|
if (strcmp(current->filImage.fname, "..") == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(current->filImage.fname, "..") == 0)
|
PopFolder();
|
||||||
{
|
|
||||||
PopFolder();
|
|
||||||
}
|
|
||||||
else if (strcmp(current->filImage.fname, ".") != 0)
|
|
||||||
{
|
|
||||||
f_chdir(current->filImage.fname);
|
|
||||||
RefreshFolderEntries();
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
}
|
}
|
||||||
else
|
else if (strcmp(current->filImage.fname, ".") != 0)
|
||||||
{
|
{
|
||||||
if (strcmp(current->filImage.fname, "..") == 0)
|
f_chdir(current->filImage.fname);
|
||||||
|
RefreshFolderEntries();
|
||||||
|
}
|
||||||
|
dirty = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strcmp(current->filImage.fname, "..") == 0)
|
||||||
|
{
|
||||||
|
PopFolder();
|
||||||
|
}
|
||||||
|
else if (DiskImage::IsDiskImageExtention(current->filImage.fname))
|
||||||
|
{
|
||||||
|
DiskImage::DiskType diskType = DiskImage::GetDiskImageTypeViaExtention(current->filImage.fname);
|
||||||
|
|
||||||
|
// Should also be able to create a LST file from all the images currently selected in the caddy
|
||||||
|
if (diskType == DiskImage::LST)
|
||||||
{
|
{
|
||||||
PopFolder();
|
selectionsMade = SelectLST(current->filImage.fname);
|
||||||
}
|
}
|
||||||
else if (DiskImage::IsDiskImageExtention(current->filImage.fname))
|
else
|
||||||
{
|
{
|
||||||
DiskImage::DiskType diskType = DiskImage::GetDiskImageTypeViaExtention(current->filImage.fname);
|
// Add the current selected
|
||||||
|
AddToCaddy(current);
|
||||||
// Should also be able to create a LST file from all the images currently selected in the caddy
|
selectionsMade = FillCaddyWithSelections();
|
||||||
if (diskType == DiskImage::LST)
|
|
||||||
{
|
|
||||||
selectionsMade = SelectLST(current->filImage.fname);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Add the current selected
|
|
||||||
AddToCaddy(current);
|
|
||||||
selectionsMade = FillCaddyWithSelections();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectionsMade)
|
|
||||||
lastSelectionName = current->filImage.fname;
|
|
||||||
|
|
||||||
dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectionsMade)
|
||||||
|
lastSelectionName = current->filImage.fname;
|
||||||
|
|
||||||
|
dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -954,19 +943,12 @@ void FileBrowser::UpdateInputFolders()
|
||||||
ClearSelections();
|
ClearSelections();
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseInsert())
|
else if (inputMappings->BrowseInsert() && !buttonChangedROMDevice )
|
||||||
{
|
{
|
||||||
if (buttonChangedDevice)
|
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||||
|
if (current)
|
||||||
{
|
{
|
||||||
buttonChangedDevice = false;
|
dirty = AddToCaddy(current);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
|
||||||
if (current)
|
|
||||||
{
|
|
||||||
dirty = AddToCaddy(current);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseNewD64())
|
else if (inputMappings->BrowseNewD64())
|
||||||
|
@ -997,6 +979,7 @@ void FileBrowser::UpdateInputFolders()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// check for number keys for ROM and Drive Number changes
|
||||||
unsigned keySetIndex;
|
unsigned keySetIndex;
|
||||||
for (keySetIndex = 0; keySetIndex < 11; ++keySetIndex)
|
for (keySetIndex = 0; keySetIndex < 11; ++keySetIndex)
|
||||||
{
|
{
|
||||||
|
@ -1004,15 +987,16 @@ void FileBrowser::UpdateInputFolders()
|
||||||
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase])
|
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase])
|
||||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
||||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||||
|
SelectROMOrDevice(keySetIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for keys a-z
|
||||||
|
if ( keyboard->KeyAnyHeld() && !keyboard->KeyEitherAlt() )
|
||||||
|
for (unsigned i=KEY_A; i<=KEY_Z; i++)
|
||||||
|
{
|
||||||
|
if (keyboard->KeyPressed( i ))
|
||||||
{
|
{
|
||||||
if (SelectROM(keySetIndex))
|
char ascKey = i-KEY_A+'A';
|
||||||
{
|
|
||||||
}
|
|
||||||
else if ( (keySetIndex >= 7) && (keySetIndex <= 10 ) )
|
|
||||||
{
|
|
||||||
GlobalSetDeviceID( keySetIndex+1 );
|
|
||||||
ShowDeviceAndROM();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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]))
|
if ((index < ROMs::MAX_ROMS) && (roms->ROMValid[index]))
|
||||||
{
|
{
|
||||||
|
@ -1043,6 +1029,12 @@ bool FileBrowser::SelectROM(u32 index)
|
||||||
ShowDeviceAndROM();
|
ShowDeviceAndROM();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if ( (index >= 7) && (index <= 10 ) )
|
||||||
|
{
|
||||||
|
GlobalSetDeviceID( index+1 );
|
||||||
|
ShowDeviceAndROM();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ private:
|
||||||
bool CheckForPNG(const char* filename, FILINFO& filIcon);
|
bool CheckForPNG(const char* filename, FILINFO& filIcon);
|
||||||
void DisplayPNG();
|
void DisplayPNG();
|
||||||
|
|
||||||
bool SelectROM(u32 index);
|
bool SelectROMOrDevice(u32 index);
|
||||||
|
|
||||||
enum State
|
enum State
|
||||||
{
|
{
|
||||||
|
@ -232,8 +232,7 @@ private:
|
||||||
ROMs* roms;
|
ROMs* roms;
|
||||||
u8* deviceID;
|
u8* deviceID;
|
||||||
bool displayPNGIcons;
|
bool displayPNGIcons;
|
||||||
bool buttonChangedDevice;
|
bool buttonChangedROMDevice;
|
||||||
bool buttonSelectROM;
|
|
||||||
|
|
||||||
BrowsableList caddySelections;
|
BrowsableList caddySelections;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue