Commit Graph

3197 Commits

Author SHA1 Message Date
Matan Bareket
1474ca4ab3 JANITORIAL: Fix comment style for kFeatureSystemBrowserDialog 2018-12-26 15:30:16 -05:00
Thierry Crozat
56d1305f9d COMMON: Rename enum variable for native browser feature
There was a typo in the name (missing 'r' in browser).
2018-12-17 23:06:07 +00:00
SupSuper
d0512db25c WIN32: Move all ARRAYSIZE undefs to util.h
Instead of trying to undefine ARRAYSIZE everywhere we use a Windows header, let's just do it before we define our own
2018-12-17 12:28:33 +02:00
Thierry Crozat
319b90fb21 BACKENDS: Add kFeatureNativeFileBowserDialog 2018-12-16 15:58:43 +00:00
Thierry Crozat
d320c36e58 JANITORIAL: Fix typo in comment 2018-12-16 15:58:43 +00:00
SupSuper
fbc9c7d371 BACKENDS: Hook GUI browser to DialogManager 2018-12-16 10:48:13 +00:00
SupSuper
952b12311c BACKENDS: Add base support for system dialogs 2018-12-16 10:48:13 +00:00
Cameron Cawley
8fa2f90a26 CREATE_PROJECT: Support building with Tremor instead of Vorbis 2018-11-27 22:58:02 +00:00
Cameron Cawley
79a4e3f813 BACKENDS: Remove references to the GP32 backend 2018-11-04 21:38:45 +00:00
Torbjörn Andersson
fc7fa1de3a VIDEO: Use liba52 to decode audio. This is still laughably broken
At the moment, this produces nothing but misery in the form of
Valgrind warnings and horrible noise.
2018-11-04 22:33:22 +01:00
D G Turner
4c4ede54b9 COMMON: Add Portuguese (Portugal) Language.
The current Portuguese entry is Brazilian dialect, so modifying the
description and adding an entry for European Portuguese.

This is required to deal with bug Trac #10791.
2018-11-03 17:13:54 +00:00
D G Turner
d0480e2dad COMMON: Add Danish Language.
This is required in PINK engine for danish localization as per
Trac bug #10708.
2018-10-26 01:34:03 +01:00
Thierry Crozat
1e11da712b COMMON: Add mutex to protect access to the String memory pool
This fixes a crash due to concurrent access to the global MemoryPool
used by the String class when String objects are used simultaneously
from several threads (as is for example the case when enabling the
cloud features).

See bug #10524: Thread safety issue with MemoryPool
2018-10-14 21:25:16 +01:00
Thierry Crozat
c39dcc57a0 OSYSTEM: Add backendInitialized() function
Some feature, such as mutexes, are only available once the backend
has been initialized. This new function can be used to avoid using
those feature too early or too late.
2018-10-14 21:25:02 +01:00
Filippos Karapetis
7f83640894 SCI32: Add a game option to double the videos in KQ7 by default
Scaling works correctly with the Windows variant, which uses AVI files,
but the DOS variant uses Robot videos, and the way scaling is done
there is different, and is not working yet with KQ7 DOS. Nonetheless,
both versions are included in the game, so it's not a major issue.
2018-09-01 13:14:38 +03:00
David Fioramonti
51c11efbbc COMMON: Cos/Sin Table switch internal structure so at() is faster
A new internal table has been added so that no if checks need to
be performed for the at() lookup.

The old table can still be accessed using getTable or atLegacy().

at() and atLegacy() return the same values, but at() is faster.
2018-08-25 23:51:40 +02:00
David Fioramonti
cf99bb0a5e COMMON: Update RDFT and DCT cos/sin table constructor usage
When the constructor for the cos/sin table was changed from
number of bits to number of points all usages thoughout the
code should of been changed, but this was missed in RDFT and DCT.

