Merge pull request #53 from penfold42/alt-a
Alt-a to re load AutoMountImage
This commit is contained in:
commit
5491711446
6 changed files with 55 additions and 12 deletions
|
@ -41,6 +41,7 @@ extern Options options;
|
|||
#define PNG_HEIGHT 200
|
||||
|
||||
extern void GlobalSetDeviceID(u8 id);
|
||||
extern void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser);
|
||||
|
||||
unsigned char FileBrowser::LSTBuffer[FileBrowser::LSTBuffer_size];
|
||||
|
||||
|
@ -1007,6 +1008,10 @@ void FileBrowser::UpdateInputFolders()
|
|||
if (inputMappings->BrowseBack())
|
||||
PopFolder();
|
||||
}
|
||||
if (inputMappings->BrowseAutoLoad())
|
||||
{
|
||||
CheckAutoMountImage(EXIT_RESET, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1321,8 +1326,11 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
|
|||
}
|
||||
}
|
||||
|
||||
void FileBrowser::AutoSelectImage(const char* image)
|
||||
void FileBrowser::SelectAutoMountImage(const char* image)
|
||||
{
|
||||
f_chdir("/1541");
|
||||
RefreshFolderEntries();
|
||||
|
||||
FileBrowser::BrowsableList::Entry* current = 0;
|
||||
int index;
|
||||
int maxEntries = folder.entries.size();
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool displayPNGIcons, ScreenBase* screenMain, ScreenBase* screenLCD, float scrollHighlightRate);
|
||||
|
||||
void AutoSelectImage(const char* image);
|
||||
void SelectAutoMountImage(const char* image);
|
||||
void DisplayRoot();
|
||||
void Update();
|
||||
|
||||
|
|
|
@ -187,6 +187,10 @@ bool InputMappings::CheckKeyboardBrowseMode()
|
|||
// SetKeyboardFlag(PAGEDOWN_LCD_FLAG);
|
||||
else if (keyboard->KeyHeld(KEY_N) && keyboard->KeyEitherAlt() )
|
||||
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;
|
||||
|
@ -214,6 +218,10 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
|
|||
SetKeyboardFlag(PREV_FLAG);
|
||||
else if (keyboard->KeyHeld(KEY_PAGEDOWN))
|
||||
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;
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#define PAGEUP_LCD_FLAG (1 << 13)
|
||||
|
||||
#define NEWD64_FLAG (1 << 14)
|
||||
#define AUTOLOAD_FLAG (1 << 15)
|
||||
#define FAKERESET_FLAG (1 << 16)
|
||||
// dont exceed 32!!
|
||||
|
||||
class InputMappings : public Singleton<InputMappings>
|
||||
|
@ -98,6 +100,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);
|
||||
|
@ -151,6 +163,16 @@ public:
|
|||
return KeyboardFlag(NEWD64_FLAG);
|
||||
}
|
||||
|
||||
inline bool BrowseAutoLoad()
|
||||
{
|
||||
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;
|
||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -102,12 +102,6 @@ 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
|
||||
|
@ -654,7 +648,7 @@ void GlobalSetDeviceID(u8 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();
|
||||
if (autoMountImageName[0] != 0)
|
||||
|
@ -662,8 +656,9 @@ static void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowse
|
|||
switch (reset_reason)
|
||||
{
|
||||
case EXIT_UNKNOWN:
|
||||
case EXIT_AUTOLOAD:
|
||||
case EXIT_RESET:
|
||||
fileBrowser->AutoSelectImage(autoMountImageName);
|
||||
fileBrowser->SelectAutoMountImage(autoMountImageName);
|
||||
break;
|
||||
case EXIT_CD:
|
||||
case EXIT_KEYBOARD:
|
||||
|
@ -945,6 +940,7 @@ void emulator()
|
|||
bool exitEmulation = inputMappings->Exit();
|
||||
bool nextDisk = inputMappings->NextDisk();
|
||||
bool prevDisk = inputMappings->PrevDisk();
|
||||
bool exitDoAutoLoad = inputMappings->AutoLoad();
|
||||
|
||||
if (nextDisk)
|
||||
{
|
||||
|
@ -977,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
|
||||
|
@ -1001,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.
|
||||
|
|
|
@ -16,4 +16,12 @@ typedef enum {
|
|||
LCD_1106_128x64,
|
||||
} LCD_MODEL;
|
||||
|
||||
typedef enum {
|
||||
EXIT_UNKNOWN,
|
||||
EXIT_RESET,
|
||||
EXIT_CD,
|
||||
EXIT_KEYBOARD,
|
||||
EXIT_AUTOLOAD
|
||||
} EXIT_TYPE;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue