diff --git a/arc_file.c b/arc_file.c index e4ccca2..cf4deef 100644 --- a/arc_file.c +++ b/arc_file.c @@ -9,6 +9,7 @@ #define MAX_CONF_SIZE 512 static char mod; +static uint32_t conf_default; static char rbfname[9]; static char corename[9]; static char conf[MAX_CONF_SIZE]; @@ -24,6 +25,7 @@ const ini_section_t arc_ini_sections[] = { // arc ini vars const ini_var_t arc_ini_vars[] = { {"MOD", (void*)(&mod), UINT8, 0, 127, 1}, + {"DEFAULT", (void*)(&conf_default), UINT32, 0, 0xffffff, 1}, {"RBF", (void*)rbfname, STRING, 1, 8, 1}, {"NAME", (void*)corename, STRING, 1, 8, 1}, {"CONF", (void*)arc_set_conf, CUSTOM_HANDLER, 0, 0, 1}, @@ -66,6 +68,7 @@ void arc_reset() conf[0] = 0; conf_ptr = 0; mod = 0; + conf_default = 0; } char *arc_get_rbfname() @@ -82,3 +85,8 @@ char *arc_get_conf() { return conf; } + +uint32_t arc_get_default() +{ + return conf_default; +} diff --git a/arc_file.h b/arc_file.h index 227e8ec..615c98e 100644 --- a/arc_file.h +++ b/arc_file.h @@ -12,5 +12,6 @@ void arc_reset(); char *arc_get_rbfname(); char *arc_get_corename(); char *arc_get_conf(); +uint32_t arc_get_default(); #endif // ARC_FILE_H diff --git a/menu.c b/menu.c index 5cf8ac1..5434840 100644 --- a/menu.c +++ b/menu.c @@ -3278,6 +3278,7 @@ void HandleUI(void) OsdCoreNameSet(file.name); char mod = 0; + arc_reset(); if (!strncasecmp(&file.name[8],"ARC",3)) { mod = arc_open(file.name); @@ -3287,8 +3288,6 @@ void HandleUI(void) } strncpy(file.name, " RBF", 11); strncpy(file.name, arc_get_rbfname(), strlen(arc_get_rbfname())); - } else { - arc_reset(); } user_io_set_core_mod(mod); diff --git a/user_io.c b/user_io.c index 5dda93f..253d602 100644 --- a/user_io.c +++ b/user_io.c @@ -307,12 +307,14 @@ void user_io_detect_core_type() { iprintf("Loading config %.11s\n", s); if (FileOpen(&file, s)) { - iprintf("Found config\n"); - if(file.size <= 4) { - ((unsigned long*)sector_buffer)[0] = 0; - FileRead(&file, sector_buffer); - user_io_8bit_set_status(((unsigned long*)sector_buffer)[0], 0xffffffff); - } + iprintf("Found config\n"); + if(file.size <= 4) { + ((unsigned long*)sector_buffer)[0] = 0; + FileRead(&file, sector_buffer); + user_io_8bit_set_status(((unsigned long*)sector_buffer)[0], 0xfffffffe); + } + } else { + user_io_8bit_set_status(arc_get_default(), 0xfffffffe); } // check if there's a .rom present @@ -711,7 +713,7 @@ unsigned long user_io_8bit_set_status(unsigned long new_status, unsigned long ma status |= new_status & mask; spi_uio_cmd8(UIO_SET_STATUS, status); - spi_uio_cmd32(UIO_SET_STATUS2, status); + spi_uio_cmd32(UIO_SET_STATUS2, status); } return status;