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:
parent
86131addf0
commit
70fddc97c5
4 changed files with 162 additions and 111 deletions
|
@ -385,6 +385,7 @@ FileBrowser::FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool di
|
|||
, roms(roms)
|
||||
, deviceID(deviceID)
|
||||
, displayPNGIcons(displayPNGIcons)
|
||||
, buttonChangedDevice(false)
|
||||
, screenMain(screenMain)
|
||||
, screenLCD(screenLCD)
|
||||
, scrollHighlightRate(scrollHighlightRate)
|
||||
|
@ -820,128 +821,167 @@ void FileBrowser::UpdateInputFolders()
|
|||
Keyboard* keyboard = Keyboard::Instance();
|
||||
InputMappings* inputMappings = InputMappings::Instance();
|
||||
|
||||
if (folder.entries.size() > 0)
|
||||
if (IEC_Bus::GetInputButtonHeld(4))
|
||||
{
|
||||
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
||||
bool dirty = false;
|
||||
|
||||
if (inputMappings->BrowseSelect())
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
{
|
||||
if (current->filImage.fattrib & AM_DIR)
|
||||
{
|
||||
if (strcmp(current->filImage.fname, "..") == 0)
|
||||
{
|
||||
PopFolder();
|
||||
}
|
||||
else 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)
|
||||
{
|
||||
selectionsMade = SelectLST(current->filImage.fname);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the current selected
|
||||
AddToCaddy(current);
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
}
|
||||
|
||||
if (selectionsMade)
|
||||
lastSelectionName = current->filImage.fname;
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_LOG("DEv8\r\n");
|
||||
GlobalSetDeviceID(8);
|
||||
ShowDeviceAndROM();
|
||||
buttonChangedDevice = true;
|
||||
}
|
||||
else if (inputMappings->BrowseDone())
|
||||
else if (inputMappings->BrowseUp())
|
||||
{
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
DEBUG_LOG("DEv9\r\n");
|
||||
GlobalSetDeviceID(9);
|
||||
ShowDeviceAndROM();
|
||||
buttonChangedDevice = true;
|
||||
}
|
||||
else if (inputMappings->BrowseDown())
|
||||
{
|
||||
GlobalSetDeviceID(10);
|
||||
ShowDeviceAndROM();
|
||||
buttonChangedDevice = true;
|
||||
}
|
||||
//else if (keyboard->KeyPressed(KEY_TAB))
|
||||
//{
|
||||
// state = State_DiskCaddy;
|
||||
// dirty = true;
|
||||
//}
|
||||
else if (inputMappings->BrowseBack())
|
||||
{
|
||||
PopFolder();
|
||||
dirty = true;
|
||||
GlobalSetDeviceID(11);
|
||||
ShowDeviceAndROM();
|
||||
buttonChangedDevice = true;
|
||||
}
|
||||
else if (inputMappings->Exit())
|
||||
{
|
||||
ClearSelections();
|
||||
dirty = true;
|
||||
}
|
||||
else if (inputMappings->BrowseInsert())
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
{
|
||||
dirty = AddToCaddy(current);
|
||||
}
|
||||
}
|
||||
else if (inputMappings->BrowseNewD64())
|
||||
{
|
||||
char newFileName[64];
|
||||
strncpy (newFileName, options.GetAutoBaseName(), 63);
|
||||
int num = folder.FindNextAutoName( newFileName );
|
||||
m_IEC_Commands.CreateD64(newFileName, "42", true);
|
||||
FolderChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned keySetIndex;
|
||||
for (keySetIndex = 0; keySetIndex < 11; ++keySetIndex)
|
||||
{
|
||||
unsigned keySetIndexBase = keySetIndex * 3;
|
||||
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||
{
|
||||
if ( (keySetIndex < ROMs::MAX_ROMS) && (roms->ROMValid[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 ) )
|
||||
{
|
||||
GlobalSetDeviceID( keySetIndex+1 );
|
||||
ShowDeviceAndROM();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dirty = folder.CheckBrowseNavigation();
|
||||
}
|
||||
|
||||
if (dirty) RefeshDisplay();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inputMappings->BrowseBack())
|
||||
PopFolder();
|
||||
if (folder.entries.size() > 0)
|
||||
{
|
||||
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
||||
bool dirty = false;
|
||||
|
||||
if (inputMappings->BrowseSelect())
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
{
|
||||
if (current->filImage.fattrib & AM_DIR)
|
||||
{
|
||||
if (strcmp(current->filImage.fname, "..") == 0)
|
||||
{
|
||||
PopFolder();
|
||||
}
|
||||
else 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)
|
||||
{
|
||||
selectionsMade = SelectLST(current->filImage.fname);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the current selected
|
||||
AddToCaddy(current);
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
}
|
||||
|
||||
if (selectionsMade)
|
||||
lastSelectionName = current->filImage.fname;
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (inputMappings->BrowseDone())
|
||||
{
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
}
|
||||
//else if (keyboard->KeyPressed(KEY_TAB))
|
||||
//{
|
||||
// state = State_DiskCaddy;
|
||||
// dirty = true;
|
||||
//}
|
||||
else if (inputMappings->BrowseBack())
|
||||
{
|
||||
PopFolder();
|
||||
dirty = true;
|
||||
}
|
||||
else if (inputMappings->Exit())
|
||||
{
|
||||
ClearSelections();
|
||||
dirty = true;
|
||||
}
|
||||
else if (inputMappings->BrowseInsert())
|
||||
{
|
||||
if (buttonChangedDevice)
|
||||
{
|
||||
buttonChangedDevice = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
{
|
||||
dirty = AddToCaddy(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (inputMappings->BrowseNewD64())
|
||||
{
|
||||
char newFileName[64];
|
||||
strncpy (newFileName, options.GetAutoBaseName(), 63);
|
||||
int num = folder.FindNextAutoName( newFileName );
|
||||
m_IEC_Commands.CreateD64(newFileName, "42", true);
|
||||
FolderChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned keySetIndex;
|
||||
for (keySetIndex = 0; keySetIndex < 11; ++keySetIndex)
|
||||
{
|
||||
unsigned keySetIndexBase = keySetIndex * 3;
|
||||
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||
{
|
||||
if ( (keySetIndex < ROMs::MAX_ROMS) && (roms->ROMValid[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 ) )
|
||||
{
|
||||
GlobalSetDeviceID( keySetIndex+1 );
|
||||
ShowDeviceAndROM();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dirty = folder.CheckBrowseNavigation();
|
||||
}
|
||||
|
||||
if (dirty) RefeshDisplay();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inputMappings->BrowseBack())
|
||||
PopFolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,6 +230,7 @@ private:
|
|||
ROMs* roms;
|
||||
u8* deviceID;
|
||||
bool displayPNGIcons;
|
||||
bool buttonChangedDevice;
|
||||
|
||||
BrowsableList caddySelections;
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ unsigned InputMappings::directDiskSwapRequest = 0;
|
|||
|
||||
InputMappings::InputMappings()
|
||||
: keyboardBrowseLCDScreen(false)
|
||||
, insertButtonPressedPrev(false)
|
||||
, insertButtonPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -47,8 +49,13 @@ bool InputMappings::CheckButtonsBrowseMode()
|
|||
SetButtonFlag(DOWN_FLAG);
|
||||
else if (IEC_Bus::GetInputButtonPressed(3))
|
||||
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);
|
||||
insertButtonPressedPrev = insertButtonPressed;
|
||||
|
||||
return buttonFlags != 0;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,9 @@ protected:
|
|||
|
||||
bool keyboardBrowseLCDScreen;
|
||||
|
||||
bool insertButtonPressedPrev;
|
||||
bool insertButtonPressed;
|
||||
|
||||
//inline void SetUartFlag(unsigned flag) { uartFlags |= flag; }
|
||||
//inline bool UartFlag(unsigned flag) { return (uartFlags & flag) != 0; }
|
||||
inline void SetKeyboardFlag(unsigned flag) { keyboardFlags |= flag; }
|
||||
|
|
Loading…
Reference in a new issue