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); SetKeyboardFlag(NEWD64_FLAG);
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() ) else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(AUTOLOAD_FLAG); SetKeyboardFlag(AUTOLOAD_FLAG);
else if (keyboard->KeyHeld(KEY_R) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(FAKERESET_FLAG);
else else
{ {
unsigned index; unsigned index;
@ -210,6 +212,8 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
SetKeyboardFlag(NEXT_FLAG); SetKeyboardFlag(NEXT_FLAG);
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() ) else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(AUTOLOAD_FLAG); SetKeyboardFlag(AUTOLOAD_FLAG);
else if (keyboard->KeyHeld(KEY_R) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(FAKERESET_FLAG);
else if (numberOfImages > 1) else if (numberOfImages > 1)
{ {
unsigned index; unsigned index;

View File

@ -39,6 +39,7 @@
#define NEWD64_FLAG (1 << 14) #define NEWD64_FLAG (1 << 14)
#define AUTOLOAD_FLAG (1 << 15) #define AUTOLOAD_FLAG (1 << 15)
#define FAKERESET_FLAG (1 << 16)
// dont exceed 32!! // dont exceed 32!!
class InputMappings : public Singleton<InputMappings> class InputMappings : public Singleton<InputMappings>
@ -96,6 +97,16 @@ public:
return KeyboardFlag(PREV_FLAG)/* | UartFlag(PREV_FLAG)*/ | ButtonFlag(PREV_FLAG); 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() inline bool BrowseSelect()
{ {
return KeyboardFlag(ENTER_FLAG)/* | UartFlag(ENTER_FLAG)*/ | ButtonFlag(ENTER_FLAG); return KeyboardFlag(ENTER_FLAG)/* | UartFlag(ENTER_FLAG)*/ | ButtonFlag(ENTER_FLAG);
@ -154,6 +165,11 @@ public:
return KeyboardFlag(AUTOLOAD_FLAG); return KeyboardFlag(AUTOLOAD_FLAG);
} }
inline bool BrowseFakeReset()
{
return KeyboardFlag(FAKERESET_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

@ -656,6 +656,7 @@ void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser)
switch (reset_reason) switch (reset_reason)
{ {
case EXIT_UNKNOWN: case EXIT_UNKNOWN:
case EXIT_AUTOLOAD:
case EXIT_RESET: case EXIT_RESET:
fileBrowser->SelectAutoMountImage(autoMountImageName); fileBrowser->SelectAutoMountImage(autoMountImageName);
break; break;
@ -939,6 +940,7 @@ void emulator()
bool exitEmulation = inputMappings->Exit(); bool exitEmulation = inputMappings->Exit();
bool nextDisk = inputMappings->NextDisk(); bool nextDisk = inputMappings->NextDisk();
bool prevDisk = inputMappings->PrevDisk(); bool prevDisk = inputMappings->PrevDisk();
bool exitDoAutoLoad = inputMappings->AutoLoad();
if (nextDisk) if (nextDisk)
{ {
@ -971,7 +973,7 @@ void emulator()
else else
resetCount = 0; resetCount = 0;
if (!emulating || (resetCount > 10) || exitEmulation) if (!emulating || (resetCount > 10) || exitEmulation || exitDoAutoLoad)
{ {
// Clearing the caddy now // Clearing the caddy now
// - will write back all changed/dirty/written to disk images now // - will write back all changed/dirty/written to disk images now
@ -995,8 +997,9 @@ void emulator()
} }
if (exitEmulation) if (exitEmulation)
exitReason = EXIT_KEYBOARD; exitReason = EXIT_KEYBOARD;
if (exitDoAutoLoad)
exitReason = EXIT_AUTOLOAD;
break; 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. 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_UNKNOWN,
EXIT_RESET, EXIT_RESET,
EXIT_CD, EXIT_CD,
EXIT_KEYBOARD EXIT_KEYBOARD,
EXIT_AUTOLOAD
} EXIT_TYPE; } EXIT_TYPE;
#endif #endif