From 98a9c975f451235fda2c6d46de6f115e7ba5af40 Mon Sep 17 00:00:00 2001 From: SarahW Date: Sun, 18 Mar 2018 17:27:54 +0000 Subject: [PATCH] Added command line option to specify floppy disc images. --- src/pc.c | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/src/pc.c b/src/pc.c index 67b99a0..12cc456 100644 --- a/src/pc.c +++ b/src/pc.c @@ -64,6 +64,8 @@ int window_w, window_h, window_x, window_y, window_remember; int start_in_fullscreen = 0; +static int override_drive_a = 0, override_drive_b = 0; + int CPUID; int vid_resize, vid_api; @@ -241,6 +243,8 @@ void initpc(int argc, char *argv[]) printf("PCem command line options :\n\n"); printf("--config file.cfg - use given config file as initial configuration\n"); printf("--fullscreen - start in fullscreen mode\n"); + printf("--load_drive_a file.img - load drive A: with the given disc image\n"); + printf("--load_drive_b file.img - load drive B: with the given disc image\n"); exit(-1); } else if (!strcasecmp(argv[c], "--fullscreen")) @@ -266,6 +270,24 @@ void initpc(int argc, char *argv[]) config_override = 1; c++; } + else if (!strcasecmp(argv[c], "--load_drive_a")) + { + if ((c+1) == argc) + break; + + strncpy(discfns[0], argv[c+1], 260); + c++; + override_drive_a = 1; + } + else if (!strcasecmp(argv[c], "--load_drive_b")) + { + if ((c+1) == argc) + break; + + strncpy(discfns[1], argv[c+1], 260); + c++; + override_drive_b = 1; + } } // append_filename(config_file_default, pcempath, "pcem.cfg", 511); @@ -493,6 +515,8 @@ void runpc() char s[200]; int done=0; int cycles_to_run = cpu_get_speed() / 100; + + override_drive_a = override_drive_b = 0; startblit(); @@ -708,13 +732,19 @@ void loadconfig(char *fn) else sound_card_current = 0; - p = (char *)config_get_string(CFG_MACHINE, NULL, "disc_a", ""); - if (p) strcpy(discfns[0], p); - else strcpy(discfns[0], ""); + if (!override_drive_a) + { + p = (char *)config_get_string(CFG_MACHINE, NULL, "disc_a", ""); + if (p) strcpy(discfns[0], p); + else strcpy(discfns[0], ""); + } - p = (char *)config_get_string(CFG_MACHINE, NULL, "disc_b", ""); - if (p) strcpy(discfns[1], p); - else strcpy(discfns[1], ""); + if (!override_drive_b) + { + p = (char *)config_get_string(CFG_MACHINE, NULL, "disc_b", ""); + if (p) strcpy(discfns[1], p); + else strcpy(discfns[1], ""); + } p = (char *)config_get_string(CFG_MACHINE, NULL, "hdd_controller", ""); if (p)