Fixes Trac#10683.
2018-08-25 23:50:07 +02:00
Ľubomír Remák
0e90d6eae3 MUTATIONOFJB: Use advanced detector. 2018-08-25 23:12:01 +02:00
David Fioramonti
da57cef0c3 COMMON: FFT update cos/sin table constructor change
They now take in the size rather than the power of 2 exponent.
2018-08-18 16:30:57 +02:00
David Fioramonti
9cfc70e7fe COMMON: allow cos/sin number of points to be more flexible
Previously, the cos/sin table had to be a power of 2, but there
are many use cases where the number of points is not necessarily
a power of 2 so this change the constructor so it now takes
in the number of points rather than the number of points as the
exponent of a power of 2.

The restriction is that the size must be divisible by 4.
2018-08-18 16:30:57 +02:00
Cameron Cawley
4016cffd7a COMMON: Make strdup a forbidden symbol 2018-08-18 16:30:05 +02:00
Cameron Cawley
7a437e909c COMMON: Move new_strdup to common/str.cpp 2018-08-18 16:30:05 +02:00
Andrei Prykhodko
47130eceb3 COMMON: changed code page constant name from ascii to utf8 2018-08-05 22:50:42 +03:00
Andrei Prykhodko
ca54a72072 COMMON: made code pages conversion arrays static and constant 2018-08-05 21:57:36 +03:00
Andrei Prykhodko
9948b2452f COMMON: named CodePage enum 2018-08-05 21:53:31 +03:00
Andrei Prykhodko
62c250a8be COMMON: added method to convert text from various code pages to Unicode 2018-08-05 20:32:25 +03:00
lolbot-iichan
d91307e401 COMMON: Added Ukrainian language
Common::UA_UKR is needed for FoxTail game at WinterMute engine
2018-08-03 00:43:33 +02:00
Thierry Crozat
53d0fe22d9 COMMON: Fix HashMap never reusing erased items storage
When erasing and inserting many items this caused the hashmap capacity
to grow more than it should which resulted in performances issues (and
possibly memory issues as well). The issue was reported on IRC today
with the wintermute engine.
2018-07-30 19:32:02 +01:00
David Fioramonti
650e26b6ab COMMON: Add at() index function to cosine/sine table
The cos/sin table class now has an at() function for indexing
safely into its internal array.

This allows the checking and computing of the correct
indexes to be done internally.

The indexing in allows cos/sine of 0 to 2pi to be
obtained.

The values returned by getTable are the same as before.

Comments that describe the values that the table
contains has been modified to line up with what
the code is doing.
2018-07-25 10:18:32 +02:00
Thierry Crozat
89f1b1c96e GUI: Add Stretch Mode selection in Options dialog 2018-07-08 16:54:51 +01:00
Thierry Crozat
8526c2c31a OSYSTEM: Add Stretch Mode API 2018-07-08 16:54:51 +01:00
Eugene Sandulenko
4d847d83ed COMMON: Added Finnish language constants 2018-06-28 23:51:32 +02:00
Eugene Sandulenko
79e158671e COMMON: Add simplistic UTF8->UTF32 converter 2018-06-18 00:08:01 +02:00
Bastien Bouclet
3b794d2633 MOHAWK: Display a GUI error message when no audio devices are available 2018-06-07 20:14:27 +02:00
David Fioramonti
2fcc429498 COMMON: More nullptr usage in common/ptr
Replaces some more ptr=0 with ptr=nullptr.
2018-06-04 03:36:27 -07:00
Thierry Crozat
4229e2642e
Merge pull request #1141 from DanielSWolf/larryscale
SCI: High-quality "LarryScale" cel scaler for LSL7
2018-06-03 17:41:47 +01:00
David Fioramonti
8d10fbe1ba COMMON: coding convention improvements for degree conversion funcs
Removed whitespace before template keyword.

Made template types camel case starting with lowercase.
2018-05-28 23:00:53 +01:00
whiterandrek
ac5f61265f COMMON: fix wrong size assignment in HashMap 2018-05-25 19:13:14 +01:00
Adrian Frühwirth
cee4d6b853 JANITORIAL: Fix trailing whitespace 2018-05-24 15:30:55 +02:00
David Fioramonti
abb8ae0936 COMMON: Template deg2rad and rad2deg in Common/math
The input and output type can be different.

