Skip to content

Commit

Permalink
ARC: add DEFAULT setting
Browse files Browse the repository at this point in the history
Fixes #48
  • Loading branch information
gyurco committed Apr 17, 2020
1 parent 470c1ac commit e648509
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
8 changes: 8 additions & 0 deletions arc_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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},
Expand Down Expand Up @@ -66,6 +68,7 @@ void arc_reset()
conf[0] = 0;
conf_ptr = 0;
mod = 0;
conf_default = 0;
}

char *arc_get_rbfname()
Expand All @@ -82,3 +85,8 @@ char *arc_get_conf()
{
return conf;
}

uint32_t arc_get_default()
{
return conf_default;
}
1 change: 1 addition & 0 deletions arc_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
16 changes: 9 additions & 7 deletions user_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <core>.rom present
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e648509

Please sign in to comment.