Browse mode - MUST use F1..F11 for rom and device ID changes

numbers have been removed
This commit is contained in:
penfold42 2018-08-01 21:24:33 +10:00
parent 313ad5a978
commit c080a8cb0c
3 changed files with 51 additions and 66 deletions

View File

@ -1021,11 +1021,11 @@ void FileBrowser::UpdateInputFolders()
else else
{ {
// check for number keys for ROM and Drive Number changes // check for number keys for ROM and Drive Number changes
if (inputMappings->BrowseNumber() if (inputMappings->BrowseFunction()
&& inputMappings->getKeyboardNumber() >= 0 && inputMappings->getKeyboardFunction() >= 1
&& inputMappings->getKeyboardNumber() < 11 ) && inputMappings->getKeyboardFunction() <= 11 )
{ {
SelectROMOrDevice(inputMappings->getKeyboardNumber()); SelectROMOrDevice(inputMappings->getKeyboardFunction());
} }
@ -1047,9 +1047,16 @@ void FileBrowser::UpdateInputFolders()
} }
bool FileBrowser::SelectROMOrDevice(u32 index) bool FileBrowser::SelectROMOrDevice(u32 index)
// 0-6 select ROM image // 1-7 select ROM image
// 7-10 change deviceID to 8-11 // 8-11 change deviceID to 8-11
{ {
if ( (index >= 8) && (index <= 11 ) )
{
GlobalSetDeviceID( index );
ShowDeviceAndROM();
return true;
}
index--;
if ((index < ROMs::MAX_ROMS) && (roms->ROMValid[index])) if ((index < ROMs::MAX_ROMS) && (roms->ROMValid[index]))
{ {
roms->currentROMIndex = index; roms->currentROMIndex = index;
@ -1058,12 +1065,6 @@ bool FileBrowser::SelectROMOrDevice(u32 index)
ShowDeviceAndROM(); ShowDeviceAndROM();
return true; return true;
} }
else if ( (index >= 7) && (index <= 10 ) )
{
GlobalSetDeviceID( index+1 );
ShowDeviceAndROM();
return true;
}
return false; return false;
} }

View File

@ -197,14 +197,23 @@ bool InputMappings::CheckKeyboardBrowseMode()
if (keyboard->KeyNoModifiers()) if (keyboard->KeyNoModifiers())
{ {
unsigned index; unsigned index;
for (index = 0; index < sizeof(NumberKeys)/sizeof(NumberKeys[0]); index+=3)
for (index = KEY_1; index <= KEY_0; ++index)
{ {
if (keyboard->KeyHeld(NumberKeys[index]) if (keyboard->KeyHeld(index))
|| keyboard->KeyHeld(NumberKeys[index + 1])
|| keyboard->KeyHeld(NumberKeys[index + 2]) )
{ {
SetKeyboardFlag(NUMBER_FLAG); SetKeyboardFlag(NUMBER_FLAG);
keyboardNumber = index/3; // key 1 is 0 keyboardNumber = index-KEY_1+'1'; // key 1 is ascii '1'
if (keyboardNumber > '9') keyboardNumber = '0';
}
}
for (index = KEY_KP1; index <= KEY_KP0; ++index)
{
if (keyboard->KeyHeld(index))
{
SetKeyboardFlag(NUMBER_FLAG);
keyboardNumber = index-KEY_KP1+'1'; // key 1 is ascii '1'
if (keyboardNumber > '9') keyboardNumber = '0';
} }
} }
for (index = KEY_A; index <= KEY_Z; ++index) for (index = KEY_A; index <= KEY_Z; ++index)
@ -215,6 +224,14 @@ bool InputMappings::CheckKeyboardBrowseMode()
keyboardLetter = index-KEY_A+'A'; // key A is ascii 'A' keyboardLetter = index-KEY_A+'A'; // key A is ascii 'A'
} }
} }
for (index = KEY_F1; index <= KEY_F12; ++index) // F13 isnt contiguous
{
if (keyboard->KeyHeld(index))
{
SetKeyboardFlag(FUNCTION_FLAG);
keyboardFunction = index-KEY_F1+1; // key F1 is 1
}
}
} }
} }

View File

