Bitu (aka uintptr_t) is not necessary for handling shortened files,
as we can represent max 10^7 shortened files anyway; unsigned is good
enough.
This allows use to use simple %u for conversion instead of PRIuPTR,
which caused a bug on AmigaOS on PPC.
Fixes: #162
Class DOS_Drive_Cache is declared in dos_system.h, but this header was
indirectly included. Remove faulty windows.h include (the correct one
exists in cross.h already).
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.
MSVC replaced its own non-standard implementation of stricmp with
ISO-compliant _stricmp, and issues a security warnings when old name is
used.
This tiny redefine solves 129 warnings in Visual Studio 2019.
This way we prevent pointless dynamic_cast; correct usage of
dynamic_cast requires a nullcheck, which was missing in this case
causing Coverity to complain.
Instead of changing cast, let's make this method a virtual one in base
class - this way we could reuse it in future for cases outside of CD-ROM
(e.g. write-protected floppies).
This removes the last warnings in this area; in this case changing endianess
is not used for accessing emulated memory, just to flip few values to
low endian for storage.
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 is old, and disabled by default in new MSVC compilers.
It was purely infomational warning:
"object name was truncated to 'number' characters in the debug
information"
Regardless, even if we'll decide to silence it again for any reason,
then it should be configured in VS project and not using ifdefed
pragma in the code.
Warning C4290 informs users, that MSVC ignores throw specification. This
is very good warning, because 'throw' specifications were faulty design
and got deprecated in C++11 and REMOVED from the language in C++20.
Throw specifications were replaced by much better 'noexcept' keyword,
which allows for compile-time checks, unlike 'throw', which might
silently inject exception 'std::unexpected'.
There's no point in hardcoding these values - they can be different to
every user (it depends on hardware, OS, SDL version, etc).
Also, future versions of SDL might introduce more renderers, so this way
the code is more future-proof.
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.
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
Cleanup before replacing SDL1.2 with SDL2.
OS/2 support was introduced in DOSBox in March 2006. OS/2 reached EOL
in December 2006.
As of 2019, OS/2 is being continued by proprietary 32-bit only ArcaOS,
although there is no official SDL2 support, despite pledges from SDL2
maintainers.
- 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
- Limit write length into buffer, and add comment about corner-case
- Use C++11's syntax to explicitly remove private copy and assignment operators
- Use C++11 container loop syntax to shorting a cleanup function
- Fix Bitu printf format type
- Check a pointer prior to dereferencing it
- Prevent writing one-beyond the last index
- Replace strcpy with with helper safe_strcpy, provided by @dreamer - thank you!
- Replace strcat with strncat
- Add constructor intializers for scalars and arrays
- Initialize and replace 0-value pointers with nullptr
- Pass in the buffer length when strncpy'ing into a function variable
Issue reported by Dagar and Pr3tty F1y, and confirmed as a bug by ripsaw8080.
Thank you!
This fixes the GoG release of Betrayal at Krondor which (either due to CD mastering
issues or a faulty rip), requests playback of a given track at the tail end
of the prior track.
In debugging and performing this fix, many debug messages were improved as well
as making some small small code adjustments, such as using iterators to point to
individual tracks (track->attribute) instead of using the tracks array
(tracks[track -1].attribute).