Alt-A from browser load the automountimage

This commit is contained in:
penfold42 2018-07-27 23:43:49 +10:00
parent 369e2ff800
commit d15641e57f
5 changed files with 23 additions and 7 deletions

View file

@ -41,6 +41,7 @@ extern Options options;
#define PNG_HEIGHT 200 #define PNG_HEIGHT 200
extern void GlobalSetDeviceID(u8 id); extern void GlobalSetDeviceID(u8 id);
extern void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser);
unsigned char FileBrowser::LSTBuffer[FileBrowser::LSTBuffer_size]; unsigned char FileBrowser::LSTBuffer[FileBrowser::LSTBuffer_size];
@ -982,6 +983,10 @@ void FileBrowser::UpdateInputFolders()
if (inputMappings->BrowseBack()) if (inputMappings->BrowseBack())
PopFolder(); PopFolder();
} }
if (inputMappings->BrowseAutoLoad())
{
CheckAutoMountImage(EXIT_RESET, this);
}
} }
} }

View file

@ -179,6 +179,8 @@ bool InputMappings::CheckKeyboardBrowseMode()
// SetKeyboardFlag(PAGEDOWN_LCD_FLAG); // SetKeyboardFlag(PAGEDOWN_LCD_FLAG);
else if (keyboard->KeyHeld(KEY_N) && keyboard->KeyEitherAlt() ) else if (keyboard->KeyHeld(KEY_N) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(NEWD64_FLAG); SetKeyboardFlag(NEWD64_FLAG);
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(AUTOLOAD_FLAG);
else else
{ {
unsigned index; unsigned index;
@ -206,6 +208,8 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
SetKeyboardFlag(PREV_FLAG); SetKeyboardFlag(PREV_FLAG);
else if (keyboard->KeyHeld(KEY_PAGEDOWN)) else if (keyboard->KeyHeld(KEY_PAGEDOWN))
SetKeyboardFlag(NEXT_FLAG); SetKeyboardFlag(NEXT_FLAG);
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(AUTOLOAD_FLAG);
else if (numberOfImages > 1) else if (numberOfImages > 1)
{ {
unsigned index; unsigned index;

View file

@ -38,6 +38,7 @@
#define PAGEUP_LCD_FLAG (1 << 13) #define PAGEUP_LCD_FLAG (1 << 13)
#define NEWD64_FLAG (1 << 14) #define NEWD64_FLAG (1 << 14)
#define AUTOLOAD_FLAG (1 << 15)
// dont exceed 32!! // dont exceed 32!!
class InputMappings : public Singleton<InputMappings> class InputMappings : public Singleton<InputMappings>
@ -148,6 +149,11 @@ public:
return KeyboardFlag(NEWD64_FLAG); return KeyboardFlag(NEWD64_FLAG);
} }
inline bool BrowseAutoLoad()
{
return KeyboardFlag(AUTOLOAD_FLAG);
}
// 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;
static unsigned directDiskSwapRequest; static unsigned directDiskSwapRequest;

View file

@ -102,12 +102,6 @@ unsigned int screenHeight = 768;
const char* termainalTextRed = "\E[31m"; const char* termainalTextRed = "\E[31m";
const char* termainalTextNormal = "\E[0m"; const char* termainalTextNormal = "\E[0m";
typedef enum {
EXIT_UNKNOWN,
EXIT_RESET,
EXIT_CD,
EXIT_KEYBOARD
} EXIT_TYPE;
EXIT_TYPE exitReason = EXIT_UNKNOWN; EXIT_TYPE exitReason = EXIT_UNKNOWN;
// Hooks required for USPi library // Hooks required for USPi library
@ -654,7 +648,7 @@ void GlobalSetDeviceID(u8 id)
SetVIAsDeviceID(id); SetVIAsDeviceID(id);
} }
static void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser) void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser)
{ {
const char* autoMountImageName = options.GetAutoMountImageName(); const char* autoMountImageName = options.GetAutoMountImageName();
if (autoMountImageName[0] != 0) if (autoMountImageName[0] != 0)

View file

@ -16,4 +16,11 @@ typedef enum {
LCD_1106_128x64, LCD_1106_128x64,
} LCD_MODEL; } LCD_MODEL;
typedef enum {
EXIT_UNKNOWN,
EXIT_RESET,
EXIT_CD,
EXIT_KEYBOARD
} EXIT_TYPE;
#endif #endif