Commit Graph

2986 Commits

Author SHA1 Message Date
Colin Snover
dda0f77bcf COMMON: Add basic fixed-width word wrap to Common::String 2017-11-10 09:57:41 -06:00
Colin Snover
2de83e0937 COMMON: Use C++11 static_assert when available
This improves the output of static assertions in all compilers,
and prevents problems in MSVC 2015 where the mechanism for
triggering a compilation error in C++98 mode may cause errors when
that compiler builds in release mode.

Fixes Trac#10154.
2017-11-10 09:56:43 -06:00
Bastien Bouclet
bd82345f0b Merge pull request #1035 from bgK/require-64bits-integers
BUILD: Require 64bits integers
2017-10-25 19:17:11 +02:00
Colin Snover
d1b77d4b68 BACKENDS: Fix missing mouse events when system cursor cannot be moved
Normally with SDL, a mouse motion event will be sent after the
system mouse cursor has been moved by a call to
SDL_WarpMouseInWindow, but if the system cursor cannot be moved
(e.g. because the window does not have mouse focus), games still
need to receive these mouse events so they can successfully update
the mouse position internally. Otherwise, games continue to think
the mouse is still in the original position and will continue to
try to perform whatever action is associated with that mouse
position.

Refs Trac#9689.
2017-10-15 13:24:21 -05:00
Colin Snover
914bb1bd2d COMMON: Undefine ABS if it is a macro
Fixes iOS7 compilation when common/util.h is included after
NSObjCRuntime.h, as happens in ios7_video.mm.
2017-10-07 13:04:05 -05:00
Colin Snover
04f357e6ff BACKENDS: Make initSizeHint an optional extension point
There is no particular reason why backends that don't need to
calculate screen dimensions in advance should still need to
implement initSizeHint at this point.
2017-10-07 12:30:29 -05:00
Colin Snover
6e157429b7 BACKENDS: Fix window sizing of games that switch between multiple resolutions 2017-10-07 12:30:29 -05:00
Colin Snover
f037d4df16 COMMON: Allow construction of Arrays of non-copyable members
Although the previous count-constructor would never make a copy of
a member at runtime, Array<T>::reserve *may* copy-construct, so
the compiler would forbid creation of arrays of NonCopyable objects
even when the array was created only once and then never resized
(and thus never actually tried to perform a copy-construction).
2017-10-06 22:10:50 -05:00
Colin Snover
79dd02373c COMMON: Prevent implicit conversion of smart pointers to non-bools 2017-10-06 22:10:49 -05:00
Colin Snover
5e2e6e9e8a COMMON: Switch to compile-time checking of invalid SortedArray calls
Runtime error detection is error-prone and unnecessary.
2017-10-06 22:10:49 -05:00
Bastien Bouclet
bbdbd85324 COMMON: Remove unused OverlayColor typedef 2017-09-30 21:35:16 +02:00
Bastien Bouclet
fd19e2fc15 COMMON: Introduce a shared hash function for pointer types 2017-09-30 21:35:16 +02:00
Bastien Bouclet
55f46d3667 BUILD: Define pointer sized integer types and remove SCUMM_64BITS 2017-09-30 21:35:16 +02:00
Bastien Bouclet
86573a8eaf COMMON: Unconditionally enable 64 bit integer features 2017-09-30 21:35:16 +02:00
Colin Snover
4938d5cc76 COMMON: Add standard data method to Common::Array
This matches the C++11 std::vector method of the same name, and
replaces usage of taking the address of the first element of an
array by &array[0] or &array.front() or &*array.begin(). The data
method is better than these usages because it can be used even
when the array is empty.
2017-09-30 11:17:53 +02:00
Colin Snover
c867a1834f COMMON: Add standard count & count+copy array constructors
These are additions to match C++11 std::vector common init
patterns, to make Common::Array cover more common use cases where
C-style arrays are currently used (and should not be).
2017-09-30 11:17:53 +02:00
Bastien Bouclet
be67f0d8bf COMMON: Remove DisposeAfterUse default value from dynamic write memory streams
The default value was DisposeAfterUse::NO, which made it very easy to
accidentally leak memory by omitting to specify a value.
2017-09-22 07:06:21 +02:00
Bastien Bouclet
8547c89b86 VIDEO: Change QT edit list to a Common::Array
And fix an out of bounds acces when seeking to the end of a video.
Skipping samples is needed even when seeking through silent edits
because a silent stream is queued for those.

Fixes #10219.
2017-09-21 13:06:18 +02:00
Colin Snover
f11b0a4ff5 SCI32: Toggle Phant2 content censoring from game options
To enable the optional content censoring mode, Phant2 looks
for a RESDUK.PAT file, which is normally placed by the game's
installer if the user chose to enable censorship. If the file
exists, the game reads an unlock password out of the file and
asks the user to enter the password when starting a new game to
create an uncensored game, or to click a "less intense" button
to start the game with censoring. The censorship state of the
game is then persisted in the save game file, and installations
with the RESDUK.PAT file need to enter the password again in
order to restore any of the uncensored saves.

Since we do not have an installer that can enable this feature,
add a game option toggle to enable/disable censoring (for the
releases that have the optional censorship mode) instead so the
censored content feature is available for anyone that wants to use
it. This flag is restored from ScummVM whenever a save game is
loaded, so it can be toggled on or off at any point without
needing a separate save game, unlike in the original interpreter.
2017-09-08 16:03:24 -05:00
Colin Snover
5bc4b46aa5 COMMON: Add comparator for sorting ArchiveMemberList 2017-09-08 16:02:32 -05:00
Colin Snover
110b4f0991 COMMON: Add helper macro for printing rects 2017-09-04 23:57:19 +02:00
Willem Jan Palenstijn
4278cff7f0 COMMON: Optimize BitStream::getBits 2017-08-24 19:46:59 +02:00
Willem Jan Palenstijn
0c8f95603f COMMON: Add BitStream classes for memory buffers 2017-08-24 19:46:59 +02:00
Willem Jan Palenstijn
e7428bca2e COMMON: Keep track of bitstream position 2017-08-24 19:46:59 +02:00
Willem Jan Palenstijn
ac95030ef6 COMMON: Cache BitStream size 2017-08-24 19:46:59 +02:00
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