Commit graph

20 commits

Author SHA1 Message Date
Gleb Mazovetskiy
7e1fea6f76 clang-format all files in {Source,test}/
Also includes a few manual tweaks to comments and newlines for better results.

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
2021-11-24 23:44:12 +01:00
Gleb Mazovetskiy
fa90679416 game_assets.* -> assets.* 2021-11-17 11:49:57 +01:00
Gleb Mazovetskiy
3d308983a8 Migrate to libmpq
libmpq is a much simpler alternative to StormLib for reading MPQ archives.

We use our own fork of libmpq: https://github.com/diasurgical/libmpq

Impact:

* DevilutionX is now a lot more portable. Unlike StormLib, libmpq only
  needs platform-specific code for Windows.
* Locks around file access **removed** (instead we duplicate the file descriptor for streamed audio only).
* RAM usage is **300 KiB** lower than StormLib.
* Stripped release linux_x86_64 binary is **32 KiB** smaller.
* Amiga build now hangs instead of crashing.
2021-11-06 23:51:42 +00:00
Anders Jenbo
11e37e972a Port essential parts to use SDL abstraction for file access 2021-10-20 21:52:59 +02:00
Vladimir Olteanu
79d24fa840 Use SDLWrap::CreateRGBSurfaceWithFormat in LoadArt 2021-09-13 23:07:04 +02:00
Anders Jenbo
3c246a5930 Add TRN support to PCX loader 2021-09-12 01:37:28 +02:00
Vladimir Olteanu
2d4a205fef Introduce SDL::CreateRGBSurfaceWithFormat 2021-08-19 08:51:59 +02:00
Gleb Mazovetskiy
3e5a593021 🐞 Fix reading PCX files with odd widths
PCX files always have an even number of bytes on each uncompressed source line, which means there is an unused byte of each compressed line if the width is odd.

References:

1. https://kaba.hilvi.org/pastel-1.5.0/pastel/gfx/image_file/pcx/pcx_file.htm
2. https://www.moon-soft.com/program/FORMAT/graphics/pcx.htm#decoding%20.pcx%20files
2021-08-04 23:33:11 +02:00
Anders Jenbo
0889780923 Remove more usage of miniwin types 2021-07-18 02:11:58 +02:00
Gleb Mazovetskiy
b76f7656f3 🧹 LoadArt: BYTE -> uint8_t
The change in include order necessitated a couple of other minor
cleanups, one in stubs.h and one in sdl2_to_1_2_backports.h
2021-05-23 18:45:01 +02:00
Anders Jenbo
a095bc0bf7 ♻️Migrate more code away from miniwin 2021-05-13 02:30:18 +02:00
staphen
3e5e5b2696 Synchronize SFileCloseFile() access 2021-05-08 04:01:07 +02:00
Gleb Mazovetskiy
987ab2533b 🐞 Synchronize SFileReadFile access
StormLib read function is not thread-safe: https://github.com/ladislav-zezula/StormLib/issues/175
2021-05-03 02:35:22 +02:00
Gleb Mazovetskiy
f33f7ae7eb 💨 Do not zero-initalize arrays we write to
`std::make_unique<T[]>(size)` always zero-initalizes the array.

C++20 has `std::make_unique_for_overwrite` to avoid that, while
older C++ versions can use the approach applied here.
2021-05-02 05:52:11 +02:00
Gleb Mazovetskiy
3d03990cb8 ♻️ Replace SBmpLoadImage with a simpler method
The new approach only makes 2 read calls and does not do any seeks.

It is also less general and is internal to `art.cpp`, allowing us to
simplify it somewhat.
2021-05-02 01:28:18 +02:00
Jmgr
1b7e0d2cb3 Migrate existing log entries 2021-04-25 02:39:42 +02:00
Anders Jenbo
191d98207b 🎨 readability-identifier-naming on DiabloUI 2021-04-22 00:50:07 +02:00
Anders Jenbo
bb4e1960e7 🎨 modernize-use-nullptr 2021-04-19 16:02:05 +02:00
Anders Jenbo
5fdb9ce459 🎨 Format code 2021-04-19 00:37:33 +02:00
Anders Jenbo
8c821e98d3 🚚 Restructure files 2021-04-16 03:57:22 +02:00
Renamed from SourceX/DiabloUI/art.cpp (Browse further)