INI option to wait for specific mount before core start.

This commit is contained in:
Sorgelig
2022-02-17 02:40:59 +08:00
parent c2c2ce2514
commit f1b693c512
4 changed files with 21 additions and 0 deletions

View File

@@ -188,3 +188,9 @@ bt_reset_before_pair=0
;default shadow mask mode:
; 0 - none, 1 - 1x, 2 - 2x, 3 - 1x Rotated, 4 - 2x Rotated
;shmask_mode_default=1
; Wait for specific mount before start the core.
; Attention: waiting is performing BEFORE core start, so no message will be displayed on screen!
; This is debug option. It's useful when core is loaded from USB blaster and games folder is on USB or Network drive.
; This option cannot be used in specific core section as it's parsed before name of core!
;waitmount=/media/usb0

View File

@@ -90,6 +90,7 @@ static const ini_var_t ini_vars[] =
{ "LOG_FILE_ENTRY", (void*)(&(cfg.log_file_entry)), UINT8, 0, 1 },
{ "BT_AUTO_DISCONNECT", (void*)(&(cfg.bt_auto_disconnect)), UINT32, 0, 180 },
{ "BT_RESET_BEFORE_PAIR", (void*)(&(cfg.bt_reset_before_pair)), UINT8, 0, 1 },
{ "WAITMOUNT", (void*)(&(cfg.waitmount)), STRING, 0, sizeof(cfg.waitmount) - 1 },
};
static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t));

1
cfg.h
View File

@@ -62,6 +62,7 @@ typedef struct {
char video_conf_ntsc[1024];
char font[1024];
char shared_folder[1024];
char waitmount[1024];
char custom_aspect_ratio[2][16];
char afilter_default[1023];
char vfilter_default[1023];

View File

@@ -1103,6 +1103,18 @@ void user_io_init(const char *path, const char *xml)
user_io_set_core_name("sharpmz");
}
// parse INI before CONFSTR, no core-specific settings possible at theis time!
cfg_parse();
while (cfg.waitmount[0])
{
printf("> > > wait for %s mount < < <\n", cfg.waitmount);
static char str[256];
snprintf(str, sizeof(str), "exit $(mount | grep \"%s\" | wc -c)", cfg.waitmount);
int ret = system(str);
if (!(ret & 0xFF) && ret) break;
sleep(1);
}
user_io_read_confstr();
user_io_read_core_name();
parse_config();
@@ -1116,6 +1128,7 @@ void user_io_init(const char *path, const char *xml)
printf("Using default MRA: %s\n", xml);
}
// parse INI again with core-specific settings.
cfg_parse();
if (cfg.log_file_entry) MakeFile("/tmp/STARTPATH", core_path);