Escape will now exit an automounted image without re-autoloading it
This commit is contained in:
parent
2bc501dd85
commit
c6c79d9c81
1 changed files with 30 additions and 11 deletions
37
src/main.cpp
37
src/main.cpp
|
@ -102,6 +102,14 @@ unsigned int screenHeight = 768;
|
|||
const char* termainalTextRed = "\E[31m";
|
||||
const char* termainalTextNormal = "\E[0m";
|
||||
|
||||
typedef enum {
|
||||
EXIT_UNKNOWN,
|
||||
EXIT_RESET,
|
||||
EXIT_CD,
|
||||
EXIT_KEYBOARD
|
||||
} EXIT_TYPE;
|
||||
EXIT_TYPE exitReason = EXIT_UNKNOWN;
|
||||
|
||||
// Hooks required for USPi library
|
||||
extern "C"
|
||||
{
|
||||
|
@ -631,13 +639,23 @@ static void SetVIAsDeviceID(u8 id)
|
|||
if (id & 2) pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL1, true);
|
||||
}
|
||||
|
||||
static void CheckAutoMountImage(bool CD_, FileBrowser* fileBrowser)
|
||||
static void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser)
|
||||
{
|
||||
if (CD_ == false)
|
||||
{
|
||||
const char* autoMountImageName = options.GetAutoMountImageName();
|
||||
if (autoMountImageName[0] != 0)
|
||||
{
|
||||
switch (reset_reason)
|
||||
{
|
||||
case EXIT_UNKNOWN:
|
||||
case EXIT_RESET:
|
||||
fileBrowser->AutoSelectImage(autoMountImageName);
|
||||
break;
|
||||
case EXIT_CD:
|
||||
case EXIT_KEYBOARD:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -651,7 +669,6 @@ void emulator()
|
|||
bool selectedViaIECCommands = false;
|
||||
InputMappings* inputMappings = InputMappings::Instance();
|
||||
FileBrowser* fileBrowser;
|
||||
bool CD_ = false;
|
||||
|
||||
roms.lastManualSelectedROMIndex = 0;
|
||||
|
||||
|
@ -691,7 +708,7 @@ void emulator()
|
|||
{
|
||||
m_IEC_Commands.SimulateIECBegin();
|
||||
|
||||
CheckAutoMountImage(CD_, fileBrowser);
|
||||
CheckAutoMountImage(exitReason, fileBrowser);
|
||||
|
||||
while (!emulating)
|
||||
{
|
||||
|
@ -704,7 +721,7 @@ void emulator()
|
|||
fileBrowser->DisplayRoot();
|
||||
IEC_Bus::Reset();
|
||||
m_IEC_Commands.SimulateIECBegin();
|
||||
CheckAutoMountImage(false, fileBrowser);
|
||||
CheckAutoMountImage(EXIT_UNKNOWN, fileBrowser);
|
||||
break;
|
||||
case IEC_Commands::NONE:
|
||||
{
|
||||
|
@ -843,7 +860,7 @@ void emulator()
|
|||
// Exit full emulation back to IEC commands level simulation.
|
||||
snoopIndex = 0;
|
||||
emulating = false;
|
||||
CD_ = true;
|
||||
exitReason = EXIT_CD;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -960,8 +977,10 @@ void emulator()
|
|||
fileBrowser->DisplayRoot();//m_IEC_Commands.ChangeToRoot(); // TO CHECK
|
||||
emulating = false;
|
||||
resetWhileEmulating = true;
|
||||
if (reset || exitEmulation)
|
||||
CD_ = false;
|
||||
if (reset)
|
||||
exitReason = EXIT_RESET;
|
||||
if (exitEmulation)
|
||||
exitReason = EXIT_KEYBOARD;
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue