274 Commits
Author SHA1 Message Date
Anders Jenboandstaphen 6f319978e6 Migrate from libmpq to mpqfs (#8482)
Co-authored-by: staphen <[email protected]>
2026-03-30 00:14:11 +02:00
Gleb Mazovetskiy 1bbe8bfe08 SDL3: Even more migration 2025-10-09 01:28:37 +01:00
Anders Jenbo 1c76897f2c Apply simple const rules using clang-tidy 2025-08-16 01:21:36 +02:00
Nick Wicked 120993c9a9 Fix Automap movement being hardcoded to right stick on gamepad (#7921) 2025-08-14 23:19:08 +02:00
Gleb Mazovetskiy 58fe44f836 init.h -> init.hpp 2025-05-18 22:37:09 +01:00
Gleb Mazovetskiy b890edfd56 Support mods with UNPACKED_MPQS 2025-05-18 22:37:09 +01:00
Anders Jenbo 96112e675b Handle loaded MPQ files in a map instead of bespoke globals (#7887) 2025-04-07 17:17:05 +02:00
Gleb Mazovetskiy d94bc424df sgOptions -> GetOptions()
In C++, globals initialization order accross translation units is not
defined. Accessing a global via a function ensures that it is initialized.

This will be needed for #7638, which will statically initialize change
handlers after the Options object has been initialized.
2025-01-13 11:57:25 +00:00
Gleb Mazovetskiy d7647d6c63 More dependency untangling
1. Moves more assets-related stuff from `init` to `engine/assets`.
2. Removes `SDL_audiolib` dependency from `soundsample.h`.
3. Cleans up some unused/missing includes.
2025-01-09 18:19:44 +00:00
Gleb Mazovetskiy a7651f15d9 Extract HeadlessMode from diablo.h
Untangles some dependencies.
Many places that use `HeadlessMode` do not need all of `diablo.h`.
2025-01-09 12:21:26 +00:00
Gleb Mazovetskiy b76feb2be3 Extract game mode out of init.cpp
Untangles some dependencies
2025-01-09 11:02:19 +00:00
Gleb Mazovetskiy affd7e86e6 Move MPQs from init to engine/assets
Untangles some of the dependencies.
2025-01-08 06:03:29 +09:00
Gleb Mazovetskiy b68f59d002 OSX: Fix base/pref/config paths on Tiger 2024-12-12 03:20:31 +01:00
Gleb Mazovetskiy 7d5bef724d Check DevilutionX version
This is similar to how we handle extra fonts
2024-08-15 00:53:21 +01:00
djvs a6e2481a3e Option to not pause the game when the window loses focus (#7046) 2024-04-18 00:25:55 +02:00
Gleb Mazovetskiy 1bcdd17e34 Reduce verbose SDL_WINDOWEVENT event log spam 2023-10-14 00:14:42 +02:00
Gleb Mazovetskiy c7fefd74b6 LoggedFstream: Fix OpenFile error check
Fixes #6626
2023-09-20 13:49:17 +01:00
Gleb Mazovetskiy 040c4fe82f Generalize support for Windows without wchar APIs
Replaces `NXDK` ifdefs that relate to the lack of wchar APIs
with the more general `DEVILUTIONX_WINDOWS_NO_WCHAR` ifdefs.

This should make it much easier to port to Windows 98.
2023-09-17 07:26:29 +01:00
Gleb MazovetskiyandStephen C. Wills 4d0341afb5 net: Replace packet_exception with tl::expected
The network code still has ways to go to get rid of exceptions,
this is but a small first step.

Co-authored-by: Stephen C. Wills <[email protected]>
2023-09-15 18:32:56 +01:00
Gleb Mazovetskiy 16a6fc62e1 Deduplicate some of the MPQ handling
Reuse libmpq functions where possible instead of our own.
2023-09-10 02:16:15 +01:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +01:00
Gleb MazovetskiyandStephen C. Wills 9d96eea86b De-duplicate extra fonts version check code
Co-authored-by: Stephen C. Wills <[email protected]>
2023-07-16 06:02:19 +02:00
staphen 22fdeaf2f0 Use JNI to check VERSION file in fonts.mpq 2023-07-16 06:02:19 +02:00
Anders Jenbo 4eb07c9237 React to SDL_WINDOWEVENT_RESTORED 2023-06-13 01:17:55 +02:00
Gleb Mazovetskiy 5bf0b8bc96 Add more missing <cstdint> includes
https://github.com/diasurgical/devilutionX/pull/6095 only added includes
for `uint32_t`, this PR also adds the includes for the remaining
integral types.
2023-05-10 16:29:27 +01:00
obligaron a632d733c3 Update gbActive correctly when minimizing the app 2023-05-07 00:47:48 +02:00
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00:00
Gleb Mazovetskiy 6d274c9547 UNPACKED_SAVES: Saves without MPQs
Reduces rg99 binary size by ~70 KiB.
2023-01-18 23:40:30 +00:00
Gleb Mazovetskiy f085af70ca Add paths::ConfigPath to the MPQ search list
This mitigates the situation where providing `--save-dir`
result in no ~/.local/share/diasurgical/devilutionx in the search path
2023-01-12 03:38:29 +00:00
Gleb Mazovetskiy 56f94c7471 Add a --lang command line argument
This allows forcing the locale without changing the settings.

The `forceLocale` option also lets us avoid changing the locale in settings if fonts.mpq is missing, fixing the following scenario:
1. System locale is ja
2. Launch the game -- fonts are missing
3. Close the game, download fonts.mpq
4. Launch the game again -- it is now in English because the settings have changed
2022-12-10 02:26:11 +00: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
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