aboutsummaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2018-04-22JANITORIAL: Fix formattingAdrian Frühwirth
2018-04-19JANITORIAL: Fix whitespaceAdrian Frühwirth
2018-04-15JANITORIAL: Fix whitespaceAdrian Frühwirth
2018-04-07ALL: Load savegame thumbnail only when necessaryAdrian Frühwirth
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-04COMMON: Add WARN_UNUSED_RESULT to scummsys.hAdrian Frühwirth
2018-04-04COMMON: Verify nb_NO localeAdrian Frühwirth
Despite looking weird, this is the correct locale for Norwegian (Bokmål).
2018-03-29COMMON: Fix Doxygen commentAdrian Frühwirth
2018-03-22COMMON: Fix UB, left shift of negative valueAdrian Frühwirth
2018-01-31COMMON: Move VER macro for serializer into common codeColin Snover
2018-01-31COMMON: Add support for array serialization to SerializerColin Snover
SCUMM engine does quite a bit of direct array serialization.
2017-12-28COMMON: Add a reset method to DisposablePtrBastien Bouclet
2017-12-03ALL: Remove obsolete register keywordColin Snover
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-01COMMON: Fix UB shifting negative integersColin Snover
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-11-19COMMON: Improve spacing between members in the event structsBastien Bouclet
2017-11-19EVENTS: Rename synthetic to kbdRepeatBastien Bouclet
2017-11-18COMMON: Add limited support for custom deleters to ScopedPtrColin Snover
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-10COMMON: Add basic fixed-width word wrap to Common::StringColin Snover
2017-11-10COMMON: Use C++11 static_assert when availableColin Snover
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-10-25Merge pull request #1035 from bgK/require-64bits-integersBastien Bouclet
BUILD: Require 64bits integers
2017-10-15BACKENDS: Fix missing mouse events when system cursor cannot be movedColin Snover
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-07COMMON: Undefine ABS if it is a macroColin Snover
Fixes iOS7 compilation when common/util.h is included after NSObjCRuntime.h, as happens in ios7_video.mm.
2017-10-07BACKENDS: Make initSizeHint an optional extension pointColin Snover
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-07BACKENDS: Fix window sizing of games that switch between multiple resolutionsColin Snover
2017-10-06COMMON: Allow construction of Arrays of non-copyable membersColin Snover
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-06COMMON: Prevent implicit conversion of smart pointers to non-boolsColin Snover
2017-10-06COMMON: Switch to compile-time checking of invalid SortedArray callsColin Snover
Runtime error detection is error-prone and unnecessary.
2017-09-30COMMON: Remove unused OverlayColor typedefBastien Bouclet
2017-09-30COMMON: Introduce a shared hash function for pointer typesBastien Bouclet
2017-09-30BUILD: Define pointer sized integer types and remove SCUMM_64BITSBastien Bouclet
2017-09-30COMMON: Unconditionally enable 64 bit integer featuresBastien Bouclet
2017-09-30COMMON: Add standard data method to Common::ArrayColin Snover
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-30COMMON: Add standard count & count+copy array constructorsColin Snover
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-22COMMON: Remove DisposeAfterUse default value from dynamic write memory streamsBastien Bouclet
The default value was DisposeAfterUse::NO, which made it very easy to accidentally leak memory by omitting to specify a value.
2017-09-21VIDEO: Change QT edit list to a Common::ArrayBastien Bouclet
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-08SCI32: Toggle Phant2 content censoring from game optionsColin Snover
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-08COMMON: Add comparator for sorting ArchiveMemberListColin Snover
2017-09-04COMMON: Add helper macro for printing rectsColin Snover
2017-08-24COMMON: Optimize BitStream::getBitsWillem Jan Palenstijn
2017-08-24COMMON: Add BitStream classes for memory buffersWillem Jan Palenstijn
2017-08-24COMMON: Keep track of bitstream positionWillem Jan Palenstijn
2017-08-24COMMON: Cache BitStream sizeWillem Jan Palenstijn
2017-08-24COMMON: Remove BitStream base class to allow inlining callsWillem Jan Palenstijn
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-20COMMON: Implement SeekableReadStream interface for MemoryReadWriteStreamColin Snover
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-12COMMON: Added freeing notes to zlib wrapper methodsPaul Gilbert
2017-08-07COMMON: Add a setVersion method to Common::SerializerPaul Gilbert
2017-07-30COMMON: Migrate Various Endian Functions to Common from Engine Code.D G Turner
Thanks to N.E.C <beholdnec@gmail.com> for this.
2017-07-27COMMON: Only clear events from the EventSources in clearEvents()Thierry Crozat
2017-07-26COMMON: Add method in EventManager to clear the event queueThierry Crozat
2017-07-13STREAM: add read/write functions for float LE/BEyinsimei
2017-07-10Revert "COMMON: Change way the Singleton instances are instantiated"Eugene Sandulenko
This reverts commit eefa72afa1978a9dea10f5b1833fcc8f58a3468e. With this patch ConfigManager is broken.