Commit Graph

3307 Commits

Author SHA1 Message Date
D G Turner
0eec560cac COMMON: Add Missing Switch Default Cases to Stream Seek Methods
These are flagged by GCC if -Wswitch-default is enabled.
2019-10-03 01:01:16 +01:00
D G Turner
78ef4b9499 COMMON: Add Default Cases to Switch Statements in Memstream Classes
These are flagged by GCC if -Wswitch-default is enabled.

This avoids possible hard to diagnose bugs if the whence int parameter is
accidently set to an unexpected value.
2019-10-02 06:12:38 +01:00
Thierry Crozat
06acfd515f COMMON: Fix memory leaks in iconv error case
This fixes coverity CID 1405783 and CID 1405784.
2019-09-30 22:04:27 +01:00
D G Turner
e895548237 COMMON: Fix MSVC Compiler Warning
The enum is implicitly int32 by default so causes signed vs. unsigned
assignment warnings. Changing this to a const uint32 avoids the issue.
2019-09-30 01:44:14 +01:00
Paul Gilbert
c03b7a50ea GLK: ADRIFT: Implement zlib decompression 2019-09-25 20:13:27 -07:00
Eugene Sandulenko
7def18a26c COMMON: Workaround for a compiler bug in osx_intel buildbot toolchain
It was introduced in 014bef9eab. There is
nothing wrong with our code, but strangely, it makes the
i686-apple-darwin9-as v1.38 to choke when parsing .stabd directives.

