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

Auto-exit when using instant-launch #1269

Merged
merged 28 commits into from
Sep 18, 2021
Merged

Auto-exit when using instant-launch #1269

merged 28 commits into from
Sep 18, 2021

Conversation

kcgen
Copy link
Member

@kcgen kcgen commented Sep 17, 2021

If startup_verbosity is auto (or low or quiet) and an executable's passed on the command-line, then automatically "exit" when that program finishes up. This is equivalent to manually adding the -exit command-line flag.

This PR also updates the README to reflect this logic.

This PR also adds a 1.5 second "exit cool down period" as some protection against scenarios where an executable immediately fails and dosbox quits back to the host. In these cases, the the user sees a brief flash - and then everything is gone, which is a bad user experience leaving them with nothing to help them diagnose the issue.

This cool down should catch most of those scenarios. Of course, using a higher verbosity (medium or high) will fully prevent auto-exit, likewise simply launch dosbox without instant-launch will also avoid the auto-exit.

@kcgen kcgen changed the title Add auto-exit Auto-exit when using Instant-Launch Sep 17, 2021
@kcgen kcgen changed the title Auto-exit when using Instant-Launch Auto-exit when using instant-launch Sep 17, 2021
@kcgen kcgen self-assigned this Sep 17, 2021
@kcgen kcgen added the enhancement New feature or enhancement of existing features label Sep 17, 2021
Fixes a newly-flagged Codacity security warning:

Does not handle strings that are not \0-terminated; if given one it may
perform an over-read (it could cause a crash if unprotected) (CWE-126).
@kcgen kcgen merged commit 1f9c17d into master Sep 18, 2021
@kcgen
Copy link
Member Author

kcgen commented Sep 18, 2021

Thank you @Burrito78 for this excellent suggestion!

@kcgen kcgen deleted the kc/2109-auto-exit-1 branch September 18, 2021 19:35
@Burrito78
Copy link
Collaborator

Copying from Discord so it doesn't get buried:

Hi @kcgen! This PR works as expected, very nice! But i found one side-effect: The "cool down" timer is always active, not only when using "instant launch". So when i start Staging and directly enter exit then the above line "Preventing an early exit call..." is also triggered and i have to exit a second time. Is this expected and wanted behavior?

One other possible terrible idea: Maybe skip the whole autoexec section while running using instant launch to prevent mount conflicts in the first place and refer people to better use game specific config files (if needed at all) when using instant launch?

@kcgen
Copy link
Member Author

kcgen commented Sep 20, 2021

The "cool down" timer is always active, not only when using "instant launch". So when i start Staging and directly enter exit then the above line "Preventing an early exit call..." is also triggered and i have to exit a second time. Is this expected and wanted behavior?

Anytime dosbox 'instant-exits' is typically a bad thing, so I had settled on it being a general feature ... but it's indeed a changes from baseline behavior. Perhaps there are scripts or wrappers that won't deal well with this.

I'll adjust it to only take place when instant-launching. Thanks for the help here @Burrito78 !

@kcgen kcgen added this to the 0.78 release milestone Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants