1
0
Fork 0
Commit graph

4178 commits

Author SHA1 Message Date
Patryk Obara
a06035a35e Replace SDL 1.2 with SDL 2.0
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.
2019-12-26 03:23:19 +01:00
Patryk Obara
3eaabb41c1 Fix output formatting of 'dir' command
Adapt to 'pause' command working correctly (assuming the terminal height
is 25, this will need further adjustments for supporting 80x50 and
different modes).

Adjust "intro" by 1 space to make formatting the same as MS-DOS 'dir'
command - this makes intro not "merge" visually with the files listed.

Adjust placing of files and directories counters, to make it resemble
most 'dir' implementations.

Count intro lines for purpose of correct pagination with 'dir /p'.

Skip counting not printed lines with 'dir /b /p'.

Output of 'dir /w /p' is still broken, but fixing it will require more
invasive changes.

Fixes: #75
2019-12-23 21:52:37 +01:00
Patryk Obara
e68a64aade Adjust 'help /all' to fixed 'pause' 2019-12-23 21:52:37 +01:00
Patryk Obara
b0cdfa5161 Do not print newline after every command
This newline is already ommitted from batch files and noecho commands,
this change makes the behaviour consistent in interactive mode.

Additional newline is a behaviour inherited from MS-DOS, and even still
visible in Windows cmd.exe, but all modern DOS implementations,
PowerShell, unix terminals, etc - they all prefer consistent behaviour
over addtional newline. Also, there's no point in wasting 4% of screen
estate just to show empty line.

This fixes CLS command, which is now able to properly clean the screen
and place prompt in the first line.
2019-12-23 21:52:37 +01:00
Patryk Obara
c20579a835 Display newline after key was pressed in 'pause' cmd
Move newline from the string message to the WriteOut in command itself.
This makes the PAUSE command behave like the original, which is
important for commands like DIR /P.
2019-12-23 21:52:37 +01:00
Patryk Obara
c81269eebe Remove extern global variable from bios_disk.h
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.
2019-12-18 23:56:28 +01:00
Patryk Obara
8f81eb199a Simplify 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.
2019-12-18 23:56:28 +01:00
Patryk Obara
5f282f6015 Use shared_ptr to prevent double free on imageDisk
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
2019-12-18 23:56:28 +01:00
Patryk Obara
70a1f9f0d1 Remove PHYSICAL_CD from MountType enum 2019-12-18 22:31:19 +01:00
Patryk Obara
94b987b5b5 Update MSF conversion functions
All usecases, that required these functions to pass 3 values separately
are now gone, we can simply pass/return a struct now.
2019-12-18 22:31:19 +01:00
Patryk Obara
f66a4f5416 Fix a number of effc++ warnings 2019-12-18 22:31:19 +01:00
Patryk Obara
8b86910c33 Add user-visible warnings about removed options 2019-12-18 22:31:19 +01:00
Patryk Obara
d035c2cbd9 Move GetMountType to dos_mscdex file
This was the only user of this function.
2019-12-18 22:31:19 +01:00
Patryk Obara
3e6e97bf47 Create dos_mscdex header 2019-12-18 22:31:19 +01:00
Patryk Obara
28dd59e03e Introduce MountType enum for CDROM_GetMountType 2019-12-18 22:31:19 +01:00
Patryk Obara
f82a0a46da Remove dead code for force selecting CD drive 2019-12-18 22:31:19 +01:00
Patryk Obara
ac4411389b Remove CDROM_USE_SDL enum value 2019-12-18 22:31:19 +01:00
Patryk Obara
3e3c2c02b4 Update INTRO CDROM text 2019-12-18 22:31:19 +01:00
Patryk Obara
e1286efca9 Remove SDL_cdrom 1.2 based CD-ROM interfaces
This removes a feature of mounting physical CD-ROMs in DOSBox.

SDL 2.0 removed SDL_cdrom from supported libraries, so to bring this
code back, either the functionality will need to be reimplemented or
SDL_cdrom code modernized for SDL 2.0, and bundled with the repo (the
same way SDL_sound is already bundled).
2019-12-18 22:31:19 +01:00
Patryk Obara
5cc7e300e5 Remove inaccurate information from INTRO 2019-12-14 03:35:27 +01:00
Patryk Obara
b8fdf961ae Display a warning when user requests -ioctl 2019-12-14 03:35:27 +01:00
Patryk Obara
ddda555854 Remove MCI, DX, and DIO CD-ROM interfaces
Also, remove all traces of these interfaces from user manual (README
file) and man page (docs/dosbox.1).

MCI (Media Control Interface) was a primary Windows interface. Code
comments and documentation claimed, that it's only for "NT, 2000, XP"
but the code was enabled for Windows 2000 or later (version > 4.0).

DX (Digital audio eXtraction (?)) could be forced on any Windows with
autodetection working only on Vista and Windows 7 (code was disabled for
Windows 8 or later - probably unintentionally).

DIO used DeviceIoControl interface and Windows-specific ioctl calls.

All 3 interfaces depend on SDL and SDL_cdrom functionality to work.
SDL_cdrom 1.2 implementation uses MCI on Windows to provide the same
functionality.
2019-12-14 03:35:27 +01:00
Patryk Obara
61511a4bdf Merge branch 'svn/trunk' r4301 2019-12-10 15:27:14 +01:00
Peter Veenstra
77a46559a6 Additional refinements and speed ups. Thanks jmarsh!
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4301
2019-12-10 14:07:20 +00:00
Peter Veenstra
d37d74791e Simplify and correct flags handling so that childpsp works correctly and some misc fixes.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4299
2019-12-10 13:29:10 +00:00
Patryk Obara
fc321a7fa2 Merge branch 'svn/trunk' r4298 2019-12-10 12:42:57 +01:00
Patryk Obara
07fc74cff4 Silence 12 switch warnings
Author's intention was sufficiently explained in the comment
in this case.
2019-12-10 12:40:07 +01:00
Patryk Obara
6dde4e78bf Fix usage of uninitialized value in dos_mscdex
These issues were detected by Clang static analyzer.

