Commit Graph
217 Commits
Author SHA1 Message Date
Walter Agazzi dfb4598c31 AGS: Common: fix String::Trim*() to avoid asserts for extended chars
This complements 82abea8
From upstream 82ffab07df0bdf4a016addcc6050ba7f2b5e8fdc
2024-03-28 12:00:55 +01:00
Walter Agazzi 5d7c835c53 AGS: fixed wrong offset calculation when writing TRA
This was broken at some point... see commits:
f93f44c, e74b5ca
From upstream f49c8c90a198dbe187d811ea861afd19f094acdd
2024-03-28 12:00:55 +01:00
Walter Agazzi 0f438f51c7 AGS: Common: fix String::IsNullOrSpace() to avoid asserts for extended chars
From upstream 4aa8d0ce7324dafcbd528ca904189604c5a9fe0d
2024-03-28 12:00:55 +01:00
Walter Agazzi 4eaac90e4e AGS: Common: safer reading of fixed-len string fields
From upstream 458a524a418f30142f5fe2e512902b7e00e97eec
2024-01-17 03:12:30 +01:00
Walter Agazzi a7266499a5 AGS: Engine: misspelling fix: perfomance->performance
From upstream c4cf67ac5bc5ac3463609eeefea16c1caa8abab9
2024-01-17 03:12:29 +01:00
Le Philousophe 728b2cbac7 AGS: Migrate engine to Path 2023-12-24 13:19:25 +01:00
Le Philousophe db5041ecb0 COMMON: Make savepath a Path object 2023-12-24 13:19:25 +01:00
Walter Agazzi 531a915261 AGS: Engine: hotfix config failing at cs filter names in "disabled"
From upstream 79847cc5e59236cfd93d6d98218c01d5f3cfa03f
2023-11-02 20:06:27 +01:00
Walter Agazzi 808b90b39f AGS: Common: fixes for CreateAllDirectories, Path::GetParent, GetFilename
Partially from upstream 3086f1b19d6d6a01c7f32871161cea6e5e3c13d8
2023-08-13 10:58:26 +02:00
Lars Sundström 49e30c93cd AGS: Remove function FileCloseNotify
In AGS there is a possibility to define a function, FileCloseNotify
with arguments, which is called when closing a file. This possibility
seems not to be used by any of the engines supported by ScummVM since
it's set to nullptr. This is not a problem in itself. Hoewever when
enabling compiler optimisiations the compiler may optimise away the
FileCloseNotify definition. This was discovered when compiling iOS
with Apple Clang in "Release" mode that the if-case in the code block
below was removed while the args parameter was left:
    if (FileCloseNotify) {
         CloseNotifyArgs args;
         args.Filepath = _fileName;
         args.WorkMode = _workMode;
         FileCloseNotify(args);
     }

This caused a nullptr exception since FileCloseNotify was nullptr.
A bit strange behavior by the compiler which could remove the entire
code block above.

Since the FileCloseNotify is not used in ScummVM, remove it as it
only seems to be used in upstream by the emscripten code which is
not part of the ScummVM repository.
2023-07-21 16:48:03 +02:00
Walter Agazzi 7c96b06aa6 AGS: Common: fixed memory leak in String::ReverseUTF8()
From upstream 57e866411b77af9e3a942bccf4a8c59bfa3d12cd
2023-05-14 23:04:38 +02:00
Walter Agazzi 1b3a417e75 AGS: Common: in IniFile replaced string indexes from int with size_t
This is long overdue since String class changed int indexes to size_t.

From upstream b81f9e31e8b8bbbbf46e570427d16deea5102d3a
2023-04-29 13:11:41 +02:00
Walter Agazzi 53a472650d AGS: Common: moved iagsstream to util dir (api dir proved to be excessive)
From upstream 2de0701f47cb189b51aa429cd8ef4812b6dae9ef
2023-04-29 13:11:41 +02:00
Walter Agazzi 7d7a6c6b4e AGS: Engine: improvements to ValidateWindowSize()
Screen limits are hardcoded in ScummVM's implementation, so this function
does not really validate anything
Partially from upstream cbe729f93c9b204db41ddd1b28c455d4a98ff703
2023-04-29 13:11:41 +02:00
Walter Agazzi 3b37a13af6 AGS: Common: in ConvertUtf8ToAscii() fallback to strcopy if setlocale failed
setlocale equivalent is not actually implemented so this does nothing
From upstream f4bd0604c73aad7ecf05bf6e3f22dbe161434b2c
2023-04-29 13:11:41 +02:00
Walter Agazzi a8df307602 AGS: Common: add Close Notify to FileStream
- with FileStream::FileCloseNotify we can run an event when a file closes
- the arguments are a struct so we can expand them later if needed easily