Once we upgrade buildbot or do another change to system.h, hopefully
this could be removed.
2019-09-23 22:22:23 +02:00
Cameron Cawley
7bf22fa996 BACKENDS: Add EVENT_CLIPBOARD_UPDATE event 2019-09-21 22:16:01 +03:00
Cameron Cawley
014bef9eab BACKENDS: Add a default clipboard implementation 2019-09-21 22:16:01 +03:00
Thierry Crozat
bdd7b6baed COMMON: Fix escaping and parsing of UTF-8 strings in JASON parser 2019-09-21 22:15:26 +03:00
D G Turner
04242ce829 LUA: Fix Coverity Warnings in File Class 2019-09-15 16:21:02 +01:00
Cameron Cawley
410923351b Revert "COMMON: Implement FSNode::createDirectoryRecursive()"
This reverts commit aca627bec7.
2019-09-15 00:07:46 +02:00
D G Turner
019de0cc23 EVENTRECORDER: Fix GCC Compiler Warnings
These were memcpy usage to copy a non-trivial structure.
2019-09-14 00:54:10 +01:00
Le Philousophe
5cc574a695 BUILD: Fix GCC bogus warning by removing const
GCC emits "warning: type qualifiers ignored on cast result type" when
some types are used for HashMap because of the const modifier.
This applies especially to pointer-to-member-functions.
The const there is not really useful as it only prevents unfortunate
object editions.
2019-09-09 17:39:06 +03:00
Cameron Cawley
713fe80b47 LUA: Remove references to Sword25 (#1833) 2019-09-06 10:38:14 +03:00
Jaromir Wysoglad
8f930126e7 COMMON: Add string size computation to Encoding. 2019-09-05 23:52:46 +01:00
Eugene Sandulenko
102846becf COMMON: Added PocketPC platform 2019-09-03 17:17:30 +02:00
Eugene Sandulenko
ea2f09b256 COMMON: Restored functionaluty of Lua print 2019-09-03 17:17:21 +02:00
SupSuper
1c1cc91ad5 COMMON: Don't include win32.h in common/encoding.h 2019-09-02 08:01:18 +03:00
Jaromir Wysoglad
d4a98dcadb COMMON: Add CP437 encoding conversion table. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
291360a280 COMMON: Add CP850 conversion.
CP850 is used by the mortevielle engine (and apparently by other
engines too). Anytime an engine using CP850 encoding wants to use
the TTS, the encoding has to be converted, so this is pretty
important encoding conversion to support. Unfortunately SDL
(when compiled without iconv) doesn't support this encoding
(which means, there might not be a way to convert this encoding
on some platforms), so I added a conversion table for this.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
4b5b812712 TTS: Better documentation of TTSVoice. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
54c37f6f46 TTS: Document diferences in resume()
On linux the resume() behaves slightly differently than on
other platforms.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
c2c4458253 JANITORIAL: Remove some trailing whitespaces 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
01d843c527 TTS: Update documentation of INTERRUPT_NO_REPEAT 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
38e769430a TTS: Improve documentation 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
4bae32ffe7 TTS: Add *_NO_REPEAT actions 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
1694b930e6 TTS: Make one say() method non-virtual 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
6703f88f7f TTS: Implement speech queueing on Linux and Win 2019-09-01 22:47:55 +03:00
Thierry Crozat
5baa023ed0 TTS: Improve documentation 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
c7dbf192ef TTS: Remove unneeded code
Remove debuging outputs
Remove commented iconv implementation of text conversion to UTF-8
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
58065ceacd TTS: Refactoring
* Delete multiple empty rows
 * Make getVolume non-virtual and leave just the implementation
    in base class
 * Resolve warning about signed / unsigned comparison in
    gui-manager
 * Clear availableVoices when updating voices on linux
 * By default set language to transMan language on windows
    (if the transMan is available)
 * Remove freeVoices method from Windows ttsMan, it isn't needed
    anymore
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
0631070833 TTS: Fix state switching on windows
Voice is changed when changing language on windows, so when poping
state, the voice, that should get set has to be saved before
changing the language.

The speech shouldn't continue when changing state, so it is stopped
in pushState and popState.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
33549d9c02 TTS: Add getVoiceIndicesByGender to the base class
This is a way to easily get a list of voices with the given gender
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
b5d5576f90 TTS: Add check to getVoice, fix typo.
Check if _availableVoices isn't empty.
Replace availaible with available
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
bb3346fba7 TTS: Update the TTS documentation 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
7c78912931 TTS: Move popState to the base class 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
5c1f562452 TTS: Implement conversion to UTF-8 in say on linux 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
5d9f03e71d TTS: Add reference counting to TTSVoice
Also refactor TTSVoice destruction to use this reference counting.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
62e219ece3 TTS: Implement default behavior of TTS setters 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
dae7d64d38 TTS: Add documentation to common/text-to-speech.h 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
33f8aadfeb TTS: Add age to TTSVoice 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
318c6d7ec6 TTS: Finish implementing the Windows TTS manager 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
8bd7e39265 TTS: Add voice selection to options 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
b5cebcbeae TTS: Add text to speech to the GUI. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
62a011e28a TTS: Add ttsStatus push and pop functions 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
7f895d21df TTS: Add checks for correct TTS engine state. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
8c44b03231 TTS: Resolve segfault when exiting scummvm 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
39e74b027e TTS: Add part of linux TTS 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
f78fc85f3a TTS: Create a TTS skeleton 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
b0c8b368a9 COMMON: Don't include iconv.h in common/encoding.h
Move #include<iconv.h> from common/encoding.h to
common/encoding.cpp and change the methods accordingly.

This resulted in not saving the iconvHandle if using the
"non-static" version of conversion, but it simplified the code
and hopefuly resolved issues with forbidden symbols on some
platforms.
2019-08-25 13:46:16 +03:00
Jaromir Wysoglad
96fef16693 COMMON: Don't include config.h before scummsys.h
Thil should fix the ds build. For some reason
I thought the forbidden.h wouldn't allow me to
include the iconv.h, so I tryed to include it
before the forbidden.h (it seems like I didn't
have to do that.)
2019-08-25 03:14:24 +01:00
Jaromir Wysoglad
fcbf59f5ba COMMON: Convert endianity when needed in Encoding. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
0c74a7f27e COMMON: Fix typos 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
f8ac40af7c COMMON: Encoding refactoring 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
05df774905 COMMON: Add OSystem::convertEncoding documentation 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
b20922942c COMMON: Add missing documentation. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
96270d4bf2 JANITORIAL: Remove debuging code. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
a0564bc564 COMMON: Resolve endianity in Encoding 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
613613568c COMMON: Rename methods in Common::Encoding 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
24d35df476 COMMON: Refactor convertIconv 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
9fa09eeefe COMMON: Check for return values in Encoding 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
5043dec13c COMMON: Add propper Encoding setters 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
73fa9d921f COMMON: Add documentation to Common::Encoding 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
61cf628bfb COMMON: Add cyrilic transliteration to Encoding. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
888f3e4d30 COMMON: Add transMan mapping encoding conversion. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
bfdff38d01 COMMON: Use backend specific encoding conversion 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
a43526cb3e OSYSTEM: Add convertEncoding virtual method 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad
dfbbd228e6 COMMON: Add encoding conversion using iconv 2019-08-24 18:12:45 +03:00
Andrei Prykhodko
c2054682f0 COMMON: added support for ini files with non english characters 2019-08-20 13:53:01 +03:00
Filippos Karapetis
1dd915ccdf COMMON: Handle invalid INI file characters gracefully
This replaces all the asserts with warning messages
2019-08-20 11:38:27 +03:00
Andrei Prykhodko
f52a96e1f4 COMMON: fixed reading ini files which have not value for key 2019-08-19 21:50:14 +03:00
Cameron Cawley
e609d0247c
LUA: Fix end of namespace comment 2019-08-13 16:44:58 +01:00
Cameron Cawley
46adbfa7b5
LUA: Remove duplicate object file from module.mk 2019-08-13 10:23:32 +01:00
Nipun Garg
c1f029c6dc COMMON: Move Lua into Common and make it into...
an engine feature
2019-08-13 10:18:02 +02:00
Cameron Cawley
aca627bec7 COMMON: Implement FSNode::createDirectoryRecursive() 2019-08-11 22:15:54 +03:00
lolbot-iichan
7553940792 COMMON: Add warnings on failed FSNode::createDirectory() 2019-08-11 22:15:54 +03:00
lolbot-iichan
f1250dbfcb COMMON: Implement createDirectory() method to Common::FSNode
Added a simple wrapper for AbstractFSNode::create(true) since there was
no way to create directories.
2019-08-11 22:15:54 +03:00
Cameron Cawley
66ef50cfeb BACKENDS: Rename and simplify AbstractFSNode::create() 2019-08-06 07:17:29 +03:00
Alexander Tkachev
7fc6477ce2 COMMON: Update getHumanReadableBytes() in util.h
Function now casts bytes (as <1024) to unsigned long int to correspond
"%lu" format string. For consistency, KB are now printed as floating
number. Finally, it looks like double is pretty precise to be used in
comparisons, so I made the function a little bit shorter.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
d04c1dfad4 COMMON: Add getHumanReadableBytes() in util.h
This function was used in cloud-related DownloadDialog before,
and now it is also used in Options > Cloud tab.
2019-07-30 14:51:41 -04:00
D G Turner
2d1b4dc977 COMMON: Add Default Values for Joystick State Structure
This ensures that this has a defined value when used without the
engine needing to set the field values directly i.e. as per CGE.
2019-07-24 22:00:26 +01:00
Cameron Cawley
30edabf589 COMMON: Add wrappers for iscntrl() and isgraph() 2019-07-24 22:47:40 +03:00
lolbot-iichan
567a6b20e6 COMMON: Add conversion table for CP1254 2019-07-21 08:51:11 +03:00
Peter Kohaut
377cf606dd COMMON: Fix U32String initialization issues
Bug 1:
If the original C string contained chars > 127 they would be stored
as huge u32 numbers due to the underflow as char is signed.
It still might end-up with invalid UTF32 characters, but now the caller
can control it.

Bug 2:
The inline storage was not properly initialized when U32String was
initalized from shorter non-UTF32 strings.
2019-07-18 01:00:01 +02:00
lolbot-iichan
1dfc637b06 COMMON: Add Turkish language 2019-07-16 20:24:42 +03:00
jepael
3b68380ca3 SDL: Fix compiler warning and joystick event handling 2019-07-13 09:15:41 +03:00
Cameron Cawley
4cf9d1815c COMMON: Open the main menu when the joystick START button is pressed 2019-07-08 01:24:55 +03:00
Cameron Cawley
30109816fe SDL: Initial implementation of joystick events 2019-07-08 01:24:55 +03:00
Le Philousophe
3a7219fa57 JANITORIAL: Avoid C4121 warnings in MSVC by reordering fields
C4121 is about 'symbol': alignment of a member was sensitive to packing
2019-06-30 21:43:58 +03:00
lolbot-iichan
747ace78fc COMMON & WINTERMUTE: Use non-1252 for 125X games (PR 1698)
* WINTERMUTE: Add detection for "The Driller Incident"

"The Driller Incident" is a small freeware game for Wintermute,
avaliable in English and Russian: http://questzone.ru/enzi/files/1645

* WINTERMUTE: Add detection table for "One Helluva Day" demo

"One Helluva Day" is a point-and-click adventure demo in English / Czech
/ Russian.
Free download:
https://store.steampowered.com/app/603680/One_helluva_day/

* WINTERMUTE: Support CHARSET property for TT fonts

"// we don't need this anymore" was a mistake =)