Currently, rad2deg is only being used by sci (float to int)
and deg2rad in wintermute.
2018-05-20 11:21:06 +01:00
Bastien Bouclet
955e18c648 COMMON: Use nullptr instead of NULL or 0 where appropriate 2018-05-10 08:35:46 +02:00
Bastien Bouclet
7382af32be GUI: Make the tab completion case insensitive in the debug console
It made little sense for the tab-completion to be case sensitive while
command execution itself is case insensitive.
2018-04-30 20:31:44 +02:00
Lothar Serra Mari
05c1e593c0 COMMON: Add hasInstance() bool to singleton class 2018-04-29 21:47:10 +01:00
Thierry Crozat
3fe0e3c38e OSYSTEM: Add API to copy text to clipboard
This has also been implemented for the SDL2 and macOS backends.
2018-04-29 21:47:10 +01:00
Adrian Frühwirth
a20f90cbb7 JANITORIAL: Fix formatting 2018-04-22 00:56:21 +02:00
Adrian Frühwirth
9bee9e1ba6 JANITORIAL: Fix whitespace 2018-04-19 12:08:31 +02:00
Adrian Frühwirth
3747d852ee JANITORIAL: Fix whitespace 2018-04-15 16:31:31 +02:00
Adrian Frühwirth
00e59a3122 ALL: Load savegame thumbnail only when necessary
This commit introduces the following changes:

