1
0
Fork 0
Commit graph

3760 commits

Author SHA1 Message Date
Patryk Obara
19b8902db3 Fix a resource leak
This bug was detected via Coverity static analysis:
Variable tempfile going out of scope leaks the storage it points to.

The leak happens when invalid keyboard layout file is being loaded:

  $ touch xx.kl
  $ dosbox .
  C:\>keyb xx
2019-11-28 21:06:20 +01:00
Patryk Obara
301d7c3423 Merge branch 'svn/trunk' r4296 2019-11-26 18:37:09 +01:00
Peter Veenstra
1521b7ad7d Fix bug #519
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4296
2019-11-26 16:52:04 +00:00
Peter Veenstra
f1608a2509 Fix bug #520
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4295
2019-11-26 15:30:53 +00:00
krcroft
eaeb001b17 Play into subsequent track(s) if playback length exceeds the the current track
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).
2019-11-24 17:34:54 +01:00
Patryk Obara
6c42f3adf8 Fix several unused-private-field warnings 2019-11-24 17:14:32 +01:00
Patryk Obara
ef40533d22 Silence 2 switch warnings 2019-11-24 17:14:32 +01:00
Patryk Obara
618ab5ea08 Remove several unused variables in zmbv 2019-11-24 17:14:32 +01:00
Patryk Obara
bdee95848e Silence a number of switch warnings in zmbv 2019-11-24 17:14:32 +01:00
Patryk Obara
723dfdbe46 Silence static analysis false-positive garbage value
Clang static analyzer returned a false-positive issue in line 671:

The right operand of '<' is a garbage value

Variables needed to be moved up, because otherwise initialization
crosses to the next case.
2019-11-24 17:14:32 +01:00
Patryk Obara
f105697165 Silence a number of switch warnings in vga_xga
In total, 28 warnings are removed by adding these few default cases.
2019-11-24 17:14:32 +01:00
Patryk Obara
64671a888c Avoid passing null to strcat
Static analysis indicated an issue, when line was being passed as 2nd
argument to strcat:

Null pointer passed as an argument to a 'nonnull' parameter

Replace repeated strcat with creating a formatted string and use
the opportunity to do a small format cleanup.
2019-11-24 17:14:32 +01:00
Patryk Obara
b344344821 Properly fix warnings about unused variable
A workaround with no-op assignment fools the compiler and static
analyzer, but the proper fix cleans up this code as well.
2019-11-24 17:14:32 +01:00
Patryk Obara
ef144e4bca Merge branch 'svn/trunk' r4294 2019-11-23 18:41:05 +01:00
Peter Veenstra
f923a8e644 a=a can trigger warnings as well. This should be hopefully do the trick.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4294
2019-11-22 07:28:27 +00:00
Patryk Obara
cdc193170c Merge branch 'svn/trunk' r4293 2019-11-21 20:53:21 +01:00
Peter Veenstra
db51b63554 Remove some old code and do an a=a to trick a compiler in non-debug mode
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4293
2019-11-20 07:17:12 +00:00
Peter Veenstra
8cb2e08f31 Refinements of commit 4291, so that precission can be specified as well and less fixed defines are used
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4292
2019-11-19 16:16:06 +00:00
Peter Veenstra
01fe58047e Try to solve the Bitu formatting warning on all supported platforms (both 32 and 64 bit). Did a few places. Still a lot to go. Changed default display of Bitu to be unsigned instead of signed.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4291
2019-11-18 21:08:57 +00:00
Patryk Obara
ea06a145b6 Fix several printf format warnings 2019-11-16 04:31:19 +01:00
Patryk Obara
8824504474 Silence several sometimes-uninitialized warnings
GCC compiler reports these as:

