1
0
Fork 0
Commit graph

4178 commits

Author SHA1 Message Date
NicknineTheEagle
9cb13f6158 Fix a bug with backspace handling in modem
Fixes a bug where entering backspace while command buffer was already
empty added backspace char to the buffer thus screwing it up.
2020-03-23 01:02:37 +01:00
krcroft
99e53a830f Track and free unassigned CStickBindGroup allocations 2020-03-21 23:41:06 +01:00
krcroft
a1a3e0203d Only initialize the mapper once during startup 2020-03-21 23:41:06 +01:00
krcroft
5b8364148a Use prefix form of incrementing iterators 2020-03-20 01:06:23 +01:00
krcroft
c2fcc273da Explicitly ignore some return values 2020-03-20 01:06:23 +01:00
krcroft
269908cad0 Prevent undefined behavior while bit-shifting on 32bit systems 2020-03-20 01:06:23 +01:00
krcroft
b0d90db24a Simplify joystick type assignment logic 2020-03-20 01:06:23 +01:00
krcroft
81efce0862 Refactor and make the joystick querier re-runnable
The previous function could only be effectively run one because
it changes the value of the global 'joytype' to something other
than AUTO, which is what this function looks for to re-query
the joysticks.

Second, if this function is run more than once, then it clobbers
the prior set number of joysticks back to zero (without
re-requerying for the actual quantity), rendering the joysticks
unuseable.

Finally, this function depends on several SDL calls to the joystick
subsystem, but fails to check or initialize it.

The commit:
 - Checks for an initializes the joystick subsystem before using it
 - Always re-queries the current state of the joystick (re-runnable)
 - Simplifies the logic to determine useability (retains criteria)
 - Conservatively writes the joysticks quantities at the end
2020-03-20 01:06:23 +01:00
krcroft
d815c52965 Move member initialization to the definition 2020-03-20 01:06:23 +01:00
krcroft
6c52c06a53 Cleanup leaks 2020-03-20 01:06:23 +01:00
Patryk Obara
2b6e4527be Initialize srcval on all codepaths in xga
Multiple code-paths were using this value uninitialized.
2020-03-19 01:01:23 +01:00
Patryk Obara
ffb9d62ade Change GetMixResult mixmode to uint32_t
There's no reason to use more than 32 bit for this parameter.

Also, limit scope of certain variables as much as possible without
bigger refactorizations.
2020-03-19 01:01:23 +01:00
Patryk Obara
6fe434571c Change DrawWaitSub mixmode to uint32_t
There's no reason to use more than 32 bit for this parameter; source
values are 16 bit, and they occassionally shifted, but always to values
fitting in 32 bit.
2020-03-19 01:01:23 +01:00
Patryk Obara
865ad54a87 Make XGA_DrawWaitSub a static function 2020-03-19 01:01:23 +01:00
Patryk Obara
e25e15ac1d Make XGA_GetMixResult a static function 2020-03-19 01:01:23 +01:00
Patryk Obara
a956f14de1 Inject newlines before displaying DOS prompt
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
2020-03-12 20:54:33 +01:00
Peter Veenstra
11c380aaba 0.74-3:mac os x default output change also in trunk now
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4335
2020-03-11 19:54:24 +00:00
Anton Shepelev
d1be65b105 Add output type texturepp for pixel-perfect scaling
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.
2020-03-09 20:12:36 +01:00
krcroft
83f625178a Ensure the first seek isn't cached 2020-03-08 08:36:21 +01:00
krcroft
bcae097e22 Refresh copyrights and headers 2020-03-07 11:07:48 +01:00
krcroft
37a1610f1c Bump the MP3 fast-seek-table's version identifier
The hashest generated by xxHash have changed between v0.7.2 and v0.7.3,
therefore the hashes in prior-genreated lookup tables will no longer
be valid. By bumping the file's identifier, the fast-seek code will
reject these older files and regenerate new ones.
2020-03-07 01:46:55 +01:00
krcroft
27538eeb2e Update the existing PVS false-positives for xxHash v0.7.3 2020-03-07 01:46:55 +01:00
Yann Collet
355b6faba7 Sync xxHash with upstream (v0.7.3) 2020-03-07 01:46:55 +01:00
Joshua Fern
f2029d71d8 Update copyright dates to 2020 2020-03-07 00:18:01 +01:00
krcroft
16dbd1cec6 Whitespace cleanup 2020-03-06 19:21:44 +01:00
krcroft
08c6fc10c1 Add a signed integer ceiling divide function 2020-03-06 19:21:44 +01:00
krcroft
be643d66b1 Cleanup file size and header length check 2020-03-06 19:21:44 +01:00
krcroft
51284a6d42 Simplify conditional logic 2020-03-06 19:21:44 +01:00
krcroft
0227fae934 Use auto when type is explicitly cast 2020-03-06 19:21:44 +01:00
krcroft
96a9723df5 Drop "[bug]" postfix in assets 2020-03-06 19:21:44 +01:00
krcroft
1e65bb2cdc Curtail an excessively noisy DEBUG output case
Some games repeatedly query for the first track's position during
playback, perhaps as a dual-purpose "CDROM health/heart-beat"
check.

