Alt-a will autoload image during emulation

This commit is contained in:
penfold42 2018-07-29 00:35:17 +10:00
parent 94f579fc08
commit f807a9cdc0
4 changed files with 27 additions and 3 deletions

View File

@ -181,6 +181,8 @@ bool InputMappings::CheckKeyboardBrowseMode()
SetKeyboardFlag(NEWD64_FLAG);
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(AUTOLOAD_FLAG);
else if (keyboard->KeyHeld(KEY_R) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(FAKERESET_FLAG);
else
{
unsigned index;
@ -210,6 +212,8 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
SetKeyboardFlag(NEXT_FLAG);
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(AUTOLOAD_FLAG);
else if (keyboard->KeyHeld(KEY_R) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(FAKERESET_FLAG);
else if (numberOfImages > 1)
{
unsigned index;

View File

@ -39,6 +39,7 @@
#define NEWD64_FLAG (1 << 14)
#define AUTOLOAD_FLAG (1 << 15)
#define FAKERESET_FLAG (1 << 16)
// dont exceed 32!!
class InputMappings : public Singleton<InputMappings>
@ -96,6 +97,16 @@ public:
return KeyboardFlag(PREV_FLAG)/* | UartFlag(PREV_FLAG)*/ | ButtonFlag(PREV_FLAG);
}
inline bool AutoLoad()
{
return KeyboardFlag(AUTOLOAD_FLAG);
}
inline bool FakeReset()
{
return KeyboardFlag(FAKERESET_FLAG);
}
inline bool BrowseSelect()
{
return KeyboardFlag(ENTER_FLAG)/* | UartFlag(ENTER_FLAG)*/ | ButtonFlag(ENTER_FLAG);
@ -154,6 +165,11 @@ public:
return KeyboardFlag(AUTOLOAD_FLAG);
}
inline bool BrowseFakeReset()
{
return KeyboardFlag(FAKERESET_FLAG);
}
// Used by the 2 cores so need to be volatile
//volatile static unsigned directDiskSwapRequest;
static unsigned directDiskSwapRequest;

View File

@ -656,6 +656,7 @@ void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser)
switch (reset_reason)
{
case EXIT_UNKNOWN:
case EXIT_AUTOLOAD:
case EXIT_RESET:
fileBrowser->SelectAutoMountImage(autoMountImageName);
break;
@ -939,6 +940,7 @@ void emulator()
bool exitEmulation = inputMappings->Exit();
bool nextDisk = inputMappings->NextDisk();
bool prevDisk = inputMappings->PrevDisk();
bool exitDoAutoLoad = inputMappings->AutoLoad();
if (nextDisk)
{
@ -971,7 +973,7 @@ void emulator()
else
resetCount = 0;
if (!emulating || (resetCount > 10) || exitEmulation)
if (!emulating || (resetCount > 10) || exitEmulation || exitDoAutoLoad)
{
// Clearing the caddy now
// - will write back all changed/dirty/written to disk images now
@ -995,8 +997,9 @@ void emulator()
}
if (exitEmulation)
exitReason = EXIT_KEYBOARD;
if (exitDoAutoLoad)
exitReason = EXIT_AUTOLOAD;
break;
}
if (cycleCount < FAST_BOOT_CYCLES) // cycleCount is used so we can quickly get through 1541's self test code. This will make the emulated 1541 responsive to commands asap.

View File

@ -20,7 +20,8 @@ typedef enum {
EXIT_UNKNOWN,
EXIT_RESET,
EXIT_CD,
EXIT_KEYBOARD
EXIT_KEYBOARD,
EXIT_AUTOLOAD
} EXIT_TYPE;
#endif