@ -44,6 +44,7 @@
#define LETTER_FLAG (1 << 18) #define LETTER_FLAG (1 << 18)
#define HOME_FLAG (1 << 19) #define HOME_FLAG (1 << 19)
#define END_FLAG (1 << 20) #define END_FLAG (1 << 20)
#define FUNCTION_FLAG (1 << 21)
// dont exceed 32!! // dont exceed 32!!
const unsigned NumberKeys[33] = const unsigned NumberKeys[33] =
@ -79,6 +80,7 @@ protected:
unsigned keyboardNumber; unsigned keyboardNumber;
unsigned keyboardLetter; unsigned keyboardLetter;
unsigned keyboardFunction;
//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; }
@ -122,15 +124,9 @@ public:
return KeyboardFlag(PREV_FLAG)/* | UartFlag(PREV_FLAG)*/ | ButtonFlag(PREV_FLAG); return KeyboardFlag(PREV_FLAG)/* | UartFlag(PREV_FLAG)*/ | ButtonFlag(PREV_FLAG);
} }
inline bool AutoLoad() inline bool AutoLoad() { return KeyboardFlag(AUTOLOAD_FLAG); }
{
return KeyboardFlag(AUTOLOAD_FLAG);
}
inline bool FakeReset() inline bool FakeReset() { return KeyboardFlag(FAKERESET_FLAG); }
{
return KeyboardFlag(FAKERESET_FLAG);
}
inline bool BrowseSelect() inline bool BrowseSelect()
{ {
@ -156,10 +152,7 @@ public:
{ {
return KeyboardFlag(PAGEUP_FLAG)/* | UartFlag(PAGEUP_FLAG)*/; return KeyboardFlag(PAGEUP_FLAG)/* | UartFlag(PAGEUP_FLAG)*/;
} }
inline bool BrowsePageUpLCD() inline bool BrowsePageUpLCD() { return KeyboardFlag(PAGEUP_LCD_FLAG); }
{
return KeyboardFlag(PAGEUP_LCD_FLAG);
}
inline bool BrowseDown() inline bool BrowseDown()
{ {
@ -170,58 +163,32 @@ public:
{ {
return KeyboardFlag(PAGEDOWN_FLAG)/* | UartFlag(PAGEDOWN_FLAG)*/; return KeyboardFlag(PAGEDOWN_FLAG)/* | UartFlag(PAGEDOWN_FLAG)*/;
} }
inline bool BrowsePageDownLCD() inline bool BrowsePageDownLCD() { return KeyboardFlag(PAGEDOWN_LCD_FLAG); }
{
return KeyboardFlag(PAGEDOWN_LCD_FLAG);
}
inline bool BrowseInsert() inline bool BrowseInsert()
{ {
return KeyboardFlag(INSERT_FLAG)/* | UartFlag(INSERT_FLAG)*/ | ButtonFlag(INSERT_FLAG); return KeyboardFlag(INSERT_FLAG)/* | UartFlag(INSERT_FLAG)*/ | ButtonFlag(INSERT_FLAG);
} }
inline bool BrowseNewD64() inline bool BrowseNewD64() { return KeyboardFlag(NEWD64_FLAG); }
{
return KeyboardFlag(NEWD64_FLAG);
}
inline bool BrowseAutoLoad() inline bool BrowseAutoLoad() { return KeyboardFlag(AUTOLOAD_FLAG); }
{
return KeyboardFlag(AUTOLOAD_FLAG);
}
inline bool BrowseFakeReset() inline bool BrowseFakeReset() { return KeyboardFlag(FAKERESET_FLAG); }
{
return KeyboardFlag(FAKERESET_FLAG);
}
inline bool BrowseWriteProtect() inline bool BrowseWriteProtect() { return KeyboardFlag(WRITEPROTECT_FLAG); }
{
return KeyboardFlag(WRITEPROTECT_FLAG);
}
inline bool BrowseNumber() inline bool BrowseNumber() { return KeyboardFlag(NUMBER_FLAG); }
{ inline bool BrowseLetter() { return KeyboardFlag(LETTER_FLAG); }
return KeyboardFlag(NUMBER_FLAG); inline bool BrowseFunction() { return KeyboardFlag(FUNCTION_FLAG); }
}
inline bool BrowseLetter() inline bool BrowseHome() { return KeyboardFlag(HOME_FLAG); }
{
return KeyboardFlag(LETTER_FLAG);
}
inline bool BrowseHome() inline bool BrowseEnd() { return KeyboardFlag(END_FLAG); }
{
return KeyboardFlag(HOME_FLAG);
}
inline bool BrowseEnd()
{
return KeyboardFlag(END_FLAG);
}
inline unsigned getKeyboardNumber() { return keyboardNumber; } inline unsigned getKeyboardNumber() { return keyboardNumber; }
inline char getKeyboardLetter() { return (char) keyboardLetter; } inline char getKeyboardLetter() { return (char) keyboardLetter; }
inline char getKeyboardFunction() { return (char) keyboardFunction; }
// Used by the 2 cores so need to be volatile // Used by the 2 cores so need to be volatile
//volatile static unsigned directDiskSwapRequest; //volatile static unsigned directDiskSwapRequest;