Calling GetCurrentPos might leave pos uninitialized, and it will result
in passing uninitialized value pos.min to msf_to_frames function.

Same situation might happen for GetAudioStatus and all variables it
misses to initialize.
2019-12-10 12:40:07 +01:00
Patryk Obara
496611b2ce Fix out-of-bounds access error
Also, fix formatting in adjacent lines.

Coverity error CID 277445 says:

Out-of-bounds access (ARRAY_VS_SINGLETON).
Passing &ch to function upcase which uses it as an array. This might
corrupt or misinterpret adjacent memory locations.
2019-12-10 12:40:07 +01:00
Peter Veenstra
e7df2b9b19 Set cursor speed to the vga standard of 32 frames for a full period. Hope that this is correct for the other machines as well. Fix that frameskip would slow down the cursor blinking speed.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4298
2019-12-10 08:25:18 +00:00
Patryk Obara
fe519d0344 Merge branch 'svn/trunk' r4297 2019-12-10 00:07:41 +01:00
Patryk Obara
0049ba1bc5 Remove files used only by ASPI support 2019-12-09 21:36:27 +01:00
Patryk Obara
e43f83a68a Remove ASPI CD-ROM interface
ASPI was supported by Microsoft only for Windows 95, 98 and, ME.
Adaptec supported this interface going forward for Windows NT, 2000,
and XP (32-bit only).
2019-12-09 21:36:27 +01:00
Patryk Obara
d82766930f Reformat the enum with CD-ROM interfaces 2019-12-09 21:36:27 +01:00
ripsaw8080
0987fb6f0c Correct an oversight in INT10_GetDACPage; fixes blank screen in Blue Force on vgaonly machine type.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4297
2019-12-09 18:03:55 +00:00
Patryk Obara
5f9ac5eeab Remove code ifdefed for OS/2
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.
2019-12-09 16:27:11 +01:00
krcroft
ef2686ac02 Switch from std::vector to std::array 2019-12-09 09:11:16 +01:00
krcroft
78cc6be86d Make use of template variable, and reformat whitespace 2019-12-09 08:19:26 +01:00
krcroft
c34670aba0 Replace strncat with safe_strcat where possible 2019-12-09 08:19:26 +01:00
krcroft
c9198b2944 Fix unsafe memory operations and warnings in the fatDrive class
- 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
2019-12-09 08:19:26 +01:00
Patryk Obara
f89416a20a Update version in config.h and resource script 2019-12-09 07:22:15 +01:00
krcroft
8c6758c8d1 Memory overrun and C++11 updates
- 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
2019-12-07 19:08:47 +01:00
krcroft
cff6b05559 Improve memory safety in the DOS Drive Cache class
- 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
2019-12-07 19:08:47 +01:00
Patryk Obara
9576db91c1 Use fixed name for a GitHub-generated zip 2019-12-05 23:35:15 +01:00
Patryk Obara
57d61085e2 Replace version with brand for .conf file suffix 2019-12-05 23:35:15 +01:00
krcroft
8f2a153dc2 STB Vorbis: eliminate inaccessible branch
The eliminated code removes the (ch == 1) branch, which is scoped
within this if condition: `if (rtype == 2 && ch != 1)`, therefore
the (ch == 1) branch will never be taken.
2019-12-05 10:35:44 +01:00
krcroft
a7a899fdb0 STB Vorbis: prevent division by zero in decode_resign if ch == 0
In the call to decode_residue:
  decode_residue(f, residue_buffers, ch, n2, r, do_not_decode);

The channel count is previously intialized as zero and incremented
based on a for-loop (f->channels) plus a conditional,
if (map->chan[j].mux == i).  If this doesn't happen then 'ch'
remains zero.

Once inside decode_residue(..), the code has three branches based
on channel count: stereo (ch == 2), mono (ch == 1), and then the
exception if it's neither of those (simple 'else').  It's in here
where a zero-valued 'ch' can be used as the denominator in these
calculations:
    int c_inter = z % ch
    p_inter = z/ch;

Obviously this 'else' branch is meant for channel counts greater
than two an not for zero channels; so this change simply makes
that branch only valid if (ch > 2).
2019-12-05 10:35:44 +01:00
krcroft
bedcc244d9 STB Vorbis: Check before derefercing a potential NULL pointer 2019-12-05 10:35:44 +01:00
Patryk Obara
4add527371 Fix wrong function name in the exception log
Bug report: https://sourceforge.net/p/dosbox/bugs/518/
2019-12-04 06:11:01 +01:00
David Reid
84588c50bd Bump dr_wav to v0.11.2
Fixes:
- https://github.com/mackron/dr_libs/issues/84
- https://github.com/mackron/dr_libs/issues/83
- https://github.com/mackron/dr_libs/issues/82
- https://github.com/mackron/dr_libs/issues/81
- https://github.com/mackron/dr_libs/issues/80
- https://github.com/mackron/dr_libs/issues/79
- https://github.com/mackron/dr_libs/issues/78
- https://github.com/mackron/dr_libs/issues/77
- https://github.com/mackron/dr_libs/issues/76
- https://github.com/mackron/dr_libs/issues/75
2019-12-03 06:35:00 +01:00