warning: variable (…) is used uninitialized whenever switch default
is taken
2019-11-16 04:31:19 +01:00
Patryk Obara
97ded39c2e Remove unused variable 2019-11-16 04:31:19 +01:00
Patryk Obara
d63849ea72 Remove unused function 2019-11-16 04:31:19 +01:00
Patryk Obara
41126f8ff9 Fix unused-function warning
This function is used only inside x86 ifdef, so move it to prevent the
warning. Also, use this opportunity to improve readability a bit.
2019-11-16 04:31:19 +01:00
Patryk Obara
ce1deb1516 Silence a number of switch warnings
Avoid "default" case when only 1-2 enumarations are missing.
2019-11-16 04:31:19 +01:00
Patryk Obara
ae6c1e9a89 Fix order of includes in Windows-specific files
These files assume, that WIN32 is defined by compiler or MSVC project
file, when in MSYS2 and MinGW environments, it is defined in config.h
and appears after dosbox.h is included, which in turn is included by
associated header (cdrom.h in this case).

Fixes: #42
2019-11-14 23:17:54 +01:00
Patryk Obara
4e65c8f69f Add asserts to prevent a potential bug
Use C++11 static_assert to assure, that code behaves correctly; if
Chip or Channel structs will be changed to non-std layout or a different
first fields will be introduced, that will invalidate the offset
calculation.

Additionally, add asserts to prevent possibility of introducing a bug
when offset stored in one the tables is 0.
2019-11-12 17:13:01 +01:00
Patryk Obara
1e95311081 Add cases for missing SynthMode enumerations
Silence compiler warnings:
enumeration value 'sm2Percussion' not handled in switch [-Wswitch]
enumeration value 'sm3Percussion' not handled in switch [-Wswitch]
2019-11-12 17:13:01 +01:00
Patryk Obara
43170ff1c2 Merge branch 'svn/trunk' r4284 2019-11-12 16:13:13 +01:00
Peter Veenstra
fab69cb4c7 Stuff written to the console needs a cariage return since 4114. Thanks for spotting this dreamer_.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4284
2019-11-12 13:31:23 +00:00
Peter Veenstra
a5d561a3ad Fix some issues with commit 4282. Thanks dreamer_ and jmarsh.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4283
2019-11-12 12:25:43 +00:00
Patryk Obara
34112dd2da Merge branch 'svn/trunk' r4282 2019-11-12 08:56:37 +01:00
krcroft
93ae382995 Remove conversion sources from the VisualStudio project 2019-11-12 08:17:09 +01:00
krcroft
9892c1722a Remove SpeexDSP from the auto-tools configuraiton 2019-11-12 08:17:09 +01:00
krcroft
d1a6f373cb Refactor CD-DA flow by removing intermediate buffers and loops
Thanks to @ripsaw8080 for insight into CD-DA channel mapping,
@hail-to-the-ryzen for testing and flagging a position-tracking bug,
and @dreamer_ for guidance and code review.

The CD-DA volume and channel mapping loops were moved to generic mixer
calls and no longer require a pre-processing loop:
 - Application-controlled CD-DA volume adjustment is now applied using
   an existing mixer volume scalar that was previously unused by the
   CD-DA code.
 - Mapping of CD-DA left and right channels is now applied at the tail
   end of the mixer's sample ingest sequence.

The following have been removed:
 - The CD-DA callback chunk-wise circular buffer
 - The decode buffers in the Opus and MP3 decoders
 - The decode buffer and conversion buffers in SDL_Sound
These removals and API changes allow the image player's buffer
to be passed-through ultimately to the audio codec, skipping multiple
intermediate buffers.
2019-11-12 08:16:53 +01:00
krcroft
5a9dd2866b
Refactor and pass-through the decode buffer 2019-11-11 13:27:19 -08:00
krcroft
83e1979f26
Eliminate buffers, conversions, and unused code 2019-11-11 13:20:11 -08:00
David Reid
3d8dceee57
Bump dr_mp3 codec to v0.5.2 2019-11-11 13:16:22 -08:00
Peter Veenstra
92da7c45ef Switch to a different way to calculate the table offsets. Thanks jmarsh
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4282
2019-11-11 17:23:05 +00:00
Peter Veenstra
8f3474ecfd Make it possible to compile without CoreMIDI and CoreAudio on Mac OS X using a non-Apple compiler. Give some feedback to user in this case. (modified version of patch by krcroft with input from jmarsh, Dominus and Qbix)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4281
2019-11-10 14:50:11 +00:00
Patryk Obara
fe7600baa9 Merge branch 'svn/trunk' r4280 2019-11-07 15:12:51 +01:00
Peter Veenstra
a2e7d257e5 GenerateDMASound can generate sound even with input size is 0, so lets not do that. Might even be an option to skip this call entirely depending on the sblaster configuration (not sb.dma.autoinit)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4280
2019-11-06 08:59:40 +00:00
krcroft
dfc9b2db31 Add the audio handling changes to build system and documentation 2019-11-06 05:47:03 +01:00
krcroft
edad78b5e0 Adapt and improve audio-handling in the CDROM sources
Runtime improvements:

