Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option not to pause after host program execution is completed #5244

Merged
merged 5 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Next
- Added an option not to pause after host program execution is
completed (maron2000)
- Fixed corrupted display when loading language files at launch
(maron2000)
- Fixed Z Drive path expansion to be case insensitive (maron2000)

2024.10.01
Expand Down
24 changes: 21 additions & 3 deletions src/dos/dos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ bool rsize = false;
bool reqwin = false;
bool packerr = false;
bool incall = false;
bool startnopause = false;
int file_access_tries = 0;
int dos_initial_hma_free = 34*1024;
int dos_sda_size = 0x560;
Expand Down Expand Up @@ -842,6 +843,7 @@ void HostAppRun() {
char comline[256], *p=comline;
char winDirCur[512], winDirNew[512], winName[256], dir[CROSS_LEN+15];
char *fullname=appname;
std::string winPath;
uint8_t drive;
if (!DOS_MakeName(fullname, winDirNew, &drive)) return;
bool net = false;
Expand Down Expand Up @@ -891,6 +893,16 @@ void HostAppRun() {
strcpy(winDirNew, useoverlay?odp->getOverlaydir():Drives[drive]->GetBaseDir());
strcat(winDirNew, Drives[drive]->curdir);
}
if(!(isalpha(winDirNew[0]) && winDirNew[1] == ':') && winDirNew[0] != '\\') {
//LOG_MSG("not a absolute path");
winPath = winDirCur + std::string("\\") + std::string(winDirNew);
strcpy(winDirNew, winPath.c_str());
}
if(!(isalpha(winName[0]) && winName[1] == ':') && winName[0] != '\\') {
//LOG_MSG("not a absolute path");
winPath = winDirCur + std::string("\\") + std::string(winName);
strcpy(winName, winPath.c_str());
}
if (SetCurrentDirectory(winDirNew)||net) {
SHELLEXECUTEINFO lpExecInfo;
strcpy(comline, appargs);
Expand All @@ -903,18 +915,22 @@ void HostAppRun() {
DWORD temp = (DWORD)SHGetFileInfo(winName,0,NULL,0,SHGFI_EXETYPE);
if (temp==0) temp = (DWORD)SHGetFileInfo((std::string(winDirNew)+"\\"+std::string(fullname)).c_str(),0,NULL,0,SHGFI_EXETYPE);
if (HIWORD(temp)==0 && LOWORD(temp)==0x4550) { // Console applications
Section_prop* section = static_cast<Section_prop*>(control->GetSection("dos"));
lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
lpExecInfo.fMask=SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS;
lpExecInfo.hwnd = NULL;
lpExecInfo.lpVerb = "open";
lpExecInfo.lpDirectory = NULL;
lpExecInfo.nShow = SW_SHOW;
lpExecInfo.hInstApp = (HINSTANCE) SE_ERR_DDEFAIL;
strcpy(dir, "/C \"");
strcpy(dir, "/C \"\"");
strcat(dir, winName);
strcat(dir, " ");
strcat(dir, "\" ");
strcat(dir, comline);
strcat(dir, " & echo( & echo The command execution is completed. & pause\"");
strcat(dir, " & echo( & echo The command execution is completed.");
startnopause = section->Get_bool("startnopause");
if(startnopause) strcat(dir, " \"");
else strcat(dir, " & pause\"");
lpExecInfo.lpFile = "CMD.EXE";
lpExecInfo.lpParameters = dir;
ShellExecuteEx(&lpExecInfo);
Expand Down Expand Up @@ -959,6 +975,7 @@ void HostAppRun() {
hret = errno;
DOS_SetError((uint16_t)hret);
hret=0;
runRescan(" -A -Q");
return;
} else if (startquiet) {
char msg[]="This program cannot be run in DOS mode.\r\n";
Expand Down Expand Up @@ -4149,6 +4166,7 @@ class DOS:public Module_base{
}
startcmd = section->Get_bool("startcmd");
startincon = section->Get_string("startincon");
startnopause = section->Get_bool("startnopause");
const char *dos_clipboard_device_enable = section->Get_string("dos clipboard device enable");
dos_clipboard_device_access = !strcasecmp(dos_clipboard_device_enable, "disabled")?0:(!strcasecmp(dos_clipboard_device_enable, "read")?2:(!strcasecmp(dos_clipboard_device_enable, "write")?3:(!strcasecmp(dos_clipboard_device_enable, "full")||!strcasecmp(dos_clipboard_device_enable, "true")?4:1)));
dos_clipboard_device_name = section->Get_string("dos clipboard device name");
Expand Down
4 changes: 4 additions & 0 deletions src/dosbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4731,6 +4731,10 @@ void DOSBOX_SetupConfigSections(void) {
Pstring = secprop->Add_string("startincon",Property::Changeable::OnlyAtStart,"assoc attrib chcp copy dir echo for ftype help if set type ver vol xcopy");
Pstring->Set_help("START command will start these commands (separated by space) in a console and wait for a key press before exiting.");

Pbool = secprop->Add_bool("startnopause", Property::Changeable::WhenIdle, false);
Pbool->Set_help("If set, DOSBox-X will not pause after host command execution is completed.");
Pbool->SetBasic(true);

Pbool = secprop->Add_bool("vmware",Property::Changeable::WhenIdle,true);
Pbool->Set_help("Enable VMware interface emulation including guest mouse integration (when used along with e.g. VMware mouse driver for Windows 3.x).");
Pbool->SetBasic(true);
Expand Down
Loading