Surely, most Wintermute games are either designed for 1252 language
(DE_DEU, EN_ANY, ES_ESP, FR_FRA, IT_ITA, PT_BRA), or don't use TrueType
fonts (5ma, deadcity, grotter1, grotter2, thekite, tib), or use
CHARSET=1 with UTF strings (dirtysplit, reversion1, reversion2, twc),
which meen this conversion is not needed for those games.

However, there are some games that explicitly states CHARSET=10 (driller
(RU_RUS), oknytt (RU_RUS), onehelluvaday (UNK_LANG when playing as
Russian)) and there are some games with CHARSET=1 with non-1252 in mind
(bookofgron (RU_RUS excepts 1251), carolreed4 (RU_RUS excepts 1251),
kulivocko (CZ_CZE excepts 1250)).

This fixes text in some games: bookofgron, carolreed4, driller, kulivocko,
oknytt, onehelluvaday.

* WINTERMUTE: Break savegame compatibility

sizeof(BaseFontTT) was changed, so let's break savegame compatibility

* COMMON: Add conversion tables for win1253 and win1257

* COMMON: Add string conversion from U32String back to Common::String

convertUtf32ToUtf8 code is based on Wintermute::ConvertUTF32toUTF8
convertFromU32String use convertUtf32ToUtf8 for UTF8 or lookup through
conversion table for single-byte encodings

