Commit Graph
244 Commits
Author SHA1 Message Date
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
Gleb Mazovetskiy 680ab5ec40 Overhaul backbuffer state handling
When rendering directly to the output buffer, we need to maintain the
state of what has been drawn and what needs redrawing per-buffer.

We previously tried to do it implicitly by checking `SDL_DOUBLEBUF` and
other flags. The previous implementation was broken in several
ways, resulting in rendering issues on devices that support 8-bit output
directly.

Changes this mechanism to explicitly maintain buffer state per output
buffer. The new mechanism doesn't require knowledge of the number of
buffers, and thus also works correctly with triple-buffering.

Fixes #5447
2022-11-01 02:43:24 +00:00
Gleb Mazovetskiy 41f43ea3f5 Support unpacked MPQs from devilutionx-mpq-tools
https://github.com/diasurgical/devilutionx-mpq-tools produces an unpacked MPQ
with all the graphics converted to CLX and the unused files removed.
This is primarily useful on RAM-constrained platforms, such as PS2,
because it eliminates the MPQ overhead.

Adds a build option to load from such unpacked directories instead of the MPQ.

These directories are searched for in the same locations
where the MPQs would be searched for otherwise.

Example directory layout:

* /usr/local/share/diasurgical/devilutionx/diabdat/ -- unpacked and converted diabdat.mpq
* /usr/local/share/diasurgical/devilutionx/hellfire/ -- unpacked and converted hellfire MPQs (all of them merged into 1 directory)
* /usr/local/share/diasurgical/devilutionx/fonts/ -- unpacked fonts.mpq
* /usr/local/share/diasurgical/devilutionx/pl/ -- unpacked pl.mpq

These directory structure is produced by calling `unpack_and_minify_mpq`
2022-10-11 18:00:57 +01:00
Gleb Mazovetskiy 9feb3139e2 Add XDG_DATA_DIRS to MPQ search paths
Fixes #5304
2022-08-29 15:12:27 +01:00
staphen a3e94d6b55 [Switch] Bundle assets directly in romfs 2022-08-21 06:41:35 +02:00
Anders Jenbo df45bd28d7 Do not try to load devilutionx.mpq on 3DS 2022-08-21 06:41:35 +02:00
staphen 5a2b167728 [3DS] Bundle assets directly in romfs 2022-08-21 05:41:04 +02:00
Gleb Mazovetskiy 2d0d7ccc88 Reinitialize hardware cursor on window size change 2022-08-08 12:05:59 +01:00
Gleb Mazovetskiy ba34bafb3f Use SDL events directly
Removes redundant miniwin events and queue, using SDL events directly instead.

Demo migrated using this script: https://gist.github.com/glebm/8a73b04f695de96f344cc2e35151e03e
2022-08-03 03:50:19 +02:00
obligaron ebfb519ee0 Rename gbQuietMode to HeadlessMode 2022-07-13 18:54:36 +02:00
obligaron bab9baa42a Handle gbQuietMode for paths in StartGame 2022-07-13 18:54:36 +02:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Anders Jenbo a7be622aa3 Clean up naming of event handler 2022-07-10 21:13:39 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Anders Jenbo c7f19336c9 [xbox] Initialize the video system and specify search path 2022-07-09 18:50:53 +01:00
Gleb Mazovetskiy 4063afb792 Xbox NXDK platform 2022-07-09 18:50:53 +01:00
Gleb Mazovetskiy 72660d9189 Migrate snprintf to fmt (#4845)
* Migrate `app_fatal` from printf to libfmt
* Migrate snprintf to fmt
2022-07-02 02:36:17 +02:00
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +02:00
obligaron 7afe7d2a70 Save Methods in loadsave gets MpqWriter passed 2022-06-16 09:43:34 +02:00
Gleb Mazovetskiy 779ccaca17 Overhaul translation fetching
1. Do not modify the map after loading. Instead, return string views
   (guaranteed to be null-terminated) from look up functions and return
   the key directly if not found.
2. Use an `unorded_map` instead of `map` where available (C++20).
   Saves a bit of RAM (~50 KiB) and improves lookup performance.
2022-06-14 12:46:36 +01:00
Dmitry Marakasov 446ec5f95d check for either linux or BSDs as defined(__unix__) 2022-05-18 17:39:07 +02:00
obligaron c6c929a90c Remove MpqDir and use PrefPath instead. 2022-04-10 17:06:45 +02:00
staphen 56af849632 Use romfs on Switch for devilutionx.mpq 2022-04-09 03:23:42 +02:00
Anders Jenbo 1409e604f5 Reduce string conversions 2022-03-20 11:04:15 +01:00
Anders Jenbo a48f89007d Implement stash 2022-03-18 06:01:53 +01:00
Felipe Wannmacher 8efbcf2058 Xbox One/Series support (#3946) 2022-01-17 12:37:29 +01:00
Andrew James d3aedf5df1 Split loading of MPQs to handle translations and voice packs (#3922) 2022-01-08 09:15:39 +01:00
Gleb Mazovetskiy 0f924528ba macOS/iOS: Add resources to the bundle 2021-12-05 20:33:24 +01:00
obligaron 945ee04f62 Add OptionEntry Language 2021-11-28 19:08:10 +01:00
obligaron b3740012b0 Add init_language_archives() to reinitalize lang_mpq 2021-11-28 19:08:10 +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
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 720d210d95 utils/mpq* -> mpq/* 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 fa4321adcc Do not probe for devilutionx.mpq on Android
Android loads the assets from the APK instead
2021-10-26 01:18:41 +02:00
Anders Jenbo ac18696af6 Fix loading translation packs 2021-10-26 00:46:06 +02:00
Gleb Mazovetskiy 7e230df94a Allow forcing Hellfire with command-line flags
This is useful for systems such as batocera.linux that have dynamic
launcher items that depend on the presence of the appropriate MPQ files.
2021-10-25 13:52:14 +01: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 5d53910127 Verbose log base/pref/config/assets paths 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
obligaron a0b14e43fe Ensure SFileSetAssetsPath is called before InsertCDDlg is called 2021-10-21 18:39:20 +02:00
Anders Jenbo e69853487d Correct name of font mpq 2021-10-21 13:14:25 +02:00
Anders Jenbo 508cfabcdb Load langauge specific mpq files 2021-10-21 03:56:21 +02:00
Anders Jenbo 8df5912dc6 Always use SDL wrapper for file access 2021-10-20 21:52:59 +02:00
obligaron 8dd5fcfc8f Search app assets folder in SFileOpenFile 2021-10-10 00:51:45 +02:00
staphen e5d32da8a2 Load font file from devilutionx.mpq 2021-09-30 09:48:15 +02:00
Cong 6091c3f3c2 Add GOG installation paths to game data search paths (fixes #2709) (#2748) 2021-08-30 12:00:21 +00:00
Vladimir Olteanu f1490b7826 Fix mem leak in storm.cpp 2021-08-17 17:49:08 +02:00
ephphatha aec1491c98 Close devilutionx_mpq instead of trying to close patch_rt_mpq twice 2021-08-08 16:19:31 +02:00