- Replaces the existing audio callback routine with an efficient chunked
  circular-buffer audio reader
- Replaces assumptions that all audio tracks are 44.1 kHz & stereo.
  The mixer is now fed data at the actual compressed track's rate and
  channel count
- Eliminates all SDL locks in the audio code in favour of mixer state
  control
- Queries the codec for track-length instead of using hundreds of
  iterative decimating seeks to determine track length (loading
  a 99-track CUE now takes 0.1 user-seconds versus 3+ seconds
  previously)
- Seeks are performed within the already-decoded buffer (for all
  codecs) instead of discarding and re-running the decode sequence
- SDL_Sound's buffer-size is now set once and never resized, which
  eliminates repeated re-malloc'ing in the library
- Only one seek is performed per-playback sequence followed by
  sequential decodes, similar to a physical CDROM (The baseline dosbox
  performs a seek for every 2352-bytes of uncompressed audio)
- The DOSBox mixer is now only active during playback sequences and
  fully dormant otherwise (baseline dosbox instead performs hundreds of
  calls/second with empty data)
- When using Opus audio tracks, and if your dosbox.conf [mixer]
  rate=48000, then you will (very likely) achieve sample-exact
  unadulterated pass-through along your entire audio chain from the
  decoder, to DOSBox, to your operating system's software mixer,
  to your sound card driver, to your sound card, to your speakers,
  or to your digital receiver / USB speakers/headphones / or HDMI
  TV/screen.  This is because almost all modern hardware DACs use
  a native sample rate of 48000

Source-level maintenance improvements:

- It strips all pre-processor #ifdef branching for SDL_Sound from
  the code
- Fixes all codec compiler warnings (in the modified files); builds
  have been tested with GCC 4 to 10, Clang 6 to 10, and MSVC 14
- Tested on Linux, macOS (Xcode), and Windows (MinGW MSYS 1.0)
  operating systems
- Tested on i386, x86_64, ARM, and PowerPC (big-endian) architectures
2019-11-06 05:45:42 +01:00
krcroft
fd695b0948 Cleanup comments and NULL-handling in decoders 2019-11-06 05:15:42 +01:00
krcroft
b932a89f87
Adapt the vorbis library to SDL_Sound's needs 2019-11-05 17:21:39 -08:00
Patryk Obara
d68af8b650 Merge branch 'svn/trunk' r4279 2019-11-02 19:30:48 +01:00
Patryk Obara
1f16a164a6 Add DOSBox splash screen graphic in vector format
So far, a splash screen exists only in raster format, encoded with RLE
for easy inclusion in .cpp files (src/gui/dosbox_splash.h).

Vector format is easier to modify and can be used as basis for more
artwork, to provide splash screen in better resolutions, etc.

This vector was obtained by resizing raster image to high resolution,
using a set of Gimp filters to sharpen it, then converted in Inkscape
using Path Bitmap functionality and finally optimized by hand to e.g.
remove excessive path nodes.

To convert it to a format easily usable from C/C++: open the file in
Gimp, edit to fit your requirements and export as C header.
2019-11-02 19:29:03 +01:00
Patryk Obara
4a01b6a00d Prevent potential null pointer dereference
This null-check resolves a potential issue detected by static analysis.

It might be the case, that crash never happens due to the way this
static function is used at the moment, and because DYNFLG_CHANGED is being
cleared in dnew->genreg->Clear() few lines before, but the crash might
still happen if initial state of flags is inconsistent or surrounding
code will be changed even a little bit.

This nullcheck makes the code more robust at no performance penalty.
2019-11-02 19:29:03 +01:00
Patryk Obara
2487242011 Silence compiler warnings introduced in r4277 2019-11-02 19:29:03 +01:00