* WINTERMUTE: Use Common::convert functions for non-UTF charsets

* WINTERMUTE: Fix whitespaces at detection tables

* WINTERMUTE: Add TODO comments
2019-06-30 16:45:46 +03:00
Cameron Cawley
b9e29cedfc ANDROID: Move isConnectionLimited into OSystem 2019-06-21 08:19:37 +03:00
Le Philousophe
97397bdaff STREAM: add read/write functions for double LE/BE 2019-06-01 22:43:48 +02:00
Bastien Bouclet
fd4fa5e899 COMMON: Fix a memory leak in Common::DumpFile 2019-06-01 13:59:08 +02:00
Paul Gilbert
105a1b94bd GLK: TADS2: Added code for output, run, various miscellaneous 2019-05-24 18:21:06 -07:00
Paul Gilbert
e2f68e2403 COMMON: Fix seek return values, memory stream use in create_titanic 2019-05-12 11:44:15 +03:00
Paul Gilbert
b821e8fce4 COMMON: Changed DumpFile & StdIOStream to derive from SeekableWriteStream 2019-05-12 11:44:15 +03:00
Paul Gilbert
f4dacdf34d COMMON: Created SeekableWriteStream class 2019-05-12 11:44:15 +03:00
Cameron Cawley
8c2b09d919 COMMON: Replace NEResourceType and PEResourceType with a shared enum 2019-05-01 23:52:56 +03:00
Cameron Cawley
d7b2b1b8f9 GUI: Support adding games via Drag and Drop 2019-04-30 22:17:04 +01:00
jepael
7e18d4c28d COMMON: Fix compiler warning
Cast the string character type to native type for comparison.
2019-04-21 22:19:58 +01:00
Cameron Cawley
bcef809e61 WINCE: Fix compilation 2019-04-15 08:06:39 +03:00
Bastien Bouclet
0f57aea2df COMMON: Use a prefix table to speed up the Huffman decoder
Symbols for codes shorter than the prefix table index width are stored
in the table. All the entries in the table with an index starting with
the code are set to the symbol value. That way, when decoding it is
possible to get the number of bits corresponding to the table width from
the bitstream and directly find the symbol value. Longer code still need
to be searched for in the codes list.
2019-04-13 16:24:25 +03:00
Bastien Bouclet
ae9eeb731f COMMON: Rework the BitStream class to improve its performance
* Fixed peekBits not to seek the underlying stream. Seeking can be slow
  when the stream is a file.
* Changed multi-bit  operations to work on multiple bits at once rather
  than iterating over single-bit operations.

This is an almost direct port of a patch for xoreos provided by DrMcCoy.
2019-04-13 16:24:25 +03:00
Andrei Prykhodko
8469b8749c COMMON: fixed reading ini files with section containing more than one word 2019-04-09 21:02:29 +03:00
Cameron Cawley
09dbe7686b JANITORIAL: Update all scummvm.org URLS to use https 2019-03-09 21:52:14 +01:00
sluicebox
85333d8050 COMMON: Allow '\#' to match '#' in matchString
matchString patterns couldn't be used to find files with the # character
as it was only treated as a digit wildcard. SCI expected that to work as
it looks for files that start with the # character.
2019-03-03 22:44:29 +02:00
Cameron Cawley
5d912b6923 COMMON: Add WRITE_UINT24 2019-03-02 07:29:22 +01:00
Bastien Bouclet
662791a961 COMMON: Include hidden files in directory listings by default
Hidden files are now only ignored in the GUI file browser when the user
has not checked 'show hidden files'.

Myst III has the hidden flag set for one of the directories containing
datafiles on the CD-ROM. When users copy the files to their hard drives
the hidden flag is kept. Detection worked previously because hidden
files were explicitly requested in the AD code. The engine would fail
to open the datafiles because SearchMan.addSubDirectoryMatching
ignored hidden directories.
2019-01-30 06:48:32 +01:00
Bastien Bouclet
26d0935b9f COMMON: Remove usage of ScopedPtr in OutSaveFile
It's not very useful. However this is mostly to test the theory that the
build failure we've been experiencing in
engines/scumm/he/logic/football.cpp with the osx builder on buildbot is
related to the size of the intermediary assembly source file.
2019-01-05 12:02:19 +01:00
Paul Gilbert
7643382ff4 COMMON: Suport String in U32String assignment & equality operators 2019-01-01 00:40:17 -08:00
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