1
0
mirror of https://github.com/mist-devel/mist-firmware.git synced 2026-01-13 15:17:43 +00:00

Add DIR= option to ARC files

This commit is contained in:
Gyorgy Szombathelyi 2021-03-29 17:50:21 +02:00
parent 55749a55db
commit adb54beeaa
3 changed files with 17 additions and 3 deletions

View File

@ -12,6 +12,7 @@ static char mod;
static uint64_t conf_default;
static char rbfname[9];
static char corename[9];
static char dirname[9];
static char conf[MAX_CONF_SIZE];
static int conf_ptr;
@ -28,6 +29,7 @@ const ini_var_t arc_ini_vars[] = {
{"DEFAULT", (void*)(&conf_default), UINT64, 0, ~0, 1},
{"RBF", (void*)rbfname, STRING, 1, 8, 1},
{"NAME", (void*)corename, STRING, 1, 8, 1},
{"DIR", (void*)dirname, STRING, 1, 8, 1},
{"CONF", (void*)arc_set_conf, CUSTOM_HANDLER, 0, 0, 1},
};
@ -57,7 +59,7 @@ char arc_open(char *fname)
arc_reset();
mod = -1; // indicate error by default, valid ARC file will overrdide with the correct MOD value
ini_parse(&arc_ini_cfg, 0);
iprintf("arc conf=%s\n",conf);
iprintf("ARC CONF STR: %s\n",conf);
return mod;
}
@ -65,6 +67,7 @@ void arc_reset()
{
memset(rbfname, 0, sizeof(rbfname));
memset(corename, 0, sizeof(rbfname));
memset(dirname, 0, sizeof(dirname));
conf[0] = 0;
conf_ptr = 0;
mod = 0;
@ -81,6 +84,11 @@ char *arc_get_corename()
return corename;
}
char *arc_get_dirname()
{
return dirname;
}
char *arc_get_conf()
{
return conf;

View File

@ -11,6 +11,7 @@ char arc_open(char *fname);
void arc_reset();
char *arc_get_rbfname();
char *arc_get_corename();
char *arc_get_dirname();
char *arc_get_conf();
uint64_t arc_get_default();

View File

@ -2154,10 +2154,15 @@ extern unsigned char iSelectedEntry;
// this should be moved into fat.c?
void user_io_change_into_core_dir(void) {
char s[13]; // 8+3+'\0'
user_io_create_config_name(s);
if (arc_get_dirname()[0]) {
strncpy(s, " ", 11);
strncpy(s, arc_get_dirname(), strlen(arc_get_dirname()));
} else {
user_io_create_config_name(s);
strcpy(s+8, " ");
}
// try to change into subdir named after the core
strcpy(s+8, " ");
iprintf("Trying to open work dir \"%s\"\n", s);
ScanDirectory(SCAN_INIT, "", SCAN_DIR | FIND_DIR);