Fixed issue #133

This commit is contained in:
Stephen White 2019-05-20 20:00:38 +10:00
parent 1921f5755d
commit 50a590ee84
3 changed files with 38 additions and 10 deletions

View file

@ -23,6 +23,7 @@
extern "C"
{
#include "rpi-aux.h"
extern void usDelay(unsigned nMicroSeconds);
}
extern void Reboot_Pi(void);
@ -67,6 +68,7 @@ bool InputMappings::CheckButtonsBrowseMode()
SetButtonFlag(FUNCTION_FLAG);
inputROMOrDevice = 11;
}
insertButtonPressedPrev = false;
}
else if (IEC_Bus::GetInputButtonHeld(INPUT_BUTTON_ENTER)) // Change ROMs
{
@ -90,6 +92,7 @@ bool InputMappings::CheckButtonsBrowseMode()
SetButtonFlag(FUNCTION_FLAG);
inputROMOrDevice = 4;
}
enterButtonPressedPrev = false;
}
else if (IEC_Bus::GetInputButtonRepeating(INPUT_BUTTON_UP))
SetButtonFlag(UP_FLAG);
@ -97,8 +100,9 @@ bool InputMappings::CheckButtonsBrowseMode()
SetButtonFlag(DOWN_FLAG);
else if (IEC_Bus::GetInputButtonPressed(INPUT_BUTTON_BACK))
SetButtonFlag(BACK_FLAG);
// edge detection
else
{
// edge detection
insertButtonPressed = !IEC_Bus::GetInputButtonReleased(INPUT_BUTTON_INSERT);
if (insertButtonPressedPrev && !insertButtonPressed)
SetButtonFlag(INSERT_FLAG);
@ -108,10 +112,29 @@ bool InputMappings::CheckButtonsBrowseMode()
if (enterButtonPressedPrev && !enterButtonPressed)
SetButtonFlag(ENTER_FLAG);
enterButtonPressedPrev = enterButtonPressed;
}
return buttonFlags != 0;
}
void InputMappings::WaitForClearButtons()
{
buttonFlags = 0;
do
{
IEC_Bus::ReadBrowseMode();
insertButtonPressed = !IEC_Bus::GetInputButtonReleased(INPUT_BUTTON_INSERT);
insertButtonPressedPrev = insertButtonPressed;
enterButtonPressed = !IEC_Bus::GetInputButtonReleased(INPUT_BUTTON_ENTER);
enterButtonPressedPrev = enterButtonPressed;
usDelay(1);
} while (insertButtonPressedPrev || enterButtonPressedPrev);
}
void InputMappings::CheckButtonsEmulationMode()
{
buttonFlags = 0;

View file

@ -84,6 +84,8 @@ public:
bool CheckButtonsBrowseMode();
void CheckButtonsEmulationMode();
void WaitForClearButtons();
u8 INPUT_BUTTON_ENTER = 0;
u8 INPUT_BUTTON_UP = 1;
u8 INPUT_BUTTON_DOWN = 2;

View file

@ -618,6 +618,7 @@ EmulatingMode BeginEmulating(FileBrowser* fileBrowser, const char* filenameForIc
return EMULATING_1541;
}
}
inputMappings->WaitForClearButtons();
return IEC_COMMANDS;
}
@ -1251,6 +1252,8 @@ void emulator()
if ((exitReason == EXIT_RESET) && (options.GetOnResetChangeToStartingFolder() || selectedViaIECCommands))
fileBrowser->DisplayRoot(); // TO CHECK
inputMappings->WaitForClearButtons();
}
}
delete fileBrowser;