Commit Graph

2961 Commits

Author SHA1 Message Date
Willem Jan Palenstijn
dde259f068 COMMON: Remove BitStream base class to allow inlining calls
All users of BitStream were in fact using a specific, hardcoded variant,
so we can hardcode that variant, removing the need for virtual calls,
and enabling inlining.
2017-08-24 19:46:59 +02:00
Colin Snover
1d844978d6 COMMON: Implement SeekableReadStream interface for MemoryReadWriteStream
This allows MemoryReadWriteStream to be passed successfully to
functions that use the SeekableReadStream type so that they can
call the `pos` method, like the DPCMStream class of the VMD
decoder.
2017-08-20 11:36:14 -05:00
Paul Gilbert
4a945162c5 COMMON: Added freeing notes to zlib wrapper methods 2017-08-12 20:17:56 -04:00
Paul Gilbert
9a0f1adcb7 COMMON: Add a setVersion method to Common::Serializer 2017-08-07 19:07:25 -04:00
D G Turner
d2a7c296a2 COMMON: Migrate Various Endian Functions to Common from Engine Code.
Thanks to N.E.C <beholdnec@gmail.com> for this.
2017-07-30 22:03:29 +02:00
Thierry Crozat
013b09fa28 COMMON: Only clear events from the EventSources in clearEvents() 2017-07-27 21:05:43 +01:00
Thierry Crozat
b8142ff362 COMMON: Add method in EventManager to clear the event queue 2017-07-26 21:39:31 +01:00
yinsimei
8f2a177cef STREAM: add read/write functions for float LE/BE 2017-07-13 18:27:45 +02:00
Eugene Sandulenko
940b2a20f1 Revert "COMMON: Change way the Singleton instances are instantiated"
This reverts commit eefa72afa1.

With this patch ConfigManager is broken.
2017-07-10 21:17:41 +02:00
Thierry Crozat
eefa72afa1 COMMON: Change way the Singleton instances are instantiated
This fixes tons of warnings with clang from a recent xcode version on
macOS (and possibly other systems) complaining that an instantiation
of _singleton is required but no definition is available.
2017-07-10 21:11:20 +02:00
Colin Snover
798c6bf34d COMMON: Add yet another GUIO option flag
SCI engine has very many game options.
2017-07-06 19:12:36 -05:00
Colin Snover
d7e5e5f995 COMMON: Take immutable reference in SpanOwner copy assignment
Thanks again to @waltervn.
2017-06-08 20:04:37 -05:00
Colin Snover
58c83dcd14 COMMON: Make SpanOwner copy assignment make a copy of the owned Span
To move data from one SpanOwner to another, use `moveFrom`.
Thanks @waltervn for pointing out the problem.
2017-06-08 10:45:55 -05:00
Colin Snover
993d83fe4b COMMON: Reduce maximum Span size to 4GiB
Until C++11 (which introduces the z and t length modifiers), there
is no consistent way to print size_t and ptrdiff_t types using
printf formatting across 32-bit, LLP64, and LP64 architectures
without using a cumbersome macro to select the appropriate length
modifier for the target architecture. Since ScummVM engines
currently need to support 32-bit targets, there is no reason at
the moment to support any larger memory sizes in Span anyway.

