mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
run program after [autoexec] by default (#2925)
This commit is contained in:
@@ -21,6 +21,12 @@
|
||||
zhì yì zhī yōugǔ chuánqí) which appear to assume
|
||||
some of these fixed BIOS addresses and will
|
||||
crash if they are wrong.
|
||||
- If a program is provided in the command-line when
|
||||
launching DOSBox-X, it will now be executed after
|
||||
any commands in the [autoexec] section by default.
|
||||
A command-line option "-prerun" is added to force
|
||||
the program run before any commands in [autoexec]
|
||||
section like before. (Wengier)
|
||||
- Improved the menu option "Restart DOSBox-X with
|
||||
language file..." (under "Main") for switching
|
||||
between DBCS languages. (Wengier)
|
||||
|
@@ -52,6 +52,7 @@ public:
|
||||
opt_nogui = false;
|
||||
opt_nomenu = false;
|
||||
opt_langcp = false;
|
||||
opt_prerun = false;
|
||||
opt_showrt = false;
|
||||
opt_silent = false;
|
||||
opt_startui = false;
|
||||
@@ -144,6 +145,7 @@ public:
|
||||
bool opt_silent;
|
||||
bool opt_showrt;
|
||||
bool opt_nomenu;
|
||||
bool opt_prerun;
|
||||
bool opt_langcp;
|
||||
bool opt_debug;
|
||||
bool opt_nogui;
|
||||
|
@@ -9631,7 +9631,7 @@ bool DOSBOX_parse_argv() {
|
||||
else if (optname == "?" || optname == "h" || optname == "help") {
|
||||
DOSBox_ShowConsole();
|
||||
|
||||
fprintf(stderr,"\ndosbox-x [options]\n");
|
||||
fprintf(stderr,"\ndosbox-x [name] [options]\n");
|
||||
fprintf(stderr,"\nDOSBox-X version %s %s, copyright 2011-%s The DOSBox-X Team.\n",VERSION,SDL_STRING,COPYRIGHT_END_YEAR);
|
||||
fprintf(stderr,"DOSBox-X project maintainer: joncampbell123 (The Great Codeholio)\n\n");
|
||||
fprintf(stderr,"Options can be started with either \"-\" or \"/\" (e.g. \"-help\" or \"/help\"):\n\n");
|
||||
@@ -9664,16 +9664,17 @@ bool DOSBOX_parse_argv() {
|
||||
#endif
|
||||
fprintf(stderr," -date-host-forced Force synchronization of date with host\n");
|
||||
#if C_DEBUG
|
||||
fprintf(stderr," -display2 <color> Enable standard & monochrome dual-screen mode with <color>.\n");
|
||||
fprintf(stderr," -display2 <color> Enable standard & monochrome dual-screen mode with <color>\n");
|
||||
#endif
|
||||
fprintf(stderr," -lang <message file> Use specific message file instead of language= setting\n");
|
||||
fprintf(stderr," -nodpiaware Ignore (do not signal) Windows DPI awareness\n");
|
||||
fprintf(stderr," -securemode Enable secure mode (no drive mounting etc)\n");
|
||||
fprintf(stderr," -prerun If [name] is given, run it before AUTOEXEC.BAT config section\n");
|
||||
#if defined(WIN32) && !defined(HX_DOS) || defined(MACOSX) || defined(LINUX)
|
||||
fprintf(stderr," -hostrun Enable START command, CLIP$ device and long filename support\n");
|
||||
#endif
|
||||
#if defined(WIN32) && !defined(HX_DOS)
|
||||
fprintf(stderr," Windows programs can be launched directly to run on the host.\n");
|
||||
fprintf(stderr," Windows programs can be launched directly to run on the host\n");
|
||||
#endif
|
||||
fprintf(stderr," -noconfig Do not execute CONFIG.SYS config section\n");
|
||||
fprintf(stderr," -noautoexec Do not execute AUTOEXEC.BAT config section\n");
|
||||
@@ -9757,6 +9758,9 @@ bool DOSBOX_parse_argv() {
|
||||
else if (optname == "noautoexec") {
|
||||
control->opt_noautoexec = true;
|
||||
}
|
||||
else if (optname == "prerun") {
|
||||
control->opt_prerun = true;
|
||||
}
|
||||
#if defined(WIN32) && !defined(HX_DOS) || defined(MACOSX) || defined(LINUX)
|
||||
else if (optname == "hostrun") {
|
||||
winrun = true;
|
||||
|
@@ -913,12 +913,7 @@ private:
|
||||
AutoexecObject autoexec_echo;
|
||||
AutoexecObject autoexec_auto_bat;
|
||||
public:
|
||||
AUTOEXEC(Section* configuration):Module_base(configuration) {
|
||||
/* Register a virtual AUTOEXEC.BAT file */
|
||||
const Section_line * section=static_cast<Section_line *>(configuration);
|
||||
|
||||
/* Check -securemode switch to disable mount/imgmount/boot after running autoexec.bat */
|
||||
bool secure = control->opt_securemode;
|
||||
void RunAdditional() {
|
||||
force_conversion = true;
|
||||
int cp=dos.loaded_codepage;
|
||||
InitCodePage();
|
||||
@@ -931,7 +926,7 @@ public:
|
||||
for (unsigned int i=0;i<control->auto_bat_additional.size();i++) {
|
||||
if (!strncmp(control->auto_bat_additional[i].c_str(), "@mount c: ", 10)) {
|
||||
cmd += control->auto_bat_additional[i]+"\n";
|
||||
cmd += "@c:\n";
|
||||
cmd += "@c:";
|
||||
} else {
|
||||
std::string batname;
|
||||
//LOG_MSG("auto_bat_additional %s\n", control->auto_bat_additional[i].c_str());
|
||||
@@ -968,13 +963,23 @@ public:
|
||||
#if defined(WIN32) && !defined(HX_DOS)
|
||||
if (!winautorun) cmd += "@config -set startcmd=false\n";
|
||||
#endif
|
||||
cmd += "@mount c: -q -u\n";
|
||||
cmd += "@mount c: -q -u";
|
||||
}
|
||||
if (control->opt_prerun) cmd += "\n";
|
||||
}
|
||||
|
||||
autoexec_auto_bat.Install(cmd);
|
||||
}
|
||||
dos.loaded_codepage = cp;
|
||||
}
|
||||
AUTOEXEC(Section* configuration):Module_base(configuration) {
|
||||
/* Register a virtual AUTOEXEC.BAT file */
|
||||
const Section_line * section=static_cast<Section_line *>(configuration);
|
||||
|
||||
/* Check -securemode switch to disable mount/imgmount/boot after running autoexec.bat */
|
||||
bool secure = control->opt_securemode;
|
||||
|
||||
if (control->opt_prerun) RunAdditional();
|
||||
|
||||
/* add stuff from the configfile unless -noautexec or -securemode is specified. */
|
||||
const char * extra = section->data.c_str();
|
||||
@@ -1010,6 +1015,8 @@ public:
|
||||
/* Check for the -exit switch which causes dosbox to when the command on the commandline has finished */
|
||||
bool addexit = control->opt_exit;
|
||||
|
||||
if (!control->opt_prerun) RunAdditional();
|
||||
|
||||
#if 0/*FIXME: This is ugly. I don't care to follow through on this nonsense for now. When needed, port to new command line switching. */
|
||||
/* Check for first command being a directory or file */
|
||||
char buffer[CROSS_LEN+1];
|
||||
|
Reference in New Issue
Block a user