1. Graphics::loadThumbnail()

   Now returns a boolean and takes a new argument skipThumbnail which
   defaults to false. In case of true, loadThumbnail() reads past the
   thumbnail data in the input stream instead of actually loading the
   thumbnail. This simplifies savegame handling where, up until now,
   many engines always read the whole savegame metadata (including
   the thumbnail) and then threw away the thumbnail when not needed
   (which is in almost all cases, the most common exception being
   MetaEngine::querySaveMetaInfos() which is responsible for loading
   savegame metadata for displaying it in the GUI launcher.

2. readSavegameHeader()

   Engines which already implement such a method (name varies) now take
   a new argument skipThumbnail (default: true) which is passed
   through to loadThumbnail(). This means that the default case for
   readSavegameHeader() is now _not_ loading the thumbnail from a
   savegame and just reading past it. In those cases, e.g.
   querySaveMetaInfos(), where we actually are interested in loading
   the thumbnail readSavegameHeader() needs to explicitely be called
   with skipThumbnail == false.

   Engines whose readSavegameHeader() (name varies) already takes an
   argument loadThumbnail have been adapted to have a similar
   prototype and semantics.
   I.e. readSaveHeader(in, loadThumbnail, header) now is
   readSaveHeader(in, header, skipThumbnail).

3. Error handling

   Engines which previously did not check the return value of
   readSavegameHeader() (name varies) now do so ensuring that possibly
   broken savegames (be it a broken thumbnail or something else) don't
   make it into the GUI launcher list in the first place.
2018-04-07 09:26:20 +02:00
Adrian Frühwirth
a0d7a99439 COMMON: Add WARN_UNUSED_RESULT to scummsys.h 2018-04-04 20:56:41 +00:00
Adrian Frühwirth
4c5afcf780 COMMON: Verify nb_NO locale
Despite looking weird, this is the correct locale for Norwegian (Bokmål).
2018-04-04 22:48:28 +02:00
Adrian Frühwirth
f8a195b034 COMMON: Fix Doxygen comment 2018-03-29 00:19:33 +02:00
Adrian Frühwirth
d623ec2c38 COMMON: Fix UB, left shift of negative value 2018-03-22 22:16:24 +01:00
Daniel Wolf
999cf71dcf SCI: Add game option for enabling/disabling LarryScale in LSL7
All other SCI games continue using the default scaler.
2018-03-16 22:33:06 +01:00
Colin Snover
2e061d95c5 COMMON: Move VER macro for serializer into common code 2018-01-31 17:58:01 +01:00
Colin Snover
157ee95f64 COMMON: Add support for array serialization to Serializer
SCUMM engine does quite a bit of direct array serialization.
2018-01-31 17:58:01 +01:00
Bastien Bouclet
2c8afb2bd2 COMMON: Add a reset method to DisposablePtr 2017-12-28 21:18:51 +01:00
Colin Snover
a5bc89102e ALL: Remove obsolete register keyword
The register keyword was deprecated from the C++11 standard,
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4193.html#809>,
and removed from the C++17 standard,
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4340>, so
cannot exist in a well-formed C++17 program.

It has never done anything in GCC
<https://gcc.gnu.org/ml/gcc/2010-05/msg00113.html>
and because of the way it is specified in the standard, it is “as
meaningful as whitespace”
<http://www.drdobbs.com/keywords-that-arent-or-comments-by-anoth/184403859>.

The one remaining use of the register keyword is in the DS backend,
where it is used to create a local register variable using the
non-standard GCC Extended Asm feature.

Closes gh-1079.
2017-12-03 20:27:42 -06:00
Colin Snover
02614f2f1a COMMON: Fix UB shifting negative integers
Compilers optimise these back into shifts on architectures where
shifts of negative integers work the same as mul/div, so this
solves the UB without actually causing any performance issue.
2017-12-01 19:22:24 -06:00
Bastien Bouclet
acf87add27 COMMON: Improve spacing between members in the event structs 2017-11-19 20:16:10 +01:00
Bastien Bouclet
8beb519c5e EVENTS: Rename synthetic to kbdRepeat 2017-11-19 16:12:50 +01:00
Colin Snover
076667dc00 COMMON: Add limited support for custom deleters to ScopedPtr
Custom deleters of ScopedPtr are not currently fully conforming to
C++11's support for custom deleters in std::unique_ptr for the
sake of simplicity of implementation. Unlike in the standard
library, plain functions and lvalue references are not supported,
nor may custom deleters be passed to the constructor at runtime.
This can be improved in the future, if necessary, by doing what
standard library implementations usually do and creating a Pair
class that uses the Empty Base Optimization idiom to avoid extra
storage overhead of the deleter instance when it is not needed, as
in typical standard library implementations, plus some additional
type traits to support the necessary metaprogramming for the
different type overloads.
2017-11-18 22:35:12 +01:00
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
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
Thierry Crozat
e732186724 COMMON: Add OSDMessageQueue singleton
This class can be used to get messages to display on the OSD from
any thread. Those messages are then passed to the backend in the
graphic thread.
2016-10-29 15:13:32 +01:00
Eugene Sandulenko
3071bb40d8 COMMON: Added debug method for printing out stream contents 2016-10-26 19:00:13 +02:00
Thierry Crozat
5151bd99dd Merge pull request #847 from criezy/sdl-filtering
Add graphics linear filtering feature
2016-10-16 18:42:40 +01:00
Eugene Sandulenko
e89c76f63c Merge pull request #836 from peterkohaut/bladerunner
BLADERUNNER: added basic support for blade runner game
2016-10-13 23:48:50 +02:00
Thierry Crozat
30aae5178a OSYSTEM: Add kFeatureFilteringMode 2016-10-13 01:45:01 +01:00
Eugene Sandulenko
355c4fa646 JANITORIAL: Remove more trailing spaces 2016-10-09 15:02:02 +02:00
Eugene Sandulenko
7ab0985ca8 COMMON: Add ReadFloatLE to Common::ReadStream 2016-09-29 22:33:36 +02:00
Bastien Bouclet
0802bbd8ee OSYSTEM: Remove the API allowing to draw to the OSD surface directly 2016-09-13 20:41:26 +02:00
Bastien Bouclet
521ba2cb8a OSYSTEM: Introduce a method allowing to draw a background activity icon 2016-09-13 20:25:13 +02:00
Paul Gilbert
bd010bc79f COMMON: Converted Common::BitStream to use DisposeAfterUse 2016-09-10 11:16:07 -04:00
Thierry Crozat
1f2a50bcd3 CLOUD: Move openUrl to OSystem 2016-09-10 01:12:42 +01:00
Thierry Crozat
dff88b1058 COMMON: Fix indentation inconsistencies 2016-09-09 22:28:48 +01:00
Eugene Sandulenko
fab199d37e JANITORIAL: Make GPL headers uniform 2016-09-03 12:46:38 +02:00
Eugene Sandulenko
029e1c0d1a Merge pull request #820 from waltervn/platform-atari8bit
COMMON: Add Atari 8-bit platform
2016-09-02 23:41:29 +02:00
Willem Jan Palenstijn
9b6bbeb911 COMMON: Replace broken URL 2016-08-30 21:59:12 +02:00
Willem Jan Palenstijn
3b2bdd3a89 COMMON: Fix sign warning 2016-08-30 21:53:22 +02:00
Walter van Niftrik
51360ec6ab COMMON: Add Atari 8-bit platform 2016-08-29 17:52:36 +02:00
Alexander Tkachev
368f664c81 COMMON: Fix WriteStream::pos() once again
MemoryReadWriteStream now returns int32, not uint32. It actually doesn't
ever return -1 to indicate that an error occured, so uint32 was a better
choice, but that's what is used in WriteStream base class now.

That method is abstract, so that's also why OutSaveFile had to override
it.
2016-08-24 16:24:16 +06:00
Alexander Tkachev
b9bba9bd4b ALL: Move Clipboard support to OSystem
Commit adds kFeatureClipboardSupport. hasTextInClipboard() and
getTextFromClipboard().

OSystem_SDL has this feature if SDL2 is used.

EditableWidget and StorageWizardDialog use g_system to access clipboard
now.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
438ba985a4 JANITORIAL: Remove spaces at the end of the line
I knew there were some, but I wanted to fix them once, instead of doing
it all the time.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
627bda9d82 COMMON: Add replace(String, String, String)
Searches for a substring in the string and replaces it with the other
string.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
acce1c89ab CLOUD: Fix saves sync
Tested that on actual unix system and found out a few minor bugs related
to paths.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
fa3ea83165 CLOUD: Fix some warnings
Mostly on format string
2016-08-24 16:07:55 +06:00
Alexander Tkachev
aee713141b CLOUD: Make OutSaveFile start saves sync
It had to become a proxy class in order to do that.
finalize() starts the saves sync.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
c99b24c16d COMMON: Add String::asUint64()
Instead of all these atoull() I've added everywhere.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
9eb4aad7fd CLOUD: Make DefaultSaveFileManager ignore syncing files
MetaEngines don't get "locked" files in the list, so won't try to open
these.

Save/Load dialog updates save list every time SavesSyncRequest tells it
to.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
1b9987ddc9 GUI: Add getOSDFormat() and make OSD 32 bpp 2016-08-24 16:07:55 +06:00
Alexander Tkachev
2a15b8b280 GUI: Add clearOSD() method
So one can erase everything from OSD and then blit something on it.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
7ff1f91808 GUI: Add copyRectToOSD()
I was lazy to implement that in OpenGLGraphicsManager and I'm not sure
it's implemented correctly in SurfaceSdlGraphicsManager, but it works
for me.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
da3b7bd8d9 CLOUD: Add GoogleDriveStorage
It has its own GoogleDriveTokenRefresher and knows how to do info().

This commit also contains JSON int -> long long int fix and
CurlJsonRequest '\n' -> ' ' fix.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
b3bf532211 CLOUD: Make CloudManager singleton
It's needed to ::destroy() it in main().
2016-08-24 16:07:55 +06:00
Alexander Tkachev
4e7dec5500 CLOUD: Add DropboxCreateDirectoryRequest
Also add CloudManager::testFeature(), because syncSaves() now works fine
and I don't want to break it again and again with my testing requests.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
eb63b50b7f CLOUD: Refactor Request
Added ErrorResponse and ErrorCallback. Each Request now has an
ErrorCallback, which should be called instead of usual callback in case
of failure.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
cc4512e50b COMMON: Add SaveFileManager::openRawFile()
It's needed for the cloud saves upload/sync feature.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
701b07adfb COMMON: Fix JSON to understand integers correctly 2016-08-24 16:07:55 +06:00
Peter Bozsó
81c34adaef Fix comment formatting 2016-08-24 16:07:55 +06:00
Alexander Tkachev
14d60e62f8 CLOUD: Fix format string warnings
I get 'warning: ISO C++98 does not support the '%lg' ms_printf format'
warning though.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
f4547f44df CLOUD: Add RequestIdPair struct
Can be used with Callback<T> (means it's still type safe). It's used to
pass not only Request id to user's callback, but also a value user
wanted.

void *data field is removed from RequestInfo.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
ae8e7f39f5 CLOUD: Make download() create necessary directories
DumpFile::open() with createPath=true create would create the missing
directories from the path before opening a file. Thus, one can easily
create a file and avoid "can't open a file" error.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
d014b5bf38 CLOUD: Fix MemoryReadWriteStream
There was a problem with file downloading in MinGW. Strangely, there is
no such problem in Visual Studio, yet this fixes the problem.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
5f4bbe6e9e CLOUD: Add OneDrive Storage stub
Knows how to OAuth already.

This commit also adds CloudManager::addStorage(), so OneDriveStorage can
add newly created Storage and CloudManager can save it in the
configuration file.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
41e65db7d0 CLOUD: Add Storage saving mechanism
In this commit CloudManager starts supporting multiple Storage. Now, in
its init() it loads all the Storages and determines the current one.

It now also has save() method. In that method all Storages are saved
with their new saveConfig() method.

CloudManager::save() not called from anywhere, though. The only one
Storage that could be added is DropboxStorage in case you have no
cloud-related config keys or you have no storages connected.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
b570499164 CLOUD: Add Callback typedefs
And do some minor cleanup work.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
9e531e3ce7 CLOUD: Polish Callbacks
Cleaned up all example code and old callbacks.

New Callback classes are introduced in "common/callback.h" and
documented.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
e1109c0c32 CLOUD: Add CallbackBridge
This commit also adds GlobalFunctionCallback, because it was needed in
order to replace plain C pointers to functions (which were used in
Request) into our object-oriented BaseCallback pointers.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
ca456a7241 CLOUD: Add object-oriented Callbacks
These callbacks can call object's methods, not some global C functions.

DropboxStorage::info2() and DropboxStorage::infoMethodCallback()
demonstrate the idea.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
17eb5f9143 CLOUD: Add complex callbacks
Originally, I intended to add Storage API, StorageFile and StorageInfo
stubs. When I tried to implement a simple info() call, I ended up fixing
Request to contain some pointer field and all callbacks to have Request*
parameter. And, now I have to place callback pointer into Request. which
calls another callback.

And, eventually, these "simple" callbacks would again require another
pointer (to some caller class).
2016-08-24 16:07:55 +06:00
Alexander Tkachev
e743a65636 CLOUD: Add Dropbox into CloudManager's configs
This commit adds:
* ConfMan's new "cloud" domain;
* CloudManager's init() method, where it loads keys from "cloud" configs
domain;
* CurlJsonRequest's addHeader() and addPostField() methods;
* temporary Storage's printInfo() method;
* DropboxStorage's implementation of printInfo(), which is using access
token and user id;
* DropboxStorage's loadFromConfig() static method to load access token
and user id from configs and create a Storage instance with those;
* temporary DropboxStorage's authThroughConsole() static method, which
guides user through auth process from the console.

So, in CloudManager's init() implementation ScummVM checks that there is
"current_storage_type" key in "cloud" domain of configs, and loads
corresponding storage if there is such key.

If there is no such key, ScummVM offers user to auth with Dropbox.
That's done through console, and thus it's temporary (it also requires
restarting ScummVM twice and manually editing config.ini file).
2016-08-24 16:07:55 +06:00
Alexander Tkachev
03217cd5c3 CLOUD: Add CurlJsonRequest
Now we can do REST API request by creating CurlJsonRequest and waiting
for it to call our callback. Passed pointer is Common::JSONValue.

This commit also does some minor variable renaming fixes.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
9c22b7cc64 CLOUD: Rewrite NetworkReadStream
Now it is based on MemoryReadWriteStream, which is introduced by this
commit. This stream is using ring buffer and is dynamically increasing
its size when necessary.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
b272bba751 CLOUD: Do minor fixes 2016-08-24 16:07:55 +06:00
Alexander Tkachev
fade746f37 CLOUD: Add USE_CLOUD feature
Adds USE_CLOUD in both configure and create_project.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
ca2eeb2214 CLOUD: Add Cloud::Manager and Cloud::Storage
This commit introduces Common::CloudManager, which can be accessed from
OSystem.

The backend for this manager is Cloud::Manager (defined in
backends/cloud/manager.h). It should load all users storages from
configs and provide access to current Storage instance. For now it just
creates a new one.

Cloud::Storage (backends/cloud/storage.h) provides an API to interact
with cloud storage, for example, create new directory or sync files.
Right now it's not ready and has only two dummy methods: listDirectory()
and syncSaves().

There is Cloud::Dropbox::DropboxStorage backend
(backends/cloud/dropbox/dropboxstorage.h) for Cloud::Storage. Right now
it implements both listDirectory() and syncSaves() with starting timer
task and handling it by printing out some JSON examples.
2016-08-24 16:05:07 +06:00
Alexander Tkachev
7446ffd73b CLOUD: Integrate CloudThread into OSystem
Would be changed soon.
2016-08-24 16:05:07 +06:00
Alexander Tkachev
e4e2ec390d CLOUD: Remove wcsncasecmp() usage from SimpleJSON
Replaced with scumm_strnicmp().
2016-08-24 16:05:07 +06:00
Alexander Tkachev
2ac2816d68 CLOUD: Refactor SimpleJSON 2016-08-24 16:05:07 +06:00
Alexander Tkachev
a7fb8c72ab CLOUD: SimpleJSON refactor
Resharper + manual methods & fields renaming.
2016-08-24 16:05:07 +06:00
Alexander Tkachev
79e6368b42 CLOUD: Add SimpleJSON library (module.mk hotfix)
Forgot to edit those.
2016-08-24 16:05:07 +06:00
Alexander Tkachev
8429c40362 CLOUD: Add SimpleJSON library as Common::JSON
This commit also adds CloudThread class, which work() method is called
every second by TimerManager.

Right now it prints JSON examples on the console, so that's why it's
introduced with SimpleJSON library.
2016-08-24 16:05:07 +06:00
Eugene Sandulenko
0ab903a9e2 COMMON: Added checkers for debug channels.
Sometimes there is a need to add debug execution and enable it from
the command line. Now it is possible, both with debug levels and channels
2016-08-19 09:55:22 +02:00
Eugene Sandulenko
0fdab36710 COMMON: Introduce --debug-channels-only command line flag.
Many of our systems currently generate significant amount of debug
output on deeper levels. Now, when your engine is using Debug Channels,
you might want to show that debug information only, which is currently
not possible, as the generic output will be mixed in your output.

Alternative solution would be to implement possibility to specify
per-channel debug levels.
2016-08-13 21:07:43 +02:00
Willem Jan Palenstijn
68a15c10be Merge pull request #790 from salty-horse/clang_fixes
ALL: Don't use 'defined' in macro definitions
2016-08-13 11:57:39 +02:00
Paul Gilbert
9e0a6cda67 COMMON: Fix octal for GUIO_GAMEOPTIONS9 2016-08-12 20:46:21 -04:00
Alexander Tkachev
f58abd9540 COMMON: Update GZipWriteStream::pos()
Though it seemed the _wrapped stream should return valid position, it
was always 0. That's why I've added a _pos field, which is updated in
write() and returned in pos().
2016-08-04 15:14:06 +06:00