OSD: display saving message upon autosave.

This commit is contained in:
sorgelig
2021-01-15 17:51:40 +08:00
parent 7c8d3cac61
commit b238b4644f
3 changed files with 30 additions and 2 deletions

View File

@@ -131,6 +131,7 @@ enum MENU
MENU_GENERIC_MAIN2,
MENU_GENERIC_FILE_SELECTED,
MENU_GENERIC_IMAGE_SELECTED,
MENU_GENERIC_SAVE_WAIT,
// Arcade
MENU_ARCADE_DIP1,
@@ -186,6 +187,7 @@ static uint32_t menusub = 0;
static uint32_t menusub_last = 0; //for when we allocate it dynamically and need to know last row
static uint64_t menumask = 0; // Used to determine which rows are selectable...
static uint32_t menu_timer = 0;
static uint32_t menu_save_timer = 0;
extern const char *version;
@@ -1838,11 +1840,26 @@ void HandleUI(void)
} break;
case MENU_GENERIC_SAVE_WAIT:
menumask = 0;
parentstate = menustate;
if (menu_save_timer && CheckTimer(menu_save_timer))
{
menu_save_timer = 0;
menustate = MENU_GENERIC_MAIN1;
}
break;
case MENU_GENERIC_MAIN2:
saved_menustate = MENU_GENERIC_MAIN1;
// menu key closes menu
if (menu)
if (menu_save_timer && !CheckTimer(menu_save_timer))
{
for (int i = 0; i < 16; i++) OsdWrite(m++);
OsdWrite(8, " Saving...");
menustate = MENU_GENERIC_SAVE_WAIT;
}
else if (menu)
{
menustate = MENU_NONE1;
}
@@ -6347,3 +6364,8 @@ int menu_allow_cfg_switch()
return 0;
}
void menu_process_save()
{
menu_save_timer = GetTimer(1000);
}

1
menu.h
View File

@@ -5,6 +5,7 @@
void HandleUI(void);
void menu_key_set(unsigned int c);
void menu_process_save();
void PrintDirectory(int expand = 0);
void ScrollLongName(void);

View File

@@ -42,6 +42,8 @@ static char rbf_path[1024] = {};
static fileTYPE sd_image[4] = {};
static uint64_t buffer_lba[4] = { ULLONG_MAX,ULLONG_MAX,ULLONG_MAX,ULLONG_MAX };
static int use_save = 0;
// mouse and keyboard emulation state
static int emu_mode = EMU_NONE;
@@ -1466,6 +1468,7 @@ int user_io_file_mount(const char *name, unsigned char index, char pre)
}
buffer_lba[index] = -1;
if (!index) use_save = pre;
if (!ret)
{
@@ -2617,6 +2620,8 @@ void user_io_poll()
{
//printf("SD WR %d on %d\n", lba, disk);
if (use_save) menu_process_save();
buffer_lba[disk] = -1;
// Fetch sector data from FPGA ...