This allows us to show a warning to the user if the .conf file includes
a property that is no longer supported, or a property that is completely
unknown. Actual handling of the property can still be implemented
(e.g. to use as a fallback for modern replacement), but doesn't need
to be.
Usually, when window is being created without SDL_WINDOW_OPENGL flag,
SDL2 internally re-creates it to support OpenGL during
SDL_CreateRenderer if needed.
This leads to crash in AMD OpenGL drivers (Windows only), which happens
for drivers: "opengl", "opengles", "opengles2".
When the window is created with correct flag from the get-go, the crash
does not happen.
On Linux, the code does not crash either way (at least not when using
Mesa and AMDGPU open source driver), so there's no point in propagating
the hack.
Also, remove a comment that is no longer relevant to the code below.
Usage of this function depends on the state of global sdl struct; and
it's very easy to make a mistake - documentation should lower this risk.
Change the type of output parameter 'pitch' and assure type safety with
internal SDL types via static asserts.
This used to have meaning for Windows 9x support via SDL 1.2; the issue
described in README was never mentioned in the context of SDL2.
Add missing include to video header while we're at it.
In an earlier change, I removed appending newline outside of batch mode
in DOS shell code - that made DOSBox behave less like MS-DOS and more
like modern shells, that do not try to compensate for buggy
applications.
However, we should recognize that DOSBox (unlike e.g. FreeDOS) is designed
to run legacy applications, which might make assumptions about DOS
implementation. Some examples:
- PC Player Benchmark assumes, that help commands are displayed exactly
at 80x25 terminal and formats the output to fill the whole screen
(scrolling past DOS4GW messages).
- Quake and other ID games print shareware information on exit, but do
it via a direct memory dump (not interrupts to print DOS text), and
follow up with setting cursor exactly at line 22 (which is partly
written already), expecting shell to inject newline.
- PCC Compiler prints status message on exit without newline, depending
on MS-DOS shell behaviour.
- TEXTUTIL set of external commands do not print nothing to standard
output, and are designed to clear the screen, therefore writing a
newline after .COM commands would be a mistake.
Therefore we want to inject this newline, but not in every case.
New implementation reuses a static variable used by Program base class
(for purpose of translating UNIX newlines to DOS newlines) for detection
if it's appropriate to inject an additional newline or not.
Injecting the newline happens in function displaying the DOS prompt (so
we don't need to write additonal logic for separately handling batch
mode). When starting a non-COM, non-internal command the static variable
is set to the state indicating that next DOS prompt should inject the
newline.
Fixes: #208
The new output type `texturepp' was added, which implements
pixel-perfect scaling using SDL's hardware-accelerated texture output.
In pixel-pefect mode, each original pixel is displayed as a rectangle m
by n pixels, so that m:n yields a reasonably good approximation of the
pixel aspect ratio (PAR) of the emulated graphical mode while using as
much screen space as possible. The balance between the precision of
aspect ratio and the utilisation of screen space is specified as the
`parweight' parameter to pp_getscale() and is currently hard-coded in
sdlmain.cpp.
This implementation emulatates pixel-perfect mode as a special case of
nearest-neighbor interpolation when the horisontal and vertical scaling
factors are integers.
Many parts of the code (especially audio) deal with discrete integer
(and always-positive) values that need to be scaled up or down by
some divisor. This functions provides a fast and an easy way to
divide and round up, while avoiding the CPU burden and excessive
wordiness associated with casting to and from floating point and
back to integer again.
1. Moves the mutex and mixer channel members to unique pointers
2. Moves the trackFile to a weak pointer
3. Move member initialization to the class definition
This class still retains a raw *cd member, however fixing this
ripples up to the array of [26] CD images, and across more
code that generically deals with mount points; so this work
remains to do.
Function fileno is available in POSIX environment out of the box. On
non-POSIX platforms, it might be missing in some cases when compiling
with -std=c++11, as it's outside of strict ANSI compatibility.
Many DOS games open all their files in write-mode regardless if the
game actually intends to write to them or not.
This can result the files' metadata being updated (lossing the
original date-stamp) as well as putting the file at-risk of
corruption if the game crashes with the file open for writing.
Under the existing DOSBox implementation, if a user attempts to
write-protect their data files then DOSBox will quit with an error in
the above scenario.
This commit allows the use of write-protected files (similar to
running a game from CDROM) and indicates which files are being
actively protected against modification.
Typically the only files that need to be left writable are those that
the game actually changes, such as: save-game files, highscore
files, in-game settings, and so on. If these are also protected,
then the game will quit/crash immediately after the protected message
is printed, and thus indicate which file require write-allowance.
This code made silent assumption that first fields in direntry are
exactly 14 bytes - this was fine, except would break as soon as anyone
would touch the struct (or e.g. if a compiler would lack support for
packed structures and inject some padding in there); rewrite the copy
code to follow the same pattern as other fields - now the code will be
fine even if someone will change fields in the direntry struct.
Fixes 2 PVS static analysis issues (buffer underflow on src and dst).
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'.