Replace the [sdl] `autolock = true/false` configuration setting with [sdl]
`capture_mouse = ...` with a two-value setting.
The first value defines how the mouse is controlled:
- onclick: The mouse will be captured with a click inside the window.
- onstart: The mouse is captured immediately on start (similar to real DOS).
- seamless: The mouse will move seamlessly in and out of DOSBox and cannot be captured.
- nomouse: The mouse is disabled and hidden without any input sent to the game.
The second value defines how middle-clicks are handled:
- middlegame: Middle-clicks are sent to the game (not used to uncapture the mouse).
- middlerelease: Middle-click will uncapture the mouse when windowed (not sent to the game).
Middle-clicks are sent to the game when fullscreen or when seamless control is set.
The default setting of "onclick middlegame" reproduces DOSBox's existing behavior.
There are two functions: one for handling EGA and VGA machines, and
"other" handling all remaining cases. This makes it somewhat clear which
cases should be handled where.
M_TANDY16 seems incorrectly handled in 2 places; this patch decides not
preserve existing behaviour (and adds TODOs). Runtime behaviour changed
only for debug builds.
Judging by the usage, this header belongs in there instead of being
limited to dos module only. This change makes it easier to reuse code
for new features related to drives mounting/unmounting.
This massive patch is based on work of NY00123, which was published on
Vogons forum in 2013 and was waiting for inclusion in SVN since then:
https://www.vogons.org/viewtopic.php?f=41&t=34770
Revision from December 2018 was used to kickstart this work. However, a
number of changes were implemented:
- Original patch preserves all SDL 1.2 code by ifdefing it; this patch
completely removes all code ifdefed for several versions of SDL 1.2.*
This way the code will be easier to maintain going forward and
features enabled by SDL 2.0 do not need to be backported.
A side-effect of this change is almost-complete removal of DirectDraw
support - but users can now use Direct3D based acceleration (without
any ifdefs in code).
- Code ifdefed for Android was removed to make the project easier to
understand and modify. Android port should still be possible, but it
requires more work (mostly CI and buildsystem work).
Android-related functionalities that were cross-platform were
preserved.
- Code ifdefed for OpenGL ES (which was only used for Android) was
removed - this should not affect Android support, as
hardware-accelerated 2D should still be viable via "texture" output,
but it was not tested, as buildsystem does not support Android ATM.
- SDL_cdrom code is not included; it was outside of scope of SDL2
changes. Inclusion of that library did not justify supporting one
small usecase (playblack of CD audio from physical CDs).
- Few code warning were fixed (but new sdl_mapper implementation
introduces many, many new warnings).
- Some formatting changes were implemented.
Overall, the original patch had ~40k lines of code - here it was
trimmed to +769,-972 (so more old code got removed than new code added).
This implementation was extensively tested on Linux and somewhat tested
on Windows 10. It fixes numerous issues (too many too list).
Testing found two small regressions:
- Starting game in fullscreen makes it impossible to switch back to
windowed mode correctly (Windows 10)
- Scaling works a bit worse, only in text mode, only in window (Linux)
This implementation introduces revised user settings in sdl section - it
is only partly compatible with settings from SDL 1.2; this is an issue,
but it will need to be addressed in a separete commit.
This way interface of swapInDisks function is cleaner and we avoid a
warning when comparing (previously) signed swap position with an
unsigned array size or index.
Also, add some documentation to swapInDisks function.
After introducing shared_ptr, previous implementation of this function
confused Clang static analyzer into reporting a false-positive "use
after free".
Also, do small cleanup in lines touching diskSwap array.
Also, replacing unique_ptr with shared_ptr makes it unnecessary to move
a pointer when swapping boot disks; moving shared_ptr would lead to
inconsistent internal state.
Fixes: #94
- Move imageDiskList from pointer to vector of unique_ptr
- Replace string operations with size-limited versions
- Initialize members
- Eliminate unecessary casts
- Eliminate memory-leak on pointer assignment
- Fix Bit8u instead of char weirdness for imageDisk (dreamer_)
- Give device_t a virtual empty destructor so some warning program
doesn't go crazy.
- Give the code that moves the Z drive its own function for readability.
- Give sizes arrays default values again for warning program.
- Rewrite IMGMOUNT in order to exit early for clarity and attempt
to group things together.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4267