Commit Graph
105 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 3ab2f49a92 Audio: Avoid creating same-rate resamplers
Each resampler allocates an input buffer and an output buffer.

Since we create ~100 audio stream objects (1 per `sfx_MISC` effect),
the memory cost of these buffers adds up.

Avoids creating a resampler when the audio sampler rate matches the
output sample rate. This is mostly the case when the output sample
rate is 22050.
2023-01-19 13:09:31 +01:00
Gleb Mazovetskiy 9db80ef5d7 Assets: Load files directly for UNPACKED_MPQS
When using `UNPACKED_MPQS`, avoid all the SDL machinery for reading
files.

This is beneficial not only due to reduced indirection but also because
we can test for the file's existence and get the file size without
opening it, which is much faster.
2022-11-22 02:44:25 +01:00
Anders Jenbo 872456ae5d Use size_t for a select few pnum variables 2022-08-26 13:22:04 +09:00
Stephen C. Wills a06dd25d17 Synchronize player inventories (#5217)
* Synchronize item placement in player's backpack

* Synchronize item remove from player's backpack

* Synchronize item placement and removal from player's belt

* Set up loopback network provider for failing tests
2022-08-20 16:30:40 +00:00
Gleb Mazovetskiy 961866e1c4 CLX: A new graphics format
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.

This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.

Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
2022-08-03 02:38:55 +02:00
Anders Jenbo f6f05da485 Clean up game name and password variables 2022-07-16 20:15:07 +02:00
Anders Jenbo acc4f27f63 Remove last usage of DWORD 2022-07-16 09:39:50 +02:00
Cesar Canassa e538acb248 📝 Fixes Doxygen warnings (#4904) 2022-07-07 12:51:24 +02:00
Anders Jenbo 72656b3011 Move path and palette to the engine folder 2022-06-24 16:34:20 +02:00
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +02:00
Gleb Mazovetskiy 4cdbd358dd Audio: Use SDL resampler where available 2022-04-16 04:20:47 +02:00
obligaron 1f7b0607a6 public game browsing: show difficulty, speed, players and possible incompatibility 2022-02-20 12:18:31 +01:00
obligaron 79b926c375 Move more options to OptionEntryBase 2022-02-05 20:51:54 +01:00
staphen 6418d7a2f0 Detect window focus state to mute automatically when starting audio 2022-01-18 13:13:31 +01:00
staphen a7bca3a1ec Extend window focus mute to cinematic audio 2022-01-18 13:13:31 +01:00
obligaron 0888546d62 Make DvlNet_SendInfoRequest non blocking 2022-01-06 13:16:23 +01:00
obligaron 8a4d4b6375 Add OptionEntries for Audio 2021-12-14 04:10:16 +01:00
Gleb Mazovetskiy d99dd678e2 storm_svid: Cleanup video rendering code
1. Removes adjustments to `orig/system_palette`.
   They're not needed because videos have a separate render loop.
   For an in-game movie, the caller sets the palette after the movie.

2. Splits some of `SVidPlayContinue` code into functions
   (`UpdatePalette` and `BlitFrame`).
3. Adds a separate config variable for SDL1 SVid video mode.
   E.g. on rg99 there isn't enough video RAM for double-buffering
   the main game but we can do it for the videos.
2021-12-12 17:30:48 +01:00
Gleb MazovetskiyandAnders Jenbo 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 <[email protected]>
2021-11-24 23:44:12 +01:00
staphen 25afdee39b Replace libsmacker with libsmackerdec 2021-11-23 21:04:10 +01:00
Anders Jenbo 799f1763af Performce UTF8 aware limited string copies 2021-11-22 03:28:51 +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 ac18696af6 Fix loading translation packs 2021-10-26 00:46:06 +02:00
staphen ffbbcc6d62 Support unencrypted multiplayer games with no password 2021-10-25 01:14:37 +02:00
Gleb Mazovetskiy a97ffd1640 Load MPQ file overrides without StormLib
Also logs the overrides in verbose mode.
2021-10-24 16:21:39 +01:00
Gleb Mazovetskiy 7d91bc461a Improve asset file opening
Avoid wrapping asset files via StormLib, open them directly via SDL
instead.
2021-10-24 16:21:39 +01:00
Anders Jenbo 272049380c Fix building on Debian 2021-10-21 23:49:18 +02:00
Anders Jenbo 508cfabcdb Load langauge specific mpq files 2021-10-21 03:56:21 +02:00
Anders Jenbo 82657e7d21 Use APK as a last fall back to other file access methodes 2021-10-20 21:52:59 +02:00
Anders Jenbo 8df5912dc6 Always use SDL wrapper for file access 2021-10-20 21:52:59 +02:00
Anders Jenbo 2480fbac21 Use correct lenth when forcing lowercase of asset path 2021-10-12 21:05:19 +02:00
Anders Jenbo ae90193136 Game discovery over ZeroTier 2021-10-12 19:24:37 +02:00
obligaron 8dd5fcfc8f Search app assets folder in SFileOpenFile 2021-10-10 00:51:45 +02:00
staphen 393d6d7fbe Free dvlnet resources when game is shutting down 2021-10-01 06:52:16 +02:00
staphen 60492ef954 Add proper graphics for gamepad 2021-09-16 19:25:31 +02:00
Vladimir Olteanu bcd7f89319 Have SDLWrap::AllocPalette allocate space for 256 colors by default 2021-09-13 23:07:04 +02:00
Vladimir Olteanu e14504ae56 SVidPlayContinue: use SDLWrap::ConvertSurface* 2021-09-13 23:07:04 +02:00
Vladimir Olteanu d226885672 Introduce SDLWrap::AllocPalette 2021-09-13 23:07:04 +02:00
Vladimir Olteanu cc9ea97e0f Introduce SDLWrap::CreateTexture 2021-09-13 23:07:04 +02:00
Vladimir Olteanu e9063c578f Introduce SDLWrap::CreateRGBSurfaceWithFormatFrom 2021-09-13 23:07:04 +02:00
Anders Jenbo a207644d88 Rename HaveAudio to HasAudio 2021-08-30 10:57:59 +02:00
Vladimir Olteanu f1490b7826 Fix mem leak in storm.cpp 2021-08-17 17:49:08 +02:00
Vladimir Olteanu fae1e4eee5 Replace CCritSect with SdlMutex 2021-07-21 08:10:46 +02:00
Anders Jenbo 0889780923 Remove more usage of miniwin types 2021-07-18 02:11:58 +02:00
Jonathan Bergeron 33ad9fa187 renamed Source/mainmenu.cpp and .h to menu.cpp/.h 2021-07-18 01:31:15 +02:00
Anders Jenbo a19e7b2a3b Remove some more use of miniwin 2021-07-17 23:54:13 +02:00
Anders Jenbo 2ca6e37c46 Clean up sub folders using clang-tidy/Android Studio 2021-07-08 03:30:25 -07:00
ephphatha 3520dc4201 Update numeric literals to use appropriate suffix
Mainly things like .F for floats instead of doubles in float context.
2021-07-05 08:52:05 -07:00
Anders Jenbo a7c7fa0030 Fully apply clang-tidy/format to all files 2021-07-03 16:41:43 -07:00