From upstream 2c170cacb84f56004d86d8e981710777c9c09554
2023-04-29 13:11:41 +02:00
D G Turner be309e97eb AGS: Fix GCC Compiler Warnings 2023-03-12 20:58:29 +00:00
Walter Agazzi cd43ec26ed AGS: Common: wrong clamping in memory stream
From upstream 020189c4c3e8be9c68fb9f6c0896c7d3506d1113
2023-03-12 20:58:28 +00:00
Walter Agazzi a76b930e87 AGS: Common: bufferedstream add default and remove unused break
From upstream 957ad1ad7cb2d1df396f57de52c3808c28c53bb6
2023-03-12 20:58:28 +00:00
Walter Agazzi 16658128f6 AGS: Common: revert lzwexpand to expanding to mem, for better speed
This somewhat reverts 2b9f130 , while keeping tidier code and safer args.

Switching from lzwexpand_to_mem to using streams only caused speed
regression, which became notable for hi-res games with LZW sprite
compression (a 3.6.0 feature).
For this revert we instead load compressed data into a buffer in whole,
then pass two memory buffer pointers to lzw_expand, where it reads
and writes memory directly.
Testing a high-res (1920x1080) game with lots of sprite streaming
showed speed improvement of this function by around 200%.
The downside is the temporary buffer for reading compressed
data too.
In theory, same could be done for lzwcompress afterwards.

From upstream 6959004676916568c6fca210702d669f61741e13
2023-03-12 20:58:28 +00:00
Walter Agazzi 8c6524a888 AGS: Common: fix warns and clang-tidy notices
- using braced initializers for returned invalid objects
partially from upstream 8aeda4b67bf24ce080b09255139e0f6b907a9a8f
2023-03-12 20:58:27 +00:00
Walter Agazzi 73d169c0e4 AGS: Common: fix warnings in directory.cpp
- prefer empty instead of size() == 0
partially from upstream de97ab3e8c14074944c7087cc8e4bc5b15d6f4d6
2023-03-12 20:58:27 +00:00
Le Philousophe 14d3afb297 AGS: Don't check EOS when writing
As the cursor is always at the end of the stream, BufferedStream::EOS()
always return true.
We check for errors when writing so no check is needed here.
2023-02-12 11:17:36 +01:00
Le Philousophe ef4ac3b728 AGS: Fix FileStream::EOS when used on a file opened for writing
EOS should always return false in this case.
2023-02-12 11:17:36 +01:00
Walter Agazzi 5ae3427f9d AGS: Common: simplified MFLUtil::ReadEncInt32(), use conditional function
Apparently, this was already done once in b6b8701, but then broken soon after by a merge 22e3a83 (years ago).
From upstream 50800e0e2aca0b7678af4a24bd6322d82261760f
2023-01-20 14:14:56 +00:00
Thierry Crozat 31c1d49762 AGS: fixed skip_rle_bitmap8() made no sense whatsoever
This fixes loading pre 2.55 games.

From upstream 3df6b7185685bcd6a2d6cbdb7b5c3b62ea5dc9b0
2022-12-17 22:10:55 +01:00
Thierry Crozat 9a14045e0e AGS: Common: fixed linker error at BufferedStream::BufferSize
From upstream 919f14226d1391bdee7ea50ac4825414b4dd5e95
2022-12-15 22:40:17 +01:00
Thierry Crozat 5c8287dfec AGS: Common: fixed BufferedSectionStream not preventing read past end
There have been this stupid oversight all along since the introduction
of the class: while it reported Length and EOS correctly, it still
allowed to read past the end.

This can cause issues if the user code relies, for example, on Read()
or ReadByte() return value.

For upstream code, in practice this fixes MP3 streaming, where the length
of data is not always possible to precalculate. In ScummVM we used a
different code for MP3, but this may fix other cases as well.

