18 Commits
Author SHA1 Message Date
obligaron 780015bfd4 Fix warnings in MpqWriter 2023-12-21 20:55:45 +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 74755c8be7 Remove utils/stdcompat/cstddef.hpp 2023-08-14 01:54:29 +01:00
Gleb Mazovetskiy c858ab4d2c Fix some compilation warnings
also removes a couple of unused filesystem includes
2023-03-12 13:21:40 +00:00
Gleb Mazovetskiy f2cb9f0fa0 file_util: Implement RecursivelyCreateDir
With this, we no longer require `std::filesystem` support to create the
save file directory when it does not exist.

Note that by default the save file directory exists because it is
created by SDL, so this is mostly useful on platforms that override the
save directory or use `UNPACKED_SAVES`.
2023-03-11 17:47:29 +00:00
Gleb Mazovetskiy 1a1a282d9a Use C FILE instead of C++ streams throughout
Reduces binary size by ~2 KiB and may improve compatibility with oddball
systems (e.g. PS2).
2023-02-15 18:15:07 +00:00
Gleb Mazovetskiy 8fe8023542 Create save and config directories
If a config directory did not exist, the ini file was
not saved at all.

Only implemented for targets that support `std::filesystem` or `std::experimental::filesystem`.
These are all the targets except nxdk and iOS (only supported on iOS 13+).
2023-01-12 03:28:28 +00:00
Gleb Mazovetskiy ea1087dfeb Use StrCat in a few more places
Now `fmt` is only used for more complex formatting and for translations.
2022-07-17 20:43:00 +02:00
Gleb Mazovetskiy 04c3d85179 Remove MAX_PATH
Rather than using the Windows-like `MAX_PATH`, what we really want is 2
things:

1. Maximum path of a file in an MPQ. This is now `MaxMpqPathSize`.
2. Max size for the known monster paths. This is now 64 for sounds and
   TRNs, which is more than enough (picked arbitrarily).
2022-07-16 11:14:16 +01:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Gleb Mazovetskiy 197e1180b2 Add StrCat and StrAppend
Adds simple string / integer concatenation functions.

Many of the uses of `fmt::format` are simply concatenation
of a few strings and integers.

`StrCat` is an easier-to-read alternative to such uses of `fmt`.
2022-07-10 06:14:58 +02:00
Gleb Mazovetskiy ac15c3bbb4 MpqWriter: No std::ios::in for new archives 2022-07-06 13:25:51 +01:00
Gleb Mazovetskiy a23ad0113b MpqWriter constructor: Better error message 2022-07-06 13:25:51 +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
obligaron 7afe7d2a70 Save Methods in loadsave gets MpqWriter passed 2022-06-16 09:43:34 +02:00
Gleb Mazovetskiy 0bddde1644 Reduce debug log output of MpqWriter 2022-04-11 23:35:03 +02:00
Gleb Mazovetskiy 8d74b99c72 MpqWriter: Cleanups and renames
I've spent some time understanding how the `MpqWriter` works
and cleaned it up a bit and renamed some variables for clarity.

1. Fixes all signedness and clang-tidy warnings.
2. Renames variables, structs, and methods for clarity.
3. Marks structs used for I/O as packed.
4. Adds comments in a few places.
5. Eliminates recursion from `MpqWriter::AllocBlock` (a clang-tidy
   warning).
2021-12-11 19:41:53 +00:00
Gleb Mazovetskiy 720d210d95 utils/mpq* -> mpq/* 2021-11-17 11:49:57 +01:00