Span error output is also updated in this commit to reflect that
index values are unsigned.
2017-03-30 14:22:56 -05:00
Paul Gilbert
4564b84d91 COMMON: Compilation fix for Visual Studio 2015
The SpanImpl template was generating a bunch of C2248 errors that
protected fields of the SpanBase template could not be accessed
2017-03-28 18:50:58 -04:00
Peter Kohaut
652c29914b BUILD: Fixed mingw-w64 32 bits build 2017-03-10 00:07:09 +01:00
Peter Kohaut
d34314ccc9 BUILD: Fixed macro redefinition warning for 64 bits builds 2017-03-09 23:48:57 +01:00
Eugene Sandulenko
8b8fd13d56 BACKENDS: Fix const'ness which led to warnings 2017-03-05 00:56:27 +01:00
cpasjuste
70988527c6 PSP2: Add Playstation Vita (PSP2) support 2017-03-04 15:42:19 -06:00
rsn8887
45bd7a8b75 SDL: Fix erratic analog pointer + control options
Fixes erratic speeds in analog pointer motion
Implemented option to set analog/keyboard pointer speed
and control the analog joystick deadzone. The deadzone option appears
only if the build supports analog joystick (via JOY_ANALOG define)
2017-02-22 16:52:09 -06:00
Eugene Sandulenko
8458e3deb7 Merge pull request #905 from lubomyr/master
ANDROIDSDL: added tab Control in main Options menu for switching some features
2017-02-21 23:29:51 +01:00
lubomyr
2412502eee ANDROIDSDL: implemented checkbox for swap menu and back buttons 2017-02-14 17:38:44 +02:00
lubomyr
216f9c4f11 ANDROIDSDL: backend related checking in options.cpp replaced with hasFeature... condition, renamed some fields and methods 2017-02-14 15:13:58 +02:00
Eugene Sandulenko
3d5d279bed Merge pull request #895 from csnover/gui-volume-options
GUI: Add three new options for volume slider controls
2017-02-11 08:56:16 +01:00
Colin Snover
f1d9955540 COMMON: Fix calling Span::getStringAt with non-zero index 2017-02-08 12:05:14 -06:00
Thierry Crozat
5484f36f38 BUILD: Define SCUMM_64BITS on 64 bits platforms when not using configure
This for example fixes the compilation of the fullpipe engine on 64 bits
platforms when using create_project.
2017-02-06 21:49:38 +00:00
Colin Snover
d1fe6476fe GUI: Add three new options for volume slider controls
GUIO_NOSPEECHVOLUME can be used for games that allow toggling of
speech but do not provide the ability for users to control speech
volume.

GUIO_LINKMUSICTOSFX and GUI_LINKSPEECHTOSFX can be used for games
that allow control of music, sfx, and speech in combinations, like
games that provide control of digital audio separately from MIDI,
or games that only control all three audio types through a single
volume control.
2017-02-05 10:41:28 -06:00
lubomyr
9cdda5c045 ANDROIDSDL: implemented checkbox for show/hide on-screen control in Options menu 2017-01-31 22:44:50 +02:00
lubomyr
15acee29f1 ANDROIDSDL: implemented checkbox for change mouse mode in Options menu 2017-01-30 22:35:40 +02:00
Eugene Sandulenko
4ede54e6b0 GRAPHICS: Rename MacFont to MacFONTFont to avoid clashed 2017-01-17 20:30:32 +01:00
D G Turner
906f850a9c COMMON: Fix Variable Used Uninitialized Compiler Warning. 2017-01-15 11:46:42 +00:00
Colin Snover
135ac922aa COMMON: Define STATIC_ASSERT for all ports
Ports with -DNONSTANDARD_PORT need this too.
2017-01-14 10:17:58 -06:00
Eugene Sandulenko
0b95b734b8 COMMON: Add ReadStream::readPascalString() 2017-01-14 12:45:58 +01:00
Eugene Sandulenko
8096ccb745 Merge pull request #881 from csnover/span-h
COMMON: Add Span to common library
2017-01-13 22:20:26 +01:00
D G Turner
7db886e02f VKEYBD: Remove Unused Variable. 2017-01-12 09:59:27 +00:00
D G Turner
70d3726034 COMMON: Replace sprintf() with safer String::format() in JSON module. 2017-01-12 04:50:45 +00:00
Eugene Sandulenko
eab2e06169 COMMON: Enhanced debug channel checks.
Now it is possible to enforce checking by specifying level -1,
that is, debug level 11 will not turn it on.
2017-01-09 09:22:35 +01:00
Colin Snover
3c02008262 COMMON: Fix GCC 4 shadow warnings in Span 2017-01-08 15:17:22 -06:00
Colin Snover
3cfc396ecd COMMON: Simplify Span code
Implicitly generated constructors can be used instead of explicit
constructors, which reduces the amount of necessary boilerplate.

Long lists of identical typedefs to the superclass are now defined
using a macro.

