In the current code, we assess the --disable-opus-cdda argument,
and if it's not present we run pkg-config to get the Opus CFLAGS
and LIBS. If it finds them, it sets the OPUSFILE_CFLAGS and
OPUSFILE_LIBS variables. We finally check for the presense of
one of these before actually enabling Opus.
However, if the user directly sets OPUSFILE_LIBS, then this final
check will become true regardless if the user passed --disable-opus-cdda
to configure.
The obvious fix is to move the final Opus check inside the
prior checks (for example, moving AM_CONDITIONAL(USE_OPUS) inside
AS_IF(..), however that results in the OPUS_USE conditional not
existing if the AS_IF test fails its check.
Therefore, we set a new variable HAVE_OPUS, if the pkg-config
check passes, and look for that instead of OPUSFILE_LIBS.
(Of course, the user could export HAVE_OPUS=yes in their
environment as well, but at that point they're deliberately
circumenting configure, in which case they can have at it!).
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.
Our macOS release builds are limited to Catalina only, and this OS
officially works only on Ivy Bridge (2012) or newer microarchitecture.
Point GCC to target Nehalen (2008) instead - this should cover also all
possible Hackintoshes or virtual machines.
Pass --disable-network to disable modem and ipx features during
configuration step (and avoid linking SDL2_net without actually removing
it from the system).
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.
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.
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.
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.
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.
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.
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.
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.
- 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