This excessive console output in DEBUG mode tends to add far more
noise than signal, and prevents the maintainer from seeing the
overall flow of the CDROM calls.
2020-03-06 19:21:44 +01:00
krcroft
818e923296 Let the code describe the functionality when reading sectors
Moves to using a member vector to provide a persistent buffer,
instead of repeatedly allocating and deleting memory on every
invocation (during DAE, this can be called hundreds of times
per second, with requsts of up 24 sectors or ~56KB of memory
per call).

The buffer is only resized upward, which avoids 'zig-zag'
re-allocations when switching between raw (2352-byte) and cooked
(2048-byte) sectors.

Only writes as much data was was successfully read into
the DOS program's buffer, avoiding (potential) garbage-fill.
2020-03-06 19:21:44 +01:00
krcroft
c76cc09d97 Add support for mono tracks when performing DAE (digital-audio-extraction)
This commit:
- Adds more sanity checks and comments
- Lets the seek() function to take care of monitoring the track's
  post-seek decode position, instead of managing it in read(..).
- Adds in-place conversion from mono-to-stereo
- Adds micro-second-level DEBUG timing around the mono converter
- Makes use of the more intuitive ceil_divide() support function
  to avoid excessive casting and floating-point conversion.
2020-03-06 19:21:44 +01:00
krcroft
cff1ded8e9 Improve seeking for audio tracks
This commit:
- Comments why we convert from byte-to-time offset.
- Checks for underlying stream validity before seeking.
- Tracks the new as-seeked decode position.
- Skips seeking if it's unecessary.
- Adds DEBUG messaging and a warning if the seek took
  longer than that of an average physical CDROM.
2020-03-06 19:21:44 +01:00
krcroft
e8e9e0ef4f Replace code with existing support function 2020-03-06 19:21:44 +01:00
krcroft
c7eebacde9 Allow the code to describe the return value 2020-03-06 19:21:44 +01:00
krcroft
9bebfdabd3 Make more logic assertions and cleanup multi-line comments 2020-03-06 19:21:44 +01:00
krcroft
1393c1316c Refine types and eliminate implicit-casting and magic-numbers
The commit refines several types to their logical use-cases.
For example, a CDROM will at-most contain 400,000 sectors and be
less than 1B bytes in size. Likewise, both are 'physical'
quantities and this should always be zero-or-greater
(therefore, uint32_t is used).

Fortunately, there are almost no cases where these values are
overloaded to mean something else (ie: negative return codes to
indicate failure).

Besides eliminating many implicit cast warnings, differing-signed
comparison warnings, and overflowable type-cast warnings, the
more correct use of types helps logically bound expectations of the
values they contain, which should improve maintainability.
2020-03-06 19:21:44 +01:00
krcroft
459f7d32f9 Define more CD-DA magic numbers 2020-03-06 19:21:44 +01:00
krcroft
619b21425a Handle and fix small-block reads from decoder interfaces
Context: The codecs implement a read-write callback function
(RWops) used to read N bytes from the underlying binary stream
into a buffer. In some cases, a codec might only return a
subset of the requested bytes and requires subsequent read()
requests to get the remaining bytes. Internally, the codec
might have to reposition or run second decode sequence to get
the bytes.

The RWops callbacks for the various codecs were inconsistently
implemented: some performed the above mentioned subsequent
re-read attempts while others simply accepted whatever we got
after the first read attempt. This commit makes them the same
by attempting to re-read ("get the requested bytes at all
costs") until the underly stream goes EOF.

Some of these RWops functions also contained a book-keeping
bug from upstream that resulted in over-reading after
under-delivering on the first read attempt. The concequence
being that too much data would be written to the buffer
(writing past its end) and leaving the underlying stream's
file position too-far-forward.
2020-03-06 19:21:44 +01:00
krcroft
d2979db2fe Cleanup debug and on-error handling 2020-03-06 19:21:44 +01:00
krcroft
9828f2d912 Perform some minor house-keeping in the mp3 and seek handler
- Cleanup some types where precision is lost.
- Explicitly cast between types (fixes all effc++ warnings)
- Simplify lossy and cast-heavy floating-point coversions with ceil_divide
2020-03-06 19:21:44 +01:00
krcroft
fc9711c932 Use C++ typing in Opus decoding interface
Also add more assert checks.
2020-03-06 19:21:44 +01:00
krcroft
c484ef7e21 Migrate Opus decoding interface to C++ 2020-03-06 19:21:44 +01:00
krcroft
a6251d7e9f Fix iterator-past-end-of-container Coverity warning 2020-03-04 16:03:40 +01:00
krcroft
eef8c51419 Address code-review comments (squash-me) 2020-03-04 05:11:40 +01:00
krcroft
908ddafb5f Reserve the trackFile shared_ptr prior to its test 2020-03-04 05:11:40 +01:00
krcroft
5bbf876f0c Expand trackFile's shared_ptr life 2020-03-04 05:11:40 +01:00
krcroft
1d123367a5 Use MixerObject's singleton-pattern to manage the channel 2020-03-04 05:11:40 +01:00
krcroft
91cd907c4e Migrate some members of the Player class to smart pointers
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.
2020-03-04 05:11:40 +01:00