Commit Graph
19 Commits
Author SHA1 Message Date
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 6d274c9547 UNPACKED_SAVES: Saves without MPQs
Reduces rg99 binary size by ~70 KiB.
2023-01-18 23:40:30 +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 67581033d7 Remove "MpqFileRwRead beyond EOF by %u" warning
It spams the debug log but is not really an error from what I understand
2022-04-09 14:15:55 +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 a4bc8fea7d Fix warnings: -Wsign-compare, -Wnarrowing 2021-12-08 23:03:20 +00: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
Gleb Mazovetskiy 720d210d95 utils/mpq* -> mpq/* 2021-11-17 11:49:57 +01:00