1
0
mirror of https://github.com/mist-devel/mist-firmware.git synced 2026-04-20 09:16:12 +00:00

Fixed OSD handling when switching cores

This commit is contained in:
harbaum
2014-07-21 19:48:37 +00:00
parent a8a0b4e071
commit c00453d2ec
5 changed files with 25 additions and 20 deletions

2
fat.c
View File

@@ -988,8 +988,6 @@ char ScanDirectory(unsigned long mode, char *extension, unsigned char options) {
void ChangeDirectory(unsigned long iStartCluster)
{
iprintf(">>>>>>>>>>>> change to %d\n", iStartCluster);
iPreviousDirectory = iCurrentDirectory;
iCurrentDirectory = iStartCluster;
}

10
main.c
View File

@@ -172,11 +172,6 @@ int main(void)
usb_cdc_open();
// if it's a 8 bit core check if it has a config string
// (and thus has a user interface/osd)
if(user_io_core_type() == CORE_TYPE_8BIT)
tmp = (user_io_8bit_get_string(0) != NULL);
while (1) {
cdc_control_poll();
@@ -201,8 +196,9 @@ int main(void)
HandleUI();
}
// 8 bit cores can also have a ui
if((user_io_core_type() == CORE_TYPE_8BIT) && tmp)
// 8 bit cores can also have a ui if a valid config string can be read from it
if((user_io_core_type() == CORE_TYPE_8BIT) &&
user_io_is_8bit_with_config_string())
HandleUI();
}
return 0;

6
menu.c
View File

@@ -493,7 +493,7 @@ void HandleUI(void)
menusub = 1;
}
if(menusub == 1) { // Save settings
else if(menusub == 1) { // Save settings
user_io_create_config_name(s);
iprintf("Saving config to %s\n", s);
@@ -2391,7 +2391,11 @@ void HandleUI(void)
break;
case MENU_FIRMWARE_CORE_FILE_SELECTED :
OsdDisable();
// close OSD now as the new core may not even have one
fpga_init(file.name);
menustate = MENU_NONE1;
break;

View File

@@ -24,6 +24,7 @@ static long emu_timer;
#define EMU_MOUSE_FREQ 5
static unsigned char core_type = CORE_TYPE_UNKNOWN;
static char core_type_8bit_with_config_string = 0;
static unsigned char adc_state = 0;
AT91PS_ADC a_pADC = AT91C_BASE_ADC;
@@ -111,9 +112,9 @@ char user_io_create_config_name(char *s) {
return 1;
}
extern DIRENTRY DirEntry[MAXDIRENTRIES];
extern unsigned char sort_table[MAXDIRENTRIES];
extern unsigned char nDirEntries;
char user_io_is_8bit_with_config_string() {
return core_type_8bit_with_config_string;
}
void user_io_detect_core_type() {
EnableIO();
@@ -151,18 +152,22 @@ void user_io_detect_core_type() {
case CORE_TYPE_8BIT: {
puts("Identified 8BIT core");
// check if core has a config string
core_type_8bit_with_config_string = (user_io_8bit_get_string(0) != NULL);
// send a reset
user_io_8bit_set_status(UIO_STATUS_RESET, UIO_STATUS_RESET);
// try to load config
user_io_create_config_name(s);
iprintf("Loading config %s\n", s);
if(user_io_create_config_name(s) == 0) {
iprintf("Loading config %s\n", s);
if (FileOpen(&file, s)) {
iprintf("Found config\n");
if(file.size == 1) {
FileRead(&file, sector_buffer);
user_io_8bit_set_status(sector_buffer[0], 0xff);
if (FileOpen(&file, s)) {
iprintf("Found config\n");
if(file.size == 1) {
FileRead(&file, sector_buffer);
user_io_8bit_set_status(sector_buffer[0], 0xff);
}
}
}
@@ -960,3 +965,4 @@ void user_io_kbd(unsigned char m, unsigned char *k) {
pressed[i] = k[i];
}
}

View File

@@ -76,6 +76,7 @@
void user_io_init();
void user_io_detect_core_type();
unsigned char user_io_core_type();
char user_io_is_8bit_with_config_string();
void user_io_poll();
char user_io_menu_button();
char user_io_button_dip_switch1();