data() const now returns a pointer to data that matches the
value_type of the data, instead of forcing the data to be const.
This better matches the intent of the Span class, which provides
a view into data, rather than being a container that holds data.
2017-01-08 14:08:16 -06:00
Colin Snover
b2796e65aa COMMON: Restrict use of data access helpers
The data access helpers as written are effectively little-endian
when reading from spans with value_types larger than the size of
the requested data (e.g. more than 1 byte for getting a char,
more than 2 bytes for getting a uint16, etc.). For now, restrict
use of these methods at compile time until someone actually needs
to read memory that way.
2017-01-08 13:21:10 -06:00
Colin Snover
2558b20cdd COMMON: Improve test coverage for Span and fix bugs from testing 2017-01-08 13:20:23 -06:00
Colin Snover
7e0b40173f COMMON: Add STATIC_ASSERT macro to scummsys.h 2017-01-08 13:20:23 -06:00
Colin Snover
640f6039ca COMMON: Add Span to common library
Span is roughly modelled on the GSL span<T> type, and is intended
to replace direct access to raw pointers -- especially pointers
that are passed to functions along with a separate size
parameter. It provides low-cost bounds-checked reads and writes,
as well as convenience functions for reading common values
(integers of varying endianness, strings, etc.). While similar to
MemoryReadStream in purpose, Span is superior in cases where
memory is writable, where memory is accessed randomly rather than
sequentially, or where any invalid access should be treated as an
unrecoverable error. It should also be more efficient than a
MemoryReadStream because it is implemented using CRTP, so there is
no runtime overhead from dynamic dispatch.

NamedSpan is an extension of Span which provides enhanced
debugging information when out-of-bounds memory accesses occur.
It allows programmers to name the memory span at construction time,
and it also tracks the offsets of subspans so that the absolute
byte offset of the original memory can be provided in the error
message if an out-of-bounds access occurs.

SpanOwner is similar to ScopedPtr but has awareness of the design
of Span objects, so allows the memory pointed to by the Span object
inside the SpanOwner to be freed when the SpanOwner is freed
without requiring holding a separate pointer to the start of
memory. It also provides some copy semantics, so unlike a ScopedPtr,
SpanOwners can be held by objects in movable containers like
Common::Array -- but note that because there are no move semantics
in C++98, this means that a new, complete memory copy of the
pointed-to data will be created, rather than just a new Span
pointing to the same block of memory, when a container holding a
SpanOwner expands.
2017-01-08 13:20:23 -06:00
Colin Snover
ff1c2295ab COMMON: Add type traits to common library
Type traits allow conditional selection and manipulation of types
during compilation.
2017-01-08 13:20:23 -06:00
Colin Snover
9d3893459f COMMON: Add strnlen for safer C string length reads
This API is intended for use in cases where C strings come
from untrusted sources like game files, where malformed data
missing the null terminator would cause strlen to read out of
bounds.
2017-01-05 22:07:24 +01:00
Colin Snover
849e29dc87 COMMON: Add stddef.h to scummsys.h for ptrdiff_t 2016-12-19 15:00:09 -06:00
Eugene Sandulenko
6acbe91a27 COMMON: Added Estonian language 2016-12-04 15:21:37 +01:00
Ben Castricum
6f38c1e55d ALL: game state => saved game 2016-11-29 20:15:20 +01:00
D G Turner
844972441e COMMON: Fix GCC Warning in JSON Parser.
The emitted warning is "ISO C++98 does not support the ‘%lg’ gnu_printf
format [-Wformat=]".

Though "%lg" is required for *scanf functions to indicate the field
size, it is not required for *printf functions which use "%g" instead.
2016-10-30 14:46:47 +00:00
Thierry Crozat
3ae52a61af COMMON: Add referencing and destruction of the OSDMessageQueue instance
Registering the OSDMessageQueue instance as an event source is now done
right after the event manager is initialised. This ensures that it is created in a
sensible place and not for example in another thread). Also registering the
event source is moved to a separate function instead of being in the constructor
to remove any issue in case some code tries to display a OSD Message very early
on (the instance would be created then, but it would be registered as an event
source later).
2016-10-29 15:13:32 +01:00