From upstream 6f02bedc65b902ce41858b7e92970662020a11cf
2022-12-15 22:40:17 +01:00
Thierry Crozat 7d88a52275 AGS: Engine: fixed restoring a legacy savegame
From upstream 9776df3c8403f252e981f5518c48eace2e83d373
2022-12-15 22:40:17 +01:00
Vladimir Serbinenko db09df7d14 AGS: Support files coming from SearchMan 2022-11-18 01:22:59 +01:00
Vladimir Serbinenko 9caa5324bc AGS: Switch from getFSNode to getFile to hide whether file comes from an archive 2022-11-18 01:22:59 +01:00
Le Philousophe 1f2c78adfe ALL: Make sure str.h is included when using String
Fix all cases working because str.h is included in util.h
2022-10-30 18:37:16 +01:00
Hubert Maier 491d8b0c6e AGS: Correct spelling mistake
accomodate -> accommodate
2022-10-27 15:56:07 +02:00
Hubert Maier 86a8279c59 AGS: Correct spelling mistake
loose -> lose
2022-10-27 15:56:07 +02:00
Le Philousophe ab0854d81a AGS: Don't use unsafe sprintf and vsprintf 2022-10-23 22:46:19 +02:00
Donovan Watteau a82501b638 AGS: Fix ReadEncInt32() on big-endian systems
Fixes kq1agdi crashing on big-endian systems, since it tried to allocate
a gigantic amount of memory from MFLUtil::ReadV21() because of the
misread values.

From upstream 5e29a339fc83bf5c06a3a9a3b1c65a2fc4b4e72c
Also includes upstream 427752da015fd93549deef1a31d5e533e5c9319e
2022-10-03 18:42:58 +01:00
Thierry Crozat e90fb00412 AGS: Replaced more strcpy with snprintf, for safety
From upstream 1b6cf053ebbe85e7ba6c5828e2582d757503bc16
2022-06-19 20:50:24 +01:00
Thierry Crozat 884048108d AGS: Replaced freadstring/fwritestring with safer StrUtil functions
From upstream 73af6bafd2e590956b7a248cf3615c3b6df8dcd2
2022-06-19 20:50:24 +01:00
D G Turner 8af2dc3a8c AGS: Fix Remaining Compiler Warnings 2022-06-17 12:19:37 +01:00
Thierry Crozat 9789a32bac AGS: In BufferedStream skip buffering if reading large chunk at once
From upstream 8137918c209a479edf5127bb7c21d29470b8c40e
2022-06-16 23:16:20 +01:00
Thierry Crozat 98bb288bbe AGS: Fixed BufferedStream may overwrite dest with clear buffer
From upstream 39c8f628575eeabff1ed583b43bd6c58530c6b24
2022-06-15 22:13:02 +01:00
Thierry Crozat 56154c8065 AGS: Made BufferedStream work as expected in writing mode
From upstream 97eebe7b91010ad9e507de5c8b9c2515bb8d6cfd
2022-06-15 02:22:03 +01:00
Thierry Crozat 01dd8d5abf AGS: Clean BufferedStream code
Part of upstream 82a928cb07970acc5918905c5836c39ce11b7f32
(Tests: added BufferedStream tests)

This commit has no functional change but allows to keep the code
in ScummVM close to upstream code.
2022-06-15 02:22:03 +01:00
Thierry Crozat 370e939ad7 AGS: Fixes for MemoryStream: proper seek support for writing mode
From upstream 80a17c94f6fc44955dcee5c559247ea73a8c0a76
2022-06-13 00:30:21 +01:00
Paul Gilbert 2e726fa214 AGS: Removed deprecated globals 2022-05-30 15:23:20 -07:00
Paul Gilbert f93e757aff AGS: Fix global constructor/destructor warnings 2022-05-29 15:44:45 -07:00
Donovan Watteau 5b1ec56f96 JANITORIAL: Fix some lost or outdated URLs in comments 2022-05-19 07:57:31 +03:00
Paul Gilbert 23f8e4f87c AGS: Avoid copying PfnWriteExtBlock in data_ext
From upstream df40976317787b919d2e15a9042e495a911aaa23
2022-05-10 21:18:00 -07:00
Paul Gilbert eb7421400c AGS: Use empty() to check for emptiness in vector
From upstream 166803dd6cb99851e424f9eb9d150169cd3909fe
2022-05-10 21:18:00 -07:00
Paul Gilbert b1649597d7 AGS: Replaced Math/std Min/Max with ScummVM macros
Inspired by 6dee5ee6f271c600e30879d892295ea6069e8cc9
2022-05-05 22:41:10 -07:00